three实现三维3ai级第一人称射击游戏代码

代码语言:html

所属分类:游戏

代码描述:three实现三维3ai级第一人称射击游戏代码,由ai生成。

代码标签: three 三维 3ai 级 第一 人称 射击 游戏 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!doctype html><html lang="en"><head><meta charset="utf-8"><title>Black Tide</title>
<meta name="claude:viewport-fit-sides" content="cover">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Big+Shoulders+Display:wght@500;700;900&family=IBM+Plex+Mono:wght@400;500&family=Barlow+Condensed:wght@400;500;600&display=swap">
<style>
/* game/ui.css — owned by the Game agent. One deliberate dark look (a game viewport): port-authority signage meets a film title card.
   Sections: tokens · page + boot · HUD · radio · touch controls · menus · panel · motion preferences. */
:root {
  color-scheme: dark;
  --ink: #0b0d0f; --ink-2: #14181b; --bone: #e8e4da; --bone-dim: rgba(232, 228, 218, .64); --bone-faint: rgba(232, 228, 218, .24);
  --signal: #ffb347; --signal-hot: #ffc977; --rust: #d2622a; --steel: #8d9aa3; --alarm: #ff5a40;
  --line: rgba(232, 228, 218, .2); --plate: rgba(11, 13, 15, .6); --plate-solid: rgba(11, 13, 15, .9);
  --f-display: 'Big Shoulders Display', 'Impact', 'Haettenschweiler', 'Arial Narrow', sans-serif;
  --f-label: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
  --gl: max(16px, env(safe-area-inset-left, 0px)); --gr: max(16px, env(safe-area-inset-right, 0px));
  --shadow: 0 0 2px rgba(0, 0, 0, .75), 0 1px 5px rgba(0, 0, 0, .55);
}
html, body { height: 100%; margin: 0; }
body { background: var(--ink); color: var(--bone); overflow: hidden; font-family: var(--f-label); -webkit-text-size-adjust: 100%; }
#app { position: fixed; inset: 0; overflow: hidden; background: var(--ink); -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
#app *, #app *::before, #app *::after { box-sizing: border-box; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; touch-action: none; }
#ui { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

/* ---- boot ---- */
#boot { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: var(--ink); transition: opacity .6s ease; z-index: 50;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
#boot.done { opacity: 0; pointer-events: none; }
.boot-mark { font-family: var(--f-display); font-weight: 900; font-size: clamp(40px, 9vw, 96px); letter-spacing: .16em; margin-right: -.16em; color: var(--bone); line-height: 1; }
.boot-sub { font-family: var(--f-mono); font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--steel); text-align: center; }
.boot-bar { width: min(320px, 70vw); height: 2px; background: #23282c; }
.boot-bar i { display: block; height: 100%; width: 0%; background: var(--signal); transition: width .25s ease; }
#fatal { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(10px + var(--sab)) max(16px, env(safe-area-inset-left, 0px)); font: 12px/1.4 var(--f-mono); color: #ffb4a8; background: rgba(40, 8, 4, .85); white-space: pre-wrap; z-index: 99; max-height: 40%; overflow: auto; pointer-events: auto; -webkit-user-select: text; user-select: text; }

/* =====================================================================  HUD  */
.hud { position: absolute; inset: 0; opacity: 0; transition: opacity .35s ease; pointer-events: none; color: var(--bone); text-shadow: var(--shadow); }
.hud.on { opacity: 1; }
.h-k { font: 600 11px/1 var(--f-label); letter-spacing: .26em; text-transform: uppercase; color: rgba(232, 228, 218, .72); }

/* compass */
.h-compass { position: absolute; top: calc(12px + var(--sat)); left: 50%; width: min(420px, calc(100vw - var(--gl) - var(--gr) - 8px)); height: 60px; transform: translateX(-50%); }
.h-tape-wrap { position: absolute; left: 0; right: 0; top: 0; height: 28px; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 16%, #000 84%, transparent); mask-image: linear-gradient(90deg, transparent, #000 16%, #000 84%, transparent); }
.h-tape { position: absolute; left: 0; top: 0; height: 100%; width: 2168px; will-change: transform; }
.h-tape i { position: absolute; bottom: 0; width: 1px; margin-left: -.5px; background: var(--bone); box-shadow: 0 0 2px rgba(0, 0, 0, .6); }
.h-tape i.mn { height: 4px; opacity: .45; } .h-tape i.md { height: 7px; opacity: .8; } .h-tape i.mj { height: 10px; width: 2px; margin-left: -1px; }
.h-tape b { position: absolute; top: 0; transform: translateX(-50%); font-weight: 400; white-space: nowrap; }
.h-tape b.card { font: 700 16px/1 var(--f-display); letter-spacing: .04em; }
.h-tape b.ic { font: 600 11px/1.4 var(--f-label); color: var(--bone-dim); letter-spacing: .08em; }
.h-tape b.num { font: 400 9px/1.7 var(--f-mono); color: var(--bone-dim); }
.h-needle { position: absolute; left: 50%; top: 14px; width: 2px; height: 16px; margin-left: -1px; background: var(--signal); box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); }
.h-heading { position: absolute; left: 100%; top: 9px; margin-left: 6px; font: 500 11px/1 var(--f-mono); color: var(--bone-dim); letter-spacing: .06em; }
.h-cmarks { position: absolute; left: 50%; top: 33px; width: 0; height: 0; }
.h-cm { position: absolute; left: -24px; top: 0; width: 48px; text-align: center; will-change: transform; color: var(--signal); }
.h-cm i { display: block; width: 8px; height: 8px; margin: 0 auto 3px; border: 1.5px solid currentColor; transform: rotate(45deg); background: rgba(11, 13, 15, .5); }
.h-cm b { font: 700 13px/1 var(--f-display); letter-spacing: .06em; margin-right: 4px; }
.h-cm span { font: 400 10px/1 var(--f-mono); color: var(--bone); }
.h-cm.edge { opacity: .55; }
.h-cm.extract { color: var(--bone); } .h-cm.extract i { background: var(--bone); }

/* objective tracker */
.h-obj { position: absolute; top: calc(16px + var(--sat)); left: var(--gl); max-width: min(300px, 42vw); padding-left: 12px; border-left: 2px solid var(--signal); opacity: 0; transition: opacity .3s; }
.h-obj.has { opacity: 1; }
.h-obj-t { font: 600 20px/1.1 var(--f-label); letter-spacing: .05em; text-transform: uppercase; margin: 6px 0 9px; min-height: 22px; }
.h-relays { display: flex; align-items: center; gap: 5px; font: 600 11px/1 var(--f-label); letter-spacing: .22em; text-transform: uppercase; color: rgba(232, 228, 218, .72); }
.h-relays span { margin-right: 4px; }
.h-relays.tally i, .h-relays.tally b { display: none; } .h-relays.tally span { color: var(--bone); letter-spacing: .16em; }
.h-relays i { width: 9px; height: 9px; border: 1.5px solid var(--bone); box-shadow: 0 0 2px rgba(0, 0, 0, .6); }
.h-relays i.cut { background: var(--signal); border-color: var(--signal); }
.h-relays b { font: 500 11px/1 var(--f-mono); letter-spacing: .04em; color: var(--bone); margin-left: 5px; }
@keyframes objflash { 0% { border-left-color: var(--bone); } 100% { border-left-color: var(--signal); } }
.h-obj.flash { animation: objflash .9s ease-out; }

/* wave warning */
.h-warn { position: absolute; left: 50%; top: 21%; transform: translateX(-50%); white-space: nowrap; opacity: 0; color: var(--signal);
  font: 700 clamp(20px, 3.6vw, 38px)/1 var(--f-display); letter-spacing: .24em; margin-right: -.24em; text-transform: uppercase; padding: 9px 0 8px; border-top: 1px solid currentColor; border-bottom: 1px solid currentColor; }
@keyframes warn { 0% { opacity: 0; letter-spacing: .5em; } 8% { opacity: 1; letter-spacing: .24em; } 14% { opacity: .35; } 20%, 82% { opacity: 1; } 100% { opacity: 0; } }
.h-warn.on { animation: warn 3.4s linear both; }

/* crosshair + hit marker */
.h-cross { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transition: opacity .1s; }
.h-cross.off { opacity: 0; }
.h-cross i { position: absolute; left: 0; top: 0; background: var(--bone); box-shadow: 0 0 0 1px rgba(0, 0, 0, .4); transition: transform .06s linear; }
.h-cross .c-t, .h-cross .c-b { width: 2px; height: 9px; transform: translate3d(-50%, 0, 0); }
.h-cross .c-l, .h-cross .c-r { width: 9px; height: 2px; transform: translate3d(0, -50%, 0); }
.h-cross .c-dot { width: 2px; height: 2px; margin: -1px 0 0 -1px; opacity: .85; }
.h-hit { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; transform: translate(-50%, -50%); opacity: 0; }
.h-hit i { position: absolute; width: 2px; height: 11px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); }
.h-hit i:nth-child(1) { left: 3px; top: 0; transform: rotate(-45deg); } .h-hit i:nth-child(2) { right: 3px; top: 0; transform: rotate(45deg); }
.h-hit i:nth-child(3) { left: 3px; bottom: 0; transform: rotate(45deg); } .h-hit i:nth-child(4) { right: 3px; bottom: 0; transform: rotate(-45deg); }
.h-hit.weak i { background: var(--signal); } .h-hit.kill i { background: var(--alarm); width: 3px; }

/* damage direction */
.h-arcs { position: absolute; inset: 0; }
.h-arc { position: absolute; left: 50%; top: 50%; width: min(72vh, 94vw); aspect-ratio: 1; transform: translate(-50%, -50%); opacity: 0; will-change: transform, opacity; }
.h-arc svg { width: 100%; height: 100%; display: block; overflow: visible; }
.h-arc path { fill: none; stroke: var(--alarm); stroke-width: 4; opacity: .9; }
.h-arc path.tip { stroke-width: 2.5; }

/* interaction prompt */
.h-prompt { position: absolute; left: 50%; top: 61%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; opacity: 0; transition: opacity .15s; white-space: nowrap; }
.h-prompt.on { opacity: 1; }
.h-prompt svg { width: 48px; height: 48px; flex: none; }
.h-prompt circle { fill: none; stroke-width: 3; }
.h-prompt .bg { stroke: var(--bone-faint); fill: rgba(11, 13, 15, .5); } .h-prompt .fg { stroke: var(--signal); }
.h-key { position: absolute; left: 0; top: 0; width: 48px; line-height: 48px; text-align: center; font: 700 19px/48px var(--f-display); letter-spacing: .04em; }
.h-key.wide { font-size: 12px; letter-spacing: .1em; }
.h-plabel { font: 600 16px/1 var(--f-label); letter-spacing: .14em; text-transform: uppercase; padding: 7px 10px 6px; background: var(--plate); border-left: 2px solid var(--signal); }
.h-prompt.busy .h-plabel { color: var(--signal); }

/* kill feed + transient message */
.h-feed { position: absolute; right: var(--gr); top: 31%; text-align: right; }
.h-fl { font: 500 13px/1.5 var(--f-label); letter-spacing: .18em; text-transform: uppercase; color: var(--bone-dim); transition: opacity .5s; }
.h-fl b { font-weight: 600; color: var(--bone); } .h-fl em { font-style: normal; color: var(--signal); margin-left: 10px; }
.h-fl.out { opacity: 0; }
.h-msg { position: absolute; left: 50%; bottom: calc(23% + var(--sab)); transform: translateX(-50%); max-width: calc(100vw - var(--gl) - var(--gr)); text-align: center; padding: 6px 10px; background: var(--plate);
  font: 400 11px/1.4 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; opacity: 0; transition: opacity .3s; }
.h-msg.on { opacity: 1; }

/* health (only while hurt) */
.h-health { position: absolute; left: var(--gl); bottom: calc(22px + var(--sab)); opacity: 0; transition: opacity .6s; }
.h-health.on { opacity: 1; transition-duration: .12s; }
.h-hp-row { display: flex; align-items: flex-end; gap: 10px; margin-top: 6px; }
.h-hp-n { font: 700 34px/.82 var(--f-display); letter-spacing: .02em; min-width: 1.6em; }
.h-hp-bar { display: flex; gap: 3px; padding-bottom: 2px; }
.h-hp-bar i { width: 15px; height: 5px; background: var(--bone); box-shadow: 0 0 2px rgba(0, 0, 0, .6); }
.h-hp-bar i.off { background: transparent; box-shadow: inset 0 0 0 1px var(--bone-faint); }
.h-health.crit .h-hp-n { color: var(--alarm); } .h-health.crit .h-hp-bar i:not(.off) { background: var(--alarm); }

/* ammo */
.h-ammo { position: absolute; right: var(--gr); bottom: calc(20px + var(--sab)); text-align: right; }
.h-cue { height: 16px; font: 600 12px/16px var(--f-label); letter-spacing: .26em; margin-right: -.26em; text-transform: uppercase; color: var(--signal); opacity: 0; }
.h-cue.on { opacity: 1; } .h-cue.urgent { color: var(--alarm); animation: blink .7s steps(2, jump-none) infinite; }
@keyframes blink { 0% { opacity: 1; } 100% { opacity: .35; } }
.h-ammo-row { display: flex; align-items: flex-end; justify-content: flex-end; gap: 8px; }
.h-ammo-n { font: 700 76px/.8 var(--f-display); letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.h-ammo-r { font: 500 15px/1 var(--f-mono); color: var(--bone); padding-bottom: 3px; }
.h-ammo-r::before { content: '/ '; color: var(--bone-dim); }
.h-ammo.low .h-ammo-n { color: var(--signal); }
.h-pips { display: flex; justify-content: flex-end; gap: 2px; margin: 9px 0 7px; }
.h-pips i { width: 3px; height: 11px; background: var(--bone); box-shadow: 0 0 2px rgba(0, 0, 0, .5); }
.h-pips i.off { background: var(--bone-faint); box-shadow: none; }
.h-ammo.low .h-pips i:not(.off) { background: var(--signal); }
.h-wname { font: 600 11px/1 var(--f-label); letter-spacing: .28em; margin-right: -.28em; text-transform: uppercase; color: rgba(232, 228, 218, .82); }
.h-alt { margin-top: 7px; font: 500 11px/1 var(--f-mono); letter-spacing: .06em; color: var(--bone-dim); white-space: nowrap; }
.h-alt b { font-weight: 500; color: rgba(232, 228, 218, .82); } .h-alt kbd { margin-right: 6px; }
.h-alt:empty { display: none; }

/* world-space objective diamonds */
.h-marks { position: absolute; inset: 0; transition: opacity .15s; } .h-marks.off { opacity: 0; }
.h-wm { position: absolute; left: 0; top: 0; width: 0; height: 0; color: var(--signal); will-change: transform; opacity: .78; transition: opacity .25s; }
.h-wm.dim { opacity: .22; }
.h-wm i { position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; border: 1.5px solid currentColor; transform: rotate(45deg); background: rgba(11, 13, 15, .45); box-shadow: 0 0 3px rgba(0, 0, 0, .5); }
.h-wm b { position: absolute; left: -30px; width: 60px; top: -24px; text-align: center; font: 700 12px/1 var(--f-display); letter-spacing: .08em; }
.h-wm span { position: absolute; left: -30px; width: 60px; top: 11px; text-align: center; font: 400 10px/1 var(--f-mono); color: var(--bone); }
.h-wm.offscreen { opacity: .7; } .h-wm.offscreen i { left: -5px; top: -5px; width: 10px; height: 10px; } .h-wm.offscreen b { top: -24px; font-size: 12px; }
.h-wm.near { opacity: 0; }
.h-wm.extract { color: var(--bone); } .h-wm.extract i { background: var(--bone); }

/* =====================================================================  radio subtitles  */
.comms { position: absolute; left: 50%; bottom: calc(15% + var(--sab)); transform: translateX(-50%); width: min(620px, calc(100vw - var(--gl) - var(--gr))); text-align: center; opacity: 0; transition: opacity .3s; text-shadow: var(--shadow); }
.comms.on { opacity: 1; }
.comms-who { display: block; font: 600 11px/1 var(--f-label); letter-spacing: .34em; margin-right: -.34em; text-transform: uppercase; color: var(--signal); margin-bottom: 6px; }
.comms-t { display: inline; font: 500 19px/1.3 var(--f-label); letter-spacing: .02em; color: var(--bone); background: var(--plate); box-decoration-break: clone; -webkit-box-decoration-break: clone; padding: 2px 8px; }

/* =====================================================================  touch controls  */
.touch { position: absolute; inset: 0; display: none; pointer-events: none; }
.touch.on { display: block; }
.t-stick { position: absolute; left: 0; top: 0; width: 0; height: 0; opacity: 0; transition: opacity .12s; }
.t-stick.on { opacity: 1; }
.t-ring { position: absolute; left: -58px; top: -58px; width: 116px; height: 116px; border-radius: 50%; border: 1.5px solid rgba(232, 228, 218, .5); background: rgba(11, 13, 15, .18); }
.t-nub { position: absolute; left: -24px; top: -24px; width: 48px; height: 48px; border-radius: 50%; background: rgba(232, 228, 218, .3); border: 1.5px solid rgba(232, 228, 218, .7); }
.t-btn { position: absolute; pointer-events: auto; touch-action: none; border-radius: 50%; border: 1.5px solid rgba(232, 228, 218, .55); background: rgba(11, 13, 15, .38); color: var(--bone);
  font: 600 12px/1 var(--f-label); letter-spacing: .14em; padding: 0; margin: 0; -webkit-appearance: none; appearance: none; }
.t-btn span { pointer-events: none; margin-right: -.14em; }
.t-btn.active { background: rgba(255, 179, 71, .32); border-color: var(--signal); color: var(--signal); }
.t-fire { width: 86px; height: 86px; right: calc(20px + var(--sar)); bottom: calc(62px + var(--sab)); font-size: 14px; }
.t-ads { width: 60px; height: 60px; right: calc(120px + var(--sar)); bottom: calc(34px + var(--sab)); }
.t-jump { width: 60px; height: 60px; right: calc(20px + var(--sar)); bottom: calc(164px + var(--sab)); }
.t-reload { width: 54px; height: 54px; right: calc(108px + var(--sar)); bottom: calc(126px + var(--sab)); }
.t-swap { width: 54px; height: 54px; right: calc(92px + var(--sar)); bottom: calc(196px + var(--sab)); font-size: 10px; }
.t-interact { width: 68px; height: 68px; right: calc(186px + var(--sar)); bottom: calc(96px + var(--sab)); border-color: var(--signal); color: var(--signal); display: none; }
.t-interact.on { display: block; }
.t-pause { width: 42px; height: 42px; border-radius: 0; right: calc(12px + var(--sar)); top: calc(12px + var(--sat)); letter-spacing: .2em; }
/* touch layout: keep the thumbs' corners clear */
.is-touch .h-ammo { bottom: auto; top: calc(64px + var(--sat)); }
.is-touch .h-ammo-n { font-size: 44px; } .is-touch .h-pips { margin: 6px 0 5px; } .is-touch .h-pips i { height: 7px; width: 2px; }
.is-touch .h-health { bottom: auto; top: calc(128px + var(--sat)); }
.is-touch .h-feed { top: calc(150px + var(--sat)); }
.is-touch .comms { bottom: auto; top: calc(27% + var(--sat)); }
.is-touch .h-compass { width: min(300px, calc(100vw - var(--gl) - var(--gr) - 120px)); }

/* =====================================================================  menus  */
.menu { position: absolute; inset: 0; pointer-events: none; color: var(--bone); }
.menu.open { pointer-events: auto; }
.menu h1, .menu h2, .menu h3, .menu p, .menu dl, .menu dd, .menu dt { margin: 0; padding: 0; }
.m-veil { position: absolute; inset: 0; opacity: 0; transition: opacity .5s ease; background: rgba(6, 8, 10, .62); }
.menu.open .m-veil { opacity: 1; }
/* title: a reading scrim on the text side only — the scene stays the picture */
.menu[data-screen="title"] .m-veil { background: linear-gradient(90deg, rgba(6, 8, 10, .82) 0%, rgba(6, 8, 10, .5) 38%, rgba(6, 8, 10, 0) 72%), linear-gradient(0deg, rgba(6, 8, 10, .7) 0%, rgba(6, 8, 10, 0) 46%); }
.menu[data-screen="dead"] .m-veil { background: rgba(6, 8, 10, .35); }
.m-bars i { position: absolute; left: 0; right: 0; height: calc(clamp(14px, 5.5vh, 52px) + var(--sat)); background: #000; top: 0; transform: translateY(-101%); transition: transform .7s cubic-bezier(.2, .7, .2, 1); }
.m-bars i + i { top: auto; bottom: 0; height: calc(clamp(14px, 5.5vh, 52px) + var(--sab)); transform: translateY(101%); }
.menu[data-screen="title"] .m-bars i { transform: none; }

.m-screen { position: absolute; display: none; }
.menu[data-screen="title"] .m-title { display: flex; }
.menu[data-screen="paused"] [data-s="paused"], .menu[data-screen="dead"] [data-s="dead"], .menu[data-screen="complete"] [data-s="complete"] { display: block; }

/* ---- title ---- */
.m-title { inset: 0; align-items: flex-end; justify-content: space-between; gap: 32px;
  padding: calc(clamp(14px, 5.5vh, 52px) + var(--sat) + 20px) max(var(--gr), 4.5vw) calc(clamp(14px, 5.5vh, 52px) + var(--sab) + clamp(18px, 5vh, 56px)) max(var(--gl), 5.5vw); }
.m-title-main { min-width: 0; flex: 1 1 auto; }
.m-eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font: 600 13px/1.2 var(--f-label); letter-spacing: .24em; text-transform: uppercase; }
.m-tag { font: 900 15px/1 var(--f-display); letter-spacing: .06em; color: var(--ink); background: var(--signal); padding: 4px 7px 3px; }
.m-dim { color: var(--bone-dim); }
.m-word { font: 900 clamp(52px, 15.5vw, 208px)/.8 var(--f-display) !important; letter-spacing: .15em !important; margin: clamp(10px, 2vh, 22px) -.15em clamp(12px, 2.2vh, 24px) -.035em !important; color: var(--bone); white-space: nowrap; text-shadow: 0 2px 30px rgba(0, 0, 0, .35); }
.m-premise { position: relative; padding-top: 16px !important; border-top: 1px solid var(--line); font: 500 clamp(17px, 1.55vw, 22px)/1.3 var(--f-label); letter-spacing: .03em; color: rgba(232, 228, 218, .9); max-width: 40em; }
.m-premise::before { content: ''; position: absolute; left: 0; top: -2px; width: 72px; height: 3px; background: var(--signal); }
.m-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: clamp(16px, 3vh, 28px); }
.m-actions.col { flex-direction: column; align-items: stretch; margin-top: 22px; }
.m-pick { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px 14px; margin-top: clamp(12px, 2.2vh, 20px); max-width: 430px; }
.m-pick label { font: 500 11px/1 var(--f-label); letter-spacing: .24em; text-transform: uppercase; color: var(--steel); }
.m-pick .seg button { min-height: 34px; font-size: 12px; background: rgba(11, 13, 15, .45); }
.m-pick .seg button[aria-pressed="true"] { background: var(--bone); }
.m-pick-note { grid-column: 1 / -1; font: 400 11px/1.4 var(--f-mono); color: var(--steel); min-height: 15px; }
.m-dead [data-only] { display: none; } .menu[data-mode="holdout"] .m-dead [data-only="holdout"], .menu[data-mode="mission"] .m-dead [data-only="mission"] { display: flex; }
.m-note { margin-top: clamp(14px, 2.6vh, 26px) !important; font: 400 11px/1.5 var(--f-mono); letter-spacing: .04em; color: var(--steel); max-width: 52ch; }
/* callout (unused) */
.m-callout { position: absolute; z-index: 2; top: calc(clamp(14px, 5.5vh, 52px) + var(--sat) + 14px); right: max(var(--gr), 4.5vw); width: min(360px, 22.5vw); text-align: left; display: flex; flex-direction: column;
  max-height: calc(100% - clamp(14px, 5.5vh, 52px) * 2 - var(--sat) - var(--sab) - 28px); }
.m-callout[hidden] { display: none; }
.m-callout-tab { display: block; margin-left: auto; font: 500 11px/1 var(--f-label); letter-spacing: .22em; text-transform: uppercase; color: var(--bone); background: rgba(11, 13, 15, .6); border: 1px solid rgba(232, 228, 218, .42); border-radius: 0; min-height: 32px; padding: 1px 12px 0; cursor: pointer; }
.m-callout-tab::after { content: ' +'; color: var(--signal); }
.m-callout-tab:hover { border-color: var(--bone); }
.m-callout.open .m-callout-tab { display: none; }
.m-callout-body { display: none; overflow: auto; padding: 14px 16px 16px; background: rgba(8, 10, 12, .72); border: 1px solid var(--line); border-left: 3px solid var(--signal); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.m-callout.open .m-callout-body { display: block; }
.m-callout-x { float: right; width: 34px; height: 34px; margin: -12px -14px 2px 6px; background: none; border: 0; border-radius: 0; color: var(--bone-dim); font: 400 22px/1 var(--f-mono); cursor: pointer; }
.m-callout-x:hover { color: var(--bone); }
.m-callout-body p { margin: 0 0 10px !important; font: 400 12px/1.55 var(--f-mono); letter-spacing: .01em; color: rgba(232, 228, 218, .9); }
.m-callout-body .btn.small { width: 100%; min-height: 38px; margin-top: 2px; font-size: 13px; letter-spacing: .18em; padding: 2px 10px 0; }
@media (max-width: 1099px), (max-height: 599px) {
  .m-callout { width: min(360px, calc(100vw - var(--gl) - var(--gr) - 24px)); top: calc(clamp(14px, 5.5vh, 52px) + var(--sat) + 10px); }
  .m-callout-body { background: rgba(8, 10, 12, .93); }
}

.btn { font: 600 15px/1 var(--f-label); letter-spacing: .22em; text-transform: uppercase; color: var(--bone); background: rgba(11, 13, 15, .55); border: 1px solid rgba(232, 228, 218, .42);
  border-radius: 0; min-height: 46px; padding: 2px 22px 0; cursor: pointer; text-align: center; -webkit-appearance: none; appearance: none; transition: background .12s, border-color .12s, color .12s; }
.btn:hover { border-color: var(--bone); background: rgba(232, 228, 218, .12); }
.btn:active { background: rgba(232, 228, 218, .22); }
.btn.primary { background: var(--signal); border-color: var(--signal); color: var(--ink); font-size: 18px; font-weight: 600; letter-spacing: .3em; min-height: 52px; padding: 2px 40px 0 44px; }
.btn.primary:hover { background: var(--signal-hot); border-color: var(--signal-hot); }
.btn.small { min-height: 34px; font-size: 12px; padding: 1px 14px 0; }
.m-actions.col .btn { text-align: left; padding-left: 18px; }
.menu button:focus-visible, .menu input:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }
.menu.pad-nav button:focus, .menu.pad-nav input:focus { outline: 2px solid var(--signal); outline-offset: 3px; }
.menu.pad-nav .btn.primary:focus { outline-color: var(--bone); }
.btn.primary:focus-visible { outline-color: var(--bone); }

/* controls at a glance on the title (wide screens; the Controls button covers the rest) */
.m-legend { display: none; flex: none; text-align: right; text-shadow: var(--shadow); padding-bottom: 2px; }
.m-legend > div { display: flex; justify-content: flex-end; align-items: center; gap: 18px; margin-top: 9px; font: 500 12px/1 var(--f-label); letter-spacing: .16em; text-transform: uppercase; color: rgba(232, 228, 218, .78); white-space: nowrap; }
.m-legend kbd { margin-right: 3px; background: rgba(11, 13, 15, .45); }
.m-legend .lg-touch, .m-legend .lg-pad { margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--line); color: var(--bone-dim); }
.m-legend .lg-pad + .lg-touch { margin-top: 9px; padding-top: 0; border-top: 0; }
.m-legend em { font-style: normal; color: var(--signal); letter-spacing: .26em; }
@media (min-width: 1180px) and (min-height: 600px) { .m-legend { display: block; } }
.keys > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 3px 0; }
.keys dt { font: 500 12px/1.3 var(--f-label); letter-spacing: .16em; text-transform: uppercase; color: var(--steel); white-space: nowrap; }
.keys dd { font: 500 13px/1.3 var(--f-label); letter-spacing: .04em; color: var(--bone); text-align: right; }
kbd { display: inline-block; font: 500 10px/1 var(--f-mono); color: var(--bone); border: 1px solid rgba(232, 228, 218, .45); padding: 3px 4px 2px; margin: 0 1px; min-width: 18px; text-align: center; text-transform: uppercase; }

/* ---- cards: paused / dead / debrief ---- */
.m-card { left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(430px, calc(100vw - var(--gl) - var(--gr))); max-height: calc(100vh - 24px - var(--sat) - var(--sab)); overflow: auto;
  padding: 26px 26px 24px; background: var(--plate-solid); border: 1px solid var(--line); border-top: 3px solid var(--signal); }
.m-card.m-dead { border-top-color: var(--alarm); }
.m-k { font: 600 12px/1 var(--f-label); letter-spacing: .28em; text-transform: uppercase; color: var(--steel); }
.m-h { font: 900 clamp(40px, 11vw, 62px)/.86 var(--f-display) !important; letter-spacing: .08em; text-transform: uppercase; margin: 10px 0 12px !important; }
.m-dead .m-h { color: var(--alarm); }
.m-debrief .m-h { font-size: clamp(30px, 8.6vw, 44px) !important; white-space: nowrap; }
.m-line { font: 400 11px/1.5 var(--f-mono); letter-spacing: .04em; color: var(--steel); min-height: 1px; }
.m-stats > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 9px 0 8px; border-top: 1px solid var(--line); }
.m-stats > div:last-child { border-bottom: 1px solid var(--line); }
.m-stats dt { font: 500 13px/1 var(--f-label); letter-spacing: .18em; text-transform: uppercase; color: var(--steel); }
.m-stats dd { font: 500 16px/1 var(--f-mono); color: var(--bone); }
.m-rating { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin: 4px 0 12px; }
.m-rating span { font: 500 13px/1 var(--f-label); letter-spacing: .18em; text-transform: uppercase; color: var(--steel); }
.m-rating b { font: 900 46px/.9 var(--f-display); letter-spacing: .08em; text-transform: uppercase; color: var(--signal); }

/* ---- settings / controls panel ---- */
.panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); display: flex; flex-direction: column; background: rgba(11, 13, 15, .95); border-left: 1px solid var(--line);
  padding: calc(10px + var(--sat)) 0 var(--sab); z-index: 5; }
.panel[hidden] { display: none; }
.panel:focus { outline: none; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px max(20px, var(--sar)) 0 22px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 22px; }
.tab { font: 600 15px/1 var(--f-label); letter-spacing: .22em; text-transform: uppercase; color: var(--steel); background: none; border: 0; border-bottom: 3px solid transparent; border-radius: 0; padding: 14px 0 12px; cursor: pointer; margin-bottom: -1px; }
.tab[aria-selected="true"] { color: var(--bone); border-bottom-color: var(--signal); }
.tab:hover { color: var(--bone); }
.panel-b { flex: 1 1 auto; overflow-y: auto; padding: 6px max(20px, var(--sar)) 24px 22px; -webkit-overflow-scrolling: touch; }
.panel-b[hidden] { display: none; }
.panel-b h3 { font: 600 11px/1 var(--f-label); letter-spacing: .26em; text-transform: uppercase; color: var(--steel); margin: 20px 0 8px !important; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.panel-note { font: 400 11px/1.6 var(--f-mono); letter-spacing: .02em; color: var(--steel); margin-top: 14px !important; }
.row { padding: 15px 0 16px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.row[hidden] { display: none; }
.row .btn.small { justify-self: start; min-height: 38px; }
.row label { font: 600 13px/1 var(--f-label); letter-spacing: .2em; text-transform: uppercase; color: var(--bone); }
.seg { display: flex; }
.seg button { flex: 1 1 0; min-width: 0; min-height: 40px; font: 600 13px/1 var(--f-label); letter-spacing: .16em; text-transform: uppercase; color: var(--bone-dim); background: transparent; border: 1px solid rgba(232, 228, 218, .35); border-radius: 0; margin-left: -1px; padding: 1px 0 0; cursor: pointer; }
.seg button:first-child { margin-left: 0; }
.seg button:hover { color: var(--bone); }
.seg button[aria-pressed="true"] { background: var(--bone); border-color: var(--bone); color: var(--ink); position: relative; }
.slider { display: flex; align-items: center; gap: 14px; }
.slider output { font: 500 13px/1 var(--f-mono); color: var(--bone); min-width: 5ch; text-align: right; }
.slider input { flex: 1 1 auto; min-width: 0; height: 28px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
.slider input::-webkit-slider-runnable-track { height: 2px; background: rgba(232, 228, 218, .35); }
.slider input::-moz-range-track { height: 2px; background: rgba(232, 228, 218, .35); }
.slider input::-webkit-slider-thumb { -webkit-appearance: none; width: 10px; height: 22px; margin-top: -10px; background: var(--signal); border: 0; border-radius: 0; }
.slider input::-moz-range-thumb { width: 10px; height: 22px; background: var(--signal); border: 0; border-radius: 0; }
.toggle { display: inline-flex; align-items: center; gap: 12px; justify-self: start; background: none; border: 0; padding: 4px 0; color: var(--bone); cursor: pointer; font: 500 13px/1 var(--f-mono); }
.toggle i { position: relative; width: 44px; height: 22px; border: 1px solid rgba(232, 228, 218, .45); }
.toggle i::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 14px; background: var(--bone-dim); transition: transform .12s, background .12s; }
.toggle[aria-pressed="true"] i { border-color: var(--signal); } .toggle[aria-pressed="true"] i::after { transform: translateX(20px); background: var(--signal); }

/* ---- intro location card ---- */
.loc-card { position: absolute; left: max(var(--gl), 5.5vw); bottom: calc(28vh + var(--sab)); padding-left: 16px; opacity: 0; transition: opacity .5s; text-shadow: var(--shadow); max-width: calc(100vw - var(--gl) - var(--gr) - 16px); }
.loc-card i { position: absolute; left: 0; top: 2px; bottom: 2px; width: 3px; background: var(--signal); }
.loc-card b { display: block; font: 700 clamp(19px, 3vw, 34px)/1.05 var(--f-display); letter-spacing: .16em; text-transform: uppercase; }
.loc-card span { display: block; margin-top: 7px; font: 400 11px/1.4 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--bone-dim); }
@keyframes locin { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 -2% 0 0); } }
.loc-card.on { opacity: 1; } .loc-card.on b { animation: locin 1.1s steps(28, end) both; }

/* ---- narrow screens (phones, portrait) ---- */
@media (max-width: 760px) {
  .h-obj { top: calc(78px + var(--sat)); max-width: 62vw; } .h-obj-t { font-size: 17px; }
  .h-heading { display: none; }
  .h-ammo-n { font-size: 56px; }
  .is-touch .h-ammo { top: calc(78px + var(--sat)); }
  .is-touch .h-health { top: calc(150px + var(--sat)); }
  .m-title { padding-left: var(--gl); padding-right: var(--gr); }
  .m-word { font-size: clamp(52px, 20vw, 150px) !important; }
  .m-eyebrow { font-size: 11px; letter-spacing: .2em; }
  .m-actions .btn.primary { flex: 1 1 100%; }
  .m-actions:not(.col) .btn:not(.primary) { flex: 1 1 0; padding-left: 8px; padding-right: 8px; }
  .m-card { padding: 22px 20px 20px; }
  .comms-t { font-size: 17px; }
}
@media (max-height: 520px) {
  .m-word { font-size: clamp(40px, 20vh, 120px) !important; margin-top: 8px !important; margin-bottom: 10px !important; }
  .m-premise { padding-top: 10px !important; } .m-actions { margin-top: 12px; } .m-note { margin-top: 10px !important; }
  .btn.primary { min-height: 44px; } .btn { min-height: 40px; }
  .m-card { padding: 16px 20px 16px; } .m-h { font-size: clamp(30px, 11vh, 62px) !important; margin: 6px 0 8px !important; }
  .m-actions.col { margin-top: 12px; gap: 6px; } .m-stats > div { padding: 6px 0 5px; } .m-rating b { font-size: 34px; }
  .h-prompt { top: 64%; }
}

/* ---- motion preferences ---- */
@media (prefers-reduced-motion: reduce) {
  .menu *, .hud *, .comms, .loc-card, .loc-card *, #boot, .m-bars i { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .h-warn.on { animation: none; opacity: 1; }
  .h-cue.urgent { animation: none; }
}

/* Black Tide */
.m-word { font-size: clamp(44px, 10.5vw, 150px) !important; }
.h-cm.loot i, .h-wm.loot i { background: var(--signal) !important; border-color: var(--signal) !important; }
.h-cm.loot b, .h-wm.loot b { color: var(--signal) !important; }
</style>
<div id="app">
  <canvas id="view" tabindex="0"></canvas>
  <div id="ui"></div>
  <div id="boot">
    <div class="boot-mark">BLACK TIDE</div>
    <div class="boot-sub" id="boot-msg">Running dark</div>
    <div class="boot-bar"><i id="boot-fill"></i></div>
  </div>
</div>
<script>
(()=>{var L6=Object.defineProperty,Io=(e,t)=>{for(var r in t)L6(e,r,{get:t[r],enumerable:!0})},Ir={};Io(Ir,{ACESFilmicToneMapping:()=>a1,AddEquation:()=>Ms,AddOperation:()=>kv,AdditiveAnimationBlendMode:()=>Ym,AdditiveBlending:()=>rl,AgXToneMapping:()=>Dv,AlphaFormat:()=>qm,AlwaysCompare:()=>Kv,AlwaysDepth:()=>ju,AlwaysStencilFunc:()=>$m,AmbientLight:()=>Dx,AnimationAction:()=>Kx,AnimationClip:()=>Vc,AnimationLoader:()=>h8,AnimationMixer:()=>F8,AnimationObjectGroup:()=>D8,AnimationUtils:()=>o8,ArcCurve:()=>Q3,ArrayCamera:()=>jx,ArrowHelper:()=>pT,AttachedBindMode:()=>Om,Audio:()=>Yx,AudioAnalyser:()=>A8,AudioContext:()=>ug,AudioListener:()=>_8,AudioLoader:()=>b8,AxesHelper:()=>fT,BackSide:()=>Ka,BasicDepthPacking:()=>Hv,BasicShadowMap:()=>O6,BatchedMesh:()=>V3,Bone:()=>_c,BooleanKeyframeTrack:()=>gl,Box2:()=>K8,Box3:()=>_r,Box3Helper:()=>cT,BoxGeometry:()=>cr,BoxHelper:()=>uT,BufferAttribute:()=>mt,BufferGeometry:()=>Tt,BufferGeometryLoader:()=>Vx,ByteType:()=>Vm,Cache:()=>ns,Camera:()=>np,CameraHelper:()=>hT,CanvasTexture:()=>yn,CapsuleGeometry:()=>U2,CatmullRomCurve3:()=>Ip,CineonToneMapping:()=>Lv,CircleGeometry:()=>D2,ClampToEdgeWrapping:()=>Ja,Clock:()=>Xx,Color:()=>at,ColorKeyframeTrack:()=>ag,ColorManagement:()=>x0,CompressedArrayTexture:()=>ES,CompressedCubeTexture:()=>RS,CompressedTexture:()=>Ap,CompressedTextureLoader:()=>u8,ConeGeometry:()=>Ep,ConstantAlphaFactor:()=>Rv,ConstantColorFactor:()=>Av,Controls:()=>gT,CubeCamera:()=>w2,CubeReflectionMapping:()=>ws,CubeRefractionMapping:()=>nn,CubeTexture:()=>gc,CubeTextureLoader:()=>c8,CubeUVReflectionMapping:()=>lh,CubicBezierCurve:()=>H2,CubicBezierCurve3:()=>tx,CubicInterpolant:()=>Ex,CullFaceBack:()=>Im,CullFaceFront:()=>fv,CullFaceFrontBack:()=>F6,CullFaceNone:()=>pv,Curve:()=>Oo,CurvePath:()=>ax,CustomBlending:()=>Nm,CustomToneMapping:()=>Uv,CylinderGeometry:()=>bn,Cylindrical:()=>$8,Data3DTexture:()=>G1,DataArrayTexture:()=>H1,DataTexture:()=>yi,DataTextureLoader:()=>d8,DataUtils:()=>v2,DecrementStencilOp:()=>Q6,DecrementWrapStencilOp:()=>t_,DefaultLoadingManager:()=>zx,DepthFormat:()=>dh,DepthStencilFormat:()=>ph,DepthTexture:()=>Rc,DetachedBindMode:()=>Fv,DirectionalLight:()=>Bp,DirectionalLightHelper:()=>lT,DiscreteInterpolant:()=>Rx,DodecahedronGeometry:()=>K3,DoubleSide:()=>Gr,DstAlphaFactor:()=>Mv,DstColorFactor:()=>_v,DynamicCopyUsage:()=>m_,DynamicDrawUsage:()=>_s,DynamicReadUsage:()=>d_,EdgesGeometry:()=>J3,EllipseCurve:()=>kp,EqualCompare:()=>Xv,EqualDepth:()=>Qd,EqualStencilFunc:()=>o_,EquirectangularReflectionMapping:()=>Yu,EquirectangularRefractionMapping:()=>$u,Euler:()=>Sr,EventDispatcher:()=>ts,ExternalTexture:()=>L2,ExtrudeGeometry:()=>Uc,FileLoader:()=>Ls,Float16BufferAttribute:()=>oS,Float32BufferAttribute:()=>et,FloatType:()=>mi,Fog:()=>_3,FogExp2:()=>w3,FramebufferTexture:()=>AS,FrontSide:()=>bs,Frustum:()=>Fh,FrustumArray:()=>F3,GLBufferAttribute:()=>W8,GLSL1:()=>v_,GLSL3:()=>V1,GreaterCompare:()=>Yv,GreaterDepth:()=>t1,GreaterEqualCompare:()=>Zv,GreaterEqualDepth:()=>e1,GreaterEqualStencilFunc:()=>h_,GreaterStencilFunc:()=>n_,GridHelper:()=>sT,Group:()=>Qt,HalfFloatType:()=>es,HemisphereLight:()=>kx,HemisphereLightHelper:()=>oT,IcosahedronGeometry:()=>cx,ImageBitmapLoader:()=>y8,ImageLoader:()=>Hc,ImageUtils:()=>o3,IncrementStencilOp:()=>J6,IncrementWrapStencilOp:()=>e_,InstancedBufferAttribute:()=>ks,InstancedBufferGeometry:()=>Vp,InstancedInterleavedBuffer:()=>G8,InstancedMesh:()=>Nh,Int16BufferAttribute:()=>aS,Int32BufferAttribute:()=>iS,Int8BufferAttribute:()=>eS,IntType:()=>o1,InterleavedBuffer:()=>hp,InterleavedBufferAttribute:()=>xc,Interpolant:()=>Nc,InterpolateDiscrete:()=>ic,InterpolateLinear:()=>F1,InterpolateSmooth:()=>O1,InterpolationSamplingMode:()=>b_,InterpolationSamplingType:()=>y_,InvertStencilOp:()=>r_,KeepStencilOp:()=>sl,KeyframeTrack:()=>xo,LOD:()=>C3,LatheGeometry:()=>Dc,Layers:()=>Z1,LessCompare:()=>jv,LessDepth:()=>Jd,LessEqualCompare:()=>Zm,LessEqualDepth:()=>al,LessEqualStencilFunc:()=>s_,LessStencilFunc:()=>i_,Light:()=>Mn,LightProbe:()=>Ox,Line:()=>xn,Line3:()=>eT,LineBasicMaterial:()=>bi,LineCurve:()=>G2,LineCurve3:()=>rx,LineDashedMaterial:()=>Sx,LineLoop:()=>j3,LineSegments:()=>os,LinearFilter:()=>F0,LinearInterpolant:()=>rg,LinearMipMapLinearFilter:()=>G6,LinearMipMapNearestFilter:()=>H6,LinearMipmapLinearFilter:()=>ca,LinearMipmapNearestFilter:()=>Ku,LinearSRGBColorSpace:()=>hn,LinearToneMapping:()=>Pv,LinearTransfer:()=>sc,Loader:()=>Bi,LoaderUtils:()=>lg,LoadingManager:()=>ig,LoopOnce:()=>Ov,LoopPingPong:()=>Vv,LoopRepeat:()=>Bv,MOUSE:()=>D6,Material:()=>ai,MaterialLoader:()=>Bx,MathUtils:()=>rs,Matrix2:()=>Z8,Matrix3:()=>Jt,Matrix4:()=>ut,MaxEquation:()=>xv,Mesh:()=>Pt,MeshBasicMaterial:()=>za,MeshDepthMaterial:()=>J2,MeshDistanceMaterial:()=>Q2,MeshLambertMaterial:()=>wx,MeshMatcapMaterial:()=>_x,MeshNormalMaterial:()=>Mx,MeshPhongMaterial:()=>yx,MeshPhysicalMaterial:()=>xx,MeshStandardMaterial:()=>fa,MeshToonMaterial:()=>bx,MinEquation:()=>vv,MirroredRepeatWrapping:()=>Zu,MixOperation:()=>zv,MultiplyBlending:()=>Dm,MultiplyOperation:()=>Xu,NearestFilter:()=>Wr,NearestMipMapLinearFilter:()=>V6,NearestMipMapNearestFilter:()=>B6,NearestMipmapLinearFilter:()=>hh,NearestMipmapNearestFilter:()=>Bm,NeutralToneMapping:()=>Nv,NeverCompare:()=>qv,NeverDepth:()=>Kd,NeverStencilFunc:()=>a_,NoBlending:()=>Qo,NoColorSpace:()=>Fa,NoToneMapping:()=>Di,NormalAnimationBlendMode:()=>B1,NormalBlending:()=>tl,NotEqualCompare:()=>$v,NotEqualDepth:()=>r1,NotEqualStencilFunc:()=>l_,NumberKeyframeTrack:()=>Fc,Object3D:()=>I0,ObjectLoader:()=>v8,ObjectSpaceNormalMap:()=>Wv,OctahedronGeometry:()=>Np,OneFactor:()=>Wu,OneMinusConstantAlphaFactor:()=>Cv,OneMinusConstantColorFactor:()=>Ev,OneMinusDstAlphaFactor:()=>wv,OneMinusDstColorFactor:()=>Sv,OneMinusSrcAlphaFactor:()=>qu,OneMinusSrcColorFactor:()=>bv,OrthographicCamera:()=>Gh,PCFShadowMap:()=>$d,PCFSoftShadowMap:()=>Lm,PMREMGenerator:()=>Wc,Path:()=>Bh,PerspectiveCamera:()=>ea,Plane:()=>Ps,PlaneGeometry:()=>qr,PlaneHelper:()=>dT,PointLight:()=>Op,PointLightHelper:()=>aT,Points:()=>Y3,PointsMaterial:()=>P2,PolarGridHelper:()=>nT,PolyhedronGeometry:()=>Oh,PositionalAudio:()=>T8,PropertyBinding:()=>er,PropertyMixer:()=>Zx,QuadraticBezierCurve:()=>W2,QuadraticBezierCurve3:()=>q2,Quaternion:()=>Wt,QuaternionKeyframeTrack:()=>Oc,QuaternionLinearInterpolant:()=>Cx,RED_GREEN_RGTC2_Format:()=>D1,RED_RGTC1_Format:()=>L1,REVISION:()=>U6,RGBADepthPacking:()=>Gv,RGBAFormat:()=>wr,RGBAIntegerFormat:()=>h1,RGBA_ASTC_10x10_Format:()=>R1,RGBA_ASTC_10x5_Format:()=>T1,RGBA_ASTC_10x6_Format:()=>A1,RGBA_ASTC_10x8_Format:()=>E1,RGBA_ASTC_12x10_Format:()=>C1,RGBA_ASTC_12x12_Format:()=>z1,RGBA_ASTC_4x4_Format:()=>v1,RGBA_ASTC_5x4_Format:()=>x1,RGBA_ASTC_5x5_Format:()=>y1,RGBA_ASTC_6x5_Format:()=>b1,RGBA_ASTC_6x6_Format:()=>M1,RGBA_ASTC_8x5_Format:()=>w1,RGBA_ASTC_8x6_Format:()=>_1,RGBA_ASTC_8x8_Format:()=>S1,RGBA_BPTC_Format:()=>k1,RGBA_ETC2_EAC_Format:()=>g1,RGBA_PVRTC_2BPPV1_Format:()=>p1,RGBA_PVRTC_4BPPV1_Format:()=>d1,RGBA_S3TC_DXT1_Format:()=>tc,RGBA_S3TC_DXT3_Format:()=>rc,RGBA_S3TC_DXT5_Format:()=>ac,RGBDepthPacking:()=>Y6,RGBFormat:()=>jm,RGBIntegerFormat:()=>W6,RGB_BPTC_SIGNED_Format:()=>P1,RGB_BPTC_UNSIGNED_Format:()=>I1,RGB_ETC1_Format:()=>f1,RGB_ETC2_Format:()=>m1,RGB_PVRTC_2BPPV1_Format:()=>c1,RGB_PVRTC_4BPPV1_Format:()=>u1,RGB_S3TC_DXT1_Format:()=>ec,RGDepthPacking:()=>$6,RGFormat:()=>Xm,RGIntegerFormat:()=>l1,RawShaderMaterial:()=>K2,Ray:()=>wh,Raycaster:()=>q8,RectAreaLight:()=>Nx,RedFormat:()=>Ju,RedIntegerFormat:()=>Qu,ReinhardToneMapping:()=>Iv,RenderTarget:()=>r2,RenderTarget3D:()=>O8,RepeatWrapping:()=>Lo,ReplaceStencilOp:()=>K6,ReverseSubtractEquation:()=>gv,RingGeometry:()=>$2,SIGNED_RED_GREEN_RGTC2_Format:()=>N1,SIGNED_RED_RGTC1_Format:()=>U1,SRGBColorSpace:()=>da,SRGBTransfer:()=>O0,Scene:()=>vc,ShaderChunk:()=>qt,ShaderLib:()=>Ho,ShaderMaterial:()=>pa,ShadowMaterial:()=>vx,Shape:()=>Bo,ShapeGeometry:()=>Z2,ShapePath:()=>mT,ShapeUtils:()=>Vo,ShortType:()=>Hm,Skeleton:()=>mp,SkeletonHelper:()=>rT,SkinnedMesh:()=>wc,Source:()=>un,Sphere:()=>Lr,SphereGeometry:()=>ss,Spherical:()=>Y8,SphericalHarmonics3:()=>Fx,SplineCurve:()=>j2,SpotLight:()=>Lx,SpotLightHelper:()=>tT,Sprite:()=>E3,SpriteMaterial:()=>S2,SrcAlphaFactor:()=>Zd,SrcAlphaSaturateFactor:()=>Tv,SrcColorFactor:()=>yv,StaticCopyUsage:()=>f_,StaticDrawUsage:()=>nc,StaticReadUsage:()=>c_,StereoCamera:()=>M8,StreamCopyUsage:()=>g_,StreamDrawUsage:()=>u_,StreamReadUsage:()=>p_,StringKeyframeTrack:()=>vl,SubtractEquation:()=>mv,SubtractiveBlending:()=>Um,TOUCH:()=>N6,TangentSpaceNormalMap:()=>ln,TetrahedronGeometry:()=>dx,Texture:()=>Ca,TextureLoader:()=>p8,TextureUtils:()=>MT,Timer:()=>j8,TimestampQuery:()=>x_,TorusGeometry:()=>Oi,TorusKnotGeometry:()=>px,Triangle:()=>mn,TriangleFanDrawMode:()=>X6,TriangleStripDrawMode:()=>j6,TrianglesDrawMode:()=>q6,TubeGeometry:()=>Fp,UVMapping:()=>i1,Uint16BufferAttribute:()=>x2,Uint32BufferAttribute:()=>y2,Uint8BufferAttribute:()=>tS,Uint8ClampedBufferAttribute:()=>rS,Uniform:()=>B8,UniformsGroup:()=>H8,UniformsLib:()=>pt,UniformsUtils:()=>y3,UnsignedByteType:()=>Qa,UnsignedInt101111Type:()=>Wm,UnsignedInt248Type:()=>ch,UnsignedInt5999Type:()=>Gm,UnsignedIntType:()=>Uo,UnsignedShort4444Type:()=>s1,UnsignedShort5551Type:()=>n1,UnsignedShortType:()=>uh,VSMShadowMap:()=>Jo,Vector2:()=>je,Vector3:()=>Q,Vector4:()=>s0,VectorKeyframeTrack:()=>Bc,VideoFrameTexture:()=>TS,VideoTexture:()=>Z3,WebGL3DRenderTarget:()=>G_,WebGLArrayRenderTarget:()=>H_,WebGLCoordinateSystem:()=>Zi,WebGLCubeRenderTarget:()=>_2,WebGLRenderTarget:()=>ti,WebGLRenderer:()=>Fy,WebGLUtils:()=>Ny,WebGPUCoordinateSystem:()=>fh,WebXRController:()=>lp,WireframeGeometry:()=>fx,WrapAroundEnding:()=>oc,ZeroCurvatureEnding:()=>il,ZeroFactor:()=>Fm,ZeroSlopeEnding:()=>ol,ZeroStencilOp:()=>Z6,createCanvasElement:()=>t3});var U6="180",D6={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},N6={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},pv=0,Im=1,fv=2,F6=3,O6=0,$d=1,Lm=2,Jo=3,bs=0,Ka=1,Gr=2,Qo=0,tl=1,rl=2,Um=3,Dm=4,Nm=5,Ms=100,mv=101,gv=102,vv=103,xv=104,Fm=200,Wu=201,yv=202,bv=203,Zd=204,qu=205,Mv=206,wv=207,_v=208,Sv=209,Tv=210,Av=211,Ev=212,Rv=213,Cv=214,Kd=0,ju=1,Jd=2,al=3,Qd=4,e1=5,t1=6,r1=7,Xu=0,zv=1,kv=2,Di=0,Pv=1,Iv=2,Lv=3,a1=4,Uv=5,Dv=6,Nv=7,Om="attached",Fv="detached",i1=300,ws=301,nn=302,Yu=303,$u=304,lh=306,Lo=1e3,Ja=1001,Zu=1002,Wr=1003,Bm=1004,B6=1004,hh=1005,V6=1005,F0=1006,Ku=1007,H6=1007,ca=1008,G6=1008,Qa=1009,Vm=1010,Hm=1011,uh=1012,o1=1013,Uo=1014,mi=1015,es=1016,s1=1017,n1=1018,ch=1020,Gm=35902,Wm=35899,qm=1021,jm=1022,wr=1023,dh=1026,ph=1027,Ju=1028,Qu=1029,Xm=1030,l1=1031,W6=1032,h1=1033,ec=33776,tc=33777,rc=33778,ac=33779,u1=35840,c1=35841,d1=35842,p1=35843,f1=36196,m1=37492,g1=37496,v1=37808,x1=37809,y1=37810,b1=37811,M1=37812,w1=37813,_1=37814,S1=37815,T1=37816,A1=37817,E1=37818,R1=37819,C1=37820,z1=37821,k1=36492,P1=36494,I1=36495,L1=36283,U1=36284,D1=36285,N1=36286,Ov=2200,Bv=2201,Vv=2202,ic=2300,F1=2301,O1=2302,il=2400,ol=2401,oc=2402,B1=2500,Ym=2501,q6=0,j6=1,X6=2,Hv=3200,Gv=3201,Y6=3202,$6=3203,ln=0,Wv=1,Fa="",da="srgb",hn="srgb-linear",sc="linear",O0="srgb",Z6=0,sl=7680,K6=7681,J6=7682,Q6=7683,e_=34055,t_=34056,r_=5386,a_=512,i_=513,o_=514,s_=515,n_=516,l_=517,h_=518,$m=519,qv=512,jv=513,Xv=514,Zm=515,Yv=516,$v=517,Zv=518,Kv=519,nc=35044,_s=35048,u_=35040,c_=35045,d_=35049,p_=35041,f_=35046,m_=35050,g_=35042,v_="100",V1="300 es",Zi=2e3,fh=2001,x_={COMPUTE:"compute",RENDER:"render"},y_={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},b_={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},ts=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)}hasEventListener(e,t){let r=this._listeners;return r===void 0?!1:r[e]!==void 0&&r[e].indexOf(t)!==-1}removeEventListener(e,t){let r=this._listeners;if(r===void 0)return;let a=r[e];if(a!==void 0){let i=a.indexOf(t);i!==-1&&a.splice(i,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let r=t[e.type];if(r!==void 0){e.target=this;let a=r.slice(0);for(let i=0,o=a.length;i<o;i++)a[i].call(this,e);e.target=null}}},ei=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],Jv=1234567,nl=Math.PI/180,mh=180/Math.PI;function Ki(){let e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,r=Math.random()*4294967295|0,a=Math.random()*4294967295|0;return(ei[e&255]+ei[e>>8&255]+ei[e>>16&255]+ei[e>>24&255]+"-"+ei[t&255]+ei[t>>8&255]+"-"+ei[t>>16&15|64]+ei[t>>24&255]+"-"+ei[r&63|128]+ei[r>>8&255]+"-"+ei[r>>16&255]+ei[r>>24&255]+ei[a&255]+ei[a>>8&255]+ei[a>>16&255]+ei[a>>24&255]).toLowerCase()}function Bt(e,t,r){return Math.max(t,Math.min(r,e))}function Km(e,t){return(e%t+t)%t}function M_(e,t,r,a,i){return a+(e-t)*(i-a)/(r-t)}function w_(e,t,r){return e!==t?(r-e)/(t-e):0}function lc(e,t,r){return(1-r)*e+r*t}function __(e,t,r,a){return lc(e,t,1-Math.exp(-r*a))}function S_(e,t=1){return t-Math.abs(Km(e,t*2)-t)}function T_(e,t,r){return e<=t?0:e>=r?1:(e=(e-t)/(r-t),e*e*(3-2*e))}function A_(e,t,r){return e<=t?0:e>=r?1:(e=(e-t)/(r-t),e*e*e*(e*(e*6-15)+10))}function E_(e,t){return e+Math.floor(Math.random()*(t-e+1))}function R_(e,t){return e+Math.random()*(t-e)}function C_(e){return e*(.5-Math.random())}function z_(e){e!==void 0&&(Jv=e);let t=Jv+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function k_(e){return e*nl}function P_(e){return e*mh}function I_(e){return(e&e-1)===0&&e!==0}function L_(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function U_(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function D_(e,t,r,a,i){let o=Math.cos,s=Math.sin,n=o(r/2),l=s(r/2),h=o((t+a)/2),u=s((t+a)/2),d=o((t-a)/2),c=s((t-a)/2),g=o((a-t)/2),p=s((a-t)/2);switch(i){case"XYX":e.set(n*u,l*d,l*c,n*h);break;case"YZY":e.set(l*c,n*u,l*d,n*h);break;case"ZXZ":e.set(l*d,l*c,n*u,n*h);break;case"XZX":e.set(n*u,l*p,l*g,n*h);break;case"YXY":e.set(l*g,n*u,l*p,n*h);break;case"ZYZ":e.set(l*p,l*g,n*u,n*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function gi(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function $t(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw new Error("Invalid component type.")}}var rs={DEG2RAD:nl,RAD2DEG:mh,generateUUID:Ki,clamp:Bt,euclideanModulo:Km,mapLinear:M_,inverseLerp:w_,lerp:lc,damp:__,pingpong:S_,smoothstep:T_,smootherstep:A_,randInt:E_,randFloat:R_,randFloatSpread:C_,seededRandom:z_,degToRad:k_,radToDeg:P_,isPowerOfTwo:I_,ceilPowerOfTwo:L_,floorPowerOfTwo:U_,setQuaternionFromProperEuler:D_,normalize:$t,denormalize:gi},je=class e6{constructor(t=0,r=0){e6.prototype.isVector2=!0,this.x=t,this.y=r}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,r){return this.x=t,this.y=r,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,r){switch(t){case 0:this.x=r;break;case 1:this.y=r;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,r){return this.x=t.x+r.x,this.y=t.y+r.y,this}addScaledVector(t,r){return this.x+=t.x*r,this.y+=t.y*r,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,r){return this.x=t.x-r.x,this.y=t.y-r.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let r=this.x,a=this.y,i=t.elements;return this.x=i[0]*r+i[3]*a+i[6],this.y=i[1]*r+i[4]*a+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,r){return this.x=Bt(this.x,t.x,r.x),this.y=Bt(this.y,t.y,r.y),this}clampScalar(t,r){return this.x=Bt(this.x,t,r),this.y=Bt(this.y,t,r),this}clampLength(t,r){let a=this.length();return this.divideScalar(a||1).multiplyScalar(Bt(a,t,r))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){let r=Math.sqrt(this.lengthSq()*t.lengthSq());if(r===0)return Math.PI/2;let a=this.dot(t)/r;return Math.acos(Bt(a,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let r=this.x-t.x,a=this.y-t.y;return r*r+a*a}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,r){return this.x+=(t.x-this.x)*r,this.y+=(t.y-this.y)*r,this}lerpVectors(t,r,a){return this.x=t.x+(r.x-t.x)*a,this.y=t.y+(r.y-t.y)*a,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,r=0){return this.x=t[r],this.y=t[r+1],this}toArray(t=[],r=0){return t[r]=this.x,t[r+1]=this.y,t}fromBufferAttribute(t,r){return this.x=t.getX(r),this.y=t.getY(r),this}rotateAround(t,r){let a=Math.cos(r),i=Math.sin(r),o=this.x-t.x,s=this.y-t.y;return this.x=o*a-s*i+t.x,this.y=o*i+s*a+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Wt=class{constructor(e=0,t=0,r=0,a=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=r,this._w=a}static slerpFlat(e,t,r,a,i,o,s){let n=r[a+0],l=r[a+1],h=r[a+2],u=r[a+3],d=i[o+0],c=i[o+1],g=i[o+2],p=i[o+3];if(s===0){e[t+0]=n,e[t+1]=l,e[t+2]=h,e[t+3]=u;return}if(s===1){e[t+0]=d,e[t+1]=c,e[t+2]=g,e[t+3]=p;return}if(u!==p||n!==d||l!==c||h!==g){let m=1-s,v=n*d+l*c+h*g+u*p,y=v>=0?1:-1,x=1-v*v;if(x>Number.EPSILON){let f=Math.sqrt(x),_=Math.atan2(f,v*y);m=Math.sin(m*_)/f,s=Math.sin(s*_)/f}let b=s*y;if(n=n*m+d*b,l=l*m+c*b,h=h*m+g*b,u=u*m+p*b,m===1-s){let f=1/Math.sqrt(n*n+l*l+h*h+u*u);n*=f,l*=f,h*=f,u*=f}}e[t]=n,e[t+1]=l,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,r,a,i,o){let s=r[a],n=r[a+1],l=r[a+2],h=r[a+3],u=i[o],d=i[o+1],c=i[o+2],g=i[o+3];return e[t]=s*g+h*u+n*c-l*d,e[t+1]=n*g+h*d+l*u-s*c,e[t+2]=l*g+h*c+s*d-n*u,e[t+3]=h*g-s*u-n*d-l*c,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,r,a){return this._x=e,this._y=t,this._z=r,this._w=a,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let r=e._x,a=e._y,i=e._z,o=e._order,s=Math.cos,n=Math.sin,l=s(r/2),h=s(a/2),u=s(i/2),d=n(r/2),c=n(a/2),g=n(i/2);switch(o){case"XYZ":this._x=d*h*u+l*c*g,this._y=l*c*u-d*h*g,this._z=l*h*g+d*c*u,this._w=l*h*u-d*c*g;break;case"YXZ":this._x=d*h*u+l*c*g,this._y=l*c*u-d*h*g,this._z=l*h*g-d*c*u,this._w=l*h*u+d*c*g;break;case"ZXY":this._x=d*h*u-l*c*g,this._y=l*c*u+d*h*g,this._z=l*h*g+d*c*u,this._w=l*h*u-d*c*g;break;case"ZYX":this._x=d*h*u-l*c*g,this._y=l*c*u+d*h*g,this._z=l*h*g-d*c*u,this._w=l*h*u+d*c*g;break;case"YZX":this._x=d*h*u+l*c*g,this._y=l*c*u+d*h*g,this._z=l*h*g-d*c*u,this._w=l*h*u-d*c*g;break;case"XZY":this._x=d*h*u-l*c*g,this._y=l*c*u-d*h*g,this._z=l*h*g+d*c*u,this._w=l*h*u+d*c*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let r=t/2,a=Math.sin(r);return this._x=e.x*a,this._y=e.y*a,this._z=e.z*a,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,r=t[0],a=t[4],i=t[8],o=t[1],s=t[5],n=t[9],l=t[2],h=t[6],u=t[10],d=r+s+u;if(d>0){let c=.5/Math.sqrt(d+1);this._w=.25/c,this._x=(h-n)*c,this._y=(i-l)*c,this._z=(o-a)*c}else if(r>s&&r>u){let c=2*Math.sqrt(1+r-s-u);this._w=(h-n)/c,this._x=.25*c,this._y=(a+o)/c,this._z=(i+l)/c}else if(s>u){let c=2*Math.sqrt(1+s-r-u);this._w=(i-l)/c,this._x=(a+o)/c,this._y=.25*c,this._z=(n+h)/c}else{let c=2*Math.sqrt(1+u-r-s);this._w=(o-a)/c,this._x=(i+l)/c,this._y=(n+h)/c,this._z=.25*c}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return r<1e-8?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Bt(this.dot(e),-1,1)))}rotateTowards(e,t){let r=this.angleTo(e);if(r===0)return this;let a=Math.min(1,t/r);return this.slerp(e,a),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let r=e._x,a=e._y,i=e._z,o=e._w,s=t._x,n=t._y,l=t._z,h=t._w;return this._x=r*h+o*s+a*l-i*n,this._y=a*h+o*n+i*s-r*l,this._z=i*h+o*l+r*n-a*s,this._w=o*h-r*s-a*n-i*l,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let r=this._x,a=this._y,i=this._z,o=this._w,s=o*e._w+r*e._x+a*e._y+i*e._z;if(s<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),s>=1)return this._w=o,this._x=r,this._y=a,this._z=i,this;let n=1-s*s;if(n<=Number.EPSILON){let c=1-t;return this._w=c*o+t*this._w,this._x=c*r+t*this._x,this._y=c*a+t*this._y,this._z=c*i+t*this._z,this.normalize(),this}let l=Math.sqrt(n),h=Math.atan2(l,s),u=Math.sin((1-t)*h)/l,d=Math.sin(t*h)/l;return this._w=o*u+this._w*d,this._x=r*u+this._x*d,this._y=a*u+this._y*d,this._z=i*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),r=Math.random(),a=Math.sqrt(1-r),i=Math.sqrt(r);return this.set(a*Math.sin(e),a*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},Q=class t6{constructor(t=0,r=0,a=0){t6.prototype.isVector3=!0,this.x=t,this.y=r,this.z=a}set(t,r,a){return a===void 0&&(a=this.z),this.x=t,this.y=r,this.z=a,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,r){switch(t){case 0:this.x=r;break;case 1:this.y=r;break;case 2:this.z=r;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,r){return this.x=t.x+r.x,this.y=t.y+r.y,this.z=t.z+r.z,this}addScaledVector(t,r){return this.x+=t.x*r,this.y+=t.y*r,this.z+=t.z*r,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,r){return this.x=t.x-r.x,this.y=t.y-r.y,this.z=t.z-r.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,r){return this.x=t.x*r.x,this.y=t.y*r.y,this.z=t.z*r.z,this}applyEuler(t){return this.applyQuaternion(Qv.setFromEuler(t))}applyAxisAngle(t,r){return this.applyQuaternion(Qv.setFromAxisAngle(t,r))}applyMatrix3(t){let r=this.x,a=this.y,i=this.z,o=t.elements;return this.x=o[0]*r+o[3]*a+o[6]*i,this.y=o[1]*r+o[4]*a+o[7]*i,this.z=o[2]*r+o[5]*a+o[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let r=this.x,a=this.y,i=this.z,o=t.elements,s=1/(o[3]*r+o[7]*a+o[11]*i+o[15]);return this.x=(o[0]*r+o[4]*a+o[8]*i+o[12])*s,this.y=(o[1]*r+o[5]*a+o[9]*i+o[13])*s,this.z=(o[2]*r+o[6]*a+o[10]*i+o[14])*s,this}applyQuaternion(t){let r=this.x,a=this.y,i=this.z,o=t.x,s=t.y,n=t.z,l=t.w,h=2*(s*i-n*a),u=2*(n*r-o*i),d=2*(o*a-s*r);return this.x=r+l*h+s*d-n*u,this.y=a+l*u+n*h-o*d,this.z=i+l*d+o*u-s*h,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let r=this.x,a=this.y,i=this.z,o=t.elements;return this.x=o[0]*r+o[4]*a+o[8]*i,this.y=o[1]*r+o[5]*a+o[9]*i,this.z=o[2]*r+o[6]*a+o[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,r){return this.x=Bt(this.x,t.x,r.x),this.y=Bt(this.y,t.y,r.y),this.z=Bt(this.z,t.z,r.z),this}clampScalar(t,r){return this.x=Bt(this.x,t,r),this.y=Bt(this.y,t,r),this.z=Bt(this.z,t,r),this}clampLength(t,r){let a=this.length();return this.divideScalar(a||1).multiplyScalar(Bt(a,t,r))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,r){return this.x+=(t.x-this.x)*r,this.y+=(t.y-this.y)*r,this.z+=(t.z-this.z)*r,this}lerpVectors(t,r,a){return this.x=t.x+(r.x-t.x)*a,this.y=t.y+(r.y-t.y)*a,this.z=t.z+(r.z-t.z)*a,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,r){let a=t.x,i=t.y,o=t.z,s=r.x,n=r.y,l=r.z;return this.x=i*l-o*n,this.y=o*s-a*l,this.z=a*n-i*s,this}projectOnVector(t){let r=t.lengthSq();if(r===0)return this.set(0,0,0);let a=t.dot(this)/r;return this.copy(t).multiplyScalar(a)}projectOnPlane(t){return Jm.copy(this).projectOnVector(t),this.sub(Jm)}reflect(t){return this.sub(Jm.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let r=Math.sqrt(this.lengthSq()*t.lengthSq());if(r===0)return Math.PI/2;let a=this.dot(t)/r;return Math.acos(Bt(a,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let r=this.x-t.x,a=this.y-t.y,i=this.z-t.z;return r*r+a*a+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,r,a){let i=Math.sin(r)*t;return this.x=i*Math.sin(a),this.y=Math.cos(r)*t,this.z=i*Math.cos(a),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,r,a){return this.x=t*Math.sin(r),this.y=a,this.z=t*Math.cos(r),this}setFromMatrixPosition(t){let r=t.elements;return this.x=r[12],this.y=r[13],this.z=r[14],this}setFromMatrixScale(t){let r=this.setFromMatrixColumn(t,0).length(),a=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=r,this.y=a,this.z=i,this}setFromMatrixColumn(t,r){return this.fromArray(t.elements,r*4)}setFromMatrix3Column(t,r){return this.fromArray(t.elements,r*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,r=0){return this.x=t[r],this.y=t[r+1],this.z=t[r+2],this}toArray(t=[],r=0){return t[r]=this.x,t[r+1]=this.y,t[r+2]=this.z,t}fromBufferAttribute(t,r){return this.x=t.getX(r),this.y=t.getY(r),this.z=t.getZ(r),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,r=Math.random()*2-1,a=Math.sqrt(1-r*r);return this.x=a*Math.cos(t),this.y=r,this.z=a*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Jm=new Q,Qv=new Wt,Jt=class r6{constructor(t,r,a,i,o,s,n,l,h){r6.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,r,a,i,o,s,n,l,h)}set(t,r,a,i,o,s,n,l,h){let u=this.elements;return u[0]=t,u[1]=i,u[2]=n,u[3]=r,u[4]=o,u[5]=l,u[6]=a,u[7]=s,u[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let r=this.elements,a=t.elements;return r[0]=a[0],r[1]=a[1],r[2]=a[2],r[3]=a[3],r[4]=a[4],r[5]=a[5],r[6]=a[6],r[7]=a[7],r[8]=a[8],this}extractBasis(t,r,a){return t.setFromMatrix3Column(this,0),r.setFromMatrix3Column(this,1),a.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let r=t.elements;return this.set(r[0],r[4],r[8],r[1],r[5],r[9],r[2],r[6],r[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,r){let a=t.elements,i=r.elements,o=this.elements,s=a[0],n=a[3],l=a[6],h=a[1],u=a[4],d=a[7],c=a[2],g=a[5],p=a[8],m=i[0],v=i[3],y=i[6],x=i[1],b=i[4],f=i[7],_=i[2],M=i[5],w=i[8];return o[0]=s*m+n*x+l*_,o[3]=s*v+n*b+l*M,o[6]=s*y+n*f+l*w,o[1]=h*m+u*x+d*_,o[4]=h*v+u*b+d*M,o[7]=h*y+u*f+d*w,o[2]=c*m+g*x+p*_,o[5]=c*v+g*b+p*M,o[8]=c*y+g*f+p*w,this}multiplyScalar(t){let r=this.elements;return r[0]*=t,r[3]*=t,r[6]*=t,r[1]*=t,r[4]*=t,r[7]*=t,r[2]*=t,r[5]*=t,r[8]*=t,this}determinant(){let t=this.elements,r=t[0],a=t[1],i=t[2],o=t[3],s=t[4],n=t[5],l=t[6],h=t[7],u=t[8];return r*s*u-r*n*h-a*o*u+a*n*l+i*o*h-i*s*l}invert(){let t=this.elements,r=t[0],a=t[1],i=t[2],o=t[3],s=t[4],n=t[5],l=t[6],h=t[7],u=t[8],d=u*s-n*h,c=n*l-u*o,g=h*o-s*l,p=r*d+a*c+i*g;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return t[0]=d*m,t[1]=(i*h-u*a)*m,t[2]=(n*a-i*s)*m,t[3]=c*m,t[4]=(u*r-i*l)*m,t[5]=(i*o-n*r)*m,t[6]=g*m,t[7]=(a*l-h*r)*m,t[8]=(s*r-a*o)*m,this}transpose(){let t,r=this.elements;return t=r[1],r[1]=r[3],r[3]=t,t=r[2],r[2]=r[6],r[6]=t,t=r[5],r[5]=r[7],r[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let r=this.elements;return t[0]=r[0],t[1]=r[3],t[2]=r[6],t[3]=r[1],t[4]=r[4],t[5]=r[7],t[6]=r[2],t[7]=r[5],t[8]=r[8],this}setUvTransform(t,r,a,i,o,s,n){let l=Math.cos(o),h=Math.sin(o);return this.set(a*l,a*h,-a*(l*s+h*n)+s+t,-i*h,i*l,-i*(-h*s+l*n)+n+r,0,0,1),this}scale(t,r){return this.premultiply(Qm.makeScale(t,r)),this}rotate(t){return this.premultiply(Qm.makeRotation(-t)),this}translate(t,r){return this.premultiply(Qm.makeTranslation(t,r)),this}makeTranslation(t,r){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,r,0,0,1),this}makeRotation(t){let r=Math.cos(t),a=Math.sin(t);return this.set(r,-a,0,a,r,0,0,0,1),this}makeScale(t,r){return this.set(t,0,0,0,r,0,0,0,1),this}equals(t){let r=this.elements,a=t.elements;for(let i=0;i<9;i++)if(r[i]!==a[i])return!1;return!0}fromArray(t,r=0){for(let a=0;a<9;a++)this.elements[a]=t[a+r];return this}toArray(t=[],r=0){let a=this.elements;return t[r]=a[0],t[r+1]=a[1],t[r+2]=a[2],t[r+3]=a[3],t[r+4]=a[4],t[r+5]=a[5],t[r+6]=a[6],t[r+7]=a[7],t[r+8]=a[8],t}clone(){return new this.constructor().fromArray(this.elements)}},Qm=new Jt;function e3(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}var N_={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function gh(e,t){return new N_[e](t)}function hc(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function t3(){let e=hc("canvas");return e.style.display="block",e}var r3={};function uc(e){e in r3||(r3[e]=!0,console.warn(e))}function F_(e,t,r){return new Promise(function(a,i){function o(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(o,r);break;default:a()}}setTimeout(o,r)})}var a3=new Jt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),i3=new Jt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function O_(){let e={enabled:!0,workingColorSpace:hn,spaces:{},convert:function(i,o,s){return this.enabled===!1||o===s||!o||!s||(this.spaces[o].transfer===O0&&(i.r=Ss(i.r),i.g=Ss(i.g),i.b=Ss(i.b)),this.spaces[o].primaries!==this.spaces[s].primaries&&(i.applyMatrix3(this.spaces[o].toXYZ),i.applyMatrix3(this.spaces[s].fromXYZ)),this.spaces[s].transfer===O0&&(i.r=vh(i.r),i.g=vh(i.g),i.b=vh(i.b))),i},workingToColorSpace:function(i,o){return this.convert(i,this.workingColorSpace,o)},colorSpaceToWorking:function(i,o){return this.convert(i,o,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===Fa?sc:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,o=this.workingColorSpace){return i.fromArray(this.spaces[o].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,o,s){return i.copy(this.spaces[o].toXYZ).multiply(this.spaces[s].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,o){return uc("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),e.workingToColorSpace(i,o)},toWorkingColorSpace:function(i,o){return uc("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),e.colorSpaceToWorking(i,o)}},t=[.64,.33,.3,.6,.15,.06],r=[.2126,.7152,.0722],a=[.3127,.329];return e.define({[hn]:{primaries:t,whitePoint:a,transfer:sc,toXYZ:a3,fromXYZ:i3,luminanceCoefficients:r,workingColorSpaceConfig:{unpackColorSpace:da},outputColorSpaceConfig:{drawingBufferColorSpace:da}},[da]:{primaries:t,whitePoint:a,transfer:O0,toXYZ:a3,fromXYZ:i3,luminanceCoefficients:r,outputColorSpaceConfig:{drawingBufferColorSpace:da}}}),e}var x0=O_();function Ss(e){return e<.04045?e*.0773993808:Math.pow(e*.9478672986+.0521327014,2.4)}function vh(e){return e<.0031308?e*12.92:1.055*Math.pow(e,.41666)-.055}var xh,o3=class{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let r;if(e instanceof HTMLCanvasElement)r=e;else{xh===void 0&&(xh=hc("canvas")),xh.width=e.width,xh.height=e.height;let a=xh.getContext("2d");e instanceof ImageData?a.putImageData(e,0,0):a.drawImage(e,0,0,e.width,e.height),r=xh}return r.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=hc("canvas");t.width=e.width,t.height=e.height;let r=t.getContext("2d");r.drawImage(e,0,0,e.width,e.height);let a=r.getImageData(0,0,e.width,e.height),i=a.data;for(let o=0;o<i.length;o++)i[o]=Ss(i[o]/255)*255;return r.putImageData(a,0,0),t}else if(e.data){let t=e.data.slice(0);for(let r=0;r<t.length;r++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[r]=Math.floor(Ss(t[r]/255)*255):t[r]=Ss(t[r]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},B_=0,un=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:B_++}),this.uuid=Ki(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let r={uuid:this.uuid,url:""},a=this.data;if(a!==null){let i;if(Array.isArray(a)){i=[];for(let o=0,s=a.length;o<s;o++)a[o].isDataTexture?i.push(e2(a[o].image)):i.push(e2(a[o]))}else i=e2(a);r.url=i}return t||(e.images[this.uuid]=r),r}};function e2(e){return typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap?o3.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var V_=0,t2=new Q,Ca=class km extends ts{constructor(t=km.DEFAULT_IMAGE,r=km.DEFAULT_MAPPING,a=Ja,i=Ja,o=F0,s=ca,n=wr,l=Qa,h=km.DEFAULT_ANISOTROPY,u=Fa){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:V_++}),this.uuid=Ki(),this.name="",this.source=new un(t),this.mipmaps=[],this.mapping=r,this.channel=0,this.wrapS=a,this.wrapT=i,this.magFilter=o,this.minFilter=s,this.anisotropy=h,this.format=n,this.internalFormat=null,this.type=l,this.offset=new je(0,0),this.repeat=new je(1,1),this.center=new je(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Jt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(t2).x}get height(){return this.source.getSize(t2).y}get depth(){return this.source.getSize(t2).z}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(t,r){this.updateRanges.push({start:t,count:r})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(let r in t){let a=t[r];if(a===void 0){console.warn(`THREE.Texture.setValues(): parameter '${r}' has value of undefined.`);continue}let i=this[r];if(i===void 0){console.warn(`THREE.Texture.setValues(): property '${r}' does not exist.`);continue}i&&a&&i.isVector2&&a.isVector2||i&&a&&i.isVector3&&a.isVector3||i&&a&&i.isMatrix3&&a.isMatrix3?i.copy(a):this[r]=a}}toJSON(t){let r=t===void 0||typeof t=="string";if(!r&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let a={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(a.userData=this.userData),r||(t.textures[this.uuid]=a),a}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==i1)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Lo:t.x=t.x-Math.floor(t.x);break;case Ja:t.x=t.x<0?0:1;break;case Zu:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case Lo:t.y=t.y-Math.floor(t.y);break;case Ja:t.y=t.y<0?0:1;break;case Zu:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}};Ca.DEFAULT_IMAGE=null,Ca.DEFAULT_MAPPING=i1,Ca.DEFAULT_ANISOTROPY=1;var s0=class a6{constructor(t=0,r=0,a=0,i=1){a6.prototype.isVector4=!0,this.x=t,this.y=r,this.z=a,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,r,a,i){return this.x=t,this.y=r,this.z=a,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,r){switch(t){case 0:this.x=r;break;case 1:this.y=r;break;case 2:this.z=r;break;case 3:this.w=r;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,r){return this.x=t.x+r.x,this.y=t.y+r.y,this.z=t.z+r.z,this.w=t.w+r.w,this}addScaledVector(t,r){return this.x+=t.x*r,this.y+=t.y*r,this.z+=t.z*r,this.w+=t.w*r,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,r){return this.x=t.x-r.x,this.y=t.y-r.y,this.z=t.z-r.z,this.w=t.w-r.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let r=this.x,a=this.y,i=this.z,o=this.w,s=t.elements;return this.x=s[0]*r+s[4]*a+s[8]*i+s[12]*o,this.y=s[1]*r+s[5]*a+s[9]*i+s[13]*o,this.z=s[2]*r+s[6]*a+s[10]*i+s[14]*o,this.w=s[3]*r+s[7]*a+s[11]*i+s[15]*o,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let r=Math.sqrt(1-t.w*t.w);return r<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/r,this.y=t.y/r,this.z=t.z/r),this}setAxisAngleFromRotationMatrix(t){let r,a,i,o,s=t.elements,n=s[0],l=s[4],h=s[8],u=s[1],d=s[5],c=s[9],g=s[2],p=s[6],m=s[10];if(Math.abs(l-u)<.01&&Math.abs(h-g)<.01&&Math.abs(c-p)<.01){if(Math.abs(l+u)<.1&&Math.abs(h+g)<.1&&Math.abs(c+p)<.1&&Math.abs(n+d+m-3)<.1)return this.set(1,0,0,0),this;r=Math.PI;let y=(n+1)/2,x=(d+1)/2,b=(m+1)/2,f=(l+u)/4,_=(h+g)/4,M=(c+p)/4;return y>x&&y>b?y<.01?(a=0,i=.707106781,o=.707106781):(a=Math.sqrt(y),i=f/a,o=_/a):x>b?x<.01?(a=.707106781,i=0,o=.707106781):(i=Math.sqrt(x),a=f/i,o=M/i):b<.01?(a=.707106781,i=.707106781,o=0):(o=Math.sqrt(b),a=_/o,i=M/o),this.set(a,i,o,r),this}let v=Math.sqrt((p-c)*(p-c)+(h-g)*(h-g)+(u-l)*(u-l));return Math.abs(v)<.001&&(v=1),this.x=(p-c)/v,this.y=(h-g)/v,this.z=(u-l)/v,this.w=Math.acos((n+d+m-1)/2),this}setFromMatrixPosition(t){let r=t.elements;return this.x=r[12],this.y=r[13],this.z=r[14],this.w=r[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,r){return this.x=Bt(this.x,t.x,r.x),this.y=Bt(this.y,t.y,r.y),this.z=Bt(this.z,t.z,r.z),this.w=Bt(this.w,t.w,r.w),this}clampScalar(t,r){return this.x=Bt(this.x,t,r),this.y=Bt(this.y,t,r),this.z=Bt(this.z,t,r),this.w=Bt(this.w,t,r),this}clampLength(t,r){let a=this.length();return this.divideScalar(a||1).multiplyScalar(Bt(a,t,r))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,r){return this.x+=(t.x-this.x)*r,this.y+=(t.y-this.y)*r,this.z+=(t.z-this.z)*r,this.w+=(t.w-this.w)*r,this}lerpVectors(t,r,a){return this.x=t.x+(r.x-t.x)*a,this.y=t.y+(r.y-t.y)*a,this.z=t.z+(r.z-t.z)*a,this.w=t.w+(r.w-t.w)*a,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,r=0){return this.x=t[r],this.y=t[r+1],this.z=t[r+2],this.w=t[r+3],this}toArray(t=[],r=0){return t[r]=this.x,t[r+1]=this.y,t[r+2]=this.z,t[r+3]=this.w,t}fromBufferAttribute(t,r){return this.x=t.getX(r),this.y=t.getY(r),this.z=t.getZ(r),this.w=t.getW(r),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},r2=class extends ts{constructor(e=1,t=1,r={}){super(),r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:F0,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},r),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=r.depth,this.scissor=new s0(0,0,e,t),this.scissorTest=!1,this.viewport=new s0(0,0,e,t);let a={width:e,height:t,depth:r.depth},i=new Ca(a);this.textures=[];let o=r.count;for(let s=0;s<o;s++)this.textures[s]=i.clone(),this.textures[s].isRenderTargetTexture=!0,this.textures[s].renderTarget=this;this._setTextureOptions(r),this.depthBuffer=r.depthBuffer,this.stencilBuffer=r.stencilBuffer,this.resolveDepthBuffer=r.resolveDepthBuffer,this.resolveStencilBuffer=r.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=r.depthTexture,this.samples=r.samples,this.multiview=r.multiview}_setTextureOptions(e={}){let t={minFilter:F0,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let r=0;r<this.textures.length;r++)this.textures[r].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,r=1){if(this.width!==e||this.height!==t||this.depth!==r){this.width=e,this.height=t,this.depth=r;for(let a=0,i=this.textures.length;a<i;a++)this.textures[a].image.width=e,this.textures[a].image.height=t,this.textures[a].image.depth=r,this.textures[a].isArrayTexture=this.textures[a].image.depth>1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,r=e.textures.length;t<r;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let a=Object.assign({},e.textures[t].image);this.textures[t].source=new un(a)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}},ti=class extends r2{constructor(e=1,t=1,r={}){super(e,t,r),this.isWebGLRenderTarget=!0}},H1=class extends Ca{constructor(e=null,t=1,r=1,a=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:r,depth:a},this.magFilter=Wr,this.minFilter=Wr,this.wrapR=Ja,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}},H_=class extends ti{constructor(e=1,t=1,r=1,a={}){super(e,t,a),this.isWebGLArrayRenderTarget=!0,this.depth=r,this.texture=new H1(null,e,t,r),this._setTextureOptions(a),this.texture.isRenderTargetTexture=!0}},G1=class extends Ca{constructor(e=null,t=1,r=1,a=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:r,depth:a},this.magFilter=Wr,this.minFilter=Wr,this.wrapR=Ja,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},G_=class extends ti{constructor(e=1,t=1,r=1,a={}){super(e,t,a),this.isWebGL3DRenderTarget=!0,this.depth=r,this.texture=new G1(null,e,t,r),this._setTextureOptions(a),this.texture.isRenderTargetTexture=!0}},_r=class{constructor(e=new Q(1/0,1/0,1/0),t=new Q(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t+=3)this.expandByPoint(Do.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,r=e.count;t<r;t++)this.expandByPoint(Do.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let r=Do.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let r=e.geometry;if(r!==void 0){let i=r.getAttribute("position");if(t===!0&&i!==void 0&&e.isInstancedMesh!==!0)for(let o=0,s=i.count;o<s;o++)e.isMesh===!0?e.getVertexPosition(o,Do):Do.fromBufferAttribute(i,o),Do.applyMatrix4(e.matrixWorld),this.expandByPoint(Do);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),W1.copy(e.boundingBox)):(r.boundingBox===null&&r.computeBoundingBox(),W1.copy(r.boundingBox)),W1.applyMatrix4(e.matrixWorld),this.union(W1)}let a=e.children;for(let i=0,o=a.length;i<o;i++)this.expandByObject(a[i],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Do),Do.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(cc),q1.subVectors(this.max,cc),yh.subVectors(e.a,cc),bh.subVectors(e.b,cc),Mh.subVectors(e.c,cc),cn.subVectors(bh,yh),dn.subVectors(Mh,bh),ll.subVectors(yh,Mh);let t=[0,-cn.z,cn.y,0,-dn.z,dn.y,0,-ll.z,ll.y,cn.z,0,-cn.x,dn.z,0,-dn.x,ll.z,0,-ll.x,-cn.y,cn.x,0,-dn.y,dn.x,0,-ll.y,ll.x,0];return!a2(t,yh,bh,Mh,q1)||(t=[1,0,0,0,1,0,0,0,1],!a2(t,yh,bh,Mh,q1))?!1:(j1.crossVectors(cn,dn),t=[j1.x,j1.y,j1.z],a2(t,yh,bh,Mh,q1))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Do).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Do).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Ts[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ts[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ts[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ts[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ts[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ts[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ts[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ts[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ts),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},Ts=[new Q,new Q,new Q,new Q,new Q,new Q,new Q,new Q],Do=new Q,W1=new _r,yh=new Q,bh=new Q,Mh=new Q,cn=new Q,dn=new Q,ll=new Q,cc=new Q,q1=new Q,j1=new Q,hl=new Q;function a2(e,t,r,a,i){for(let o=0,s=e.length-3;o<=s;o+=3){hl.fromArray(e,o);let n=i.x*Math.abs(hl.x)+i.y*Math.abs(hl.y)+i.z*Math.abs(hl.z),l=t.dot(hl),h=r.dot(hl),u=a.dot(hl);if(Math.max(-Math.max(l,h,u),Math.min(l,h,u))>n)return!1}return!0}var W_=new _r,dc=new Q,i2=new Q,Lr=class{constructor(e=new Q,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let r=this.center;t!==void 0?r.copy(t):W_.setFromPoints(e).getCenter(r);let a=0;for(let i=0,o=e.length;i<o;i++)a=Math.max(a,r.distanceToSquared(e[i]));return this.radius=Math.sqrt(a),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let r=this.center.distanceToSquared(e);return t.copy(e),r>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;dc.subVectors(e,this.center);let t=dc.lengthSq();if(t>this.radius*this.radius){let r=Math.sqrt(t),a=(r-this.radius)*.5;this.center.addScaledVector(dc,a/r),this.radius+=a}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(i2.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(dc.copy(e.center).add(i2)),this.expandByPoint(dc.copy(e.center).sub(i2))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},As=new Q,o2=new Q,X1=new Q,pn=new Q,s2=new Q,Y1=new Q,n2=new Q,wh=class{constructor(e=new Q,t=new Q(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,As)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let r=t.dot(this.direction);return r<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=As.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(As.copy(this.origin).addScaledVector(this.direction,t),As.distanceToSquared(e))}distanceSqToSegment(e,t,r,a){o2.copy(e).add(t).multiplyScalar(.5),X1.copy(t).sub(e).normalize(),pn.copy(this.origin).sub(o2);let i=e.distanceTo(t)*.5,o=-this.direction.dot(X1),s=pn.dot(this.direction),n=-pn.dot(X1),l=pn.lengthSq(),h=Math.abs(1-o*o),u,d,c,g;if(h>0)if(u=o*n-s,d=o*s-n,g=i*h,u>=0)if(d>=-g)if(d<=g){let p=1/h;u*=p,d*=p,c=u*(u+o*d+2*s)+d*(o*u+d+2*n)+l}else d=i,u=Math.max(0,-(o*d+s)),c=-u*u+d*(d+2*n)+l;else d=-i,u=Math.max(0,-(o*d+s)),c=-u*u+d*(d+2*n)+l;else d<=-g?(u=Math.max(0,-(-o*i+s)),d=u>0?-i:Math.min(Math.max(-i,-n),i),c=-u*u+d*(d+2*n)+l):d<=g?(u=0,d=Math.min(Math.max(-i,-n),i),c=d*(d+2*n)+l):(u=Math.max(0,-(o*i+s)),d=u>0?i:Math.min(Math.max(-i,-n),i),c=-u*u+d*(d+2*n)+l);else d=o>0?-i:i,u=Math.max(0,-(o*d+s)),c=-u*u+d*(d+2*n)+l;return r&&r.copy(this.origin).addScaledVector(this.direction,u),a&&a.copy(o2).addScaledVector(X1,d),c}intersectSphere(e,t){As.subVectors(e.center,this.origin);let r=As.dot(this.direction),a=As.dot(As)-r*r,i=e.radius*e.radius;if(a>i)return null;let o=Math.sqrt(i-a),s=r-o,n=r+o;return n<0?null:s<0?this.at(n,t):this.at(s,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null}intersectPlane(e,t){let r=this.distanceToPlane(e);return r===null?null:this.at(r,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let r,a,i,o,s,n,l=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,d=this.origin;return l>=0?(r=(e.min.x-d.x)*l,a=(e.max.x-d.x)*l):(r=(e.max.x-d.x)*l,a=(e.min.x-d.x)*l),h>=0?(i=(e.min.y-d.y)*h,o=(e.max.y-d.y)*h):(i=(e.max.y-d.y)*h,o=(e.min.y-d.y)*h),r>o||i>a||((i>r||isNaN(r))&&(r=i),(o<a||isNaN(a))&&(a=o),u>=0?(s=(e.min.z-d.z)*u,n=(e.max.z-d.z)*u):(s=(e.max.z-d.z)*u,n=(e.min.z-d.z)*u),r>n||s>a)||((s>r||r!==r)&&(r=s),(n<a||a!==a)&&(a=n),a<0)?null:this.at(r>=0?r:a,t)}intersectsBox(e){return this.intersectBox(e,As)!==null}intersectTriangle(e,t,r,a,i){s2.subVectors(t,e),Y1.subVectors(r,e),n2.crossVectors(s2,Y1);let o=this.direction.dot(n2),s;if(o>0){if(a)return null;s=1}else if(o<0)s=-1,o=-o;else return null;pn.subVectors(this.origin,e);let n=s*this.direction.dot(Y1.crossVectors(pn,Y1));if(n<0)return null;let l=s*this.direction.dot(s2.cross(pn));if(l<0||n+l>o)return null;let h=-s*pn.dot(n2);return h<0?null:this.at(h/o,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},ut=class dv{constructor(t,r,a,i,o,s,n,l,h,u,d,c,g,p,m,v){dv.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,r,a,i,o,s,n,l,h,u,d,c,g,p,m,v)}set(t,r,a,i,o,s,n,l,h,u,d,c,g,p,m,v){let y=this.elements;return y[0]=t,y[4]=r,y[8]=a,y[12]=i,y[1]=o,y[5]=s,y[9]=n,y[13]=l,y[2]=h,y[6]=u,y[10]=d,y[14]=c,y[3]=g,y[7]=p,y[11]=m,y[15]=v,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new dv().fromArray(this.elements)}copy(t){let r=this.elements,a=t.elements;return r[0]=a[0],r[1]=a[1],r[2]=a[2],r[3]=a[3],r[4]=a[4],r[5]=a[5],r[6]=a[6],r[7]=a[7],r[8]=a[8],r[9]=a[9],r[10]=a[10],r[11]=a[11],r[12]=a[12],r[13]=a[13],r[14]=a[14],r[15]=a[15],this}copyPosition(t){let r=this.elements,a=t.elements;return r[12]=a[12],r[13]=a[13],r[14]=a[14],this}setFromMatrix3(t){let r=t.elements;return this.set(r[0],r[3],r[6],0,r[1],r[4],r[7],0,r[2],r[5],r[8],0,0,0,0,1),this}extractBasis(t,r,a){return t.setFromMatrixColumn(this,0),r.setFromMatrixColumn(this,1),a.setFromMatrixColumn(this,2),this}makeBasis(t,r,a){return this.set(t.x,r.x,a.x,0,t.y,r.y,a.y,0,t.z,r.z,a.z,0,0,0,0,1),this}extractRotation(t){let r=this.elements,a=t.elements,i=1/_h.setFromMatrixColumn(t,0).length(),o=1/_h.setFromMatrixColumn(t,1).length(),s=1/_h.setFromMatrixColumn(t,2).length();return r[0]=a[0]*i,r[1]=a[1]*i,r[2]=a[2]*i,r[3]=0,r[4]=a[4]*o,r[5]=a[5]*o,r[6]=a[6]*o,r[7]=0,r[8]=a[8]*s,r[9]=a[9]*s,r[10]=a[10]*s,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,this}makeRotationFromEuler(t){let r=this.elements,a=t.x,i=t.y,o=t.z,s=Math.cos(a),n=Math.sin(a),l=Math.cos(i),h=Math.sin(i),u=Math.cos(o),d=Math.sin(o);if(t.order==="XYZ"){let c=s*u,g=s*d,p=n*u,m=n*d;r[0]=l*u,r[4]=-l*d,r[8]=h,r[1]=g+p*h,r[5]=c-m*h,r[9]=-n*l,r[2]=m-c*h,r[6]=p+g*h,r[10]=s*l}else if(t.order==="YXZ"){let c=l*u,g=l*d,p=h*u,m=h*d;r[0]=c+m*n,r[4]=p*n-g,r[8]=s*h,r[1]=s*d,r[5]=s*u,r[9]=-n,r[2]=g*n-p,r[6]=m+c*n,r[10]=s*l}else if(t.order==="ZXY"){let c=l*u,g=l*d,p=h*u,m=h*d;r[0]=c-m*n,r[4]=-s*d,r[8]=p+g*n,r[1]=g+p*n,r[5]=s*u,r[9]=m-c*n,r[2]=-s*h,r[6]=n,r[10]=s*l}else if(t.order==="ZYX"){let c=s*u,g=s*d,p=n*u,m=n*d;r[0]=l*u,r[4]=p*h-g,r[8]=c*h+m,r[1]=l*d,r[5]=m*h+c,r[9]=g*h-p,r[2]=-h,r[6]=n*l,r[10]=s*l}else if(t.order==="YZX"){let c=s*l,g=s*h,p=n*l,m=n*h;r[0]=l*u,r[4]=m-c*d,r[8]=p*d+g,r[1]=d,r[5]=s*u,r[9]=-n*u,r[2]=-h*u,r[6]=g*d+p,r[10]=c-m*d}else if(t.order==="XZY"){let c=s*l,g=s*h,p=n*l,m=n*h;r[0]=l*u,r[4]=-d,r[8]=h*u,r[1]=c*d+m,r[5]=s*u,r[9]=g*d-p,r[2]=p*d-g,r[6]=n*u,r[10]=m*d+c}return r[3]=0,r[7]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,this}makeRotationFromQuaternion(t){return this.compose(q_,t,j_)}lookAt(t,r,a){let i=this.elements;return Ji.subVectors(t,r),Ji.lengthSq()===0&&(Ji.z=1),Ji.normalize(),fn.crossVectors(a,Ji),fn.lengthSq()===0&&(Math.abs(a.z)===1?Ji.x+=1e-4:Ji.z+=1e-4,Ji.normalize(),fn.crossVectors(a,Ji)),fn.normalize(),$1.crossVectors(Ji,fn),i[0]=fn.x,i[4]=$1.x,i[8]=Ji.x,i[1]=fn.y,i[5]=$1.y,i[9]=Ji.y,i[2]=fn.z,i[6]=$1.z,i[10]=Ji.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,r){let a=t.elements,i=r.elements,o=this.elements,s=a[0],n=a[4],l=a[8],h=a[12],u=a[1],d=a[5],c=a[9],g=a[13],p=a[2],m=a[6],v=a[10],y=a[14],x=a[3],b=a[7],f=a[11],_=a[15],M=i[0],w=i[4],A=i[8],S=i[12],T=i[1],C=i[5],z=i[9],k=i[13],O=i[2],H=i[6],E=i[10],I=i[14],R=i[3],D=i[7],B=i[11],V=i[15];return o[0]=s*M+n*T+l*O+h*R,o[4]=s*w+n*C+l*H+h*D,o[8]=s*A+n*z+l*E+h*B,o[12]=s*S+n*k+l*I+h*V,o[1]=u*M+d*T+c*O+g*R,o[5]=u*w+d*C+c*H+g*D,o[9]=u*A+d*z+c*E+g*B,o[13]=u*S+d*k+c*I+g*V,o[2]=p*M+m*T+v*O+y*R,o[6]=p*w+m*C+v*H+y*D,o[10]=p*A+m*z+v*E+y*B,o[14]=p*S+m*k+v*I+y*V,o[3]=x*M+b*T+f*O+_*R,o[7]=x*w+b*C+f*H+_*D,o[11]=x*A+b*z+f*E+_*B,o[15]=x*S+b*k+f*I+_*V,this}multiplyScalar(t){let r=this.elements;return r[0]*=t,r[4]*=t,r[8]*=t,r[12]*=t,r[1]*=t,r[5]*=t,r[9]*=t,r[13]*=t,r[2]*=t,r[6]*=t,r[10]*=t,r[14]*=t,r[3]*=t,r[7]*=t,r[11]*=t,r[15]*=t,this}determinant(){let t=this.elements,r=t[0],a=t[4],i=t[8],o=t[12],s=t[1],n=t[5],l=t[9],h=t[13],u=t[2],d=t[6],c=t[10],g=t[14],p=t[3],m=t[7],v=t[11],y=t[15];return p*(+o*l*d-i*h*d-o*n*c+a*h*c+i*n*g-a*l*g)+m*(+r*l*g-r*h*c+o*s*c-i*s*g+i*h*u-o*l*u)+v*(+r*h*d-r*n*g-o*s*d+a*s*g+o*n*u-a*h*u)+y*(-i*n*u-r*l*d+r*n*c+i*s*d-a*s*c+a*l*u)}transpose(){let t=this.elements,r;return r=t[1],t[1]=t[4],t[4]=r,r=t[2],t[2]=t[8],t[8]=r,r=t[6],t[6]=t[9],t[9]=r,r=t[3],t[3]=t[12],t[12]=r,r=t[7],t[7]=t[13],t[13]=r,r=t[11],t[11]=t[14],t[14]=r,this}setPosition(t,r,a){let i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=r,i[14]=a),this}invert(){let t=this.elements,r=t[0],a=t[1],i=t[2],o=t[3],s=t[4],n=t[5],l=t[6],h=t[7],u=t[8],d=t[9],c=t[10],g=t[11],p=t[12],m=t[13],v=t[14],y=t[15],x=d*v*h-m*c*h+m*l*g-n*v*g-d*l*y+n*c*y,b=p*c*h-u*v*h-p*l*g+s*v*g+u*l*y-s*c*y,f=u*m*h-p*d*h+p*n*g-s*m*g-u*n*y+s*d*y,_=p*d*l-u*m*l-p*n*c+s*m*c+u*n*v-s*d*v,M=r*x+a*b+i*f+o*_;if(M===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let w=1/M;return t[0]=x*w,t[1]=(m*c*o-d*v*o-m*i*g+a*v*g+d*i*y-a*c*y)*w,t[2]=(n*v*o-m*l*o+m*i*h-a*v*h-n*i*y+a*l*y)*w,t[3]=(d*l*o-n*c*o-d*i*h+a*c*h+n*i*g-a*l*g)*w,t[4]=b*w,t[5]=(u*v*o-p*c*o+p*i*g-r*v*g-u*i*y+r*c*y)*w,t[6]=(p*l*o-s*v*o-p*i*h+r*v*h+s*i*y-r*l*y)*w,t[7]=(s*c*o-u*l*o+u*i*h-r*c*h-s*i*g+r*l*g)*w,t[8]=f*w,t[9]=(p*d*o-u*m*o-p*a*g+r*m*g+u*a*y-r*d*y)*w,t[10]=(s*m*o-p*n*o+p*a*h-r*m*h-s*a*y+r*n*y)*w,t[11]=(u*n*o-s*d*o-u*a*h+r*d*h+s*a*g-r*n*g)*w,t[12]=_*w,t[13]=(u*m*i-p*d*i+p*a*c-r*m*c-u*a*v+r*d*v)*w,t[14]=(p*n*i-s*m*i-p*a*l+r*m*l+s*a*v-r*n*v)*w,t[15]=(s*d*i-u*n*i+u*a*l-r*d*l-s*a*c+r*n*c)*w,this}scale(t){let r=this.elements,a=t.x,i=t.y,o=t.z;return r[0]*=a,r[4]*=i,r[8]*=o,r[1]*=a,r[5]*=i,r[9]*=o,r[2]*=a,r[6]*=i,r[10]*=o,r[3]*=a,r[7]*=i,r[11]*=o,this}getMaxScaleOnAxis(){let t=this.elements,r=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],a=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(r,a,i))}makeTranslation(t,r,a){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,r,0,0,1,a,0,0,0,1),this}makeRotationX(t){let r=Math.cos(t),a=Math.sin(t);return this.set(1,0,0,0,0,r,-a,0,0,a,r,0,0,0,0,1),this}makeRotationY(t){let r=Math.cos(t),a=Math.sin(t);return this.set(r,0,a,0,0,1,0,0,-a,0,r,0,0,0,0,1),this}makeRotationZ(t){let r=Math.cos(t),a=Math.sin(t);return this.set(r,-a,0,0,a,r,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,r){let a=Math.cos(r),i=Math.sin(r),o=1-a,s=t.x,n=t.y,l=t.z,h=o*s,u=o*n;return this.set(h*s+a,h*n-i*l,h*l+i*n,0,h*n+i*l,u*n+a,u*l-i*s,0,h*l-i*n,u*l+i*s,o*l*l+a,0,0,0,0,1),this}makeScale(t,r,a){return this.set(t,0,0,0,0,r,0,0,0,0,a,0,0,0,0,1),this}makeShear(t,r,a,i,o,s){return this.set(1,a,o,0,t,1,s,0,r,i,1,0,0,0,0,1),this}compose(t,r,a){let i=this.elements,o=r._x,s=r._y,n=r._z,l=r._w,h=o+o,u=s+s,d=n+n,c=o*h,g=o*u,p=o*d,m=s*u,v=s*d,y=n*d,x=l*h,b=l*u,f=l*d,_=a.x,M=a.y,w=a.z;return i[0]=(1-(m+y))*_,i[1]=(g+f)*_,i[2]=(p-b)*_,i[3]=0,i[4]=(g-f)*M,i[5]=(1-(c+y))*M,i[6]=(v+x)*M,i[7]=0,i[8]=(p+b)*w,i[9]=(v-x)*w,i[10]=(1-(c+m))*w,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,r,a){let i=this.elements,o=_h.set(i[0],i[1],i[2]).length(),s=_h.set(i[4],i[5],i[6]).length(),n=_h.set(i[8],i[9],i[10]).length();this.determinant()<0&&(o=-o),t.x=i[12],t.y=i[13],t.z=i[14],No.copy(this);let l=1/o,h=1/s,u=1/n;return No.elements[0]*=l,No.elements[1]*=l,No.elements[2]*=l,No.elements[4]*=h,No.elements[5]*=h,No.elements[6]*=h,No.elements[8]*=u,No.elements[9]*=u,No.elements[10]*=u,r.setFromRotationMatrix(No),a.x=o,a.y=s,a.z=n,this}makePerspective(t,r,a,i,o,s,n=Zi,l=!1){let h=this.elements,u=2*o/(r-t),d=2*o/(a-i),c=(r+t)/(r-t),g=(a+i)/(a-i),p,m;if(l)p=o/(s-o),m=s*o/(s-o);else if(n===Zi)p=-(s+o)/(s-o),m=-2*s*o/(s-o);else if(n===fh)p=-s/(s-o),m=-s*o/(s-o);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+n);return h[0]=u,h[4]=0,h[8]=c,h[12]=0,h[1]=0,h[5]=d,h[9]=g,h[13]=0,h[2]=0,h[6]=0,h[10]=p,h[14]=m,h[3]=0,h[7]=0,h[11]=-1,h[15]=0,this}makeOrthographic(t,r,a,i,o,s,n=Zi,l=!1){let h=this.elements,u=2/(r-t),d=2/(a-i),c=-(r+t)/(r-t),g=-(a+i)/(a-i),p,m;if(l)p=1/(s-o),m=s/(s-o);else if(n===Zi)p=-2/(s-o),m=-(s+o)/(s-o);else if(n===fh)p=-1/(s-o),m=-o/(s-o);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+n);return h[0]=u,h[4]=0,h[8]=0,h[12]=c,h[1]=0,h[5]=d,h[9]=0,h[13]=g,h[2]=0,h[6]=0,h[10]=p,h[14]=m,h[3]=0,h[7]=0,h[11]=0,h[15]=1,this}equals(t){let r=this.elements,a=t.elements;for(let i=0;i<16;i++)if(r[i]!==a[i])return!1;return!0}fromArray(t,r=0){for(let a=0;a<16;a++)this.elements[a]=t[a+r];return this}toArray(t=[],r=0){let a=this.elements;return t[r]=a[0],t[r+1]=a[1],t[r+2]=a[2],t[r+3]=a[3],t[r+4]=a[4],t[r+5]=a[5],t[r+6]=a[6],t[r+7]=a[7],t[r+8]=a[8],t[r+9]=a[9],t[r+10]=a[10],t[r+11]=a[11],t[r+12]=a[12],t[r+13]=a[13],t[r+14]=a[14],t[r+15]=a[15],t}},_h=new Q,No=new ut,q_=new Q(0,0,0),j_=new Q(1,1,1),fn=new Q,$1=new Q,Ji=new Q,s3=new ut,n3=new Wt,Sr=class i6{constructor(t=0,r=0,a=0,i=i6.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=r,this._z=a,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,r,a,i=this._order){return this._x=t,this._y=r,this._z=a,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,r=this._order,a=!0){let i=t.elements,o=i[0],s=i[4],n=i[8],l=i[1],h=i[5],u=i[9],d=i[2],c=i[6],g=i[10];switch(r){case"XYZ":this._y=Math.asin(Bt(n,-1,1)),Math.abs(n)<.9999999?(this._x=Math.atan2(-u,g),this._z=Math.atan2(-s,o)):(this._x=Math.atan2(c,h),this._z=0);break;case"YXZ":this._x=Math.asin(-Bt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(n,g),this._z=Math.atan2(l,h)):(this._y=Math.atan2(-d,o),this._z=0);break;case"ZXY":this._x=Math.asin(Bt(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(-d,g),this._z=Math.atan2(-s,h)):(this._y=0,this._z=Math.atan2(l,o));break;case"ZYX":this._y=Math.asin(-Bt(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(c,g),this._z=Math.atan2(l,o)):(this._x=0,this._z=Math.atan2(-s,h));break;case"YZX":this._z=Math.asin(Bt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,h),this._y=Math.atan2(-d,o)):(this._x=0,this._y=Math.atan2(n,g));break;case"XZY":this._z=Math.asin(-Bt(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(c,h),this._y=Math.atan2(n,o)):(this._x=Math.atan2(-u,g),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+r)}return this._order=r,a===!0&&this._onChangeCallback(),this}setFromQuaternion(t,r,a){return s3.makeRotationFromQuaternion(t),this.setFromRotationMatrix(s3,r,a)}setFromVector3(t,r=this._order){return this.set(t.x,t.y,t.z,r)}reorder(t){return n3.setFromEuler(this),this.setFromQuaternion(n3,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],r=0){return t[r]=this._x,t[r+1]=this._y,t[r+2]=this._z,t[r+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Sr.DEFAULT_ORDER="XYZ";var Z1=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}},X_=0,l3=new Q,Sh=new Wt,Es=new ut,K1=new Q,pc=new Q,Y_=new Q,$_=new Wt,h3=new Q(1,0,0),u3=new Q(0,1,0),c3=new Q(0,0,1),d3={type:"added"},Z_={type:"removed"},Th={type:"childadded",child:null},l2={type:"childremoved",child:null},I0=class Pm extends ts{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:X_++}),this.uuid=Ki(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Pm.DEFAULT_UP.clone();let t=new Q,r=new Sr,a=new Wt,i=new Q(1,1,1);function o(){a.setFromEuler(r,!1)}function s(){r.setFromQuaternion(a,void 0,!1)}r._onChange(o),a._onChange(s),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:r},quaternion:{configurable:!0,enumerable:!0,value:a},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new ut},normalMatrix:{value:new Jt}}),this.matrix=new ut,this.matrixWorld=new ut,this.matrixAutoUpdate=Pm.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Pm.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Z1,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,r){this.quaternion.setFromAxisAngle(t,r)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,r){return Sh.setFromAxisAngle(t,r),this.quaternion.multiply(Sh),this}rotateOnWorldAxis(t,r){return Sh.setFromAxisAngle(t,r),this.quaternion.premultiply(Sh),this}rotateX(t){return this.rotateOnAxis(h3,t)}rotateY(t){return this.rotateOnAxis(u3,t)}rotateZ(t){return this.rotateOnAxis(c3,t)}translateOnAxis(t,r){return l3.copy(t).applyQuaternion(this.quaternion),this.position.add(l3.multiplyScalar(r)),this}translateX(t){return this.translateOnAxis(h3,t)}translateY(t){return this.translateOnAxis(u3,t)}translateZ(t){return this.translateOnAxis(c3,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Es.copy(this.matrixWorld).invert())}lookAt(t,r,a){t.isVector3?K1.copy(t):K1.set(t,r,a);let i=this.parent;this.updateWorldMatrix(!0,!1),pc.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Es.lookAt(pc,K1,this.up):Es.lookAt(K1,pc,this.up),this.quaternion.setFromRotationMatrix(Es),i&&(Es.extractRotation(i.matrixWorld),Sh.setFromRotationMatrix(Es),this.quaternion.premultiply(Sh.invert()))}add(t){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.add(arguments[r]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(d3),Th.child=t,this.dispatchEvent(Th),Th.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let a=0;a<arguments.length;a++)this.remove(arguments[a]);return this}let r=this.children.indexOf(t);return r!==-1&&(t.parent=null,this.children.splice(r,1),t.dispatchEvent(Z_),l2.child=t,this.dispatchEvent(l2),l2.child=null),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Es.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Es.multiply(t.parent.matrixWorld)),t.applyMatrix4(Es),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(d3),Th.child=t,this.dispatchEvent(Th),Th.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,r){if(this[t]===r)return this;for(let a=0,i=this.children.length;a<i;a++){let o=this.children[a].getObjectByProperty(t,r);if(o!==void 0)return o}}getObjectsByProperty(t,r,a=[]){this[t]===r&&a.push(this);let i=this.children;for(let o=0,s=i.length;o<s;o++)i[o].getObjectsByProperty(t,r,a);return a}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(pc,t,Y_),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(pc,$_,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let r=this.matrixWorld.elements;return t.set(r[8],r[9],r[10]).normalize()}raycast(){}traverse(t){t(this);let r=this.children;for(let a=0,i=r.length;a<i;a++)r[a].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let r=this.children;for(let a=0,i=r.length;a<i;a++)r[a].traverseVisible(t)}traverseAncestors(t){let r=this.parent;r!==null&&(t(r),r.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);let r=this.children;for(let a=0,i=r.length;a<i;a++)r[a].updateMatrixWorld(t)}updateWorldMatrix(t,r){let a=this.parent;if(t===!0&&a!==null&&a.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),r===!0){let i=this.children;for(let o=0,s=i.length;o<s;o++)i[o].updateWorldMatrix(!1,!0)}}toJSON(t){let r=t===void 0||typeof t=="string",a={};r&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},a.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(n=>({...n,boundingBox:n.boundingBox?n.boundingBox.toJSON():void 0,boundingSphere:n.boundingSphere?n.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(n=>({...n})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(t),i.indirectTexture=this._indirectTexture.toJSON(t),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function o(n,l){return n[l.uuid]===void 0&&(n[l.uuid]=l.toJSON(t)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=o(t.geometries,this.geometry);let n=this.geometry.parameters;if(n!==void 0&&n.shapes!==void 0){let l=n.shapes;if(Array.isArray(l))for(let h=0,u=l.length;h<u;h++){let d=l[h];o(t.shapes,d)}else o(t.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(o(t.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let n=[];for(let l=0,h=this.material.length;l<h;l++)n.push(o(t.materials,this.material[l]));i.material=n}else i.material=o(t.materials,this.material);if(this.children.length>0){i.children=[];for(let n=0;n<this.children.length;n++)i.children.push(this.children[n].toJSON(t).object)}if(this.animations.length>0){i.animations=[];for(let n=0;n<this.animations.length;n++){let l=this.animations[n];i.animations.push(o(t.animations,l))}}if(r){let n=s(t.geometries),l=s(t.materials),h=s(t.textures),u=s(t.images),d=s(t.shapes),c=s(t.skeletons),g=s(t.animations),p=s(t.nodes);n.length>0&&(a.geometries=n),l.length>0&&(a.materials=l),h.length>0&&(a.textures=h),u.length>0&&(a.images=u),d.length>0&&(a.shapes=d),c.length>0&&(a.skeletons=c),g.length>0&&(a.animations=g),p.length>0&&(a.nodes=p)}return a.object=i,a;function s(n){let l=[];for(let h in n){let u=n[h];delete u.metadata,l.push(u)}return l}}clone(t){return new this.constructor().copy(this,t)}copy(t,r=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),r===!0)for(let a=0;a<t.children.length;a++){let i=t.children[a];this.add(i.clone())}return this}};I0.DEFAULT_UP=new Q(0,1,0),I0.DEFAULT_MATRIX_AUTO_UPDATE=!0,I0.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Fo=new Q,Rs=new Q,h2=new Q,Cs=new Q,Ah=new Q,Eh=new Q,p3=new Q,u2=new Q,c2=new Q,d2=new Q,p2=new s0,f2=new s0,m2=new s0,mn=class Hu{constructor(t=new Q,r=new Q,a=new Q){this.a=t,this.b=r,this.c=a}static getNormal(t,r,a,i){i.subVectors(a,r),Fo.subVectors(t,r),i.cross(Fo);let o=i.lengthSq();return o>0?i.multiplyScalar(1/Math.sqrt(o)):i.set(0,0,0)}static getBarycoord(t,r,a,i,o){Fo.subVectors(i,r),Rs.subVectors(a,r),h2.subVectors(t,r);let s=Fo.dot(Fo),n=Fo.dot(Rs),l=Fo.dot(h2),h=Rs.dot(Rs),u=Rs.dot(h2),d=s*h-n*n;if(d===0)return o.set(0,0,0),null;let c=1/d,g=(h*l-n*u)*c,p=(s*u-n*l)*c;return o.set(1-g-p,p,g)}static containsPoint(t,r,a,i){return this.getBarycoord(t,r,a,i,Cs)===null?!1:Cs.x>=0&&Cs.y>=0&&Cs.x+Cs.y<=1}static getInterpolation(t,r,a,i,o,s,n,l){return this.getBarycoord(t,r,a,i,Cs)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(o,Cs.x),l.addScaledVector(s,Cs.y),l.addScaledVector(n,Cs.z),l)}static getInterpolatedAttribute(t,r,a,i,o,s){return p2.setScalar(0),f2.setScalar(0),m2.setScalar(0),p2.fromBufferAttribute(t,r),f2.fromBufferAttribute(t,a),m2.fromBufferAttribute(t,i),s.setScalar(0),s.addScaledVector(p2,o.x),s.addScaledVector(f2,o.y),s.addScaledVector(m2,o.z),s}static isFrontFacing(t,r,a,i){return Fo.subVectors(a,r),Rs.subVectors(t,r),Fo.cross(Rs).dot(i)<0}set(t,r,a){return this.a.copy(t),this.b.copy(r),this.c.copy(a),this}setFromPointsAndIndices(t,r,a,i){return this.a.copy(t[r]),this.b.copy(t[a]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,r,a,i){return this.a.fromBufferAttribute(t,r),this.b.fromBufferAttribute(t,a),this.c.fromBufferAttribute(t,i),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Fo.subVectors(this.c,this.b),Rs.subVectors(this.a,this.b),Fo.cross(Rs).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Hu.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,r){return Hu.getBarycoord(t,this.a,this.b,this.c,r)}getInterpolation(t,r,a,i,o){return Hu.getInterpolation(t,this.a,this.b,this.c,r,a,i,o)}containsPoint(t){return Hu.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Hu.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,r){let a=this.a,i=this.b,o=this.c,s,n;Ah.subVectors(i,a),Eh.subVectors(o,a),u2.subVectors(t,a);let l=Ah.dot(u2),h=Eh.dot(u2);if(l<=0&&h<=0)return r.copy(a);c2.subVectors(t,i);let u=Ah.dot(c2),d=Eh.dot(c2);if(u>=0&&d<=u)return r.copy(i);let c=l*d-u*h;if(c<=0&&l>=0&&u<=0)return s=l/(l-u),r.copy(a).addScaledVector(Ah,s);d2.subVectors(t,o);let g=Ah.dot(d2),p=Eh.dot(d2);if(p>=0&&g<=p)return r.copy(o);let m=g*h-l*p;if(m<=0&&h>=0&&p<=0)return n=h/(h-p),r.copy(a).addScaledVector(Eh,n);let v=u*p-g*d;if(v<=0&&d-u>=0&&g-p>=0)return p3.subVectors(o,i),n=(d-u)/(d-u+(g-p)),r.copy(i).addScaledVector(p3,n);let y=1/(v+m+c);return s=m*y,n=c*y,r.copy(a).addScaledVector(Ah,s).addScaledVector(Eh,n)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},f3={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},gn={h:0,s:0,l:0},J1={h:0,s:0,l:0};function g2(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*6*(2/3-r):e}var at=class{constructor(e,t,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,r)}set(e,t,r){if(t===void 0&&r===void 0){let a=e;a&&a.isColor?this.copy(a):typeof a=="number"?this.setHex(a):typeof a=="string"&&this.setStyle(a)}else this.setRGB(e,t,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=da){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,x0.colorSpaceToWorking(this,t),this}setRGB(e,t,r,a=x0.workingColorSpace){return this.r=e,this.g=t,this.b=r,x0.colorSpaceToWorking(this,a),this}setHSL(e,t,r,a=x0.workingColorSpace){if(e=Km(e,1),t=Bt(t,0,1),r=Bt(r,0,1),t===0)this.r=this.g=this.b=r;else{let i=r<=.5?r*(1+t):r+t-r*t,o=2*r-i;this.r=g2(o,i,e+1/3),this.g=g2(o,i,e),this.b=g2(o,i,e-1/3)}return x0.colorSpaceToWorking(this,a),this}setStyle(e,t=da){function r(i){i!==void 0&&parseFloat(i)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let a;if(a=/^(\w+)\(([^\)]*)\)/.exec(e)){let i,o=a[1],s=a[2];switch(o){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return r(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,t);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return r(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,t);break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return r(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(a=/^\#([A-Fa-f\d]+)$/.exec(e)){let i=a[1],o=i.length;if(o===3)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(i,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=da){let r=f3[e.toLowerCase()];return r!==void 0?this.setHex(r,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Ss(e.r),this.g=Ss(e.g),this.b=Ss(e.b),this}copyLinearToSRGB(e){return this.r=vh(e.r),this.g=vh(e.g),this.b=vh(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=da){return x0.workingToColorSpace(ri.copy(this),e),Math.round(Bt(ri.r*255,0,255))*65536+Math.round(Bt(ri.g*255,0,255))*256+Math.round(Bt(ri.b*255,0,255))}getHexString(e=da){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=x0.workingColorSpace){x0.workingToColorSpace(ri.copy(this),t);let r=ri.r,a=ri.g,i=ri.b,o=Math.max(r,a,i),s=Math.min(r,a,i),n,l,h=(s+o)/2;if(s===o)n=0,l=0;else{let u=o-s;switch(l=h<=.5?u/(o+s):u/(2-o-s),o){case r:n=(a-i)/u+(a<i?6:0);break;case a:n=(i-r)/u+2;break;case i:n=(r-a)/u+4;break}n/=6}return e.h=n,e.s=l,e.l=h,e}getRGB(e,t=x0.workingColorSpace){return x0.workingToColorSpace(ri.copy(this),t),e.r=ri.r,e.g=ri.g,e.b=ri.b,e}getStyle(e=da){x0.workingToColorSpace(ri.copy(this),e);let t=ri.r,r=ri.g,a=ri.b;return e!==da?`color(${e} ${t.toFixed(3)} ${r.toFixed(3)} ${a.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(r*255)},${Math.round(a*255)})`}offsetHSL(e,t,r){return this.getHSL(gn),this.setHSL(gn.h+e,gn.s+t,gn.l+r)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,r){return this.r=e.r+(t.r-e.r)*r,this.g=e.g+(t.g-e.g)*r,this.b=e.b+(t.b-e.b)*r,this}lerpHSL(e,t){this.getHSL(gn),e.getHSL(J1);let r=lc(gn.h,J1.h,t),a=lc(gn.s,J1.s,t),i=lc(gn.l,J1.l,t);return this.setHSL(r,a,i),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,r=this.g,a=this.b,i=e.elements;return this.r=i[0]*t+i[3]*r+i[6]*a,this.g=i[1]*t+i[4]*r+i[7]*a,this.b=i[2]*t+i[5]*r+i[8]*a,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},ri=new at;at.NAMES=f3;var K_=0,ai=class extends ts{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:K_++}),this.uuid=Ki(),this.name="",this.type="Material",this.blending=tl,this.side=bs,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Zd,this.blendDst=qu,this.blendEquation=Ms,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new at(0,0,0),this.blendAlpha=0,this.depthFunc=al,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=$m,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=sl,this.stencilZFail=sl,this.stencilZPass=sl,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let r=e[t];if(r===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}let a=this[t];if(a===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}a&&a.isColor?a.set(r):a&&a.isVector3&&r&&r.isVector3?a.copy(r):this[t]=r}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let r={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(r.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(r.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(r.dispersion=this.dispersion),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapRotation!==void 0&&(r.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==tl&&(r.blending=this.blending),this.side!==bs&&(r.side=this.side),this.vertexColors===!0&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=!0),this.blendSrc!==Zd&&(r.blendSrc=this.blendSrc),this.blendDst!==qu&&(r.blendDst=this.blendDst),this.blendEquation!==Ms&&(r.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(r.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(r.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(r.blendAlpha=this.blendAlpha),this.depthFunc!==al&&(r.depthFunc=this.depthFunc),this.depthTest===!1&&(r.depthTest=this.depthTest),this.depthWrite===!1&&(r.depthWrite=this.depthWrite),this.colorWrite===!1&&(r.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(r.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==$m&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==sl&&(r.stencilFail=this.stencilFail),this.stencilZFail!==sl&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==sl&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.wireframe===!0&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=!0),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function a(i){let o=[];for(let s in i){let n=i[s];delete n.metadata,o.push(n)}return o}if(t){let i=a(e.textures),o=a(e.images);i.length>0&&(r.textures=i),o.length>0&&(r.images=o)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,r=null;if(t!==null){let a=t.length;r=new Array(a);for(let i=0;i!==a;++i)r[i]=t[i].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}},za=class extends ai{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new at(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Sr,this.combine=Xu,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},zs=J_();function J_(){let e=new ArrayBuffer(4),t=new Float32Array(e),r=new Uint32Array(e),a=new Uint32Array(512),i=new Uint32Array(512);for(let l=0;l<256;++l){let h=l-127;h<-27?(a[l]=0,a[l|256]=32768,i[l]=24,i[l|256]=24):h<-14?(a[l]=1024>>-h-14,a[l|256]=1024>>-h-14|32768,i[l]=-h-1,i[l|256]=-h-1):h<=15?(a[l]=h+15<<10,a[l|256]=h+15<<10|32768,i[l]=13,i[l|256]=13):h<128?(a[l]=31744,a[l|256]=64512,i[l]=24,i[l|256]=24):(a[l]=31744,a[l|256]=64512,i[l]=13,i[l|256]=13)}let o=new Uint32Array(2048),s=new Uint32Array(64),n=new Uint32Array(64);for(let l=1;l<1024;++l){let h=l<<13,u=0;for(;(h&8388608)===0;)h<<=1,u-=8388608;h&=-8388609,u+=947912704,o[l]=h|u}for(let l=1024;l<2048;++l)o[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)s[l]=l<<23;s[31]=1199570944,s[32]=2147483648;for(let l=33;l<63;++l)s[l]=2147483648+(l-32<<23);s[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(n[l]=1024);return{floatView:t,uint32View:r,baseTable:a,shiftTable:i,mantissaTable:o,exponentTable:s,offsetTable:n}}function Ni(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=Bt(e,-65504,65504),zs.floatView[0]=e;let t=zs.uint32View[0],r=t>>23&511;return zs.baseTable[r]+((t&8388607)>>zs.shiftTable[r])}function fc(e){let t=e>>10;return zs.uint32View[0]=zs.mantissaTable[zs.offsetTable[t]+(e&1023)]+zs.exponentTable[t],zs.floatView[0]}var v2=class{static toHalfFloat(e){return Ni(e)}static fromHalfFloat(e){return fc(e)}},Qr=new Q,Q1=new je,Q_=0,mt=class{constructor(e,t,r=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Q_++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=r,this.usage=nc,this.updateRanges=[],this.gpuType=mi,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,r){e*=this.itemSize,r*=t.itemSize;for(let a=0,i=this.itemSize;a<i;a++)this.array[e+a]=t.array[r+a];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,r=this.count;t<r;t++)Q1.fromBufferAttribute(this,t),Q1.applyMatrix3(e),this.setXY(t,Q1.x,Q1.y);else if(this.itemSize===3)for(let t=0,r=this.count;t<r;t++)Qr.fromBufferAttribute(this,t),Qr.applyMatrix3(e),this.setXYZ(t,Qr.x,Qr.y,Qr.z);return this}applyMatrix4(e){for(let t=0,r=this.count;t<r;t++)Qr.fromBufferAttribute(this,t),Qr.applyMatrix4(e),this.setXYZ(t,Qr.x,Qr.y,Qr.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)Qr.fromBufferAttribute(this,t),Qr.applyNormalMatrix(e),this.setXYZ(t,Qr.x,Qr.y,Qr.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)Qr.fromBufferAttribute(this,t),Qr.transformDirection(e),this.setXYZ(t,Qr.x,Qr.y,Qr.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let r=this.array[e*this.itemSize+t];return this.normalized&&(r=gi(r,this.array)),r}setComponent(e,t,r){return this.normalized&&(r=$t(r,this.array)),this.array[e*this.itemSize+t]=r,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=gi(t,this.array)),t}setX(e,t){return this.normalized&&(t=$t(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=gi(t,this.array)),t}setY(e,t){return this.normalized&&(t=$t(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=gi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=$t(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=gi(t,this.array)),t}setW(e,t){return this.normalized&&(t=$t(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,r){return e*=this.itemSize,this.normalized&&(t=$t(t,this.array),r=$t(r,this.array)),this.array[e+0]=t,this.array[e+1]=r,this}setXYZ(e,t,r,a){return e*=this.itemSize,this.normalized&&(t=$t(t,this.array),r=$t(r,this.array),a=$t(a,this.array)),this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=a,this}setXYZW(e,t,r,a,i){return e*=this.itemSize,this.normalized&&(t=$t(t,this.array),r=$t(r,this.array),a=$t(a,this.array),i=$t(i,this.array)),this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=a,this.array[e+3]=i,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==nc&&(e.usage=this.usage),e}},eS=class extends mt{constructor(e,t,r){super(new Int8Array(e),t,r)}},tS=class extends mt{constructor(e,t,r){super(new Uint8Array(e),t,r)}},rS=class extends mt{constructor(e,t,r){super(new Uint8ClampedArray(e),t,r)}},aS=class extends mt{constructor(e,t,r){super(new Int16Array(e),t,r)}},x2=class extends mt{constructor(e,t,r){super(new Uint16Array(e),t,r)}},iS=class extends mt{constructor(e,t,r){super(new Int32Array(e),t,r)}},y2=class extends mt{constructor(e,t,r){super(new Uint32Array(e),t,r)}},oS=class extends mt{constructor(e,t,r){super(new Uint16Array(e),t,r),this.isFloat16BufferAttribute=!0}getX(e){let t=fc(this.array[e*this.itemSize]);return this.normalized&&(t=gi(t,this.array)),t}setX(e,t){return this.normalized&&(t=$t(t,this.array)),this.array[e*this.itemSize]=Ni(t),this}getY(e){let t=fc(this.array[e*this.itemSize+1]);return this.normalized&&(t=gi(t,this.array)),t}setY(e,t){return this.normalized&&(t=$t(t,this.array)),this.array[e*this.itemSize+1]=Ni(t),this}getZ(e){let t=fc(this.array[e*this.itemSize+2]);return this.normalized&&(t=gi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=$t(t,this.array)),this.array[e*this.itemSize+2]=Ni(t),this}getW(e){let t=fc(this.array[e*this.itemSize+3]);return this.normalized&&(t=gi(t,this.array)),t}setW(e,t){return this.normalized&&(t=$t(t,this.array)),this.array[e*this.itemSize+3]=Ni(t),this}setXY(e,t,r){return e*=this.itemSize,this.normalized&&(t=$t(t,this.array),r=$t(r,this.array)),this.array[e+0]=Ni(t),this.array[e+1]=Ni(r),this}setXYZ(e,t,r,a){return e*=this.itemSize,this.normalized&&(t=$t(t,this.array),r=$t(r,this.array),a=$t(a,this.array)),this.array[e+0]=Ni(t),this.array[e+1]=Ni(r),this.array[e+2]=Ni(a),this}setXYZW(e,t,r,a,i){return e*=this.itemSize,this.normalized&&(t=$t(t,this.array),r=$t(r,this.array),a=$t(a,this.array),i=$t(i,this.array)),this.array[e+0]=Ni(t),this.array[e+1]=Ni(r),this.array[e+2]=Ni(a),this.array[e+3]=Ni(i),this}},et=class extends mt{constructor(e,t,r){super(new Float32Array(e),t,r)}},sS=0,vo=new ut,b2=new I0,Rh=new Q,Qi=new _r,mc=new _r,ka=new Q,Tt=class o6 extends ts{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:sS++}),this.uuid=Ki(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(e3(t)?y2:x2)(t,1):this.index=t,this}setIndirect(t){return this.indirect=t,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,r){return this.attributes[t]=r,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,r,a=0){this.groups.push({start:t,count:r,materialIndex:a})}clearGroups(){this.groups=[]}setDrawRange(t,r){this.drawRange.start=t,this.drawRange.count=r}applyMatrix4(t){let r=this.attributes.position;r!==void 0&&(r.applyMatrix4(t),r.needsUpdate=!0);let a=this.attributes.normal;if(a!==void 0){let o=new Jt().getNormalMatrix(t);a.applyNormalMatrix(o),a.needsUpdate=!0}let i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(t),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return vo.makeRotationFromQuaternion(t),this.applyMatrix4(vo),this}rotateX(t){return vo.makeRotationX(t),this.applyMatrix4(vo),this}rotateY(t){return vo.makeRotationY(t),this.applyMatrix4(vo),this}rotateZ(t){return vo.makeRotationZ(t),this.applyMatrix4(vo),this}translate(t,r,a){return vo.makeTranslation(t,r,a),this.applyMatrix4(vo),this}scale(t,r,a){return vo.makeScale(t,r,a),this.applyMatrix4(vo),this}lookAt(t){return b2.lookAt(t),b2.updateMatrix(),this.applyMatrix4(b2.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Rh).negate(),this.translate(Rh.x,Rh.y,Rh.z),this}setFromPoints(t){let r=this.getAttribute("position");if(r===void 0){let a=[];for(let i=0,o=t.length;i<o;i++){let s=t[i];a.push(s.x,s.y,s.z||0)}this.setAttribute("position",new et(a,3))}else{let a=Math.min(t.length,r.count);for(let i=0;i<a;i++){let o=t[i];r.setXYZ(i,o.x,o.y,o.z||0)}t.length>r.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),r.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new _r);let t=this.attributes.position,r=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new Q(-1/0,-1/0,-1/0),new Q(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),r)for(let a=0,i=r.length;a<i;a++){let o=r[a];Qi.setFromBufferAttribute(o),this.morphTargetsRelative?(ka.addVectors(this.boundingBox.min,Qi.min),this.boundingBox.expandByPoint(ka),ka.addVectors(this.boundingBox.max,Qi.max),this.boundingBox.expandByPoint(ka)):(this.boundingBox.expandByPoint(Qi.min),this.boundingBox.expandByPoint(Qi.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Lr);let t=this.attributes.position,r=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new Q,1/0);return}if(t){let a=this.boundingSphere.center;if(Qi.setFromBufferAttribute(t),r)for(let o=0,s=r.length;o<s;o++){let n=r[o];mc.setFromBufferAttribute(n),this.morphTargetsRelative?(ka.addVectors(Qi.min,mc.min),Qi.expandByPoint(ka),ka.addVectors(Qi.max,mc.max),Qi.expandByPoint(ka)):(Qi.expandByPoint(mc.min),Qi.expandByPoint(mc.max))}Qi.getCenter(a);let i=0;for(let o=0,s=t.count;o<s;o++)ka.fromBufferAttribute(t,o),i=Math.max(i,a.distanceToSquared(ka));if(r)for(let o=0,s=r.length;o<s;o++){let n=r[o],l=this.morphTargetsRelative;for(let h=0,u=n.count;h<u;h++)ka.fromBufferAttribute(n,h),l&&(Rh.fromBufferAttribute(t,h),ka.add(Rh)),i=Math.max(i,a.distanceToSquared(ka))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let t=this.index,r=this.attributes;if(t===null||r.position===void 0||r.normal===void 0||r.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let a=r.position,i=r.normal,o=r.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new mt(new Float32Array(4*a.count),4));let s=this.getAttribute("tangent"),n=[],l=[];for(let A=0;A<a.count;A++)n[A]=new Q,l[A]=new Q;let h=new Q,u=new Q,d=new Q,c=new je,g=new je,p=new je,m=new Q,v=new Q;function y(A,S,T){h.fromBufferAttribute(a,A),u.fromBufferAttribute(a,S),d.fromBufferAttribute(a,T),c.fromBufferAttribute(o,A),g.fromBufferAttribute(o,S),p.fromBufferAttribute(o,T),u.sub(h),d.sub(h),g.sub(c),p.sub(c);let C=1/(g.x*p.y-p.x*g.y);isFinite(C)&&(m.copy(u).multiplyScalar(p.y).addScaledVector(d,-g.y).multiplyScalar(C),v.copy(d).multiplyScalar(g.x).addScaledVector(u,-p.x).multiplyScalar(C),n[A].add(m),n[S].add(m),n[T].add(m),l[A].add(v),l[S].add(v),l[T].add(v))}let x=this.groups;x.length===0&&(x=[{start:0,count:t.count}]);for(let A=0,S=x.length;A<S;++A){let T=x[A],C=T.start,z=T.count;for(let k=C,O=C+z;k<O;k+=3)y(t.getX(k+0),t.getX(k+1),t.getX(k+2))}let b=new Q,f=new Q,_=new Q,M=new Q;function w(A){_.fromBufferAttribute(i,A),M.copy(_);let S=n[A];b.copy(S),b.sub(_.multiplyScalar(_.dot(S))).normalize(),f.crossVectors(M,S);let T=f.dot(l[A])<0?-1:1;s.setXYZW(A,b.x,b.y,b.z,T)}for(let A=0,S=x.length;A<S;++A){let T=x[A],C=T.start,z=T.count;for(let k=C,O=C+z;k<O;k+=3)w(t.getX(k+0)),w(t.getX(k+1)),w(t.getX(k+2))}}computeVertexNormals(){let t=this.index,r=this.getAttribute("position");if(r!==void 0){let a=this.getAttribute("normal");if(a===void 0)a=new mt(new Float32Array(r.count*3),3),this.setAttribute("normal",a);else for(let c=0,g=a.count;c<g;c++)a.setXYZ(c,0,0,0);let i=new Q,o=new Q,s=new Q,n=new Q,l=new Q,h=new Q,u=new Q,d=new Q;if(t)for(let c=0,g=t.count;c<g;c+=3){let p=t.getX(c+0),m=t.getX(c+1),v=t.getX(c+2);i.fromBufferAttribute(r,p),o.fromBufferAttribute(r,m),s.fromBufferAttribute(r,v),u.subVectors(s,o),d.subVectors(i,o),u.cross(d),n.fromBufferAttribute(a,p),l.fromBufferAttribute(a,m),h.fromBufferAttribute(a,v),n.add(u),l.add(u),h.add(u),a.setXYZ(p,n.x,n.y,n.z),a.setXYZ(m,l.x,l.y,l.z),a.setXYZ(v,h.x,h.y,h.z)}else for(let c=0,g=r.count;c<g;c+=3)i.fromBufferAttribute(r,c+0),o.fromBufferAttribute(r,c+1),s.fromBufferAttribute(r,c+2),u.subVectors(s,o),d.subVectors(i,o),u.cross(d),a.setXYZ(c+0,u.x,u.y,u.z),a.setXYZ(c+1,u.x,u.y,u.z),a.setXYZ(c+2,u.x,u.y,u.z);this.normalizeNormals(),a.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let r=0,a=t.count;r<a;r++)ka.fromBufferAttribute(t,r),ka.normalize(),t.setXYZ(r,ka.x,ka.y,ka.z)}toNonIndexed(){function t(n,l){let h=n.array,u=n.itemSize,d=n.normalized,c=new h.constructor(l.length*u),g=0,p=0;for(let m=0,v=l.length;m<v;m++){n.isInterleavedBufferAttribute?g=l[m]*n.data.stride+n.offset:g=l[m]*u;for(let y=0;y<u;y++)c[p++]=h[g++]}return new mt(c,u,d)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let r=new o6,a=this.index.array,i=this.attributes;for(let n in i){let l=i[n],h=t(l,a);r.setAttribute(n,h)}let o=this.morphAttributes;for(let n in o){let l=[],h=o[n];for(let u=0,d=h.length;u<d;u++){let c=h[u],g=t(c,a);l.push(g)}r.morphAttributes[n]=l}r.morphTargetsRelative=this.morphTargetsRelative;let s=this.groups;for(let n=0,l=s.length;n<l;n++){let h=s[n];r.addGroup(h.start,h.count,h.materialIndex)}return r}toJSON(){let t={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0){let l=this.parameters;for(let h in l)l[h]!==void 0&&(t[h]=l[h]);return t}t.data={attributes:{}};let r=this.index;r!==null&&(t.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});let a=this.attributes;for(let l in a){let h=a[l];t.data.attributes[l]=h.toJSON(t.data)}let i={},o=!1;for(let l in this.morphAttributes){let h=this.morphAttributes[l],u=[];for(let d=0,c=h.length;d<c;d++){let g=h[d];u.push(g.toJSON(t.data))}u.length>0&&(i[l]=u,o=!0)}o&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);let s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));let n=this.boundingSphere;return n!==null&&(t.data.boundingSphere=n.toJSON()),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let r={};this.name=t.name;let a=t.index;a!==null&&this.setIndex(a.clone());let i=t.attributes;for(let h in i){let u=i[h];this.setAttribute(h,u.clone(r))}let o=t.morphAttributes;for(let h in o){let u=[],d=o[h];for(let c=0,g=d.length;c<g;c++)u.push(d[c].clone(r));this.morphAttributes[h]=u}this.morphTargetsRelative=t.morphTargetsRelative;let s=t.groups;for(let h=0,u=s.length;h<u;h++){let d=s[h];this.addGroup(d.start,d.count,d.materialIndex)}let n=t.boundingBox;n!==null&&(this.boundingBox=n.clone());let l=t.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}},m3=new ut,ul=new wh,ep=new Lr,g3=new Q,tp=new Q,rp=new Q,ap=new Q,M2=new Q,ip=new Q,v3=new Q,op=new Q,Pt=class extends I0{constructor(e=new Tt,t=new za){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let r=e[t[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let a=0,i=r.length;a<i;a++){let o=r[a].name||String(a);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=a}}}}getVertexPosition(e,t){let r=this.geometry,a=r.attributes.position,i=r.morphAttributes.position,o=r.morphTargetsRelative;t.fromBufferAttribute(a,e);let s=this.morphTargetInfluences;if(i&&s){ip.set(0,0,0);for(let n=0,l=i.length;n<l;n++){let h=s[n],u=i[n];h!==0&&(M2.fromBufferAttribute(u,e),o?ip.addScaledVector(M2,h):ip.addScaledVector(M2.sub(t),h))}t.add(ip)}return t}raycast(e,t){let r=this.geometry,a=this.material,i=this.matrixWorld;a!==void 0&&(r.boundingSphere===null&&r.computeBoundingSphere(),ep.copy(r.boundingSphere),ep.applyMatrix4(i),ul.copy(e.ray).recast(e.near),!(ep.containsPoint(ul.origin)===!1&&(ul.intersectSphere(ep,g3)===null||ul.origin.distanceToSquared(g3)>(e.far-e.near)**2))&&(m3.copy(i).invert(),ul.copy(e.ray).applyMatrix4(m3),!(r.boundingBox!==null&&ul.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,t,ul)))}_computeIntersections(e,t,r){let a,i=this.geometry,o=this.material,s=i.index,n=i.attributes.position,l=i.attributes.uv,h=i.attributes.uv1,u=i.attributes.normal,d=i.groups,c=i.drawRange;if(s!==null)if(Array.isArray(o))for(let g=0,p=d.length;g<p;g++){let m=d[g],v=o[m.materialIndex],y=Math.max(m.start,c.start),x=Math.min(s.count,Math.min(m.start+m.count,c.start+c.count));for(let b=y,f=x;b<f;b+=3){let _=s.getX(b),M=s.getX(b+1),w=s.getX(b+2);a=sp(this,v,e,r,l,h,u,_,M,w),a&&(a.faceIndex=Math.floor(b/3),a.face.materialIndex=m.materialIndex,t.push(a))}}else{let g=Math.max(0,c.start),p=Math.min(s.count,c.start+c.count);for(let m=g,v=p;m<v;m+=3){let y=s.getX(m),x=s.getX(m+1),b=s.getX(m+2);a=sp(this,o,e,r,l,h,u,y,x,b),a&&(a.faceIndex=Math.floor(m/3),t.push(a))}}else if(n!==void 0)if(Array.isArray(o))for(let g=0,p=d.length;g<p;g++){let m=d[g],v=o[m.materialIndex],y=Math.max(m.start,c.start),x=Math.min(n.count,Math.min(m.start+m.count,c.start+c.count));for(let b=y,f=x;b<f;b+=3){let _=b,M=b+1,w=b+2;a=sp(this,v,e,r,l,h,u,_,M,w),a&&(a.faceIndex=Math.floor(b/3),a.face.materialIndex=m.materialIndex,t.push(a))}}else{let g=Math.max(0,c.start),p=Math.min(n.count,c.start+c.count);for(let m=g,v=p;m<v;m+=3){let y=m,x=m+1,b=m+2;a=sp(this,o,e,r,l,h,u,y,x,b),a&&(a.faceIndex=Math.floor(m/3),t.push(a))}}}};function nS(e,t,r,a,i,o,s,n){let l;if(t.side===Ka?l=a.intersectTriangle(s,o,i,!0,n):l=a.intersectTriangle(i,o,s,t.side===bs,n),l===null)return null;op.copy(n),op.applyMatrix4(e.matrixWorld);let h=r.ray.origin.distanceTo(op);return h<r.near||h>r.far?null:{distance:h,point:op.clone(),object:e}}function sp(e,t,r,a,i,o,s,n,l,h){e.getVertexPosition(n,tp),e.getVertexPosition(l,rp),e.getVertexPosition(h,ap);let u=nS(e,t,r,a,tp,rp,ap,v3);if(u){let d=new Q;mn.getBarycoord(v3,tp,rp,ap,d),i&&(u.uv=mn.getInterpolatedAttribute(i,n,l,h,d,new je)),o&&(u.uv1=mn.getInterpolatedAttribute(o,n,l,h,d,new je)),s&&(u.normal=mn.getInterpolatedAttribute(s,n,l,h,d,new Q),u.normal.dot(a.direction)>0&&u.normal.multiplyScalar(-1));let c={a:n,b:l,c:h,normal:new Q,materialIndex:0};mn.getNormal(tp,rp,ap,c.normal),u.face=c,u.barycoord=d}return u}var cr=class s6 extends Tt{constructor(t=1,r=1,a=1,i=1,o=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:r,depth:a,widthSegments:i,heightSegments:o,depthSegments:s};let n=this;i=Math.floor(i),o=Math.floor(o),s=Math.floor(s);let l=[],h=[],u=[],d=[],c=0,g=0;p("z","y","x",-1,-1,a,r,t,s,o,0),p("z","y","x",1,-1,a,r,-t,s,o,1),p("x","z","y",1,1,t,a,r,i,s,2),p("x","z","y",1,-1,t,a,-r,i,s,3),p("x","y","z",1,-1,t,r,a,i,o,4),p("x","y","z",-1,-1,t,r,-a,i,o,5),this.setIndex(l),this.setAttribute("position",new et(h,3)),this.setAttribute("normal",new et(u,3)),this.setAttribute("uv",new et(d,2));function p(m,v,y,x,b,f,_,M,w,A,S){let T=f/w,C=_/A,z=f/2,k=_/2,O=M/2,H=w+1,E=A+1,I=0,R=0,D=new Q;for(let B=0;B<E;B++){let V=B*C-k;for(let K=0;K<H;K++){let F=K*T-z;D[m]=F*x,D[v]=V.........完整代码请登录后点击上方下载按钮下载查看

网友评论0