@fleox/agent3d 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.md +350 -126
  2. package/changelog.json +12 -0
  3. package/dist/agent/agent3d.mjs +16 -16
  4. package/dist/agent/chunks/{cdp-CaKRRzMX.mjs → cdp-Bdtm4fBN.mjs} +3 -2
  5. package/dist/agent/chunks/{imageCodec-BpDU9Lsq.mjs → imageCodec-Dz9PFxi9.mjs} +1 -1
  6. package/dist/agent/chunks/{package-Ck7_Nszg.mjs → package-BOIyp_2B.mjs} +1 -1
  7. package/dist/agent/chunks/{render-Cbuhz5uW.mjs → render-CN4mgGLQ.mjs} +2 -2
  8. package/dist/runtime/agent3d-runtime.js +23 -23
  9. package/dist/runtime/agent3d-runtime.single.js +2 -2
  10. package/dist/runtime/chunks/{BufferGeometryUtils-Re3wQkXp.js → BufferGeometryUtils-XmME4f7Z.js} +1 -1
  11. package/dist/runtime/chunks/{EXRLoader-Bzm84si5.js → EXRLoader-CBdIpBMT.js} +1 -1
  12. package/dist/runtime/chunks/{FontLoader-BocwqK8V.js → FontLoader-dVu9WH2X.js} +1 -1
  13. package/dist/runtime/chunks/GLTFLoader-Z9Inv-Xm.js +1 -0
  14. package/dist/runtime/chunks/{GroundedSkybox-esvlRCO0.js → GroundedSkybox-g1ASZWNu.js} +1 -1
  15. package/dist/runtime/chunks/{HDRLoader-DHrHp8fs.js → HDRLoader-DBOMWa7O.js} +2 -2
  16. package/dist/{studio/assets/OrbitControls-fcOgB96a.js → runtime/chunks/OrbitControls-BIpWXK4x.js} +1 -1
  17. package/dist/runtime/chunks/{RectAreaLightUniformsLib-_mZ62yWn.js → RectAreaLightUniformsLib-4ZzgX9vp.js} +1 -1
  18. package/dist/runtime/chunks/{RoomEnvironment-CL4UR6ZW.js → RoomEnvironment-CXgfLJdO.js} +1 -1
  19. package/dist/runtime/chunks/{RoundedBoxGeometry-x-ot8ZSh.js → RoundedBoxGeometry-BViRogcJ.js} +1 -1
  20. package/dist/runtime/chunks/{SVGLoader-hRF0EwD-.js → SVGLoader-CV0U1EIF.js} +1 -1
  21. package/dist/runtime/chunks/{Sky-BrLN9Fk5.js → Sky-DGJXlPb_.js} +1 -1
  22. package/dist/runtime/chunks/{extrude-m04mghOS.js → extrude-D6WnITQq.js} +1 -1
  23. package/dist/runtime/chunks/{game-BoG2S6g4.js → game-BoEiyZrL.js} +3 -3
  24. package/dist/runtime/chunks/generators-D5JUo0jp.js +331 -0
  25. package/dist/runtime/chunks/{materials-C2uffFEd.js → materials-Dn-bYrZd.js} +5 -5
  26. package/dist/runtime/chunks/{model-D-4xZz21.js → model-BCVF3QzB.js} +1 -1
  27. package/dist/runtime/chunks/{params-DdApDOBw.js → params-C2uoUDJ0.js} +1 -1
  28. package/dist/runtime/chunks/{physicsHost-DPaVdM0R.js → physicsHost-ChPgysMQ.js} +1 -1
  29. package/dist/runtime/chunks/{postfx-BpBXjLX3.js → postfx-UgKCbmZs.js} +29 -29
  30. package/dist/{studio/assets/shaders-BEznGIct.js → runtime/chunks/shaders-Dw6zHdu_.js} +3 -3
  31. package/dist/runtime/chunks/svg-CmlFY_8O.js +1 -0
  32. package/dist/runtime/chunks/{text-CmkU-b0C.js → text-D1EQpdSU.js} +2 -2
  33. package/dist/runtime/chunks/{three.module-W4hp4qHb.js → three.module-DnaBiDAJ.js} +31 -31
  34. package/dist/runtime/chunks/{toon-B5Jhf37V.js → toon-BsvVk_nK.js} +1 -1
  35. package/dist/runtime/chunks/{util-THUewKBk.js → util-CyaW1fcW.js} +1 -1
  36. package/dist/studio/assets/{BufferGeometryUtils-wW9vV1l2.js → BufferGeometryUtils-CAlXAboW.js} +1 -1
  37. package/dist/studio/assets/{EXRLoader-f8U8jnlr.js → EXRLoader-BKkzlNd8.js} +1 -1
  38. package/dist/studio/assets/{FontLoader-9sHudKzD.js → FontLoader-Bzjx8mXt.js} +2 -2
  39. package/dist/studio/assets/GLTFLoader-1Zd9N406.js +1 -0
  40. package/dist/studio/assets/GroundedSkybox-BEMqNCBD.js +1 -0
  41. package/dist/studio/assets/{HDRLoader-CkQyrTWY.js → HDRLoader-DxB0kxPH.js} +2 -2
  42. package/dist/{runtime/chunks/OrbitControls-sjN2MF0e.js → studio/assets/OrbitControls-MlE9XiCg.js} +1 -1
  43. package/dist/studio/assets/{RectAreaLightUniformsLib-CZHWO9xf.js → RectAreaLightUniformsLib-ClHrtYY6.js} +1 -1
  44. package/dist/studio/assets/{RoomEnvironment-BsISzuCp.js → RoomEnvironment-MJ-jIEC8.js} +1 -1
  45. package/dist/studio/assets/{SVGLoader-BIkQDT66.js → SVGLoader-CIYl0nEy.js} +1 -1
  46. package/dist/studio/assets/{Sky-C282PFL1.js → Sky-DNMfpp92.js} +1 -1
  47. package/dist/studio/assets/{camera-BhKdE9ej.js → camera-7sEn13L-.js} +2 -2
  48. package/dist/studio/assets/editor-CnbvVkhU.js +53 -0
  49. package/dist/studio/assets/{extrude-CnayHczh.js → extrude-9bG8hr2C.js} +1 -1
  50. package/dist/studio/assets/{game-Dv5s4eMN.js → game-B04KGAK0.js} +3 -3
  51. package/dist/studio/assets/generators-LSni1Yfc.js +331 -0
  52. package/dist/studio/assets/{index-Dh-2Y34U.js → index-3LL5NEIH.js} +8 -8
  53. package/dist/studio/assets/{model-XZSP52pV.js → model-CNddhwmA.js} +2 -2
  54. package/dist/studio/assets/{physicsHost-C84FddIe.js → physicsHost-hMU_SDiX.js} +1 -1
  55. package/dist/studio/assets/{postfx-BWWXb8i8.js → postfx-BcCZS0Bq.js} +27 -27
  56. package/dist/studio/assets/runtime-DY_KqD1x.js +572 -0
  57. package/dist/{runtime/chunks/shaders-CmeJRio1.js → studio/assets/shaders-BhMCstyv.js} +3 -3
  58. package/dist/studio/assets/svg-CNKK-h7H.js +2 -0
  59. package/dist/studio/assets/{text-5DsJJHcj.js → text-BSPI7dk1.js} +3 -3
  60. package/dist/studio/assets/{three.module-ByMn_ZTv.js → three.module-CnI50X0U.js} +31 -31
  61. package/dist/studio/index.html +3 -3
  62. package/package.json +1 -1
  63. package/plugin/.claude-plugin/plugin.json +2 -2
  64. package/plugin/skills/agent3d-assets/SKILL.md +24 -24
  65. package/plugin/skills/agent3d-create/SKILL.md +20 -20
  66. package/plugin/skills/agent3d-create/references/art-direction.md +3 -3
  67. package/plugin/skills/agent3d-create/references/recipes.md +6 -6
  68. package/plugin/skills/agent3d-edit/SKILL.md +22 -22
  69. package/plugin/skills/agent3d-edit/references/patch-ops.md +2 -2
  70. package/plugin/skills/agent3d-game/SKILL.md +7 -7
  71. package/plugin/skills/agent3d-publish/SKILL.md +21 -21
  72. package/plugin/skills/agent3d-publish/references/integrations.md +1 -1
  73. package/dist/runtime/chunks/GLTFLoader-DHp1wv6J.js +0 -1
  74. package/dist/runtime/chunks/generators-OHhFCc2E.js +0 -331
  75. package/dist/runtime/chunks/svg-B3nZaQFD.js +0 -1
  76. package/dist/studio/assets/GLTFLoader-C3C_3K62.js +0 -1
  77. package/dist/studio/assets/GroundedSkybox-BTqmv4fv.js +0 -1
  78. package/dist/studio/assets/editor-BgY_RoRd.js +0 -1
  79. package/dist/studio/assets/generators-DVX3bAxe.js +0 -331
  80. package/dist/studio/assets/runtime-k_MFerbJ.js +0 -572
  81. package/dist/studio/assets/svg-DT8kx37i.js +0 -2
@@ -1,4 +1,4 @@
1
- var e=Object.defineProperty,t=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},n=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},r=`0.2.0`,i=/\{data\.([a-zA-Z_$][\w$-]*(?:\.[a-zA-Z_$][\w$-]*)*)(?:\|([^}]*))?\}/g;function a(e,t){let n=e;for(let e of t.split(`.`)){if(typeof n!=`object`||!n)return;n=n[e]}return n}function o(e){return typeof e!=`string`||!e.includes(`{data.`)?!1:(i.lastIndex=0,i.test(e))}function s(e,t){return e.includes(`{data.`)?e.replace(i,(e,n,r)=>{let i=a(t,n);return i==null||i===``?r??``:typeof i==`object`?JSON.stringify(i):String(i)}):e}var c=/^\{data\.([a-zA-Z_$][\w$-]*(?:\.[a-zA-Z_$][\w$-]*)*)(?:\|([^}]*))?\}$/;function l(e,t){if(typeof e!=`string`||!e.includes(`{data.`))return e;let n=c.exec(e.trim());if(!n)return s(e,t);let r=a(t,n[1]);if(r!=null&&r!==``)return r;if(n[2]!==void 0)try{return JSON.parse(n[2])}catch{return n[2]}}function u(e,t=e.data){let n=!1,r=e=>o(e)?(n=!0,s(e,t)):e,i=e=>{if(typeof e==`string`)return o(e)?(n=!0,l(e,t)):e;if(Array.isArray(e)){let t=e.map(i);return t.every((t,n)=>t===e[n])?e:t}if(e&&typeof e==`object`){let t=!1,n={};for(let[r,a]of Object.entries(e)){let e=i(a);e!==a&&(t=!0),e!==void 0&&(n[r]=e)}return t?n:e}return e},a=e=>{let t=e,n=t.kind===`text`?r(t.text):t.text,o=r(t.href),s=t.kind===`generator`&&t.params?i(t.params):t.params,c=e.children?.map(a);return n===t.text&&o===t.href&&s===t.params&&(!c||c.every((t,n)=>t===e.children[n]))?e:{...e,...t.kind===`text`?{text:n}:{},...t.href===void 0?{}:{href:o},...s===t.params?{}:{params:s},...c?{children:c}:{}}},c=e.interactions?.map(e=>{let t=e.do;if(!Array.isArray(t))return e;let n=t.map(e=>{let t=e;return!t||typeof t!=`object`||!o(t.openUrl)?e:{...t,openUrl:r(t.openUrl)}});return n.every((e,n)=>e===t[n])?e:{...e,do:n}}),u=(e.objects??[]).map(a),d=r(e.title),f=r(e.ariaLabel),p=e.ui?.elements?.map(e=>{let t=e,n=r(t.text);return n===t.text?e:{...e,text:n}});return n?{...e,title:d,...e.ariaLabel===void 0?{}:{ariaLabel:f},objects:u,...e.ui&&p?{ui:{...e.ui,elements:p}}:{},...c?{interactions:c}:{}}:e}function d(e){let t={};for(let[n,r]of Object.entries(e))if(r!==void 0){if(n===`json`)try{let e=JSON.parse(r);e&&typeof e==`object`&&!Array.isArray(e)&&Object.assign(t,e)}catch{}else t[n]=r}return t}function f(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function p(e,t){return new mi[e](t)}function m(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function h(e){return document.createElementNS(`http://www.w3.org/1999/xhtml`,e)}function g(){let e=h(`canvas`);return e.style.display=`block`,e}function _(e){gi=e}function v(){return gi}function y(...e){let t=`THREE.`+e.shift();gi?gi(`log`,t,...e):console.log(t,...e)}function b(e){let t=e[0];if(typeof t==`string`&&t.startsWith(`TSL:`)){let t=e[1];t&&t.isStackTrace?e[0]+=` `+t.getLocation():e[1]=`Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.`}return e}function x(...e){e=b(e);let t=`THREE.`+e.shift();if(gi)gi(`warn`,t,...e);else{let n=e[0];n&&n.isStackTrace?console.warn(n.getError(t)):console.warn(t,...e)}}function S(...e){e=b(e);let t=`THREE.`+e.shift();if(gi)gi(`error`,t,...e);else{let n=e[0];n&&n.isStackTrace?console.error(n.getError(t)):console.error(t,...e)}}function C(...e){let t=e.join(` `);t in hi||(hi[t]=!0,x(...e))}function w(e,t,n){return new Promise(function(r,i){function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:r()}}setTimeout(a,n)})}function T(){let e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(yi[e&255]+yi[e>>8&255]+yi[e>>16&255]+yi[e>>24&255]+`-`+yi[t&255]+yi[t>>8&255]+`-`+yi[t>>16&15|64]+yi[t>>24&255]+`-`+yi[n&63|128]+yi[n>>8&255]+`-`+yi[n>>16&255]+yi[n>>24&255]+yi[r&255]+yi[r>>8&255]+yi[r>>16&255]+yi[r>>24&255]).toLowerCase()}function E(e,t,n){return Math.max(t,Math.min(n,e))}function D(e,t){return(e%t+t)%t}function O(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)}function k(e,t,n){return e===t?0:(n-e)/(t-e)}function A(e,t,n){return(1-n)*e+n*t}function j(e,t,n,r){return A(e,t,1-Math.exp(-n*r))}function M(e,t=1){return t-Math.abs(D(e,t*2)-t)}function N(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))}function P(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10))}function F(e,t){return e+Math.floor(Math.random()*(t-e+1))}function ee(e,t){return e+Math.random()*(t-e)}function te(e){return e*(.5-Math.random())}function ne(e){e!==void 0&&(bi=e);let t=bi+=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 re(e){return e*xi}function ie(e){return e*Si}function ae(e){return e>0&&Number.isInteger(e)&&2**Math.round(Math.log2(e))===e}function I(e){return 2**Math.ceil(Math.log(e)/Math.LN2)}function oe(e){return 2**Math.floor(Math.log(e)/Math.LN2)}function se(e,t,n,r,i){let a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+r)/2),u=o((t+r)/2),d=a((t-r)/2),f=o((t-r)/2),p=a((r-t)/2),m=o((r-t)/2);switch(i){case`XYX`:e.set(s*u,c*d,c*f,s*l);break;case`YZY`:e.set(c*f,s*u,c*d,s*l);break;case`ZXZ`:e.set(c*d,c*f,s*u,s*l);break;case`XZX`:e.set(s*u,c*m,c*p,s*l);break;case`YXY`:e.set(c*p,s*u,c*m,s*l);break;case`ZYZ`:e.set(c*m,c*p,s*u,s*l);break;default:x(`MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: `+i)}}function ce(e){switch(e.constructor){case Uint32Array:return 4294967295;case Uint16Array:return 65535;case Uint8Array:case Uint8ClampedArray:return 255;case Int32Array:return 2147483647;case Int16Array:return 32767;case Int8Array:return 127;default:return}}function le(e,t){if(t.constructor===Float32Array)return e;let n=ce(t);if(n===void 0)throw Error(`THREE.MathUtils: Invalid component type.`);return Math.max(e/n,-1)}function ue(e,t){if(t.constructor===Float32Array)return e;let n=ce(t);if(n===void 0)throw Error(`THREE.MathUtils: Invalid component type.`);return Math.round(e*n)}function de(){let e={enabled:!0,workingColorSpace:Vr,spaces:{},convert:function(e,t,n){return this.enabled===!1||t===n||!t||!n||(this.spaces[t].transfer===`srgb`&&(e.r=fe(e.r),e.g=fe(e.g),e.b=fe(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===`srgb`&&(e.r=pe(e.r),e.g=pe(e.g),e.b=pe(e.b))),e},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===``?Hr:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||`standard`},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[n].fromXYZ).multiply(this.spaces[t].toXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return e.define({[Vr]:{primaries:t,whitePoint:r,transfer:Hr,toXYZ:ki,fromXYZ:Ai,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:Br},outputColorSpaceConfig:{drawingBufferColorSpace:Br}},[Br]:{primaries:t,whitePoint:r,transfer:Ur,toXYZ:ki,fromXYZ:Ai,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:Br}}}),e}function fe(e){return e<.04045?e*.0773993808:(e*.9478672986+.0521327014)**2.4}function pe(e){return e<.0031308?e*12.92:1.055*e**.41666-.055}function me(e){return typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap?Ni.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(x(`Texture: Unable to serialize Texture.`),{})}function he(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}function ge(e,t,n,r,i){for(let a=0,o=e.length-3;a<=o;a+=3){ro.fromArray(e,a);let o=i.x*Math.abs(ro.x)+i.y*Math.abs(ro.y)+i.z*Math.abs(ro.z),s=t.dot(ro),c=n.dot(ro),l=r.dot(ro);if(Math.max(-Math.max(s,c,l),Math.min(s,c,l))>o)return!1}return!0}function _e(){let e=/* @__PURE__ */ new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),r=/* @__PURE__ */ new Uint32Array(512),i=/* @__PURE__ */ new Uint32Array(512);for(let e=0;e<256;++e){let t=e-127;t<-27?(r[e]=0,r[e|256]=32768,i[e]=24,i[e|256]=24):t<-14?(r[e]=1024>>-t-14,r[e|256]=1024>>-t-14|32768,i[e]=-t-1,i[e|256]=-t-1):t<=15?(r[e]=t+15<<10,r[e|256]=t+15<<10|32768,i[e]=13,i[e|256]=13):t<128?(r[e]=31744,r[e|256]=64512,i[e]=24,i[e|256]=24):(r[e]=31744,r[e|256]=64512,i[e]=13,i[e|256]=13)}let a=/* @__PURE__ */ new Uint32Array(2048),o=/* @__PURE__ */ new Uint32Array(64),s=/* @__PURE__ */ new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,n=0;for(;!(t&8388608);)t<<=1,n-=8388608;t&=-8388609,n+=947912704,a[e]=t|n}for(let e=1024;e<2048;++e)a[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)o[e]=e<<23;o[31]=1199570944,o[32]=2147483648;for(let e=33;e<63;++e)o[e]=2147483648+(e-32<<23);o[63]=3347054592;for(let e=1;e<64;++e)e!==32&&(s[e]=1024);return{floatView:t,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:a,exponentTable:o,offsetTable:s}}function ve(e){Math.abs(e)>65504&&x(`DataUtils.toHalfFloat(): Value out of range.`),e=E(e,-65504,65504),io.floatView[0]=e;let t=io.uint32View[0],n=t>>23&511;return io.baseTable[n]+((t&8388607)>>io.shiftTable[n])}function ye(e){let t=e>>10;return io.uint32View[0]=io.mantissaTable[io.offsetTable[t]+(e&1023)]+io.exponentTable[t],io.floatView[0]}function be(e){return e.buffer._uuid===void 0&&(e.buffer._uuid=T()),e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer._uuid:e.buffer._uuid+`:`+e.byteOffset+`:`+e.byteLength}function xe(e,t,n,r,i,a){Uo.subVectors(e,n).addScalar(.5).multiply(r),i===void 0?Wo.copy(Uo):(Wo.x=a*Uo.x-i*Uo.y,Wo.y=i*Uo.x+a*Uo.y),e.copy(t),e.x+=Wo.x,e.y+=Wo.y,e.applyMatrix4(Go)}function Se(e,t,n,r,i,a,o,s){let c;if(c=t.side===1?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,t.side===0,s),c===null)return null;vs.copy(s),vs.applyMatrix4(e.matrixWorld);let l=n.ray.origin.distanceTo(vs);return l<n.near||l>n.far?null:{distance:l,point:vs.clone(),object:e}}function Ce(e,t,n,r,i,a,o,s,c,l){e.getVertexPosition(s,fs),e.getVertexPosition(c,ps),e.getVertexPosition(l,ms);let u=Se(e,t,n,r,fs,ps,ms,_s);if(u){let e=new B;Ua.getBarycoord(_s,fs,ps,ms,e),i&&(u.uv=Ua.getInterpolatedAttribute(i,s,c,l,e,new z)),a&&(u.uv1=Ua.getInterpolatedAttribute(a,s,c,l,e,new z)),o&&(u.normal=Ua.getInterpolatedAttribute(o,s,c,l,e,new B),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));let t={a:s,b:c,c:l,normal:new B,materialIndex:0};Ua.getNormal(fs,ps,ms,t.normal),u.face=t,u.barycoord=e}return u}function we(e,t){return e-t}function Te(e,t){return e.z-t.z}function Ee(e,t){return t.z-e.z}function L(e,t,n=0){let r=t.itemSize;if(e.isInterleavedBufferAttribute||e.array.constructor!==t.array.constructor){let i=e.count;for(let a=0;a<i;a++)for(let i=0;i<r;i++)t.setComponent(a+n,i,e.getComponent(a,i))}else t.array.set(e.array,n*r);t.needsUpdate=!0}function De(e,t){if(e.constructor!==t.constructor){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)t[r]=e[r]}else{let n=Math.min(e.length,t.length);t.set(new e.constructor(e.buffer,0,n))}}function Oe(e,t,n,r,i,a,o){let s=e.geometry.attributes.position;if(dc.fromBufferAttribute(s,i),fc.fromBufferAttribute(s,a),n.distanceSqToSegment(dc,fc,gc,_c)>r)return;gc.applyMatrix4(e.matrixWorld);let c=t.ray.origin.distanceTo(gc);if(!(c<t.near||c>t.far))return{distance:c,point:_c.clone().applyMatrix4(e.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:e}}function ke(e,t,n,r,i,a,o){let s=Tc.distanceSqToPoint(e);if(s<n){let n=new B;Tc.closestPointToPoint(e,n),n.applyMatrix4(r);let c=i.ray.origin.distanceTo(n);if(c<i.near||c>i.far)return;a.push({distance:c,distanceToRay:Math.sqrt(s),point:n,index:t,face:null,faceIndex:null,barycoord:null,object:o})}}function R(){let e=0,t=0,n=0,r=0;function i(i,a,o,s){e=i,t=o,n=-3*i+3*a-2*o-s,r=2*i-2*a+o+s}return{initCatmullRom:function(e,t,n,r,a){i(t,n,a*(n-e),a*(r-t))},initNonuniformCatmullRom:function(e,t,n,r,a,o,s){let c=(t-e)/a-(n-e)/(a+o)+(n-t)/o,l=(n-t)/o-(r-t)/(o+s)+(r-n)/s;c*=o,l*=o,i(t,n,c,l)},calc:function(i){let a=i*i,o=a*i;return e+t*i+n*a+r*o}}}function Ae(e,t,n,r,i){let a=(r-t)*.5,o=(i-n)*.5,s=e*e,c=e*s;return(2*n-2*r+a+o)*c+(-3*n+3*r-2*a-o)*s+a*e+n}function je(e,t){let n=1-e;return n*n*t}function Me(e,t){return 2*(1-e)*e*t}function Ne(e,t){return e*e*t}function Pe(e,t,n,r){return je(e,t)+Me(e,n)+Ne(e,r)}function Fe(e,t){let n=1-e;return n*n*n*t}function Ie(e,t){let n=1-e;return 3*n*n*e*t}function Le(e,t){return 3*(1-e)*e*e*t}function Re(e,t){return e*e*e*t}function ze(e,t,n,r,i){return Fe(e,t)+Ie(e,n)+Le(e,r)+Re(e,i)}function Be(e,t,n=2){let r=t&&t.length,i=r?t[0]*n:e.length,a=Ve(e,0,i,n,!0),o=[];if(!a||a.next===a.prev)return o;let s,c,l;if(r&&(a=Je(e,t,a,n)),e.length>80*n){s=e[0],c=e[1];let t=s,r=c;for(let a=n;a<i;a+=n){let n=e[a],i=e[a+1];n<s&&(s=n),i<c&&(c=i),n>t&&(t=n),i>r&&(r=i)}l=Math.max(t-s,r-c),l=l===0?0:32767/l}return Ue(a,o,n,s,c,l,0),o}function Ve(e,t,n,r,i){let a;if(i===vt(e,t,n,r)>0)for(let i=t;i<n;i+=r)a=ht(i/r|0,e[i],e[i+1],a);else for(let i=n-r;i>=t;i-=r)a=ht(i/r|0,e[i],e[i+1],a);return a&&st(a,a.next)&&(gt(a),a=a.next),a}function He(e,t){if(!e)return e;t||=e;let n=e,r;do if(r=!1,!n.steiner&&(st(n,n.next)||ot(n.prev,n,n.next)===0)){if(gt(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function Ue(e,t,n,r,i,a,o){if(!e)return;!o&&a&&$e(e,r,i,a);let s=e;for(;e.prev!==e.next;){let c=e.prev,l=e.next;if(a?Ge(e,r,i,a):We(e))t.push(c.i,e.i,l.i),gt(e),e=l.next,s=l.next;else if(e=l,e===s){o?o===1?(e=Ke(He(e),t),Ue(e,t,n,r,i,a,2)):o===2&&qe(e,t,n,r,i,a):Ue(He(e),t,n,r,i,a,1);break}}}function We(e){let t=e.prev,n=e,r=e.next;if(ot(t,n,r)>=0)return!1;let i=t.x,a=n.x,o=r.x,s=t.y,c=n.y,l=r.y,u=Math.min(i,a,o),d=Math.min(s,c,l),f=Math.max(i,a,o),p=Math.max(s,c,l),m=r.next;for(;m!==t;){if(m.x>=u&&m.x<=f&&m.y>=d&&m.y<=p&&it(i,s,a,c,o,l,m.x,m.y)&&ot(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Ge(e,t,n,r){let i=e.prev,a=e,o=e.next;if(ot(i,a,o)>=0)return!1;let s=i.x,c=a.x,l=o.x,u=i.y,d=a.y,f=o.y,p=Math.min(s,c,l),m=Math.min(u,d,f),h=Math.max(s,c,l),g=Math.max(u,d,f),_=tt(p,m,t,n,r),v=tt(h,g,t,n,r),y=e.prevZ,b=e.nextZ;for(;y&&y.z>=_&&b&&b.z<=v;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&it(s,u,c,d,l,f,y.x,y.y)&&ot(y.prev,y,y.next)>=0||(y=y.prevZ,b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&it(s,u,c,d,l,f,b.x,b.y)&&ot(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;y&&y.z>=_;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&it(s,u,c,d,l,f,y.x,y.y)&&ot(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;b&&b.z<=v;){if(b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&it(s,u,c,d,l,f,b.x,b.y)&&ot(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function Ke(e,t){let n=e;do{let r=n.prev,i=n.next.next;!st(r,i)&&ct(r,n,n.next,i)&&ft(r,i)&&ft(i,r)&&(t.push(r.i,n.i,i.i),gt(n),gt(n.next),n=e=i),n=n.next}while(n!==e);return He(n)}function qe(e,t,n,r,i,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&at(o,e)){let s=mt(o,e);o=He(o,o.next),s=He(s,s.next),Ue(o,t,n,r,i,a,0),Ue(s,t,n,r,i,a,0);return}e=e.next}o=o.next}while(o!==e)}function Je(e,t,n,r){let i=[];for(let n=0,a=t.length;n<a;n++){let o=Ve(e,t[n]*r,n<a-1?t[n+1]*r:e.length,r,!1);o===o.next&&(o.steiner=!0),i.push(nt(o))}i.sort(Ye);for(let e=0;e<i.length;e++)n=Xe(i[e],n);return n}function Ye(e,t){let n=e.x-t.x;return n===0&&(n=e.y-t.y,n===0&&(n=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x))),n}function Xe(e,t){let n=Ze(e,t);if(!n)return t;let r=mt(n,e);return He(r,r.next),He(n,n.next)}function Ze(e,t){let n=t,r=e.x,i=e.y,a=-1/0,o;if(st(e,n))return n;do{if(st(e,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){let e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>a&&(a=e,o=n.x<n.next.x?n:n.next,e===r))return o}n=n.next}while(n!==t);if(!o)return null;let s=o,c=o.x,l=o.y,u=1/0;n=o;do{if(r>=n.x&&n.x>=c&&r!==n.x&&rt(i<l?r:a,i,c,l,i<l?a:r,i,n.x,n.y)){let t=Math.abs(i-n.y)/(r-n.x);ft(n,e)&&(t<u||t===u&&(n.x>o.x||n.x===o.x&&Qe(o,n)))&&(o=n,u=t)}n=n.next}while(n!==s);return o}function Qe(e,t){return ot(e.prev,e,t.prev)<0&&ot(t.next,e,e.next)<0}function $e(e,t,n,r){let i=e;do i.z===0&&(i.z=tt(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,et(i)}function et(e){let t,n=1;do{let r=e,i;e=null;let a=null;for(t=0;r;){t++;let o=r,s=0;for(let e=0;e<n&&(s++,o=o.nextZ,o);e++);let c=n;for(;s>0||c>0&&o;)s!==0&&(c===0||!o||r.z<=o.z)?(i=r,r=r.nextZ,s--):(i=o,o=o.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;r=o}a.nextZ=null,n*=2}while(t>1);return e}function tt(e,t,n,r,i){return e=(e-n)*i|0,t=(t-r)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function nt(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function rt(e,t,n,r,i,a,o,s){return(i-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function it(e,t,n,r,i,a,o,s){return(e!==o||t!==s)&&rt(e,t,n,r,i,a,o,s)}function at(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!dt(e,t)&&(ft(e,t)&&ft(t,e)&&pt(e,t)&&(ot(e.prev,e,t.prev)||ot(e,t.prev,t))||st(e,t)&&ot(e.prev,e,e.next)>0&&ot(t.prev,t,t.next)>0)}function ot(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function st(e,t){return e.x===t.x&&e.y===t.y}function ct(e,t,n,r){let i=ut(ot(e,t,n)),a=ut(ot(e,t,r)),o=ut(ot(n,r,e)),s=ut(ot(n,r,t));return!!(i!==a&&o!==s||i===0&&lt(e,n,t)||a===0&&lt(e,r,t)||o===0&&lt(n,e,r)||s===0&&lt(n,t,r))}function lt(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function ut(e){return e>0?1:e<0?-1:0}function dt(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&ct(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function ft(e,t){return ot(e.prev,e,e.next)<0?ot(e,t,e.next)>=0&&ot(e,e.prev,t)>=0:ot(e,t,e.prev)<0||ot(e,e.next,t)<0}function pt(e,t){let n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function mt(e,t){let n=_t(e.i,e.x,e.y),r=_t(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function ht(e,t,n,r){let i=_t(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function gt(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function _t(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function vt(e,t,n,r){let i=0;for(let a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}function yt(e){let t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function bt(e,t){for(let n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}function xt(e,t,n){if(n.shapes=[],Array.isArray(e))for(let t=0,r=e.length;t<r;t++){let r=e[t];n.shapes.push(r.uuid)}else n.shapes.push(e.uuid);return n.options=Object.assign({},t),t.extrudePath!==void 0&&(n.options.extrudePath=t.extrudePath.toJSON()),n}function St(e,t){if(t.shapes=[],Array.isArray(e))for(let n=0,r=e.length;n<r;n++){let r=e[n];t.shapes.push(r.uuid)}else t.shapes.push(e.uuid);return t}function Ct(e,t,n){let r=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`,i=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`;return n.has(r)===!0||n.has(i)===!0?!1:(n.add(r),n.add(i),!0)}function wt(e){let t={};for(let n in e){t[n]={};for(let r in e[n]){let i=e[n][r];if(Et(i))i.isRenderTargetTexture?(x(`UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().`),t[n][r]=null):t[n][r]=i.clone();else if(Array.isArray(i)){if(Et(i[0])){let e=[];for(let t=0,n=i.length;t<n;t++)e[t]=i[t].clone();t[n][r]=e}else t[n][r]=i.slice()}else t[n][r]=i}}return t}function Tt(e){let t={};for(let n=0;n<e.length;n++){let r=wt(e[n]);for(let e in r)t[e]=r[e]}return t}function Et(e){return e&&(e.isColor||e.isMatrix3||e.isMatrix4||e.isVector2||e.isVector3||e.isVector4||e.isTexture||e.isQuaternion)}function Dt(e){let t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}function Ot(e){let t=e.getRenderTarget();return t===null?e.outputColorSpace:t.isXRRenderTarget===!0?t.texture.colorSpace:ji.workingColorSpace}function kt(e,t){return!e||e.constructor===t?e:typeof t.BYTES_PER_ELEMENT==`number`?new t(e):Array.prototype.slice.call(e)}function At(e){return e!==void 0&&e.inTangents!==void 0&&e.outTangents!==void 0}function jt(e){function t(t,n){return e[t]-e[n]}let n=e.length,r=Array(n);for(let e=0;e!==n;++e)r[e]=e;return r.sort(t),r}function Mt(e,t,n){let r=e.length,i=new e.constructor(r);for(let a=0,o=0;o!==r;++a){let r=n[a]*t;for(let n=0;n!==t;++n)i[o++]=e[r+n]}return i}function Nt(e,t,n,r){let i=1,a=e[0];for(;a!==void 0&&a[r]===void 0;)a=e[i++];if(a===void 0)return;let o=a[r];if(o!==void 0){if(Array.isArray(o))do o=a[r],o!==void 0&&(t.push(a.time),n.push(...o)),a=e[i++];while(a!==void 0);else if(o.toArray!==void 0)do o=a[r],o!==void 0&&(t.push(a.time),o.toArray(n,n.length)),a=e[i++];while(a!==void 0);else do o=a[r],o!==void 0&&(t.push(a.time),n.push(o)),a=e[i++];while(a!==void 0)}}function Pt(e,t,n,r,i=30){let a=e.clone();a.name=t;let o=[];for(let e=0;e<a.tracks.length;++e){let t=a.tracks[e],s=t.getValueSize(),c=[],l=[];for(let e=0;e<t.times.length;++e){let a=t.times[e]*i;if(!(a<n||a>=r)){c.push(t.times[e]);for(let n=0;n<s;++n)l.push(t.values[e*s+n])}}c.length!==0&&(t.times=kt(c,t.times.constructor),t.values=kt(l,t.values.constructor),o.push(t))}a.tracks=o;let s=1/0;for(let e=0;e<a.tracks.length;++e)s>a.tracks[e].times[0]&&(s=a.tracks[e].times[0]);for(let e=0;e<a.tracks.length;++e)a.tracks[e].shift(-1*s);return a.resetDuration(),a}function Ft(e,t=0,n=e,r=30){r<=0&&(r=30);let i=n.tracks.length,a=t/r;for(let t=0;t<i;++t){let r=n.tracks[t],i=r.ValueTypeName;if(i===`bool`||i===`string`)continue;let o=e.tracks.find(function(e){return e.name===r.name&&e.ValueTypeName===i});if(o===void 0)continue;let s=0,c=r.getValueSize();r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(s=c/3);let l=0,u=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(l=u/3);let d=r.times.length-1,f;if(a<=r.times[0]){let e=s,t=c-s;f=r.values.slice(e,t)}else if(a>=r.times[d]){let e=d*c+s,t=e+c-s;f=r.values.slice(e,t)}else{let e=r.createInterpolant();e.evaluate(a),f=e.resultBuffer.slice()}i===`quaternion`&&new wi().fromArray(f).normalize().conjugate().toArray(f);let p=o.times.length;for(let e=0;e<p;++e){let t=e*u+l;if(i===`quaternion`)wi.multiplyQuaternionsFlat(o.values,t,f,0,o.values,t);else{let e=u-l*2;for(let n=0;n<e;++n)o.values[t+n]-=f[n]}}}return e.blendMode=Fr,e}function It(e,t,n,r,i){let a=1-e;return a*a*a*t+3*a*a*e*n+3*a*e*e*r+e*e*e*i}function Lt(e,t,n,r,i){let a=1-e;return 3*a*a*(n-t)+6*a*e*(r-n)+3*e*e*(i-r)}function Rt(e,t,n,r,i){let a=(e-t)/(i-t);for(let o=0;o<8;o++){let o=It(a,t,n,r,i)-e;if(Math.abs(o)<1e-10)break;let s=Lt(a,t,n,r,i);if(Math.abs(s)<1e-10)break;a=Math.max(0,Math.min(1,a-o/s))}return a}function zt(e,t){for(let n=0,r=e.length;n!==r;n+=2)e[n]+=t}function Bt(e,t){for(let n=0,r=e.length;n!==r;n+=2)e[n]*=t}function Vt(e){switch(e.toLowerCase()){case`scalar`:case`double`:case`float`:case`number`:case`integer`:return su;case`vector`:case`vector2`:case`vector3`:case`vector4`:return du;case`color`:return ou;case`quaternion`:return lu;case`bool`:case`boolean`:return au;case`string`:return uu}throw Error(`THREE.KeyframeTrack: Unsupported typeName: `+e)}function Ht(e){if(e.type===void 0)throw Error(`THREE.KeyframeTrack: track type undefined, can not parse`);let t=Vt(e.type);if(e.times===void 0){let t=[],n=[];Nt(e.keys,t,n,`value`),e.times=t,e.values=n}let n;return n=t.parse===void 0?new t(e.name,e.times,e.values,e.interpolation):t.parse(e),At(e.settings)&&(n.settings={inTangents:kt(e.settings.inTangents,Float32Array),outTangents:kt(e.settings.outTangents,Float32Array)}),n}function Ut(e){try{let t=e.slice(e.indexOf(`:`)+1);return new URL(t).protocol===`blob:`}catch{return!1}}function Wt(){this._document.hidden===!1&&this.reset()}function Gt(e,t){return e.distance-t.distance}function Kt(e,t,n,r){let i=!0;if(e.layers.test(t.layers)&&e.raycast(t,n)===!1&&(i=!1),i===!0&&r===!0){let r=e.children;for(let e=0,i=r.length;e<i;e++)Kt(r[e],t,n,!0)}}function qt(e){let t=[];e.isBone===!0&&t.push(e);for(let n=0;n<e.children.length;n++)t.push(...qt(e.children[n]));return t}function Jt(e,t,n,r,i,a,o){Rf.set(i,a,o).unproject(r);let s=t[e];if(s!==void 0){let e=n.getAttribute(`position`);for(let t=0,n=s.length;t<n;t++)e.setXYZ(s[t],Rf.x,Rf.y,Rf.z)}}function Yt(e,t){let n=e.image&&e.image.width?e.image.width/e.image.height:1;return n>t?(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2):(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0),e}function Xt(e,t){let n=e.image&&e.image.width?e.image.width/e.image.height:1;return n>t?(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0):(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2),e}function Zt(e){return e.repeat.x=1,e.repeat.y=1,e.offset.x=0,e.offset.y=0,e}function Qt(e,t,n,r){let i=$t(r);switch(n){case jn:return e*t;case In:return e*t/i.components*i.byteLength;case Ln:return e*t/i.components*i.byteLength;case Rn:return e*t*2/i.components*i.byteLength;case zn:return e*t*2/i.components*i.byteLength;case Mn:return e*t*3/i.components*i.byteLength;case Nn:return e*t*4/i.components*i.byteLength;case Vn:return e*t*4/i.components*i.byteLength;case Hn:case Un:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case Wn:case Gn:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case qn:case Yn:return Math.max(e,16)*Math.max(t,8)/4;case Kn:case Jn:return Math.max(e,8)*Math.max(t,8)/2;case Xn:case Zn:case $n:case er:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case Qn:case tr:case nr:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case rr:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case ir:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case ar:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case or:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case sr:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case cr:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case lr:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case ur:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case dr:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case fr:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case pr:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case mr:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case hr:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case gr:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case _r:case vr:case yr:return Math.ceil(e/4)*Math.ceil(t/4)*16;case br:case xr:return Math.ceil(e/4)*Math.ceil(t/4)*8;case Sr:case Cr:return Math.ceil(e/4)*Math.ceil(t/4)*16}throw Error(`Unable to determine texture byte length for ${n} format.`)}function $t(e){switch(e){case vn:case yn:return{byteLength:1,components:1};case xn:case bn:case Tn:return{byteLength:2,components:1};case En:case Dn:return{byteLength:2,components:4};case Cn:case Sn:case wn:return{byteLength:4,components:1};case kn:case An:return{byteLength:4,components:3}}throw Error(`THREE.TextureUtils: Unknown texture type ${e}.`)}var en,tn,nn,rn,an,on,sn,cn,ln,un,dn,fn,pn,mn,hn,gn,_n,vn,yn,bn,xn,Sn,Cn,wn,Tn,En,Dn,On,kn,An,jn,Mn,Nn,Pn,Fn,In,Ln,Rn,zn,Bn,Vn,Hn,Un,Wn,Gn,Kn,qn,Jn,Yn,Xn,Zn,Qn,$n,er,tr,nr,rr,ir,ar,or,sr,cr,lr,ur,dr,fr,pr,mr,hr,gr,_r,vr,yr,br,xr,Sr,Cr,wr,Tr,Er,Dr,Or,kr,Ar,jr,Mr,Nr,Pr,Fr,Ir,Lr,Rr,zr,Br,Vr,Hr,Ur,Wr,Gr,Kr,qr,Jr,Yr,Xr,Zr,Qr,$r,ei,ti,ni,ri,ii,ai,oi,si,ci,li,ui,di,fi,pi,mi,hi,gi,_i,vi,yi,bi,xi,Si,Ci,z,wi,B,Ti,Ei,Di,Oi,ki,Ai,ji,Mi,Ni,Pi,Fi,Ii,Li,Ri,zi,Bi,Vi,Hi,Ui,Wi,Gi,Ki,V,qi,Ji,Yi,Xi,Zi,Qi,$i,ea,ta,na,ra,ia,aa,oa,sa,ca,la,ua,da,fa,pa,ma,ha,ga,_a,va,ya,ba,xa,Sa,Ca,wa,Ta,H,Ea,Da,Oa,ka,Aa,ja,Ma,Na,Pa,Fa,Ia,La,Ra,za,Ba,Va,Ha,Ua,Wa,Ga,Ka,qa,Ja,Ya,Xa,Za,Qa,$a,eo,to,no,ro,io,U,ao,oo,so,co,lo,uo,fo,po,mo,ho,go,_o,W,vo,yo,bo,xo,So,Co,wo,To,Eo,Do,Oo,G,ko,Ao,jo,Mo,No,Po,Fo,Io,Lo,Ro,zo,Bo,Vo,Ho,Uo,Wo,Go,Ko,qo,Jo,Yo,Xo,Zo,Qo,$o,es,ts,ns,rs,is,as,os,ss,cs,ls,us,ds,fs,ps,ms,hs,gs,_s,vs,K,ys,bs,xs,Ss,Cs,ws,Ts,Es,Ds,Os,ks,As,js,Ms,Ns,Ps,Fs,Is,Ls,Rs,zs,Bs,Vs,Hs,Us,Ws,Gs,Ks,qs,Js,Ys,Xs,Zs,Qs,$s,ec,tc,nc,rc,ic,ac,oc,sc,cc,lc,uc,dc,fc,pc,mc,hc,gc,_c,vc,yc,bc,xc,Sc,Cc,wc,Tc,Ec,Dc,Oc,kc,Ac,jc,Mc,Nc,Pc,Fc,Ic,Lc,Rc,zc,Bc,Vc,Hc,Uc,Wc,Gc,Kc,qc,Jc,Yc,Xc,Zc,Qc,$c,el,tl,nl,rl,il,al,ol,sl,cl,ll,ul,dl,fl,pl,ml,hl,gl,_l,vl,yl,bl,xl,Sl,Cl,wl,Tl,El,Dl,Ol,kl,Al,jl,Ml,Nl,Pl,Fl,Il,Ll,Rl,zl,Bl,Vl,Hl,Ul,Wl,Gl,Kl,ql,Jl,Yl,Xl,Zl,Ql,$l,eu,tu,nu,ru,iu,au,ou,su,cu,lu,uu,du,fu,pu,mu,hu,gu,_u,vu,yu,bu,xu,Su,Cu,wu,Tu,Eu,Du,Ou,ku,Au,ju,Mu,Nu,Pu,Fu,Iu,Lu,Ru,zu,Bu,Vu,Hu,Uu,Wu,Gu,Ku,qu,Ju,Yu,Xu,Zu,Qu,$u,ed,td,nd,rd,id,ad,od,sd,cd,ld,ud,dd,fd,pd,md,hd,gd,_d,vd,yd,bd,xd,Sd,Cd,wd,Td,Ed,Dd,Od,kd,Ad,jd,Md,Nd,Pd,Fd,Id,Ld,Rd,zd,Bd,Vd,Hd,Ud,Wd,Gd,Kd,qd,Jd,Yd,Xd,Zd,Qd,$d,ef,tf,nf,rf,af,of,sf,cf,lf,uf,df,ff,pf,mf,hf,gf,_f,vf,yf,bf,xf,Sf,Cf,wf,Tf,Ef,Df,Of,kf,Af,jf,Mf,Nf,Pf,Ff,If,Lf,Rf,zf,Bf,Vf,Hf,Uf,Wf,Gf,Kf,qf,Jf,Yf,Xf,Zf,Qf,$f=t((()=>{en={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},tn={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},nn=`attached`,rn=`detached`,an=1e3,on=1001,sn=1002,cn=1003,ln=1004,un=1004,dn=1005,fn=1005,pn=1006,mn=1007,hn=1007,gn=1008,_n=1008,vn=1009,yn=1010,bn=1011,xn=1012,Sn=1013,Cn=1014,wn=1015,Tn=1016,En=1017,Dn=1018,On=1020,kn=35902,An=35899,jn=1021,Mn=1022,Nn=1023,Pn=1026,Fn=1027,In=1028,Ln=1029,Rn=1030,zn=1031,Bn=1032,Vn=1033,Hn=33776,Un=33777,Wn=33778,Gn=33779,Kn=35840,qn=35841,Jn=35842,Yn=35843,Xn=36196,Zn=37492,Qn=37496,$n=37488,er=37489,tr=37490,nr=37491,rr=37808,ir=37809,ar=37810,or=37811,sr=37812,cr=37813,lr=37814,ur=37815,dr=37816,fr=37817,pr=37818,mr=37819,hr=37820,gr=37821,_r=36492,vr=36494,yr=36495,br=36283,xr=36284,Sr=36285,Cr=36286,wr=2200,Tr=2201,Er=2202,Dr=2300,Or=2301,kr=2302,Ar=2303,jr=2400,Mr=2401,Nr=2402,Pr=2500,Fr=2501,Ir=3200,Lr=3201,Rr=3202,zr=3203,Br=`srgb`,Vr=`srgb-linear`,Hr=`linear`,Ur=`srgb`,Wr=7680,Gr=7681,Kr=7682,qr=7683,Jr=34055,Yr=34056,Xr=5386,Zr=35044,Qr=35048,$r=35040,ei=35045,ti=35049,ni=35041,ri=35046,ii=35050,ai=35042,oi=`300 es`,si=2e3,ci=2001,li={COMPUTE:`compute`,RENDER:`render`},ui={PERSPECTIVE:`perspective`,LINEAR:`linear`,FLAT:`flat`},di={NORMAL:`normal`,CENTROID:`centroid`,SAMPLE:`sample`,FIRST:`first`,EITHER:`either`},fi={TEXTURE_COMPARE:`depthTextureCompare`},pi={NONE:0,SHARED:1,FULL:2},mi={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array},hi={},gi=null,_i={0:0,2:6,4:4,3:5,1:1,6:2,7:7,5:3},vi=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n!==void 0&&n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let t=n.slice(0);for(let n=0,r=t.length;n<r;n++)t[n].call(this,e);e.target=null}}},yi=/* @__PURE__ */ `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`.split(`.`),bi=1234567,xi=Math.PI/180,Si=180/Math.PI,Ci={DEG2RAD:xi,RAD2DEG:Si,generateUUID:T,clamp:E,euclideanModulo:D,mapLinear:O,inverseLerp:k,lerp:A,damp:j,pingpong:M,smoothstep:N,smootherstep:P,randInt:F,randFloat:ee,randFloatSpread:te,seededRandom:ne,degToRad:re,radToDeg:ie,isPowerOfTwo:ae,ceilPowerOfTwo:I,floorPowerOfTwo:oe,setQuaternionFromProperEuler:se,normalize:ue,denormalize:le},z=class{static{this.prototype.isVector2=!0}constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error(`THREE.Vector2: index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error(`THREE.Vector2: index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=E(this.x,e.x,t.x),this.y=E(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=E(this.x,e,t),this.y=E(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(E(n,e,t))}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(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.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(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(E(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},wi=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,i,a,o){let s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],d=i[a+0],f=i[a+1],p=i[a+2],m=i[a+3];if(u!==m||s!==d||c!==f||l!==p){let e=s*d+c*f+l*p+u*m;e<0&&(d=-d,f=-f,p=-p,m=-m,e=-e);let t=1-o;if(e<.9995){let n=Math.acos(e),r=Math.sin(n);t=Math.sin(t*n)/r,o=Math.sin(o*n)/r,s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o}else{s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o;let e=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=e,c*=e,l*=e,u*=e}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,i,a){let o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],d=i[a+1],f=i[a+2],p=i[a+3];return e[t]=o*p+l*u+s*f-c*d,e[t+1]=s*p+l*d+c*u-o*f,e[t+2]=c*p+l*f+o*d-s*u,e[t+3]=l*p-o*u-s*d-c*f,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,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,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 n=e._x,r=e._y,i=e._z,a=e._order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),d=s(n/2),f=s(r/2),p=s(i/2);switch(a){case`XYZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`YXZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`ZXY`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`ZYX`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`YZX`:this._x=d*l*u+c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u-d*f*p;break;case`XZY`:this._x=d*l*u-c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u+d*f*p;break;default:x(`Quaternion: .setFromEuler() encountered an unknown order: `+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],c=t[2],l=t[6],u=t[10],d=n+o+u;if(d>0){let e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(l-s)*e,this._y=(i-c)*e,this._z=(a-r)*e}else if(n>o&&n>u){let e=2*Math.sqrt(1+n-o-u);this._w=(l-s)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(i+c)/e}else if(o>u){let e=2*Math.sqrt(1+o-n-u);this._w=(i-c)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(s+l)/e}else{let e=2*Math.sqrt(1+u-n-o);this._w=(a-r)/e,this._x=(i+c)/e,this._y=(s+l)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(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=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(E(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),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*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,r=-r,i=-i,a=-a,o=-o);let s=1-t;if(o<.9995){let e=Math.acos(o),c=Math.sin(e);s=Math.sin(s*e)/c,t=Math.sin(t*e)/c,this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this._onChangeCallback()}else this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*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}},B=class{static{this.prototype.isVector3=!0}constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error(`THREE.Vector3: index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error(`THREE.Vector3: index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Ei.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Ei.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=2*(a*r-o*n),l=2*(o*t-i*r),u=2*(i*n-a*t);return this.x=t+s*c+a*u-o*l,this.y=n+s*l+o*c-i*u,this.z=r+s*u+i*l-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=E(this.x,e.x,t.x),this.y=E(this.y,e.y,t.y),this.z=E(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=E(this.x,e,t),this.y=E(this.y,e,t),this.z=E(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(E(n,e,t))}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(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Ti.copy(this).projectOnVector(e),this.sub(Ti)}reflect(e){return this.sub(Ti.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(E(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Ti=/*@__PURE__*/ new B,Ei=/*@__PURE__*/ new wi,Di=class{static{this.prototype.isMatrix3=!0}constructor(e,t,n,r,i,a,o,s,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,i,a,o,s,c)}set(e,t,n,r,i,a,o,s,c){let l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],d=n[2],f=n[5],p=n[8],m=r[0],h=r[3],g=r[6],_=r[1],v=r[4],y=r[7],b=r[2],x=r[5],S=r[8];return i[0]=a*m+o*_+s*b,i[3]=a*h+o*v+s*x,i[6]=a*g+o*y+s*S,i[1]=c*m+l*_+u*b,i[4]=c*h+l*v+u*x,i[7]=c*g+l*y+u*S,i[2]=d*m+f*_+p*b,i[5]=d*h+f*v+p*x,i[8]=d*g+f*y+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=l*a-o*c,d=o*s-l*i,f=c*i-a*s,p=t*u+n*d+r*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return e[0]=u*m,e[1]=(r*c-l*n)*m,e[2]=(o*n-r*a)*m,e[3]=d*m,e[4]=(l*t-r*s)*m,e[5]=(r*i-o*t)*m,e[6]=f*m,e[7]=(n*s-c*t)*m,e[8]=(a*t-n*i)*m,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,a,o){let s=Math.cos(i),c=Math.sin(i);return this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1),this}scale(e,t){return C(`Matrix3: .scale() is deprecated. Use .makeScale() instead.`),this.premultiply(Oi.makeScale(e,t)),this}rotate(e){return C(`Matrix3: .rotate() is deprecated. Use .makeRotation() instead.`),this.premultiply(Oi.makeRotation(-e)),this}translate(e,t){return C(`Matrix3: .translate() is deprecated. Use .makeTranslation() instead.`),this.premultiply(Oi.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}},Oi=/*@__PURE__*/ new Di,ki=/*@__PURE__*/ new Di().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Ai=/*@__PURE__*/ new Di().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),ji=/*@__PURE__*/ de(),Ni=class{static getDataURL(e,t=`image/png`){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>`u`)return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Mi===void 0&&(Mi=h(`canvas`)),Mi.width=e.width,Mi.height=e.height;let t=Mi.getContext(`2d`);e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),n=Mi}return n.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=h(`canvas`);t.width=e.width,t.height=e.height;let n=t.getContext(`2d`);n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e<i.length;e++)i[e]=fe(i[e]/255)*255;return n.putImageData(r,0,0),t}if(e.data){let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(fe(t[e]/255)*255):t[e]=fe(t[e]);return{data:t,width:e.width,height:e.height}}return x(`ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.`),e}},Pi=0,Fi=class{constructor(e=null){this.isTextureSource=!0,Object.defineProperty(this,"id",{value:Pi++}),this.uuid=T(),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):typeof VideoFrame<`u`&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t===null?e.set(0,0,0):e.set(t.width||0,t.height||0,t.depth||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 n={uuid:this.uuid,url:``},r=this.data;if(r!==null){let e;if(Array.isArray(r)){e=[];for(let t=0,n=r.length;t<n;t++)r[t].isDataTexture?e.push(me(r[t].image)):e.push(me(r[t]))}else e=me(r);n.url=e}return t||(e.images[this.uuid]=n),n}},Ii=class extends Fi{constructor(e=null){C(`Source: "Source" has been renamed to "TextureSource". Please update your code to use "THREE.TextureSource" instead.`),super(e),this.isSource=!0}},Li=0,Ri=/*@__PURE__*/ new B,zi=class e extends vi{constructor(t=e.DEFAULT_IMAGE,n=e.DEFAULT_MAPPING,r=on,i=on,a=pn,o=gn,s=Nn,c=vn,l=e.DEFAULT_ANISOTROPY,u=``){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Li++}),this.uuid=T(),this.name=``,this.source=new Fi(t),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=a,this.minFilter=o,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=c,this.offset=new z(0,0),this.repeat=new z(1,1),this.center=new z(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Di,this.generateMipmaps=!0,this.mipmapsAutoUpdate=!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,this.isPMREMTexture=!1,this.normalized=!1}get width(){return this.source.getSize(Ri).x}get height(){return this.source.getSize(Ri).y}get depth(){return this.source.getSize(Ri).z}get image(){return this.source.data}set image(e){this.source.data=e}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(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.mipmapsAutoUpdate=e.mipmapsAutoUpdate,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isPMREMTexture=e.isPMREMTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){x(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];r===void 0?x(`Texture.setValues(): property '${t}' does not exist.`):r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:`Texture`,generator:`Texture.toJSON`},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).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,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,mipmapsAutoUpdate:this.mipmapsAutoUpdate,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:`dispose`})}transformUv(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case an:e.x-=Math.floor(e.x);break;case on:e.x=e.x<0?0:1;break;case sn:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case an:e.y-=Math.floor(e.y);break;case on:e.y=e.y<0?0:1;break;case sn:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}},zi.DEFAULT_IMAGE=null,zi.DEFAULT_MAPPING=300,zi.DEFAULT_ANISOTROPY=1,Bi=class{static{this.prototype.isVector4=!0}constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error(`THREE.Vector4: index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error(`THREE.Vector4: index is out of range: `+e)}}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===void 0?1:e.w,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],d=s[1],f=s[5],p=s[9],m=s[2],h=s[6],g=s[10];if(Math.abs(l-d)<a&&Math.abs(u-m)<a&&Math.abs(p-h)<a){if(Math.abs(l+d)<o&&Math.abs(u+m)<o&&Math.abs(p+h)<o&&Math.abs(c+f+g-3)<o)return this.set(1,0,0,0),this;t=Math.PI;let e=(c+1)/2,s=(f+1)/2,_=(g+1)/2,v=(l+d)/4,y=(u+m)/4,b=(p+h)/4;return e>s&&e>_?e<a?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(e),r=v/n,i=y/n):s>_?s<a?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(s),n=v/r,i=b/r):_<a?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(_),n=y/i,r=b/i),this.set(n,r,i,t),this}let _=Math.sqrt((h-p)*(h-p)+(u-m)*(u-m)+(d-l)*(d-l));return Math.abs(_)<.001&&(_=1),this.x=(h-p)/_,this.y=(u-m)/_,this.z=(d-l)/_,this.w=Math.acos((c+f+g-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=E(this.x,e.x,t.x),this.y=E(this.y,e.y,t.y),this.z=E(this.z,e.z,t.z),this.w=E(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=E(this.x,e,t),this.y=E(this.y,e,t),this.z=E(this.z,e,t),this.w=E(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(E(n,e,t))}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(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)}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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}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}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}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}},Vi=class extends vi{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:pn,depthBuffer:!0,stencilBuffer:!1,resolveColorBuffer:!0,resolveDepthBuffer:!0,resolveStencilBuffer:!0,storeMultisampledColorBuffer:!0,storeMultisampledDepthBuffer:!0,storeMultisampledStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new Bi(0,0,e,t),this.scissorTest=!1,this.viewport=new Bi(0,0,e,t),this.textures=[];let r=n.count;for(let i=0;i<r;i++)this.textures[i]=new zi({width:e,height:t,depth:n.depth}),this.textures[i].isRenderTargetTexture=!0,this.textures[i].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveColorBuffer=n.resolveColorBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this.storeMultisampledColorBuffer=n.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=n.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=n.storeMultisampledStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){let t={minFilter:pn,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.mipmapsAutoUpdate!==void 0&&(t.mipmapsAutoUpdate=e.mipmapsAutoUpdate),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let e=0;e<this.textures.length;e++)this.textures[e].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&this._depthTexture.renderTarget===this&&(this._depthTexture.renderTarget=null),e!==null&&e.renderTarget===null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,i=this.textures.length;r<i;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].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,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let n=Object.assign({},e.textures[t].image);this.textures[t].source=new Fi(n)}if(this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveColorBuffer=e.resolveColorBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,this.storeMultisampledColorBuffer=e.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=e.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=e.storeMultisampledStencilBuffer,e.depthTexture!==null){if(e.depthTexture.renderTarget===e){let t=e.depthTexture.clone();t.renderTarget=null,this.depthTexture=t}else this.depthTexture=e.depthTexture}else this.depthTexture=null;return this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:`dispose`})}},Hi=class extends Vi{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},Ui=class extends zi{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=cn,this.minFilter=cn,this.wrapR=on,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=/* @__PURE__ */ new Set}copy(e){return super.copy(e),this.wrapR=e.wrapR,this}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}},Wi=class extends Hi{constructor(e=1,t=1,n=1,r={}){super(e,t,r),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new Ui(null,e,t,n),this._setTextureOptions(r),this.texture.isRenderTargetTexture=!0}},Gi=class extends zi{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=cn,this.minFilter=cn,this.wrapR=on,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}copy(e){return super.copy(e),this.wrapR=e.wrapR,this}},Ki=class extends Hi{constructor(e=1,t=1,n=1,r={}){super(e,t,r),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new Gi(null,e,t,n),this._setTextureOptions(r),this.texture.isRenderTargetTexture=!0}},V=class e{static{this.prototype.isMatrix4=!0}constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=u,g[14]=d,g[3]=f,g[7]=p,g[11]=m,g[15]=h,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 e().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();let t=this.elements,n=e.elements,r=1/qi.setFromMatrixColumn(e,0).length(),i=1/qi.setFromMatrixColumn(e,1).length(),a=1/qi.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if(e.order===`XYZ`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=n+r*c,t[5]=e-i*c,t[9]=-o*s,t[2]=i-e*c,t[6]=r+n*c,t[10]=a*s}else if(e.order===`YXZ`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e+i*o,t[4]=r*o-n,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=n*o-r,t[6]=i+e*o,t[10]=a*s}else if(e.order===`ZXY`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e-i*o,t[4]=-a*u,t[8]=r+n*o,t[1]=n+r*o,t[5]=a*l,t[9]=i-e*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if(e.order===`ZYX`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=r*c-n,t[8]=e*c+i,t[1]=s*u,t[5]=i*c+e,t[9]=n*c-r,t[2]=-c,t[6]=o*s,t[10]=a*s}else if(e.order===`YZX`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=i-e*u,t[8]=r*u+n,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=n*u+r,t[10]=e-i*u}else if(e.order===`XZY`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=e*u+i,t[5]=a*l,t[9]=n*u-r,t[2]=r*u-n,t[6]=o*l,t[10]=i*u+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Yi,e,Xi)}lookAt(e,t,n){let r=this.elements;return $i.subVectors(e,t),$i.lengthSq()===0&&($i.z=1),$i.normalize(),Zi.crossVectors(n,$i),Zi.lengthSq()===0&&(Math.abs(n.z)===1?$i.x+=1e-4:$i.z+=1e-4,$i.normalize(),Zi.crossVectors(n,$i)),Zi.normalize(),Qi.crossVectors($i,Zi),r[0]=Zi.x,r[4]=Qi.x,r[8]=$i.x,r[1]=Zi.y,r[5]=Qi.y,r[9]=$i.y,r[2]=Zi.z,r[6]=Qi.z,r[10]=$i.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],d=n[9],f=n[13],p=n[2],m=n[6],h=n[10],g=n[14],_=n[3],v=n[7],y=n[11],b=n[15],x=r[0],S=r[4],C=r[8],w=r[12],T=r[1],E=r[5],D=r[9],O=r[13],k=r[2],A=r[6],j=r[10],M=r[14],N=r[3],P=r[7],F=r[11],ee=r[15];return i[0]=a*x+o*T+s*k+c*N,i[4]=a*S+o*E+s*A+c*P,i[8]=a*C+o*D+s*j+c*F,i[12]=a*w+o*O+s*M+c*ee,i[1]=l*x+u*T+d*k+f*N,i[5]=l*S+u*E+d*A+f*P,i[9]=l*C+u*D+d*j+f*F,i[13]=l*w+u*O+d*M+f*ee,i[2]=p*x+m*T+h*k+g*N,i[6]=p*S+m*E+h*A+g*P,i[10]=p*C+m*D+h*j+g*F,i[14]=p*w+m*O+h*M+g*ee,i[3]=_*x+v*T+y*k+b*N,i[7]=_*S+v*E+y*A+b*P,i[11]=_*C+v*D+y*j+b*F,i[15]=_*w+v*O+y*M+b*ee,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],d=e[10],f=e[14],p=e[3],m=e[7],h=e[11],g=e[15],_=s*f-c*d,v=o*f-c*u,y=o*d-s*u,b=a*f-c*l,x=a*d-s*l,S=a*u-o*l;return t*(m*_-h*v+g*y)-n*(p*_-h*b+g*x)+r*(p*v-m*b+g*S)-i*(p*y-m*x+h*S)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[1],a=e[5],o=e[9],s=e[2],c=e[6],l=e[10];return t*(a*l-o*c)-n*(i*l-o*s)+r*(i*c-a*s)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=e[9],d=e[10],f=e[11],p=e[12],m=e[13],h=e[14],g=e[15],_=t*o-n*a,v=t*s-r*a,y=t*c-i*a,b=n*s-r*o,x=n*c-i*o,S=r*c-i*s,C=l*m-u*p,w=l*h-d*p,T=l*g-f*p,E=u*h-d*m,D=u*g-f*m,O=d*g-f*h,k=_*O-v*D+y*E+b*T-x*w+S*C;if(k===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let A=1/k;return e[0]=(o*O-s*D+c*E)*A,e[1]=(r*D-n*O-i*E)*A,e[2]=(m*S-h*x+g*b)*A,e[3]=(d*x-u*S-f*b)*A,e[4]=(s*T-a*O-c*w)*A,e[5]=(t*O-r*T+i*w)*A,e[6]=(h*y-p*S-g*v)*A,e[7]=(l*S-d*y+f*v)*A,e[8]=(a*D-o*T+c*C)*A,e[9]=(n*T-t*D-i*C)*A,e[10]=(p*x-m*y+g*_)*A,e[11]=(u*y-l*x-f*_)*A,e[12]=(o*w-a*E-s*C)*A,e[13]=(t*E-n*w+r*C)*A,e[14]=(m*v-p*b-h*_)*A,e[15]=(l*b-u*v+d*_)*A,this}scale(e){let t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,u=o+o,d=i*c,f=i*l,p=i*u,m=a*l,h=a*u,g=o*u,_=s*c,v=s*l,y=s*u,b=n.x,x=n.y,S=n.z;return r[0]=(1-(m+g))*b,r[1]=(f+y)*b,r[2]=(p-v)*b,r[3]=0,r[4]=(f-y)*x,r[5]=(1-(d+g))*x,r[6]=(h+_)*x,r[7]=0,r[8]=(p+v)*S,r[9]=(h-_)*S,r[10]=(1-(d+m))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];let i=this.determinantAffine();if(i===0)return n.set(1,1,1),t.identity(),this;let a=qi.set(r[0],r[1],r[2]).length(),o=qi.set(r[4],r[5],r[6]).length(),s=qi.set(r[8],r[9],r[10]).length();i<0&&(a=-a),Ji.copy(this);let c=1/a,l=1/o,u=1/s;return Ji.elements[0]*=c,Ji.elements[1]*=c,Ji.elements[2]*=c,Ji.elements[4]*=l,Ji.elements[5]*=l,Ji.elements[6]*=l,Ji.elements[8]*=u,Ji.elements[9]*=u,Ji.elements[10]*=u,t.setFromRotationMatrix(Ji),n.x=a,n.y=o,n.z=s,this}makePerspective(e,t,n,r,i,a,o=si,s=!1){let c=this.elements,l=2*i/(t-e),u=2*i/(n-r),d=(t+e)/(t-e),f=(n+r)/(n-r),p,m;if(s)p=i/(a-i),m=a*i/(a-i);else if(o===2e3)p=-(a+i)/(a-i),m=-2*a*i/(a-i);else if(o===2001)p=-a/(a-i),m=-a*i/(a-i);else throw Error(`THREE.Matrix4.makePerspective(): Invalid coordinate system: `+o);return c[0]=l,c[4]=0,c[8]=d,c[12]=0,c[1]=0,c[5]=u,c[9]=f,c[13]=0,c[2]=0,c[6]=0,c[10]=p,c[14]=m,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,i,a,o=si,s=!1){let c=this.elements,l=2/(t-e),u=2/(n-r),d=-(t+e)/(t-e),f=-(n+r)/(n-r),p,m;if(s)p=1/(a-i),m=a/(a-i);else if(o===2e3)p=-2/(a-i),m=-(a+i)/(a-i);else if(o===2001)p=-1/(a-i),m=-i/(a-i);else throw Error(`THREE.Matrix4.makeOrthographic(): Invalid coordinate system: `+o);return c[0]=l,c[4]=0,c[8]=0,c[12]=d,c[1]=0,c[5]=u,c[9]=0,c[13]=f,c[2]=0,c[6]=0,c[10]=p,c[14]=m,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}},qi=/*@__PURE__*/ new B,Ji=/*@__PURE__*/ new V,Yi=/*@__PURE__*/ new B(0,0,0),Xi=/*@__PURE__*/ new B(1,1,1),Zi=/*@__PURE__*/ new B,Qi=/*@__PURE__*/ new B,$i=/*@__PURE__*/ new B,ea=/*@__PURE__*/ new V,ta=/*@__PURE__*/ new wi,na=class e{constructor(t=0,n=0,r=0,i=e.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=n,this._z=r,this._order=i}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 order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,i=r[0],a=r[4],o=r[8],s=r[1],c=r[5],l=r[9],u=r[2],d=r[6],f=r[10];switch(t){case`XYZ`:this._y=Math.asin(E(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,f),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(d,c),this._z=0);break;case`YXZ`:this._x=Math.asin(-E(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(s,c)):(this._y=Math.atan2(-u,i),this._z=0);break;case`ZXY`:this._x=Math.asin(E(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(s,i));break;case`ZYX`:this._y=Math.asin(-E(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,c));break;case`YZX`:this._z=Math.asin(E(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,c),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(o,f));break;case`XZY`:this._z=Math.asin(-E(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-l,f),this._y=0);break;default:x(`Euler: .setFromRotationMatrix() encountered an unknown order: `+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return ea.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ea,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return ta.setFromEuler(this),this.setFromQuaternion(ta,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[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._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}},na.DEFAULT_ORDER=`XYZ`,ra=class{constructor(){this.mask=1}set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return!!(this.mask&1<<e)}},ia=0,aa=/*@__PURE__*/ new B,oa=/*@__PURE__*/ new wi,sa=/*@__PURE__*/ new V,ca=/*@__PURE__*/ new B,la=/*@__PURE__*/ new B,ua=/*@__PURE__*/ new B,da=/*@__PURE__*/ new wi,fa=/*@__PURE__*/ new B(1,0,0),pa=/*@__PURE__*/ new B(0,1,0),ma=/*@__PURE__*/ new B(0,0,1),ha={type:`added`},ga={type:`removed`},_a={type:`childadded`,child:null},va={type:`childremoved`,child:null},ya=class e extends vi{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:ia++}),this.uuid=T(),this.name=``,this.type=`Object3D`,this.parent=null,this.children=[],this.up=e.DEFAULT_UP.clone();let t=new B,n=new na,r=new wi,i=new B(1,1,1);function a(){r.setFromEuler(n,!1)}function o(){n.setFromQuaternion(r,void 0,!1)}n._onChange(a),r._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new V},normalMatrix:{value:new Di}}),this.matrix=new V,this.matrixWorld=new V,this.matrixAutoUpdate=e.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=e.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new ra,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.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale),this.pivot!==null&&this.position.copy(this.pivot).applyMatrix4(this.matrix).sub(this.pivot)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return oa.setFromAxisAngle(e,t),this.quaternion.multiply(oa),this}rotateOnWorldAxis(e,t){return oa.setFromAxisAngle(e,t),this.quaternion.premultiply(oa),this}rotateX(e){return this.rotateOnAxis(fa,e)}rotateY(e){return this.rotateOnAxis(pa,e)}rotateZ(e){return this.rotateOnAxis(ma,e)}translateOnAxis(e,t){return aa.copy(e).applyQuaternion(this.quaternion),this.position.add(aa.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(fa,e)}translateY(e){return this.translateOnAxis(pa,e)}translateZ(e){return this.translateOnAxis(ma,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(sa.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?ca.copy(e):ca.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),la.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?sa.lookAt(la,ca,this.up):sa.lookAt(ca,la,this.up),this.quaternion.setFromRotationMatrix(sa),r&&(sa.extractRotation(r.matrixWorld),oa.setFromRotationMatrix(sa),this.quaternion.premultiply(oa.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?(S(`Object3D.add: object can't be added as a child of itself.`,e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(ha),_a.child=e,this.dispatchEvent(_a),_a.child=null):S(`Object3D.add: object not an instance of THREE.Object3D.`,e),this)}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(ga),va.child=e,this.dispatchEvent(va),va.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),sa.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),sa.multiply(e.parent.matrixWorld)),e.applyMatrix4(sa),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(ha),_a.child=e,this.dispatchEvent(_a),_a.child=null,this}getObjectById(e){return this.getObjectByProperty(`id`,e)}getObjectByName(e){return this.getObjectByProperty(`name`,e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){let r=this.children[n].getObjectByProperty(e,t);if(r!==void 0)return r}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let r=this.children;for(let i=0,a=r.length;i<a;i++)r[i].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(la,e,ua),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(la,da,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}intersectsFrustum(){return!0}traverse(e){e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,n=e.y,r=e.z,i=this.matrix.elements;i[12]+=t-i[0]*t-i[4]*n-i[8]*r,i[13]+=n-i[1]*t-i[5]*n-i[9]*r,i[14]+=r-i[2]*t-i[6]*n-i[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){let r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),t===!0){let e=this.children;for(let t=0,r=e.length;t<r;t++)e[t].updateWorldMatrix(!1,!0,n)}}toJSON(e){let t=e===void 0||typeof e==`string`,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:`Object`,generator:`Object3D.toJSON`});let r={};r.uuid=this.uuid,r.type=this.type,r.name=this.name,r.castShadow=this.castShadow,r.receiveShadow=this.receiveShadow,r.visible=this.visible,r.frustumCulled=this.frustumCulled,r.renderOrder=this.renderOrder,r.static=this.static,r.matrixAutoUpdate=this.matrixAutoUpdate,Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type=`InstancedMesh`,r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type=`BatchedMesh`,r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(e=>({...e})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function i(t,n){return t[n.uuid]===void 0&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);let t=this.geometry.parameters;if(t!==void 0&&t.shapes!==void 0){let n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t<r;t++){let r=n[t];i(e.shapes,r)}else i(e.shapes,n)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(i(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0){if(Array.isArray(this.material)){let t=[];for(let n=0,r=this.material.length;n<r;n++)t.push(i(e.materials,this.material[n]));r.material=t}else r.material=i(e.materials,this.material)}if(this.children.length>0){r.children=[];for(let t=0;t<this.children.length;t++)r.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let t=0;t<this.animations.length;t++){let n=this.animations[t];r.animations.push(i(e.animations,n))}}if(t){let t=a(e.geometries),r=a(e.materials),i=a(e.textures),o=a(e.images),s=a(e.shapes),c=a(e.skeletons),l=a(e.animations),u=a(e.nodes);t.length>0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),s.length>0&&(n.shapes=s),c.length>0&&(n.skeletons=c),l.length>0&&(n.animations=l),u.length>0&&(n.nodes=u)}return n.object=r,n;function a(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot===null?null:e.pivot.clone(),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let t=0;t<e.children.length;t++){let n=e.children[t];this.add(n.clone())}return this}dispose(){this.dispatchEvent({type:`dispose`})}},ya.DEFAULT_UP=/*@__PURE__*/ new B(0,1,0),ya.DEFAULT_MATRIX_AUTO_UPDATE=!0,ya.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0,ba=class extends ya{constructor(){super(),this.isGroup=!0,this.type=`Group`}},xa={type:`move`},Sa=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ba,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new ba,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new B,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new B),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ba,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new B,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new B,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:`connected`,data:e}),this}disconnect(e){return this.dispatchEvent({type:`disconnected`,data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,i=null,a=null,o=this._targetRay,s=this._grip,c=this._hand;if(e&&t.session.visibilityState!==`visible-blurred`){if(c&&e.hand){a=!0;for(let r of e.hand.values()){let e=t.getJointPose(r,n),i=this._getHandJoint(c,r);e!==null&&(i.matrix.fromArray(e.transform.matrix),i.matrix.decompose(i.position,i.quaternion,i.scale),i.matrixWorldNeedsUpdate=!0,i.jointRadius=e.radius),i.visible=e!==null}let r=c.joints[`index-finger-tip`],i=c.joints[`thumb-tip`],o=r.position.distanceTo(i.position);c.inputState.pinching&&o>.025?(c.inputState.pinching=!1,this.dispatchEvent({type:`pinchend`,handedness:e.handedness,target:this})):!c.inputState.pinching&&o<=.015&&(c.inputState.pinching=!0,this.dispatchEvent({type:`pinchstart`,handedness:e.handedness,target:this}))}else s!==null&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),i!==null&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.quaternion,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,s.eventsEnabled&&s.dispatchEvent({type:`gripUpdated`,data:e,target:this})));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&i!==null&&(r=i),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.quaternion,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(xa)))}return o!==null&&(o.visible=r!==null),s!==null&&(s.visible=i!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new ba;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},Ca={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},wa={h:0,s:0,l:0},Ta={h:0,s:0,l:0},H=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let t=e;t&&t.isColor?this.copy(t):typeof t==`number`?this.setHex(t):typeof t==`string`&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Br){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ji.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=ji.workingColorSpace){return this.r=e,this.g=t,this.b=n,ji.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=ji.workingColorSpace){if(e=D(e,1),t=E(t,0,1),n=E(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=he(i,r,e+1/3),this.g=he(i,r,e),this.b=he(i,r,e-1/3)}return ji.colorSpaceToWorking(this,r),this}setStyle(e,t=Br){function n(t){t!==void 0&&parseFloat(t)<1&&x(`Color: Alpha component of `+e+` will be ignored.`)}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let i,a=r[1],o=r[2];switch(a){case`rgb`:case`rgba`:if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+(?:\.\d+)?|\.\d+)\s*)?$/.exec(o))return n(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+(?:\.\d+)?|\.\d+)\%\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*(?:,\s*(\d+(?:\.\d+)?|\.\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(100,parseFloat(i[1]))/100,Math.min(100,parseFloat(i[2]))/100,Math.min(100,parseFloat(i[3]))/100,t);break;case`hsl`:case`hsla`:if(i=/^\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*(?:,\s*(\d+(?:\.\d+)?|\.\d+)\s*)?$/.exec(o))return n(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:x(`Color: Unknown color model `+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=r[1],i=n.length;if(i===3)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(i===6)return this.setHex(parseInt(n,16),t);x(`Color: Invalid hex color `+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Br){let n=Ca[e.toLowerCase()];return n===void 0?x(`Color: Unknown color `+e):this.setHex(n,t),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=fe(e.r),this.g=fe(e.g),this.b=fe(e.b),this}copyLinearToSRGB(e){return this.r=pe(e.r),this.g=pe(e.g),this.b=pe(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Br){return ji.workingToColorSpace(Ea.copy(this),e),Math.round(E(Ea.r*255,0,255))*65536+Math.round(E(Ea.g*255,0,255))*256+Math.round(E(Ea.b*255,0,255))}getHexString(e=Br){return(`000000`+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ji.workingColorSpace){ji.workingToColorSpace(Ea.copy(this),t);let n=Ea.r,r=Ea.g,i=Ea.b,a=Math.max(n,r,i),o=Math.min(n,r,i),s,c,l=(o+a)/2;if(o===a)s=0,c=0;else{let e=a-o;switch(c=l<=.5?e/(a+o):e/(2-a-o),a){case n:s=(r-i)/e+(r<i?6:0);break;case r:s=(i-n)/e+2;break;case i:s=(n-r)/e+4}s/=6}return e.h=s,e.s=c,e.l=l,e}getRGB(e,t=ji.workingColorSpace){return ji.workingToColorSpace(Ea.copy(this),t),e.r=Ea.r,e.g=Ea.g,e.b=Ea.b,e}getStyle(e=Br){ji.workingToColorSpace(Ea.copy(this),e);let t=Ea.r,n=Ea.g,r=Ea.b;return e===`srgb`?`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`:`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`}offsetHSL(e,t,n){return this.getHSL(wa),this.setHSL(wa.h+e,wa.s+t,wa.l+n)}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,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(wa),e.getHSL(Ta);let n=A(wa.h,Ta.h,t),r=A(wa.s,Ta.s,t),i=A(wa.l,Ta.l,t);return this.setHSL(n,r,i),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,r=this.b,i=e.elements;return this.r=i[0]*t+i[3]*n+i[6]*r,this.g=i[1]*t+i[4]*n+i[7]*r,this.b=i[2]*t+i[5]*n+i[8]*r,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}},Ea=/*@__PURE__*/ new H,H.NAMES=Ca,Da=class e{constructor(e,t=25e-5){this.isFogExp2=!0,this.name=``,this.color=new H(e),this.density=t}clone(){return new e(this.color,this.density)}toJSON(){return{type:`FogExp2`,name:this.name,color:this.color.getHex(),density:this.density}}},Oa=class e{constructor(e,t=1,n=1e3){this.isFog=!0,this.name=``,this.color=new H(e),this.near=t,this.far=n}clone(){return new e(this.color,this.near,this.far)}toJSON(){return{type:`Fog`,name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}},ka=class extends ya{constructor(){super(),this.isScene=!0,this.type=`Scene`,this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new na,this.environmentIntensity=1,this.environmentRotation=new na,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}copy(e,t){return super.copy(e,t),this.background=e.background===null?null:e.background.clone(),this.environment=e.environment===null?null:e.environment.clone(),this.fog=e.fog===null?null:e.fog.clone(),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),this.overrideMaterial=e.overrideMaterial===null?null:e.overrideMaterial.clone(),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),t.object.backgroundBlurriness=this.backgroundBlurriness,t.object.backgroundIntensity=this.backgroundIntensity,t.object.backgroundRotation=this.backgroundRotation.toArray(),t.object.environmentIntensity=this.environmentIntensity,t.object.environmentRotation=this.environmentRotation.toArray(),t}},Aa=/*@__PURE__*/ new B,ja=/*@__PURE__*/ new B,Ma=/*@__PURE__*/ new B,Na=/*@__PURE__*/ new B,Pa=/*@__PURE__*/ new B,Fa=/*@__PURE__*/ new B,Ia=/*@__PURE__*/ new B,La=/*@__PURE__*/ new B,Ra=/*@__PURE__*/ new B,za=/*@__PURE__*/ new B,Ba=/*@__PURE__*/ new Bi,Va=/*@__PURE__*/ new Bi,Ha=/*@__PURE__*/ new Bi,Ua=class e{constructor(e=new B,t=new B,n=new B){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Aa.subVectors(e,t),r.cross(Aa);let i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){Aa.subVectors(r,t),ja.subVectors(n,t),Ma.subVectors(e,t);let a=Aa.dot(Aa),o=Aa.dot(ja),s=Aa.dot(Ma),c=ja.dot(ja),l=ja.dot(Ma),u=a*c-o*o;if(u===0)return i.set(0,0,0),null;let d=1/u,f=(c*s-o*l)*d,p=(a*l-o*s)*d;return i.set(1-f-p,p,f)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Na)!==null&&Na.x>=0&&Na.y>=0&&Na.x+Na.y<=1}static getInterpolation(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,Na)===null?(s.x=0,s.y=0,`z`in s&&(s.z=0),`w`in s&&(s.w=0),null):(s.setScalar(0),s.addScaledVector(i,Na.x),s.addScaledVector(a,Na.y),s.addScaledVector(o,Na.z),s)}static getInterpolatedAttribute(e,t,n,r,i,a){return Ba.setScalar(0),Va.setScalar(0),Ha.setScalar(0),Ba.fromBufferAttribute(e,t),Va.fromBufferAttribute(e,n),Ha.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(Ba,i.x),a.addScaledVector(Va,i.y),a.addScaledVector(Ha,i.z),a}static isFrontFacing(e,t,n,r){return Aa.subVectors(n,t),ja.subVectors(e,t),Aa.cross(ja).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Aa.subVectors(this.c,this.b),ja.subVectors(this.a,this.b),Aa.cross(ja).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return e.getNormal(this.a,this.b,this.c,t)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}getInterpolation(t,n,r,i,a){return e.getInterpolation(t,this.a,this.b,this.c,n,r,i,a)}containsPoint(t){return e.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return e.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,i=this.c,a,o;Pa.subVectors(r,n),Fa.subVectors(i,n),La.subVectors(e,n);let s=Pa.dot(La),c=Fa.dot(La);if(s<=0&&c<=0)return t.copy(n);Ra.subVectors(e,r);let l=Pa.dot(Ra),u=Fa.dot(Ra);if(l>=0&&u<=l)return t.copy(r);let d=s*u-l*c;if(d<=0&&s>=0&&l<=0&&s-l>0)return a=s/(s-l),t.copy(n).addScaledVector(Pa,a);za.subVectors(e,i);let f=Pa.dot(za),p=Fa.dot(za);if(p>=0&&f<=p)return t.copy(i);let m=f*c-s*p;if(m<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(Fa,o);let h=l*p-f*u;if(h<=0&&u-l>=0&&f-p>=0)return Ia.subVectors(i,r),o=(u-l)/(u-l+(f-p)),t.copy(r).addScaledVector(Ia,o);let g=1/(h+m+d);return a=m*g,o=d*g,t.copy(n).addScaledVector(Pa,a).addScaledVector(Fa,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},Wa=class{constructor(e=new B(1/0,1/0,1/0),t=new B(-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,n=e.length;t<n;t+=3)this.expandByPoint(Ka.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Ka.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=Ka.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),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 n=e.geometry;if(n!==void 0){let r=n.getAttribute(`position`);if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0&&e.isBatchedMesh!==!0)for(let t=0,n=r.count;t<n;t++)e.isMesh===!0?e.getVertexPosition(t,Ka):Ka.fromBufferAttribute(r,t),Ka.applyMatrix4(e.matrixWorld),this.expandByPoint(Ka);else e.boundingBox===void 0?(n.boundingBox===null&&n.computeBoundingBox(),qa.copy(n.boundingBox)):(e.boundingBox===null&&e.computeBoundingBox(),qa.copy(e.boundingBox)),qa.applyMatrix4(e.matrixWorld),this.union(qa)}let r=e.children;for(let e=0,n=r.length;e<n;e++)this.expandByObject(r[e],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,Ka),Ka.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(eo),to.subVectors(this.max,eo),Ja.subVectors(e.a,eo),Ya.subVectors(e.b,eo),Xa.subVectors(e.c,eo),Za.subVectors(Ya,Ja),Qa.subVectors(Xa,Ya),$a.subVectors(Ja,Xa);let t=[0,-Za.z,Za.y,0,-Qa.z,Qa.y,0,-$a.z,$a.y,Za.z,0,-Za.x,Qa.z,0,-Qa.x,$a.z,0,-$a.x,-Za.y,Za.x,0,-Qa.y,Qa.x,0,-$a.y,$a.x,0];return!ge(t,Ja,Ya,Xa,to)||(t=[1,0,0,0,1,0,0,0,1],!ge(t,Ja,Ya,Xa,to))?!1:(no.crossVectors(Za,Qa),t=[no.x,no.y,no.z],ge(t,Ja,Ya,Xa,to))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ka).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Ka).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()||(Ga[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ga[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ga[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ga[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ga[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ga[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ga[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ga[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ga)),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}},Ga=[/*@__PURE__*/ new B,/*@__PURE__*/ new B,/*@__PURE__*/ new B,/*@__PURE__*/ new B,/*@__PURE__*/ new B,/*@__PURE__*/ new B,/*@__PURE__*/ new B,/*@__PURE__*/ new B],Ka=/*@__PURE__*/ new B,qa=/*@__PURE__*/ new Wa,Ja=/*@__PURE__*/ new B,Ya=/*@__PURE__*/ new B,Xa=/*@__PURE__*/ new B,Za=/*@__PURE__*/ new B,Qa=/*@__PURE__*/ new B,$a=/*@__PURE__*/ new B,eo=/*@__PURE__*/ new B,to=/*@__PURE__*/ new B,no=/*@__PURE__*/ new B,ro=/*@__PURE__*/ new B,io=/*@__PURE__*/ _e(),U=class{static toHalfFloat(e){return ve(e)}static fromHalfFloat(e){return ye(e)}},ao=/*@__PURE__*/ new B,oo=/*@__PURE__*/ new z,so=0,co=class extends vi{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw TypeError(`THREE.BufferAttribute: array should be a Typed Array.`);this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:so++}),this.name=``,this.array=e,this.itemSize=t,this.count=e===void 0?0:e.length/t,this.normalized=n,this.usage=Zr,this.updateRanges=[],this.gpuType=wn,this.version=0,this._normalizationScale=e===void 0?void 0:ce(e)}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._normalizationScale=e._normalizationScale,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)oo.fromBufferAttribute(this,t),oo.applyMatrix3(e),this.setXY(t,oo.x,oo.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)ao.fromBufferAttribute(this,t),ao.applyMatrix3(e),this.setXYZ(t,ao.x,ao.y,ao.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)ao.fromBufferAttribute(this,t),ao.applyMatrix4(e),this.setXYZ(t,ao.x,ao.y,ao.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ao.fromBufferAttribute(this,t),ao.applyNormalMatrix(e),this.setXYZ(t,ao.x,ao.y,ao.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ao.fromBufferAttribute(this,t),ao.transformDirection(e),this.setXYZ(t,ao.x,ao.y,ao.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=this._denormalize(n)),n}setComponent(e,t,n){return this.normalized&&(n=this._normalize(n)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=this._denormalize(t)),t}setX(e,t){return this.normalized&&(t=this._normalize(t)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=this._denormalize(t)),t}setY(e,t){return this.normalized&&(t=this._normalize(t)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=this._denormalize(t)),t}setZ(e,t){return this.normalized&&(t=this._normalize(t)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=this._denormalize(t)),t}setW(e,t){return this.normalized&&(t=this._normalize(t)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=this._normalize(t),n=this._normalize(n)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=this._normalize(t),n=this._normalize(n),r=this._normalize(r)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=this._normalize(t),n=this._normalize(n),r=this._normalize(r),i=this._normalize(i)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,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 e.name=this.name,e.usage=this.usage,e.gpuType=this.gpuType,e}dispose(){this.dispatchEvent({type:`dispose`})}_denormalize(e){let t=this._normalizationScale;return t===void 0?le(e,this.array):Math.max(e/t,-1)}_normalize(e){let t=this._normalizationScale;return t===void 0?ue(e,this.array):Math.round(e*t)}},lo=class extends co{constructor(e,t,n){super(new Int8Array(e),t,n)}},uo=class extends co{constructor(e,t,n){super(new Uint8Array(e),t,n)}},fo=class extends co{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}},po=class extends co{constructor(e,t,n){super(new Int16Array(e),t,n)}},mo=class extends co{constructor(e,t,n){super(new Uint16Array(e),t,n)}},ho=class extends co{constructor(e,t,n){super(new Int32Array(e),t,n)}},go=class extends co{constructor(e,t,n){super(new Uint32Array(e),t,n)}},_o=class extends co{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=ye(this.array[e*this.itemSize]);return this.normalized&&(t=le(t,this.array)),t}setX(e,t){return this.normalized&&(t=ue(t,this.array)),this.array[e*this.itemSize]=ve(t),this}getY(e){let t=ye(this.array[e*this.itemSize+1]);return this.normalized&&(t=le(t,this.array)),t}setY(e,t){return this.normalized&&(t=ue(t,this.array)),this.array[e*this.itemSize+1]=ve(t),this}getZ(e){let t=ye(this.array[e*this.itemSize+2]);return this.normalized&&(t=le(t,this.array)),t}setZ(e,t){return this.normalized&&(t=ue(t,this.array)),this.array[e*this.itemSize+2]=ve(t),this}getW(e){let t=ye(this.array[e*this.itemSize+3]);return this.normalized&&(t=le(t,this.array)),t}setW(e,t){return this.normalized&&(t=ue(t,this.array)),this.array[e*this.itemSize+3]=ve(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=ue(t,this.array),n=ue(n,this.array)),this.array[e+0]=ve(t),this.array[e+1]=ve(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=ue(t,this.array),n=ue(n,this.array),r=ue(r,this.array)),this.array[e+0]=ve(t),this.array[e+1]=ve(n),this.array[e+2]=ve(r),this}setXYZW(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=ue(t,this.array),n=ue(n,this.array),r=ue(r,this.array),i=ue(i,this.array)),this.array[e+0]=ve(t),this.array[e+1]=ve(n),this.array[e+2]=ve(r),this.array[e+3]=ve(i),this}},W=class extends co{constructor(e,t,n){super(new Float32Array(e),t,n)}},vo=/*@__PURE__*/ new Wa,yo=/*@__PURE__*/ new B,bo=/*@__PURE__*/ new B,xo=class{constructor(e=new B,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 n=this.center;t===void 0?vo.setFromPoints(e).getCenter(n):n.copy(t);let r=0;for(let t=0,i=e.length;t<i;t++)r=Math.max(r,n.distanceToSquared(e[t]));return this.radius=Math.sqrt(r),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 n=this.center.distanceToSquared(e);return t.copy(e),n>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*=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;yo.subVectors(e,this.center);let t=yo.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(yo,n/e),this.radius+=n}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):(bo.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(yo.copy(e.center).add(bo)),this.expandByPoint(yo.copy(e.center).sub(bo))),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}},So=0,Co=/*@__PURE__*/ new V,wo=/*@__PURE__*/ new ya,To=/*@__PURE__*/ new B,Eo=/*@__PURE__*/ new Wa,Do=/*@__PURE__*/ new Wa,Oo=/*@__PURE__*/ new B,G=class e extends vi{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:So++}),this.uuid=T(),this.name=``,this.type=`BufferGeometry`,this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return this.index=Array.isArray(e)?new(f(e)?go:mo)(e,1):e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let t=new Di().getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return Co.makeRotationFromQuaternion(e),this.applyMatrix4(Co),this}rotateX(e){return Co.makeRotationX(e),this.applyMatrix4(Co),this}rotateY(e){return Co.makeRotationY(e),this.applyMatrix4(Co),this}rotateZ(e){return Co.makeRotationZ(e),this.applyMatrix4(Co),this}translate(e,t,n){return Co.makeTranslation(e,t,n),this.applyMatrix4(Co),this}scale(e,t,n){return Co.makeScale(e,t,n),this.applyMatrix4(Co),this}lookAt(e){return wo.lookAt(e),wo.updateMatrix(),this.applyMatrix4(wo.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(To).negate(),this.translate(To.x,To.y,To.z),this}setFromPoints(e){let t=this.getAttribute(`position`);if(t===void 0){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];t.push(r.x,r.y,r.z||0)}this.setAttribute(`position`,new W(t,3))}else{let n=Math.min(e.length,t.count);for(let r=0;r<n;r++){let n=e[r];t.setXYZ(r,n.x,n.y,n.z||0)}e.length>t.count&&x(`BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.`),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Wa);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)S(`BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.`,this),this.boundingBox.set(new B(-1/0,-1/0,-1/0),new B(1/0,1/0,1/0));else{if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];Eo.setFromBufferAttribute(n),this.morphTargetsRelative?(Oo.addVectors(this.boundingBox.min,Eo.min),this.boundingBox.expandByPoint(Oo),Oo.addVectors(this.boundingBox.max,Eo.max),this.boundingBox.expandByPoint(Oo)):(this.boundingBox.expandByPoint(Eo.min),this.boundingBox.expandByPoint(Eo.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&S(`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 xo);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)S(`BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.`,this),this.boundingSphere.set(new B,1/0);else if(e){let n=this.boundingSphere.center;if(Eo.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];Do.setFromBufferAttribute(n),this.morphTargetsRelative?(Oo.addVectors(Eo.min,Do.min),Eo.expandByPoint(Oo),Oo.addVectors(Eo.max,Do.max),Eo.expandByPoint(Oo)):(Eo.expandByPoint(Do.min),Eo.expandByPoint(Do.max))}Eo.getCenter(n);let r=0;for(let t=0,i=e.count;t<i;t++)Oo.fromBufferAttribute(e,t),r=Math.max(r,n.distanceToSquared(Oo));if(t)for(let i=0,a=t.length;i<a;i++){let a=t[i],o=this.morphTargetsRelative;for(let t=0,i=a.count;t<i;t++)Oo.fromBufferAttribute(a,t),o&&(To.fromBufferAttribute(e,t),Oo.add(To)),r=Math.max(r,n.distanceToSquared(Oo))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&S(`BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.`,this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){S(`BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)`);return}let n=t.position,r=t.normal,i=t.uv,a=this.getAttribute(`tangent`);(a===void 0||a.count!==n.count)&&(a=new co(new Float32Array(4*n.count),4),this.setAttribute(`tangent`,a));let o=[],s=[],c=new Uint8Array(n.count);for(let e=0;e<n.count;e++)o[e]=new B,s[e]=new B;let l=new B,u=new B,d=new B,f=new z,p=new z,m=new z,h=new B,g=new B;function _(e,t,r){c[e]=c[t]=c[r]=1,l.fromBufferAttribute(n,e),u.fromBufferAttribute(n,t),d.fromBufferAttribute(n,r),f.fromBufferAttribute(i,e),p.fromBufferAttribute(i,t),m.fromBufferAttribute(i,r),u.sub(l),d.sub(l),p.sub(f),m.sub(f);let a=1/(p.x*m.y-m.x*p.y);isFinite(a)&&(h.copy(u).multiplyScalar(m.y).addScaledVector(d,-p.y).multiplyScalar(a),g.copy(d).multiplyScalar(p.x).addScaledVector(u,-m.x).multiplyScalar(a),o[e].add(h),o[t].add(h),o[r].add(h),s[e].add(g),s[t].add(g),s[r].add(g))}let v=this.groups;v.length===0&&(v=[{start:0,count:e.count}]);for(let t=0,n=v.length;t<n;++t){let n=v[t],r=n.start,i=n.count;for(let t=r,n=r+i;t<n;t+=3)_(e.getX(t+0),e.getX(t+1),e.getX(t+2))}let y=new B,b=new B,x=new B,C=new B;function w(e){x.fromBufferAttribute(r,e),C.copy(x);let t=o[e];y.copy(t),y.sub(x.multiplyScalar(x.dot(t))).normalize(),b.crossVectors(C,t);let n=b.dot(s[e])<0?-1:1;a.setXYZW(e,y.x,y.y,y.z,n)}for(let e=0,t=n.count;e<t;++e)c[e]&&w(e);this._transformed=!0}computeVertexNormals(){let e=this.index,t=this.getAttribute(`position`);if(t!==void 0){let n=this.getAttribute(`normal`);if(n===void 0||n.count!==t.count)n=new co(new Float32Array(t.count*3),3),this.setAttribute(`normal`,n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);let r=new B,i=new B,a=new B,o=new B,s=new B,c=new B,l=new B,u=new B;if(e)for(let d=0,f=e.count;d<f;d+=3){let f=e.getX(d+0),p=e.getX(d+1),m=e.getX(d+2);r.fromBufferAttribute(t,f),i.fromBufferAttribute(t,p),a.fromBufferAttribute(t,m),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),o.fromBufferAttribute(n,f),s.fromBufferAttribute(n,p),c.fromBufferAttribute(n,m),o.add(l),s.add(l),c.add(l),n.setXYZ(f,o.x,o.y,o.z),n.setXYZ(p,s.x,s.y,s.z),n.setXYZ(m,c.x,c.y,c.z)}else for(let e=0,o=t.count;e<o;e+=3)r.fromBufferAttribute(t,e+0),i.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),n.setXYZ(e+0,l.x,l.y,l.z),n.setXYZ(e+1,l.x,l.y,l.z),n.setXYZ(e+2,l.x,l.y,l.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Oo.fromBufferAttribute(e,t),Oo.normalize(),e.setXYZ(t,Oo.x,Oo.y,Oo.z)}toNonIndexed(){function t(e,t){let n=e.array,r=e.itemSize,i=e.normalized,a=new n.constructor(t.length*r),o=0,s=0;for(let i=0,c=t.length;i<c;i++){o=e.isInterleavedBufferAttribute?t[i]*e.data.stride+e.offset:t[i]*r;for(let e=0;e<r;e++)a[s++]=n[o++]}return new co(a,r,i)}if(this.index===null)return x(`BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.`),this;let n=new e,r=this.index.array,i=this.attributes;for(let e in i){let a=i[e],o=t(a,r);n.setAttribute(e,o)}let a=this.morphAttributes;for(let e in a){let i=[],o=a[e];for(let e=0,n=o.length;e<n;e++){let n=o[e],a=t(n,r);i.push(a)}n.morphAttributes[e]=i}n.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let e=0,t=o.length;e<t;e++){let t=o[e];n.addGroup(t.start,t.count,t.materialIndex)}return n}toJSON(){let e={metadata:{version:4.7,type:`BufferGeometry`,generator:`BufferGeometry.toJSON`}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?`BufferGeometry`:this.type,e.name=this.name,Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let t=this.parameters;for(let n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let r=n[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},i=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,r=n.length;t<r;t++){let r=n[t];a.push(r.toJSON(e.data))}a.length>0&&(r[t]=a,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let e in r){let n=r[e];this.setAttribute(e,n.clone(t))}let i=e.morphAttributes;for(let e in i){let n=[],r=i[e];for(let e=0,i=r.length;e<i;e++)n.push(r[e].clone(t));this.morphAttributes[e]=n}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let e=0,t=a.length;e<t;e++){let t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}let o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());let s=e.boundingSphere;return s!==null&&(this.boundingSphere=s.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:`dispose`})}},ko=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e===void 0?0:e.length/t,this.usage=Zr,this.updateRanges=[],this.version=0,this.uuid=T()}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.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,i=this.stride;r<i;r++)this.array[e+r]=t.array[n+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={});let t=be(this.array);e.arrayBuffers[t]===void 0&&(e.arrayBuffers[t]=this.array.slice(0).buffer);let n=new this.array.constructor(e.arrayBuffers[t]),r=new this.constructor(n,this.stride);return r.setUsage(this.usage),r}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){e.arrayBuffers===void 0&&(e.arrayBuffers={});let t=be(this.array);e.arrayBuffers[t]===void 0&&(e.arrayBuffers[t]=Array.from(new Uint32Array(this.array.slice(0).buffer)));let n={uuid:this.uuid,buffer:t,type:this.array.constructor.name,stride:this.stride};return n.usage=this.usage,n}},Ao=/*@__PURE__*/ new B,jo=class e{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name=``,this.data=e,this.itemSize=t,this.offset=n,this.normalized=r,this._normalizationScale=e===void 0?void 0:ce(e.array)}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Ao.fromBufferAttribute(this,t),Ao.applyMatrix4(e),this.setXYZ(t,Ao.x,Ao.y,Ao.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Ao.fromBufferAttribute(this,t),Ao.applyNormalMatrix(e),this.setXYZ(t,Ao.x,Ao.y,Ao.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Ao.fromBufferAttribute(this,t),Ao.transformDirection(e),this.setXYZ(t,Ao.x,Ao.y,Ao.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=this._denormalize(n)),n}setComponent(e,t,n){return this.normalized&&(n=this._normalize(n)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=this._normalize(t)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=this._normalize(t)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=this._normalize(t)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=this._normalize(t)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=this._denormalize(t)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=this._denormalize(t)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=this._denormalize(t)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=this._denormalize(t)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=this._normalize(t),n=this._normalize(n)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=this._normalize(t),n=this._normalize(n),r=this._normalize(r)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=this._normalize(t),n=this._normalize(n),r=this._normalize(r),i=this._normalize(i)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=i,this}clone(t){if(t===void 0){y(`InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.`);let e=[];for(let t=0;t<this.count;t++){let n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return new co(new this.array.constructor(e),this.itemSize,this.normalized)}return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new e(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){y(`InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.`);let e=[];for(let t=0;t<this.count;t++){let n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}_denormalize(e){let t=this._normalizationScale;return t===void 0?le(e,this.data.array):Math.max(e/t,-1)}_normalize(e){let t=this._normalizationScale;return t===void 0?ue(e,this.data.array):Math.round(e*t)}},Mo=/*@__PURE__*/ new B,No=/*@__PURE__*/ new B,Po=/*@__PURE__*/ new Di,Fo=class{constructor(e=new B(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let r=Mo.subVectors(n,t).cross(No.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){let r=e.delta(Mo),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let a=-(e.start.dot(this.normal)+this.constant)/i;return n===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(r,a)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||Po.getNormalMatrix(e),r=this.coplanarPoint(Mo).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}toJSON(){return{normal:this.normal.toArray(),constant:this.constant}}fromJSON(e){return this.normal.fromArray(e.normal),this.constant=e.constant,this}},Io=0,Lo=class extends vi{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Io++}),this.uuid=T(),this.name=``,this.type=`Material`,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new H(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Wr,this.stencilZFail=Wr,this.stencilZPass=Wr,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 n=e[t];if(n===void 0){x(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];r===void 0?x(`Material: '${t}' is not a property of THREE.${this.type}.`):r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:`Material`,generator:`Material.toJSON`}};n.uuid=this.uuid,n.type=this.type,n.blending=this.blending,n.side=this.side,n.shadowSide=this.shadowSide,n.vertexColors=this.vertexColors,n.opacity=this.opacity,n.transparent=this.transparent,n.blendSrc=this.blendSrc,n.blendDst=this.blendDst,n.blendEquation=this.blendEquation,n.blendSrcAlpha=this.blendSrcAlpha,n.blendDstAlpha=this.blendDstAlpha,n.blendEquationAlpha=this.blendEquationAlpha,n.blendColor=this.blendColor.getHex(),n.blendAlpha=this.blendAlpha,n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.clipIntersection=this.clipIntersection,n.clipShadows=this.clipShadows,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,n.stencilWrite=this.stencilWrite,n.polygonOffset=this.polygonOffset,n.polygonOffsetFactor=this.polygonOffsetFactor,n.polygonOffsetUnits=this.polygonOffsetUnits,n.dithering=this.dithering,n.alphaTest=this.alphaTest,n.alphaHash=this.alphaHash,n.alphaToCoverage=this.alphaToCoverage,n.premultipliedAlpha=this.premultipliedAlpha,n.forceSinglePass=this.forceSinglePass,n.allowOverride=this.allowOverride,n.visible=this.visible,n.toneMapped=this.toneMapped,n.name=this.name,this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.diffuseRoughness!==void 0&&(n.diffuseRoughness=this.diffuseRoughness),this.diffuseRoughnessMap&&this.diffuseRoughnessMap.isTexture&&(n.diffuseRoughnessMap=this.diffuseRoughnessMap.toJSON(e).uuid),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.retroreflectivity!==void 0&&(n.retroreflectivity=this.retroreflectivity),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessMinimum!==void 0&&(n.iridescenceThicknessMinimum=this.iridescenceThicknessMinimum),this.iridescenceThicknessMaximum!==void 0&&(n.iridescenceThicknessMaximum=this.iridescenceThicknessMaximum),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),Array.isArray(this.clippingPlanes)&&this.clippingPlanes.length>0&&(n.clippingPlanes=this.clippingPlanes.map(e=>e.toJSON())),this.rotation!==void 0&&(n.rotation=this.rotation),this.depthPacking!==void 0&&(n.depthPacking=this.depthPacking),this.linewidth!==void 0&&(n.linewidth=this.linewidth),this.linecap!==void 0&&(n.linecap=this.linecap),this.linejoin!==void 0&&(n.linejoin=this.linejoin),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.wireframe!==void 0&&(n.wireframe=this.wireframe),this.wireframeLinewidth!==void 0&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==void 0&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==void 0&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading!==void 0&&(n.flatShading=this.flatShading),this.fog!==void 0&&(n.fog=this.fog),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(t){let t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new H().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.diffuseRoughness!==void 0&&(this.diffuseRoughness=e.diffuseRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.retroreflectivity!==void 0&&(this.retroreflectivity=e.retroreflectivity),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessMinimum!==void 0&&(this.iridescenceThicknessMinimum=e.iridescenceThicknessMinimum),e.iridescenceThicknessMaximum!==void 0&&(this.iridescenceThicknessMaximum=e.iridescenceThicknessMaximum),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],this.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1]),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.clippingPlanes!==void 0&&(this.clippingPlanes=e.clippingPlanes.map(e=>new Fo().fromJSON(e))),e.clipIntersection!==void 0&&(this.clipIntersection=e.clipIntersection),e.clipShadows!==void 0&&(this.clipShadows=e.clipShadows),e.depthPacking!==void 0&&(this.depthPacking=e.depthPacking),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.linecap!==void 0&&(this.linecap=e.linecap),e.linejoin!==void 0&&(this.linejoin=e.linejoin),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(this.vertexColors=typeof e.vertexColors==`number`?e.vertexColors>0:e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let t=e.normalScale;Array.isArray(t)===!1&&(t=[t,t]),this.normalScale=new z().fromArray(t)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new z().fromArray(e.clearcoatNormalScale)),e.diffuseRoughnessMap!==void 0&&(this.diffuseRoughnessMap=t[e.diffuseRoughnessMap]||null),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}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,n=null;if(t!==null){let e=t.length;n=Array(e);for(let r=0;r!==e;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,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.allowOverride=e.allowOverride,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++}},Ro=class extends Lo{constructor(e){super(),this.isSpriteMaterial=!0,this.type=`SpriteMaterial`,this.color=new H(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},Bo=/*@__PURE__*/ new B,Vo=/*@__PURE__*/ new B,Ho=/*@__PURE__*/ new B,Uo=/*@__PURE__*/ new z,Wo=/*@__PURE__*/ new z,Go=/*@__PURE__*/ new V,Ko=/*@__PURE__*/ new B,qo=/*@__PURE__*/ new B,Jo=/*@__PURE__*/ new B,Yo=/*@__PURE__*/ new z,Xo=/*@__PURE__*/ new z,Zo=/*@__PURE__*/ new z,Qo=class extends ya{constructor(e=new Ro){if(super(),this.isSprite=!0,this.type=`Sprite`,zo===void 0){zo=new G;let e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),t=new ko(e,5);zo.setIndex([0,1,2,0,2,3]),zo.setAttribute(`position`,new jo(t,3,0,!1)),zo.setAttribute(`uv`,new jo(t,2,3,!1))}this.geometry=zo,this.material=e,this.center=new z(.5,.5),this.count=1}intersectsFrustum(e){return e.intersectsSprite(this)}raycast(e,t){e.camera===null&&S(`Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.`),Vo.setFromMatrixScale(this.matrixWorld),Go.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Ho.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Vo.multiplyScalar(-Ho.z);let n=this.material.rotation,r,i;n!==0&&(i=Math.cos(n),r=Math.sin(n));let a=this.center;xe(Ko.set(-.5,-.5,0),Ho,a,Vo,r,i),xe(qo.set(.5,-.5,0),Ho,a,Vo,r,i),xe(Jo.set(.5,.5,0),Ho,a,Vo,r,i),Yo.set(0,0),Xo.set(1,0),Zo.set(1,1);let o=e.ray.intersectTriangle(Ko,qo,Jo,!1,Bo);if(o===null&&(xe(qo.set(-.5,.5,0),Ho,a,Vo,r,i),Xo.set(0,1),o=e.ray.intersectTriangle(Ko,Jo,qo,!1,Bo),o===null))return;let s=e.ray.origin.distanceTo(Bo);s<e.near||s>e.far||t.push({distance:s,point:Bo.clone(),uv:Ua.getInterpolation(Bo,Ko,qo,Jo,Yo,Xo,Zo,new z),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}toJSON(e){let t=super.toJSON(e);return t.object.center=this.center.toArray(),t}},$o=/*@__PURE__*/ new B,es=/*@__PURE__*/ new B,ts=class extends ya{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type=`LOD`,Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);let t=e.levels;for(let e=0,n=t.length;e<n;e++){let n=t[e];this.addLevel(n.object.clone(),n.distance,n.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);let r=this.levels,i=0;for(;i<r.length&&!(t<r[i].distance);i++);return r.splice(i,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){let t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){let e=t.splice(n,1);return this.remove(e[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){let t=this.levels;if(t.length>0){let n,r;for(n=1,r=t.length;n<r;n++){let r=t[n].distance;if(t[n].object.visible&&(r-=r*t[n].hysteresis),e<r)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){$o.setFromMatrixPosition(this.matrixWorld);let n=e.ray.origin.distanceTo($o);this.getObjectForDistance(n).raycast(e,t)}}update(e){let t=this.levels;if(t.length>1){$o.setFromMatrixPosition(e.matrixWorld),es.setFromMatrixPosition(this.matrixWorld);let n=$o.distanceTo(es)/e.zoom;t[0].object.visible=!0;let r,i;for(r=1,i=t.length;r<i;r++){let e=t[r].distance;if(t[r].object.visible&&(e-=e*t[r].hysteresis),n>=e)t[r-1].object.visible=!1,t[r].object.visible=!0;else break}for(this._currentLevel=r-1;r<i;r++)t[r].object.visible=!1}}toJSON(e){let t=super.toJSON(e);t.object.autoUpdate=this.autoUpdate,t.object.levels=[];let n=this.levels;for(let e=0,r=n.length;e<r;e++){let r=n[e];t.object.levels.push({object:r.object.uuid,distance:r.distance,hysteresis:r.hysteresis})}return t}},ns=/*@__PURE__*/ new B,rs=/*@__PURE__*/ new B,is=/*@__PURE__*/ new B,as=/*@__PURE__*/ new B,os=class{constructor(e=new B,t=new B(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,ns)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=ns.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ns.copy(this.origin).addScaledVector(this.direction,t),ns.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){rs.copy(e).add(t).multiplyScalar(.5),is.copy(t).sub(e).normalize(),as.copy(this.origin).sub(rs);let i=e.distanceTo(t)*.5,a=-this.direction.dot(is),o=as.dot(this.direction),s=-as.dot(is),c=as.lengthSq(),l=Math.abs(1-a*a),u,d,f,p;if(l>0){if(u=a*s-o,d=a*o-s,p=i*l,u>=0){if(d>=-p){if(d<=p){let e=1/l;u*=e,d*=e,f=u*(u+a*d+2*o)+d*(a*u+d+2*s)+c}else d=i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c}else d=-i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c}else d<=-p?(u=Math.max(0,-(-a*i+o)),d=u>0?-i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c):d<=p?(u=0,d=Math.min(Math.max(-i,-s),i),f=d*(d+2*s)+c):(u=Math.max(0,-(a*i+o)),d=u>0?i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c)}else d=a>0?-i:i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(rs).addScaledVector(is,d),f}intersectSphere(e,t){if(e.radius<0)return null;ns.subVectors(e.center,this.origin);let n=ns.dot(this.direction),r=ns.dot(ns)-n*n,i=e.radius*e.radius;if(r>i)return null;let a=Math.sqrt(i-r),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,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 n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),l>=0?(i=(e.min.y-d.y)*l,a=(e.max.y-d.y)*l):(i=(e.max.y-d.y)*l,a=(e.min.y-d.y)*l),n>a||i>r||((i>n||isNaN(n))&&(n=i),(a<r||isNaN(r))&&(r=a),u>=0?(o=(e.min.z-d.z)*u,s=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,s=(e.min.z-d.z)*u),n>s||o>r)||((o>n||n!==n)&&(n=o),(s<r||r!==r)&&(r=s),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,ns)!==null}intersectTriangle(e,t,n,r,i){let a=this.origin,o=this.direction,s=o.x,c=o.y,l=o.z,u=e.x-a.x,d=e.y-a.y,f=e.z-a.z,p=t.x-a.x,m=t.y-a.y,h=t.z-a.z,g=n.x-a.x,_=n.y-a.y,v=n.z-a.z,y=Math.abs(s),b=Math.abs(c),x=Math.abs(l),S,C,w,T,E,D,O,k,A,j,M,N;if(y>=b&&y>=x?(w=s,D=u,A=p,N=g,s>=0?(S=c,C=l,T=d,E=f,O=m,k=h,j=_,M=v):(S=l,C=c,T=f,E=d,O=h,k=m,j=v,M=_)):b>=x?(w=c,D=d,A=m,N=_,c>=0?(S=l,C=s,T=f,E=u,O=h,k=p,j=v,M=g):(S=s,C=l,T=u,E=f,O=p,k=h,j=g,M=v)):(w=l,D=f,A=h,N=v,l>=0?(S=s,C=c,T=u,E=d,O=p,k=m,j=g,M=_):(S=c,C=s,T=d,E=u,O=m,k=p,j=_,M=g)),w===0)return null;let P=S/w,F=C/w,ee=1/w,te=T-P*D,ne=E-F*D,re=O-P*A,ie=k-F*A,ae=j-P*N,I=M-F*N,oe=ae*ie-I*re,se=te*I-ne*ae,ce=re*ne-ie*te;if(r){if(oe<0||se<0||ce<0)return null}else if((oe<0||se<0||ce<0)&&(oe>0||se>0||ce>0))return null;let le=oe+se+ce;if(le===0)return null;let ue=ee*(oe*D+se*A+ce*N);return(le>0?ue<0:ue>0)?null:this.at(ue/le,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)}},ss=class extends Lo{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type=`MeshBasicMaterial`,this.color=new H(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 na,this.combine=0,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}},cs=/*@__PURE__*/ new V,ls=/*@__PURE__*/ new os,us=/*@__PURE__*/ new xo,ds=/*@__PURE__*/ new B,fs=/*@__PURE__*/ new B,ps=/*@__PURE__*/ new B,ms=/*@__PURE__*/ new B,hs=/*@__PURE__*/ new B,gs=/*@__PURE__*/ new B,_s=/*@__PURE__*/ new B,vs=/*@__PURE__*/ new B,K=class extends ya{constructor(e=new G,t=new ss){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),this.morphTargetInfluences=e.morphTargetInfluences===void 0?void 0:e.morphTargetInfluences.slice(),this.morphTargetDictionary=e.morphTargetDictionary===void 0?void 0: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 n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){let n=this.geometry,r=n.attributes.position,i=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);let o=this.morphTargetInfluences;if(i&&o){gs.set(0,0,0);for(let n=0,r=i.length;n<r;n++){let r=o[n],s=i[n];r!==0&&(hs.fromBufferAttribute(s,e),a?gs.addScaledVector(hs,r):gs.addScaledVector(hs.sub(t),r))}t.add(gs)}return t}intersectsFrustum(e){return e.intersectsObject(this)}raycast(e,t){let n=this.geometry,r=this.material,i=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),us.copy(n.boundingSphere),us.applyMatrix4(i),ls.copy(e.ray).recast(e.near),us.containsPoint(ls.origin)===!1&&(ls.intersectSphere(us,ds)===null||ls.origin.distanceToSquared(ds)>(e.far-e.near)**2)||(cs.copy(i).invert(),ls.copy(e.ray).applyMatrix4(cs),(n.boundingBox===null||ls.intersectsBox(n.boundingBox)!==!1)&&this._computeIntersections(e,t,ls)))}_computeIntersections(e,t,n){let r,i=this.geometry,a=this.material,o=i.index,s=i.attributes.position,c=i.attributes.uv,l=i.attributes.uv1,u=i.attributes.normal,d=i.groups,f=i.drawRange;if(o!==null){if(Array.isArray(a))for(let i=0,s=d.length;i<s;i++){let s=d[i],p=a[s.materialIndex],m=Math.max(s.start,f.start),h=Math.min(o.count,Math.min(s.start+s.count,f.start+f.count));for(let i=m,a=h;i<a;i+=3){let a=o.getX(i),d=o.getX(i+1),f=o.getX(i+2);r=Ce(this,p,e,n,c,l,u,a,d,f),r&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=s.materialIndex,t.push(r))}}else{let i=Math.max(0,f.start),s=Math.min(o.count,f.start+f.count);for(let d=i,f=s;d<f;d+=3){let i=o.getX(d),s=o.getX(d+1),f=o.getX(d+2);r=Ce(this,a,e,n,c,l,u,i,s,f),r&&(r.faceIndex=Math.floor(d/3),t.push(r))}}}else if(s!==void 0){if(Array.isArray(a))for(let i=0,o=d.length;i<o;i++){let o=d[i],p=a[o.materialIndex],m=Math.max(o.start,f.start),h=Math.min(s.count,Math.min(o.start+o.count,f.start+f.count));for(let i=m,a=h;i<a;i+=3){let a=i,s=i+1,d=i+2;r=Ce(this,p,e,n,c,l,u,a,s,d),r&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=o.materialIndex,t.push(r))}}else{let i=Math.max(0,f.start),o=Math.min(s.count,f.start+f.count);for(let s=i,d=o;s<d;s+=3){let i=s,o=s+1,d=s+2;r=Ce(this,a,e,n,c,l,u,i,o,d),r&&(r.faceIndex=Math.floor(s/3),t.push(r))}}}}},ys=/*@__PURE__*/ new Bi,bs=/*@__PURE__*/ new Bi,xs=/*@__PURE__*/ new Bi,Ss=/*@__PURE__*/ new Bi,Cs=/*@__PURE__*/ new V,ws=/*@__PURE__*/ new B,Ts=/*@__PURE__*/ new xo,Es=/*@__PURE__*/ new V,Ds=/*@__PURE__*/ new os,Os=class extends K{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type=`SkinnedMesh`,this.bindMode=nn,this.bindMatrix=new V,this.bindMatrixInverse=new V,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Wa),this.boundingBox.makeEmpty();let t=e.getAttribute(`position`);for(let e=0;e<t.count;e++)this.getVertexPosition(e,ws),this.boundingBox.expandByPoint(ws)}computeBoundingSphere(){let e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new xo),this.boundingSphere.makeEmpty();let t=e.getAttribute(`position`);for(let e=0;e<t.count;e++)this.getVertexPosition(e,ws),this.boundingSphere.expandByPoint(ws)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this.boundingBox=e.boundingBox===null?null:e.boundingBox.clone(),this.boundingSphere=e.boundingSphere===null?null:e.boundingSphere.clone(),this}raycast(e,t){let n=this.material,r=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Ts.copy(this.boundingSphere),Ts.applyMatrix4(r),e.ray.intersectsSphere(Ts)!==!1&&(Es.copy(r).invert(),Ds.copy(e.ray).applyMatrix4(Es),(this.boundingBox===null||Ds.intersectsBox(this.boundingBox)!==!1)&&this._computeIntersections(e,t,Ds)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new Bi,t=this.geometry.attributes.skinWeight;for(let n=0,r=t.count;n<r;n++){e.fromBufferAttribute(t,n);let r=1/e.manhattanLength();r===1/0?e.set(1,0,0,0):e.multiplyScalar(r),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===`attached`?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===`detached`?this.bindMatrixInverse.copy(this.bindMatrix).invert():x(`SkinnedMesh: Unrecognized bindMode: `+this.bindMode)}applyBoneTransform(e,t){let n=this.skeleton,r=this.geometry;bs.fromBufferAttribute(r.attributes.skinIndex,e),xs.fromBufferAttribute(r.attributes.skinWeight,e),t.isVector4?(ys.copy(t),t.set(0,0,0,0)):(ys.set(t.x,t.y,t.z,1),t.set(0,0,0)),ys.applyMatrix4(this.bindMatrix);for(let e=0;e<4;e++){let r=xs.getComponent(e);if(r!==0){let i=bs.getComponent(e);Cs.multiplyMatrices(n.bones[i].matrixWorld,n.boneInverses[i]),t.addScaledVector(Ss.copy(ys).applyMatrix4(Cs),r)}}return t.isVector4&&(t.w=ys.w),t.applyMatrix4(this.bindMatrixInverse)}},ks=class extends ya{constructor(){super(),this.isBone=!0,this.type=`Bone`}},As=class extends zi{constructor(e=null,t=1,n=1,r,i,a,o,s,c=cn,l=cn,u,d){super(null,a,o,s,c,l,r,i,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},js=/*@__PURE__*/ new V,Ms=/*@__PURE__*/ new V,Ns=class e{constructor(e=[],t=[]){this.uuid=T(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.previousBoneTexture=null,this.init()}init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){x(`Skeleton: Number of inverse bone matrices does not match amount of bones.`),this.boneInverses=[];for(let e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new V)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let t=new V;this.bones[e]&&t.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(t)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&(t.parent&&t.parent.isBone?(t.matrix.copy(t.parent.matrixWorld).invert(),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))}}update(){let e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture;for(let r=0,i=e.length;r<i;r++){let i=e[r]?e[r].matrixWorld:Ms;js.multiplyMatrices(i,t[r]),js.toArray(n,r*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new e(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);let t=new Float32Array(e*e*4);t.set(this.boneMatrices);let n=new As(t,e,e,Nn,wn);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){let n=this.bones[t];if(n.name===e)return n}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null),this.previousBoneTexture!==null&&(this.previousBoneTexture.dispose(),this.previousBoneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,r=e.bones.length;n<r;n++){let r=e.bones[n],i=t[r];i===void 0&&(x(`Skeleton: No bone found with UUID:`,r),i=new ks),this.bones.push(i),this.boneInverses.push(new V().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){let e={metadata:{version:4.7,type:`Skeleton`,generator:`Skeleton.toJSON`},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,n=this.boneInverses;for(let r=0,i=t.length;r<i;r++){let i=t[r];e.bones.push(i.uuid);let a=n[r];e.boneInverses.push(a.toArray())}return e}},Ps=class extends co{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}},Fs=/*@__PURE__*/ new V,Is=/*@__PURE__*/ new V,Ls=[],Rs=/*@__PURE__*/ new Wa,zs=/*@__PURE__*/ new V,Bs=/*@__PURE__*/ new K,Vs=/*@__PURE__*/ new xo,Hs=class extends K{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Ps(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let e=0;e<n;e++)this.setMatrixAt(e,zs)}computeBoundingBox(){let e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Wa),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Fs),Rs.copy(e.boundingBox).applyMatrix4(Fs),this.boundingBox.union(Rs)}computeBoundingSphere(){let e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new xo),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Fs),Vs.copy(e.boundingSphere).applyMatrix4(Fs),this.boundingSphere.union(Vs)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),this.morphTexture=e.morphTexture===null?null:e.morphTexture.clone(),this.instanceColor=e.instanceColor===null?null:e.instanceColor.clone(),this.count=e.count,this.boundingBox=e.boundingBox===null?null:e.boundingBox.clone(),this.boundingSphere=e.boundingSphere===null?null:e.boundingSphere.clone(),this}getColorAt(e,t){return this.instanceColor===null?t.setRGB(1,1,1):t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){return t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){let n=t.morphTargetInfluences,r=this.morphTexture.source.data.data,i=e*(n.length+1)+1;for(let e=0;e<n.length;e++)n[e]=r[i+e]}raycast(e,t){let n=this.matrixWorld,r=this.count;if(Bs.geometry=this.geometry,Bs.material=this.material,Bs.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Vs.copy(this.boundingSphere),Vs.applyMatrix4(n),e.ray.intersectsSphere(Vs)!==!1))for(let i=0;i<r;i++){this.getMatrixAt(i,Fs),Is.multiplyMatrices(n,Fs),Bs.matrixWorld=Is,Bs.raycast(e,Ls);for(let e=0,n=Ls.length;e<n;e++){let n=Ls[e];n.instanceId=i,n.object=this,t.push(n)}Ls.length=0}}setColorAt(e,t){return this.instanceColor===null&&(this.instanceColor=new Ps(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3),this}setMatrixAt(e,t){return t.toArray(this.instanceMatrix.array,e*16),this}setMorphAt(e,t){let n=t.morphTargetInfluences,r=n.length+1;this.morphTexture===null&&(this.morphTexture=new As(new Float32Array(r*this.count),r,this.count,In,wn));let i=this.morphTexture.source.data.data,a=0;for(let e=0;e<n.length;e++)a+=n[e];let o=this.geometry.morphTargetsRelative?1:1-a,s=r*e;return i[s]=o,i.set(n,s+1),this}updateMorphTargets(){}dispose(){super.dispose(),this.instanceMatrix.dispose(),this.instanceColor!==null&&this.instanceColor.dispose(),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}},Us=/*@__PURE__*/ new xo,Ws=/*@__PURE__*/ new z(.5,.5),Gs=/*@__PURE__*/ new B,Ks=class{constructor(e=new Fo,t=new Fo,n=new Fo,r=new Fo,i=new Fo,a=new Fo){this.planes=[e,t,n,r,i,a]}set(e,t,n,r,i,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=si,n=!1){let r=this.planes,i=e.elements,a=i[0],o=i[1],s=i[2],c=i[3],l=i[4],u=i[5],d=i[6],f=i[7],p=i[8],m=i[9],h=i[10],g=i[11],_=i[12],v=i[13],y=i[14],b=i[15];if(r[0].setComponents(c-a,f-l,g-p,b-_).normalize(),r[1].setComponents(c+a,f+l,g+p,b+_).normalize(),r[2].setComponents(c+o,f+u,g+m,b+v).normalize(),r[3].setComponents(c-o,f-u,g-m,b-v).normalize(),n)r[4].setComponents(s,d,h,y).normalize(),r[5].setComponents(c-s,f-d,g-h,b-y).normalize();else if(r[4].setComponents(c-s,f-d,g-h,b-y).normalize(),t===2e3)r[5].setComponents(c+s,f+d,g+h,b+y).normalize();else if(t===2001)r[5].setComponents(s,d,h,y).normalize();else throw Error(`THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: `+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Us.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Us.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Us)}intersectsSprite(e){Us.center.set(0,0,0);let t=Ws.distanceTo(e.center);return Us.radius=.7071067811865476+t,Us.applyMatrix4(e.matrixWorld),this.intersectsSphere(Us)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let r=t[n];if(Gs.x=r.normal.x>0?e.max.x:e.min.x,Gs.y=r.normal.y>0?e.max.y:e.min.y,Gs.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Gs)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},qs=/*@__PURE__*/ new V,Js=class e{constructor(){this.coordinateSystem=si,this._frustums=[],this._count=0}setFromArrayCamera(e){let t=e.cameras,n=this._frustums;for(let e=0;e<t.length;e++){let r=t[e];qs.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),n[e]===void 0&&(n[e]=new Ks),n[e].setFromProjectionMatrix(qs,r.coordinateSystem,r.reversedDepth)}return this._count=t.length,this}getFrustum(e){return this._frustums[e]}intersectsObject(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsObject(e))return!0;return!1}intersectsSprite(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSprite(e))return!0;return!1}intersectsSphere(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSphere(e))return!0;return!1}intersectsBox(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsBox(e))return!0;return!1}containsPoint(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].containsPoint(e))return!0;return!1}copy(e){this.coordinateSystem=e.coordinateSystem;let t=this._frustums,n=e._frustums;for(let r=0;r<e._count;r++)t[r]===void 0&&(t[r]=new Ks),t[r].copy(n[r]);return this._count=e._count,this}clone(){return new e().copy(this)}},Ys=class{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n,r){let i=this.pool,a=this.list;this.index>=i.length&&i.push({start:-1,count:-1,z:-1,index:-1});let o=i[this.index];a.push(o),this.index++,o.start=e,o.count=t,o.z=n,o.index=r}reset(){this.list.length=0,this.index=0}},Xs=/*@__PURE__*/ new V,Zs=/*@__PURE__*/ new H(1,1,1),Qs=/*@__PURE__*/ new Ks,$s=/*@__PURE__*/ new Js,ec=/*@__PURE__*/ new Wa,tc=/*@__PURE__*/ new xo,nc=/*@__PURE__*/ new B,rc=/*@__PURE__*/ new B,ic=/*@__PURE__*/ new B,ac=/*@__PURE__*/ new B,oc=/*@__PURE__*/ new Ys,sc=/*@__PURE__*/ new K,cc=[],lc=class extends K{constructor(e,t,n=t*2,r){super(new G,r),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawBytesPerElement=1,this._mergedDrawCounts=new Int32Array(e),this._mergedDrawStarts=new Int32Array(e),this._mergedDrawInstanceCounts=new Int32Array(e),this._mergedDrawCount=0,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._previousMatricesTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);let t=new Float32Array(e*e*4),n=new As(t,e,e,Nn,wn);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);let t=new Uint32Array(e*e),n=new As(t,e,e,Ln,Cn);this._indirectTexture=n}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);let t=new Float32Array(e*e*4).fill(1),n=new As(t,e,e,Nn,wn);n.colorSpace=ji.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){let t=this.geometry,n=this._maxVertexCount,r=this._maxIndexCount;if(this._geometryInitialized===!1){for(let r in e.attributes){let{array:i,itemSize:a,normalized:o}=e.getAttribute(r),s=new i.constructor(n*a),c=new co(s,a,o);t.setAttribute(r,c)}if(e.getIndex()!==null){let e=n>65535?new Uint32Array(r):new Uint16Array(r);t.setIndex(new co(e,1))}this._geometryInitialized=!0}}_validateGeometry(e){let t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw Error(`THREE.BatchedMesh: All geometries must consistently have "index".`);for(let n in t.attributes){if(!e.hasAttribute(n))throw Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);let r=e.getAttribute(n),i=t.getAttribute(n);if(r.itemSize!==i.itemSize||r.normalized!==i.normalized)throw Error(`THREE.BatchedMesh: Added geometry attribute "${n}" has an inconsistent itemSize or normalized value.`)}}validateInstanceId(e){let t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){let t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Wa);let e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,r=t.length;n<r;n++){if(t[n].active===!1)continue;let r=t[n].geometryIndex;this.getMatrixAt(n,Xs),this.getBoundingBoxAt(r,ec).applyMatrix4(Xs),e.union(ec)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new xo);let e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let n=0,r=t.length;n<r;n++){if(t[n].active===!1)continue;let r=t[n].geometryIndex;this.getMatrixAt(n,Xs),this.getBoundingSphereAt(r,tc).applyMatrix4(Xs),e.union(tc)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw Error(`THREE.BatchedMesh: Maximum item count reached.`);let t={visible:!0,active:!0,geometryIndex:e},n=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(we),n=this._availableInstanceIds.shift(),this._instanceInfo[n]=t):(n=this._instanceInfo.length,this._instanceInfo.push(t));let r=this._matricesTexture;Xs.identity().toArray(r.image.data,n*16),r.needsUpdate=!0;let i=this._colorsTexture;return i&&(Zs.toArray(i.image.data,n*4),i.needsUpdate=!0),this._visibilityChanged=!0,n}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);let r={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},i=this._geometryInfo;r.vertexStart=this._nextVertexStart,r.reservedVertexCount=t===-1?e.getAttribute(`position`).count:t;let a=e.getIndex();if(a!==null&&(r.indexStart=this._nextIndexStart,r.reservedIndexCount=n===-1?a.count:n),r.indexStart!==-1&&r.indexStart+r.reservedIndexCount>this._maxIndexCount||r.vertexStart+r.reservedVertexCount>this._maxVertexCount)throw Error(`THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.`);let o;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(we),o=this._availableGeometryIds.shift(),i[o]=r):(o=this._geometryCount,this._geometryCount++,i.push(r)),this.setGeometryAt(o,e),this._nextIndexStart=r.indexStart+r.reservedIndexCount,this._nextVertexStart=r.vertexStart+r.reservedVertexCount,o}setGeometryAt(e,t){if(e>=this._geometryCount)throw Error(`THREE.BatchedMesh: Maximum geometry count reached.`);this._validateGeometry(t);let n=this.geometry,r=n.getIndex()!==null,i=n.getIndex(),a=t.getIndex(),o=this._geometryInfo[e];if(r&&a.count>o.reservedIndexCount||t.attributes.position.count>o.reservedVertexCount)throw Error(`THREE.BatchedMesh: Reserved space not large enough for provided geometry.`);let s=o.vertexStart,c=o.reservedVertexCount;o.vertexCount=t.getAttribute(`position`).count;for(let e in n.attributes){let r=t.getAttribute(e),i=n.getAttribute(e);L(r,i,s);let a=r.itemSize;for(let e=r.count,t=c;e<t;e++){let t=s+e;for(let e=0;e<a;e++)i.setComponent(t,e,0)}i.needsUpdate=!0,i.addUpdateRange(s*a,c*a)}if(r){let e=o.indexStart,n=o.reservedIndexCount;o.indexCount=t.getIndex().count;for(let t=0;t<a.count;t++)i.setX(e+t,s+a.getX(t));for(let t=a.count,r=n;t<r;t++)i.setX(e+t,s);i.needsUpdate=!0,i.addUpdateRange(e,o.reservedIndexCount)}return o.start=r?o.indexStart:o.vertexStart,o.count=r?o.indexCount:o.vertexCount,o.boundingBox=null,t.boundingBox!==null&&(o.boundingBox=t.boundingBox.clone()),o.boundingSphere=null,t.boundingSphere!==null&&(o.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){let t=this._geometryInfo;if(e>=t.length||t[e].active===!1)return this;let n=this._instanceInfo;for(let t=0,r=n.length;t<r;t++)n[t].active&&n[t].geometryIndex===e&&this.deleteInstance(t);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,t=0,n=this._geometryInfo,r=n.map((e,t)=>t).sort((e,t)=>n[e].vertexStart-n[t].vertexStart),i=this.geometry;for(let a=0,o=n.length;a<o;a++){let o=n[r[a]];if(o.active!==!1){if(i.index!==null){if(o.indexStart!==t){let{indexStart:n,vertexStart:r,reservedIndexCount:a}=o,s=i.index,c=s.array,l=e-r;for(let e=n;e<n+a;e++)c[e]=c[e]+l;s.array.copyWithin(t,n,n+a),s.addUpdateRange(t,a),s.needsUpdate=!0,o.indexStart=t}t+=o.reservedIndexCount}if(o.vertexStart!==e){let{vertexStart:t,reservedVertexCount:n}=o,r=i.attributes;for(let i in r){let a=r[i],{array:o,itemSize:s}=a;o.copyWithin(e*s,t*s,(t+n)*s),a.addUpdateRange(e*s,n*s),a.needsUpdate=!0}o.vertexStart=e}e+=o.reservedVertexCount,o.start=i.index?o.indexStart:o.vertexStart}}return this._nextIndexStart=t,this._nextVertexStart=e,this._visibilityChanged=!0,this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;let n=this.geometry,r=this._geometryInfo[e];if(r.boundingBox===null){let e=new Wa,t=n.index,i=n.attributes.position;for(let n=r.start,a=r.start+r.count;n<a;n++){let r=n;t&&(r=t.getX(r)),e.expandByPoint(nc.fromBufferAttribute(i,r))}r.boundingBox=e}return t.copy(r.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;let n=this.geometry,r=this._geometryInfo[e];if(r.boundingSphere===null){let t=new xo;this.getBoundingBoxAt(e,ec),ec.getCenter(t.center);let i=n.index,a=n.attributes.position,o=0;for(let e=r.start,n=r.start+r.count;e<n;e++){let n=e;i&&(n=i.getX(n)),nc.fromBufferAttribute(a,n),o=Math.max(o,t.center.distanceToSquared(nc))}t.radius=Math.sqrt(o),r.boundingSphere=t}return t.copy(r.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);let n=this._matricesTexture,r=this._matricesTexture.image.data;return t.toArray(r,e*16),n.needsUpdate=!0,this}getMatrixAt(e,t){return this.validateInstanceId(e),t.fromArray(this._matricesTexture.image.data,e*16)}setColorAt(e,t){return this.validateInstanceId(e),this._colorsTexture===null&&this._initColorsTexture(),t.toArray(this._colorsTexture.image.data,e*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,t){return this.validateInstanceId(e),this._colorsTexture===null?t.isVector4?t.set(1,1,1,1):t.setRGB(1,1,1):t.fromArray(this._colorsTexture.image.data,e*4)}setVisibleAt(e,t){return this.validateInstanceId(e),this._instanceInfo[e].visible===t||(this._instanceInfo[e].visible=t,this._visibilityChanged=!0),this}getVisibleAt(e){return this.validateInstanceId(e),this._instanceInfo[e].visible}setGeometryIdAt(e,t){return this.validateInstanceId(e),this.validateGeometryId(t),this._instanceInfo[e].geometryIndex=t,this._visibilityChanged=!0,this}getGeometryIdAt(e){return this.validateInstanceId(e),this._instanceInfo[e].geometryIndex}getGeometryRangeAt(e,t={}){this.validateGeometryId(e);let n=this._geometryInfo[e];return t.vertexStart=n.vertexStart,t.vertexCount=n.vertexCount,t.reservedVertexCount=n.reservedVertexCount,t.indexStart=n.indexStart,t.indexCount=n.indexCount,t.reservedIndexCount=n.reservedIndexCount,t.start=n.start,t.count=n.count,t}setInstanceCount(e){let t=this._availableInstanceIds,n=this._instanceInfo;for(t.sort(we);t[t.length-1]===n.length-1;)n.pop(),t.pop();if(e<n.length)throw Error(`THREE.BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);let r=new Int32Array(e),i=new Int32Array(e);De(this._multiDrawCounts,r),De(this._multiDrawStarts,i),this._multiDrawCounts=r,this._multiDrawStarts=i;let a=new Int32Array(e),o=new Int32Array(e),s=new Int32Array(e);De(this._mergedDrawCounts,a),De(this._mergedDrawStarts,o),De(this._mergedDrawInstanceCounts,s),this._mergedDrawCounts=a,this._mergedDrawStarts=o,this._mergedDrawInstanceCounts=s,this._maxInstanceCount=e;let c=this._indirectTexture,l=this._matricesTexture,u=this._colorsTexture;c.dispose(),this._initIndirectTexture(),De(c.image.data,this._indirectTexture.image.data),l.dispose(),this._initMatricesTexture(),De(l.image.data,this._matricesTexture.image.data),u&&(u.dispose(),this._initColorsTexture(),De(u.image.data,this._colorsTexture.image.data)),this._previousMatricesTexture!==null&&(this._previousMatricesTexture.dispose(),this._previousMatricesTexture=null)}setGeometrySize(e,t){let n=[...this._geometryInfo].filter(e=>e.active);if(Math.max(...n.map(e=>e.vertexStart+e.reservedVertexCount))>e)throw Error(`THREE.BatchedMesh: Geometry vertex values are being used outside the range ${e}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(e=>e.indexStart+e.reservedIndexCount))>t)throw Error(`THREE.BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);let r=this.geometry;r.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new G,this._initializeGeometry(r));let i=this.geometry;r.index&&De(r.index.array,i.index.array);for(let e in r.attributes)De(r.attributes[e].array,i.attributes[e].array);this._visibilityChanged=!0}raycast(e,t){let n=this._instanceInfo,r=this._geometryInfo,i=this.matrixWorld,a=this.geometry;sc.material=this.material,sc.geometry.index=a.index,sc.geometry.attributes=a.attributes,sc.geometry.boundingBox===null&&(sc.geometry.boundingBox=new Wa),sc.geometry.boundingSphere===null&&(sc.geometry.boundingSphere=new xo);for(let a=0,o=n.length;a<o;a++){if(!n[a].visible||!n[a].active)continue;let o=n[a].geometryIndex,s=r[o];sc.geometry.setDrawRange(s.start,s.count),this.getMatrixAt(a,sc.matrixWorld).premultiply(i),this.getBoundingBoxAt(o,sc.geometry.boundingBox),this.getBoundingSphereAt(o,sc.geometry.boundingSphere),sc.raycast(e,cc);for(let e=0,n=cc.length;e<n;e++){let n=cc[e];n.object=this,n.batchId=a,t.push(n)}cc.length=0}sc.material=null,sc.geometry.index=null,sc.geometry.attributes={},sc.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox===null?null:e.boundingBox.clone(),this.boundingSphere=e.boundingSphere===null?null:e.boundingSphere.clone(),this._geometryInfo=e._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox===null?null:e.boundingBox.clone(),boundingSphere:e.boundingSphere===null?null:e.boundingSphere.clone()})),this._instanceInfo=e._instanceInfo.map(e=>({...e})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._multiDrawBytesPerElement=e._multiDrawBytesPerElement,this._mergedDrawCounts=e._mergedDrawCounts.slice(),this._mergedDrawStarts=e._mergedDrawStarts.slice(),this._mergedDrawInstanceCounts=e._mergedDrawInstanceCounts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),e._colorsTexture===null?this._colorsTexture=null:(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){super.dispose(),this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null),this._previousMatricesTexture!==null&&(this._previousMatricesTexture.dispose(),this._previousMatricesTexture=null)}_updateDrawParameters(e,t,n,r=`multiDraw`){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;let i=t.getIndex(),a=i===null?1:i.array.BYTES_PER_ELEMENT,o=1;n.wireframe&&(o=2,a=t.attributes.position.count>65535?4:2);let s=this._instanceInfo,c=this._multiDrawStarts,l=this._multiDrawCounts,u=this._mergedDrawStarts,d=this._mergedDrawCounts,f=this._mergedDrawInstanceCounts,p=this._geometryInfo,m=this.perObjectFrustumCulled,h=this._indirectTexture,g=h.image.data,_=e.isArrayCamera?$s:Qs;m&&(e.isArrayCamera?_.setFromArrayCamera(e):(Xs.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse).multiply(this.matrixWorld),_.setFromProjectionMatrix(Xs,e.coordinateSystem,e.reversedDepth)));let v=0,y=0;if(this.sortObjects){Xs.copy(this.matrixWorld).invert(),rc.setFromMatrixPosition(e.matrixWorld).applyMatrix4(Xs),ic.set(0,0,-1).transformDirection(e.matrixWorld).transformDirection(Xs);for(let e=0,t=s.length;e<t;e++)if(s[e].visible&&s[e].active){let t=s[e].geometryIndex;this.getMatrixAt(e,Xs),this.getBoundingSphereAt(t,tc).applyMatrix4(Xs);let n=!1;if(m&&(n=!_.intersectsSphere(tc)),!n){let n=p[t],r=ac.subVectors(tc.center,rc).dot(ic);oc.push(n.start,n.count,r,e)}}let t=oc.list,i=this.customSort;i===null?t.sort(n.transparent?Ee:Te):i.call(this,t,e);for(let e=0,n=t.length;e<n;e++){let n=t[e],i=n.start*a*o,s=n.count*o;r===`merged`?y>0&&u[y-1]===i&&d[y-1]===s?f[y-1]++:(u[y]=i,d[y]=s,f[y]=1,y++):(c[v]=i,l[v]=s),g[v]=n.index,v++}oc.reset()}else for(let e=0,t=s.length;e<t;e++)if(s[e].visible&&s[e].active){let t=s[e].geometryIndex,n=!1;if(m&&(this.getMatrixAt(e,Xs),this.getBoundingSphereAt(t,tc).applyMatrix4(Xs),n=!_.intersectsSphere(tc)),!n){let n=p[t],i=n.start*a*o,s=n.count*o;r===`merged`?y>0&&u[y-1]===i&&d[y-1]===s?f[y-1]++:(u[y]=i,d[y]=s,f[y]=1,y++):(c[v]=i,l[v]=s),g[v]=e,v++}}h.needsUpdate=!0,this._multiDrawCount=v,this._mergedDrawCount=y,this._multiDrawBytesPerElement=a,this._visibilityChanged=!1}onBeforeRender(e,t,n,r,i){e.isWebGPURenderer===!0?(this._visibilityChanged||this.perObjectFrustumCulled||this.sortObjects)&&(this._indirectTexture.needsUpdate=!0):this._updateDrawParameters(n,r,i)}onBeforeShadow(e,t,n,r,i,a){e.isWebGPURenderer!==!0&&this._updateDrawParameters(r,i,a)}},uc=class extends Lo{constructor(e){super(),this.isLineBasicMaterial=!0,this.type=`LineBasicMaterial`,this.color=new H(16777215),this.map=null,this.linewidth=1,this.linecap=`round`,this.linejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},dc=/*@__PURE__*/ new B,fc=/*@__PURE__*/ new B,pc=/*@__PURE__*/ new V,mc=/*@__PURE__*/ new os,hc=/*@__PURE__*/ new xo,gc=/*@__PURE__*/ new B,_c=/*@__PURE__*/ new B,vc=class extends ya{constructor(e=new G,t=new uc){super(),this.isLine=!0,this.type=`Line`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.morphTargetInfluences=e.morphTargetInfluences===void 0?void 0:e.morphTargetInfluences.slice(),this.morphTargetDictionary=e.morphTargetDictionary===void 0?void 0:Object.assign({},e.morphTargetDictionary),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let e=1,r=t.count;e<r;e++)dc.fromBufferAttribute(t,e-1),fc.fromBufferAttribute(t,e),n[e]=n[e-1],n[e]+=dc.distanceTo(fc);e.setAttribute(`lineDistance`,new W(n,1))}else x(`Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`);return this}intersectsFrustum(e){return e.intersectsObject(this)}raycast(e,t){let n=this.geometry,r=this.matrixWorld,i=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),hc.copy(n.boundingSphere),hc.applyMatrix4(r),hc.radius+=i,e.ray.intersectsSphere(hc)===!1)return;pc.copy(r).invert(),mc.copy(e.ray).applyMatrix4(pc);let o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,c=this.isLineSegments?2:1,l=n.index,u=n.attributes.position;if(l!==null){let n=Math.max(0,a.start),r=Math.min(l.count,a.start+a.count);for(let i=n,a=r-1;i<a;i+=c){let n=l.getX(i),r=l.getX(i+1),a=Oe(this,e,mc,s,n,r,i);a&&t.push(a)}if(this.isLineLoop){let i=l.getX(r-1),a=l.getX(n),o=Oe(this,e,mc,s,i,a,r-1);o&&t.push(o)}}else{let n=Math.max(0,a.start),r=Math.min(u.count,a.start+a.count);for(let i=n,a=r-1;i<a;i+=c){let n=Oe(this,e,mc,s,i,i+1,i);n&&t.push(n)}if(this.isLineLoop){let i=Oe(this,e,mc,s,r-1,n,r-1);i&&t.push(i)}}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}},yc=/*@__PURE__*/ new B,bc=/*@__PURE__*/ new B,xc=class extends vc{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type=`LineSegments`}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let e=0,r=t.count;e<r;e+=2)yc.fromBufferAttribute(t,e),bc.fromBufferAttribute(t,e+1),n[e]=e===0?0:n[e-1],n[e+1]=n[e]+yc.distanceTo(bc);e.setAttribute(`lineDistance`,new W(n,1))}else x(`LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`);return this}},Sc=class extends vc{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type=`LineLoop`}},Cc=class extends Lo{constructor(e){super(),this.isPointsMaterial=!0,this.type=`PointsMaterial`,this.color=new H(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},wc=/*@__PURE__*/ new V,Tc=/*@__PURE__*/ new os,Ec=/*@__PURE__*/ new xo,Dc=/*@__PURE__*/ new B,Oc=class extends ya{constructor(e=new G,t=new Cc){super(),this.isPoints=!0,this.type=`Points`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.morphTargetInfluences=e.morphTargetInfluences===void 0?void 0:e.morphTargetInfluences.slice(),this.morphTargetDictionary=e.morphTargetDictionary===void 0?void 0:Object.assign({},e.morphTargetDictionary),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}intersectsFrustum(e){return e.intersectsObject(this)}raycast(e,t){let n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Ec.copy(n.boundingSphere),Ec.applyMatrix4(r),Ec.radius+=i,e.ray.intersectsSphere(Ec)===!1)return;wc.copy(r).invert(),Tc.copy(e.ray).applyMatrix4(wc);let o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,c=n.index,l=n.attributes.position;if(c!==null){let n=Math.max(0,a.start),i=Math.min(c.count,a.start+a.count);for(let a=n,o=i;a<o;a++){let n=c.getX(a);Dc.fromBufferAttribute(l,n),ke(Dc,n,s,r,e,t,this)}}else{let n=Math.max(0,a.start),i=Math.min(l.count,a.start+a.count);for(let a=n,o=i;a<o;a++)Dc.fromBufferAttribute(l,a),ke(Dc,a,s,r,e,t,this)}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}},kc=class extends zi{constructor(e,t,n,r,i=pn,a=pn,o,s,c){super(e,t,n,r,i,a,o,s,c),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;let l=this;function u(){l.needsUpdate=!0,l._requestVideoFrameCallbackId=e.requestVideoFrameCallback(u)}`requestVideoFrameCallback`in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(u))}clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;!(`requestVideoFrameCallback`in e)&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}},Ac=class extends kc{constructor(e,t,n,r,i,a,o,s){super({},e,t,n,r,i,a,o,s),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}},jc=class extends zi{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=cn,this.minFilter=cn,this.generateMipmaps=!1,this.needsUpdate=!0}copy(e){return super.copy(e),this.source=new Fi(Object.assign({},e.image)),this}},Mc=class extends zi{constructor(e=[],t,n,r,i,a,o,s,c,l,u,d){super(null,a,o,s,c,l,r,i,u,d),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}},Nc=class extends Mc{constructor(e,t,n,r,i,a){super(e,t,n,i,a),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=on,this.layerUpdates=/* @__PURE__ */ new Set}copy(e){return super.copy(e),this.wrapR=e.wrapR,this}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}},Pc=class extends Mc{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,301),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}},Fc=class extends zi{constructor(e=[],t=301,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,s,c,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},Ic=class extends zi{constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r,i,a,o,s,c),this.isCanvasTexture=!0,this.needsUpdate=!0}},Lc=class extends zi{constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r,i,a,o,s,c),this.isHTMLTexture=!0,this.generateMipmaps=!1,this.needsUpdate=!0;let l=e?e.parentNode:null;l!==null&&`requestPaint`in l&&(l.onpaint=()=>{this.needsUpdate=!0},l.requestPaint())}dispose(){let e=this.image?this.image.parentNode:null;e!==null&&`onpaint`in e&&(e.onpaint=null),super.dispose()}},Rc=class extends zi{constructor(e,t,n=Cn,r,i,a,o=cn,s=cn,c,l=Pn,u=1){if(l!==1026&&l!==1027)throw Error(`THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat`);super({width:e,height:t,depth:u},r,i,a,o,s,l,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Fi(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return t.compareFunction=this.compareFunction,t}},zc=class extends Rc{constructor(e,t=Cn,n=301,r,i,a=cn,o=cn,s,c=Pn){let l={width:e,height:e,depth:1},u=[l,l,l,l,l,l];super(e,e,t,n,r,i,a,o,s,c),this.image=u,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},Bc=class extends zi{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},Vc=class e extends G{constructor(e=1,t=1,n=1,r=1,i=1,a=1){super(),this.type=`BoxGeometry`,this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};let o=this;r=Math.floor(r),i=Math.floor(i),a=Math.floor(a);let s=[],c=[],l=[],u=[],d=0,f=0;p(`z`,`y`,`x`,-1,-1,n,t,e,a,i,0),p(`z`,`y`,`x`,1,-1,n,t,-e,a,i,1),p(`x`,`z`,`y`,1,1,e,n,t,r,a,2),p(`x`,`z`,`y`,1,-1,e,n,-t,r,a,3),p(`x`,`y`,`z`,1,-1,e,t,n,r,i,4),p(`x`,`y`,`z`,-1,-1,e,t,-n,r,i,5),this.setIndex(s),this.setAttribute(`position`,new W(c,3)),this.setAttribute(`normal`,new W(l,3)),this.setAttribute(`uv`,new W(u,2));function p(e,t,n,r,i,a,p,m,h,g,_){let v=a/h,y=p/g,b=a/2,x=p/2,S=m/2,C=h+1,w=g+1,T=0,E=0,D=new B;for(let a=0;a<w;a++){let o=a*y-x;for(let s=0;s<C;s++)D[e]=(s*v-b)*r,D[t]=o*i,D[n]=S,c.push(D.x,D.y,D.z),D[e]=0,D[t]=0,D[n]=m>0?1:-1,l.push(D.x,D.y,D.z),u.push(s/h),u.push(1-a/g),T+=1}for(let e=0;e<g;e++)for(let t=0;t<h;t++){let n=d+t+C*e,r=d+t+C*(e+1),i=d+(t+1)+C*(e+1),a=d+(t+1)+C*e;s.push(n,r,a),s.push(r,i,a),E+=6}o.addGroup(f,E,_),f+=E,d+=T}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}},Hc=class e extends G{constructor(e=1,t=1,n=4,r=8,i=1){super(),this.type=`CapsuleGeometry`,this.parameters={radius:e,height:t,capSegments:n,radialSegments:r,heightSegments:i},t=Math.max(0,t),n=Math.max(1,Math.floor(n)),r=Math.max(3,Math.floor(r)),i=Math.max(1,Math.floor(i));let a=[],o=[],s=[],c=[],l=t/2,u=Math.PI/2*e,d=t,f=2*u+d,p=n*2+i,m=r+1,h=new B,g=new B;for(let _=0;_<=p;_++){let v=0,y=0,b=0,x=0;if(_<=n){let t=_/n,r=t*Math.PI/2;y=-l-e*Math.cos(r),b=e*Math.sin(r),x=-e*Math.cos(r),v=t*u}else if(_<=n+i){let r=(_-n)/i;y=-l+r*t,b=e,x=0,v=u+r*d}else{let t=(_-n-i)/n,r=t*Math.PI/2;y=l+e*Math.sin(r),b=e*Math.cos(r),x=e*Math.sin(r),v=u+d+t*u}let S=Math.max(0,Math.min(1,v/f)),C=0;_===0?C=.5/r:_===p&&(C=-.5/r);for(let e=0;e<=r;e++){let t=e/r,n=t*Math.PI*2,i=Math.sin(n),a=Math.cos(n);g.x=-b*a,g.y=y,g.z=b*i,o.push(g.x,g.y,g.z),h.set(-b*a,x,b*i),h.normalize(),s.push(h.x,h.y,h.z),c.push(t+C,S)}if(_>0){let e=(_-1)*m;for(let t=0;t<r;t++){let n=e+t,r=e+t+1,i=_*m+t,o=_*m+t+1;a.push(n,r,i),a.push(r,o,i)}}}this.setIndex(a),this.setAttribute(`position`,new W(o,3)),this.setAttribute(`normal`,new W(s,3)),this.setAttribute(`uv`,new W(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.height,t.capSegments,t.radialSegments,t.heightSegments)}},Uc=class e extends G{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type=`CircleGeometry`,this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);let i=[],a=[],o=[],s=[],c=new B,l=new z;a.push(0,0,0),o.push(0,0,1),s.push(.5,.5);for(let i=0,u=3;i<=t;i++,u+=3){let d=n+i/t*r;c.x=e*Math.cos(d),c.y=e*Math.sin(d),a.push(c.x,c.y,c.z),o.push(0,0,1),l.x=(a[u]/e+1)/2,l.y=(a[u+1]/e+1)/2,s.push(l.x,l.y)}for(let e=1;e<=t;e++)i.push(e,e+1,0);this.setIndex(i),this.setAttribute(`position`,new W(a,3)),this.setAttribute(`normal`,new W(o,3)),this.setAttribute(`uv`,new W(s,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.segments,t.thetaStart,t.thetaLength)}},Wc=class e extends G{constructor(e=1,t=1,n=1,r=32,i=1,a=!1,o=0,s=Math.PI*2){super(),this.type=`CylinderGeometry`,this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s};let c=this;r=Math.floor(r),i=Math.floor(i);let l=[],u=[],d=[],f=[],p=0,m=[],h=n/2,g=0;_(),a===!1&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(l),this.setAttribute(`position`,new W(u,3)),this.setAttribute(`normal`,new W(d,3)),this.setAttribute(`uv`,new W(f,2));function _(){let a=new B,_=new B,v=0,y=(t-e)/n;for(let c=0;c<=i;c++){let l=[],g=c/i,v=g*(t-e)+e;for(let e=0;e<=r;e++){let t=e/r,i=t*s+o,c=Math.sin(i),m=Math.cos(i);_.x=v*c,_.y=-g*n+h,_.z=v*m,u.push(_.x,_.y,_.z),a.set(c,y,m).normalize(),d.push(a.x,a.y,a.z),f.push(t,1-g),l.push(p++)}m.push(l)}for(let n=0;n<r;n++)for(let r=0;r<i;r++){let a=m[r][n],o=m[r+1][n],s=m[r+1][n+1],c=m[r][n+1];(e>0||r!==0)&&(l.push(a,o,c),v+=3),(t>0||r!==i-1)&&(l.push(o,s,c),v+=3)}c.addGroup(g,v,0),g+=v}function v(n){let i=p,a=new z,m=new B,_=0,v=n===!0?e:t,y=n===!0?1:-1;for(let e=1;e<=r;e++)u.push(0,h*y,0),d.push(0,y,0),f.push(.5,.5),p++;let b=p;for(let e=0;e<=r;e++){let t=e/r*s+o,n=Math.cos(t),i=Math.sin(t);m.x=v*i,m.y=h*y,m.z=v*n,u.push(m.x,m.y,m.z),d.push(0,y,0),a.x=n*.5+.5,a.y=i*.5*y+.5,f.push(a.x,a.y),p++}for(let e=0;e<r;e++){let t=i+e,r=b+e;n===!0?l.push(r,r+1,t):l.push(r+1,r,t),_+=3}c.addGroup(g,_,n===!0?1:2),g+=_}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},Gc=class e extends Wc{constructor(e=1,t=1,n=32,r=1,i=!1,a=0,o=Math.PI*2){super(0,e,t,n,r,i,a,o),this.type=`ConeGeometry`,this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}static fromJSON(t){return new e(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},Kc=class e extends G{constructor(e=[],t=[],n=1,r=0){super(),this.type=`PolyhedronGeometry`,this.parameters={vertices:e,indices:t,radius:n,detail:r};let i=[],a=[];o(r),c(n),l(),this.setAttribute(`position`,new W(i,3)),this.setAttribute(`normal`,new W(i.slice(),3)),this.setAttribute(`uv`,new W(a,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function o(e){let n=new B,r=new B,i=new B;for(let a=0;a<t.length;a+=3)f(t[a+0],n),f(t[a+1],r),f(t[a+2],i),s(n,r,i,e)}function s(e,t,n,r){let i=r+1,a=[];for(let r=0;r<=i;r++){a[r]=[];let o=e.clone().lerp(n,r/i),s=t.clone().lerp(n,r/i),c=i-r;for(let e=0;e<=c;e++)e===0&&r===i?a[r][e]=o:a[r][e]=o.clone().lerp(s,e/c)}for(let e=0;e<i;e++)for(let t=0;t<2*(i-e)-1;t++){let n=Math.floor(t/2);t%2==0?(d(a[e][n+1]),d(a[e+1][n]),d(a[e][n])):(d(a[e][n+1]),d(a[e+1][n+1]),d(a[e+1][n]))}}function c(e){let t=new B;for(let n=0;n<i.length;n+=3)t.x=i[n+0],t.y=i[n+1],t.z=i[n+2],t.normalize().multiplyScalar(e),i[n+0]=t.x,i[n+1]=t.y,i[n+2]=t.z}function l(){let e=new B;for(let t=0;t<i.length;t+=3){e.x=i[t+0],e.y=i[t+1],e.z=i[t+2];let n=h(e)/2/Math.PI+.5,r=g(e)/Math.PI+.5;a.push(n,1-r)}p(),u()}function u(){for(let e=0;e<a.length;e+=6){let t=a[e+0],n=a[e+2],r=a[e+4];Math.max(t,n,r)>.9&&Math.min(t,n,r)<.1&&(t<.2&&(a[e+0]+=1),n<.2&&(a[e+2]+=1),r<.2&&(a[e+4]+=1))}}function d(e){i.push(e.x,e.y,e.z)}function f(t,n){let r=t*3;n.x=e[r+0],n.y=e[r+1],n.z=e[r+2]}function p(){let e=new B,t=new B,n=new B,r=new B,o=new z,s=new z,c=new z;for(let l=0,u=0;l<i.length;l+=9,u+=6){e.set(i[l+0],i[l+1],i[l+2]),t.set(i[l+3],i[l+4],i[l+5]),n.set(i[l+6],i[l+7],i[l+8]),o.set(a[u+0],a[u+1]),s.set(a[u+2],a[u+3]),c.set(a[u+4],a[u+5]),r.copy(e).add(t).add(n).divideScalar(3);let d=h(r);m(o,u+0,e,d),m(s,u+2,t,d),m(c,u+4,n,d)}}function m(e,t,n,r){r<0&&e.x===1&&(a[t]=e.x-1),n.x===0&&n.z===0&&(a[t]=r/2/Math.PI+.5)}function h(e){return Math.atan2(e.z,-e.x)}function g(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.vertices,t.indices,t.radius,t.detail)}},qc=class e extends Kc{constructor(e=1,t=0){let n=(1+Math.sqrt(5))/2,r=1/n,i=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r];super(i,[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type=`DodecahedronGeometry`,this.parameters={radius:e,detail:t}}static fromJSON(t){return new e(t.radius,t.detail)}},Jc=/*@__PURE__*/ new B,Yc=/*@__PURE__*/ new B,Xc=/*@__PURE__*/ new B,Zc=/*@__PURE__*/ new Ua,Qc=class extends G{constructor(e=null,t=1){if(super(),this.type=`EdgesGeometry`,this.parameters={geometry:e,thresholdAngle:t},e!==null){let n=1e4,r=Math.cos(xi*t),i=e.getIndex(),a=e.getAttribute(`position`),o=i?i.count:a.count,s=[0,0,0],c=[`a`,`b`,`c`],l=[,,,],u=/* @__PURE__ */ new Map,d=[];for(let e=0;e<o;e+=3){i?(s[0]=i.getX(e),s[1]=i.getX(e+1),s[2]=i.getX(e+2)):(s[0]=e,s[1]=e+1,s[2]=e+2);let{a:t,b:o,c:f}=Zc;if(t.fromBufferAttribute(a,s[0]),o.fromBufferAttribute(a,s[1]),f.fromBufferAttribute(a,s[2]),Zc.getNormal(Xc),l[0]=`${Math.round(t.x*n)},${Math.round(t.y*n)},${Math.round(t.z*n)}`,l[1]=`${Math.round(o.x*n)},${Math.round(o.y*n)},${Math.round(o.z*n)}`,l[2]=`${Math.round(f.x*n)},${Math.round(f.y*n)},${Math.round(f.z*n)}`,l[0]!==l[1]&&l[1]!==l[2]&&l[2]!==l[0])for(let e=0;e<3;e++){let t=(e+1)%3,n=l[e],i=l[t],a=Zc[c[e]],o=Zc[c[t]],f=`${n}_${i}`,p=`${i}_${n}`,m=u.get(p);m?(Xc.dot(m.normal)<=r&&(d.push(a.x,a.y,a.z),d.push(o.x,o.y,o.z)),u.set(p,null)):u.has(f)||u.set(f,{index0:s[e],index1:s[t],normal:Xc.clone()})}}for(let e of u.values())if(e){let{index0:t,index1:n}=e;Jc.fromBufferAttribute(a,t),Yc.fromBufferAttribute(a,n),d.push(Jc.x,Jc.y,Jc.z),d.push(Yc.x,Yc.y,Yc.z)}this.setAttribute(`position`,new W(d,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}},$c=class{constructor(){this.type=`Curve`,this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){x(`Curve: .getPoint() not implemented.`)}getPointAt(e,t){let n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],n,r=this.getPoint(0),i=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),i+=n.distanceTo(r),t.push(i),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){let n=this.getLengths(),r=0,i=n.length,a;a=t||e*n[i-1];let o=0,s=i-1,c;for(;o<=s;)if(r=Math.floor(o+(s-o)/2),c=n[r]-a,c<0)o=r+1;else if(c>0)s=r-1;else{s=r;break}if(r=s,n[r]===a)return r/(i-1);let l=n[r],u=n[r+1]-l,d=(a-l)/u;return(r+d)/(i-1)}getTangent(e,t){let n=1e-4,r=e-n,i=e+n;r<0&&(r=0),i>1&&(i=1);let a=this.getPoint(r),o=this.getPoint(i),s=t||(a.isVector2?new z:new B);return s.copy(o).sub(a).normalize(),s}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){let n=new B,r=[],i=[],a=[],o=new B,s=new V;for(let t=0;t<=e;t++){let n=t/e;r[t]=this.getTangentAt(n,new B)}i[0]=new B,a[0]=new B;let c=Number.MAX_VALUE,l=Math.abs(r[0].x),u=Math.abs(r[0].y),d=Math.abs(r[0].z);l<=c&&(c=l,n.set(1,0,0)),u<=c&&(c=u,n.set(0,1,0)),d<=c&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),a[0].crossVectors(r[0],i[0]);for(let t=1;t<=e;t++){if(i[t]=i[t-1].clone(),a[t]=a[t-1].clone(),o.crossVectors(r[t-1],r[t]),o.length()>2**-52){o.normalize();let e=Math.acos(E(r[t-1].dot(r[t]),-1,1));i[t].applyMatrix4(s.makeRotationAxis(o,e))}a[t].crossVectors(r[t],i[t])}if(t===!0){let t=Math.acos(E(i[0].dot(i[e]),-1,1));t/=e,r[0].dot(o.crossVectors(i[0],i[e]))>0&&(t=-t);for(let n=1;n<=e;n++)i[n].applyMatrix4(s.makeRotationAxis(r[n],t*n)),a[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this.cacheArcLengths=null,this}toJSON(){let e={metadata:{version:4.7,type:`Curve`,generator:`Curve.toJSON`}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this.cacheArcLengths=null,this}},el=class extends $c{constructor(e=0,t=0,n=1,r=1,i=0,a=Math.PI*2,o=!1,s=0){super(),this.isEllipseCurve=!0,this.type=`EllipseCurve`,this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=a,this.aClockwise=o,this.aRotation=s}getPoint(e,t=new z){let n=t,r=Math.PI*2,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<2**-52;for(;i<0;)i+=r;for(;i>r;)i-=r;i<2**-52&&(i=a?0:r),this.aClockwise===!0&&!a&&(i===r?i=-r:i-=r);let o=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){let e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),n=s-this.aX,r=c-this.aY;s=n*e-r*t+this.aX,c=n*t+r*e+this.aY}return n.set(s,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}},tl=class extends el{constructor(e,t,n,r,i,a){super(e,t,n,n,r,i,a),this.isArcCurve=!0,this.type=`ArcCurve`}},nl=/*@__PURE__*/ new B,rl=/*@__PURE__*/ new B,il=/*@__PURE__*/ new R,al=/*@__PURE__*/ new R,ol=/*@__PURE__*/ new R,sl=class extends $c{constructor(e=[],t=!1,n=`centripetal`,r=.5){super(),this.isCatmullRomCurve3=!0,this.type=`CatmullRomCurve3`,this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new B){let n=t,r=this.points,i=r.length,a=(i-+!this.closed)*e,o=Math.floor(a),s=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/i)+1)*i:s===0&&o===i-1&&(o=i-2,s=1);let c,l;this.closed||o>0?c=r[(o-1)%i]:(rl.subVectors(r[0],r[1]).add(r[0]),c=rl);let u=r[o%i],d=r[(o+1)%i];if(this.closed||o+2<i?l=r[(o+2)%i]:(nl.subVectors(r[i-1],r[i-2]).add(r[i-1]),l=nl),this.curveType===`centripetal`||this.curveType===`chordal`){let e=this.curveType===`chordal`?.5:.25,t=c.distanceToSquared(u)**+e,n=u.distanceToSquared(d)**+e,r=d.distanceToSquared(l)**+e;n<1e-4&&(n=1),t<1e-4&&(t=n),r<1e-4&&(r=n),il.initNonuniformCatmullRom(c.x,u.x,d.x,l.x,t,n,r),al.initNonuniformCatmullRom(c.y,u.y,d.y,l.y,t,n,r),ol.initNonuniformCatmullRom(c.z,u.z,d.z,l.z,t,n,r)}else this.curveType===`catmullrom`&&(il.initCatmullRom(c.x,u.x,d.x,l.x,this.tension),al.initCatmullRom(c.y,u.y,d.y,l.y,this.tension),ol.initCatmullRom(c.z,u.z,d.z,l.z,this.tension));return n.set(il.calc(s),al.calc(s),ol.calc(s)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let n=this.points[t];e.points.push(n.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(new B().fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}},cl=class extends $c{constructor(e=new z,t=new z,n=new z,r=new z){super(),this.isCubicBezierCurve=!0,this.type=`CubicBezierCurve`,this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new z){let n=t,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(ze(e,r.x,i.x,a.x,o.x),ze(e,r.y,i.y,a.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},ll=class extends $c{constructor(e=new B,t=new B,n=new B,r=new B){super(),this.isCubicBezierCurve3=!0,this.type=`CubicBezierCurve3`,this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new B){let n=t,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(ze(e,r.x,i.x,a.x,o.x),ze(e,r.y,i.y,a.y,o.y),ze(e,r.z,i.z,a.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},ul=class extends $c{constructor(e=new z,t=new z){super(),this.isLineCurve=!0,this.type=`LineCurve`,this.v1=e,this.v2=t}getPoint(e,t=new z){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new z){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},dl=class extends $c{constructor(e=new B,t=new B){super(),this.isLineCurve3=!0,this.type=`LineCurve3`,this.v1=e,this.v2=t}getPoint(e,t=new B){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new B){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},fl=class extends $c{constructor(e=new z,t=new z,n=new z){super(),this.isQuadraticBezierCurve=!0,this.type=`QuadraticBezierCurve`,this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new z){let n=t,r=this.v0,i=this.v1,a=this.v2;return n.set(Pe(e,r.x,i.x,a.x),Pe(e,r.y,i.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},pl=class extends $c{constructor(e=new B,t=new B,n=new B){super(),this.isQuadraticBezierCurve3=!0,this.type=`QuadraticBezierCurve3`,this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new B){let n=t,r=this.v0,i=this.v1,a=this.v2;return n.set(Pe(e,r.x,i.x,a.x),Pe(e,r.y,i.y,a.y),Pe(e,r.z,i.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},ml=class extends $c{constructor(e=[]){super(),this.isSplineCurve=!0,this.type=`SplineCurve`,this.points=e}getPoint(e,t=new z){let n=t,r=this.points,i=(r.length-1)*e,a=Math.floor(i),o=i-a,s=r[a===0?a:a-1],c=r[a],l=r[a>r.length-2?r.length-1:a+1],u=r[a>r.length-3?r.length-1:a+2];return n.set(Ae(o,s.x,c.x,l.x,u.x),Ae(o,s.y,c.y,l.y,u.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let n=this.points[t];e.points.push(n.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(new z().fromArray(n))}return this}},hl=/*#__PURE__*/ Object.freeze({__proto__:null,ArcCurve:tl,CatmullRomCurve3:sl,CubicBezierCurve:cl,CubicBezierCurve3:ll,EllipseCurve:el,LineCurve:ul,LineCurve3:dl,QuadraticBezierCurve:fl,QuadraticBezierCurve3:pl,SplineCurve:ml}),gl=class extends $c{constructor(){super(),this.type=`CurvePath`,this.curves=[],this.autoClose=!1,this.cacheLengths=null}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){let n=e.isVector2===!0?`LineCurve`:`LineCurve3`;this.curves.push(new hl[n](t,e))}return this}getPoint(e,t){let n=e*this.getLength(),r=this.getCurveLengths(),i=0;for(;i<r.length;){if(r[i]>=n){let e=r[i]-n,a=this.curves[i],o=a.getLength(),s=o===0?0:1-e/o;return a.getPointAt(s,t)}i++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],n;for(let r=0,i=this.curves;r<i.length;r++){let a=i[r],o=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o);for(let e=0;e<s.length;e++){let r=s[e];n&&n.equals(r)||(t.push(r),n=r)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this.cacheLengths=null,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){let n=this.curves[t];e.curves.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let n=e.curves[t];this.curves.push(new hl[n.type]().fromJSON(n))}return this.cacheLengths=null,this}},_l=class extends gl{constructor(e){super(),this.type=`Path`,this.currentPoint=new z,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let n=new ul(this.currentPoint.clone(),new z(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,r){let i=new fl(this.currentPoint.clone(),new z(e,t),new z(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this}bezierCurveTo(e,t,n,r,i,a){let o=new cl(this.currentPoint.clone(),new z(e,t),new z(n,r),new z(i,a));return this.curves.push(o),this.currentPoint.set(i,a),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),n=new ml(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,r,i,a){let o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,n,r,i,a),this}absarc(e,t,n,r,i,a){return this.absellipse(e,t,n,n,r,i,a),this}ellipse(e,t,n,r,i,a,o,s){let c=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(e+c,t+l,n,r,i,a,o,s),this}absellipse(e,t,n,r,i,a,o,s){let c=new el(e,t,n,r,i,a,o,s);if(this.curves.length>0){let e=c.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(c);let l=c.getPoint(1);return this.currentPoint.copy(l),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},vl=class extends _l{constructor(e){super(e),this.uuid=T(),this.type=`Shape`,this.holes=[]}getPointsHoles(e){let t=[];for(let n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let n=e.holes[t];this.holes.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){let n=this.holes[t];e.holes.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let n=e.holes[t];this.holes.push(new _l().fromJSON(n))}return this}},yl=class{static triangulate(e,t,n=2){return Be(e,t,n)}},bl=class e{static area(e){let t=e.length,n=0;for(let r=t-1,i=0;i<t;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return n*.5}static isClockWise(t){return e.area(t)<0}static triangulateShape(e,t){let n=[],r=[],i=[];yt(e),bt(n,e);let a=e.length;t.forEach(yt);for(let e=0;e<t.length;e++)r.push(a),a+=t[e].length,bt(n,t[e]);let o=yl.triangulate(n,r);for(let e=0;e<o.length;e+=3)i.push(o.slice(e,e+3));return i}},xl=class e extends G{constructor(e=new vl([new z(.5,.5),new z(-.5,.5),new z(-.5,-.5),new z(.5,-.5)]),t={}){super(),this.type=`ExtrudeGeometry`,this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let n=this,r=[],i=[];for(let t=0,n=e.length;t<n;t++){let n=e[t];a(n)}this.setAttribute(`position`,new W(r,3)),this.setAttribute(`uv`,new W(i,2)),this.computeVertexNormals();function a(e){let a=[],o=t.curveSegments===void 0?12:t.curveSegments,s=t.steps===void 0?1:t.steps,c=t.depth===void 0?1:t.depth,l=t.bevelEnabled===void 0||t.bevelEnabled,u=t.bevelThickness===void 0?.2:t.bevelThickness,d=t.bevelSize===void 0?u-.1:t.bevelSize,f=t.bevelOffset===void 0?0:t.bevelOffset,p=t.bevelSegments===void 0?3:t.bevelSegments,m=t.extrudePath,h=t.UVGenerator===void 0?Sl:t.UVGenerator,g,_=!1,v,y,b,x;if(m){g=m.getSpacedPoints(s),_=!0,l=!1;let e=m.isCatmullRomCurve3?m.closed:!1;v=m.computeFrenetFrames(s,e),y=new B,b=new B,x=new B}l||(p=0,u=0,d=0,f=0);let C=e.extractPoints(o),w=C.shape,T=C.holes;if(!bl.isClockWise(w)){w=w.reverse();for(let e=0,t=T.length;e<t;e++){let t=T[e];bl.isClockWise(t)&&(T[e]=t.reverse())}}function E(e){let t=e[0];for(let n=1;n<=e.length;n++){let r=n%e.length,i=e[r],a=i.x-t.x,o=i.y-t.y,s=a*a+o*o,c=Math.max(Math.abs(i.x),Math.abs(i.y),Math.abs(t.x),Math.abs(t.y));s<=10000000000000001e-36*c*c?(e.splice(r,1),n--):t=i}}E(w),T.forEach(E);let D=T.length,O=w;for(let e=0;e<D;e++){let t=T[e];w=w.concat(t)}function k(e,t,n){return t||S(`ExtrudeGeometry: vec does not exist`),e.clone().addScaledVector(t,n)}let A=w.length;function j(e,t,n){let r,i,a,o=e.x-t.x,s=e.y-t.y,c=n.x-e.x,l=n.y-e.y,u=o*o+s*s,d=o*l-s*c;if(Math.abs(d)>2**-52){let d=Math.sqrt(u),f=Math.sqrt(c*c+l*l),p=t.x-s/d,m=t.y+o/d,h=n.x-l/f,g=n.y+c/f,_=((h-p)*l-(g-m)*c)/(o*l-s*c);r=p+o*_-e.x,i=m+s*_-e.y;let v=r*r+i*i;if(v<=2)return new z(r,i);a=Math.sqrt(v/2)}else{let e=!1;o>2**-52?c>2**-52&&(e=!0):o<-(2**-52)?c<-(2**-52)&&(e=!0):Math.sign(s)===Math.sign(l)&&(e=!0),e?(r=-s,i=o,a=Math.sqrt(u)):(r=o,i=s,a=Math.sqrt(u/2))}return new z(r/a,i/a)}let M=[];for(let e=0,t=O.length,n=t-1,r=e+1;e<t;e++,n++,r++)n===t&&(n=0),r===t&&(r=0),M[e]=j(O[e],O[n],O[r]);let N=[],P,F=M.concat();for(let e=0,t=D;e<t;e++){let t=T[e];P=[];for(let e=0,n=t.length,r=n-1,i=e+1;e<n;e++,r++,i++)r===n&&(r=0),i===n&&(i=0),P[e]=j(t[e],t[r],t[i]);N.push(P),F=F.concat(P)}let ee;if(p===0)ee=bl.triangulateShape(O,T);else{let e=[],t=[];for(let n=0;n<p;n++){let r=n/p,i=u*Math.cos(r*Math.PI/2),a=d*Math.sin(r*Math.PI/2)+f;for(let t=0,n=O.length;t<n;t++){let n=k(O[t],M[t],a);I(n.x,n.y,-i),r===0&&e.push(n)}for(let e=0,n=D;e<n;e++){let n=T[e];P=N[e];let o=[];for(let e=0,t=n.length;e<t;e++){let t=k(n[e],P[e],a);I(t.x,t.y,-i),r===0&&o.push(t)}r===0&&t.push(o)}}ee=bl.triangulateShape(e,t)}let te=ee.length,ne=d+f;for(let e=0;e<A;e++){let t=l?k(w[e],F[e],ne):w[e];_?(b.copy(v.normals[0]).multiplyScalar(t.x),y.copy(v.binormals[0]).multiplyScalar(t.y),x.copy(g[0]).add(b).add(y),I(x.x,x.y,x.z)):I(t.x,t.y,0)}for(let e=1;e<=s;e++)for(let t=0;t<A;t++){let n=l?k(w[t],F[t],ne):w[t];_?(b.copy(v.normals[e]).multiplyScalar(n.x),y.copy(v.binormals[e]).multiplyScalar(n.y),x.copy(g[e]).add(b).add(y),I(x.x,x.y,x.z)):I(n.x,n.y,c/s*e)}for(let e=p-1;e>=0;e--){let t=e/p,n=u*Math.cos(t*Math.PI/2),r=d*Math.sin(t*Math.PI/2)+f;for(let e=0,t=O.length;e<t;e++){let t=k(O[e],M[e],r);I(t.x,t.y,c+n)}for(let e=0,t=T.length;e<t;e++){let t=T[e];P=N[e];for(let e=0,i=t.length;e<i;e++){let i=k(t[e],P[e],r);_?I(i.x,i.y+g[s-1].y,g[s-1].x+n):I(i.x,i.y,c+n)}}}re(),ie();function re(){let e=r.length/3;if(l){let e=0,t=A*e;for(let e=0;e<te;e++){let n=ee[e];oe(n[2]+t,n[1]+t,n[0]+t)}e=s+p*2,t=A*e;for(let e=0;e<te;e++){let n=ee[e];oe(n[0]+t,n[1]+t,n[2]+t)}}else{for(let e=0;e<te;e++){let t=ee[e];oe(t[2],t[1],t[0])}for(let e=0;e<te;e++){let t=ee[e];oe(t[0]+A*s,t[1]+A*s,t[2]+A*s)}}n.addGroup(e,r.length/3-e,0)}function ie(){let e=r.length/3,t=0;ae(O,t),t+=O.length;for(let e=0,n=T.length;e<n;e++){let n=T[e];ae(n,t),t+=n.length}n.addGroup(e,r.length/3-e,1)}function ae(e,t){let n=e.length;for(;--n>=0;){let r=n,i=n-1;i<0&&(i=e.length-1);for(let e=0,n=s+p*2;e<n;e++){let n=A*e,a=A*(e+1);se(t+r+n,t+i+n,t+i+a,t+r+a)}}}function I(e,t,n){a.push(e),a.push(t),a.push(n)}function oe(e,t,i){ce(e),ce(t),ce(i);let a=r.length/3,o=h.generateTopUV(n,r,a-3,a-2,a-1);le(o[0]),le(o[1]),le(o[2])}function se(e,t,i,a){ce(e),ce(t),ce(a),ce(t),ce(i),ce(a);let o=r.length/3,s=h.generateSideWallUV(n,r,o-6,o-3,o-2,o-1);le(s[0]),le(s[1]),le(s[3]),le(s[1]),le(s[2]),le(s[3])}function ce(e){r.push(a[e*3+0]),r.push(a[e*3+1]),r.push(a[e*3+2])}function le(e){i.push(e.x),i.push(e.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return xt(t,n,e)}static fromJSON(t,n){let r=[];for(let e=0,i=t.shapes.length;e<i;e++){let i=n[t.shapes[e]];r.push(i)}let i=t.options.extrudePath;return i!==void 0&&(t.options.extrudePath=new hl[i.type]().fromJSON(i)),new e(r,t.options)}},Sl={generateTopUV:function(e,t,n,r,i){let a=t[n*3],o=t[n*3+1],s=t[r*3],c=t[r*3+1],l=t[i*3],u=t[i*3+1];return[new z(a,o),new z(s,c),new z(l,u)]},generateSideWallUV:function(e,t,n,r,i,a){let o=t[n*3],s=t[n*3+1],c=t[n*3+2],l=t[r*3],u=t[r*3+1],d=t[r*3+2],f=t[i*3],p=t[i*3+1],m=t[i*3+2],h=t[a*3],g=t[a*3+1],_=t[a*3+2];return Math.abs(s-u)<Math.abs(o-l)?[new z(o,1-c),new z(l,1-d),new z(f,1-m),new z(h,1-_)]:[new z(s,1-c),new z(u,1-d),new z(p,1-m),new z(g,1-_)]}},Cl=class e extends Kc{constructor(e=1,t=0){let n=(1+Math.sqrt(5))/2,r=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1];super(r,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type=`IcosahedronGeometry`,this.parameters={radius:e,detail:t}}static fromJSON(t){return new e(t.radius,t.detail)}},wl=class e extends G{constructor(e=[new z(0,-.5),new z(.5,0),new z(0,.5)],t=12,n=0,r=Math.PI*2){super(),this.type=`LatheGeometry`,this.parameters={points:e,segments:t,phiStart:n,phiLength:r},t=Math.floor(t),r=E(r,0,Math.PI*2);let i=[],a=[],o=[],s=[],c=[],l=1/t,u=new B,d=new z,f=new B,p=new B,m=new B,h=0,g=0;for(let t=0;t<=e.length-1;t++)switch(t){case 0:h=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,f.x=g*1,f.y=-h,f.z=g*0,m.copy(f),f.normalize(),s.push(f.x,f.y,f.z);break;case e.length-1:m.normalize(),s.push(m.x,m.y,m.z);break;default:h=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,f.x=g*1,f.y=-h,f.z=g*0,p.copy(f),f.x+=m.x,f.y+=m.y,f.z+=m.z,f.normalize(),s.push(f.x,f.y,f.z),m.copy(p)}for(let i=0;i<=t;i++){let f=n+i*l*r,p=Math.sin(f),m=Math.cos(f);for(let n=0;n<=e.length-1;n++){u.x=e[n].x*p,u.y=e[n].y,u.z=e[n].x*m,a.push(u.x,u.y,u.z),d.x=i/t,d.y=n/(e.length-1),o.push(d.x,d.y);let r=s[3*n+0]*p,l=s[3*n+1],f=s[3*n+0]*m;c.push(r,l,f)}}for(let n=0;n<t;n++)for(let t=0;t<e.length-1;t++){let r=t+n*e.length,a=r,o=r+e.length,s=r+e.length+1,c=r+1;i.push(a,o,c),i.push(s,c,o)}this.setIndex(i),this.setAttribute(`position`,new W(a,3)),this.setAttribute(`uv`,new W(o,2)),this.setAttribute(`normal`,new W(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.points,t.segments,t.phiStart,t.phiLength)}},Tl=class e extends Kc{constructor(e=1,t=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type=`OctahedronGeometry`,this.parameters={radius:e,detail:t}}static fromJSON(t){return new e(t.radius,t.detail)}},El=class e extends G{constructor(e=1,t=1,n=1,r=1){super(),this.type=`PlaneGeometry`,this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};let i=e/2,a=t/2,o=Math.floor(n),s=Math.floor(r),c=o+1,l=s+1,u=e/o,d=t/s,f=[],p=[],m=[],h=[];for(let e=0;e<l;e++){let t=e*d-a;for(let n=0;n<c;n++){let r=n*u-i;p.push(r,-t,0),m.push(0,0,1),h.push(n/o),h.push(1-e/s)}}for(let e=0;e<s;e++)for(let t=0;t<o;t++){let n=t+c*e,r=t+c*(e+1),i=t+1+c*(e+1),a=t+1+c*e;f.push(n,r,a),f.push(r,i,a)}this.setIndex(f),this.setAttribute(`position`,new W(p,3)),this.setAttribute(`normal`,new W(m,3)),this.setAttribute(`uv`,new W(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.width,t.height,t.widthSegments,t.heightSegments)}},Dl=class e extends G{constructor(e=.5,t=1,n=32,r=1,i=0,a=Math.PI*2){super(),this.type=`RingGeometry`,this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},n=Math.max(3,n),r=Math.max(1,r);let o=[],s=[],c=[],l=[],u=e,d=(t-e)/r,f=new B,p=new z;for(let e=0;e<=r;e++){for(let e=0;e<=n;e++){let r=i+e/n*a;f.x=u*Math.cos(r),f.y=u*Math.sin(r),s.push(f.x,f.y,f.z),c.push(0,0,1),p.x=(f.x/t+1)/2,p.y=(f.y/t+1)/2,l.push(p.x,p.y)}u+=d}for(let e=0;e<r;e++){let t=e*(n+1);for(let e=0;e<n;e++){let r=e+t,i=r,a=r+n+1,s=r+n+2,c=r+1;o.push(i,a,c),o.push(a,s,c)}}this.setIndex(o),this.setAttribute(`position`,new W(s,3)),this.setAttribute(`normal`,new W(c,3)),this.setAttribute(`uv`,new W(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}},Ol=class e extends G{constructor(e=new vl([new z(0,.5),new z(-.5,-.5),new z(.5,-.5)]),t=12){super(),this.type=`ShapeGeometry`,this.parameters={shapes:e,curveSegments:t};let n=[],r=[],i=[],a=[],o=0,s=0;if(Array.isArray(e)===!1)c(e);else for(let t=0;t<e.length;t++)c(e[t]),this.addGroup(o,s,t),o+=s,s=0;this.setIndex(n),this.setAttribute(`position`,new W(r,3)),this.setAttribute(`normal`,new W(i,3)),this.setAttribute(`uv`,new W(a,2));function c(e){let o=r.length/3,c=e.extractPoints(t),l=c.shape,u=c.holes;bl.isClockWise(l)===!1&&(l=l.reverse());for(let e=0,t=u.length;e<t;e++){let t=u[e];bl.isClockWise(t)===!0&&(u[e]=t.reverse())}let d=bl.triangulateShape(l,u);for(let e=0,t=u.length;e<t;e++){let t=u[e];l=l.concat(t)}for(let e=0,t=l.length;e<t;e++){let t=l[e];r.push(t.x,t.y,0),i.push(0,0,1),a.push(t.x,t.y)}for(let e=0,t=d.length;e<t;e++){let t=d[e],r=t[0]+o,i=t[1]+o,a=t[2]+o;n.push(r,i,a),s+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes;return St(t,e)}static fromJSON(t,n){let r=[];for(let e=0,i=t.shapes.length;e<i;e++){let i=n[t.shapes[e]];r.push(i)}return new e(r,t.curveSegments)}},kl=class e extends G{constructor(e=1,t=32,n=16,r=0,i=Math.PI*2,a=0,o=Math.PI){super(),this.type=`SphereGeometry`,this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));let s=Math.min(a+o,Math.PI),c=0,l=[],u=new B,d=new B,f=[],p=[],m=[],h=[];for(let f=0;f<=n;f++){let g=[],_=f/n,v=a+_*o,y=e*Math.cos(v),b=Math.sqrt(e*e-y*y),x=0;f===0&&a===0?x=.5/t:f===n&&s===Math.PI&&(x=-.5/t);for(let e=0;e<=t;e++){let n=e/t,a=r+n*i;u.x=-b*Math.cos(a),u.y=y,u.z=b*Math.sin(a),p.push(u.x,u.y,u.z),d.copy(u).normalize(),m.push(d.x,d.y,d.z),h.push(n+x,1-_),g.push(c++)}l.push(g)}for(let e=0;e<n;e++)for(let r=0;r<t;r++){let t=l[e][r+1],i=l[e][r],o=l[e+1][r],c=l[e+1][r+1];(e!==0||a>0)&&f.push(t,i,c),(e!==n-1||s<Math.PI)&&f.push(i,o,c)}this.setIndex(f),this.setAttribute(`position`,new W(p,3)),this.setAttribute(`normal`,new W(m,3)),this.setAttribute(`uv`,new W(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}},Al=class e extends Kc{constructor(e=1,t=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type=`TetrahedronGeometry`,this.parameters={radius:e,detail:t}}static fromJSON(t){return new e(t.radius,t.detail)}},jl=class e extends G{constructor(e=1,t=.4,n=12,r=48,i=Math.PI*2,a=0,o=Math.PI*2){super(),this.type=`TorusGeometry`,this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i,thetaStart:a,thetaLength:o},n=Math.floor(n),r=Math.floor(r);let s=[],c=[],l=[],u=[],d=new B,f=new B,p=new B;for(let s=0;s<=n;s++){let m=a+s/n*o;for(let a=0;a<=r;a++){let o=a/r*i;f.x=(e+t*Math.cos(m))*Math.cos(o),f.y=(e+t*Math.cos(m))*Math.sin(o),f.z=t*Math.sin(m),c.push(f.x,f.y,f.z),d.x=e*Math.cos(o),d.y=e*Math.sin(o),p.subVectors(f,d).normalize(),l.push(p.x,p.y,p.z),u.push(a/r),u.push(s/n)}}for(let e=1;e<=n;e++)for(let t=1;t<=r;t++){let n=(r+1)*e+t-1,i=(r+1)*(e-1)+t-1,a=(r+1)*(e-1)+t,o=(r+1)*e+t;s.push(n,i,o),s.push(i,a,o)}this.setIndex(s),this.setAttribute(`position`,new W(c,3)),this.setAttribute(`normal`,new W(l,3)),this.setAttribute(`uv`,new W(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc,t.thetaStart,t.thetaLength)}},Ml=class e extends G{constructor(e=1,t=.4,n=64,r=8,i=2,a=3){super(),this.type=`TorusKnotGeometry`,this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:a},n=Math.floor(n),r=Math.floor(r);let o=[],s=[],c=[],l=[],u=new B,d=new B,f=new B,p=new B,m=new B,h=new B,g=new B;for(let o=0;o<=n;++o){let v=o/n*i*Math.PI*2;_(v,i,a,e,f),_(v+.01,i,a,e,p),h.subVectors(p,f),g.addVectors(p,f),m.crossVectors(h,g),g.crossVectors(m,h),m.normalize(),g.normalize();for(let e=0;e<=r;++e){let i=e/r*Math.PI*2,a=-t*Math.cos(i),p=t*Math.sin(i);u.x=f.x+(a*g.x+p*m.x),u.y=f.y+(a*g.y+p*m.y),u.z=f.z+(a*g.z+p*m.z),s.push(u.x,u.y,u.z),d.subVectors(u,f).normalize(),c.push(d.x,d.y,d.z),l.push(o/n),l.push(e/r)}}for(let e=1;e<=n;e++)for(let t=1;t<=r;t++){let n=(r+1)*(e-1)+(t-1),i=(r+1)*e+(t-1),a=(r+1)*e+t,s=(r+1)*(e-1)+t;o.push(n,i,s),o.push(i,a,s)}this.setIndex(o),this.setAttribute(`position`,new W(s,3)),this.setAttribute(`normal`,new W(c,3)),this.setAttribute(`uv`,new W(l,2));function _(e,t,n,r,i){let a=Math.cos(e),o=Math.sin(e),s=n/t*e,c=Math.cos(s);i.x=r*(2+c)*.5*a,i.y=r*(2+c)*o*.5,i.z=r*Math.sin(s)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}},Nl=class e extends G{constructor(e=new pl(new B(-1,-1,0),new B(-1,1,0),new B(1,1,0)),t=64,n=1,r=8,i=!1){super(),this.type=`TubeGeometry`,this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i};let a=e.computeFrenetFrames(t,i);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;let o=new B,s=new B,c=new z,l=new B,u=[],d=[],f=[],p=[];m(),this.setIndex(p),this.setAttribute(`position`,new W(u,3)),this.setAttribute(`normal`,new W(d,3)),this.setAttribute(`uv`,new W(f,2));function m(){for(let e=0;e<t;e++)h(e);h(i===!1?t:0),_(),g()}function h(i){l=e.getPointAt(i/t,l);let c=a.normals[i],f=a.binormals[i];for(let e=0;e<=r;e++){let t=e/r*Math.PI*2,i=Math.sin(t),a=-Math.cos(t);s.x=a*c.x+i*f.x,s.y=a*c.y+i*f.y,s.z=a*c.z+i*f.z,s.normalize(),d.push(s.x,s.y,s.z),o.x=l.x+n*s.x,o.y=l.y+n*s.y,o.z=l.z+n*s.z,u.push(o.x,o.y,o.z)}}function g(){for(let e=1;e<=t;e++)for(let t=1;t<=r;t++){let n=(r+1)*(e-1)+(t-1),i=(r+1)*e+(t-1),a=(r+1)*e+t,o=(r+1)*(e-1)+t;p.push(n,i,o),p.push(i,a,o)}}function _(){for(let e=0;e<=t;e++)for(let n=0;n<=r;n++)c.x=e/t,c.y=n/r,f.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(t){return new e(new hl[t.path.type]().fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}},Pl=class extends G{constructor(e=null){if(super(),this.type=`WireframeGeometry`,this.parameters={geometry:e},e!==null){let t=[],n=/* @__PURE__ */ new Set,r=new B,i=new B;if(e.index!==null){let a=e.attributes.position,o=e.index,s=e.groups;s.length===0&&(s=[{start:0,count:o.count,materialIndex:0}]);for(let e=0,c=s.length;e<c;++e){let c=s[e],l=c.start,u=c.count;for(let e=l,s=l+u;e<s;e+=3)for(let s=0;s<3;s++){let c=o.getX(e+s),l=o.getX(e+(s+1)%3);r.fromBufferAttribute(a,c),i.fromBufferAttribute(a,l),Ct(r,i,n)===!0&&(t.push(r.x,r.y,r.z),t.push(i.x,i.y,i.z))}}}else{let a=e.attributes.position;for(let e=0,o=a.count/3;e<o;e++)for(let o=0;o<3;o++){let s=3*e+o,c=3*e+(o+1)%3;r.fromBufferAttribute(a,s),i.fromBufferAttribute(a,c),Ct(r,i,n)===!0&&(t.push(r.x,r.y,r.z),t.push(i.x,i.y,i.z))}}this.setAttribute(`position`,new W(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}},Fl=/*#__PURE__*/ Object.freeze({__proto__:null,BoxGeometry:Vc,CapsuleGeometry:Hc,CircleGeometry:Uc,ConeGeometry:Gc,CylinderGeometry:Wc,DodecahedronGeometry:qc,EdgesGeometry:Qc,ExtrudeGeometry:xl,IcosahedronGeometry:Cl,LatheGeometry:wl,OctahedronGeometry:Tl,PlaneGeometry:El,PolyhedronGeometry:Kc,RingGeometry:Dl,ShapeGeometry:Ol,SphereGeometry:kl,TetrahedronGeometry:Al,TorusGeometry:jl,TorusKnotGeometry:Ml,TubeGeometry:Nl,WireframeGeometry:Pl}),Il=class extends Lo{constructor(e){super(),this.isShadowMaterial=!0,this.type=`ShadowMaterial`,this.color=new H(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}},Ll={clone:wt,merge:Tt},Rl=`void main() {
1
+ var e=Object.defineProperty,t=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},n=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},r=`0.2.1`,i=/\{data\.([a-zA-Z_$][\w$-]*(?:\.[a-zA-Z_$][\w$-]*)*)(?:\|([^}]*))?\}/g;function a(e,t){let n=e;for(let e of t.split(`.`)){if(typeof n!=`object`||!n)return;n=n[e]}return n}function o(e){return typeof e!=`string`||!e.includes(`{data.`)?!1:(i.lastIndex=0,i.test(e))}function s(e,t){return e.includes(`{data.`)?e.replace(i,(e,n,r)=>{let i=a(t,n);return i==null||i===``?r??``:typeof i==`object`?JSON.stringify(i):String(i)}):e}var c=/^\{data\.([a-zA-Z_$][\w$-]*(?:\.[a-zA-Z_$][\w$-]*)*)(?:\|([^}]*))?\}$/;function l(e,t){if(typeof e!=`string`||!e.includes(`{data.`))return e;let n=c.exec(e.trim());if(!n)return s(e,t);let r=a(t,n[1]);if(r!=null&&r!==``)return r;if(n[2]!==void 0)try{return JSON.parse(n[2])}catch{return n[2]}}function u(e,t=e.data){let n=!1,r=e=>o(e)?(n=!0,s(e,t)):e,i=e=>{if(typeof e==`string`)return o(e)?(n=!0,l(e,t)):e;if(Array.isArray(e)){let t=e.map(i);return t.every((t,n)=>t===e[n])?e:t}if(e&&typeof e==`object`){let t=!1,n={};for(let[r,a]of Object.entries(e)){let e=i(a);e!==a&&(t=!0),e!==void 0&&(n[r]=e)}return t?n:e}return e},a=e=>{let t=e,n=t.kind===`text`?r(t.text):t.text,o=r(t.href),s=t.kind===`generator`&&t.params?i(t.params):t.params,c=e.children?.map(a);return n===t.text&&o===t.href&&s===t.params&&(!c||c.every((t,n)=>t===e.children[n]))?e:{...e,...t.kind===`text`?{text:n}:{},...t.href===void 0?{}:{href:o},...s===t.params?{}:{params:s},...c?{children:c}:{}}},c=e.interactions?.map(e=>{let t=e.do;if(!Array.isArray(t))return e;let n=t.map(e=>{let t=e;return!t||typeof t!=`object`||!o(t.openUrl)?e:{...t,openUrl:r(t.openUrl)}});return n.every((e,n)=>e===t[n])?e:{...e,do:n}}),u=(e.objects??[]).map(a),d=r(e.title),f=r(e.ariaLabel),p=e.ui?.elements?.map(e=>{let t=e,n=r(t.text);return n===t.text?e:{...e,text:n}});return n?{...e,title:d,...e.ariaLabel===void 0?{}:{ariaLabel:f},objects:u,...e.ui&&p?{ui:{...e.ui,elements:p}}:{},...c?{interactions:c}:{}}:e}function d(e){let t={};for(let[n,r]of Object.entries(e))if(r!==void 0){if(n===`json`)try{let e=JSON.parse(r);e&&typeof e==`object`&&!Array.isArray(e)&&Object.assign(t,e)}catch{}else t[n]=r}return t}function f(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function p(e,t){return new mi[e](t)}function m(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function h(e){return document.createElementNS(`http://www.w3.org/1999/xhtml`,e)}function g(){let e=h(`canvas`);return e.style.display=`block`,e}function _(e){gi=e}function v(){return gi}function y(...e){let t=`THREE.`+e.shift();gi?gi(`log`,t,...e):console.log(t,...e)}function b(e){let t=e[0];if(typeof t==`string`&&t.startsWith(`TSL:`)){let t=e[1];t&&t.isStackTrace?e[0]+=` `+t.getLocation():e[1]=`Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.`}return e}function x(...e){e=b(e);let t=`THREE.`+e.shift();if(gi)gi(`warn`,t,...e);else{let n=e[0];n&&n.isStackTrace?console.warn(n.getError(t)):console.warn(t,...e)}}function S(...e){e=b(e);let t=`THREE.`+e.shift();if(gi)gi(`error`,t,...e);else{let n=e[0];n&&n.isStackTrace?console.error(n.getError(t)):console.error(t,...e)}}function C(...e){let t=e.join(` `);t in hi||(hi[t]=!0,x(...e))}function w(e,t,n){return new Promise(function(r,i){function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:r()}}setTimeout(a,n)})}function T(){let e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(yi[e&255]+yi[e>>8&255]+yi[e>>16&255]+yi[e>>24&255]+`-`+yi[t&255]+yi[t>>8&255]+`-`+yi[t>>16&15|64]+yi[t>>24&255]+`-`+yi[n&63|128]+yi[n>>8&255]+`-`+yi[n>>16&255]+yi[n>>24&255]+yi[r&255]+yi[r>>8&255]+yi[r>>16&255]+yi[r>>24&255]).toLowerCase()}function E(e,t,n){return Math.max(t,Math.min(n,e))}function D(e,t){return(e%t+t)%t}function O(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)}function k(e,t,n){return e===t?0:(n-e)/(t-e)}function A(e,t,n){return(1-n)*e+n*t}function j(e,t,n,r){return A(e,t,1-Math.exp(-n*r))}function M(e,t=1){return t-Math.abs(D(e,t*2)-t)}function N(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))}function P(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10))}function F(e,t){return e+Math.floor(Math.random()*(t-e+1))}function ee(e,t){return e+Math.random()*(t-e)}function te(e){return e*(.5-Math.random())}function ne(e){e!==void 0&&(bi=e);let t=bi+=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 re(e){return e*xi}function ie(e){return e*Si}function ae(e){return e>0&&Number.isInteger(e)&&2**Math.round(Math.log2(e))===e}function I(e){return 2**Math.ceil(Math.log(e)/Math.LN2)}function oe(e){return 2**Math.floor(Math.log(e)/Math.LN2)}function se(e,t,n,r,i){let a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+r)/2),u=o((t+r)/2),d=a((t-r)/2),f=o((t-r)/2),p=a((r-t)/2),m=o((r-t)/2);switch(i){case`XYX`:e.set(s*u,c*d,c*f,s*l);break;case`YZY`:e.set(c*f,s*u,c*d,s*l);break;case`ZXZ`:e.set(c*d,c*f,s*u,s*l);break;case`XZX`:e.set(s*u,c*m,c*p,s*l);break;case`YXY`:e.set(c*p,s*u,c*m,s*l);break;case`ZYZ`:e.set(c*m,c*p,s*u,s*l);break;default:x(`MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: `+i)}}function ce(e){switch(e.constructor){case Uint32Array:return 4294967295;case Uint16Array:return 65535;case Uint8Array:case Uint8ClampedArray:return 255;case Int32Array:return 2147483647;case Int16Array:return 32767;case Int8Array:return 127;default:return}}function le(e,t){if(t.constructor===Float32Array)return e;let n=ce(t);if(n===void 0)throw Error(`THREE.MathUtils: Invalid component type.`);return Math.max(e/n,-1)}function ue(e,t){if(t.constructor===Float32Array)return e;let n=ce(t);if(n===void 0)throw Error(`THREE.MathUtils: Invalid component type.`);return Math.round(e*n)}function de(){let e={enabled:!0,workingColorSpace:Vr,spaces:{},convert:function(e,t,n){return this.enabled===!1||t===n||!t||!n||(this.spaces[t].transfer===`srgb`&&(e.r=fe(e.r),e.g=fe(e.g),e.b=fe(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===`srgb`&&(e.r=pe(e.r),e.g=pe(e.g),e.b=pe(e.b))),e},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===``?Hr:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||`standard`},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[n].fromXYZ).multiply(this.spaces[t].toXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return e.define({[Vr]:{primaries:t,whitePoint:r,transfer:Hr,toXYZ:ki,fromXYZ:Ai,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:Br},outputColorSpaceConfig:{drawingBufferColorSpace:Br}},[Br]:{primaries:t,whitePoint:r,transfer:Ur,toXYZ:ki,fromXYZ:Ai,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:Br}}}),e}function fe(e){return e<.04045?e*.0773993808:(e*.9478672986+.0521327014)**2.4}function pe(e){return e<.0031308?e*12.92:1.055*e**.41666-.055}function me(e){return typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap?Ni.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(x(`Texture: Unable to serialize Texture.`),{})}function he(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}function ge(e,t,n,r,i){for(let a=0,o=e.length-3;a<=o;a+=3){ro.fromArray(e,a);let o=i.x*Math.abs(ro.x)+i.y*Math.abs(ro.y)+i.z*Math.abs(ro.z),s=t.dot(ro),c=n.dot(ro),l=r.dot(ro);if(Math.max(-Math.max(s,c,l),Math.min(s,c,l))>o)return!1}return!0}function _e(){let e=/* @__PURE__ */ new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),r=/* @__PURE__ */ new Uint32Array(512),i=/* @__PURE__ */ new Uint32Array(512);for(let e=0;e<256;++e){let t=e-127;t<-27?(r[e]=0,r[e|256]=32768,i[e]=24,i[e|256]=24):t<-14?(r[e]=1024>>-t-14,r[e|256]=1024>>-t-14|32768,i[e]=-t-1,i[e|256]=-t-1):t<=15?(r[e]=t+15<<10,r[e|256]=t+15<<10|32768,i[e]=13,i[e|256]=13):t<128?(r[e]=31744,r[e|256]=64512,i[e]=24,i[e|256]=24):(r[e]=31744,r[e|256]=64512,i[e]=13,i[e|256]=13)}let a=/* @__PURE__ */ new Uint32Array(2048),o=/* @__PURE__ */ new Uint32Array(64),s=/* @__PURE__ */ new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,n=0;for(;!(t&8388608);)t<<=1,n-=8388608;t&=-8388609,n+=947912704,a[e]=t|n}for(let e=1024;e<2048;++e)a[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)o[e]=e<<23;o[31]=1199570944,o[32]=2147483648;for(let e=33;e<63;++e)o[e]=2147483648+(e-32<<23);o[63]=3347054592;for(let e=1;e<64;++e)e!==32&&(s[e]=1024);return{floatView:t,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:a,exponentTable:o,offsetTable:s}}function ve(e){Math.abs(e)>65504&&x(`DataUtils.toHalfFloat(): Value out of range.`),e=E(e,-65504,65504),io.floatView[0]=e;let t=io.uint32View[0],n=t>>23&511;return io.baseTable[n]+((t&8388607)>>io.shiftTable[n])}function ye(e){let t=e>>10;return io.uint32View[0]=io.mantissaTable[io.offsetTable[t]+(e&1023)]+io.exponentTable[t],io.floatView[0]}function be(e){return e.buffer._uuid===void 0&&(e.buffer._uuid=T()),e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e.buffer._uuid:e.buffer._uuid+`:`+e.byteOffset+`:`+e.byteLength}function xe(e,t,n,r,i,a){Uo.subVectors(e,n).addScalar(.5).multiply(r),i===void 0?Wo.copy(Uo):(Wo.x=a*Uo.x-i*Uo.y,Wo.y=i*Uo.x+a*Uo.y),e.copy(t),e.x+=Wo.x,e.y+=Wo.y,e.applyMatrix4(Go)}function Se(e,t,n,r,i,a,o,s){let c;if(c=t.side===1?r.intersectTriangle(o,a,i,!0,s):r.intersectTriangle(i,a,o,t.side===0,s),c===null)return null;vs.copy(s),vs.applyMatrix4(e.matrixWorld);let l=n.ray.origin.distanceTo(vs);return l<n.near||l>n.far?null:{distance:l,point:vs.clone(),object:e}}function Ce(e,t,n,r,i,a,o,s,c,l){e.getVertexPosition(s,fs),e.getVertexPosition(c,ps),e.getVertexPosition(l,ms);let u=Se(e,t,n,r,fs,ps,ms,_s);if(u){let e=new B;Ua.getBarycoord(_s,fs,ps,ms,e),i&&(u.uv=Ua.getInterpolatedAttribute(i,s,c,l,e,new z)),a&&(u.uv1=Ua.getInterpolatedAttribute(a,s,c,l,e,new z)),o&&(u.normal=Ua.getInterpolatedAttribute(o,s,c,l,e,new B),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));let t={a:s,b:c,c:l,normal:new B,materialIndex:0};Ua.getNormal(fs,ps,ms,t.normal),u.face=t,u.barycoord=e}return u}function we(e,t){return e-t}function Te(e,t){return e.z-t.z}function Ee(e,t){return t.z-e.z}function L(e,t,n=0){let r=t.itemSize;if(e.isInterleavedBufferAttribute||e.array.constructor!==t.array.constructor){let i=e.count;for(let a=0;a<i;a++)for(let i=0;i<r;i++)t.setComponent(a+n,i,e.getComponent(a,i))}else t.array.set(e.array,n*r);t.needsUpdate=!0}function De(e,t){if(e.constructor!==t.constructor){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)t[r]=e[r]}else{let n=Math.min(e.length,t.length);t.set(new e.constructor(e.buffer,0,n))}}function Oe(e,t,n,r,i,a,o){let s=e.geometry.attributes.position;if(dc.fromBufferAttribute(s,i),fc.fromBufferAttribute(s,a),n.distanceSqToSegment(dc,fc,gc,_c)>r)return;gc.applyMatrix4(e.matrixWorld);let c=t.ray.origin.distanceTo(gc);if(!(c<t.near||c>t.far))return{distance:c,point:_c.clone().applyMatrix4(e.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:e}}function ke(e,t,n,r,i,a,o){let s=Tc.distanceSqToPoint(e);if(s<n){let n=new B;Tc.closestPointToPoint(e,n),n.applyMatrix4(r);let c=i.ray.origin.distanceTo(n);if(c<i.near||c>i.far)return;a.push({distance:c,distanceToRay:Math.sqrt(s),point:n,index:t,face:null,faceIndex:null,barycoord:null,object:o})}}function R(){let e=0,t=0,n=0,r=0;function i(i,a,o,s){e=i,t=o,n=-3*i+3*a-2*o-s,r=2*i-2*a+o+s}return{initCatmullRom:function(e,t,n,r,a){i(t,n,a*(n-e),a*(r-t))},initNonuniformCatmullRom:function(e,t,n,r,a,o,s){let c=(t-e)/a-(n-e)/(a+o)+(n-t)/o,l=(n-t)/o-(r-t)/(o+s)+(r-n)/s;c*=o,l*=o,i(t,n,c,l)},calc:function(i){let a=i*i,o=a*i;return e+t*i+n*a+r*o}}}function Ae(e,t,n,r,i){let a=(r-t)*.5,o=(i-n)*.5,s=e*e,c=e*s;return(2*n-2*r+a+o)*c+(-3*n+3*r-2*a-o)*s+a*e+n}function je(e,t){let n=1-e;return n*n*t}function Me(e,t){return 2*(1-e)*e*t}function Ne(e,t){return e*e*t}function Pe(e,t,n,r){return je(e,t)+Me(e,n)+Ne(e,r)}function Fe(e,t){let n=1-e;return n*n*n*t}function Ie(e,t){let n=1-e;return 3*n*n*e*t}function Le(e,t){return 3*(1-e)*e*e*t}function Re(e,t){return e*e*e*t}function ze(e,t,n,r,i){return Fe(e,t)+Ie(e,n)+Le(e,r)+Re(e,i)}function Be(e,t,n=2){let r=t&&t.length,i=r?t[0]*n:e.length,a=Ve(e,0,i,n,!0),o=[];if(!a||a.next===a.prev)return o;let s,c,l;if(r&&(a=Je(e,t,a,n)),e.length>80*n){s=e[0],c=e[1];let t=s,r=c;for(let a=n;a<i;a+=n){let n=e[a],i=e[a+1];n<s&&(s=n),i<c&&(c=i),n>t&&(t=n),i>r&&(r=i)}l=Math.max(t-s,r-c),l=l===0?0:32767/l}return Ue(a,o,n,s,c,l,0),o}function Ve(e,t,n,r,i){let a;if(i===vt(e,t,n,r)>0)for(let i=t;i<n;i+=r)a=ht(i/r|0,e[i],e[i+1],a);else for(let i=n-r;i>=t;i-=r)a=ht(i/r|0,e[i],e[i+1],a);return a&&st(a,a.next)&&(gt(a),a=a.next),a}function He(e,t){if(!e)return e;t||=e;let n=e,r;do if(r=!1,!n.steiner&&(st(n,n.next)||ot(n.prev,n,n.next)===0)){if(gt(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function Ue(e,t,n,r,i,a,o){if(!e)return;!o&&a&&$e(e,r,i,a);let s=e;for(;e.prev!==e.next;){let c=e.prev,l=e.next;if(a?Ge(e,r,i,a):We(e))t.push(c.i,e.i,l.i),gt(e),e=l.next,s=l.next;else if(e=l,e===s){o?o===1?(e=Ke(He(e),t),Ue(e,t,n,r,i,a,2)):o===2&&qe(e,t,n,r,i,a):Ue(He(e),t,n,r,i,a,1);break}}}function We(e){let t=e.prev,n=e,r=e.next;if(ot(t,n,r)>=0)return!1;let i=t.x,a=n.x,o=r.x,s=t.y,c=n.y,l=r.y,u=Math.min(i,a,o),d=Math.min(s,c,l),f=Math.max(i,a,o),p=Math.max(s,c,l),m=r.next;for(;m!==t;){if(m.x>=u&&m.x<=f&&m.y>=d&&m.y<=p&&it(i,s,a,c,o,l,m.x,m.y)&&ot(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Ge(e,t,n,r){let i=e.prev,a=e,o=e.next;if(ot(i,a,o)>=0)return!1;let s=i.x,c=a.x,l=o.x,u=i.y,d=a.y,f=o.y,p=Math.min(s,c,l),m=Math.min(u,d,f),h=Math.max(s,c,l),g=Math.max(u,d,f),_=tt(p,m,t,n,r),v=tt(h,g,t,n,r),y=e.prevZ,b=e.nextZ;for(;y&&y.z>=_&&b&&b.z<=v;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&it(s,u,c,d,l,f,y.x,y.y)&&ot(y.prev,y,y.next)>=0||(y=y.prevZ,b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&it(s,u,c,d,l,f,b.x,b.y)&&ot(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;y&&y.z>=_;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&it(s,u,c,d,l,f,y.x,y.y)&&ot(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;b&&b.z<=v;){if(b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&it(s,u,c,d,l,f,b.x,b.y)&&ot(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function Ke(e,t){let n=e;do{let r=n.prev,i=n.next.next;!st(r,i)&&ct(r,n,n.next,i)&&ft(r,i)&&ft(i,r)&&(t.push(r.i,n.i,i.i),gt(n),gt(n.next),n=e=i),n=n.next}while(n!==e);return He(n)}function qe(e,t,n,r,i,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&at(o,e)){let s=mt(o,e);o=He(o,o.next),s=He(s,s.next),Ue(o,t,n,r,i,a,0),Ue(s,t,n,r,i,a,0);return}e=e.next}o=o.next}while(o!==e)}function Je(e,t,n,r){let i=[];for(let n=0,a=t.length;n<a;n++){let o=Ve(e,t[n]*r,n<a-1?t[n+1]*r:e.length,r,!1);o===o.next&&(o.steiner=!0),i.push(nt(o))}i.sort(Ye);for(let e=0;e<i.length;e++)n=Xe(i[e],n);return n}function Ye(e,t){let n=e.x-t.x;return n===0&&(n=e.y-t.y,n===0&&(n=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x))),n}function Xe(e,t){let n=Ze(e,t);if(!n)return t;let r=mt(n,e);return He(r,r.next),He(n,n.next)}function Ze(e,t){let n=t,r=e.x,i=e.y,a=-1/0,o;if(st(e,n))return n;do{if(st(e,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){let e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>a&&(a=e,o=n.x<n.next.x?n:n.next,e===r))return o}n=n.next}while(n!==t);if(!o)return null;let s=o,c=o.x,l=o.y,u=1/0;n=o;do{if(r>=n.x&&n.x>=c&&r!==n.x&&rt(i<l?r:a,i,c,l,i<l?a:r,i,n.x,n.y)){let t=Math.abs(i-n.y)/(r-n.x);ft(n,e)&&(t<u||t===u&&(n.x>o.x||n.x===o.x&&Qe(o,n)))&&(o=n,u=t)}n=n.next}while(n!==s);return o}function Qe(e,t){return ot(e.prev,e,t.prev)<0&&ot(t.next,e,e.next)<0}function $e(e,t,n,r){let i=e;do i.z===0&&(i.z=tt(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,et(i)}function et(e){let t,n=1;do{let r=e,i;e=null;let a=null;for(t=0;r;){t++;let o=r,s=0;for(let e=0;e<n&&(s++,o=o.nextZ,o);e++);let c=n;for(;s>0||c>0&&o;)s!==0&&(c===0||!o||r.z<=o.z)?(i=r,r=r.nextZ,s--):(i=o,o=o.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;r=o}a.nextZ=null,n*=2}while(t>1);return e}function tt(e,t,n,r,i){return e=(e-n)*i|0,t=(t-r)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function nt(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function rt(e,t,n,r,i,a,o,s){return(i-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function it(e,t,n,r,i,a,o,s){return(e!==o||t!==s)&&rt(e,t,n,r,i,a,o,s)}function at(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!dt(e,t)&&(ft(e,t)&&ft(t,e)&&pt(e,t)&&(ot(e.prev,e,t.prev)||ot(e,t.prev,t))||st(e,t)&&ot(e.prev,e,e.next)>0&&ot(t.prev,t,t.next)>0)}function ot(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function st(e,t){return e.x===t.x&&e.y===t.y}function ct(e,t,n,r){let i=ut(ot(e,t,n)),a=ut(ot(e,t,r)),o=ut(ot(n,r,e)),s=ut(ot(n,r,t));return!!(i!==a&&o!==s||i===0&&lt(e,n,t)||a===0&&lt(e,r,t)||o===0&&lt(n,e,r)||s===0&&lt(n,t,r))}function lt(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function ut(e){return e>0?1:e<0?-1:0}function dt(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&ct(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function ft(e,t){return ot(e.prev,e,e.next)<0?ot(e,t,e.next)>=0&&ot(e,e.prev,t)>=0:ot(e,t,e.prev)<0||ot(e,e.next,t)<0}function pt(e,t){let n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function mt(e,t){let n=_t(e.i,e.x,e.y),r=_t(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function ht(e,t,n,r){let i=_t(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function gt(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function _t(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function vt(e,t,n,r){let i=0;for(let a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}function yt(e){let t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function bt(e,t){for(let n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}function xt(e,t,n){if(n.shapes=[],Array.isArray(e))for(let t=0,r=e.length;t<r;t++){let r=e[t];n.shapes.push(r.uuid)}else n.shapes.push(e.uuid);return n.options=Object.assign({},t),t.extrudePath!==void 0&&(n.options.extrudePath=t.extrudePath.toJSON()),n}function St(e,t){if(t.shapes=[],Array.isArray(e))for(let n=0,r=e.length;n<r;n++){let r=e[n];t.shapes.push(r.uuid)}else t.shapes.push(e.uuid);return t}function Ct(e,t,n){let r=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`,i=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`;return n.has(r)===!0||n.has(i)===!0?!1:(n.add(r),n.add(i),!0)}function wt(e){let t={};for(let n in e){t[n]={};for(let r in e[n]){let i=e[n][r];if(Et(i))i.isRenderTargetTexture?(x(`UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms().`),t[n][r]=null):t[n][r]=i.clone();else if(Array.isArray(i)){if(Et(i[0])){let e=[];for(let t=0,n=i.length;t<n;t++)e[t]=i[t].clone();t[n][r]=e}else t[n][r]=i.slice()}else t[n][r]=i}}return t}function Tt(e){let t={};for(let n=0;n<e.length;n++){let r=wt(e[n]);for(let e in r)t[e]=r[e]}return t}function Et(e){return e&&(e.isColor||e.isMatrix3||e.isMatrix4||e.isVector2||e.isVector3||e.isVector4||e.isTexture||e.isQuaternion)}function Dt(e){let t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}function Ot(e){let t=e.getRenderTarget();return t===null?e.outputColorSpace:t.isXRRenderTarget===!0?t.texture.colorSpace:ji.workingColorSpace}function kt(e,t){return!e||e.constructor===t?e:typeof t.BYTES_PER_ELEMENT==`number`?new t(e):Array.prototype.slice.call(e)}function At(e){return e!==void 0&&e.inTangents!==void 0&&e.outTangents!==void 0}function jt(e){function t(t,n){return e[t]-e[n]}let n=e.length,r=Array(n);for(let e=0;e!==n;++e)r[e]=e;return r.sort(t),r}function Mt(e,t,n){let r=e.length,i=new e.constructor(r);for(let a=0,o=0;o!==r;++a){let r=n[a]*t;for(let n=0;n!==t;++n)i[o++]=e[r+n]}return i}function Nt(e,t,n,r){let i=1,a=e[0];for(;a!==void 0&&a[r]===void 0;)a=e[i++];if(a===void 0)return;let o=a[r];if(o!==void 0){if(Array.isArray(o))do o=a[r],o!==void 0&&(t.push(a.time),n.push(...o)),a=e[i++];while(a!==void 0);else if(o.toArray!==void 0)do o=a[r],o!==void 0&&(t.push(a.time),o.toArray(n,n.length)),a=e[i++];while(a!==void 0);else do o=a[r],o!==void 0&&(t.push(a.time),n.push(o)),a=e[i++];while(a!==void 0)}}function Pt(e,t,n,r,i=30){let a=e.clone();a.name=t;let o=[];for(let e=0;e<a.tracks.length;++e){let t=a.tracks[e],s=t.getValueSize(),c=[],l=[];for(let e=0;e<t.times.length;++e){let a=t.times[e]*i;if(!(a<n||a>=r)){c.push(t.times[e]);for(let n=0;n<s;++n)l.push(t.values[e*s+n])}}c.length!==0&&(t.times=kt(c,t.times.constructor),t.values=kt(l,t.values.constructor),o.push(t))}a.tracks=o;let s=1/0;for(let e=0;e<a.tracks.length;++e)s>a.tracks[e].times[0]&&(s=a.tracks[e].times[0]);for(let e=0;e<a.tracks.length;++e)a.tracks[e].shift(-1*s);return a.resetDuration(),a}function Ft(e,t=0,n=e,r=30){r<=0&&(r=30);let i=n.tracks.length,a=t/r;for(let t=0;t<i;++t){let r=n.tracks[t],i=r.ValueTypeName;if(i===`bool`||i===`string`)continue;let o=e.tracks.find(function(e){return e.name===r.name&&e.ValueTypeName===i});if(o===void 0)continue;let s=0,c=r.getValueSize();r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(s=c/3);let l=0,u=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(l=u/3);let d=r.times.length-1,f;if(a<=r.times[0]){let e=s,t=c-s;f=r.values.slice(e,t)}else if(a>=r.times[d]){let e=d*c+s,t=e+c-s;f=r.values.slice(e,t)}else{let e=r.createInterpolant();e.evaluate(a),f=e.resultBuffer.slice()}i===`quaternion`&&new wi().fromArray(f).normalize().conjugate().toArray(f);let p=o.times.length;for(let e=0;e<p;++e){let t=e*u+l;if(i===`quaternion`)wi.multiplyQuaternionsFlat(o.values,t,f,0,o.values,t);else{let e=u-l*2;for(let n=0;n<e;++n)o.values[t+n]-=f[n]}}}return e.blendMode=Fr,e}function It(e,t,n,r,i){let a=1-e;return a*a*a*t+3*a*a*e*n+3*a*e*e*r+e*e*e*i}function Lt(e,t,n,r,i){let a=1-e;return 3*a*a*(n-t)+6*a*e*(r-n)+3*e*e*(i-r)}function Rt(e,t,n,r,i){let a=(e-t)/(i-t);for(let o=0;o<8;o++){let o=It(a,t,n,r,i)-e;if(Math.abs(o)<1e-10)break;let s=Lt(a,t,n,r,i);if(Math.abs(s)<1e-10)break;a=Math.max(0,Math.min(1,a-o/s))}return a}function zt(e,t){for(let n=0,r=e.length;n!==r;n+=2)e[n]+=t}function Bt(e,t){for(let n=0,r=e.length;n!==r;n+=2)e[n]*=t}function Vt(e){switch(e.toLowerCase()){case`scalar`:case`double`:case`float`:case`number`:case`integer`:return su;case`vector`:case`vector2`:case`vector3`:case`vector4`:return du;case`color`:return ou;case`quaternion`:return lu;case`bool`:case`boolean`:return au;case`string`:return uu}throw Error(`THREE.KeyframeTrack: Unsupported typeName: `+e)}function Ht(e){if(e.type===void 0)throw Error(`THREE.KeyframeTrack: track type undefined, can not parse`);let t=Vt(e.type);if(e.times===void 0){let t=[],n=[];Nt(e.keys,t,n,`value`),e.times=t,e.values=n}let n;return n=t.parse===void 0?new t(e.name,e.times,e.values,e.interpolation):t.parse(e),At(e.settings)&&(n.settings={inTangents:kt(e.settings.inTangents,Float32Array),outTangents:kt(e.settings.outTangents,Float32Array)}),n}function Ut(e){try{let t=e.slice(e.indexOf(`:`)+1);return new URL(t).protocol===`blob:`}catch{return!1}}function Wt(){this._document.hidden===!1&&this.reset()}function Gt(e,t){return e.distance-t.distance}function Kt(e,t,n,r){let i=!0;if(e.layers.test(t.layers)&&e.raycast(t,n)===!1&&(i=!1),i===!0&&r===!0){let r=e.children;for(let e=0,i=r.length;e<i;e++)Kt(r[e],t,n,!0)}}function qt(e){let t=[];e.isBone===!0&&t.push(e);for(let n=0;n<e.children.length;n++)t.push(...qt(e.children[n]));return t}function Jt(e,t,n,r,i,a,o){Rf.set(i,a,o).unproject(r);let s=t[e];if(s!==void 0){let e=n.getAttribute(`position`);for(let t=0,n=s.length;t<n;t++)e.setXYZ(s[t],Rf.x,Rf.y,Rf.z)}}function Yt(e,t){let n=e.image&&e.image.width?e.image.width/e.image.height:1;return n>t?(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2):(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0),e}function Xt(e,t){let n=e.image&&e.image.width?e.image.width/e.image.height:1;return n>t?(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0):(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2),e}function Zt(e){return e.repeat.x=1,e.repeat.y=1,e.offset.x=0,e.offset.y=0,e}function Qt(e,t,n,r){let i=$t(r);switch(n){case jn:return e*t;case In:return e*t/i.components*i.byteLength;case Ln:return e*t/i.components*i.byteLength;case Rn:return e*t*2/i.components*i.byteLength;case zn:return e*t*2/i.components*i.byteLength;case Mn:return e*t*3/i.components*i.byteLength;case Nn:return e*t*4/i.components*i.byteLength;case Vn:return e*t*4/i.components*i.byteLength;case Hn:case Un:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case Wn:case Gn:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case qn:case Yn:return Math.max(e,16)*Math.max(t,8)/4;case Kn:case Jn:return Math.max(e,8)*Math.max(t,8)/2;case Xn:case Zn:case $n:case er:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case Qn:case tr:case nr:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case rr:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case ir:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case ar:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case or:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case sr:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case cr:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case lr:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case ur:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case dr:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case fr:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case pr:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case mr:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case hr:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case gr:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case _r:case vr:case yr:return Math.ceil(e/4)*Math.ceil(t/4)*16;case br:case xr:return Math.ceil(e/4)*Math.ceil(t/4)*8;case Sr:case Cr:return Math.ceil(e/4)*Math.ceil(t/4)*16}throw Error(`Unable to determine texture byte length for ${n} format.`)}function $t(e){switch(e){case vn:case yn:return{byteLength:1,components:1};case xn:case bn:case Tn:return{byteLength:2,components:1};case En:case Dn:return{byteLength:2,components:4};case Cn:case Sn:case wn:return{byteLength:4,components:1};case kn:case An:return{byteLength:4,components:3}}throw Error(`THREE.TextureUtils: Unknown texture type ${e}.`)}var en,tn,nn,rn,an,on,sn,cn,ln,un,dn,fn,pn,mn,hn,gn,_n,vn,yn,bn,xn,Sn,Cn,wn,Tn,En,Dn,On,kn,An,jn,Mn,Nn,Pn,Fn,In,Ln,Rn,zn,Bn,Vn,Hn,Un,Wn,Gn,Kn,qn,Jn,Yn,Xn,Zn,Qn,$n,er,tr,nr,rr,ir,ar,or,sr,cr,lr,ur,dr,fr,pr,mr,hr,gr,_r,vr,yr,br,xr,Sr,Cr,wr,Tr,Er,Dr,Or,kr,Ar,jr,Mr,Nr,Pr,Fr,Ir,Lr,Rr,zr,Br,Vr,Hr,Ur,Wr,Gr,Kr,qr,Jr,Yr,Xr,Zr,Qr,$r,ei,ti,ni,ri,ii,ai,oi,si,ci,li,ui,di,fi,pi,mi,hi,gi,_i,vi,yi,bi,xi,Si,Ci,z,wi,B,Ti,Ei,Di,Oi,ki,Ai,ji,Mi,Ni,Pi,Fi,Ii,Li,Ri,zi,Bi,Vi,Hi,Ui,Wi,Gi,Ki,V,qi,Ji,Yi,Xi,Zi,Qi,$i,ea,ta,na,ra,ia,aa,oa,sa,ca,la,ua,da,fa,pa,ma,ha,ga,_a,va,ya,ba,xa,Sa,Ca,wa,Ta,H,Ea,Da,Oa,ka,Aa,ja,Ma,Na,Pa,Fa,Ia,La,Ra,za,Ba,Va,Ha,Ua,Wa,Ga,Ka,qa,Ja,Ya,Xa,Za,Qa,$a,eo,to,no,ro,io,U,ao,oo,so,co,lo,uo,fo,po,mo,ho,go,_o,W,vo,yo,bo,xo,So,Co,wo,To,Eo,Do,Oo,G,ko,Ao,jo,Mo,No,Po,Fo,Io,Lo,Ro,zo,Bo,Vo,Ho,Uo,Wo,Go,Ko,qo,Jo,Yo,Xo,Zo,Qo,$o,es,ts,ns,rs,is,as,os,ss,cs,ls,us,ds,fs,ps,ms,hs,gs,_s,vs,K,ys,bs,xs,Ss,Cs,ws,Ts,Es,Ds,Os,ks,As,js,Ms,Ns,Ps,Fs,Is,Ls,Rs,zs,Bs,Vs,Hs,Us,Ws,Gs,Ks,qs,Js,Ys,Xs,Zs,Qs,$s,ec,tc,nc,rc,ic,ac,oc,sc,cc,lc,uc,dc,fc,pc,mc,hc,gc,_c,vc,yc,bc,xc,Sc,Cc,wc,Tc,Ec,Dc,Oc,kc,Ac,jc,Mc,Nc,Pc,Fc,Ic,Lc,Rc,zc,Bc,Vc,Hc,Uc,Wc,Gc,Kc,qc,Jc,Yc,Xc,Zc,Qc,$c,el,tl,nl,rl,il,al,ol,sl,cl,ll,ul,dl,fl,pl,ml,hl,gl,_l,vl,yl,bl,xl,Sl,Cl,wl,Tl,El,Dl,Ol,kl,Al,jl,Ml,Nl,Pl,Fl,Il,Ll,Rl,zl,Bl,Vl,Hl,Ul,Wl,Gl,Kl,ql,Jl,Yl,Xl,Zl,Ql,$l,eu,tu,nu,ru,iu,au,ou,su,cu,lu,uu,du,fu,pu,mu,hu,gu,_u,vu,yu,bu,xu,Su,Cu,wu,Tu,Eu,Du,Ou,ku,Au,ju,Mu,Nu,Pu,Fu,Iu,Lu,Ru,zu,Bu,Vu,Hu,Uu,Wu,Gu,Ku,qu,Ju,Yu,Xu,Zu,Qu,$u,ed,td,nd,rd,id,ad,od,sd,cd,ld,ud,dd,fd,pd,md,hd,gd,_d,vd,yd,bd,xd,Sd,Cd,wd,Td,Ed,Dd,Od,kd,Ad,jd,Md,Nd,Pd,Fd,Id,Ld,Rd,zd,Bd,Vd,Hd,Ud,Wd,Gd,Kd,qd,Jd,Yd,Xd,Zd,Qd,$d,ef,tf,nf,rf,af,of,sf,cf,lf,uf,df,ff,pf,mf,hf,gf,_f,vf,yf,bf,xf,Sf,Cf,wf,Tf,Ef,Df,Of,kf,Af,jf,Mf,Nf,Pf,Ff,If,Lf,Rf,zf,Bf,Vf,Hf,Uf,Wf,Gf,Kf,qf,Jf,Yf,Xf,Zf,Qf,$f=t((()=>{en={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},tn={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},nn=`attached`,rn=`detached`,an=1e3,on=1001,sn=1002,cn=1003,ln=1004,un=1004,dn=1005,fn=1005,pn=1006,mn=1007,hn=1007,gn=1008,_n=1008,vn=1009,yn=1010,bn=1011,xn=1012,Sn=1013,Cn=1014,wn=1015,Tn=1016,En=1017,Dn=1018,On=1020,kn=35902,An=35899,jn=1021,Mn=1022,Nn=1023,Pn=1026,Fn=1027,In=1028,Ln=1029,Rn=1030,zn=1031,Bn=1032,Vn=1033,Hn=33776,Un=33777,Wn=33778,Gn=33779,Kn=35840,qn=35841,Jn=35842,Yn=35843,Xn=36196,Zn=37492,Qn=37496,$n=37488,er=37489,tr=37490,nr=37491,rr=37808,ir=37809,ar=37810,or=37811,sr=37812,cr=37813,lr=37814,ur=37815,dr=37816,fr=37817,pr=37818,mr=37819,hr=37820,gr=37821,_r=36492,vr=36494,yr=36495,br=36283,xr=36284,Sr=36285,Cr=36286,wr=2200,Tr=2201,Er=2202,Dr=2300,Or=2301,kr=2302,Ar=2303,jr=2400,Mr=2401,Nr=2402,Pr=2500,Fr=2501,Ir=3200,Lr=3201,Rr=3202,zr=3203,Br=`srgb`,Vr=`srgb-linear`,Hr=`linear`,Ur=`srgb`,Wr=7680,Gr=7681,Kr=7682,qr=7683,Jr=34055,Yr=34056,Xr=5386,Zr=35044,Qr=35048,$r=35040,ei=35045,ti=35049,ni=35041,ri=35046,ii=35050,ai=35042,oi=`300 es`,si=2e3,ci=2001,li={COMPUTE:`compute`,RENDER:`render`},ui={PERSPECTIVE:`perspective`,LINEAR:`linear`,FLAT:`flat`},di={NORMAL:`normal`,CENTROID:`centroid`,SAMPLE:`sample`,FIRST:`first`,EITHER:`either`},fi={TEXTURE_COMPARE:`depthTextureCompare`},pi={NONE:0,SHARED:1,FULL:2},mi={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array},hi={},gi=null,_i={0:0,2:6,4:4,3:5,1:1,6:2,7:7,5:3},vi=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n!==void 0&&n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let t=n.slice(0);for(let n=0,r=t.length;n<r;n++)t[n].call(this,e);e.target=null}}},yi=/* @__PURE__ */ `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`.split(`.`),bi=1234567,xi=Math.PI/180,Si=180/Math.PI,Ci={DEG2RAD:xi,RAD2DEG:Si,generateUUID:T,clamp:E,euclideanModulo:D,mapLinear:O,inverseLerp:k,lerp:A,damp:j,pingpong:M,smoothstep:N,smootherstep:P,randInt:F,randFloat:ee,randFloatSpread:te,seededRandom:ne,degToRad:re,radToDeg:ie,isPowerOfTwo:ae,ceilPowerOfTwo:I,floorPowerOfTwo:oe,setQuaternionFromProperEuler:se,normalize:ue,denormalize:le},z=class{static{this.prototype.isVector2=!0}constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error(`THREE.Vector2: index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error(`THREE.Vector2: index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=E(this.x,e.x,t.x),this.y=E(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=E(this.x,e,t),this.y=E(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(E(n,e,t))}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(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.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(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(E(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},wi=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,i,a,o){let s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],d=i[a+0],f=i[a+1],p=i[a+2],m=i[a+3];if(u!==m||s!==d||c!==f||l!==p){let e=s*d+c*f+l*p+u*m;e<0&&(d=-d,f=-f,p=-p,m=-m,e=-e);let t=1-o;if(e<.9995){let n=Math.acos(e),r=Math.sin(n);t=Math.sin(t*n)/r,o=Math.sin(o*n)/r,s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o}else{s=s*t+d*o,c=c*t+f*o,l=l*t+p*o,u=u*t+m*o;let e=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=e,c*=e,l*=e,u*=e}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,i,a){let o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],d=i[a+1],f=i[a+2],p=i[a+3];return e[t]=o*p+l*u+s*f-c*d,e[t+1]=s*p+l*d+c*u-o*f,e[t+2]=c*p+l*f+o*d-s*u,e[t+3]=l*p-o*u-s*d-c*f,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,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,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 n=e._x,r=e._y,i=e._z,a=e._order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),d=s(n/2),f=s(r/2),p=s(i/2);switch(a){case`XYZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`YXZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`ZXY`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`ZYX`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`YZX`:this._x=d*l*u+c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u-d*f*p;break;case`XZY`:this._x=d*l*u-c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u+d*f*p;break;default:x(`Quaternion: .setFromEuler() encountered an unknown order: `+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],c=t[2],l=t[6],u=t[10],d=n+o+u;if(d>0){let e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(l-s)*e,this._y=(i-c)*e,this._z=(a-r)*e}else if(n>o&&n>u){let e=2*Math.sqrt(1+n-o-u);this._w=(l-s)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(i+c)/e}else if(o>u){let e=2*Math.sqrt(1+o-n-u);this._w=(i-c)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(s+l)/e}else{let e=2*Math.sqrt(1+u-n-o);this._w=(a-r)/e,this._x=(i+c)/e,this._y=(s+l)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(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=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(E(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),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*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,r=-r,i=-i,a=-a,o=-o);let s=1-t;if(o<.9995){let e=Math.acos(o),c=Math.sin(e);s=Math.sin(s*e)/c,t=Math.sin(t*e)/c,this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this._onChangeCallback()}else this._x=this._x*s+n*t,this._y=this._y*s+r*t,this._z=this._z*s+i*t,this._w=this._w*s+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*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}},B=class{static{this.prototype.isVector3=!0}constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error(`THREE.Vector3: index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error(`THREE.Vector3: index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Ei.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Ei.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=2*(a*r-o*n),l=2*(o*t-i*r),u=2*(i*n-a*t);return this.x=t+s*c+a*u-o*l,this.y=n+s*l+o*c-i*u,this.z=r+s*u+i*l-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=E(this.x,e.x,t.x),this.y=E(this.y,e.y,t.y),this.z=E(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=E(this.x,e,t),this.y=E(this.y,e,t),this.z=E(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(E(n,e,t))}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(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Ti.copy(this).projectOnVector(e),this.sub(Ti)}reflect(e){return this.sub(Ti.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(E(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Ti=/*@__PURE__*/ new B,Ei=/*@__PURE__*/ new wi,Di=class{static{this.prototype.isMatrix3=!0}constructor(e,t,n,r,i,a,o,s,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,i,a,o,s,c)}set(e,t,n,r,i,a,o,s,c){let l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],d=n[2],f=n[5],p=n[8],m=r[0],h=r[3],g=r[6],_=r[1],v=r[4],y=r[7],b=r[2],x=r[5],S=r[8];return i[0]=a*m+o*_+s*b,i[3]=a*h+o*v+s*x,i[6]=a*g+o*y+s*S,i[1]=c*m+l*_+u*b,i[4]=c*h+l*v+u*x,i[7]=c*g+l*y+u*S,i[2]=d*m+f*_+p*b,i[5]=d*h+f*v+p*x,i[8]=d*g+f*y+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=l*a-o*c,d=o*s-l*i,f=c*i-a*s,p=t*u+n*d+r*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return e[0]=u*m,e[1]=(r*c-l*n)*m,e[2]=(o*n-r*a)*m,e[3]=d*m,e[4]=(l*t-r*s)*m,e[5]=(r*i-o*t)*m,e[6]=f*m,e[7]=(n*s-c*t)*m,e[8]=(a*t-n*i)*m,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,a,o){let s=Math.cos(i),c=Math.sin(i);return this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1),this}scale(e,t){return C(`Matrix3: .scale() is deprecated. Use .makeScale() instead.`),this.premultiply(Oi.makeScale(e,t)),this}rotate(e){return C(`Matrix3: .rotate() is deprecated. Use .makeRotation() instead.`),this.premultiply(Oi.makeRotation(-e)),this}translate(e,t){return C(`Matrix3: .translate() is deprecated. Use .makeTranslation() instead.`),this.premultiply(Oi.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}},Oi=/*@__PURE__*/ new Di,ki=/*@__PURE__*/ new Di().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Ai=/*@__PURE__*/ new Di().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),ji=/*@__PURE__*/ de(),Ni=class{static getDataURL(e,t=`image/png`){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>`u`)return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Mi===void 0&&(Mi=h(`canvas`)),Mi.width=e.width,Mi.height=e.height;let t=Mi.getContext(`2d`);e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),n=Mi}return n.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=h(`canvas`);t.width=e.width,t.height=e.height;let n=t.getContext(`2d`);n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e<i.length;e++)i[e]=fe(i[e]/255)*255;return n.putImageData(r,0,0),t}if(e.data){let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(fe(t[e]/255)*255):t[e]=fe(t[e]);return{data:t,width:e.width,height:e.height}}return x(`ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.`),e}},Pi=0,Fi=class{constructor(e=null){this.isTextureSource=!0,Object.defineProperty(this,"id",{value:Pi++}),this.uuid=T(),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):typeof VideoFrame<`u`&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t===null?e.set(0,0,0):e.set(t.width||0,t.height||0,t.depth||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 n={uuid:this.uuid,url:``},r=this.data;if(r!==null){let e;if(Array.isArray(r)){e=[];for(let t=0,n=r.length;t<n;t++)r[t].isDataTexture?e.push(me(r[t].image)):e.push(me(r[t]))}else e=me(r);n.url=e}return t||(e.images[this.uuid]=n),n}},Ii=class extends Fi{constructor(e=null){C(`Source: "Source" has been renamed to "TextureSource". Please update your code to use "THREE.TextureSource" instead.`),super(e),this.isSource=!0}},Li=0,Ri=/*@__PURE__*/ new B,zi=class e extends vi{constructor(t=e.DEFAULT_IMAGE,n=e.DEFAULT_MAPPING,r=on,i=on,a=pn,o=gn,s=Nn,c=vn,l=e.DEFAULT_ANISOTROPY,u=``){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Li++}),this.uuid=T(),this.name=``,this.source=new Fi(t),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=a,this.minFilter=o,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=c,this.offset=new z(0,0),this.repeat=new z(1,1),this.center=new z(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Di,this.generateMipmaps=!0,this.mipmapsAutoUpdate=!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,this.isPMREMTexture=!1,this.normalized=!1}get width(){return this.source.getSize(Ri).x}get height(){return this.source.getSize(Ri).y}get depth(){return this.source.getSize(Ri).z}get image(){return this.source.data}set image(e){this.source.data=e}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(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.mipmapsAutoUpdate=e.mipmapsAutoUpdate,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isPMREMTexture=e.isPMREMTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){x(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];r===void 0?x(`Texture.setValues(): property '${t}' does not exist.`):r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:`Texture`,generator:`Texture.toJSON`},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).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,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,mipmapsAutoUpdate:this.mipmapsAutoUpdate,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:`dispose`})}transformUv(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case an:e.x-=Math.floor(e.x);break;case on:e.x=e.x<0?0:1;break;case sn:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case an:e.y-=Math.floor(e.y);break;case on:e.y=e.y<0?0:1;break;case sn:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}},zi.DEFAULT_IMAGE=null,zi.DEFAULT_MAPPING=300,zi.DEFAULT_ANISOTROPY=1,Bi=class{static{this.prototype.isVector4=!0}constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error(`THREE.Vector4: index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error(`THREE.Vector4: index is out of range: `+e)}}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===void 0?1:e.w,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],d=s[1],f=s[5],p=s[9],m=s[2],h=s[6],g=s[10];if(Math.abs(l-d)<a&&Math.abs(u-m)<a&&Math.abs(p-h)<a){if(Math.abs(l+d)<o&&Math.abs(u+m)<o&&Math.abs(p+h)<o&&Math.abs(c+f+g-3)<o)return this.set(1,0,0,0),this;t=Math.PI;let e=(c+1)/2,s=(f+1)/2,_=(g+1)/2,v=(l+d)/4,y=(u+m)/4,b=(p+h)/4;return e>s&&e>_?e<a?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(e),r=v/n,i=y/n):s>_?s<a?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(s),n=v/r,i=b/r):_<a?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(_),n=y/i,r=b/i),this.set(n,r,i,t),this}let _=Math.sqrt((h-p)*(h-p)+(u-m)*(u-m)+(d-l)*(d-l));return Math.abs(_)<.001&&(_=1),this.x=(h-p)/_,this.y=(u-m)/_,this.z=(d-l)/_,this.w=Math.acos((c+f+g-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=E(this.x,e.x,t.x),this.y=E(this.y,e.y,t.y),this.z=E(this.z,e.z,t.z),this.w=E(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=E(this.x,e,t),this.y=E(this.y,e,t),this.z=E(this.z,e,t),this.w=E(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(E(n,e,t))}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(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)}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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}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}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}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}},Vi=class extends vi{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:pn,depthBuffer:!0,stencilBuffer:!1,resolveColorBuffer:!0,resolveDepthBuffer:!0,resolveStencilBuffer:!0,storeMultisampledColorBuffer:!0,storeMultisampledDepthBuffer:!0,storeMultisampledStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new Bi(0,0,e,t),this.scissorTest=!1,this.viewport=new Bi(0,0,e,t),this.textures=[];let r=n.count;for(let i=0;i<r;i++)this.textures[i]=new zi({width:e,height:t,depth:n.depth}),this.textures[i].isRenderTargetTexture=!0,this.textures[i].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveColorBuffer=n.resolveColorBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this.storeMultisampledColorBuffer=n.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=n.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=n.storeMultisampledStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){let t={minFilter:pn,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.mipmapsAutoUpdate!==void 0&&(t.mipmapsAutoUpdate=e.mipmapsAutoUpdate),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let e=0;e<this.textures.length;e++)this.textures[e].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&this._depthTexture.renderTarget===this&&(this._depthTexture.renderTarget=null),e!==null&&e.renderTarget===null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,i=this.textures.length;r<i;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].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,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let n=Object.assign({},e.textures[t].image);this.textures[t].source=new Fi(n)}if(this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveColorBuffer=e.resolveColorBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,this.storeMultisampledColorBuffer=e.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=e.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=e.storeMultisampledStencilBuffer,e.depthTexture!==null){if(e.depthTexture.renderTarget===e){let t=e.depthTexture.clone();t.renderTarget=null,this.depthTexture=t}else this.depthTexture=e.depthTexture}else this.depthTexture=null;return this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:`dispose`})}},Hi=class extends Vi{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},Ui=class extends zi{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=cn,this.minFilter=cn,this.wrapR=on,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=/* @__PURE__ */ new Set}copy(e){return super.copy(e),this.wrapR=e.wrapR,this}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}},Wi=class extends Hi{constructor(e=1,t=1,n=1,r={}){super(e,t,r),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new Ui(null,e,t,n),this._setTextureOptions(r),this.texture.isRenderTargetTexture=!0}},Gi=class extends zi{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=cn,this.minFilter=cn,this.wrapR=on,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}copy(e){return super.copy(e),this.wrapR=e.wrapR,this}},Ki=class extends Hi{constructor(e=1,t=1,n=1,r={}){super(e,t,r),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new Gi(null,e,t,n),this._setTextureOptions(r),this.texture.isRenderTargetTexture=!0}},V=class e{static{this.prototype.isMatrix4=!0}constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=u,g[14]=d,g[3]=f,g[7]=p,g[11]=m,g[15]=h,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 e().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();let t=this.elements,n=e.elements,r=1/qi.setFromMatrixColumn(e,0).length(),i=1/qi.setFromMatrixColumn(e,1).length(),a=1/qi.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if(e.order===`XYZ`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=n+r*c,t[5]=e-i*c,t[9]=-o*s,t[2]=i-e*c,t[6]=r+n*c,t[10]=a*s}else if(e.order===`YXZ`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e+i*o,t[4]=r*o-n,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=n*o-r,t[6]=i+e*o,t[10]=a*s}else if(e.order===`ZXY`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e-i*o,t[4]=-a*u,t[8]=r+n*o,t[1]=n+r*o,t[5]=a*l,t[9]=i-e*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if(e.order===`ZYX`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=r*c-n,t[8]=e*c+i,t[1]=s*u,t[5]=i*c+e,t[9]=n*c-r,t[2]=-c,t[6]=o*s,t[10]=a*s}else if(e.order===`YZX`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=i-e*u,t[8]=r*u+n,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=n*u+r,t[10]=e-i*u}else if(e.order===`XZY`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=e*u+i,t[5]=a*l,t[9]=n*u-r,t[2]=r*u-n,t[6]=o*l,t[10]=i*u+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Yi,e,Xi)}lookAt(e,t,n){let r=this.elements;return $i.subVectors(e,t),$i.lengthSq()===0&&($i.z=1),$i.normalize(),Zi.crossVectors(n,$i),Zi.lengthSq()===0&&(Math.abs(n.z)===1?$i.x+=1e-4:$i.z+=1e-4,$i.normalize(),Zi.crossVectors(n,$i)),Zi.normalize(),Qi.crossVectors($i,Zi),r[0]=Zi.x,r[4]=Qi.x,r[8]=$i.x,r[1]=Zi.y,r[5]=Qi.y,r[9]=$i.y,r[2]=Zi.z,r[6]=Qi.z,r[10]=$i.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],d=n[9],f=n[13],p=n[2],m=n[6],h=n[10],g=n[14],_=n[3],v=n[7],y=n[11],b=n[15],x=r[0],S=r[4],C=r[8],w=r[12],T=r[1],E=r[5],D=r[9],O=r[13],k=r[2],A=r[6],j=r[10],M=r[14],N=r[3],P=r[7],F=r[11],ee=r[15];return i[0]=a*x+o*T+s*k+c*N,i[4]=a*S+o*E+s*A+c*P,i[8]=a*C+o*D+s*j+c*F,i[12]=a*w+o*O+s*M+c*ee,i[1]=l*x+u*T+d*k+f*N,i[5]=l*S+u*E+d*A+f*P,i[9]=l*C+u*D+d*j+f*F,i[13]=l*w+u*O+d*M+f*ee,i[2]=p*x+m*T+h*k+g*N,i[6]=p*S+m*E+h*A+g*P,i[10]=p*C+m*D+h*j+g*F,i[14]=p*w+m*O+h*M+g*ee,i[3]=_*x+v*T+y*k+b*N,i[7]=_*S+v*E+y*A+b*P,i[11]=_*C+v*D+y*j+b*F,i[15]=_*w+v*O+y*M+b*ee,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],d=e[10],f=e[14],p=e[3],m=e[7],h=e[11],g=e[15],_=s*f-c*d,v=o*f-c*u,y=o*d-s*u,b=a*f-c*l,x=a*d-s*l,S=a*u-o*l;return t*(m*_-h*v+g*y)-n*(p*_-h*b+g*x)+r*(p*v-m*b+g*S)-i*(p*y-m*x+h*S)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[1],a=e[5],o=e[9],s=e[2],c=e[6],l=e[10];return t*(a*l-o*c)-n*(i*l-o*s)+r*(i*c-a*s)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=e[9],d=e[10],f=e[11],p=e[12],m=e[13],h=e[14],g=e[15],_=t*o-n*a,v=t*s-r*a,y=t*c-i*a,b=n*s-r*o,x=n*c-i*o,S=r*c-i*s,C=l*m-u*p,w=l*h-d*p,T=l*g-f*p,E=u*h-d*m,D=u*g-f*m,O=d*g-f*h,k=_*O-v*D+y*E+b*T-x*w+S*C;if(k===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let A=1/k;return e[0]=(o*O-s*D+c*E)*A,e[1]=(r*D-n*O-i*E)*A,e[2]=(m*S-h*x+g*b)*A,e[3]=(d*x-u*S-f*b)*A,e[4]=(s*T-a*O-c*w)*A,e[5]=(t*O-r*T+i*w)*A,e[6]=(h*y-p*S-g*v)*A,e[7]=(l*S-d*y+f*v)*A,e[8]=(a*D-o*T+c*C)*A,e[9]=(n*T-t*D-i*C)*A,e[10]=(p*x-m*y+g*_)*A,e[11]=(u*y-l*x-f*_)*A,e[12]=(o*w-a*E-s*C)*A,e[13]=(t*E-n*w+r*C)*A,e[14]=(m*v-p*b-h*_)*A,e[15]=(l*b-u*v+d*_)*A,this}scale(e){let t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,u=o+o,d=i*c,f=i*l,p=i*u,m=a*l,h=a*u,g=o*u,_=s*c,v=s*l,y=s*u,b=n.x,x=n.y,S=n.z;return r[0]=(1-(m+g))*b,r[1]=(f+y)*b,r[2]=(p-v)*b,r[3]=0,r[4]=(f-y)*x,r[5]=(1-(d+g))*x,r[6]=(h+_)*x,r[7]=0,r[8]=(p+v)*S,r[9]=(h-_)*S,r[10]=(1-(d+m))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];let i=this.determinantAffine();if(i===0)return n.set(1,1,1),t.identity(),this;let a=qi.set(r[0],r[1],r[2]).length(),o=qi.set(r[4],r[5],r[6]).length(),s=qi.set(r[8],r[9],r[10]).length();i<0&&(a=-a),Ji.copy(this);let c=1/a,l=1/o,u=1/s;return Ji.elements[0]*=c,Ji.elements[1]*=c,Ji.elements[2]*=c,Ji.elements[4]*=l,Ji.elements[5]*=l,Ji.elements[6]*=l,Ji.elements[8]*=u,Ji.elements[9]*=u,Ji.elements[10]*=u,t.setFromRotationMatrix(Ji),n.x=a,n.y=o,n.z=s,this}makePerspective(e,t,n,r,i,a,o=si,s=!1){let c=this.elements,l=2*i/(t-e),u=2*i/(n-r),d=(t+e)/(t-e),f=(n+r)/(n-r),p,m;if(s)p=i/(a-i),m=a*i/(a-i);else if(o===2e3)p=-(a+i)/(a-i),m=-2*a*i/(a-i);else if(o===2001)p=-a/(a-i),m=-a*i/(a-i);else throw Error(`THREE.Matrix4.makePerspective(): Invalid coordinate system: `+o);return c[0]=l,c[4]=0,c[8]=d,c[12]=0,c[1]=0,c[5]=u,c[9]=f,c[13]=0,c[2]=0,c[6]=0,c[10]=p,c[14]=m,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,i,a,o=si,s=!1){let c=this.elements,l=2/(t-e),u=2/(n-r),d=-(t+e)/(t-e),f=-(n+r)/(n-r),p,m;if(s)p=1/(a-i),m=a/(a-i);else if(o===2e3)p=-2/(a-i),m=-(a+i)/(a-i);else if(o===2001)p=-1/(a-i),m=-i/(a-i);else throw Error(`THREE.Matrix4.makeOrthographic(): Invalid coordinate system: `+o);return c[0]=l,c[4]=0,c[8]=0,c[12]=d,c[1]=0,c[5]=u,c[9]=0,c[13]=f,c[2]=0,c[6]=0,c[10]=p,c[14]=m,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}},qi=/*@__PURE__*/ new B,Ji=/*@__PURE__*/ new V,Yi=/*@__PURE__*/ new B(0,0,0),Xi=/*@__PURE__*/ new B(1,1,1),Zi=/*@__PURE__*/ new B,Qi=/*@__PURE__*/ new B,$i=/*@__PURE__*/ new B,ea=/*@__PURE__*/ new V,ta=/*@__PURE__*/ new wi,na=class e{constructor(t=0,n=0,r=0,i=e.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=n,this._z=r,this._order=i}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 order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,i=r[0],a=r[4],o=r[8],s=r[1],c=r[5],l=r[9],u=r[2],d=r[6],f=r[10];switch(t){case`XYZ`:this._y=Math.asin(E(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,f),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(d,c),this._z=0);break;case`YXZ`:this._x=Math.asin(-E(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(s,c)):(this._y=Math.atan2(-u,i),this._z=0);break;case`ZXY`:this._x=Math.asin(E(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(s,i));break;case`ZYX`:this._y=Math.asin(-E(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,c));break;case`YZX`:this._z=Math.asin(E(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,c),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(o,f));break;case`XZY`:this._z=Math.asin(-E(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-l,f),this._y=0);break;default:x(`Euler: .setFromRotationMatrix() encountered an unknown order: `+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return ea.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ea,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return ta.setFromEuler(this),this.setFromQuaternion(ta,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[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._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}},na.DEFAULT_ORDER=`XYZ`,ra=class{constructor(){this.mask=1}set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return!!(this.mask&1<<e)}},ia=0,aa=/*@__PURE__*/ new B,oa=/*@__PURE__*/ new wi,sa=/*@__PURE__*/ new V,ca=/*@__PURE__*/ new B,la=/*@__PURE__*/ new B,ua=/*@__PURE__*/ new B,da=/*@__PURE__*/ new wi,fa=/*@__PURE__*/ new B(1,0,0),pa=/*@__PURE__*/ new B(0,1,0),ma=/*@__PURE__*/ new B(0,0,1),ha={type:`added`},ga={type:`removed`},_a={type:`childadded`,child:null},va={type:`childremoved`,child:null},ya=class e extends vi{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:ia++}),this.uuid=T(),this.name=``,this.type=`Object3D`,this.parent=null,this.children=[],this.up=e.DEFAULT_UP.clone();let t=new B,n=new na,r=new wi,i=new B(1,1,1);function a(){r.setFromEuler(n,!1)}function o(){n.setFromQuaternion(r,void 0,!1)}n._onChange(a),r._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new V},normalMatrix:{value:new Di}}),this.matrix=new V,this.matrixWorld=new V,this.matrixAutoUpdate=e.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=e.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new ra,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.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale),this.pivot!==null&&this.position.copy(this.pivot).applyMatrix4(this.matrix).sub(this.pivot)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return oa.setFromAxisAngle(e,t),this.quaternion.multiply(oa),this}rotateOnWorldAxis(e,t){return oa.setFromAxisAngle(e,t),this.quaternion.premultiply(oa),this}rotateX(e){return this.rotateOnAxis(fa,e)}rotateY(e){return this.rotateOnAxis(pa,e)}rotateZ(e){return this.rotateOnAxis(ma,e)}translateOnAxis(e,t){return aa.copy(e).applyQuaternion(this.quaternion),this.position.add(aa.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(fa,e)}translateY(e){return this.translateOnAxis(pa,e)}translateZ(e){return this.translateOnAxis(ma,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(sa.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?ca.copy(e):ca.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),la.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?sa.lookAt(la,ca,this.up):sa.lookAt(ca,la,this.up),this.quaternion.setFromRotationMatrix(sa),r&&(sa.extractRotation(r.matrixWorld),oa.setFromRotationMatrix(sa),this.quaternion.premultiply(oa.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?(S(`Object3D.add: object can't be added as a child of itself.`,e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(ha),_a.child=e,this.dispatchEvent(_a),_a.child=null):S(`Object3D.add: object not an instance of THREE.Object3D.`,e),this)}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(ga),va.child=e,this.dispatchEvent(va),va.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),sa.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),sa.multiply(e.parent.matrixWorld)),e.applyMatrix4(sa),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(ha),_a.child=e,this.dispatchEvent(_a),_a.child=null,this}getObjectById(e){return this.getObjectByProperty(`id`,e)}getObjectByName(e){return this.getObjectByProperty(`name`,e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){let r=this.children[n].getObjectByProperty(e,t);if(r!==void 0)return r}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let r=this.children;for(let i=0,a=r.length;i<a;i++)r[i].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(la,e,ua),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(la,da,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}intersectsFrustum(){return!0}traverse(e){e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,n=e.y,r=e.z,i=this.matrix.elements;i[12]+=t-i[0]*t-i[4]*n-i[8]*r,i[13]+=n-i[1]*t-i[5]*n-i[9]*r,i[14]+=r-i[2]*t-i[6]*n-i[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){let r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),t===!0){let e=this.children;for(let t=0,r=e.length;t<r;t++)e[t].updateWorldMatrix(!1,!0,n)}}toJSON(e){let t=e===void 0||typeof e==`string`,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:`Object`,generator:`Object3D.toJSON`});let r={};r.uuid=this.uuid,r.type=this.type,r.name=this.name,r.castShadow=this.castShadow,r.receiveShadow=this.receiveShadow,r.visible=this.visible,r.frustumCulled=this.frustumCulled,r.renderOrder=this.renderOrder,r.static=this.static,r.matrixAutoUpdate=this.matrixAutoUpdate,Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type=`InstancedMesh`,r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type=`BatchedMesh`,r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(e=>({...e})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function i(t,n){return t[n.uuid]===void 0&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);let t=this.geometry.parameters;if(t!==void 0&&t.shapes!==void 0){let n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t<r;t++){let r=n[t];i(e.shapes,r)}else i(e.shapes,n)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(i(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0){if(Array.isArray(this.material)){let t=[];for(let n=0,r=this.material.length;n<r;n++)t.push(i(e.materials,this.material[n]));r.material=t}else r.material=i(e.materials,this.material)}if(this.children.length>0){r.children=[];for(let t=0;t<this.children.length;t++)r.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let t=0;t<this.animations.length;t++){let n=this.animations[t];r.animations.push(i(e.animations,n))}}if(t){let t=a(e.geometries),r=a(e.materials),i=a(e.textures),o=a(e.images),s=a(e.shapes),c=a(e.skeletons),l=a(e.animations),u=a(e.nodes);t.length>0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),s.length>0&&(n.shapes=s),c.length>0&&(n.skeletons=c),l.length>0&&(n.animations=l),u.length>0&&(n.nodes=u)}return n.object=r,n;function a(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot===null?null:e.pivot.clone(),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let t=0;t<e.children.length;t++){let n=e.children[t];this.add(n.clone())}return this}dispose(){this.dispatchEvent({type:`dispose`})}},ya.DEFAULT_UP=/*@__PURE__*/ new B(0,1,0),ya.DEFAULT_MATRIX_AUTO_UPDATE=!0,ya.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0,ba=class extends ya{constructor(){super(),this.isGroup=!0,this.type=`Group`}},xa={type:`move`},Sa=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ba,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new ba,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new B,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new B),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ba,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new B,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new B,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:`connected`,data:e}),this}disconnect(e){return this.dispatchEvent({type:`disconnected`,data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,i=null,a=null,o=this._targetRay,s=this._grip,c=this._hand;if(e&&t.session.visibilityState!==`visible-blurred`){if(c&&e.hand){a=!0;for(let r of e.hand.values()){let e=t.getJointPose(r,n),i=this._getHandJoint(c,r);e!==null&&(i.matrix.fromArray(e.transform.matrix),i.matrix.decompose(i.position,i.quaternion,i.scale),i.matrixWorldNeedsUpdate=!0,i.jointRadius=e.radius),i.visible=e!==null}let r=c.joints[`index-finger-tip`],i=c.joints[`thumb-tip`],o=r.position.distanceTo(i.position);c.inputState.pinching&&o>.025?(c.inputState.pinching=!1,this.dispatchEvent({type:`pinchend`,handedness:e.handedness,target:this})):!c.inputState.pinching&&o<=.015&&(c.inputState.pinching=!0,this.dispatchEvent({type:`pinchstart`,handedness:e.handedness,target:this}))}else s!==null&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),i!==null&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.quaternion,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,s.eventsEnabled&&s.dispatchEvent({type:`gripUpdated`,data:e,target:this})));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&i!==null&&(r=i),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.quaternion,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(xa)))}return o!==null&&(o.visible=r!==null),s!==null&&(s.visible=i!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new ba;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},Ca={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},wa={h:0,s:0,l:0},Ta={h:0,s:0,l:0},H=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let t=e;t&&t.isColor?this.copy(t):typeof t==`number`?this.setHex(t):typeof t==`string`&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Br){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ji.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=ji.workingColorSpace){return this.r=e,this.g=t,this.b=n,ji.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=ji.workingColorSpace){if(e=D(e,1),t=E(t,0,1),n=E(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=he(i,r,e+1/3),this.g=he(i,r,e),this.b=he(i,r,e-1/3)}return ji.colorSpaceToWorking(this,r),this}setStyle(e,t=Br){function n(t){t!==void 0&&parseFloat(t)<1&&x(`Color: Alpha component of `+e+` will be ignored.`)}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let i,a=r[1],o=r[2];switch(a){case`rgb`:case`rgba`:if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+(?:\.\d+)?|\.\d+)\s*)?$/.exec(o))return n(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+(?:\.\d+)?|\.\d+)\%\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*(?:,\s*(\d+(?:\.\d+)?|\.\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(100,parseFloat(i[1]))/100,Math.min(100,parseFloat(i[2]))/100,Math.min(100,parseFloat(i[3]))/100,t);break;case`hsl`:case`hsla`:if(i=/^\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*(?:,\s*(\d+(?:\.\d+)?|\.\d+)\s*)?$/.exec(o))return n(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:x(`Color: Unknown color model `+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=r[1],i=n.length;if(i===3)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(i===6)return this.setHex(parseInt(n,16),t);x(`Color: Invalid hex color `+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Br){let n=Ca[e.toLowerCase()];return n===void 0?x(`Color: Unknown color `+e):this.setHex(n,t),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=fe(e.r),this.g=fe(e.g),this.b=fe(e.b),this}copyLinearToSRGB(e){return this.r=pe(e.r),this.g=pe(e.g),this.b=pe(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Br){return ji.workingToColorSpace(Ea.copy(this),e),Math.round(E(Ea.r*255,0,255))*65536+Math.round(E(Ea.g*255,0,255))*256+Math.round(E(Ea.b*255,0,255))}getHexString(e=Br){return(`000000`+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ji.workingColorSpace){ji.workingToColorSpace(Ea.copy(this),t);let n=Ea.r,r=Ea.g,i=Ea.b,a=Math.max(n,r,i),o=Math.min(n,r,i),s,c,l=(o+a)/2;if(o===a)s=0,c=0;else{let e=a-o;switch(c=l<=.5?e/(a+o):e/(2-a-o),a){case n:s=(r-i)/e+(r<i?6:0);break;case r:s=(i-n)/e+2;break;case i:s=(n-r)/e+4}s/=6}return e.h=s,e.s=c,e.l=l,e}getRGB(e,t=ji.workingColorSpace){return ji.workingToColorSpace(Ea.copy(this),t),e.r=Ea.r,e.g=Ea.g,e.b=Ea.b,e}getStyle(e=Br){ji.workingToColorSpace(Ea.copy(this),e);let t=Ea.r,n=Ea.g,r=Ea.b;return e===`srgb`?`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`:`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`}offsetHSL(e,t,n){return this.getHSL(wa),this.setHSL(wa.h+e,wa.s+t,wa.l+n)}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,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(wa),e.getHSL(Ta);let n=A(wa.h,Ta.h,t),r=A(wa.s,Ta.s,t),i=A(wa.l,Ta.l,t);return this.setHSL(n,r,i),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,r=this.b,i=e.elements;return this.r=i[0]*t+i[3]*n+i[6]*r,this.g=i[1]*t+i[4]*n+i[7]*r,this.b=i[2]*t+i[5]*n+i[8]*r,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}},Ea=/*@__PURE__*/ new H,H.NAMES=Ca,Da=class e{constructor(e,t=25e-5){this.isFogExp2=!0,this.name=``,this.color=new H(e),this.density=t}clone(){return new e(this.color,this.density)}toJSON(){return{type:`FogExp2`,name:this.name,color:this.color.getHex(),density:this.density}}},Oa=class e{constructor(e,t=1,n=1e3){this.isFog=!0,this.name=``,this.color=new H(e),this.near=t,this.far=n}clone(){return new e(this.color,this.near,this.far)}toJSON(){return{type:`Fog`,name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}},ka=class extends ya{constructor(){super(),this.isScene=!0,this.type=`Scene`,this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new na,this.environmentIntensity=1,this.environmentRotation=new na,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}copy(e,t){return super.copy(e,t),this.background=e.background===null?null:e.background.clone(),this.environment=e.environment===null?null:e.environment.clone(),this.fog=e.fog===null?null:e.fog.clone(),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),this.overrideMaterial=e.overrideMaterial===null?null:e.overrideMaterial.clone(),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),t.object.backgroundBlurriness=this.backgroundBlurriness,t.object.backgroundIntensity=this.backgroundIntensity,t.object.backgroundRotation=this.backgroundRotation.toArray(),t.object.environmentIntensity=this.environmentIntensity,t.object.environmentRotation=this.environmentRotation.toArray(),t}},Aa=/*@__PURE__*/ new B,ja=/*@__PURE__*/ new B,Ma=/*@__PURE__*/ new B,Na=/*@__PURE__*/ new B,Pa=/*@__PURE__*/ new B,Fa=/*@__PURE__*/ new B,Ia=/*@__PURE__*/ new B,La=/*@__PURE__*/ new B,Ra=/*@__PURE__*/ new B,za=/*@__PURE__*/ new B,Ba=/*@__PURE__*/ new Bi,Va=/*@__PURE__*/ new Bi,Ha=/*@__PURE__*/ new Bi,Ua=class e{constructor(e=new B,t=new B,n=new B){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Aa.subVectors(e,t),r.cross(Aa);let i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){Aa.subVectors(r,t),ja.subVectors(n,t),Ma.subVectors(e,t);let a=Aa.dot(Aa),o=Aa.dot(ja),s=Aa.dot(Ma),c=ja.dot(ja),l=ja.dot(Ma),u=a*c-o*o;if(u===0)return i.set(0,0,0),null;let d=1/u,f=(c*s-o*l)*d,p=(a*l-o*s)*d;return i.set(1-f-p,p,f)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,Na)!==null&&Na.x>=0&&Na.y>=0&&Na.x+Na.y<=1}static getInterpolation(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,Na)===null?(s.x=0,s.y=0,`z`in s&&(s.z=0),`w`in s&&(s.w=0),null):(s.setScalar(0),s.addScaledVector(i,Na.x),s.addScaledVector(a,Na.y),s.addScaledVector(o,Na.z),s)}static getInterpolatedAttribute(e,t,n,r,i,a){return Ba.setScalar(0),Va.setScalar(0),Ha.setScalar(0),Ba.fromBufferAttribute(e,t),Va.fromBufferAttribute(e,n),Ha.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(Ba,i.x),a.addScaledVector(Va,i.y),a.addScaledVector(Ha,i.z),a}static isFrontFacing(e,t,n,r){return Aa.subVectors(n,t),ja.subVectors(e,t),Aa.cross(ja).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Aa.subVectors(this.c,this.b),ja.subVectors(this.a,this.b),Aa.cross(ja).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return e.getNormal(this.a,this.b,this.c,t)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}getInterpolation(t,n,r,i,a){return e.getInterpolation(t,this.a,this.b,this.c,n,r,i,a)}containsPoint(t){return e.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return e.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,i=this.c,a,o;Pa.subVectors(r,n),Fa.subVectors(i,n),La.subVectors(e,n);let s=Pa.dot(La),c=Fa.dot(La);if(s<=0&&c<=0)return t.copy(n);Ra.subVectors(e,r);let l=Pa.dot(Ra),u=Fa.dot(Ra);if(l>=0&&u<=l)return t.copy(r);let d=s*u-l*c;if(d<=0&&s>=0&&l<=0&&s-l>0)return a=s/(s-l),t.copy(n).addScaledVector(Pa,a);za.subVectors(e,i);let f=Pa.dot(za),p=Fa.dot(za);if(p>=0&&f<=p)return t.copy(i);let m=f*c-s*p;if(m<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(Fa,o);let h=l*p-f*u;if(h<=0&&u-l>=0&&f-p>=0)return Ia.subVectors(i,r),o=(u-l)/(u-l+(f-p)),t.copy(r).addScaledVector(Ia,o);let g=1/(h+m+d);return a=m*g,o=d*g,t.copy(n).addScaledVector(Pa,a).addScaledVector(Fa,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},Wa=class{constructor(e=new B(1/0,1/0,1/0),t=new B(-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,n=e.length;t<n;t+=3)this.expandByPoint(Ka.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Ka.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=Ka.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),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 n=e.geometry;if(n!==void 0){let r=n.getAttribute(`position`);if(t===!0&&r!==void 0&&e.isInstancedMesh!==!0&&e.isBatchedMesh!==!0)for(let t=0,n=r.count;t<n;t++)e.isMesh===!0?e.getVertexPosition(t,Ka):Ka.fromBufferAttribute(r,t),Ka.applyMatrix4(e.matrixWorld),this.expandByPoint(Ka);else e.boundingBox===void 0?(n.boundingBox===null&&n.computeBoundingBox(),qa.copy(n.boundingBox)):(e.boundingBox===null&&e.computeBoundingBox(),qa.copy(e.boundingBox)),qa.applyMatrix4(e.matrixWorld),this.union(qa)}let r=e.children;for(let e=0,n=r.length;e<n;e++)this.expandByObject(r[e],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,Ka),Ka.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(eo),to.subVectors(this.max,eo),Ja.subVectors(e.a,eo),Ya.subVectors(e.b,eo),Xa.subVectors(e.c,eo),Za.subVectors(Ya,Ja),Qa.subVectors(Xa,Ya),$a.subVectors(Ja,Xa);let t=[0,-Za.z,Za.y,0,-Qa.z,Qa.y,0,-$a.z,$a.y,Za.z,0,-Za.x,Qa.z,0,-Qa.x,$a.z,0,-$a.x,-Za.y,Za.x,0,-Qa.y,Qa.x,0,-$a.y,$a.x,0];return!ge(t,Ja,Ya,Xa,to)||(t=[1,0,0,0,1,0,0,0,1],!ge(t,Ja,Ya,Xa,to))?!1:(no.crossVectors(Za,Qa),t=[no.x,no.y,no.z],ge(t,Ja,Ya,Xa,to))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ka).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Ka).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()||(Ga[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ga[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ga[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ga[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ga[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ga[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ga[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ga[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ga)),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}},Ga=[/*@__PURE__*/ new B,/*@__PURE__*/ new B,/*@__PURE__*/ new B,/*@__PURE__*/ new B,/*@__PURE__*/ new B,/*@__PURE__*/ new B,/*@__PURE__*/ new B,/*@__PURE__*/ new B],Ka=/*@__PURE__*/ new B,qa=/*@__PURE__*/ new Wa,Ja=/*@__PURE__*/ new B,Ya=/*@__PURE__*/ new B,Xa=/*@__PURE__*/ new B,Za=/*@__PURE__*/ new B,Qa=/*@__PURE__*/ new B,$a=/*@__PURE__*/ new B,eo=/*@__PURE__*/ new B,to=/*@__PURE__*/ new B,no=/*@__PURE__*/ new B,ro=/*@__PURE__*/ new B,io=/*@__PURE__*/ _e(),U=class{static toHalfFloat(e){return ve(e)}static fromHalfFloat(e){return ye(e)}},ao=/*@__PURE__*/ new B,oo=/*@__PURE__*/ new z,so=0,co=class extends vi{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw TypeError(`THREE.BufferAttribute: array should be a Typed Array.`);this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:so++}),this.name=``,this.array=e,this.itemSize=t,this.count=e===void 0?0:e.length/t,this.normalized=n,this.usage=Zr,this.updateRanges=[],this.gpuType=wn,this.version=0,this._normalizationScale=e===void 0?void 0:ce(e)}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._normalizationScale=e._normalizationScale,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)oo.fromBufferAttribute(this,t),oo.applyMatrix3(e),this.setXY(t,oo.x,oo.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)ao.fromBufferAttribute(this,t),ao.applyMatrix3(e),this.setXYZ(t,ao.x,ao.y,ao.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)ao.fromBufferAttribute(this,t),ao.applyMatrix4(e),this.setXYZ(t,ao.x,ao.y,ao.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ao.fromBufferAttribute(this,t),ao.applyNormalMatrix(e),this.setXYZ(t,ao.x,ao.y,ao.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ao.fromBufferAttribute(this,t),ao.transformDirection(e),this.setXYZ(t,ao.x,ao.y,ao.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=this._denormalize(n)),n}setComponent(e,t,n){return this.normalized&&(n=this._normalize(n)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=this._denormalize(t)),t}setX(e,t){return this.normalized&&(t=this._normalize(t)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=this._denormalize(t)),t}setY(e,t){return this.normalized&&(t=this._normalize(t)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=this._denormalize(t)),t}setZ(e,t){return this.normalized&&(t=this._normalize(t)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=this._denormalize(t)),t}setW(e,t){return this.normalized&&(t=this._normalize(t)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=this._normalize(t),n=this._normalize(n)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=this._normalize(t),n=this._normalize(n),r=this._normalize(r)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=this._normalize(t),n=this._normalize(n),r=this._normalize(r),i=this._normalize(i)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,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 e.name=this.name,e.usage=this.usage,e.gpuType=this.gpuType,e}dispose(){this.dispatchEvent({type:`dispose`})}_denormalize(e){let t=this._normalizationScale;return t===void 0?le(e,this.array):Math.max(e/t,-1)}_normalize(e){let t=this._normalizationScale;return t===void 0?ue(e,this.array):Math.round(e*t)}},lo=class extends co{constructor(e,t,n){super(new Int8Array(e),t,n)}},uo=class extends co{constructor(e,t,n){super(new Uint8Array(e),t,n)}},fo=class extends co{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}},po=class extends co{constructor(e,t,n){super(new Int16Array(e),t,n)}},mo=class extends co{constructor(e,t,n){super(new Uint16Array(e),t,n)}},ho=class extends co{constructor(e,t,n){super(new Int32Array(e),t,n)}},go=class extends co{constructor(e,t,n){super(new Uint32Array(e),t,n)}},_o=class extends co{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=ye(this.array[e*this.itemSize]);return this.normalized&&(t=le(t,this.array)),t}setX(e,t){return this.normalized&&(t=ue(t,this.array)),this.array[e*this.itemSize]=ve(t),this}getY(e){let t=ye(this.array[e*this.itemSize+1]);return this.normalized&&(t=le(t,this.array)),t}setY(e,t){return this.normalized&&(t=ue(t,this.array)),this.array[e*this.itemSize+1]=ve(t),this}getZ(e){let t=ye(this.array[e*this.itemSize+2]);return this.normalized&&(t=le(t,this.array)),t}setZ(e,t){return this.normalized&&(t=ue(t,this.array)),this.array[e*this.itemSize+2]=ve(t),this}getW(e){let t=ye(this.array[e*this.itemSize+3]);return this.normalized&&(t=le(t,this.array)),t}setW(e,t){return this.normalized&&(t=ue(t,this.array)),this.array[e*this.itemSize+3]=ve(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=ue(t,this.array),n=ue(n,this.array)),this.array[e+0]=ve(t),this.array[e+1]=ve(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=ue(t,this.array),n=ue(n,this.array),r=ue(r,this.array)),this.array[e+0]=ve(t),this.array[e+1]=ve(n),this.array[e+2]=ve(r),this}setXYZW(e,t,n,r,i){return e*=this.itemSize,this.normalized&&(t=ue(t,this.array),n=ue(n,this.array),r=ue(r,this.array),i=ue(i,this.array)),this.array[e+0]=ve(t),this.array[e+1]=ve(n),this.array[e+2]=ve(r),this.array[e+3]=ve(i),this}},W=class extends co{constructor(e,t,n){super(new Float32Array(e),t,n)}},vo=/*@__PURE__*/ new Wa,yo=/*@__PURE__*/ new B,bo=/*@__PURE__*/ new B,xo=class{constructor(e=new B,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 n=this.center;t===void 0?vo.setFromPoints(e).getCenter(n):n.copy(t);let r=0;for(let t=0,i=e.length;t<i;t++)r=Math.max(r,n.distanceToSquared(e[t]));return this.radius=Math.sqrt(r),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 n=this.center.distanceToSquared(e);return t.copy(e),n>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*=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;yo.subVectors(e,this.center);let t=yo.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(yo,n/e),this.radius+=n}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):(bo.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(yo.copy(e.center).add(bo)),this.expandByPoint(yo.copy(e.center).sub(bo))),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}},So=0,Co=/*@__PURE__*/ new V,wo=/*@__PURE__*/ new ya,To=/*@__PURE__*/ new B,Eo=/*@__PURE__*/ new Wa,Do=/*@__PURE__*/ new Wa,Oo=/*@__PURE__*/ new B,G=class e extends vi{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:So++}),this.uuid=T(),this.name=``,this.type=`BufferGeometry`,this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return this.index=Array.isArray(e)?new(f(e)?go:mo)(e,1):e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let t=new Di().getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return Co.makeRotationFromQuaternion(e),this.applyMatrix4(Co),this}rotateX(e){return Co.makeRotationX(e),this.applyMatrix4(Co),this}rotateY(e){return Co.makeRotationY(e),this.applyMatrix4(Co),this}rotateZ(e){return Co.makeRotationZ(e),this.applyMatrix4(Co),this}translate(e,t,n){return Co.makeTranslation(e,t,n),this.applyMatrix4(Co),this}scale(e,t,n){return Co.makeScale(e,t,n),this.applyMatrix4(Co),this}lookAt(e){return wo.lookAt(e),wo.updateMatrix(),this.applyMatrix4(wo.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(To).negate(),this.translate(To.x,To.y,To.z),this}setFromPoints(e){let t=this.getAttribute(`position`);if(t===void 0){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];t.push(r.x,r.y,r.z||0)}this.setAttribute(`position`,new W(t,3))}else{let n=Math.min(e.length,t.count);for(let r=0;r<n;r++){let n=e[r];t.setXYZ(r,n.x,n.y,n.z||0)}e.length>t.count&&x(`BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.`),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Wa);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)S(`BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.`,this),this.boundingBox.set(new B(-1/0,-1/0,-1/0),new B(1/0,1/0,1/0));else{if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];Eo.setFromBufferAttribute(n),this.morphTargetsRelative?(Oo.addVectors(this.boundingBox.min,Eo.min),this.boundingBox.expandByPoint(Oo),Oo.addVectors(this.boundingBox.max,Eo.max),this.boundingBox.expandByPoint(Oo)):(this.boundingBox.expandByPoint(Eo.min),this.boundingBox.expandByPoint(Eo.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&S(`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 xo);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)S(`BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.`,this),this.boundingSphere.set(new B,1/0);else if(e){let n=this.boundingSphere.center;if(Eo.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){let n=t[e];Do.setFromBufferAttribute(n),this.morphTargetsRelative?(Oo.addVectors(Eo.min,Do.min),Eo.expandByPoint(Oo),Oo.addVectors(Eo.max,Do.max),Eo.expandByPoint(Oo)):(Eo.expandByPoint(Do.min),Eo.expandByPoint(Do.max))}Eo.getCenter(n);let r=0;for(let t=0,i=e.count;t<i;t++)Oo.fromBufferAttribute(e,t),r=Math.max(r,n.distanceToSquared(Oo));if(t)for(let i=0,a=t.length;i<a;i++){let a=t[i],o=this.morphTargetsRelative;for(let t=0,i=a.count;t<i;t++)Oo.fromBufferAttribute(a,t),o&&(To.fromBufferAttribute(e,t),Oo.add(To)),r=Math.max(r,n.distanceToSquared(Oo))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&S(`BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.`,this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){S(`BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)`);return}let n=t.position,r=t.normal,i=t.uv,a=this.getAttribute(`tangent`);(a===void 0||a.count!==n.count)&&(a=new co(new Float32Array(4*n.count),4),this.setAttribute(`tangent`,a));let o=[],s=[],c=new Uint8Array(n.count);for(let e=0;e<n.count;e++)o[e]=new B,s[e]=new B;let l=new B,u=new B,d=new B,f=new z,p=new z,m=new z,h=new B,g=new B;function _(e,t,r){c[e]=c[t]=c[r]=1,l.fromBufferAttribute(n,e),u.fromBufferAttribute(n,t),d.fromBufferAttribute(n,r),f.fromBufferAttribute(i,e),p.fromBufferAttribute(i,t),m.fromBufferAttribute(i,r),u.sub(l),d.sub(l),p.sub(f),m.sub(f);let a=1/(p.x*m.y-m.x*p.y);isFinite(a)&&(h.copy(u).multiplyScalar(m.y).addScaledVector(d,-p.y).multiplyScalar(a),g.copy(d).multiplyScalar(p.x).addScaledVector(u,-m.x).multiplyScalar(a),o[e].add(h),o[t].add(h),o[r].add(h),s[e].add(g),s[t].add(g),s[r].add(g))}let v=this.groups;v.length===0&&(v=[{start:0,count:e.count}]);for(let t=0,n=v.length;t<n;++t){let n=v[t],r=n.start,i=n.count;for(let t=r,n=r+i;t<n;t+=3)_(e.getX(t+0),e.getX(t+1),e.getX(t+2))}let y=new B,b=new B,x=new B,C=new B;function w(e){x.fromBufferAttribute(r,e),C.copy(x);let t=o[e];y.copy(t),y.sub(x.multiplyScalar(x.dot(t))).normalize(),b.crossVectors(C,t);let n=b.dot(s[e])<0?-1:1;a.setXYZW(e,y.x,y.y,y.z,n)}for(let e=0,t=n.count;e<t;++e)c[e]&&w(e);this._transformed=!0}computeVertexNormals(){let e=this.index,t=this.getAttribute(`position`);if(t!==void 0){let n=this.getAttribute(`normal`);if(n===void 0||n.count!==t.count)n=new co(new Float32Array(t.count*3),3),this.setAttribute(`normal`,n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);let r=new B,i=new B,a=new B,o=new B,s=new B,c=new B,l=new B,u=new B;if(e)for(let d=0,f=e.count;d<f;d+=3){let f=e.getX(d+0),p=e.getX(d+1),m=e.getX(d+2);r.fromBufferAttribute(t,f),i.fromBufferAttribute(t,p),a.fromBufferAttribute(t,m),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),o.fromBufferAttribute(n,f),s.fromBufferAttribute(n,p),c.fromBufferAttribute(n,m),o.add(l),s.add(l),c.add(l),n.setXYZ(f,o.x,o.y,o.z),n.setXYZ(p,s.x,s.y,s.z),n.setXYZ(m,c.x,c.y,c.z)}else for(let e=0,o=t.count;e<o;e+=3)r.fromBufferAttribute(t,e+0),i.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),l.subVectors(a,i),u.subVectors(r,i),l.cross(u),n.setXYZ(e+0,l.x,l.y,l.z),n.setXYZ(e+1,l.x,l.y,l.z),n.setXYZ(e+2,l.x,l.y,l.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Oo.fromBufferAttribute(e,t),Oo.normalize(),e.setXYZ(t,Oo.x,Oo.y,Oo.z)}toNonIndexed(){function t(e,t){let n=e.array,r=e.itemSize,i=e.normalized,a=new n.constructor(t.length*r),o=0,s=0;for(let i=0,c=t.length;i<c;i++){o=e.isInterleavedBufferAttribute?t[i]*e.data.stride+e.offset:t[i]*r;for(let e=0;e<r;e++)a[s++]=n[o++]}return new co(a,r,i)}if(this.index===null)return x(`BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.`),this;let n=new e,r=this.index.array,i=this.attributes;for(let e in i){let a=i[e],o=t(a,r);n.setAttribute(e,o)}let a=this.morphAttributes;for(let e in a){let i=[],o=a[e];for(let e=0,n=o.length;e<n;e++){let n=o[e],a=t(n,r);i.push(a)}n.morphAttributes[e]=i}n.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let e=0,t=o.length;e<t;e++){let t=o[e];n.addGroup(t.start,t.count,t.materialIndex)}return n}toJSON(){let e={metadata:{version:4.7,type:`BufferGeometry`,generator:`BufferGeometry.toJSON`}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?`BufferGeometry`:this.type,e.name=this.name,Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let t=this.parameters;for(let n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let r=n[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},i=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,r=n.length;t<r;t++){let r=n[t];a.push(r.toJSON(e.data))}a.length>0&&(r[t]=a,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let e in r){let n=r[e];this.setAttribute(e,n.clone(t))}let i=e.morphAttributes;for(let e in i){let n=[],r=i[e];for(let e=0,i=r.length;e<i;e++)n.push(r[e].clone(t));this.morphAttributes[e]=n}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let e=0,t=a.length;e<t;e++){let t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}let o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());let s=e.boundingSphere;return s!==null&&(this.boundingSphere=s.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:`dispose`})}},ko=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e===void 0?0:e.length/t,this.usage=Zr,this.updateRanges=[],this.version=0,this.uuid=T()}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.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,i=this.stride;r<i;r++)this.array[e+r]=t.array[n+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={});let t=be(this.array);e.arrayBuffers[t]===void 0&&(e.arrayBuffers[t]=this.array.slice(0).buffer);let n=new this.array.constructor(e.arrayBuffers[t]),r=new this.constructor(n,this.stride);return r.setUsage(this.usage),r}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){e.arrayBuffers===void 0&&(e.arrayBuffers={});let t=be(this.array);e.arrayBuffers[t]===void 0&&(e.arrayBuffers[t]=Array.from(new Uint32Array(this.array.slice(0).buffer)));let n={uuid:this.uuid,buffer:t,type:this.array.constructor.name,stride:this.stride};return n.usage=this.usage,n}},Ao=/*@__PURE__*/ new B,jo=class e{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name=``,this.data=e,this.itemSize=t,this.offset=n,this.normalized=r,this._normalizationScale=e===void 0?void 0:ce(e.array)}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Ao.fromBufferAttribute(this,t),Ao.applyMatrix4(e),this.setXYZ(t,Ao.x,Ao.y,Ao.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Ao.fromBufferAttribute(this,t),Ao.applyNormalMatrix(e),this.setXYZ(t,Ao.x,Ao.y,Ao.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Ao.fromBufferAttribute(this,t),Ao.transformDirection(e),this.setXYZ(t,Ao.x,Ao.y,Ao.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=this._denormalize(n)),n}setComponent(e,t,n){return this.normalized&&(n=this._normalize(n)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=this._normalize(t)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=this._normalize(t)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=this._normalize(t)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=this._normalize(t)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=this._denormalize(t)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=this._denormalize(t)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=this._denormalize(t)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=this._denormalize(t)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=this._normalize(t),n=this._normalize(n)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=this._normalize(t),n=this._normalize(n),r=this._normalize(r)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=this._normalize(t),n=this._normalize(n),r=this._normalize(r),i=this._normalize(i)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=i,this}clone(t){if(t===void 0){y(`InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.`);let e=[];for(let t=0;t<this.count;t++){let n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return new co(new this.array.constructor(e),this.itemSize,this.normalized)}return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new e(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){y(`InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.`);let e=[];for(let t=0;t<this.count;t++){let n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}_denormalize(e){let t=this._normalizationScale;return t===void 0?le(e,this.data.array):Math.max(e/t,-1)}_normalize(e){let t=this._normalizationScale;return t===void 0?ue(e,this.data.array):Math.round(e*t)}},Mo=/*@__PURE__*/ new B,No=/*@__PURE__*/ new B,Po=/*@__PURE__*/ new Di,Fo=class{constructor(e=new B(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let r=Mo.subVectors(n,t).cross(No.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){let r=e.delta(Mo),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let a=-(e.start.dot(this.normal)+this.constant)/i;return n===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(r,a)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||Po.getNormalMatrix(e),r=this.coplanarPoint(Mo).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}toJSON(){return{normal:this.normal.toArray(),constant:this.constant}}fromJSON(e){return this.normal.fromArray(e.normal),this.constant=e.constant,this}},Io=0,Lo=class extends vi{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Io++}),this.uuid=T(),this.name=``,this.type=`Material`,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new H(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Wr,this.stencilZFail=Wr,this.stencilZPass=Wr,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 n=e[t];if(n===void 0){x(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];r===void 0?x(`Material: '${t}' is not a property of THREE.${this.type}.`):r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:`Material`,generator:`Material.toJSON`}};n.uuid=this.uuid,n.type=this.type,n.blending=this.blending,n.side=this.side,n.shadowSide=this.shadowSide,n.vertexColors=this.vertexColors,n.opacity=this.opacity,n.transparent=this.transparent,n.blendSrc=this.blendSrc,n.blendDst=this.blendDst,n.blendEquation=this.blendEquation,n.blendSrcAlpha=this.blendSrcAlpha,n.blendDstAlpha=this.blendDstAlpha,n.blendEquationAlpha=this.blendEquationAlpha,n.blendColor=this.blendColor.getHex(),n.blendAlpha=this.blendAlpha,n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.clipIntersection=this.clipIntersection,n.clipShadows=this.clipShadows,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,n.stencilWrite=this.stencilWrite,n.polygonOffset=this.polygonOffset,n.polygonOffsetFactor=this.polygonOffsetFactor,n.polygonOffsetUnits=this.polygonOffsetUnits,n.dithering=this.dithering,n.alphaTest=this.alphaTest,n.alphaHash=this.alphaHash,n.alphaToCoverage=this.alphaToCoverage,n.premultipliedAlpha=this.premultipliedAlpha,n.forceSinglePass=this.forceSinglePass,n.allowOverride=this.allowOverride,n.visible=this.visible,n.toneMapped=this.toneMapped,n.name=this.name,this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.diffuseRoughness!==void 0&&(n.diffuseRoughness=this.diffuseRoughness),this.diffuseRoughnessMap&&this.diffuseRoughnessMap.isTexture&&(n.diffuseRoughnessMap=this.diffuseRoughnessMap.toJSON(e).uuid),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.retroreflectivity!==void 0&&(n.retroreflectivity=this.retroreflectivity),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessMinimum!==void 0&&(n.iridescenceThicknessMinimum=this.iridescenceThicknessMinimum),this.iridescenceThicknessMaximum!==void 0&&(n.iridescenceThicknessMaximum=this.iridescenceThicknessMaximum),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),Array.isArray(this.clippingPlanes)&&this.clippingPlanes.length>0&&(n.clippingPlanes=this.clippingPlanes.map(e=>e.toJSON())),this.rotation!==void 0&&(n.rotation=this.rotation),this.depthPacking!==void 0&&(n.depthPacking=this.depthPacking),this.linewidth!==void 0&&(n.linewidth=this.linewidth),this.linecap!==void 0&&(n.linecap=this.linecap),this.linejoin!==void 0&&(n.linejoin=this.linejoin),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.wireframe!==void 0&&(n.wireframe=this.wireframe),this.wireframeLinewidth!==void 0&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==void 0&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==void 0&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading!==void 0&&(n.flatShading=this.flatShading),this.fog!==void 0&&(n.fog=this.fog),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(t){let t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new H().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.diffuseRoughness!==void 0&&(this.diffuseRoughness=e.diffuseRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.retroreflectivity!==void 0&&(this.retroreflectivity=e.retroreflectivity),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessMinimum!==void 0&&(this.iridescenceThicknessMinimum=e.iridescenceThicknessMinimum),e.iridescenceThicknessMaximum!==void 0&&(this.iridescenceThicknessMaximum=e.iridescenceThicknessMaximum),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],this.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1]),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.clippingPlanes!==void 0&&(this.clippingPlanes=e.clippingPlanes.map(e=>new Fo().fromJSON(e))),e.clipIntersection!==void 0&&(this.clipIntersection=e.clipIntersection),e.clipShadows!==void 0&&(this.clipShadows=e.clipShadows),e.depthPacking!==void 0&&(this.depthPacking=e.depthPacking),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.linecap!==void 0&&(this.linecap=e.linecap),e.linejoin!==void 0&&(this.linejoin=e.linejoin),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(this.vertexColors=typeof e.vertexColors==`number`?e.vertexColors>0:e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let t=e.normalScale;Array.isArray(t)===!1&&(t=[t,t]),this.normalScale=new z().fromArray(t)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new z().fromArray(e.clearcoatNormalScale)),e.diffuseRoughnessMap!==void 0&&(this.diffuseRoughnessMap=t[e.diffuseRoughnessMap]||null),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}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,n=null;if(t!==null){let e=t.length;n=Array(e);for(let r=0;r!==e;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,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.allowOverride=e.allowOverride,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++}},Ro=class extends Lo{constructor(e){super(),this.isSpriteMaterial=!0,this.type=`SpriteMaterial`,this.color=new H(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},Bo=/*@__PURE__*/ new B,Vo=/*@__PURE__*/ new B,Ho=/*@__PURE__*/ new B,Uo=/*@__PURE__*/ new z,Wo=/*@__PURE__*/ new z,Go=/*@__PURE__*/ new V,Ko=/*@__PURE__*/ new B,qo=/*@__PURE__*/ new B,Jo=/*@__PURE__*/ new B,Yo=/*@__PURE__*/ new z,Xo=/*@__PURE__*/ new z,Zo=/*@__PURE__*/ new z,Qo=class extends ya{constructor(e=new Ro){if(super(),this.isSprite=!0,this.type=`Sprite`,zo===void 0){zo=new G;let e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),t=new ko(e,5);zo.setIndex([0,1,2,0,2,3]),zo.setAttribute(`position`,new jo(t,3,0,!1)),zo.setAttribute(`uv`,new jo(t,2,3,!1))}this.geometry=zo,this.material=e,this.center=new z(.5,.5),this.count=1}intersectsFrustum(e){return e.intersectsSprite(this)}raycast(e,t){e.camera===null&&S(`Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.`),Vo.setFromMatrixScale(this.matrixWorld),Go.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Ho.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Vo.multiplyScalar(-Ho.z);let n=this.material.rotation,r,i;n!==0&&(i=Math.cos(n),r=Math.sin(n));let a=this.center;xe(Ko.set(-.5,-.5,0),Ho,a,Vo,r,i),xe(qo.set(.5,-.5,0),Ho,a,Vo,r,i),xe(Jo.set(.5,.5,0),Ho,a,Vo,r,i),Yo.set(0,0),Xo.set(1,0),Zo.set(1,1);let o=e.ray.intersectTriangle(Ko,qo,Jo,!1,Bo);if(o===null&&(xe(qo.set(-.5,.5,0),Ho,a,Vo,r,i),Xo.set(0,1),o=e.ray.intersectTriangle(Ko,Jo,qo,!1,Bo),o===null))return;let s=e.ray.origin.distanceTo(Bo);s<e.near||s>e.far||t.push({distance:s,point:Bo.clone(),uv:Ua.getInterpolation(Bo,Ko,qo,Jo,Yo,Xo,Zo,new z),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}toJSON(e){let t=super.toJSON(e);return t.object.center=this.center.toArray(),t}},$o=/*@__PURE__*/ new B,es=/*@__PURE__*/ new B,ts=class extends ya{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type=`LOD`,Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);let t=e.levels;for(let e=0,n=t.length;e<n;e++){let n=t[e];this.addLevel(n.object.clone(),n.distance,n.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);let r=this.levels,i=0;for(;i<r.length&&!(t<r[i].distance);i++);return r.splice(i,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){let t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){let e=t.splice(n,1);return this.remove(e[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){let t=this.levels;if(t.length>0){let n,r;for(n=1,r=t.length;n<r;n++){let r=t[n].distance;if(t[n].object.visible&&(r-=r*t[n].hysteresis),e<r)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){$o.setFromMatrixPosition(this.matrixWorld);let n=e.ray.origin.distanceTo($o);this.getObjectForDistance(n).raycast(e,t)}}update(e){let t=this.levels;if(t.length>1){$o.setFromMatrixPosition(e.matrixWorld),es.setFromMatrixPosition(this.matrixWorld);let n=$o.distanceTo(es)/e.zoom;t[0].object.visible=!0;let r,i;for(r=1,i=t.length;r<i;r++){let e=t[r].distance;if(t[r].object.visible&&(e-=e*t[r].hysteresis),n>=e)t[r-1].object.visible=!1,t[r].object.visible=!0;else break}for(this._currentLevel=r-1;r<i;r++)t[r].object.visible=!1}}toJSON(e){let t=super.toJSON(e);t.object.autoUpdate=this.autoUpdate,t.object.levels=[];let n=this.levels;for(let e=0,r=n.length;e<r;e++){let r=n[e];t.object.levels.push({object:r.object.uuid,distance:r.distance,hysteresis:r.hysteresis})}return t}},ns=/*@__PURE__*/ new B,rs=/*@__PURE__*/ new B,is=/*@__PURE__*/ new B,as=/*@__PURE__*/ new B,os=class{constructor(e=new B,t=new B(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,ns)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=ns.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ns.copy(this.origin).addScaledVector(this.direction,t),ns.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){rs.copy(e).add(t).multiplyScalar(.5),is.copy(t).sub(e).normalize(),as.copy(this.origin).sub(rs);let i=e.distanceTo(t)*.5,a=-this.direction.dot(is),o=as.dot(this.direction),s=-as.dot(is),c=as.lengthSq(),l=Math.abs(1-a*a),u,d,f,p;if(l>0){if(u=a*s-o,d=a*o-s,p=i*l,u>=0){if(d>=-p){if(d<=p){let e=1/l;u*=e,d*=e,f=u*(u+a*d+2*o)+d*(a*u+d+2*s)+c}else d=i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c}else d=-i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c}else d<=-p?(u=Math.max(0,-(-a*i+o)),d=u>0?-i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c):d<=p?(u=0,d=Math.min(Math.max(-i,-s),i),f=d*(d+2*s)+c):(u=Math.max(0,-(a*i+o)),d=u>0?i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c)}else d=a>0?-i:i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(rs).addScaledVector(is,d),f}intersectSphere(e,t){if(e.radius<0)return null;ns.subVectors(e.center,this.origin);let n=ns.dot(this.direction),r=ns.dot(ns)-n*n,i=e.radius*e.radius;if(r>i)return null;let a=Math.sqrt(i-r),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,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 n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),l>=0?(i=(e.min.y-d.y)*l,a=(e.max.y-d.y)*l):(i=(e.max.y-d.y)*l,a=(e.min.y-d.y)*l),n>a||i>r||((i>n||isNaN(n))&&(n=i),(a<r||isNaN(r))&&(r=a),u>=0?(o=(e.min.z-d.z)*u,s=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,s=(e.min.z-d.z)*u),n>s||o>r)||((o>n||n!==n)&&(n=o),(s<r||r!==r)&&(r=s),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,ns)!==null}intersectTriangle(e,t,n,r,i){let a=this.origin,o=this.direction,s=o.x,c=o.y,l=o.z,u=e.x-a.x,d=e.y-a.y,f=e.z-a.z,p=t.x-a.x,m=t.y-a.y,h=t.z-a.z,g=n.x-a.x,_=n.y-a.y,v=n.z-a.z,y=Math.abs(s),b=Math.abs(c),x=Math.abs(l),S,C,w,T,E,D,O,k,A,j,M,N;if(y>=b&&y>=x?(w=s,D=u,A=p,N=g,s>=0?(S=c,C=l,T=d,E=f,O=m,k=h,j=_,M=v):(S=l,C=c,T=f,E=d,O=h,k=m,j=v,M=_)):b>=x?(w=c,D=d,A=m,N=_,c>=0?(S=l,C=s,T=f,E=u,O=h,k=p,j=v,M=g):(S=s,C=l,T=u,E=f,O=p,k=h,j=g,M=v)):(w=l,D=f,A=h,N=v,l>=0?(S=s,C=c,T=u,E=d,O=p,k=m,j=g,M=_):(S=c,C=s,T=d,E=u,O=m,k=p,j=_,M=g)),w===0)return null;let P=S/w,F=C/w,ee=1/w,te=T-P*D,ne=E-F*D,re=O-P*A,ie=k-F*A,ae=j-P*N,I=M-F*N,oe=ae*ie-I*re,se=te*I-ne*ae,ce=re*ne-ie*te;if(r){if(oe<0||se<0||ce<0)return null}else if((oe<0||se<0||ce<0)&&(oe>0||se>0||ce>0))return null;let le=oe+se+ce;if(le===0)return null;let ue=ee*(oe*D+se*A+ce*N);return(le>0?ue<0:ue>0)?null:this.at(ue/le,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)}},ss=class extends Lo{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type=`MeshBasicMaterial`,this.color=new H(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 na,this.combine=0,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}},cs=/*@__PURE__*/ new V,ls=/*@__PURE__*/ new os,us=/*@__PURE__*/ new xo,ds=/*@__PURE__*/ new B,fs=/*@__PURE__*/ new B,ps=/*@__PURE__*/ new B,ms=/*@__PURE__*/ new B,hs=/*@__PURE__*/ new B,gs=/*@__PURE__*/ new B,_s=/*@__PURE__*/ new B,vs=/*@__PURE__*/ new B,K=class extends ya{constructor(e=new G,t=new ss){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),this.morphTargetInfluences=e.morphTargetInfluences===void 0?void 0:e.morphTargetInfluences.slice(),this.morphTargetDictionary=e.morphTargetDictionary===void 0?void 0: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 n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){let n=this.geometry,r=n.attributes.position,i=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(r,e);let o=this.morphTargetInfluences;if(i&&o){gs.set(0,0,0);for(let n=0,r=i.length;n<r;n++){let r=o[n],s=i[n];r!==0&&(hs.fromBufferAttribute(s,e),a?gs.addScaledVector(hs,r):gs.addScaledVector(hs.sub(t),r))}t.add(gs)}return t}intersectsFrustum(e){return e.intersectsObject(this)}raycast(e,t){let n=this.geometry,r=this.material,i=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),us.copy(n.boundingSphere),us.applyMatrix4(i),ls.copy(e.ray).recast(e.near),us.containsPoint(ls.origin)===!1&&(ls.intersectSphere(us,ds)===null||ls.origin.distanceToSquared(ds)>(e.far-e.near)**2)||(cs.copy(i).invert(),ls.copy(e.ray).applyMatrix4(cs),(n.boundingBox===null||ls.intersectsBox(n.boundingBox)!==!1)&&this._computeIntersections(e,t,ls)))}_computeIntersections(e,t,n){let r,i=this.geometry,a=this.material,o=i.index,s=i.attributes.position,c=i.attributes.uv,l=i.attributes.uv1,u=i.attributes.normal,d=i.groups,f=i.drawRange;if(o!==null){if(Array.isArray(a))for(let i=0,s=d.length;i<s;i++){let s=d[i],p=a[s.materialIndex],m=Math.max(s.start,f.start),h=Math.min(o.count,Math.min(s.start+s.count,f.start+f.count));for(let i=m,a=h;i<a;i+=3){let a=o.getX(i),d=o.getX(i+1),f=o.getX(i+2);r=Ce(this,p,e,n,c,l,u,a,d,f),r&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=s.materialIndex,t.push(r))}}else{let i=Math.max(0,f.start),s=Math.min(o.count,f.start+f.count);for(let d=i,f=s;d<f;d+=3){let i=o.getX(d),s=o.getX(d+1),f=o.getX(d+2);r=Ce(this,a,e,n,c,l,u,i,s,f),r&&(r.faceIndex=Math.floor(d/3),t.push(r))}}}else if(s!==void 0){if(Array.isArray(a))for(let i=0,o=d.length;i<o;i++){let o=d[i],p=a[o.materialIndex],m=Math.max(o.start,f.start),h=Math.min(s.count,Math.min(o.start+o.count,f.start+f.count));for(let i=m,a=h;i<a;i+=3){let a=i,s=i+1,d=i+2;r=Ce(this,p,e,n,c,l,u,a,s,d),r&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=o.materialIndex,t.push(r))}}else{let i=Math.max(0,f.start),o=Math.min(s.count,f.start+f.count);for(let s=i,d=o;s<d;s+=3){let i=s,o=s+1,d=s+2;r=Ce(this,a,e,n,c,l,u,i,o,d),r&&(r.faceIndex=Math.floor(s/3),t.push(r))}}}}},ys=/*@__PURE__*/ new Bi,bs=/*@__PURE__*/ new Bi,xs=/*@__PURE__*/ new Bi,Ss=/*@__PURE__*/ new Bi,Cs=/*@__PURE__*/ new V,ws=/*@__PURE__*/ new B,Ts=/*@__PURE__*/ new xo,Es=/*@__PURE__*/ new V,Ds=/*@__PURE__*/ new os,Os=class extends K{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type=`SkinnedMesh`,this.bindMode=nn,this.bindMatrix=new V,this.bindMatrixInverse=new V,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Wa),this.boundingBox.makeEmpty();let t=e.getAttribute(`position`);for(let e=0;e<t.count;e++)this.getVertexPosition(e,ws),this.boundingBox.expandByPoint(ws)}computeBoundingSphere(){let e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new xo),this.boundingSphere.makeEmpty();let t=e.getAttribute(`position`);for(let e=0;e<t.count;e++)this.getVertexPosition(e,ws),this.boundingSphere.expandByPoint(ws)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this.boundingBox=e.boundingBox===null?null:e.boundingBox.clone(),this.boundingSphere=e.boundingSphere===null?null:e.boundingSphere.clone(),this}raycast(e,t){let n=this.material,r=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Ts.copy(this.boundingSphere),Ts.applyMatrix4(r),e.ray.intersectsSphere(Ts)!==!1&&(Es.copy(r).invert(),Ds.copy(e.ray).applyMatrix4(Es),(this.boundingBox===null||Ds.intersectsBox(this.boundingBox)!==!1)&&this._computeIntersections(e,t,Ds)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new Bi,t=this.geometry.attributes.skinWeight;for(let n=0,r=t.count;n<r;n++){e.fromBufferAttribute(t,n);let r=1/e.manhattanLength();r===1/0?e.set(1,0,0,0):e.multiplyScalar(r),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===`attached`?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===`detached`?this.bindMatrixInverse.copy(this.bindMatrix).invert():x(`SkinnedMesh: Unrecognized bindMode: `+this.bindMode)}applyBoneTransform(e,t){let n=this.skeleton,r=this.geometry;bs.fromBufferAttribute(r.attributes.skinIndex,e),xs.fromBufferAttribute(r.attributes.skinWeight,e),t.isVector4?(ys.copy(t),t.set(0,0,0,0)):(ys.set(t.x,t.y,t.z,1),t.set(0,0,0)),ys.applyMatrix4(this.bindMatrix);for(let e=0;e<4;e++){let r=xs.getComponent(e);if(r!==0){let i=bs.getComponent(e);Cs.multiplyMatrices(n.bones[i].matrixWorld,n.boneInverses[i]),t.addScaledVector(Ss.copy(ys).applyMatrix4(Cs),r)}}return t.isVector4&&(t.w=ys.w),t.applyMatrix4(this.bindMatrixInverse)}},ks=class extends ya{constructor(){super(),this.isBone=!0,this.type=`Bone`}},As=class extends zi{constructor(e=null,t=1,n=1,r,i,a,o,s,c=cn,l=cn,u,d){super(null,a,o,s,c,l,r,i,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},js=/*@__PURE__*/ new V,Ms=/*@__PURE__*/ new V,Ns=class e{constructor(e=[],t=[]){this.uuid=T(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.previousBoneTexture=null,this.init()}init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){x(`Skeleton: Number of inverse bone matrices does not match amount of bones.`),this.boneInverses=[];for(let e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new V)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let t=new V;this.bones[e]&&t.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(t)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&(t.parent&&t.parent.isBone?(t.matrix.copy(t.parent.matrixWorld).invert(),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))}}update(){let e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture;for(let r=0,i=e.length;r<i;r++){let i=e[r]?e[r].matrixWorld:Ms;js.multiplyMatrices(i,t[r]),js.toArray(n,r*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new e(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);let t=new Float32Array(e*e*4);t.set(this.boneMatrices);let n=new As(t,e,e,Nn,wn);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){let n=this.bones[t];if(n.name===e)return n}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null),this.previousBoneTexture!==null&&(this.previousBoneTexture.dispose(),this.previousBoneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,r=e.bones.length;n<r;n++){let r=e.bones[n],i=t[r];i===void 0&&(x(`Skeleton: No bone found with UUID:`,r),i=new ks),this.bones.push(i),this.boneInverses.push(new V().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){let e={metadata:{version:4.7,type:`Skeleton`,generator:`Skeleton.toJSON`},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,n=this.boneInverses;for(let r=0,i=t.length;r<i;r++){let i=t[r];e.bones.push(i.uuid);let a=n[r];e.boneInverses.push(a.toArray())}return e}},Ps=class extends co{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}},Fs=/*@__PURE__*/ new V,Is=/*@__PURE__*/ new V,Ls=[],Rs=/*@__PURE__*/ new Wa,zs=/*@__PURE__*/ new V,Bs=/*@__PURE__*/ new K,Vs=/*@__PURE__*/ new xo,Hs=class extends K{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Ps(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let e=0;e<n;e++)this.setMatrixAt(e,zs)}computeBoundingBox(){let e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new Wa),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Fs),Rs.copy(e.boundingBox).applyMatrix4(Fs),this.boundingBox.union(Rs)}computeBoundingSphere(){let e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new xo),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Fs),Vs.copy(e.boundingSphere).applyMatrix4(Fs),this.boundingSphere.union(Vs)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),this.morphTexture=e.morphTexture===null?null:e.morphTexture.clone(),this.instanceColor=e.instanceColor===null?null:e.instanceColor.clone(),this.count=e.count,this.boundingBox=e.boundingBox===null?null:e.boundingBox.clone(),this.boundingSphere=e.boundingSphere===null?null:e.boundingSphere.clone(),this}getColorAt(e,t){return this.instanceColor===null?t.setRGB(1,1,1):t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){return t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){let n=t.morphTargetInfluences,r=this.morphTexture.source.data.data,i=e*(n.length+1)+1;for(let e=0;e<n.length;e++)n[e]=r[i+e]}raycast(e,t){let n=this.matrixWorld,r=this.count;if(Bs.geometry=this.geometry,Bs.material=this.material,Bs.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Vs.copy(this.boundingSphere),Vs.applyMatrix4(n),e.ray.intersectsSphere(Vs)!==!1))for(let i=0;i<r;i++){this.getMatrixAt(i,Fs),Is.multiplyMatrices(n,Fs),Bs.matrixWorld=Is,Bs.raycast(e,Ls);for(let e=0,n=Ls.length;e<n;e++){let n=Ls[e];n.instanceId=i,n.object=this,t.push(n)}Ls.length=0}}setColorAt(e,t){return this.instanceColor===null&&(this.instanceColor=new Ps(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3),this}setMatrixAt(e,t){return t.toArray(this.instanceMatrix.array,e*16),this}setMorphAt(e,t){let n=t.morphTargetInfluences,r=n.length+1;this.morphTexture===null&&(this.morphTexture=new As(new Float32Array(r*this.count),r,this.count,In,wn));let i=this.morphTexture.source.data.data,a=0;for(let e=0;e<n.length;e++)a+=n[e];let o=this.geometry.morphTargetsRelative?1:1-a,s=r*e;return i[s]=o,i.set(n,s+1),this}updateMorphTargets(){}dispose(){super.dispose(),this.instanceMatrix.dispose(),this.instanceColor!==null&&this.instanceColor.dispose(),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}},Us=/*@__PURE__*/ new xo,Ws=/*@__PURE__*/ new z(.5,.5),Gs=/*@__PURE__*/ new B,Ks=class{constructor(e=new Fo,t=new Fo,n=new Fo,r=new Fo,i=new Fo,a=new Fo){this.planes=[e,t,n,r,i,a]}set(e,t,n,r,i,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=si,n=!1){let r=this.planes,i=e.elements,a=i[0],o=i[1],s=i[2],c=i[3],l=i[4],u=i[5],d=i[6],f=i[7],p=i[8],m=i[9],h=i[10],g=i[11],_=i[12],v=i[13],y=i[14],b=i[15];if(r[0].setComponents(c-a,f-l,g-p,b-_).normalize(),r[1].setComponents(c+a,f+l,g+p,b+_).normalize(),r[2].setComponents(c+o,f+u,g+m,b+v).normalize(),r[3].setComponents(c-o,f-u,g-m,b-v).normalize(),n)r[4].setComponents(s,d,h,y).normalize(),r[5].setComponents(c-s,f-d,g-h,b-y).normalize();else if(r[4].setComponents(c-s,f-d,g-h,b-y).normalize(),t===2e3)r[5].setComponents(c+s,f+d,g+h,b+y).normalize();else if(t===2001)r[5].setComponents(s,d,h,y).normalize();else throw Error(`THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: `+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Us.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Us.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Us)}intersectsSprite(e){Us.center.set(0,0,0);let t=Ws.distanceTo(e.center);return Us.radius=.7071067811865476+t,Us.applyMatrix4(e.matrixWorld),this.intersectsSphere(Us)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){let t=this.planes;for(let n=0;n<6;n++){let r=t[n];if(Gs.x=r.normal.x>0?e.max.x:e.min.x,Gs.y=r.normal.y>0?e.max.y:e.min.y,Gs.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Gs)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},qs=/*@__PURE__*/ new V,Js=class e{constructor(){this.coordinateSystem=si,this._frustums=[],this._count=0}setFromArrayCamera(e){let t=e.cameras,n=this._frustums;for(let e=0;e<t.length;e++){let r=t[e];qs.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),n[e]===void 0&&(n[e]=new Ks),n[e].setFromProjectionMatrix(qs,r.coordinateSystem,r.reversedDepth)}return this._count=t.length,this}getFrustum(e){return this._frustums[e]}intersectsObject(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsObject(e))return!0;return!1}intersectsSprite(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSprite(e))return!0;return!1}intersectsSphere(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSphere(e))return!0;return!1}intersectsBox(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsBox(e))return!0;return!1}containsPoint(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].containsPoint(e))return!0;return!1}copy(e){this.coordinateSystem=e.coordinateSystem;let t=this._frustums,n=e._frustums;for(let r=0;r<e._count;r++)t[r]===void 0&&(t[r]=new Ks),t[r].copy(n[r]);return this._count=e._count,this}clone(){return new e().copy(this)}},Ys=class{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n,r){let i=this.pool,a=this.list;this.index>=i.length&&i.push({start:-1,count:-1,z:-1,index:-1});let o=i[this.index];a.push(o),this.index++,o.start=e,o.count=t,o.z=n,o.index=r}reset(){this.list.length=0,this.index=0}},Xs=/*@__PURE__*/ new V,Zs=/*@__PURE__*/ new H(1,1,1),Qs=/*@__PURE__*/ new Ks,$s=/*@__PURE__*/ new Js,ec=/*@__PURE__*/ new Wa,tc=/*@__PURE__*/ new xo,nc=/*@__PURE__*/ new B,rc=/*@__PURE__*/ new B,ic=/*@__PURE__*/ new B,ac=/*@__PURE__*/ new B,oc=/*@__PURE__*/ new Ys,sc=/*@__PURE__*/ new K,cc=[],lc=class extends K{constructor(e,t,n=t*2,r){super(new G,r),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawBytesPerElement=1,this._mergedDrawCounts=new Int32Array(e),this._mergedDrawStarts=new Int32Array(e),this._mergedDrawInstanceCounts=new Int32Array(e),this._mergedDrawCount=0,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._previousMatricesTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);let t=new Float32Array(e*e*4),n=new As(t,e,e,Nn,wn);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);let t=new Uint32Array(e*e),n=new As(t,e,e,Ln,Cn);this._indirectTexture=n}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);let t=new Float32Array(e*e*4).fill(1),n=new As(t,e,e,Nn,wn);n.colorSpace=ji.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){let t=this.geometry,n=this._maxVertexCount,r=this._maxIndexCount;if(this._geometryInitialized===!1){for(let r in e.attributes){let{array:i,itemSize:a,normalized:o}=e.getAttribute(r),s=new i.constructor(n*a),c=new co(s,a,o);t.setAttribute(r,c)}if(e.getIndex()!==null){let e=n>65535?new Uint32Array(r):new Uint16Array(r);t.setIndex(new co(e,1))}this._geometryInitialized=!0}}_validateGeometry(e){let t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw Error(`THREE.BatchedMesh: All geometries must consistently have "index".`);for(let n in t.attributes){if(!e.hasAttribute(n))throw Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);let r=e.getAttribute(n),i=t.getAttribute(n);if(r.itemSize!==i.itemSize||r.normalized!==i.normalized)throw Error(`THREE.BatchedMesh: Added geometry attribute "${n}" has an inconsistent itemSize or normalized value.`)}}validateInstanceId(e){let t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){let t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Wa);let e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,r=t.length;n<r;n++){if(t[n].active===!1)continue;let r=t[n].geometryIndex;this.getMatrixAt(n,Xs),this.getBoundingBoxAt(r,ec).applyMatrix4(Xs),e.union(ec)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new xo);let e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let n=0,r=t.length;n<r;n++){if(t[n].active===!1)continue;let r=t[n].geometryIndex;this.getMatrixAt(n,Xs),this.getBoundingSphereAt(r,tc).applyMatrix4(Xs),e.union(tc)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw Error(`THREE.BatchedMesh: Maximum item count reached.`);let t={visible:!0,active:!0,geometryIndex:e},n=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(we),n=this._availableInstanceIds.shift(),this._instanceInfo[n]=t):(n=this._instanceInfo.length,this._instanceInfo.push(t));let r=this._matricesTexture;Xs.identity().toArray(r.image.data,n*16),r.needsUpdate=!0;let i=this._colorsTexture;return i&&(Zs.toArray(i.image.data,n*4),i.needsUpdate=!0),this._visibilityChanged=!0,n}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);let r={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},i=this._geometryInfo;r.vertexStart=this._nextVertexStart,r.reservedVertexCount=t===-1?e.getAttribute(`position`).count:t;let a=e.getIndex();if(a!==null&&(r.indexStart=this._nextIndexStart,r.reservedIndexCount=n===-1?a.count:n),r.indexStart!==-1&&r.indexStart+r.reservedIndexCount>this._maxIndexCount||r.vertexStart+r.reservedVertexCount>this._maxVertexCount)throw Error(`THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.`);let o;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(we),o=this._availableGeometryIds.shift(),i[o]=r):(o=this._geometryCount,this._geometryCount++,i.push(r)),this.setGeometryAt(o,e),this._nextIndexStart=r.indexStart+r.reservedIndexCount,this._nextVertexStart=r.vertexStart+r.reservedVertexCount,o}setGeometryAt(e,t){if(e>=this._geometryCount)throw Error(`THREE.BatchedMesh: Maximum geometry count reached.`);this._validateGeometry(t);let n=this.geometry,r=n.getIndex()!==null,i=n.getIndex(),a=t.getIndex(),o=this._geometryInfo[e];if(r&&a.count>o.reservedIndexCount||t.attributes.position.count>o.reservedVertexCount)throw Error(`THREE.BatchedMesh: Reserved space not large enough for provided geometry.`);let s=o.vertexStart,c=o.reservedVertexCount;o.vertexCount=t.getAttribute(`position`).count;for(let e in n.attributes){let r=t.getAttribute(e),i=n.getAttribute(e);L(r,i,s);let a=r.itemSize;for(let e=r.count,t=c;e<t;e++){let t=s+e;for(let e=0;e<a;e++)i.setComponent(t,e,0)}i.needsUpdate=!0,i.addUpdateRange(s*a,c*a)}if(r){let e=o.indexStart,n=o.reservedIndexCount;o.indexCount=t.getIndex().count;for(let t=0;t<a.count;t++)i.setX(e+t,s+a.getX(t));for(let t=a.count,r=n;t<r;t++)i.setX(e+t,s);i.needsUpdate=!0,i.addUpdateRange(e,o.reservedIndexCount)}return o.start=r?o.indexStart:o.vertexStart,o.count=r?o.indexCount:o.vertexCount,o.boundingBox=null,t.boundingBox!==null&&(o.boundingBox=t.boundingBox.clone()),o.boundingSphere=null,t.boundingSphere!==null&&(o.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){let t=this._geometryInfo;if(e>=t.length||t[e].active===!1)return this;let n=this._instanceInfo;for(let t=0,r=n.length;t<r;t++)n[t].active&&n[t].geometryIndex===e&&this.deleteInstance(t);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,t=0,n=this._geometryInfo,r=n.map((e,t)=>t).sort((e,t)=>n[e].vertexStart-n[t].vertexStart),i=this.geometry;for(let a=0,o=n.length;a<o;a++){let o=n[r[a]];if(o.active!==!1){if(i.index!==null){if(o.indexStart!==t){let{indexStart:n,vertexStart:r,reservedIndexCount:a}=o,s=i.index,c=s.array,l=e-r;for(let e=n;e<n+a;e++)c[e]=c[e]+l;s.array.copyWithin(t,n,n+a),s.addUpdateRange(t,a),s.needsUpdate=!0,o.indexStart=t}t+=o.reservedIndexCount}if(o.vertexStart!==e){let{vertexStart:t,reservedVertexCount:n}=o,r=i.attributes;for(let i in r){let a=r[i],{array:o,itemSize:s}=a;o.copyWithin(e*s,t*s,(t+n)*s),a.addUpdateRange(e*s,n*s),a.needsUpdate=!0}o.vertexStart=e}e+=o.reservedVertexCount,o.start=i.index?o.indexStart:o.vertexStart}}return this._nextIndexStart=t,this._nextVertexStart=e,this._visibilityChanged=!0,this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;let n=this.geometry,r=this._geometryInfo[e];if(r.boundingBox===null){let e=new Wa,t=n.index,i=n.attributes.position;for(let n=r.start,a=r.start+r.count;n<a;n++){let r=n;t&&(r=t.getX(r)),e.expandByPoint(nc.fromBufferAttribute(i,r))}r.boundingBox=e}return t.copy(r.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;let n=this.geometry,r=this._geometryInfo[e];if(r.boundingSphere===null){let t=new xo;this.getBoundingBoxAt(e,ec),ec.getCenter(t.center);let i=n.index,a=n.attributes.position,o=0;for(let e=r.start,n=r.start+r.count;e<n;e++){let n=e;i&&(n=i.getX(n)),nc.fromBufferAttribute(a,n),o=Math.max(o,t.center.distanceToSquared(nc))}t.radius=Math.sqrt(o),r.boundingSphere=t}return t.copy(r.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);let n=this._matricesTexture,r=this._matricesTexture.image.data;return t.toArray(r,e*16),n.needsUpdate=!0,this}getMatrixAt(e,t){return this.validateInstanceId(e),t.fromArray(this._matricesTexture.image.data,e*16)}setColorAt(e,t){return this.validateInstanceId(e),this._colorsTexture===null&&this._initColorsTexture(),t.toArray(this._colorsTexture.image.data,e*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,t){return this.validateInstanceId(e),this._colorsTexture===null?t.isVector4?t.set(1,1,1,1):t.setRGB(1,1,1):t.fromArray(this._colorsTexture.image.data,e*4)}setVisibleAt(e,t){return this.validateInstanceId(e),this._instanceInfo[e].visible===t||(this._instanceInfo[e].visible=t,this._visibilityChanged=!0),this}getVisibleAt(e){return this.validateInstanceId(e),this._instanceInfo[e].visible}setGeometryIdAt(e,t){return this.validateInstanceId(e),this.validateGeometryId(t),this._instanceInfo[e].geometryIndex=t,this._visibilityChanged=!0,this}getGeometryIdAt(e){return this.validateInstanceId(e),this._instanceInfo[e].geometryIndex}getGeometryRangeAt(e,t={}){this.validateGeometryId(e);let n=this._geometryInfo[e];return t.vertexStart=n.vertexStart,t.vertexCount=n.vertexCount,t.reservedVertexCount=n.reservedVertexCount,t.indexStart=n.indexStart,t.indexCount=n.indexCount,t.reservedIndexCount=n.reservedIndexCount,t.start=n.start,t.count=n.count,t}setInstanceCount(e){let t=this._availableInstanceIds,n=this._instanceInfo;for(t.sort(we);t[t.length-1]===n.length-1;)n.pop(),t.pop();if(e<n.length)throw Error(`THREE.BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);let r=new Int32Array(e),i=new Int32Array(e);De(this._multiDrawCounts,r),De(this._multiDrawStarts,i),this._multiDrawCounts=r,this._multiDrawStarts=i;let a=new Int32Array(e),o=new Int32Array(e),s=new Int32Array(e);De(this._mergedDrawCounts,a),De(this._mergedDrawStarts,o),De(this._mergedDrawInstanceCounts,s),this._mergedDrawCounts=a,this._mergedDrawStarts=o,this._mergedDrawInstanceCounts=s,this._maxInstanceCount=e;let c=this._indirectTexture,l=this._matricesTexture,u=this._colorsTexture;c.dispose(),this._initIndirectTexture(),De(c.image.data,this._indirectTexture.image.data),l.dispose(),this._initMatricesTexture(),De(l.image.data,this._matricesTexture.image.data),u&&(u.dispose(),this._initColorsTexture(),De(u.image.data,this._colorsTexture.image.data)),this._previousMatricesTexture!==null&&(this._previousMatricesTexture.dispose(),this._previousMatricesTexture=null)}setGeometrySize(e,t){let n=[...this._geometryInfo].filter(e=>e.active);if(Math.max(...n.map(e=>e.vertexStart+e.reservedVertexCount))>e)throw Error(`THREE.BatchedMesh: Geometry vertex values are being used outside the range ${e}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(e=>e.indexStart+e.reservedIndexCount))>t)throw Error(`THREE.BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);let r=this.geometry;r.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new G,this._initializeGeometry(r));let i=this.geometry;r.index&&De(r.index.array,i.index.array);for(let e in r.attributes)De(r.attributes[e].array,i.attributes[e].array);this._visibilityChanged=!0}raycast(e,t){let n=this._instanceInfo,r=this._geometryInfo,i=this.matrixWorld,a=this.geometry;sc.material=this.material,sc.geometry.index=a.index,sc.geometry.attributes=a.attributes,sc.geometry.boundingBox===null&&(sc.geometry.boundingBox=new Wa),sc.geometry.boundingSphere===null&&(sc.geometry.boundingSphere=new xo);for(let a=0,o=n.length;a<o;a++){if(!n[a].visible||!n[a].active)continue;let o=n[a].geometryIndex,s=r[o];sc.geometry.setDrawRange(s.start,s.count),this.getMatrixAt(a,sc.matrixWorld).premultiply(i),this.getBoundingBoxAt(o,sc.geometry.boundingBox),this.getBoundingSphereAt(o,sc.geometry.boundingSphere),sc.raycast(e,cc);for(let e=0,n=cc.length;e<n;e++){let n=cc[e];n.object=this,n.batchId=a,t.push(n)}cc.length=0}sc.material=null,sc.geometry.index=null,sc.geometry.attributes={},sc.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox===null?null:e.boundingBox.clone(),this.boundingSphere=e.boundingSphere===null?null:e.boundingSphere.clone(),this._geometryInfo=e._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox===null?null:e.boundingBox.clone(),boundingSphere:e.boundingSphere===null?null:e.boundingSphere.clone()})),this._instanceInfo=e._instanceInfo.map(e=>({...e})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._multiDrawBytesPerElement=e._multiDrawBytesPerElement,this._mergedDrawCounts=e._mergedDrawCounts.slice(),this._mergedDrawStarts=e._mergedDrawStarts.slice(),this._mergedDrawInstanceCounts=e._mergedDrawInstanceCounts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),e._colorsTexture===null?this._colorsTexture=null:(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){super.dispose(),this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null),this._previousMatricesTexture!==null&&(this._previousMatricesTexture.dispose(),this._previousMatricesTexture=null)}_updateDrawParameters(e,t,n,r=`multiDraw`){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;let i=t.getIndex(),a=i===null?1:i.array.BYTES_PER_ELEMENT,o=1;n.wireframe&&(o=2,a=t.attributes.position.count>65535?4:2);let s=this._instanceInfo,c=this._multiDrawStarts,l=this._multiDrawCounts,u=this._mergedDrawStarts,d=this._mergedDrawCounts,f=this._mergedDrawInstanceCounts,p=this._geometryInfo,m=this.perObjectFrustumCulled,h=this._indirectTexture,g=h.image.data,_=e.isArrayCamera?$s:Qs;m&&(e.isArrayCamera?_.setFromArrayCamera(e):(Xs.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse).multiply(this.matrixWorld),_.setFromProjectionMatrix(Xs,e.coordinateSystem,e.reversedDepth)));let v=0,y=0;if(this.sortObjects){Xs.copy(this.matrixWorld).invert(),rc.setFromMatrixPosition(e.matrixWorld).applyMatrix4(Xs),ic.set(0,0,-1).transformDirection(e.matrixWorld).transformDirection(Xs);for(let e=0,t=s.length;e<t;e++)if(s[e].visible&&s[e].active){let t=s[e].geometryIndex;this.getMatrixAt(e,Xs),this.getBoundingSphereAt(t,tc).applyMatrix4(Xs);let n=!1;if(m&&(n=!_.intersectsSphere(tc)),!n){let n=p[t],r=ac.subVectors(tc.center,rc).dot(ic);oc.push(n.start,n.count,r,e)}}let t=oc.list,i=this.customSort;i===null?t.sort(n.transparent?Ee:Te):i.call(this,t,e);for(let e=0,n=t.length;e<n;e++){let n=t[e],i=n.start*a*o,s=n.count*o;r===`merged`?y>0&&u[y-1]===i&&d[y-1]===s?f[y-1]++:(u[y]=i,d[y]=s,f[y]=1,y++):(c[v]=i,l[v]=s),g[v]=n.index,v++}oc.reset()}else for(let e=0,t=s.length;e<t;e++)if(s[e].visible&&s[e].active){let t=s[e].geometryIndex,n=!1;if(m&&(this.getMatrixAt(e,Xs),this.getBoundingSphereAt(t,tc).applyMatrix4(Xs),n=!_.intersectsSphere(tc)),!n){let n=p[t],i=n.start*a*o,s=n.count*o;r===`merged`?y>0&&u[y-1]===i&&d[y-1]===s?f[y-1]++:(u[y]=i,d[y]=s,f[y]=1,y++):(c[v]=i,l[v]=s),g[v]=e,v++}}h.needsUpdate=!0,this._multiDrawCount=v,this._mergedDrawCount=y,this._multiDrawBytesPerElement=a,this._visibilityChanged=!1}onBeforeRender(e,t,n,r,i){e.isWebGPURenderer===!0?(this._visibilityChanged||this.perObjectFrustumCulled||this.sortObjects)&&(this._indirectTexture.needsUpdate=!0):this._updateDrawParameters(n,r,i)}onBeforeShadow(e,t,n,r,i,a){e.isWebGPURenderer!==!0&&this._updateDrawParameters(r,i,a)}},uc=class extends Lo{constructor(e){super(),this.isLineBasicMaterial=!0,this.type=`LineBasicMaterial`,this.color=new H(16777215),this.map=null,this.linewidth=1,this.linecap=`round`,this.linejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},dc=/*@__PURE__*/ new B,fc=/*@__PURE__*/ new B,pc=/*@__PURE__*/ new V,mc=/*@__PURE__*/ new os,hc=/*@__PURE__*/ new xo,gc=/*@__PURE__*/ new B,_c=/*@__PURE__*/ new B,vc=class extends ya{constructor(e=new G,t=new uc){super(),this.isLine=!0,this.type=`Line`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.morphTargetInfluences=e.morphTargetInfluences===void 0?void 0:e.morphTargetInfluences.slice(),this.morphTargetDictionary=e.morphTargetDictionary===void 0?void 0:Object.assign({},e.morphTargetDictionary),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let e=1,r=t.count;e<r;e++)dc.fromBufferAttribute(t,e-1),fc.fromBufferAttribute(t,e),n[e]=n[e-1],n[e]+=dc.distanceTo(fc);e.setAttribute(`lineDistance`,new W(n,1))}else x(`Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`);return this}intersectsFrustum(e){return e.intersectsObject(this)}raycast(e,t){let n=this.geometry,r=this.matrixWorld,i=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),hc.copy(n.boundingSphere),hc.applyMatrix4(r),hc.radius+=i,e.ray.intersectsSphere(hc)===!1)return;pc.copy(r).invert(),mc.copy(e.ray).applyMatrix4(pc);let o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,c=this.isLineSegments?2:1,l=n.index,u=n.attributes.position;if(l!==null){let n=Math.max(0,a.start),r=Math.min(l.count,a.start+a.count);for(let i=n,a=r-1;i<a;i+=c){let n=l.getX(i),r=l.getX(i+1),a=Oe(this,e,mc,s,n,r,i);a&&t.push(a)}if(this.isLineLoop){let i=l.getX(r-1),a=l.getX(n),o=Oe(this,e,mc,s,i,a,r-1);o&&t.push(o)}}else{let n=Math.max(0,a.start),r=Math.min(u.count,a.start+a.count);for(let i=n,a=r-1;i<a;i+=c){let n=Oe(this,e,mc,s,i,i+1,i);n&&t.push(n)}if(this.isLineLoop){let i=Oe(this,e,mc,s,r-1,n,r-1);i&&t.push(i)}}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}},yc=/*@__PURE__*/ new B,bc=/*@__PURE__*/ new B,xc=class extends vc{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type=`LineSegments`}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let e=0,r=t.count;e<r;e+=2)yc.fromBufferAttribute(t,e),bc.fromBufferAttribute(t,e+1),n[e]=e===0?0:n[e-1],n[e+1]=n[e]+yc.distanceTo(bc);e.setAttribute(`lineDistance`,new W(n,1))}else x(`LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.`);return this}},Sc=class extends vc{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type=`LineLoop`}},Cc=class extends Lo{constructor(e){super(),this.isPointsMaterial=!0,this.type=`PointsMaterial`,this.color=new H(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},wc=/*@__PURE__*/ new V,Tc=/*@__PURE__*/ new os,Ec=/*@__PURE__*/ new xo,Dc=/*@__PURE__*/ new B,Oc=class extends ya{constructor(e=new G,t=new Cc){super(),this.isPoints=!0,this.type=`Points`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.morphTargetInfluences=e.morphTargetInfluences===void 0?void 0:e.morphTargetInfluences.slice(),this.morphTargetDictionary=e.morphTargetDictionary===void 0?void 0:Object.assign({},e.morphTargetDictionary),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}intersectsFrustum(e){return e.intersectsObject(this)}raycast(e,t){let n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Ec.copy(n.boundingSphere),Ec.applyMatrix4(r),Ec.radius+=i,e.ray.intersectsSphere(Ec)===!1)return;wc.copy(r).invert(),Tc.copy(e.ray).applyMatrix4(wc);let o=i/((this.scale.x+this.scale.y+this.scale.z)/3),s=o*o,c=n.index,l=n.attributes.position;if(c!==null){let n=Math.max(0,a.start),i=Math.min(c.count,a.start+a.count);for(let a=n,o=i;a<o;a++){let n=c.getX(a);Dc.fromBufferAttribute(l,n),ke(Dc,n,s,r,e,t,this)}}else{let n=Math.max(0,a.start),i=Math.min(l.count,a.start+a.count);for(let a=n,o=i;a<o;a++)Dc.fromBufferAttribute(l,a),ke(Dc,a,s,r,e,t,this)}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){let t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}},kc=class extends zi{constructor(e,t,n,r,i=pn,a=pn,o,s,c){super(e,t,n,r,i,a,o,s,c),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;let l=this;function u(){l.needsUpdate=!0,l._requestVideoFrameCallbackId=e.requestVideoFrameCallback(u)}`requestVideoFrameCallback`in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(u))}clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;!(`requestVideoFrameCallback`in e)&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}},Ac=class extends kc{constructor(e,t,n,r,i,a,o,s){super({},e,t,n,r,i,a,o,s),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}},jc=class extends zi{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=cn,this.minFilter=cn,this.generateMipmaps=!1,this.needsUpdate=!0}copy(e){return super.copy(e),this.source=new Fi(Object.assign({},e.image)),this}},Mc=class extends zi{constructor(e=[],t,n,r,i,a,o,s,c,l,u,d){super(null,a,o,s,c,l,r,i,u,d),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}},Nc=class extends Mc{constructor(e,t,n,r,i,a){super(e,t,n,i,a),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=on,this.layerUpdates=/* @__PURE__ */ new Set}copy(e){return super.copy(e),this.wrapR=e.wrapR,this}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}},Pc=class extends Mc{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,301),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}},Fc=class extends zi{constructor(e=[],t=301,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,s,c,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},Ic=class extends zi{constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r,i,a,o,s,c),this.isCanvasTexture=!0,this.needsUpdate=!0}},Lc=class extends zi{constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r,i,a,o,s,c),this.isHTMLTexture=!0,this.generateMipmaps=!1,this.needsUpdate=!0;let l=e?e.parentNode:null;l!==null&&`requestPaint`in l&&(l.onpaint=()=>{this.needsUpdate=!0},l.requestPaint())}dispose(){let e=this.image?this.image.parentNode:null;e!==null&&`onpaint`in e&&(e.onpaint=null),super.dispose()}},Rc=class extends zi{constructor(e,t,n=Cn,r,i,a,o=cn,s=cn,c,l=Pn,u=1){if(l!==1026&&l!==1027)throw Error(`THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat`);super({width:e,height:t,depth:u},r,i,a,o,s,l,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Fi(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return t.compareFunction=this.compareFunction,t}},zc=class extends Rc{constructor(e,t=Cn,n=301,r,i,a=cn,o=cn,s,c=Pn){let l={width:e,height:e,depth:1},u=[l,l,l,l,l,l];super(e,e,t,n,r,i,a,o,s,c),this.image=u,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},Bc=class extends zi{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},Vc=class e extends G{constructor(e=1,t=1,n=1,r=1,i=1,a=1){super(),this.type=`BoxGeometry`,this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};let o=this;r=Math.floor(r),i=Math.floor(i),a=Math.floor(a);let s=[],c=[],l=[],u=[],d=0,f=0;p(`z`,`y`,`x`,-1,-1,n,t,e,a,i,0),p(`z`,`y`,`x`,1,-1,n,t,-e,a,i,1),p(`x`,`z`,`y`,1,1,e,n,t,r,a,2),p(`x`,`z`,`y`,1,-1,e,n,-t,r,a,3),p(`x`,`y`,`z`,1,-1,e,t,n,r,i,4),p(`x`,`y`,`z`,-1,-1,e,t,-n,r,i,5),this.setIndex(s),this.setAttribute(`position`,new W(c,3)),this.setAttribute(`normal`,new W(l,3)),this.setAttribute(`uv`,new W(u,2));function p(e,t,n,r,i,a,p,m,h,g,_){let v=a/h,y=p/g,b=a/2,x=p/2,S=m/2,C=h+1,w=g+1,T=0,E=0,D=new B;for(let a=0;a<w;a++){let o=a*y-x;for(let s=0;s<C;s++)D[e]=(s*v-b)*r,D[t]=o*i,D[n]=S,c.push(D.x,D.y,D.z),D[e]=0,D[t]=0,D[n]=m>0?1:-1,l.push(D.x,D.y,D.z),u.push(s/h),u.push(1-a/g),T+=1}for(let e=0;e<g;e++)for(let t=0;t<h;t++){let n=d+t+C*e,r=d+t+C*(e+1),i=d+(t+1)+C*(e+1),a=d+(t+1)+C*e;s.push(n,r,a),s.push(r,i,a),E+=6}o.addGroup(f,E,_),f+=E,d+=T}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}},Hc=class e extends G{constructor(e=1,t=1,n=4,r=8,i=1){super(),this.type=`CapsuleGeometry`,this.parameters={radius:e,height:t,capSegments:n,radialSegments:r,heightSegments:i},t=Math.max(0,t),n=Math.max(1,Math.floor(n)),r=Math.max(3,Math.floor(r)),i=Math.max(1,Math.floor(i));let a=[],o=[],s=[],c=[],l=t/2,u=Math.PI/2*e,d=t,f=2*u+d,p=n*2+i,m=r+1,h=new B,g=new B;for(let _=0;_<=p;_++){let v=0,y=0,b=0,x=0;if(_<=n){let t=_/n,r=t*Math.PI/2;y=-l-e*Math.cos(r),b=e*Math.sin(r),x=-e*Math.cos(r),v=t*u}else if(_<=n+i){let r=(_-n)/i;y=-l+r*t,b=e,x=0,v=u+r*d}else{let t=(_-n-i)/n,r=t*Math.PI/2;y=l+e*Math.sin(r),b=e*Math.cos(r),x=e*Math.sin(r),v=u+d+t*u}let S=Math.max(0,Math.min(1,v/f)),C=0;_===0?C=.5/r:_===p&&(C=-.5/r);for(let e=0;e<=r;e++){let t=e/r,n=t*Math.PI*2,i=Math.sin(n),a=Math.cos(n);g.x=-b*a,g.y=y,g.z=b*i,o.push(g.x,g.y,g.z),h.set(-b*a,x,b*i),h.normalize(),s.push(h.x,h.y,h.z),c.push(t+C,S)}if(_>0){let e=(_-1)*m;for(let t=0;t<r;t++){let n=e+t,r=e+t+1,i=_*m+t,o=_*m+t+1;a.push(n,r,i),a.push(r,o,i)}}}this.setIndex(a),this.setAttribute(`position`,new W(o,3)),this.setAttribute(`normal`,new W(s,3)),this.setAttribute(`uv`,new W(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.height,t.capSegments,t.radialSegments,t.heightSegments)}},Uc=class e extends G{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type=`CircleGeometry`,this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);let i=[],a=[],o=[],s=[],c=new B,l=new z;a.push(0,0,0),o.push(0,0,1),s.push(.5,.5);for(let i=0,u=3;i<=t;i++,u+=3){let d=n+i/t*r;c.x=e*Math.cos(d),c.y=e*Math.sin(d),a.push(c.x,c.y,c.z),o.push(0,0,1),l.x=(a[u]/e+1)/2,l.y=(a[u+1]/e+1)/2,s.push(l.x,l.y)}for(let e=1;e<=t;e++)i.push(e,e+1,0);this.setIndex(i),this.setAttribute(`position`,new W(a,3)),this.setAttribute(`normal`,new W(o,3)),this.setAttribute(`uv`,new W(s,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.segments,t.thetaStart,t.thetaLength)}},Wc=class e extends G{constructor(e=1,t=1,n=1,r=32,i=1,a=!1,o=0,s=Math.PI*2){super(),this.type=`CylinderGeometry`,this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s};let c=this;r=Math.floor(r),i=Math.floor(i);let l=[],u=[],d=[],f=[],p=0,m=[],h=n/2,g=0;_(),a===!1&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(l),this.setAttribute(`position`,new W(u,3)),this.setAttribute(`normal`,new W(d,3)),this.setAttribute(`uv`,new W(f,2));function _(){let a=new B,_=new B,v=0,y=(t-e)/n;for(let c=0;c<=i;c++){let l=[],g=c/i,v=g*(t-e)+e;for(let e=0;e<=r;e++){let t=e/r,i=t*s+o,c=Math.sin(i),m=Math.cos(i);_.x=v*c,_.y=-g*n+h,_.z=v*m,u.push(_.x,_.y,_.z),a.set(c,y,m).normalize(),d.push(a.x,a.y,a.z),f.push(t,1-g),l.push(p++)}m.push(l)}for(let n=0;n<r;n++)for(let r=0;r<i;r++){let a=m[r][n],o=m[r+1][n],s=m[r+1][n+1],c=m[r][n+1];(e>0||r!==0)&&(l.push(a,o,c),v+=3),(t>0||r!==i-1)&&(l.push(o,s,c),v+=3)}c.addGroup(g,v,0),g+=v}function v(n){let i=p,a=new z,m=new B,_=0,v=n===!0?e:t,y=n===!0?1:-1;for(let e=1;e<=r;e++)u.push(0,h*y,0),d.push(0,y,0),f.push(.5,.5),p++;let b=p;for(let e=0;e<=r;e++){let t=e/r*s+o,n=Math.cos(t),i=Math.sin(t);m.x=v*i,m.y=h*y,m.z=v*n,u.push(m.x,m.y,m.z),d.push(0,y,0),a.x=n*.5+.5,a.y=i*.5*y+.5,f.push(a.x,a.y),p++}for(let e=0;e<r;e++){let t=i+e,r=b+e;n===!0?l.push(r,r+1,t):l.push(r+1,r,t),_+=3}c.addGroup(g,_,n===!0?1:2),g+=_}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},Gc=class e extends Wc{constructor(e=1,t=1,n=32,r=1,i=!1,a=0,o=Math.PI*2){super(0,e,t,n,r,i,a,o),this.type=`ConeGeometry`,this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}static fromJSON(t){return new e(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},Kc=class e extends G{constructor(e=[],t=[],n=1,r=0){super(),this.type=`PolyhedronGeometry`,this.parameters={vertices:e,indices:t,radius:n,detail:r};let i=[],a=[];o(r),c(n),l(),this.setAttribute(`position`,new W(i,3)),this.setAttribute(`normal`,new W(i.slice(),3)),this.setAttribute(`uv`,new W(a,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function o(e){let n=new B,r=new B,i=new B;for(let a=0;a<t.length;a+=3)f(t[a+0],n),f(t[a+1],r),f(t[a+2],i),s(n,r,i,e)}function s(e,t,n,r){let i=r+1,a=[];for(let r=0;r<=i;r++){a[r]=[];let o=e.clone().lerp(n,r/i),s=t.clone().lerp(n,r/i),c=i-r;for(let e=0;e<=c;e++)e===0&&r===i?a[r][e]=o:a[r][e]=o.clone().lerp(s,e/c)}for(let e=0;e<i;e++)for(let t=0;t<2*(i-e)-1;t++){let n=Math.floor(t/2);t%2==0?(d(a[e][n+1]),d(a[e+1][n]),d(a[e][n])):(d(a[e][n+1]),d(a[e+1][n+1]),d(a[e+1][n]))}}function c(e){let t=new B;for(let n=0;n<i.length;n+=3)t.x=i[n+0],t.y=i[n+1],t.z=i[n+2],t.normalize().multiplyScalar(e),i[n+0]=t.x,i[n+1]=t.y,i[n+2]=t.z}function l(){let e=new B;for(let t=0;t<i.length;t+=3){e.x=i[t+0],e.y=i[t+1],e.z=i[t+2];let n=h(e)/2/Math.PI+.5,r=g(e)/Math.PI+.5;a.push(n,1-r)}p(),u()}function u(){for(let e=0;e<a.length;e+=6){let t=a[e+0],n=a[e+2],r=a[e+4];Math.max(t,n,r)>.9&&Math.min(t,n,r)<.1&&(t<.2&&(a[e+0]+=1),n<.2&&(a[e+2]+=1),r<.2&&(a[e+4]+=1))}}function d(e){i.push(e.x,e.y,e.z)}function f(t,n){let r=t*3;n.x=e[r+0],n.y=e[r+1],n.z=e[r+2]}function p(){let e=new B,t=new B,n=new B,r=new B,o=new z,s=new z,c=new z;for(let l=0,u=0;l<i.length;l+=9,u+=6){e.set(i[l+0],i[l+1],i[l+2]),t.set(i[l+3],i[l+4],i[l+5]),n.set(i[l+6],i[l+7],i[l+8]),o.set(a[u+0],a[u+1]),s.set(a[u+2],a[u+3]),c.set(a[u+4],a[u+5]),r.copy(e).add(t).add(n).divideScalar(3);let d=h(r);m(o,u+0,e,d),m(s,u+2,t,d),m(c,u+4,n,d)}}function m(e,t,n,r){r<0&&e.x===1&&(a[t]=e.x-1),n.x===0&&n.z===0&&(a[t]=r/2/Math.PI+.5)}function h(e){return Math.atan2(e.z,-e.x)}function g(e){return Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.vertices,t.indices,t.radius,t.detail)}},qc=class e extends Kc{constructor(e=1,t=0){let n=(1+Math.sqrt(5))/2,r=1/n,i=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r];super(i,[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type=`DodecahedronGeometry`,this.parameters={radius:e,detail:t}}static fromJSON(t){return new e(t.radius,t.detail)}},Jc=/*@__PURE__*/ new B,Yc=/*@__PURE__*/ new B,Xc=/*@__PURE__*/ new B,Zc=/*@__PURE__*/ new Ua,Qc=class extends G{constructor(e=null,t=1){if(super(),this.type=`EdgesGeometry`,this.parameters={geometry:e,thresholdAngle:t},e!==null){let n=1e4,r=Math.cos(xi*t),i=e.getIndex(),a=e.getAttribute(`position`),o=i?i.count:a.count,s=[0,0,0],c=[`a`,`b`,`c`],l=[,,,],u=/* @__PURE__ */ new Map,d=[];for(let e=0;e<o;e+=3){i?(s[0]=i.getX(e),s[1]=i.getX(e+1),s[2]=i.getX(e+2)):(s[0]=e,s[1]=e+1,s[2]=e+2);let{a:t,b:o,c:f}=Zc;if(t.fromBufferAttribute(a,s[0]),o.fromBufferAttribute(a,s[1]),f.fromBufferAttribute(a,s[2]),Zc.getNormal(Xc),l[0]=`${Math.round(t.x*n)},${Math.round(t.y*n)},${Math.round(t.z*n)}`,l[1]=`${Math.round(o.x*n)},${Math.round(o.y*n)},${Math.round(o.z*n)}`,l[2]=`${Math.round(f.x*n)},${Math.round(f.y*n)},${Math.round(f.z*n)}`,l[0]!==l[1]&&l[1]!==l[2]&&l[2]!==l[0])for(let e=0;e<3;e++){let t=(e+1)%3,n=l[e],i=l[t],a=Zc[c[e]],o=Zc[c[t]],f=`${n}_${i}`,p=`${i}_${n}`,m=u.get(p);m?(Xc.dot(m.normal)<=r&&(d.push(a.x,a.y,a.z),d.push(o.x,o.y,o.z)),u.set(p,null)):u.has(f)||u.set(f,{index0:s[e],index1:s[t],normal:Xc.clone()})}}for(let e of u.values())if(e){let{index0:t,index1:n}=e;Jc.fromBufferAttribute(a,t),Yc.fromBufferAttribute(a,n),d.push(Jc.x,Jc.y,Jc.z),d.push(Yc.x,Yc.y,Yc.z)}this.setAttribute(`position`,new W(d,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}},$c=class{constructor(){this.type=`Curve`,this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){x(`Curve: .getPoint() not implemented.`)}getPointAt(e,t){let n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],n,r=this.getPoint(0),i=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),i+=n.distanceTo(r),t.push(i),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){let n=this.getLengths(),r=0,i=n.length,a;a=t||e*n[i-1];let o=0,s=i-1,c;for(;o<=s;)if(r=Math.floor(o+(s-o)/2),c=n[r]-a,c<0)o=r+1;else if(c>0)s=r-1;else{s=r;break}if(r=s,n[r]===a)return r/(i-1);let l=n[r],u=n[r+1]-l,d=(a-l)/u;return(r+d)/(i-1)}getTangent(e,t){let n=1e-4,r=e-n,i=e+n;r<0&&(r=0),i>1&&(i=1);let a=this.getPoint(r),o=this.getPoint(i),s=t||(a.isVector2?new z:new B);return s.copy(o).sub(a).normalize(),s}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){let n=new B,r=[],i=[],a=[],o=new B,s=new V;for(let t=0;t<=e;t++){let n=t/e;r[t]=this.getTangentAt(n,new B)}i[0]=new B,a[0]=new B;let c=Number.MAX_VALUE,l=Math.abs(r[0].x),u=Math.abs(r[0].y),d=Math.abs(r[0].z);l<=c&&(c=l,n.set(1,0,0)),u<=c&&(c=u,n.set(0,1,0)),d<=c&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),a[0].crossVectors(r[0],i[0]);for(let t=1;t<=e;t++){if(i[t]=i[t-1].clone(),a[t]=a[t-1].clone(),o.crossVectors(r[t-1],r[t]),o.length()>2**-52){o.normalize();let e=Math.acos(E(r[t-1].dot(r[t]),-1,1));i[t].applyMatrix4(s.makeRotationAxis(o,e))}a[t].crossVectors(r[t],i[t])}if(t===!0){let t=Math.acos(E(i[0].dot(i[e]),-1,1));t/=e,r[0].dot(o.crossVectors(i[0],i[e]))>0&&(t=-t);for(let n=1;n<=e;n++)i[n].applyMatrix4(s.makeRotationAxis(r[n],t*n)),a[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this.cacheArcLengths=null,this}toJSON(){let e={metadata:{version:4.7,type:`Curve`,generator:`Curve.toJSON`}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this.cacheArcLengths=null,this}},el=class extends $c{constructor(e=0,t=0,n=1,r=1,i=0,a=Math.PI*2,o=!1,s=0){super(),this.isEllipseCurve=!0,this.type=`EllipseCurve`,this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=a,this.aClockwise=o,this.aRotation=s}getPoint(e,t=new z){let n=t,r=Math.PI*2,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<2**-52;for(;i<0;)i+=r;for(;i>r;)i-=r;i<2**-52&&(i=a?0:r),this.aClockwise===!0&&!a&&(i===r?i=-r:i-=r);let o=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){let e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),n=s-this.aX,r=c-this.aY;s=n*e-r*t+this.aX,c=n*t+r*e+this.aY}return n.set(s,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}},tl=class extends el{constructor(e,t,n,r,i,a){super(e,t,n,n,r,i,a),this.isArcCurve=!0,this.type=`ArcCurve`}},nl=/*@__PURE__*/ new B,rl=/*@__PURE__*/ new B,il=/*@__PURE__*/ new R,al=/*@__PURE__*/ new R,ol=/*@__PURE__*/ new R,sl=class extends $c{constructor(e=[],t=!1,n=`centripetal`,r=.5){super(),this.isCatmullRomCurve3=!0,this.type=`CatmullRomCurve3`,this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new B){let n=t,r=this.points,i=r.length,a=(i-+!this.closed)*e,o=Math.floor(a),s=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/i)+1)*i:s===0&&o===i-1&&(o=i-2,s=1);let c,l;this.closed||o>0?c=r[(o-1)%i]:(rl.subVectors(r[0],r[1]).add(r[0]),c=rl);let u=r[o%i],d=r[(o+1)%i];if(this.closed||o+2<i?l=r[(o+2)%i]:(nl.subVectors(r[i-1],r[i-2]).add(r[i-1]),l=nl),this.curveType===`centripetal`||this.curveType===`chordal`){let e=this.curveType===`chordal`?.5:.25,t=c.distanceToSquared(u)**+e,n=u.distanceToSquared(d)**+e,r=d.distanceToSquared(l)**+e;n<1e-4&&(n=1),t<1e-4&&(t=n),r<1e-4&&(r=n),il.initNonuniformCatmullRom(c.x,u.x,d.x,l.x,t,n,r),al.initNonuniformCatmullRom(c.y,u.y,d.y,l.y,t,n,r),ol.initNonuniformCatmullRom(c.z,u.z,d.z,l.z,t,n,r)}else this.curveType===`catmullrom`&&(il.initCatmullRom(c.x,u.x,d.x,l.x,this.tension),al.initCatmullRom(c.y,u.y,d.y,l.y,this.tension),ol.initCatmullRom(c.z,u.z,d.z,l.z,this.tension));return n.set(il.calc(s),al.calc(s),ol.calc(s)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let n=this.points[t];e.points.push(n.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(new B().fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}},cl=class extends $c{constructor(e=new z,t=new z,n=new z,r=new z){super(),this.isCubicBezierCurve=!0,this.type=`CubicBezierCurve`,this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new z){let n=t,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(ze(e,r.x,i.x,a.x,o.x),ze(e,r.y,i.y,a.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},ll=class extends $c{constructor(e=new B,t=new B,n=new B,r=new B){super(),this.isCubicBezierCurve3=!0,this.type=`CubicBezierCurve3`,this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new B){let n=t,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(ze(e,r.x,i.x,a.x,o.x),ze(e,r.y,i.y,a.y,o.y),ze(e,r.z,i.z,a.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},ul=class extends $c{constructor(e=new z,t=new z){super(),this.isLineCurve=!0,this.type=`LineCurve`,this.v1=e,this.v2=t}getPoint(e,t=new z){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new z){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},dl=class extends $c{constructor(e=new B,t=new B){super(),this.isLineCurve3=!0,this.type=`LineCurve3`,this.v1=e,this.v2=t}getPoint(e,t=new B){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new B){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},fl=class extends $c{constructor(e=new z,t=new z,n=new z){super(),this.isQuadraticBezierCurve=!0,this.type=`QuadraticBezierCurve`,this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new z){let n=t,r=this.v0,i=this.v1,a=this.v2;return n.set(Pe(e,r.x,i.x,a.x),Pe(e,r.y,i.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},pl=class extends $c{constructor(e=new B,t=new B,n=new B){super(),this.isQuadraticBezierCurve3=!0,this.type=`QuadraticBezierCurve3`,this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new B){let n=t,r=this.v0,i=this.v1,a=this.v2;return n.set(Pe(e,r.x,i.x,a.x),Pe(e,r.y,i.y,a.y),Pe(e,r.z,i.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},ml=class extends $c{constructor(e=[]){super(),this.isSplineCurve=!0,this.type=`SplineCurve`,this.points=e}getPoint(e,t=new z){let n=t,r=this.points,i=(r.length-1)*e,a=Math.floor(i),o=i-a,s=r[a===0?a:a-1],c=r[a],l=r[a>r.length-2?r.length-1:a+1],u=r[a>r.length-3?r.length-1:a+2];return n.set(Ae(o,s.x,c.x,l.x,u.x),Ae(o,s.y,c.y,l.y,u.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let n=this.points[t];e.points.push(n.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(new z().fromArray(n))}return this}},hl=/*#__PURE__*/ Object.freeze({__proto__:null,ArcCurve:tl,CatmullRomCurve3:sl,CubicBezierCurve:cl,CubicBezierCurve3:ll,EllipseCurve:el,LineCurve:ul,LineCurve3:dl,QuadraticBezierCurve:fl,QuadraticBezierCurve3:pl,SplineCurve:ml}),gl=class extends $c{constructor(){super(),this.type=`CurvePath`,this.curves=[],this.autoClose=!1,this.cacheLengths=null}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){let n=e.isVector2===!0?`LineCurve`:`LineCurve3`;this.curves.push(new hl[n](t,e))}return this}getPoint(e,t){let n=e*this.getLength(),r=this.getCurveLengths(),i=0;for(;i<r.length;){if(r[i]>=n){let e=r[i]-n,a=this.curves[i],o=a.getLength(),s=o===0?0:1-e/o;return a.getPointAt(s,t)}i++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],n;for(let r=0,i=this.curves;r<i.length;r++){let a=i[r],o=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o);for(let e=0;e<s.length;e++){let r=s[e];n&&n.equals(r)||(t.push(r),n=r)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this.cacheLengths=null,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){let n=this.curves[t];e.curves.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let n=e.curves[t];this.curves.push(new hl[n.type]().fromJSON(n))}return this.cacheLengths=null,this}},_l=class extends gl{constructor(e){super(),this.type=`Path`,this.currentPoint=new z,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let n=new ul(this.currentPoint.clone(),new z(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,r){let i=new fl(this.currentPoint.clone(),new z(e,t),new z(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this}bezierCurveTo(e,t,n,r,i,a){let o=new cl(this.currentPoint.clone(),new z(e,t),new z(n,r),new z(i,a));return this.curves.push(o),this.currentPoint.set(i,a),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),n=new ml(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,r,i,a){let o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,n,r,i,a),this}absarc(e,t,n,r,i,a){return this.absellipse(e,t,n,n,r,i,a),this}ellipse(e,t,n,r,i,a,o,s){let c=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(e+c,t+l,n,r,i,a,o,s),this}absellipse(e,t,n,r,i,a,o,s){let c=new el(e,t,n,r,i,a,o,s);if(this.curves.length>0){let e=c.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(c);let l=c.getPoint(1);return this.currentPoint.copy(l),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},vl=class extends _l{constructor(e){super(e),this.uuid=T(),this.type=`Shape`,this.holes=[]}getPointsHoles(e){let t=[];for(let n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let n=e.holes[t];this.holes.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){let n=this.holes[t];e.holes.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let n=e.holes[t];this.holes.push(new _l().fromJSON(n))}return this}},yl=class{static triangulate(e,t,n=2){return Be(e,t,n)}},bl=class e{static area(e){let t=e.length,n=0;for(let r=t-1,i=0;i<t;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return n*.5}static isClockWise(t){return e.area(t)<0}static triangulateShape(e,t){let n=[],r=[],i=[];yt(e),bt(n,e);let a=e.length;t.forEach(yt);for(let e=0;e<t.length;e++)r.push(a),a+=t[e].length,bt(n,t[e]);let o=yl.triangulate(n,r);for(let e=0;e<o.length;e+=3)i.push(o.slice(e,e+3));return i}},xl=class e extends G{constructor(e=new vl([new z(.5,.5),new z(-.5,.5),new z(-.5,-.5),new z(.5,-.5)]),t={}){super(),this.type=`ExtrudeGeometry`,this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let n=this,r=[],i=[];for(let t=0,n=e.length;t<n;t++){let n=e[t];a(n)}this.setAttribute(`position`,new W(r,3)),this.setAttribute(`uv`,new W(i,2)),this.computeVertexNormals();function a(e){let a=[],o=t.curveSegments===void 0?12:t.curveSegments,s=t.steps===void 0?1:t.steps,c=t.depth===void 0?1:t.depth,l=t.bevelEnabled===void 0||t.bevelEnabled,u=t.bevelThickness===void 0?.2:t.bevelThickness,d=t.bevelSize===void 0?u-.1:t.bevelSize,f=t.bevelOffset===void 0?0:t.bevelOffset,p=t.bevelSegments===void 0?3:t.bevelSegments,m=t.extrudePath,h=t.UVGenerator===void 0?Sl:t.UVGenerator,g,_=!1,v,y,b,x;if(m){g=m.getSpacedPoints(s),_=!0,l=!1;let e=m.isCatmullRomCurve3?m.closed:!1;v=m.computeFrenetFrames(s,e),y=new B,b=new B,x=new B}l||(p=0,u=0,d=0,f=0);let C=e.extractPoints(o),w=C.shape,T=C.holes;if(!bl.isClockWise(w)){w=w.reverse();for(let e=0,t=T.length;e<t;e++){let t=T[e];bl.isClockWise(t)&&(T[e]=t.reverse())}}function E(e){let t=e[0];for(let n=1;n<=e.length;n++){let r=n%e.length,i=e[r],a=i.x-t.x,o=i.y-t.y,s=a*a+o*o,c=Math.max(Math.abs(i.x),Math.abs(i.y),Math.abs(t.x),Math.abs(t.y));s<=10000000000000001e-36*c*c?(e.splice(r,1),n--):t=i}}E(w),T.forEach(E);let D=T.length,O=w;for(let e=0;e<D;e++){let t=T[e];w=w.concat(t)}function k(e,t,n){return t||S(`ExtrudeGeometry: vec does not exist`),e.clone().addScaledVector(t,n)}let A=w.length;function j(e,t,n){let r,i,a,o=e.x-t.x,s=e.y-t.y,c=n.x-e.x,l=n.y-e.y,u=o*o+s*s,d=o*l-s*c;if(Math.abs(d)>2**-52){let d=Math.sqrt(u),f=Math.sqrt(c*c+l*l),p=t.x-s/d,m=t.y+o/d,h=n.x-l/f,g=n.y+c/f,_=((h-p)*l-(g-m)*c)/(o*l-s*c);r=p+o*_-e.x,i=m+s*_-e.y;let v=r*r+i*i;if(v<=2)return new z(r,i);a=Math.sqrt(v/2)}else{let e=!1;o>2**-52?c>2**-52&&(e=!0):o<-(2**-52)?c<-(2**-52)&&(e=!0):Math.sign(s)===Math.sign(l)&&(e=!0),e?(r=-s,i=o,a=Math.sqrt(u)):(r=o,i=s,a=Math.sqrt(u/2))}return new z(r/a,i/a)}let M=[];for(let e=0,t=O.length,n=t-1,r=e+1;e<t;e++,n++,r++)n===t&&(n=0),r===t&&(r=0),M[e]=j(O[e],O[n],O[r]);let N=[],P,F=M.concat();for(let e=0,t=D;e<t;e++){let t=T[e];P=[];for(let e=0,n=t.length,r=n-1,i=e+1;e<n;e++,r++,i++)r===n&&(r=0),i===n&&(i=0),P[e]=j(t[e],t[r],t[i]);N.push(P),F=F.concat(P)}let ee;if(p===0)ee=bl.triangulateShape(O,T);else{let e=[],t=[];for(let n=0;n<p;n++){let r=n/p,i=u*Math.cos(r*Math.PI/2),a=d*Math.sin(r*Math.PI/2)+f;for(let t=0,n=O.length;t<n;t++){let n=k(O[t],M[t],a);I(n.x,n.y,-i),r===0&&e.push(n)}for(let e=0,n=D;e<n;e++){let n=T[e];P=N[e];let o=[];for(let e=0,t=n.length;e<t;e++){let t=k(n[e],P[e],a);I(t.x,t.y,-i),r===0&&o.push(t)}r===0&&t.push(o)}}ee=bl.triangulateShape(e,t)}let te=ee.length,ne=d+f;for(let e=0;e<A;e++){let t=l?k(w[e],F[e],ne):w[e];_?(b.copy(v.normals[0]).multiplyScalar(t.x),y.copy(v.binormals[0]).multiplyScalar(t.y),x.copy(g[0]).add(b).add(y),I(x.x,x.y,x.z)):I(t.x,t.y,0)}for(let e=1;e<=s;e++)for(let t=0;t<A;t++){let n=l?k(w[t],F[t],ne):w[t];_?(b.copy(v.normals[e]).multiplyScalar(n.x),y.copy(v.binormals[e]).multiplyScalar(n.y),x.copy(g[e]).add(b).add(y),I(x.x,x.y,x.z)):I(n.x,n.y,c/s*e)}for(let e=p-1;e>=0;e--){let t=e/p,n=u*Math.cos(t*Math.PI/2),r=d*Math.sin(t*Math.PI/2)+f;for(let e=0,t=O.length;e<t;e++){let t=k(O[e],M[e],r);I(t.x,t.y,c+n)}for(let e=0,t=T.length;e<t;e++){let t=T[e];P=N[e];for(let e=0,i=t.length;e<i;e++){let i=k(t[e],P[e],r);_?I(i.x,i.y+g[s-1].y,g[s-1].x+n):I(i.x,i.y,c+n)}}}re(),ie();function re(){let e=r.length/3;if(l){let e=0,t=A*e;for(let e=0;e<te;e++){let n=ee[e];oe(n[2]+t,n[1]+t,n[0]+t)}e=s+p*2,t=A*e;for(let e=0;e<te;e++){let n=ee[e];oe(n[0]+t,n[1]+t,n[2]+t)}}else{for(let e=0;e<te;e++){let t=ee[e];oe(t[2],t[1],t[0])}for(let e=0;e<te;e++){let t=ee[e];oe(t[0]+A*s,t[1]+A*s,t[2]+A*s)}}n.addGroup(e,r.length/3-e,0)}function ie(){let e=r.length/3,t=0;ae(O,t),t+=O.length;for(let e=0,n=T.length;e<n;e++){let n=T[e];ae(n,t),t+=n.length}n.addGroup(e,r.length/3-e,1)}function ae(e,t){let n=e.length;for(;--n>=0;){let r=n,i=n-1;i<0&&(i=e.length-1);for(let e=0,n=s+p*2;e<n;e++){let n=A*e,a=A*(e+1);se(t+r+n,t+i+n,t+i+a,t+r+a)}}}function I(e,t,n){a.push(e),a.push(t),a.push(n)}function oe(e,t,i){ce(e),ce(t),ce(i);let a=r.length/3,o=h.generateTopUV(n,r,a-3,a-2,a-1);le(o[0]),le(o[1]),le(o[2])}function se(e,t,i,a){ce(e),ce(t),ce(a),ce(t),ce(i),ce(a);let o=r.length/3,s=h.generateSideWallUV(n,r,o-6,o-3,o-2,o-1);le(s[0]),le(s[1]),le(s[3]),le(s[1]),le(s[2]),le(s[3])}function ce(e){r.push(a[e*3+0]),r.push(a[e*3+1]),r.push(a[e*3+2])}function le(e){i.push(e.x),i.push(e.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return xt(t,n,e)}static fromJSON(t,n){let r=[];for(let e=0,i=t.shapes.length;e<i;e++){let i=n[t.shapes[e]];r.push(i)}let i=t.options.extrudePath;return i!==void 0&&(t.options.extrudePath=new hl[i.type]().fromJSON(i)),new e(r,t.options)}},Sl={generateTopUV:function(e,t,n,r,i){let a=t[n*3],o=t[n*3+1],s=t[r*3],c=t[r*3+1],l=t[i*3],u=t[i*3+1];return[new z(a,o),new z(s,c),new z(l,u)]},generateSideWallUV:function(e,t,n,r,i,a){let o=t[n*3],s=t[n*3+1],c=t[n*3+2],l=t[r*3],u=t[r*3+1],d=t[r*3+2],f=t[i*3],p=t[i*3+1],m=t[i*3+2],h=t[a*3],g=t[a*3+1],_=t[a*3+2];return Math.abs(s-u)<Math.abs(o-l)?[new z(o,1-c),new z(l,1-d),new z(f,1-m),new z(h,1-_)]:[new z(s,1-c),new z(u,1-d),new z(p,1-m),new z(g,1-_)]}},Cl=class e extends Kc{constructor(e=1,t=0){let n=(1+Math.sqrt(5))/2,r=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1];super(r,[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type=`IcosahedronGeometry`,this.parameters={radius:e,detail:t}}static fromJSON(t){return new e(t.radius,t.detail)}},wl=class e extends G{constructor(e=[new z(0,-.5),new z(.5,0),new z(0,.5)],t=12,n=0,r=Math.PI*2){super(),this.type=`LatheGeometry`,this.parameters={points:e,segments:t,phiStart:n,phiLength:r},t=Math.floor(t),r=E(r,0,Math.PI*2);let i=[],a=[],o=[],s=[],c=[],l=1/t,u=new B,d=new z,f=new B,p=new B,m=new B,h=0,g=0;for(let t=0;t<=e.length-1;t++)switch(t){case 0:h=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,f.x=g*1,f.y=-h,f.z=g*0,m.copy(f),f.normalize(),s.push(f.x,f.y,f.z);break;case e.length-1:m.normalize(),s.push(m.x,m.y,m.z);break;default:h=e[t+1].x-e[t].x,g=e[t+1].y-e[t].y,f.x=g*1,f.y=-h,f.z=g*0,p.copy(f),f.x+=m.x,f.y+=m.y,f.z+=m.z,f.normalize(),s.push(f.x,f.y,f.z),m.copy(p)}for(let i=0;i<=t;i++){let f=n+i*l*r,p=Math.sin(f),m=Math.cos(f);for(let n=0;n<=e.length-1;n++){u.x=e[n].x*p,u.y=e[n].y,u.z=e[n].x*m,a.push(u.x,u.y,u.z),d.x=i/t,d.y=n/(e.length-1),o.push(d.x,d.y);let r=s[3*n+0]*p,l=s[3*n+1],f=s[3*n+0]*m;c.push(r,l,f)}}for(let n=0;n<t;n++)for(let t=0;t<e.length-1;t++){let r=t+n*e.length,a=r,o=r+e.length,s=r+e.length+1,c=r+1;i.push(a,o,c),i.push(s,c,o)}this.setIndex(i),this.setAttribute(`position`,new W(a,3)),this.setAttribute(`uv`,new W(o,2)),this.setAttribute(`normal`,new W(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.points,t.segments,t.phiStart,t.phiLength)}},Tl=class e extends Kc{constructor(e=1,t=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type=`OctahedronGeometry`,this.parameters={radius:e,detail:t}}static fromJSON(t){return new e(t.radius,t.detail)}},El=class e extends G{constructor(e=1,t=1,n=1,r=1){super(),this.type=`PlaneGeometry`,this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};let i=e/2,a=t/2,o=Math.floor(n),s=Math.floor(r),c=o+1,l=s+1,u=e/o,d=t/s,f=[],p=[],m=[],h=[];for(let e=0;e<l;e++){let t=e*d-a;for(let n=0;n<c;n++){let r=n*u-i;p.push(r,-t,0),m.push(0,0,1),h.push(n/o),h.push(1-e/s)}}for(let e=0;e<s;e++)for(let t=0;t<o;t++){let n=t+c*e,r=t+c*(e+1),i=t+1+c*(e+1),a=t+1+c*e;f.push(n,r,a),f.push(r,i,a)}this.setIndex(f),this.setAttribute(`position`,new W(p,3)),this.setAttribute(`normal`,new W(m,3)),this.setAttribute(`uv`,new W(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.width,t.height,t.widthSegments,t.heightSegments)}},Dl=class e extends G{constructor(e=.5,t=1,n=32,r=1,i=0,a=Math.PI*2){super(),this.type=`RingGeometry`,this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},n=Math.max(3,n),r=Math.max(1,r);let o=[],s=[],c=[],l=[],u=e,d=(t-e)/r,f=new B,p=new z;for(let e=0;e<=r;e++){for(let e=0;e<=n;e++){let r=i+e/n*a;f.x=u*Math.cos(r),f.y=u*Math.sin(r),s.push(f.x,f.y,f.z),c.push(0,0,1),p.x=(f.x/t+1)/2,p.y=(f.y/t+1)/2,l.push(p.x,p.y)}u+=d}for(let e=0;e<r;e++){let t=e*(n+1);for(let e=0;e<n;e++){let r=e+t,i=r,a=r+n+1,s=r+n+2,c=r+1;o.push(i,a,c),o.push(a,s,c)}}this.setIndex(o),this.setAttribute(`position`,new W(s,3)),this.setAttribute(`normal`,new W(c,3)),this.setAttribute(`uv`,new W(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}},Ol=class e extends G{constructor(e=new vl([new z(0,.5),new z(-.5,-.5),new z(.5,-.5)]),t=12){super(),this.type=`ShapeGeometry`,this.parameters={shapes:e,curveSegments:t};let n=[],r=[],i=[],a=[],o=0,s=0;if(Array.isArray(e)===!1)c(e);else for(let t=0;t<e.length;t++)c(e[t]),this.addGroup(o,s,t),o+=s,s=0;this.setIndex(n),this.setAttribute(`position`,new W(r,3)),this.setAttribute(`normal`,new W(i,3)),this.setAttribute(`uv`,new W(a,2));function c(e){let o=r.length/3,c=e.extractPoints(t),l=c.shape,u=c.holes;bl.isClockWise(l)===!1&&(l=l.reverse());for(let e=0,t=u.length;e<t;e++){let t=u[e];bl.isClockWise(t)===!0&&(u[e]=t.reverse())}let d=bl.triangulateShape(l,u);for(let e=0,t=u.length;e<t;e++){let t=u[e];l=l.concat(t)}for(let e=0,t=l.length;e<t;e++){let t=l[e];r.push(t.x,t.y,0),i.push(0,0,1),a.push(t.x,t.y)}for(let e=0,t=d.length;e<t;e++){let t=d[e],r=t[0]+o,i=t[1]+o,a=t[2]+o;n.push(r,i,a),s+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes;return St(t,e)}static fromJSON(t,n){let r=[];for(let e=0,i=t.shapes.length;e<i;e++){let i=n[t.shapes[e]];r.push(i)}return new e(r,t.curveSegments)}},kl=class e extends G{constructor(e=1,t=32,n=16,r=0,i=Math.PI*2,a=0,o=Math.PI){super(),this.type=`SphereGeometry`,this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));let s=Math.min(a+o,Math.PI),c=0,l=[],u=new B,d=new B,f=[],p=[],m=[],h=[];for(let f=0;f<=n;f++){let g=[],_=f/n,v=a+_*o,y=e*Math.cos(v),b=Math.sqrt(e*e-y*y),x=0;f===0&&a===0?x=.5/t:f===n&&s===Math.PI&&(x=-.5/t);for(let e=0;e<=t;e++){let n=e/t,a=r+n*i;u.x=-b*Math.cos(a),u.y=y,u.z=b*Math.sin(a),p.push(u.x,u.y,u.z),d.copy(u).normalize(),m.push(d.x,d.y,d.z),h.push(n+x,1-_),g.push(c++)}l.push(g)}for(let e=0;e<n;e++)for(let r=0;r<t;r++){let t=l[e][r+1],i=l[e][r],o=l[e+1][r],c=l[e+1][r+1];(e!==0||a>0)&&f.push(t,i,c),(e!==n-1||s<Math.PI)&&f.push(i,o,c)}this.setIndex(f),this.setAttribute(`position`,new W(p,3)),this.setAttribute(`normal`,new W(m,3)),this.setAttribute(`uv`,new W(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}},Al=class e extends Kc{constructor(e=1,t=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type=`TetrahedronGeometry`,this.parameters={radius:e,detail:t}}static fromJSON(t){return new e(t.radius,t.detail)}},jl=class e extends G{constructor(e=1,t=.4,n=12,r=48,i=Math.PI*2,a=0,o=Math.PI*2){super(),this.type=`TorusGeometry`,this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i,thetaStart:a,thetaLength:o},n=Math.floor(n),r=Math.floor(r);let s=[],c=[],l=[],u=[],d=new B,f=new B,p=new B;for(let s=0;s<=n;s++){let m=a+s/n*o;for(let a=0;a<=r;a++){let o=a/r*i;f.x=(e+t*Math.cos(m))*Math.cos(o),f.y=(e+t*Math.cos(m))*Math.sin(o),f.z=t*Math.sin(m),c.push(f.x,f.y,f.z),d.x=e*Math.cos(o),d.y=e*Math.sin(o),p.subVectors(f,d).normalize(),l.push(p.x,p.y,p.z),u.push(a/r),u.push(s/n)}}for(let e=1;e<=n;e++)for(let t=1;t<=r;t++){let n=(r+1)*e+t-1,i=(r+1)*(e-1)+t-1,a=(r+1)*(e-1)+t,o=(r+1)*e+t;s.push(n,i,o),s.push(i,a,o)}this.setIndex(s),this.setAttribute(`position`,new W(c,3)),this.setAttribute(`normal`,new W(l,3)),this.setAttribute(`uv`,new W(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc,t.thetaStart,t.thetaLength)}},Ml=class e extends G{constructor(e=1,t=.4,n=64,r=8,i=2,a=3){super(),this.type=`TorusKnotGeometry`,this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:a},n=Math.floor(n),r=Math.floor(r);let o=[],s=[],c=[],l=[],u=new B,d=new B,f=new B,p=new B,m=new B,h=new B,g=new B;for(let o=0;o<=n;++o){let v=o/n*i*Math.PI*2;_(v,i,a,e,f),_(v+.01,i,a,e,p),h.subVectors(p,f),g.addVectors(p,f),m.crossVectors(h,g),g.crossVectors(m,h),m.normalize(),g.normalize();for(let e=0;e<=r;++e){let i=e/r*Math.PI*2,a=-t*Math.cos(i),p=t*Math.sin(i);u.x=f.x+(a*g.x+p*m.x),u.y=f.y+(a*g.y+p*m.y),u.z=f.z+(a*g.z+p*m.z),s.push(u.x,u.y,u.z),d.subVectors(u,f).normalize(),c.push(d.x,d.y,d.z),l.push(o/n),l.push(e/r)}}for(let e=1;e<=n;e++)for(let t=1;t<=r;t++){let n=(r+1)*(e-1)+(t-1),i=(r+1)*e+(t-1),a=(r+1)*e+t,s=(r+1)*(e-1)+t;o.push(n,i,s),o.push(i,a,s)}this.setIndex(o),this.setAttribute(`position`,new W(s,3)),this.setAttribute(`normal`,new W(c,3)),this.setAttribute(`uv`,new W(l,2));function _(e,t,n,r,i){let a=Math.cos(e),o=Math.sin(e),s=n/t*e,c=Math.cos(s);i.x=r*(2+c)*.5*a,i.y=r*(2+c)*o*.5,i.z=r*Math.sin(s)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}},Nl=class e extends G{constructor(e=new pl(new B(-1,-1,0),new B(-1,1,0),new B(1,1,0)),t=64,n=1,r=8,i=!1){super(),this.type=`TubeGeometry`,this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i};let a=e.computeFrenetFrames(t,i);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;let o=new B,s=new B,c=new z,l=new B,u=[],d=[],f=[],p=[];m(),this.setIndex(p),this.setAttribute(`position`,new W(u,3)),this.setAttribute(`normal`,new W(d,3)),this.setAttribute(`uv`,new W(f,2));function m(){for(let e=0;e<t;e++)h(e);h(i===!1?t:0),_(),g()}function h(i){l=e.getPointAt(i/t,l);let c=a.normals[i],f=a.binormals[i];for(let e=0;e<=r;e++){let t=e/r*Math.PI*2,i=Math.sin(t),a=-Math.cos(t);s.x=a*c.x+i*f.x,s.y=a*c.y+i*f.y,s.z=a*c.z+i*f.z,s.normalize(),d.push(s.x,s.y,s.z),o.x=l.x+n*s.x,o.y=l.y+n*s.y,o.z=l.z+n*s.z,u.push(o.x,o.y,o.z)}}function g(){for(let e=1;e<=t;e++)for(let t=1;t<=r;t++){let n=(r+1)*(e-1)+(t-1),i=(r+1)*e+(t-1),a=(r+1)*e+t,o=(r+1)*(e-1)+t;p.push(n,i,o),p.push(i,a,o)}}function _(){for(let e=0;e<=t;e++)for(let n=0;n<=r;n++)c.x=e/t,c.y=n/r,f.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(t){return new e(new hl[t.path.type]().fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}},Pl=class extends G{constructor(e=null){if(super(),this.type=`WireframeGeometry`,this.parameters={geometry:e},e!==null){let t=[],n=/* @__PURE__ */ new Set,r=new B,i=new B;if(e.index!==null){let a=e.attributes.position,o=e.index,s=e.groups;s.length===0&&(s=[{start:0,count:o.count,materialIndex:0}]);for(let e=0,c=s.length;e<c;++e){let c=s[e],l=c.start,u=c.count;for(let e=l,s=l+u;e<s;e+=3)for(let s=0;s<3;s++){let c=o.getX(e+s),l=o.getX(e+(s+1)%3);r.fromBufferAttribute(a,c),i.fromBufferAttribute(a,l),Ct(r,i,n)===!0&&(t.push(r.x,r.y,r.z),t.push(i.x,i.y,i.z))}}}else{let a=e.attributes.position;for(let e=0,o=a.count/3;e<o;e++)for(let o=0;o<3;o++){let s=3*e+o,c=3*e+(o+1)%3;r.fromBufferAttribute(a,s),i.fromBufferAttribute(a,c),Ct(r,i,n)===!0&&(t.push(r.x,r.y,r.z),t.push(i.x,i.y,i.z))}}this.setAttribute(`position`,new W(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}},Fl=/*#__PURE__*/ Object.freeze({__proto__:null,BoxGeometry:Vc,CapsuleGeometry:Hc,CircleGeometry:Uc,ConeGeometry:Gc,CylinderGeometry:Wc,DodecahedronGeometry:qc,EdgesGeometry:Qc,ExtrudeGeometry:xl,IcosahedronGeometry:Cl,LatheGeometry:wl,OctahedronGeometry:Tl,PlaneGeometry:El,PolyhedronGeometry:Kc,RingGeometry:Dl,ShapeGeometry:Ol,SphereGeometry:kl,TetrahedronGeometry:Al,TorusGeometry:jl,TorusKnotGeometry:Ml,TubeGeometry:Nl,WireframeGeometry:Pl}),Il=class extends Lo{constructor(e){super(),this.isShadowMaterial=!0,this.type=`ShadowMaterial`,this.color=new H(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}},Ll={clone:wt,merge:Tt},Rl=`void main() {
2
2
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3
3
  }`,zl=`void main() {
4
4
  gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
@@ -5793,7 +5793,7 @@ varying vec4 vShadowClip;
5793
5793
  \t}
5794
5794
  \t#include <tonemapping_fragment>`)},n.customProgramCacheKey=()=>`agent3d-shadow-catcher`,n}var OD=.45;function kD(e,t){let n=e.background;return e.fog?.color?e.fog.color:t||(n&&typeof n==`object`&&`sky`in n&&n.sky?.horizon?n.sky.horizon:n&&typeof n==`object`&&`meshGradient`in n&&n.meshGradient[0]?n.meshGradient[0]:typeof n==`string`&&n!==`transparent`?n:`#ffffff`)}async function AD(e,t,n,r,i){let a=[],o=[],s=i.renderer,c=e.background,l=!!n.isOrthographicCamera,u=null,d=0,f=null,p=null,m=null;t.background=null,t.backgroundIntensity=1,t.backgroundRotation.set(0,0,0),t.environmentRotation.set(0,0,0);let h=c&&typeof c==`object`?c:null,g=h&&`sky`in h?h.sky??{}:null;if(g&&gE(g))try{f=await wE(g)}catch(e){i.issue(`asset-load`,e.message,`environment.background.sky`)}if(!r&&c!==void 0&&c!==`transparent`){if(typeof c==`string`)t.background=AS(c);else if(`gradient`in c)t.background=_D(c.gradient,`linear`,Q(c.angle,0),{grain:c.grain});else if(`radial`in c)t.background=_D(c.radial,`radial`,0,{center:c.center,radius:c.radius,grain:c.grain});else if(`meshGradient`in c)m=c.meshGradient,a.push(vD(c.meshGradient,c,i));else if(`sky`in c){let e=c.sky??{};if(f){if(!l){a.push(f.mesh);let e=f;i.onUpdate(t=>e.setTime(t))}}else p=e,l?t.background=_D([e.bottom??e.horizon??`#e8eef5`,e.horizon??`#cfe6ff`,e.top??`#2f6fd6`],`linear`,0):a.push(xD(e,i))}else if(`hdri`in c)try{if(u=await wD(i.resolveAsset(c.hdri)),d=Q(c.rotation,0)*LS,t.backgroundRotation.set(0,d,0),t.backgroundIntensity=Q(c.intensity,1),o.push(u),c.groundProjection&&!l){let n=typeof c.groundProjection==`object`?c.groundProjection:{},{GroundedSkybox:r}=await Promise.resolve().then(()=>(fD(),uD)),i=Q(n.height,2),o=Q(n.radius,60),s=new r(u,i,o);s.position.y=i-.01+Q(e.ground?.y,0),s.rotation.y=d,s.material.color.setScalar(t.backgroundIntensity),s.name=`__groundProjection`,s.userData.helper=!0,s.renderOrder=-999,a.push(s),t.background=AS(`#000000`)}else t.background=u,t.backgroundBlurriness=Q(c.blur,0)}catch(e){i.issue(`asset-load`,e.message,`environment.background.hdri`)}t.background instanceof zi&&t.background!==u&&o.push(t.background)}t.fog=null,WT(t,null);let _=null;e.fog&&(_=AS(kD(e,f?.values.haze)),!e.fog.color&&f&&_.multiplyScalar(.82),`density`in e.fog?(t.fog=new Da(_,e.fog.density),e.fog.height!==void 0&&WT(t,{uA3dFogHeight:{value:e.fog.height},uA3dFogFalloff:{value:Q(e.fog.falloff,.25)}})):t.fog=new Oa(_,Q(e.fog.near,10),Q(e.fog.far,60)),f?.setHaze(_,.85));let v=u?{hdri:``}:f?`sky`:`soft`,y=e.lighting??v;if(t.environment=null,t.environmentIntensity=Q(e.lightingIntensity,1),s&&y!==`none`){let n=new vh(s),a=null;try{if(typeof y==`object`){let e=y.hdri?await wD(i.resolveAsset(y.hdri)):u;e&&(a=n.fromEquirectangular(e)),y.intensity!==void 0&&(t.environmentIntensity=y.intensity),t.environmentRotation.set(0,y.hdri?Q(y.rotation,0)*LS:y.rotation===void 0?d:y.rotation*LS,0),e&&e!==u&&e.dispose()}else if(y===`sky`){if(f){let e=f.envScene();a=n.fromScene(e,0,.1,100),CD(e)}else if(p){let e=p,t=e.sun===!1?void 0:e.sun,r=SD(e.top??`#2f6fd6`,e.horizon??`#cfe6ff`,e.bottom??e.horizon??`#e8eef5`,t?{dir:new B(...OS(t.direction,[.4,.35,-1])),color:t.color??`#fff2d6`,power:4,size:.9}:void 0,!1);a=n.fromScene(r,.02),CD(r)}else if(m){let e=m,t=SD(e[1]??e[0],e[0],e[2]??e[0],void 0,!0);a=n.fromScene(t,.04),CD(t)}else{let{RoomEnvironment:e}=await Promise.resolve().then(()=>(gD(),pD)),t=new e;a=n.fromScene(t,.06),t.dispose?.()}}else if(y===`studio`||y===`soft`){let{RoomEnvironment:r}=await Promise.resolve().then(()=>(gD(),pD)),i=new r;a=n.fromScene(i,y===`soft`?.06:.02),y===`soft`&&e.lightingIntensity===void 0&&(t.environmentIntensity=.8),i.dispose?.()}else{let e={neutral:[`#d8d8dc`,`#b9b9bd`,`#5a5a60`],sunset:[`#33306e`,`#ff9a5a`,`#3a2531`,{dir:new B(1,.15,-.6),color:`#ffb36b`,power:6,size:1.6}],night:[`#060a1a`,`#1d2a55`,`#05060c`,{dir:new B(-.5,.7,-.5),color:`#cfdcff`,power:3,size:.8}]},t=SD(...e[y]??e.neutral);a=n.fromScene(t,.03),CD(t)}}catch(e){i.issue(`asset-load`,e.message,`environment.lighting`)}a&&(t.environment=a.texture,o.push(a),l&&f&&!r&&(t.background=a.texture,t.backgroundBlurriness=0)),n.dispose();let c=e.lightingIntensity!==void 0||typeof y==`object`&&y.intensity!==void 0;e.rig&&!c&&(t.environmentIntensity*=OD)}let b=[],x=g&&g.sun!==!1?g.sun??{}:null;if(f&&x&&x.light!==!1){let t=bE(f.values.elevation),n=new qu(x.color?AS(x.color):t.color,Q(x.intensity,t.intensity));n.position.copy(f.sunDir).multiplyScalar(30),n.name=`__sun`,n.userData.a3dId=`sun`,x.castShadow!==!1&&n.intensity>0&&tE(n,{type:`directional`,shadow:{softness:3}},e.shadows),b.push(n)}for(let t of dE(e.rig)){let n=await oE(t,e.shadows);b.push(n)}for(let e of b)a.push(e),(e instanceof qu||e instanceof Hu)&&a.push(e.target);let S;if(e.ground){let t=e.ground,n=Q(t.size,60),r=Q(t.y,0),i=t.shadowOnly?DD(AS(t.color??`#000000`),Q(t.opacity,.28)):TD(AS(t.color??`#d9d9d9`),Q(t.roughness,.9));!t.shadowOnly&&t.opacity!==void 0&&(i.opacity=t.opacity);let o=new K(new El(n,n),i);if(o.rotation.x=-Math.PI/2,o.position.y=r,o.receiveShadow=!0,o.name=`__ground`,o.renderOrder=-20,o.userData.helper=!0,o.userData.ground=!0,a.push(o),S=o,t.grid){let e=new Mf(n,Math.round(n),AS(`#000000`),AS(`#000000`)),t=e.material;t.transparent=!0,t.opacity=.12,t.depthWrite=!1,e.position.y=r+.002,e.userData.helper=!0,a.push(e)}}if(e.contactShadows){let n=PT(e.contactShadows,t,e.ground?Q(e.ground.y,0):void 0,i);n&&(a.push(n.object),o.push(n))}return{objects:a,ground:S,dispose(){for(let e of o)e.dispose();for(let e of a)e.traverse(e=>{let t=e;t.geometry?.dispose(),t.material?.dispose?.(),e.shadow?.dispose?.()})}}}J(),W_(),Xg(),zS();function jD(e){return Array.isArray(e)?e.filter(e=>Array.isArray(e)&&e.length>=2).map(e=>new z(Number(e[0]),Number(e[1]))):[]}function MD(e){return Array.isArray(e)?e.filter(e=>Array.isArray(e)&&e.length>=3).map(e=>new B(Number(e[0]),Number(e[1]),Number(e[2]))):[]}var ND=(e,t=`segments`,n=32)=>Math.max(3,Math.round(Q(e[t],n))),PD={box:e=>new Vc(Q(e.width,1),Q(e.height,1),Q(e.depth,1)),roundedBox:e=>{let t=Q(e.width,1),n=Q(e.height,1),r=Q(e.depth,1),i=Math.min(Q(e.radius,.1),Math.min(t,n,r)/2-1e-4);return new U_(t,n,r,Math.max(1,Math.round(Q(e.segments,4))),Math.max(0,i))},sphere:e=>new kl(Q(e.radius,.5),ND(e),Math.max(2,Math.round(Q(e.heightSegments,24)))),cylinder:e=>new Wc(Q(e.radiusTop,.5),Q(e.radiusBottom,.5),Q(e.height,1),ND(e),1,ES(e.openEnded,!1)),cone:e=>new Gc(Q(e.radius,.5),Q(e.height,1),ND(e)),capsule:e=>{let t=Math.max(2,Math.round(Q(e.segments,16)));return new Hc(Q(e.radius,.3),Q(e.length,.6),Math.max(2,Math.round(t/2)),t*2)},torus:e=>new jl(Q(e.radius,.5),Q(e.tube,.15),Math.max(2,Math.round(Q(e.radialSegments,24))),Math.max(3,Math.round(Q(e.tubularSegments,64))),Q(e.arc,360)*LS),torusKnot:e=>new Ml(Q(e.radius,.5),Q(e.tube,.15),Math.round(Q(e.tubularSegments,128)),Math.round(Q(e.radialSegments,16)),Math.round(Q(e.p,2)),Math.round(Q(e.q,3))),plane:e=>new El(Q(e.width,1),Q(e.height,1),Math.max(1,Math.round(Q(e.widthSegments,1))),Math.max(1,Math.round(Q(e.heightSegments,1)))),circle:e=>new Uc(Q(e.radius,.5),ND(e)),ring:e=>new Dl(Q(e.innerRadius,.3),Q(e.outerRadius,.5),ND(e)),icosahedron:e=>new Cl(Q(e.radius,.5),Math.round(Q(e.detail,0))),dodecahedron:e=>new qc(Q(e.radius,.5),Math.round(Q(e.detail,0))),octahedron:e=>new Tl(Q(e.radius,.5),Math.round(Q(e.detail,0))),tetrahedron:e=>new Al(Q(e.radius,.5),Math.round(Q(e.detail,0))),lathe:e=>{let t=jD(e.points);return t.length<2&&(t=[new z(.5,-.5),new z(.5,.5)]),new wl(t,ND(e))},extrude:e=>{let t=jD(e.shape);t.length<3&&(t=[new z(-.5,-.5),new z(.5,-.5),new z(0,.5)]);let n=new vl(t),r=Q(e.depth,.2),i=Q(e.bevel,.02),a=new xl(n,{depth:r,bevelEnabled:i>0,bevelSize:i,bevelThickness:i,bevelSegments:3,curveSegments:12});return a.translate(0,0,-r/2),a},tube:e=>{let t=MD(e.points);t.length<2&&(t=[new B(-1,0,0),new B(1,0,0)]);let n=new sl(t,ES(e.closed,!1),`catmullrom`,.5);return new Nl(n,Math.max(2,Math.round(Q(e.tubularSegments,64))),Q(e.radius,.05),Math.max(3,Math.round(Q(e.radialSegments,8))),ES(e.closed,!1))}};function FD(e){let t=(PD[e.type]??PD.box)(jS(Og.find(t=>t.id===e.type),e));return t.computeBoundingBox(),t.computeBoundingSphere(),t}J(),zS();function ID(e,t){let n=[],r=(e,t=new na,r=new B(1,1,1))=>n.push({position:e,rotation:t,scale:r});switch(e.type){case`grid`:{let[t,n,i]=e.count.map(e=>Math.max(1,Math.round(e))),[a,o,s]=e.spacing;for(let e=0;e<t;e++)for(let c=0;c<n;c++)for(let l=0;l<i;l++)r(new B((e-(t-1)/2)*a,(c-(n-1)/2)*o,(l-(i-1)/2)*s));break}case`scatter`:{let n=Q(e.minScale,1),i=Q(e.maxScale,1),[a,o,s]=e.area;for(let c=0;c<Math.max(0,Math.round(e.count));c++){let c=new B(t.range(-a/2,a/2),t.range(-o/2,o/2),t.range(-s/2,s/2)),l=e.randomRotation===!1?new na:new na(0,t.range(0,Math.PI*2),0),u=t.range(n,i);r(c,l,new B(u,u,u))}break}case`circle`:{let t=Math.max(1,Math.round(e.count));for(let n=0;n<t;n++){let i=n/t*Math.PI*2;r(new B(Math.cos(i)*e.radius,0,Math.sin(i)*e.radius),new na(0,-i,0))}break}case`list`:for(let t of e.items){let e=t.position??[0,0,0],n=t.rotation??[0,0,0],i=t.scale??1;r(new B(...e),new na(n[0]*LS,n[1]*LS,n[2]*LS),typeof i==`number`?new B(i,i,i):new B(...i))}}return n}function LD(e,t,n,r,i){let a=ID(e.layout,r),o=new Hs(t,n,Math.max(1,a.length));o.count=a.length;let s=new V,c=new wi;if(a.forEach((e,t)=>{s.compose(e.position,c.setFromEuler(e.rotation),e.scale),o.setMatrixAt(t,s)}),e.colors?.length){let t=e.layout.type===`scatter`;a.forEach((n,a)=>o.setColorAt(a,i(t?r.pick(e.colors):e.colors[a%e.colors.length]))),o.instanceColor&&(o.instanceColor.needsUpdate=!0)}return o.instanceMatrix.needsUpdate=!0,o.computeBoundingBox(),o.computeBoundingSphere(),o}function RD(e,t,n=4,r=256){let i=[];for(let a of e.curves){let e=a.isLineCurve?1:Math.max(n,Math.min(r,Math.ceil(a.getLength()/t))),o=a.getPoints(e);for(let e of o)i.length&&i[i.length-1].equals(e)||i.push(e)}return e.autoClose&&i.length>1&&!i[0].equals(i[i.length-1])&&i.push(i[0].clone()),i}function zD(e,t,n=4,r=256){let i=e=>(e.length>2&&e[0].equals(e[e.length-1])&&e.pop(),e),a=new vl(i(RD(e,t,n,r)));return a.holes=e.holes.map(e=>new _l(i(RD(e,t,n,r)))),a}function BD(e,t,n){let r=n.toCreasedNormals(e,t);r!==e&&e.dispose();let i=r.getAttribute(`position`),a=r.getAttribute(`normal`),o=new B,s=new B,c=new B;for(let e=0;e+2<i.count;e+=3){o.fromBufferAttribute(i,e),s.fromBufferAttribute(i,e+1).sub(o),c.fromBufferAttribute(i,e+2).sub(o);let t=s.cross(c),n=t.length();if(n<1e-12)continue;let r=t.z/n;if(Math.abs(r)>.9999)for(let t=0;t<3;t++)a.setXYZ(e+t,0,0,Math.sign(r))}return a.needsUpdate=!0,r}function VD(e,t){let n=e.index?e.toNonIndexed():e,r=n.getAttribute(`position`),i=r.count-r.count%3;n.computeBoundingBox();let a=n.boundingBox,o=Math.max(a.max.x-a.min.x,a.max.y-a.min.y,1e-9)*1e-6,s=/* @__PURE__ */ new Map,c=[],l=e=>{let t=r.getX(e),n=r.getY(e),i=`${Math.round(t/o)},${Math.round(n/o)}`,a=s.get(i);return a===void 0&&(a=c.length,s.set(i,a),c.push([t,n])),a},u=[];for(let e=0;e<i;e+=3){let t=l(e),n=l(e+1),r=l(e+2);if(t===n||n===r||t===r)continue;let i=(c[n][0]-c[t][0])*(c[r][1]-c[t][1])-(c[r][0]-c[t][0])*(c[n][1]-c[t][1]);Math.abs(i)<o*o||(i<0&&([n,r]=[r,n]),u.push([t,n,r]))}let d=/* @__PURE__ */ new Map;for(let[e,t,n]of u)for(let[r,i]of[[e,t],[t,n],[n,e]]){let e=r<i?`${r}_${i}`:`${i}_${r}`,t=d.get(e);t?t.count++:d.set(e,{a:r,b:i,count:1})}let f=[],p=[],m=[],h=Math.max(a.max.x-a.min.x,1e-9),g=Math.max(a.max.y-a.min.y,1e-9),_=(e,t,n,r,i,o,s,c)=>{f.push(e,t,n),p.push(r,i,o),m.push(s??(e-a.min.x)/h,c??(t-a.min.y)/g)};for(let[e,n,r]of u){for(let i of[e,n,r])_(c[i][0],c[i][1],t,0,0,1);for(let t of[e,r,n])_(c[t][0],c[t][1],0,0,0,-1)}if(t>0)for(let e of d.values()){if(e.count!==1)continue;let[n,r]=c[e.a],[i,a]=c[e.b],s=i-n,l=a-r,u=Math.hypot(s,l);if(u<o)continue;let d=l/u,f=-s/u;_(n,r,0,d,f,0,0,0),_(i,a,0,d,f,0,1,0),_(i,a,t,d,f,0,1,1),_(n,r,0,d,f,0,0,0),_(i,a,t,d,f,0,1,1),_(n,r,t,d,f,0,0,1)}n!==e&&n.dispose();let v=new G;return v.setAttribute(`position`,new W(f,3)),v.setAttribute(`normal`,new W(p,3)),v.setAttribute(`uv`,new W(m,2)),v}var HD=t((()=>{J()})),UD=/* @__PURE__ */ n({Font:()=>qD,FontLoader:()=>KD});function WD(e,t,n,r){let i=Array.from(e),a=t/n.resolution,o=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*a,s=[],c=0,l=0;(r==`rtl`||r==`tb`)&&i.reverse();for(let e=0;e<i.length;e++){let t=i[e];if(t===`
5795
5795
  `)c=0,l-=o;else{let e=GD(t,a,c,l,n);r==`tb`?(c=0,l+=n.ascender*a):c+=e.offsetX,s.push(e.path)}}return s}function GD(e,t,n,r,i){let a=i.glyphs[e]||i.glyphs[`?`];if(!a){console.error(`THREE.Font: character "`+e+`" does not exists in font family `+i.familyName+`.`);return}let o=new Xf,s,c,l,u,d,f,p,m;if(a.o){let e=a._cachedOutline||=a.o.split(` `);for(let i=0,a=e.length;i<a;)switch(e[i++]){case`m`:s=e[i++]*t+n,c=e[i++]*t+r,o.moveTo(s,c);break;case`l`:s=e[i++]*t+n,c=e[i++]*t+r,o.lineTo(s,c);break;case`q`:l=e[i++]*t+n,u=e[i++]*t+r,d=e[i++]*t+n,f=e[i++]*t+r,o.quadraticCurveTo(d,f,l,u);break;case`b`:l=e[i++]*t+n,u=e[i++]*t+r,d=e[i++]*t+n,f=e[i++]*t+r,p=e[i++]*t+n,m=e[i++]*t+r,o.bezierCurveTo(d,f,p,m,l,u)}}return{offsetX:a.ha*t,path:o}}var KD,qD,JD=t((()=>{J(),KD=class extends gu{constructor(e){super(e)}load(e,t,n,r){let i=this,a=new yu(this.manager);a.setPriority(this.priority),a.setCache(this.cache),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(e){let n=i.parse(JSON.parse(e));t&&t(n)},n,r)}parse(e){return new qD(e)}},qD=class{constructor(e){this.isFont=!0,this.type=`Font`,this.data=e}generateShapes(e,t=100,n=`ltr`){let r=[],i=WD(e,t,this.data,n);for(let e=0,t=i.length;e<t;e++)r.push(...i[e].toShapes());return r}}})),YD=/* @__PURE__ */ n({REVEAL_EFFECTS:()=>bO,buildText:()=>gO,buildTextGeometry:()=>_O,depthTwin:()=>pO,fontUrl:()=>mO,kerningOf:()=>ZD,layoutText:()=>QD,loadFont:()=>XD,offsetRing:()=>oO,offsetShapes:()=>sO,outlineSpec:()=>iO,revealDelay:()=>dO,revealImpl:()=>fO,textGeometry:()=>lO,textMetrics:()=>eO});function XD(e){let t=vO.get(e);return t||(t=Promise.all([Promise.resolve().then(()=>(JD(),UD)),hg(e)]).then(([e,t])=>new e.FontLoader().parse(t)),t.catch(()=>vO.delete(e)),vO.set(e,t)),t}function ZD(e,t,n){let r=e.kerning;if(!r)return 0;let i=r[t]?.[n];if(i!==void 0)return i;let a=yO(t),o=yO(n);return a===t&&o===n?0:r[a]?.[o]??0}function QD(e,t){let n=t.em/e.resolution,r=Q(t.letterSpacing,0),i=Q(t.lineHeight,1.25)*t.em,a=t.kerning!==!1,o=t=>(e.glyphs[t]??e.glyphs[`?`])?.ha??e.resolution*.5,s=t=>{let i=[],s=0;return t.forEach((c,l)=>{l>0&&(s+=r+(a?ZD(e,t[l-1],c)*n:0)),i.push(s),s+=o(c)*n}),{xs:i,width:s}},c=[],l=typeof t.maxWidth==`number`&&t.maxWidth>0?t.maxWidth:1/0;for(let e of String(t.text??``).split(`
5796
- `)){if(l===1/0){c.push(Array.from(e));continue}let t=e.split(/ +/),n=[];for(let e of t){let t=n.length?[...n,` `,...Array.from(e)]:Array.from(e);n.length&&s(t).width>l?(c.push(n),n=Array.from(e)):n=t}c.push(n)}let u=[],d=[],f=0;return c.forEach((e,n)=>{for(;e.length&&e[e.length-1]===` `;)e.pop();let{xs:r,width:a}=s(e);f=Math.max(f,a);let o=t.align===`left`?0:t.align===`right`?-a:-a/2;e.forEach((e,t)=>{e.trim()&&u.push({ch:e,x:r[t]+o,line:n})}),d.push({width:a,y:-n*i})}),{glyphs:u,lines:d,lineHeight:i,width:f}}function $D(e){let t=e.data;if(t.capHeight&&t.resolution)return t.capHeight/t.resolution;let n=e.generateShapes(`H`,1);if(!n.length)return .72;let r=new Ol(n);r.computeBoundingBox();let i=r.boundingBox.max.y-r.boundingBox.min.y;return r.dispose(),i>0?i:.72}function eO(e,t){let n=e.data,r=Q(t.size,1),i=r/$D(e),a=Math.max(0,Q(t.depth,.2)),o=a>0?Math.max(0,Math.min(Q(t.bevel,Math.min(a*.3,r*.035)),a*.45,r*.08)):0,s=Math.round(Math.max(2,Math.min(32,Q(t.curveSegments,a>0?5+r*3:8+r*4)))),c=QD(n,{text:t.text,em:i,letterSpacing:t.letterSpacing,lineHeight:t.lineHeight,align:t.align??`center`,maxWidth:t.maxWidth,kerning:t.kerning});return{size:r,em:i,depth:a,bevel:o,curveSegments:s,layout:c,offsetY:-(r+(c.lines.length?c.lines[c.lines.length-1].y:0))/2,frontZ:a/2,backZ:-a/2}}function tO(e){let t=e.bevel;return{depth:Math.max(e.depth-t*2,1e-4),curveSegments:e.curveSegments,bevelEnabled:t>0,bevelThickness:t,bevelSize:t*.6,bevelOffset:0,bevelSegments:3}}function nO(e,t,n){let r=n.em/(n.curveSegments*5);return e.generateShapes(t,n.em).map(e=>zD(e,r,1,n.curveSegments))}function rO(e,t,n,r){let i=nO(e,t,n);if(!i.length)return null;if(n.depth<=0)return new Ol(i,n.curveSegments);let a=new xl(i,tO(n));return a.translate(0,0,n.backZ+n.bevel),a.clearGroups(),BD(a,50*Math.PI/180,r)}function iO(e,t){let n=e.outline;if(!n)return null;let r=n===!0?{}:n,i=Math.max(1e-4,Q(r.width,t.size*.06)),a=t.depth>0?t.depth*.5:t.size*.01,o=t.frontZ-a;return{width:i,frontZ:o,backZ:o-Math.max(Q(r.depth,t.depth>0?t.depth*.6:t.size*.01),1e-4),material:r.material,color:r.color??`#111111`}}function aO(e){let t=0;for(let n=0,r=e.length-1;n<e.length;r=n++)t+=(e[r].x-e[n].x)*(e[r].y+e[n].y);return t/2}function oO(e,t,n=2){let r=e.filter((t,n)=>{let r=e[(n+1)%e.length];return Math.hypot(r.x-t.x,r.y-t.y)>1e-9}),i=r.length,a=[];if(i<3)return r.map(e=>new z(e.x,e.y));let o=(e,t)=>{let n=t.x-e.x,r=t.y-e.y,i=Math.hypot(n,r)||1;return{x:r/i,y:-n/i}};for(let e=0;e<i;e++){let s=r[(e-1+i)%i],c=r[e],l=r[(e+1)%i],u=o(s,c),d=o(c,l),f=(c.x-s.x)*(l.y-c.y)-(c.y-s.y)*(l.x-c.x),p=u.x*d.x+u.y*d.y;if(f>0&&p<.995){let e=Math.atan2(u.y,u.x),n=Math.atan2(d.y,d.x);for(;n<e;)n+=Math.PI*2;for(;n>e+Math.PI*2;)n-=Math.PI*2;let r=Math.max(1,Math.ceil(Math.abs(n-e)/(Math.PI/8)));for(let i=0;i<=r;i++){let o=e+(n-e)*i/r;a.push(new z(c.x+Math.cos(o)*t,c.y+Math.sin(o)*t))}}else{let e=u.x+d.x,r=u.y+d.y,i=Math.hypot(e,r)||1;e/=i,r/=i;let o=Math.max(e*u.x+r*u.y,1/n);a.push(new z(c.x+e*t/o,c.y+r*t/o))}}return a}function sO(e,t){let n=[];for(let r of e){let{shape:e,holes:i}=r.extractPoints(1),a=e.slice();aO(a)<0&&(a=a.reverse());let o=new vl(oO(a,t));for(let e of i){let n=e.slice(),r=Math.abs(aO(n));aO(n)>0&&(n=n.reverse());let i=n.map(e=>e.x),a=n.map(e=>e.y);if(Math.max(...i)-Math.min(...i)<=2*t||Math.max(...a)-Math.min(...a)<=2*t)continue;let s=oO(n,t),c=aO(s);c<0&&-c>r*.02&&o.holes.push(new _l(s))}n.push(o)}return n}function cO(e,t,n,r,i){let a=nO(e,t,n);if(!a.length)return null;let o=new xl(sO(a,r.width),{depth:r.frontZ-r.backZ,curveSegments:1,bevelEnabled:!1});return o.translate(0,0,r.backZ),o.clearGroups(),BD(o,40*Math.PI/180,i)}function lO(e,t,n){let r=eO(e,t);return uO(r,t=>rO(e,t,r,n),n)}function uO(e,t,n){let r=/* @__PURE__ */ new Map,i=[];for(let n of e.layout.glyphs){r.has(n.ch)||r.set(n.ch,t(n.ch));let a=r.get(n.ch);if(!a)continue;let o=a.clone();o.translate(n.x,e.layout.lines[n.line].y+e.offsetY,0),i.push(o)}for(let e of r.values())e?.dispose();let a;if(!i.length)a=new G;else{a=(i.length===1?i[0].clone():n.mergeGeometries(i,!1))??new G;for(let e of i)e.dispose()}return a.computeBoundingBox(),a.computeBoundingSphere(),a}function dO(e,t,n){let r=Q(e.stagger,.04),i=t;if(e.order===`reverse`)i=n-1-t;else if(e.order===`center`)i=Math.abs(t-(n-1)/2);else if(e.order===`random`){let e=(t+1)*2654435761;e=(e^e>>>13)>>>0,i=e%1e3/1e3*(n-1)}return Q(e.delay,0)+i*r}function fO(e,t){return(n,r)=>{let i=e.effect??`rise`,a=Math.max(Q(e.duration,.6),.001),o=e.ease??(i===`scale`||i===`spin`?`outBack`:`outCubic`),s=i!==`scale`,c=[],l=[];if(s){let e=[];r.object.traverse(t=>{let n=t.material;if(n&&!t.userData.depthTwin){e.push(t);for(let e of Array.isArray(n)?n:[n])e.userData.baseOpacity===void 0&&(e.userData.baseOpacity=e.opacity),e.userData.baseTransparent===void 0&&(e.userData.baseTransparent=e.transparent),c.push(e)}});for(let t of e)l.push(pO(t))}return{update(e){let n=Math.min(Math.max(e/a,0),1),u=eS(o,n),d=r.object;if(s){let e=eS(`outCubic`,Math.min(1,n*1.6));for(let t of c)t.opacity=t.userData.baseOpacity*e,t.transparent=e<1||t.userData.baseTransparent;for(let t of l)t.visible=e>0&&e<1}switch(n<=0&&(d.visible=!1),i){case`rise`:d.position.y-=(1-u)*t*.6;break;case`drop`:d.position.y+=(1-u)*t*1.2;break;case`scale`:d.scale.multiplyScalar(Math.max(1e-4,u));break;case`spin`:d.rotation.y+=(1-u)*Math.PI,d.scale.multiplyScalar(Math.max(1e-4,Math.min(1,n*2)))}}}}}function pO(e){xO??=new ss({colorWrite:!1,depthWrite:!0});let t=new K(e.geometry,xO);return t.name=`${e.name}#depth`,t.visible=!1,t.castShadow=!1,t.receiveShadow=!1,t.renderOrder=-1,t.userData.helper=!0,t.userData.depthTwin=!0,e.add(t),t}function mO(e,t){let n=e.font??`sans-bold`;return t.resolveAsset(n.includes(`/`)||n.includes(`:`)?n:`library:fonts/${n}`)}function hO(e,t,n){let r=e.userData.gradient;r&&(r.uGradMin.value=t,r.uGradMax.value=n)}async function gO(e,t){let[n,r]=await Promise.all([XD(mO(e,t)),Promise.resolve().then(()=>(Wv(),kv))]),i=eO(n,e),a=iO(e,i),o=!!e.splitLetters||!!e.reveal,s=i.depth<=0,c=()=>yw(e.material,t,{defaultColor:`#ffffff`}),l=()=>a?yw(a.material??{color:a.color,roughness:.55},t):null,u=(i.layout.lines.length?i.layout.lines[i.layout.lines.length-1].y:0)+i.offsetY,d=i.size+i.offsetY,f=e=>(s&&(e.side=2),e);if(!o){let t=uO(i,e=>rO(n,e,i,r),r),o=f(await c());hO(o,u,d);let s=new K(t,o);if(a){let t=uO(i,e=>cO(n,e,i,a,r),r),o=await l();if(o){hO(o,u,d);let n=new K(t,o);n.name=`${e.id}/outline`,s.add(n)}}return{object:s,letters:[]}}let p=new ba,m=/* @__PURE__ */ new Map,h=/* @__PURE__ */ new Map,g=i.size/2,_=[],v=i.layout.glyphs.length,y=0;for(let t of i.layout.glyphs){if(!m.has(t.ch)){let e=rO(n,t.ch,i,r),o=0;if(e&&(e.computeBoundingBox(),o=(e.boundingBox.min.x+e.boundingBox.max.x)/2,e.translate(-o,-g,0),e.computeBoundingSphere()),m.set(t.ch,e),a){let e=cO(n,t.ch,i,a,r);e?.translate(-o,-g,0),h.set(t.ch,e)}e&&(e.userData.cx=o)}let o=m.get(t.ch);if(!o)continue;let s=o.userData.cx,b=i.layout.lines[t.line].y+i.offsetY,x=f(await c());hO(x,u-b-g,d-b-g);let S=new K(o,x);S.position.set(t.x+s,b+g,0);let C=`${e.id}/${y}`;S.name=C,S.userData.a3dId=C;let w=h.get(t.ch);if(w){let e=await l();if(e){hO(e,u-b-g,d-b-g);let t=new K(w,e);t.name=`${C}/outline`,S.add(t)}}p.add(S);let T={id:C,object:S,def:{id:C,kind:`text`,text:t.ch}};e.reveal&&(T.reveal={def:{type:`appear`,when:`visible`,delay:dO(e.reveal,y,v)},impl:fO(e.reveal,i.size)}),_.push(T),y++}return{object:p,letters:_}}async function _O(e,t){let[n,r]=await Promise.all([XD(mO(e,t)),Promise.resolve().then(()=>(Wv(),kv))]);return lO(n,e,r)}var vO,yO,bO,xO,SO=t((()=>{J(),yg(),wS(),zS(),HD(),jw(),vO=/* @__PURE__ */ new Map,yO=e=>{let t=e.normalize(`NFD`);return t.length>1?t[0]:e},bO=[`rise`,`fade`,`scale`,`spin`,`drop`],xO=null})),CO=/* @__PURE__ */ n({SVGLoader:()=>OO});function wO(e,t,n=256){if(!e||!Array.isArray(e.stops)||e.stops.length===0)return null;let r=t.userData.transform,i=e.gradientUnits===`objectBoundingBox`,a=null;if(i&&(a=TO(t,r),a===null))return null;function o(t,n,o){o.set(t,n,1),e.gradientTransform&&o.applyMatrix3(e.gradientTransform),i&&o.set(a.minX+o.x*a.width,a.minY+o.y*a.height,1),r&&o.applyMatrix3(r)}let s=document.createElement(`canvas`),c;if(e.type===`linearGradient`){s.width=n,s.height=1;let t=s.getContext(`2d`),r=t.createLinearGradient(0,0,n,0);EO(r,e.stops),t.fillStyle=r,t.fillRect(0,0,n,1);let i=new B,a=new B;o(e.x1,e.y1,i),o(e.x2,e.y2,a);let l=a.x-i.x,u=a.y-i.y,d=l*l+u*u||1e-20,f=l/d,p=u/d,m=-(f*i.x+p*i.y);c=new Di().set(f,p,m,0,0,.5,0,0,1)}else{let t=e.cx,o=e.cy,l=e.fx,u=e.fy,d=e.r;if(e.gradientTransform){let n=new B;n.set(t,o,1).applyMatrix3(e.gradientTransform),t=n.x,o=n.y,n.set(l,u,1).applyMatrix3(e.gradientTransform),l=n.x,u=n.y}if(i&&(t=a.minX+t*a.width,o=a.minY+o*a.height,l=a.minX+l*a.width,u=a.minY+u*a.height,d*=Math.sqrt((a.width*a.width+a.height*a.height)/2)),d<=0)return null;s.width=n,s.height=n;let f=s.getContext(`2d`),p=t-d,m=o-d,h=2*d,g=n/h;f.setTransform(g,0,0,g,-p*g,-m*g);let _=f.createRadialGradient(l,u,0,t,o,d);EO(_,e.stops),f.fillStyle=_,f.fillRect(p,m,h,h);let v=r?r.clone().invert():new Di;c=new Di().set(1/h,0,-p/h,0,1/h,-m/h,0,0,1).multiply(v)}let l=new Ic(s);l.colorSpace=DO,l.flipY=!1,l.matrixAutoUpdate=!1,l.matrix=c;let u=e.spreadMethod===`reflect`?sn:e.spreadMethod===`repeat`?an:on;return l.wrapS=u,l.wrapT=u,l}function TO(e,t){let n=t?t.clone().invert():null,r=new z,i=new ff;for(let t of e.subPaths)for(let e of t.getPoints())r.copy(e),n&&r.applyMatrix3(n),i.expandByPoint(r);return i.isEmpty()?null:{minX:i.min.x,minY:i.min.y,width:i.max.x-i.min.x,height:i.max.y-i.min.y}}function EO(e,t){let n=new H;for(let r of t){let t=r.color;if(r.opacity<1){n.setStyle(r.color,DO);let e=/rgb\(([^)]+)\)/.exec(n.getStyle(DO));e&&(t=`rgba(${e[1]},${r.opacity})`)}e.addColorStop(Math.max(0,Math.min(1,r.offset)),t)}}var DO,OO,kO,AO=t((()=>{J(),DO=Br,OO=class e extends gu{constructor(e){super(e),this.defaultDPI=90,this.defaultUnit=`px`}load(e,t,n,r){let i=this,a=new yu(i.manager);a.setPriority(i.priority),a.setCache(i.cache),a.setPath(i.path),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,function(n){try{t(i.parse(n))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}parse(e){let t=this;function n(e,t){if(e.nodeType!==1)return;e.hasAttribute(`filter`)&&console.warn(`THREE.SVGLoader: Filters are not supported.`);let a=b(e),o=!1,p=null;switch(e.nodeName){case`svg`:t=m(e,t);break;case`style`:i(e);break;case`g`:t=m(e,t);break;case`path`:t=m(e,t),e.hasAttribute(`d`)&&(p=r(e));break;case`rect`:t=m(e,t),p=s(e);break;case`polygon`:t=m(e,t),p=c(e);break;case`polyline`:t=m(e,t),p=l(e);break;case`circle`:t=m(e,t),p=u(e);break;case`ellipse`:t=m(e,t),p=d(e);break;case`line`:t=m(e,t),p=f(e);break;case`defs`:o=!0;break;case`use`:t=m(e,t);let a=(e.getAttributeNS(`http://www.w3.org/1999/xlink`,`href`)||e.getAttribute(`href`)||``).substring(1),h=e.viewportElement.getElementById(a);h?n(h,t):console.warn(`SVGLoader: 'use node' references non-existent node id: `+a)}if(p){t.fill!==void 0&&t.fill!==`none`&&!t.fill.startsWith(`url`)&&p.color.setStyle(t.fill,DO),C(p,ie),A.push(p);let n=Object.assign({},t);n.strokeWidth=t.strokeWidth*O(ie),p.userData={node:e,style:n,transform:ie.clone(),gradients:M}}let h=e.childNodes;for(let e=0;e<h.length;e++){let r=h[e];o&&r.nodeName!==`style`&&r.nodeName!==`defs`||n(r,t)}a&&(N.pop(),N.length>0?ie.copy(N[N.length-1]):ie.identity())}function r(e){let t=new Xf,n=new z,r=new z,i=new z,o=!1,s=e.getAttribute(`d`);if(s===``||s===`none`)return null;let c=s.match(/[a-df-z][^a-df-z]*/gi);for(let e=0,s=c.length;e<s;e++){let s=c[e],l=s.charAt(0),u=s.slice(1).trim();o===!0&&(l!==`M`&&l!==`m`&&l!==`Z`&&l!==`z`&&t.moveTo(i.x,i.y),o=!1);let d;switch(l){case`M`:d=g(u);for(let e=0,a=d.length;e<a;e+=2)n.x=d[e+0],n.y=d[e+1],r.x=n.x,r.y=n.y,e===0?t.moveTo(n.x,n.y):t.lineTo(n.x,n.y),e===0&&i.copy(n);break;case`H`:d=g(u);for(let e=0,i=d.length;e<i;e++)n.x=d[e],r.x=n.x,r.y=n.y,t.lineTo(n.x,n.y);break;case`V`:d=g(u);for(let e=0,i=d.length;e<i;e++)n.y=d[e],r.x=n.x,r.y=n.y,t.lineTo(n.x,n.y);break;case`L`:d=g(u);for(let e=0,i=d.length;e<i;e+=2)n.x=d[e+0],n.y=d[e+1],r.x=n.x,r.y=n.y,t.lineTo(n.x,n.y);break;case`C`:d=g(u);for(let e=0,i=d.length;e<i;e+=6)t.bezierCurveTo(d[e+0],d[e+1],d[e+2],d[e+3],d[e+4],d[e+5]),r.x=d[e+2],r.y=d[e+3],n.x=d[e+4],n.y=d[e+5];break;case`S`:d=g(u);for(let e=0,i=d.length;e<i;e+=4)t.bezierCurveTo(h(n.x,r.x),h(n.y,r.y),d[e+0],d[e+1],d[e+2],d[e+3]),r.x=d[e+0],r.y=d[e+1],n.x=d[e+2],n.y=d[e+3];break;case`Q`:d=g(u);for(let e=0,i=d.length;e<i;e+=4)t.quadraticCurveTo(d[e+0],d[e+1],d[e+2],d[e+3]),r.x=d[e+0],r.y=d[e+1],n.x=d[e+2],n.y=d[e+3];break;case`T`:d=g(u);for(let e=0,i=d.length;e<i;e+=2){let i=h(n.x,r.x),a=h(n.y,r.y);t.quadraticCurveTo(i,a,d[e+0],d[e+1]),r.x=i,r.y=a,n.x=d[e+0],n.y=d[e+1]}break;case`A`:d=g(u,[3,4],7);for(let e=0,i=d.length;e<i;e+=7){if(d[e+5]==n.x&&d[e+6]==n.y)continue;let i=n.clone();n.x=d[e+5],n.y=d[e+6],r.x=n.x,r.y=n.y,a(t,d[e],d[e+1],d[e+2],d[e+3],d[e+4],i,n)}break;case`m`:d=g(u);for(let e=0,a=d.length;e<a;e+=2)n.x+=d[e+0],n.y+=d[e+1],r.x=n.x,r.y=n.y,e===0?t.moveTo(n.x,n.y):t.lineTo(n.x,n.y),e===0&&i.copy(n);break;case`h`:d=g(u);for(let e=0,i=d.length;e<i;e++)n.x+=d[e],r.x=n.x,r.y=n.y,t.lineTo(n.x,n.y);break;case`v`:d=g(u);for(let e=0,i=d.length;e<i;e++)n.y+=d[e],r.x=n.x,r.y=n.y,t.lineTo(n.x,n.y);break;case`l`:d=g(u);for(let e=0,i=d.length;e<i;e+=2)n.x+=d[e+0],n.y+=d[e+1],r.x=n.x,r.y=n.y,t.lineTo(n.x,n.y);break;case`c`:d=g(u);for(let e=0,i=d.length;e<i;e+=6)t.bezierCurveTo(n.x+d[e+0],n.y+d[e+1],n.x+d[e+2],n.y+d[e+3],n.x+d[e+4],n.y+d[e+5]),r.x=n.x+d[e+2],r.y=n.y+d[e+3],n.x+=d[e+4],n.y+=d[e+5];break;case`s`:d=g(u);for(let e=0,i=d.length;e<i;e+=4)t.bezierCurveTo(h(n.x,r.x),h(n.y,r.y),n.x+d[e+0],n.y+d[e+1],n.x+d[e+2],n.y+d[e+3]),r.x=n.x+d[e+0],r.y=n.y+d[e+1],n.x+=d[e+2],n.y+=d[e+3];break;case`q`:d=g(u);for(let e=0,i=d.length;e<i;e+=4)t.quadraticCurveTo(n.x+d[e+0],n.y+d[e+1],n.x+d[e+2],n.y+d[e+3]),r.x=n.x+d[e+0],r.y=n.y+d[e+1],n.x+=d[e+2],n.y+=d[e+3];break;case`t`:d=g(u);for(let e=0,i=d.length;e<i;e+=2){let i=h(n.x,r.x),a=h(n.y,r.y);t.quadraticCurveTo(i,a,n.x+d[e+0],n.y+d[e+1]),r.x=i,r.y=a,n.x+=d[e+0],n.y+=d[e+1]}break;case`a`:d=g(u,[3,4],7);for(let e=0,i=d.length;e<i;e+=7){if(d[e+5]==0&&d[e+6]==0)continue;let i=n.clone();n.x+=d[e+5],n.y+=d[e+6],r.x=n.x,r.y=n.y,a(t,d[e],d[e+1],d[e+2],d[e+3],d[e+4],i,n)}break;case`Z`:case`z`:t.currentPath.autoClose=!0,t.currentPath.curves.length>0&&(n.copy(i),t.currentPath.currentPoint.copy(n),o=!0);break;default:console.warn(s)}}return t}function i(e){if(e.sheet&&e.sheet.cssRules&&e.sheet.cssRules.length)for(let t=0;t<e.sheet.cssRules.length;t++){let n=e.sheet.cssRules[t];if(n.type!==1)continue;let r=n.selectorText.split(/,/gm).filter(Boolean).map(e=>e.trim()),i={};for(let e=0;e<n.style.length;e++){let t=n.style[e];i[t]=n.style.getPropertyValue(t)}for(let e=0;e<r.length;e++)j[r[e]]=Object.assign(j[r[e]]||{},i)}}function a(e,t,n,r,i,a,s,c){if(t==0||n==0){e.lineTo(c.x,c.y);return}r=r*Math.PI/180,t=Math.abs(t),n=Math.abs(n);let l=(s.x-c.x)/2,u=(s.y-c.y)/2,d=Math.cos(r)*l+Math.sin(r)*u,f=-Math.sin(r)*l+Math.cos(r)*u,p=t*t,m=n*n,h=d*d,g=f*f,_=h/p+g/m;if(_>1){let e=Math.sqrt(_);t=e*t,n=e*n,p=t*t,m=n*n}let v=p*g+m*h,y=(p*m-v)/v,b=Math.sqrt(Math.max(0,y));i===a&&(b=-b);let x=b*t*f/n,S=-b*n*d/t,C=Math.cos(r)*x-Math.sin(r)*S+(s.x+c.x)/2,w=Math.sin(r)*x+Math.cos(r)*S+(s.y+c.y)/2,T=o(1,0,(d-x)/t,(f-S)/n),E=o((d-x)/t,(f-S)/n,(-d-x)/t,(-f-S)/n)%(Math.PI*2);e.currentPath.absellipse(C,w,t,n,T,T+E,a===0,r)}function o(e,t,n,r){let i=e*n+t*r,a=Math.sqrt(e*e+t*t)*Math.sqrt(n*n+r*r),o=Math.acos(Math.max(-1,Math.min(1,i/a)));return e*r-t*n<0&&(o=-o),o}function s(e){let t=y(e.getAttribute(`x`)||0),n=y(e.getAttribute(`y`)||0),r=y(e.getAttribute(`rx`)||e.getAttribute(`ry`)||0),i=y(e.getAttribute(`ry`)||e.getAttribute(`rx`)||0),a=y(e.getAttribute(`width`)),o=y(e.getAttribute(`height`)),s=.448084975506,c=new Xf;return c.moveTo(t+r,n),c.lineTo(t+a-r,n),(r!==0||i!==0)&&c.bezierCurveTo(t+a-r*s,n,t+a,n+i*s,t+a,n+i),c.lineTo(t+a,n+o-i),(r!==0||i!==0)&&c.bezierCurveTo(t+a,n+o-i*s,t+a-r*s,n+o,t+a-r,n+o),c.lineTo(t+r,n+o),(r!==0||i!==0)&&c.bezierCurveTo(t+r*s,n+o,t,n+o-i*s,t,n+o-i),c.lineTo(t,n+i),(r!==0||i!==0)&&c.bezierCurveTo(t,n+i*s,t+r*s,n,t+r,n),c}function c(e){function t(e,t,n){let a=y(t),o=y(n);i===0?r.moveTo(a,o):r.lineTo(a,o),i++}let n=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)/g,r=new Xf,i=0;return e.getAttribute(`points`).replace(n,t),r.currentPath.autoClose=!0,r}function l(e){function t(e,t,n){let a=y(t),o=y(n);i===0?r.moveTo(a,o):r.lineTo(a,o),i++}let n=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)/g,r=new Xf,i=0;return e.getAttribute(`points`).replace(n,t),r.currentPath.autoClose=!1,r}function u(e){let t=y(e.getAttribute(`cx`)||0),n=y(e.getAttribute(`cy`)||0),r=y(e.getAttribute(`r`)||0),i=new _l;i.absarc(t,n,r,0,Math.PI*2);let a=new Xf;return a.subPaths.push(i),a}function d(e){let t=y(e.getAttribute(`cx`)||0),n=y(e.getAttribute(`cy`)||0),r=y(e.getAttribute(`rx`)||0),i=y(e.getAttribute(`ry`)||0),a=new _l;a.absellipse(t,n,r,i,0,Math.PI*2);let o=new Xf;return o.subPaths.push(a),o}function f(e){let t=y(e.getAttribute(`x1`)||0),n=y(e.getAttribute(`y1`)||0),r=y(e.getAttribute(`x2`)||0),i=y(e.getAttribute(`y2`)||0),a=new Xf;return a.moveTo(t,n),a.lineTo(r,i),a.currentPath.autoClose=!1,a}function p(e){let t=e.querySelectorAll(`linearGradient, radialGradient`),n=[`x1`,`y1`,`x2`,`y2`,`cx`,`cy`,`r`,`fx`,`fy`,`gradientUnits`,`gradientTransform`,`spreadMethod`],r={};for(let e of t){let t=e.getAttribute(`id`);if(!t)continue;let i={type:e.nodeName===`radialGradient`?`radialGradient`:`linearGradient`,attrs:{},stops:null,href:null},a=e.getAttributeNS(`http://www.w3.org/1999/xlink`,`href`)||e.getAttribute(`href`)||``;a.startsWith(`#`)&&(i.href=a.substring(1));for(let t of n)e.hasAttribute(t)&&(i.attrs[t]=e.getAttribute(t));let o=e.querySelectorAll(`stop`);if(o.length>0){i.stops=[];for(let e of o){let t=e.getAttribute(`stop-color`);!t&&e.style&&(t=e.style[`stop-color`]),t||=`#000`;let n=e.getAttribute(`stop-opacity`);(n===null||n===``)&&e.style&&(n=e.style[`stop-opacity`]),n=n===null||n===``||n===void 0?1:Math.max(0,Math.min(1,parseFloat(n)));let r=Math.max(0,Math.min(1,parseFloat(e.getAttribute(`offset`)||`0`)));i.stops.push({offset:r,color:t,opacity:n})}}r[t]=i}function i(e,t){let n=r[e];if(!n||t.has(e))return n;if(t.add(e),n.href&&r[n.href]){let e=i(n.href,t);if(e){n.stops||=e.stops;for(let t in e.attrs)t in n.attrs||(n.attrs[t]=e.attrs[t])}}return n}for(let e in r)i(e,/* @__PURE__ */ new Set);for(let e in r){let t=r[e],n=t.attrs,i=n.gradientUnits===`userSpaceOnUse`?`userSpaceOnUse`:`objectBoundingBox`,a={type:t.type,gradientUnits:i,spreadMethod:n.spreadMethod===`reflect`||n.spreadMethod===`repeat`?n.spreadMethod:`pad`,gradientTransform:null,stops:(t.stops||[]).slice().sort((e,t)=>e.offset-t.offset)};n.gradientTransform&&(a.gradientTransform=new Di,S(n.gradientTransform,a.gradientTransform));function o(e){return typeof e==`string`?e.endsWith(`%`)?parseFloat(e)/100:y(e):0}if(t.type===`linearGradient`)a.x1=n.x1===void 0?0:o(n.x1),a.y1=n.y1===void 0?0:o(n.y1),a.x2=n.x2===void 0?+(i===`objectBoundingBox`):o(n.x2),a.y2=n.y2===void 0?0:o(n.y2);else{let e=i===`objectBoundingBox`?.5:0,t=i===`objectBoundingBox`?.5:0;a.cx=n.cx===void 0?e:o(n.cx),a.cy=n.cy===void 0?e:o(n.cy),a.r=n.r===void 0?t:o(n.r),a.fx=n.fx===void 0?a.cx:o(n.fx),a.fy=n.fy===void 0?a.cy:o(n.fy)}M[e]=a}}function m(e,t){t=Object.assign({},t);let n={};if(e.hasAttribute(`class`)){let t=e.getAttribute(`class`).split(/\s/).filter(Boolean).map(e=>e.trim());for(let e=0;e<t.length;e++)n=Object.assign(n,j[`.`+t[e]])}e.hasAttribute(`id`)&&(n=Object.assign(n,j[`#`+e.getAttribute(`id`)]));function r(r,i,a){a===void 0&&(a=function(e){return e}),e.hasAttribute(r)&&(t[i]=a(e.getAttribute(r))),n[r]&&(t[i]=a(n[r])),e.style&&e.style[r]!==``&&(t[i]=a(e.style[r]))}function i(e){return Math.max(0,Math.min(1,y(e)))}function a(e){return Math.max(0,y(e))}return r(`fill`,`fill`),r(`fill-opacity`,`fillOpacity`,i),r(`fill-rule`,`fillRule`),r(`opacity`,`opacity`,i),r(`stroke`,`stroke`),r(`stroke-opacity`,`strokeOpacity`,i),r(`stroke-width`,`strokeWidth`,a),r(`stroke-linejoin`,`strokeLineJoin`),r(`stroke-linecap`,`strokeLineCap`),r(`stroke-miterlimit`,`strokeMiterLimit`,a),r(`visibility`,`visibility`),t}function h(e,t){return e-(t-e)}function g(e,t,n){if(typeof e!=`string`)throw TypeError(`Invalid input: `+typeof e);let r={SEPARATOR:/[ \t\r\n\,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/},i=0,a=!0,o=``,s=``,c=[];function l(e,t,n){let r=/* @__PURE__ */ SyntaxError(`Unexpected character "`+e+`" at index `+t+`.`);throw r.partial=n,r}function u(){o!==``&&(s===``?c.push(Number(o)):c.push(Number(o)*10**Number(s))),o=``,s=``}let d,f=e.length;for(let p=0;p<f;p++)if(d=e[p],Array.isArray(t)&&t.includes(c.length%n)&&r.FLAGS.test(d))i=1,o=d,u();else{if(i===0){if(r.WHITESPACE.test(d))continue;if(r.DIGIT.test(d)||r.SIGN.test(d)){i=1,o=d;continue}if(r.POINT.test(d)){i=2,o=d;continue}r.COMMA.test(d)&&(a&&l(d,p,c),a=!0)}if(i===1){if(r.DIGIT.test(d)){o+=d;continue}if(r.POINT.test(d)){o+=d,i=2;continue}if(r.EXP.test(d)){i=3;continue}r.SIGN.test(d)&&o.length===1&&r.SIGN.test(o[0])&&l(d,p,c)}if(i===2){if(r.DIGIT.test(d)){o+=d;continue}if(r.EXP.test(d)){i=3;continue}r.POINT.test(d)&&o[o.length-1]===`.`&&l(d,p,c)}if(i===3){if(r.DIGIT.test(d)){s+=d;continue}if(r.SIGN.test(d)){if(s===``){s+=d;continue}s.length===1&&r.SIGN.test(s)&&l(d,p,c)}}r.WHITESPACE.test(d)?(u(),i=0,a=!1):r.COMMA.test(d)?(u(),i=0,a=!0):r.SIGN.test(d)?(u(),i=1,o=d):r.POINT.test(d)?(u(),i=2,o=d):l(d,p,c)}return u(),c}let _=[`mm`,`cm`,`in`,`pt`,`pc`,`px`],v={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:12,pc:1,px:-1},px:{px:1}};function y(e){let n=`px`;if(typeof e==`string`||e instanceof String)for(let t=0,r=_.length;t<r;t++){let r=_[t];if(e.endsWith(r)){n=r,e=e.substring(0,e.length-r.length);break}}let r;return n===`px`&&t.defaultUnit!==`px`?r=v.in[t.defaultUnit]/t.defaultDPI:(r=v[n][t.defaultUnit],r<0&&(r=v[n].in*t.defaultDPI)),r*parseFloat(e)}function b(e){if(!(e.hasAttribute(`transform`)||e.nodeName===`use`&&(e.hasAttribute(`x`)||e.hasAttribute(`y`))))return null;let t=x(e);return N.length>0&&t.premultiply(N[N.length-1]),ie.copy(t),N.push(t),t}function x(e){let t=new Di;if(e.nodeName===`use`&&(e.hasAttribute(`x`)||e.hasAttribute(`y`))){let n=y(e.getAttribute(`x`)||0),r=y(e.getAttribute(`y`)||0);t.makeTranslation(n,r)}return e.hasAttribute(`transform`)&&S(e.getAttribute(`transform`),t),t}function S(e,t){let n=P,r=e.split(`)`);for(let e=r.length-1;e>=0;e--){let i=r[e].trim();if(i===``)continue;let a=i.indexOf(`(`),o=i.length;if(a>0&&a<o){let e=i.slice(0,a),r=g(i.slice(a+1));switch(n.identity(),e){case`translate`:if(r.length>=1){let e=r[0],t=0;r.length>=2&&(t=r[1]),n.makeTranslation(e,t)}break;case`rotate`:if(r.length>=1){let e=0,t=0,i=0;e=r[0]*Math.PI/180,r.length>=3&&(t=r[1],i=r[2]),F.makeTranslation(-t,-i),ee.makeRotation(e),te.multiplyMatrices(ee,F),F.makeTranslation(t,i),n.multiplyMatrices(F,te)}break;case`scale`:if(r.length>=1){let e=r[0],t=e;r.length>=2&&(t=r[1]),n.makeScale(e,t)}break;case`skewX`:r.length===1&&n.set(1,Math.tan(r[0]*Math.PI/180),0,0,1,0,0,0,1);break;case`skewY`:r.length===1&&n.set(1,0,0,Math.tan(r[0]*Math.PI/180),1,0,0,0,1);break;case`matrix`:r.length===6&&n.set(r[0],r[2],r[4],r[1],r[3],r[5],0,0,1)}t.premultiply(n)}}return t}function C(e,t){function n(e){re.set(e.x,e.y,1).applyMatrix3(t),e.set(re.x,re.y)}function r(e){let n=e.xRadius,r=e.yRadius,i=Math.cos(e.aRotation),a=Math.sin(e.aRotation),o=new B(n*i,n*a,0),s=new B(-r*a,r*i,0),c=o.applyMatrix3(t),l=s.applyMatrix3(t),u=P.set(c.x,l.x,0,c.y,l.y,0,0,0,1),d=F.copy(u).invert(),f=ee.copy(d).transpose().multiply(d).elements,p=k(f[0],f[1],f[4]),m=Math.sqrt(p.rt1),h=Math.sqrt(p.rt2);if(e.xRadius=1/m,e.yRadius=1/h,e.aRotation=Math.atan2(p.sn,p.cs),!((e.aEndAngle-e.aStartAngle)%(2*Math.PI)<2**-52)){let n=F.set(m,0,0,0,h,0,0,0,1),r=ee.set(p.cs,p.sn,0,-p.sn,p.cs,0,0,0,1),i=n.multiply(r).multiply(u),a=e=>{let{x:t,y:n}=new B(Math.cos(e),Math.sin(e),0).applyMatrix3(i);return Math.atan2(n,t)};e.aStartAngle=a(e.aStartAngle),e.aEndAngle=a(e.aEndAngle),w(t)&&(e.aClockwise=!e.aClockwise)}}function i(e){let n=E(t),r=D(t);e.xRadius*=n,e.yRadius*=r;let i=n>2**-52?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);e.aRotation+=i,w(t)&&(e.aStartAngle*=-1,e.aEndAngle*=-1,e.aClockwise=!e.aClockwise)}let a=e.subPaths;for(let e=0,o=a.length;e<o;e++){let o=a[e].curves;for(let e=0;e<o.length;e++){let a=o[e];a.isLineCurve?(n(a.v1),n(a.v2)):a.isCubicBezierCurve?(n(a.v0),n(a.v1),n(a.v2),n(a.v3)):a.isQuadraticBezierCurve?(n(a.v0),n(a.v1),n(a.v2)):a.isEllipseCurve&&(ne.set(a.aX,a.aY),n(ne),a.aX=ne.x,a.aY=ne.y,T(t)?r(a):i(a))}}}function w(e){let t=e.elements;return t[0]*t[4]-t[1]*t[3]<0}function T(e){let t=e.elements,n=t[0]*t[3]+t[1]*t[4];if(n===0)return!1;let r=E(e),i=D(e);return Math.abs(n/(r*i))>2**-52}function E(e){let t=e.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function D(e){let t=e.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function O(e){let t=e.elements,n=t[0]*t[4]-t[1]*t[3];return Math.sqrt(Math.abs(n))}function k(e,t,n){let r,i,a,o,s,c=e+n,l=e-n,u=Math.sqrt(l*l+4*t*t);return c>0?(r=.5*(c+u),s=1/r,i=e*s*n-t*s*t):c<0?i=.5*(c-u):(r=.5*u,i=-.5*u),a=l>0?l+u:l-u,Math.abs(a)>2*Math.abs(t)?(s=-2*t/a,o=1/Math.sqrt(1+s*s),a=s*o):Math.abs(t)===0?(a=1,o=0):(s=-.5*a/t,a=1/Math.sqrt(1+s*s),o=s*a),l>0&&(s=a,a=-o,o=s),{rt1:r,rt2:i,cs:a,sn:o}}let A=[],j={},M={},N=[],P=new Di,F=new Di,ee=new Di,te=new Di,ne=new z,re=new B,ie=new Di,ae=new DOMParser().parseFromString(e,`image/svg+xml`);return p(ae),n(ae.documentElement,{fill:`#000`,fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:`miter`,strokeLineCap:`butt`,strokeMiterLimit:4}),{paths:A,gradients:M,xml:ae.documentElement}}static createFillMaterial(e){let t=e.userData.style;if(t.fill===void 0||t.fill===`none`)return null;let n=e.color,r=null,i=kO.exec(t.fill);i&&(r=wO(e.userData.gradients&&e.userData.gradients[i[1]],e));let a=new ss({opacity:t.fillOpacity*(t.opacity||1),transparent:!0,side:2,depthWrite:!1});return r===null?a.color=n:a.map=r,a}static createStrokeMaterial(e){let t=e.userData.style;return t.stroke===void 0||t.stroke===`none`?null:(kO.test(t.stroke)&&console.warn(`THREE.SVGLoader: Gradient strokes are not supported.`),new ss({color:new H().setStyle(t.stroke,DO),opacity:t.strokeOpacity*(t.opacity||1),transparent:!0,side:2,depthWrite:!1}))}static createShapes(e){return console.warn(`SVGLoader: createShapes() is deprecated. Use shapePath.toShapes() instead.`),e.toShapes()}static getStrokeStyle(e,t,n,r,i){return e=e===void 0?1:e,t=t===void 0?`#000`:t,n=n===void 0?`miter`:n,r=r===void 0?`butt`:r,i=i===void 0?4:i,{strokeColor:t,strokeWidth:e,strokeLineJoin:n,strokeLineCap:r,strokeMiterLimit:i}}static pointsToStroke(t,n,r,i){let a=[],o=[],s=[];if(e.pointsToStrokeWithBuffers(t,n,r,i,a,o,s)===0)return null;let c=new G;return c.setAttribute(`position`,new W(a,3)),c.setAttribute(`normal`,new W(o,3)),c.setAttribute(`uv`,new W(s,2)),c}static pointsToStrokeWithBuffers(e,t,n,r,i,a,o,s){let c=new z,l=new z,u=new z,d=new z,f=new z,p=new z,m=new z,h=new z,g=new z,_=new z,v=new z,y=new z,b=new z,x=new z,S=new z,C=new z,w=new z;n=n===void 0?12:n,r=r===void 0?.001:r,s=s===void 0?0:s,e=de(e);let T=e.length;if(T<2)return 0;let E=e[0].equals(e[T-1]),D,O=e[0],k,A=t.strokeWidth/2,j=1/(T-1),M=0,N,P,F,ee,te=!1,ne=0,re=s*3,ie=s*2;ae(e[0],e[1],c).multiplyScalar(A),h.copy(e[0]).sub(c),g.copy(e[0]).add(c),_.copy(h),v.copy(g);for(let n=1;n<T;n++){D=e[n],k=n===T-1?E?e[1]:void 0:e[n+1];let r=c;if(ae(O,D,r),u.copy(r).multiplyScalar(A),y.copy(D).sub(u),b.copy(D).add(u),N=M+j,P=!1,k!==void 0){ae(D,k,l),u.copy(l).multiplyScalar(A),x.copy(D).sub(u),S.copy(D).add(u),F=!0,u.subVectors(k,O),r.dot(u)<0&&(F=!1),n===1&&(te=F),u.subVectors(k,D),u.normalize();let e=Math.abs(r.dot(u));if(e>2**-52){let n=A/e;u.multiplyScalar(-n),d.subVectors(D,O),f.copy(d).setLength(n).add(u),C.copy(f).negate();let r=f.length(),i=d.length();d.divideScalar(i),p.subVectors(k,D);let a=p.length();if(p.divideScalar(a),d.dot(C)<i&&p.dot(C)<a&&(P=!0),w.copy(f).add(D),C.add(D),P){let e=F?g:h,t=(w.x-e.x)*(C.y-e.y)-(w.y-e.y)*(C.x-e.x);(F&&t<0||!F&&t>0)&&C.copy(e)}switch(ee=!1,P?F?(S.copy(C),b.copy(C)):(x.copy(C),y.copy(C)):se(),t.strokeLineJoin){case`bevel`:ce(F,P,N);break;case`round`:le(F,P),F?oe(D,y,x,N,0):oe(D,S,b,N,1);break;default:let e=A*t.strokeMiterLimit/r;if(e<1){if(t.strokeLineJoin!==`miter-clip`){ce(F,P,N);break}le(F,P),F?(p.subVectors(w,y).multiplyScalar(e).add(y),m.subVectors(w,x).multiplyScalar(e).add(x),I(y,N,0),I(p,N,0),I(D,N,.5),I(D,N,.5),I(p,N,0),I(m,N,0),I(D,N,.5),I(m,N,0),I(x,N,0)):(p.subVectors(w,b).multiplyScalar(e).add(b),m.subVectors(w,S).multiplyScalar(e).add(S),I(b,N,1),I(p,N,1),I(D,N,.5),I(D,N,.5),I(p,N,1),I(m,N,1),I(D,N,.5),I(m,N,1),I(S,N,1))}else P?(F?(I(g,M,1),I(h,M,0),I(w,N,0),I(g,M,1),I(w,N,0),I(C,N,1)):(I(g,M,1),I(h,M,0),I(w,N,1),I(h,M,0),I(C,N,0),I(w,N,1)),F?x.copy(w):S.copy(w)):F?(I(y,N,0),I(w,N,0),I(D,N,.5),I(D,N,.5),I(w,N,0),I(x,N,0)):(I(b,N,1),I(w,N,1),I(D,N,.5),I(D,N,.5),I(w,N,1),I(S,N,1)),ee=!0}}else se()}else se();!E&&n===T-1&&ue(e[0],_,v,F,!0,M),M=N,O=D,h.copy(x),g.copy(S)}if(!E)ue(D,y,b,F,!1,N);else if(P&&i){let e=w,t=C;te!==F&&(e=C,t=w),F?(ee||te)&&(t.toArray(i,0),t.toArray(i,9),ee&&e.toArray(i,3)):(ee||!te)&&(t.toArray(i,3),t.toArray(i,9),ee&&e.toArray(i,0))}if(i){let e=[new z,new z,new z],t=s*3;for(let n=t;n<re;n+=9)e[0].set(i[n],i[n+1]),e[1].set(i[n+3],i[n+4]),e[2].set(i[n+6],i[n+7]),bl.area(e)<0&&(i[n+3]=e[0].x,i[n+4]=e[0].y)}return ne;function ae(e,t,n){return n.subVectors(t,e),n.set(-n.y,n.x).normalize()}function I(e,t,n){i&&(i[re]=e.x,i[re+1]=e.y,i[re+2]=0,a&&(a[re]=0,a[re+1]=0,a[re+2]=1),re+=3,o&&(o[ie]=t,o[ie+1]=n,ie+=2)),ne+=3}function oe(e,t,r,i,a){c.copy(t).sub(e).normalize(),l.copy(r).sub(e).normalize();let o=Math.PI,s=c.dot(l);Math.abs(s)<1&&(o=Math.abs(Math.acos(s))),o/=n,u.copy(t);for(let t=0,r=n-1;t<r;t++)d.copy(u).rotateAround(e,o),I(u,i,a),I(d,i,a),I(e,i,.5),u.copy(d);I(u,i,a),I(r,i,a),I(e,i,.5)}function se(){I(g,M,1),I(h,M,0),I(y,N,0),I(g,M,1),I(y,N,0),I(b,N,1)}function ce(e,t,n){t?e?(I(g,M,1),I(h,M,0),I(y,N,0),I(g,M,1),I(y,N,0),I(C,N,1),I(y,n,0),I(x,n,0),I(C,n,.5)):(I(g,M,1),I(h,M,0),I(b,N,1),I(h,M,0),I(C,N,0),I(b,N,1),I(b,n,1),I(C,n,0),I(S,n,1)):e?(I(y,n,0),I(x,n,0),I(D,n,.5)):(I(b,n,1),I(S,n,0),I(D,n,.5))}function le(e,t){t&&(e?(I(g,M,1),I(h,M,0),I(y,N,0),I(g,M,1),I(y,N,0),I(C,N,1),I(y,M,0),I(D,N,.5),I(C,N,1),I(D,N,.5),I(x,M,0),I(C,N,1)):(I(g,M,1),I(h,M,0),I(b,N,1),I(h,M,0),I(C,N,0),I(b,N,1),I(b,M,1),I(C,N,0),I(D,N,.5),I(D,N,.5),I(C,N,0),I(S,M,1)))}function ue(e,n,r,a,s,f){switch(t.strokeLineCap){case`round`:s?oe(e,r,n,f,.5):oe(e,n,r,f,.5);break;case`square`:if(s)c.subVectors(n,e),l.set(c.y,-c.x),u.addVectors(c,l).add(e),d.subVectors(l,c).add(e),a?(u.toArray(i,3),d.toArray(i,0),d.toArray(i,9)):(u.toArray(i,3),o[7]===1?d.toArray(i,9):u.toArray(i,9),d.toArray(i,0));else{c.subVectors(r,e),l.set(c.y,-c.x),u.addVectors(c,l).add(e),d.subVectors(l,c).add(e);let t=i.length;a?(u.toArray(i,t-3),d.toArray(i,t-6),d.toArray(i,t-12)):(d.toArray(i,t-6),u.toArray(i,t-3),d.toArray(i,t-12))}}}function de(e){let t=!1;for(let n=1,i=e.length-1;n<i;n++)if(e[n].distanceTo(e[n+1])<r){t=!0;break}if(!t)return e;let n=[];n.push(e[0]);for(let t=1,i=e.length-1;t<i;t++)e[t].distanceTo(e[t+1])>=r&&n.push(e[t]);return n.push(e[e.length-1]),n}}},kO=/^\s*url\(\s*(?:["']\s*)?#([^)'"\s]+)(?:\s*["'])?\s*\)\s*$/})),jO=/* @__PURE__ */ n({buildSvg:()=>RO,partsBounds:()=>IO,svgParts:()=>PO});function MO(e,t,n){if(e===`currentColor`)return n;let r=/^url\(\s*['"]?#([^'")]+)['"]?\s*\)/.exec(e);if(r){let e=t.userData?.gradients?.[r[1]]?.stops??[];if(!e.length)return n;let i=new H(e[0].color),a=new H(e[e.length-1].color);return`#${i.lerp(a,.5).getHexString()}`}try{let t=new H;return t.setStyle(e,Br),`#${t.getHexString(Br)}`}catch{return n}}function NO(e,t){let n=new ff;for(let t of e.paths)for(let e of t.subPaths)for(let t of e.getPoints(4))n.expandByPoint(t);return(n.isEmpty()?100:Math.max(n.max.x-n.min.x,n.max.y-n.min.y,1e-6))/(t*10)}function PO(e,t,n={}){let r=[],i=Math.max(1,Math.round(Q(n.curveSegments,12))),a=NO(e,i),o=n.currentColor??`#1f2330`;for(let s of e.paths){let e=s.userData?.style??{};if(e.visibility===`hidden`||e.visibility===`collapse`)continue;let c=Q(e.opacity,1);if(zO(e.fill)){let t=s.toShapes().map(e=>zD(e,a));t.length&&r.push({kind:`fill`,color:MO(e.fill,s,o),opacity:Q(e.fillOpacity,1)*c,shapes:t})}if(n.strokes!==!1&&zO(e.stroke)&&Q(e.strokeWidth,1)>0){let n=t.getStrokeStyle(Q(e.strokeWidth,1),`#000`,e.strokeLineJoin??`miter`,e.strokeLineCap??`butt`,Q(e.strokeMiterLimit,4)),l=[];for(let e of s.subPaths){let r=RD(e,a);if(r.length<2)continue;let o=t.pointsToStroke(r,n,i);o&&l.push(o)}if(l.length){let t=l.length===1?l[0]:FO(l);r.push({kind:`stroke`,color:MO(e.stroke,s,o),opacity:Q(e.strokeOpacity,1)*c,stroke:t})}}}return r}function FO(e){let t=0;for(let n of e)t+=n.getAttribute(`position`).count;let n=new Float32Array(t*3),r=0;for(let t of e){let e=t.getAttribute(`position`).array;n.set(e,r),r+=e.length,t.dispose()}let i=new G;return i.setAttribute(`position`,new co(n,3)),i}function IO(e,t=12){let n=new ff;for(let r of e){if(r.shapes)for(let e of r.shapes)for(let r of e.getPoints(t))n.expandByPoint(r);if(r.stroke){let e=r.stroke.getAttribute(`position`);for(let t=0;t<e.count;t++)n.expandByPoint(new z(e.getX(t),e.getY(t)))}}return n}function LO(e,t,n,r,i){if(e.kind===`stroke`)return e.stroke?VD(e.stroke,t):null;if(!e.shapes?.length)return null;if(t<=0)return new Ol(e.shapes,r);let a=Math.min(n,t*.45),o=new xl(e.shapes,{depth:Math.max(t-a*2,t*.05),curveSegments:r,bevelEnabled:a>0,bevelThickness:a,bevelSize:a*.6,bevelOffset:0,bevelSegments:3});return o.translate(0,0,a),o.clearGroups(),BD(o,50*Math.PI/180,i)}async function RO(e,t){let[{SVGLoader:n},r]=await Promise.all([Promise.resolve().then(()=>(AO(),CO)),Promise.resolve().then(()=>(Wv(),kv))]),i=e.src.trim().startsWith(`<`)?e.src:await mg(t.resolveAsset(e.src)),a=new n().parse(i),o=e.material?lw(e.material):void 0,s=typeof o?.color==`string`?o.color:void 0,c=Math.max(1,Math.round(Q(e.curveSegments,12))),l=PO(a,n,{strokes:e.strokes,curveSegments:c,currentColor:s}),u=new ba,d=IO(l,c);if(!l.length||d.isEmpty())return u;let f=Q(e.size,2),p=Math.max(d.max.x-d.min.x,1e-6),m=Math.max(d.max.y-d.min.y,1e-6),h=e.fit??`width`,g=f/(h===`height`?m:h===`max`?Math.max(p,m):p),_=Math.max(0,Q(e.depth,.2)),v=_/g,y=Q(e.bevel,0)/g,b=Q(e.layerGap,_>0?_*.02:f*.002),x=e.keepColors??!e.material,S=/* @__PURE__ */ new Map,C=async(n,r)=>{let i=x?`${n}|${r}`:`|${r}`,a=S.get(i);return a||(a=await yw(x?{roughness:.4,metalness:.1,...e.material??{},color:n,...r<1?{opacity:r}:{}}:e.material?{...e.material,...r<1?{opacity:r}:{}}:{color:`#dddddd`,roughness:.4,metalness:.1},t,{defaultColor:n}),r<1&&(a.transparent=!0),_<=0&&(a.side=2),S.set(i,a)),a},w=[];for(let e of l){let t=LO(e,v,y,c,r);if(!t)continue;t.getAttribute(`normal`)||t.computeVertexNormals();let n=x?`${e.color}|${e.opacity}`:`|${e.opacity}`,i=w[w.length-1];i&&i.key===n?i.geos.push(t):w.push({key:n,color:e.color,opacity:e.opacity,geos:[t]})}let T=new ba;for(let[e,t]of w.entries()){for(let e of t.geos){for(let t of Object.keys(e.attributes))[`position`,`normal`,`uv`].includes(t)||e.deleteAttribute(t);e.getAttribute(`uv`)||e.setAttribute(`uv`,new W(new Float32Array(e.getAttribute(`position`).count*2),2))}let n=t.geos.length===1?t.geos[0]:r.mergeGeometries(t.geos.map(e=>e.index?e.toNonIndexed():e),!1)??t.geos[0],i=new K(n,await C(t.color,t.opacity));i.position.z=e*b/g,T.add(i)}let E=(d.min.x+d.max.x)/2,D=(d.min.y+d.max.y)/2;return T.scale.set(g,-g,g),T.position.set(-E*g,D*g,-(_+Math.max(0,w.length-1)*b)/2),u.add(T),u}var zO,BO=t((()=>{J(),yg(),zS(),HD(),jw(),zO=e=>!!e&&e!==`none`&&e!==`transparent`})),VO=/* @__PURE__ */ n({clone:()=>GO,retarget:()=>UO,retargetClip:()=>WO});function HO(e,t){return t.getBoneName===void 0?t.names[e.name]:t.getBoneName(e)}function UO(e,t,n={}){let r=new wi,i=new B,a=new V,o=new V;n.preserveBoneMatrix=n.preserveBoneMatrix===void 0||n.preserveBoneMatrix,n.preserveBonePositions=n.preserveBonePositions===void 0||n.preserveBonePositions,n.useTargetMatrix=n.useTargetMatrix!==void 0&&n.useTargetMatrix,n.hip=n.hip===void 0?`hip`:n.hip,n.hipInfluence=n.hipInfluence===void 0?new B(1,1,1):n.hipInfluence,n.scale=n.scale===void 0?1:n.scale,n.names=n.names||{};let s=t.isObject3D?t.skeleton.bones:qO(t),c=e.isObject3D?e.skeleton.bones:qO(e),l,u,d,f;if(e.isObject3D?e.skeleton.pose():(n.useTargetMatrix=!0,n.preserveBoneMatrix=!1),n.preserveBonePositions){f=[];for(let e=0;e<c.length;e++)f.push(c[e].position.clone())}if(n.preserveBoneMatrix){e.updateMatrixWorld(),e.matrixWorld.identity();for(let t=0;t<e.children.length;++t)e.children[t].updateMatrixWorld(!0)}for(let t=0;t<c.length;++t)l=c[t],u=HO(l,n),d=KO(u,s),o.copy(l.matrixWorld),d&&(d.updateMatrixWorld(),n.useTargetMatrix?a.copy(d.matrixWorld):(a.copy(e.matrixWorld).invert(),a.multiply(d.matrixWorld)),i.setFromMatrixScale(a),a.scale(i.set(1/i.x,1/i.y,1/i.z)),o.makeRotationFromQuaternion(r.setFromRotationMatrix(a)),e.isObject3D&&n.localOffsets&&n.localOffsets[l.name]&&o.multiply(n.localOffsets[l.name]),o.copyPosition(a)),u===n.hip&&(o.elements[12]*=n.scale*n.hipInfluence.x,o.elements[13]*=n.scale*n.hipInfluence.y,o.elements[14]*=n.scale*n.hipInfluence.z,n.hipPosition!==void 0&&(o.elements[12]+=n.hipPosition.x*n.scale,o.elements[13]+=n.hipPosition.y*n.scale,o.elements[14]+=n.hipPosition.z*n.scale)),l.parent?(l.matrix.copy(l.parent.matrixWorld).invert(),l.matrix.multiply(o)):l.matrix.copy(o),l.matrix.decompose(l.position,l.quaternion,l.scale),l.updateMatrixWorld();if(n.preserveBonePositions)for(let e=0;e<c.length;++e)l=c[e],u=HO(l,n)||l.name,u!==n.hip&&l.position.copy(f[e]);n.preserveBoneMatrix&&e.updateMatrixWorld(!0)}function WO(e,t,n,r={}){r.useFirstFramePosition=r.useFirstFramePosition!==void 0&&r.useFirstFramePosition,r.fps=r.fps===void 0?Math.max(...n.tracks.map(e=>e.times.length))/n.duration:r.fps,r.names=r.names||[],t.isObject3D||(t=JO(t));let i=Math.round(n.duration*(r.fps/1e3)*1e3),a=n.duration/(i-1),o=[],s=new Zd(t),c=qO(e.skeleton),l=[],u,d,f,p,m;s.clipAction(n).play();let h=0,g=i;r.trim===void 0?s.update(0):(h=Math.round(r.trim[0]*r.fps),g=Math.min(Math.round(r.trim[1]*r.fps),i)-h,s.update(r.trim[0])),t.updateMatrixWorld();for(let n=0;n<g;++n){let i=n*a;UO(e,t,r);for(let e=0;e<c.length;++e)d=c[e],m=HO(d,r)||d.name,f=KO(m,t.skeleton),f&&(p=l[e]=l[e]||{bone:d},r.hip===m&&(p.pos||(p.pos={times:new Float32Array(g),values:new Float32Array(g*3)}),r.useFirstFramePosition&&(n===0&&(u=d.position.clone()),d.position.sub(u)),p.pos.times[n]=i,d.position.toArray(p.pos.values,n*3)),p.quat||(p.quat={times:new Float32Array(g),values:new Float32Array(g*4)}),p.quat.times[n]=i,d.quaternion.toArray(p.quat.values,n*4));n===g-2?s.update(a-1e-7):s.update(a),t.updateMatrixWorld()}for(let e=0;e<l.length;++e)p=l[e],p&&(p.pos&&o.push(new du(`.bones[`+p.bone.name+`].position`,p.pos.times,p.pos.values)),o.push(new lu(`.bones[`+p.bone.name+`].quaternion`,p.quat.times,p.quat.values)));return s.uncacheAction(n),new fu(n.name,-1,o)}function GO(e){let t=/* @__PURE__ */ new Map,n=/* @__PURE__ */ new Map,r=e.clone();return YO(e,r,function(e,r){t.set(r,e),n.set(e,r)}),r.traverse(function(e){if(!e.isSkinnedMesh)return;let r=e,i=t.get(e),a=i.skeleton.bones;r.skeleton=i.skeleton.clone(),r.bindMatrix.copy(i.bindMatrix),r.skeleton.bones=a.map(function(e){return n.get(e)}),r.bind(r.skeleton,r.bindMatrix)}),r}function KO(e,t){for(let n=0,r=qO(t);n<r.length;n++)if(e===r[n].name)return r[n]}function qO(e){return Array.isArray(e)?e:e.bones}function JO(e){let t=new Ef(e.bones[0]);return t.skeleton=e,t}function YO(e,t,n){n(e,t);for(let r=0;r<e.children.length;r++)YO(e.children[r],t.children[r],n)}var XO=t((()=>{J()})),ZO=/* @__PURE__ */ n({GLTFLoader:()=>dk});function QO(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}function $O(e,t,n){let r=e.json.materials[t];return r.extensions&&r.extensions[n]?r.extensions[n]:null}function ek(e){return e.DefaultMaterial===void 0&&(e.DefaultMaterial=new Hl({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0})),e.DefaultMaterial}function tk(e,t,n){for(let r in n.extensions)e[r]===void 0&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=n.extensions[r])}function nk(e,t){t.extras!==void 0&&(typeof t.extras==`object`?Object.assign(e.userData,t.extras):console.warn(`THREE.GLTFLoader: Ignoring primitive type .extras, `+t.extras))}function rk(e,t,n){let r=!1,i=!1,a=!1;for(let e=0,n=t.length;e<n;e++){let n=t[e];if(n.POSITION!==void 0&&(r=!0),n.NORMAL!==void 0&&(i=!0),n.COLOR_0!==void 0&&(a=!0),r&&i&&a)break}if(!r&&!i&&!a)return Promise.resolve(e);let o=[],s=[],c=[];for(let l=0,u=t.length;l<u;l++){let u=t[l];if(r){let t=u.POSITION===void 0?e.attributes.position:n.getDependency(`accessor`,u.POSITION);o.push(t)}if(i){let t=u.NORMAL===void 0?e.attributes.normal:n.getDependency(`accessor`,u.NORMAL);s.push(t)}if(a){let t=u.COLOR_0===void 0?e.attributes.color:n.getDependency(`accessor`,u.COLOR_0);c.push(t)}}return Promise.all([Promise.all(o),Promise.all(s),Promise.all(c)]).then(function(t){let n=t[0],o=t[1],s=t[2];return r&&(e.morphAttributes.position=n),i&&(e.morphAttributes.normal=o),a&&(e.morphAttributes.color=s),e.morphTargetsRelative=!0,e})}function ik(e,t){if(e.updateMorphTargets(),t.weights!==void 0)for(let n=0,r=t.weights.length;n<r;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){let n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(let t=0,r=n.length;t<r;t++)e.morphTargetDictionary[n[t]]=t}else console.warn(`THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.`)}}function ak(e){let t,n=e.extensions&&e.extensions[fk.KHR_DRACO_MESH_COMPRESSION];if(t=n?`draco:`+n.bufferView+`:`+n.indices+`:`+ok(n.attributes):e.indices+`:`+ok(e.attributes)+`:`+e.mode,e.targets!==void 0)for(let n=0,r=e.targets.length;n<r;n++)t+=`:`+ok(e.targets[n]);return t}function ok(e){let t=``,n=Object.keys(e).sort();for(let r=0,i=n.length;r<i;r++)t+=n[r]+`:`+e[n[r]]+`;`;return t}function sk(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw Error(`THREE.GLTFLoader: Unsupported normalized accessor component type.`)}}function ck(e){return e.search(/\.jpe?g($|\?)/i)>0||e.search(/^data\:image\/jpeg/)===0?`image/jpeg`:e.search(/\.webp($|\?)/i)>0||e.search(/^data\:image\/webp/)===0?`image/webp`:e.search(/\.ktx2($|\?)/i)>0||e.search(/^data\:image\/ktx2/)===0?`image/ktx2`:`image/png`}function lk(e,t,n){let r=t.attributes,i=new Wa;if(r.POSITION!==void 0){let e=n.json.accessors[r.POSITION],t=e.min,a=e.max;if(t!==void 0&&a!==void 0){if(i.set(new B(t[0],t[1],t[2]),new B(a[0],a[1],a[2])),e.normalized){let t=sk(Uk[e.componentType]);i.min.multiplyScalar(t),i.max.multiplyScalar(t)}}else{console.warn(`THREE.GLTFLoader: Missing min/max properties for accessor POSITION.`);return}}else return;let a=t.targets;if(a!==void 0){let e=new B,t=new B;for(let r=0,i=a.length;r<i;r++){let i=a[r];if(i.POSITION!==void 0){let r=n.json.accessors[i.POSITION],a=r.min,o=r.max;if(a!==void 0&&o!==void 0){if(t.setX(Math.max(Math.abs(a[0]),Math.abs(o[0]))),t.setY(Math.max(Math.abs(a[1]),Math.abs(o[1]))),t.setZ(Math.max(Math.abs(a[2]),Math.abs(o[2]))),r.normalized){let e=sk(Uk[r.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn(`THREE.GLTFLoader: Missing min/max properties for accessor POSITION.`)}}i.expandByVector(e)}e.boundingBox=i;let o=new xo;i.getCenter(o.center),o.radius=i.min.distanceTo(i.max)/2,e.boundingSphere=o}function uk(e,t,n){let r=t.attributes,i=[];function a(t,r){return n.getDependency(`accessor`,t).then(function(t){e.setAttribute(r,t)})}for(let t in r){let n=qk[t]||t.toLowerCase();n in e.attributes||i.push(a(r[t],n))}if(t.indices!==void 0&&!e.index){let r=n.getDependency(`accessor`,t.indices).then(function(t){e.setIndex(t)});i.push(r)}return ji.workingColorSpace!==`srgb-linear`&&`COLOR_0`in r&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${ji.workingColorSpace}" not supported.`),nk(e,t),lk(e,t,n),Promise.all(i).then(function(){return t.targets===void 0?e:rk(e,t.targets,n)})}var dk,fk,pk,mk,hk,gk,_k,vk,yk,bk,xk,Sk,Ck,wk,Tk,Ek,Dk,Ok,kk,Ak,jk,Mk,Nk,Pk,Fk,Ik,Lk,Rk,zk,Bk,Vk,Hk,Uk,Wk,Gk,Kk,qk,Jk,Yk,Xk,Zk,Qk,$k=t((()=>{J(),Wv(),XO(),dk=class extends gu{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new gk(e)}),this.register(function(e){return new _k(e)}),this.register(function(e){return new vk(e)}),this.register(function(e){return new Dk(e)}),this.register(function(e){return new Ok(e)}),this.register(function(e){return new kk(e)}),this.register(function(e){return new bk(e)}),this.register(function(e){return new xk(e)}),this.register(function(e){return new Sk(e)}),this.register(function(e){return new Ck(e)}),this.register(function(e){return new hk(e)}),this.register(function(e){return new wk(e)}),this.register(function(e){return new yk(e)}),this.register(function(e){return new Ek(e)}),this.register(function(e){return new Tk(e)}),this.register(function(e){return new pk(e)}),this.register(function(e){return new Ak(e,fk.EXT_MESHOPT_COMPRESSION)}),this.register(function(e){return new Ak(e,fk.KHR_MESHOPT_COMPRESSION)}),this.register(function(e){return new jk(e)})}load(e,t,n,r){let i=this,a;if(this.resourcePath!==``)a=this.resourcePath;else if(this.path!==``){let t=ed.extractUrlBase(e);a=ed.resolveURL(t,this.path)}else a=ed.extractUrlBase(e);this.manager.itemStart(e);let o=function(t){r?r(t):console.error(t),i.manager.itemError(e),i.manager.itemEnd(e)},s=new yu(this.manager);s.setPriority(this.priority),s.setCache(this.cache),s.setPath(this.path),s.setResponseType(`arraybuffer`),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(n){try{i.parse(n,a,function(n){t(n),i.manager.itemEnd(e)},o)}catch(e){o(e)}},n,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,r){let i,a={},o={},s=new TextDecoder;if(typeof e==`string`)i=JSON.parse(e);else if(e instanceof ArrayBuffer){if(s.decode(new Uint8Array(e,0,4))===Mk){try{a[fk.KHR_BINARY_GLTF]=new Fk(e)}catch(e){r&&r(e);return}i=JSON.parse(a[fk.KHR_BINARY_GLTF].content)}else i=JSON.parse(s.decode(e))}else i=e;if(i.asset===void 0||i.asset.version[0]<2){r&&r(/* @__PURE__ */ Error(`THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.`));return}let c=new Qk(i,{path:t||this.resourcePath||``,crossOrigin:this.crossOrigin,priority:this.priority,cache:this.cache,withCredentials:this.withCredentials,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){let t=this.pluginCallbacks[e](c);t.name||console.error(`THREE.GLTFLoader: Invalid plugin found: missing name`),o[t.name]=t,a[t.name]=!0}if(i.extensionsUsed)for(let e=0;e<i.extensionsUsed.length;++e){let t=i.extensionsUsed[e],n=i.extensionsRequired||[];switch(t){case fk.KHR_MATERIALS_UNLIT:a[t]=new mk;break;case fk.KHR_DRACO_MESH_COMPRESSION:a[t]=new Ik(i,this.dracoLoader);break;case fk.KHR_TEXTURE_TRANSFORM:a[t]=new Lk;break;case fk.KHR_MESH_QUANTIZATION:a[t]=new Rk;break;default:n.indexOf(t)>=0&&o[t]===void 0&&console.warn(`THREE.GLTFLoader: Unknown extension "`+t+`".`)}}c.setExtensions(a),c.setPlugins(o),c.parse(n,r)}parseAsync(e,t){let n=this;return new Promise(function(r,i){n.parse(e,t,r,i)})}},fk={KHR_BINARY_GLTF:`KHR_binary_glTF`,KHR_DRACO_MESH_COMPRESSION:`KHR_draco_mesh_compression`,KHR_LIGHTS_PUNCTUAL:`KHR_lights_punctual`,KHR_MATERIALS_CLEARCOAT:`KHR_materials_clearcoat`,KHR_MATERIALS_DIFFUSE_ROUGHNESS:`KHR_materials_diffuse_roughness`,KHR_MATERIALS_DISPERSION:`KHR_materials_dispersion`,KHR_MATERIALS_IOR:`KHR_materials_ior`,KHR_MATERIALS_SHEEN:`KHR_materials_sheen`,KHR_MATERIALS_SPECULAR:`KHR_materials_specular`,KHR_MATERIALS_TRANSMISSION:`KHR_materials_transmission`,KHR_MATERIALS_IRIDESCENCE:`KHR_materials_iridescence`,KHR_MATERIALS_ANISOTROPY:`KHR_materials_anisotropy`,KHR_MATERIALS_UNLIT:`KHR_materials_unlit`,KHR_MATERIALS_VOLUME:`KHR_materials_volume`,KHR_TEXTURE_BASISU:`KHR_texture_basisu`,KHR_TEXTURE_TRANSFORM:`KHR_texture_transform`,KHR_MESH_QUANTIZATION:`KHR_mesh_quantization`,KHR_MATERIALS_EMISSIVE_STRENGTH:`KHR_materials_emissive_strength`,EXT_MATERIALS_BUMP:`EXT_materials_bump`,EXT_TEXTURE_WEBP:`EXT_texture_webp`,EXT_TEXTURE_AVIF:`EXT_texture_avif`,EXT_MESHOPT_COMPRESSION:`EXT_meshopt_compression`,KHR_MESHOPT_COMPRESSION:`KHR_meshopt_compression`,EXT_MESH_GPU_INSTANCING:`EXT_mesh_gpu_instancing`},pk=class{constructor(e){this.parser=e,this.name=fk.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,r=t.length;n<r;n++){let r=t[n];r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){let t=this.parser,n=`light:`+e,r=t.cache.get(n);if(r)return r;let i=t.json,a=((i.extensions&&i.extensions[this.name]||{}).lights||[])[e],o,s=new H(16777215);a.color!==void 0&&s.setRGB(a.color[0],a.color[1],a.color[2],Vr);let c=a.range===void 0?0:a.range;switch(a.type){case`directional`:o=new qu(s),o.target.position.set(0,0,-1),o.add(o.target);break;case`point`:o=new Wu(s),o.distance=c;break;case`spot`:o=new Hu(s),o.distance=c,a.spot=a.spot||{},a.spot.innerConeAngle=a.spot.innerConeAngle===void 0?0:a.spot.innerConeAngle,a.spot.outerConeAngle=a.spot.outerConeAngle===void 0?Math.PI/4:a.spot.outerConeAngle,o.angle=a.spot.outerConeAngle,o.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,o.target.position.set(0,0,-1),o.add(o.target);break;default:throw Error(`THREE.GLTFLoader: Unexpected light type: `+a.type)}return o.position.set(0,0,0),nk(o,a),a.intensity!==void 0&&(o.intensity=a.intensity),o.name=t.createUniqueName(a.name||`light_`+e),r=Promise.resolve(o),t.cache.add(n,r),r}getDependency(e,t){if(e===`light`)return this._loadLight(t)}createNodeAttachment(e){let t=this,n=this.parser,r=n.json.nodes[e],i=(r.extensions&&r.extensions[this.name]||{}).light;return i===void 0?null:this._loadLight(i).then(function(e){return n._getNodeRef(t.cache,i,e)})}},mk=class{constructor(){this.name=fk.KHR_MATERIALS_UNLIT}getMaterialType(){return ss}extendParams(e,t,n){let r=[];e.color=new H(1,1,1),e.opacity=1;let i=t.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){let t=i.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],Vr),e.opacity=t[3]}i.baseColorTexture!==void 0&&r.push(n.assignTexture(e,`map`,i.baseColorTexture,Br))}return Promise.all(r)}},hk=class{constructor(e){this.parser=e,this.name=fk.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let n=$O(this.parser,e,this.name);return n===null||n.emissiveStrength!==void 0&&(t.emissiveIntensity=n.emissiveStrength),Promise.resolve()}},gk=class{constructor(e){this.parser=e,this.name=fk.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){return $O(this.parser,e,this.name)===null?null:Ul}extendMaterialParams(e,t){let n=$O(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];if(n.clearcoatFactor!==void 0&&(t.clearcoat=n.clearcoatFactor),n.clearcoatTexture!==void 0&&r.push(this.parser.assignTexture(t,`clearcoatMap`,n.clearcoatTexture)),n.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=n.clearcoatRoughnessFactor),n.clearcoatRoughnessTexture!==void 0&&r.push(this.parser.assignTexture(t,`clearcoatRoughnessMap`,n.clearcoatRoughnessTexture)),n.clearcoatNormalTexture!==void 0&&(r.push(this.parser.assignTexture(t,`clearcoatNormalMap`,n.clearcoatNormalTexture)),n.clearcoatNormalTexture.scale!==void 0)){let e=n.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new z(e,e)}return Promise.all(r)}},_k=class{constructor(e){this.parser=e,this.name=fk.KHR_MATERIALS_DIFFUSE_ROUGHNESS}getMaterialType(e){return $O(this.parser,e,this.name)===null?null:Ul}extendMaterialParams(e,t){let n=$O(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return t.diffuseRoughness=n.diffuseRoughnessFactor===void 0?0:n.diffuseRoughnessFactor,n.diffuseRoughnessTexture!==void 0&&r.push(this.parser.assignTexture(t,`diffuseRoughnessMap`,n.diffuseRoughnessTexture)),Promise.all(r)}},vk=class{constructor(e){this.parser=e,this.name=fk.KHR_MATERIALS_DISPERSION}getMaterialType(e){return $O(this.parser,e,this.name)===null?null:Ul}extendMaterialParams(e,t){let n=$O(this.parser,e,this.name);return n===null||(t.dispersion=n.dispersion===void 0?0:n.dispersion),Promise.resolve()}},yk=class{constructor(e){this.parser=e,this.name=fk.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){return $O(this.parser,e,this.name)===null?null:Ul}extendMaterialParams(e,t){let n=$O(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return n.iridescenceFactor!==void 0&&(t.iridescence=n.iridescenceFactor),n.iridescenceTexture!==void 0&&r.push(this.parser.assignTexture(t,`iridescenceMap`,n.iridescenceTexture)),n.iridescenceIor!==void 0&&(t.iridescenceIOR=n.iridescenceIor),n.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessMinimum=n.iridescenceThicknessMinimum),n.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessMaximum=n.iridescenceThicknessMaximum),n.iridescenceThicknessTexture!==void 0&&r.push(this.parser.assignTexture(t,`iridescenceThicknessMap`,n.iridescenceThicknessTexture)),Promise.all(r)}},bk=class{constructor(e){this.parser=e,this.name=fk.KHR_MATERIALS_SHEEN}getMaterialType(e){return $O(this.parser,e,this.name)===null?null:Ul}extendMaterialParams(e,t){let n=$O(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];if(t.sheenColor=new H(0,0,0),t.sheenRoughness=0,t.sheen=1,n.sheenColorFactor!==void 0){let e=n.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],Vr)}return n.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=n.sheenRoughnessFactor),n.sheenColorTexture!==void 0&&r.push(this.parser.assignTexture(t,`sheenColorMap`,n.sheenColorTexture,Br)),n.sheenRoughnessTexture!==void 0&&r.push(this.parser.assignTexture(t,`sheenRoughnessMap`,n.sheenRoughnessTexture)),Promise.all(r)}},xk=class{constructor(e){this.parser=e,this.name=fk.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){return $O(this.parser,e,this.name)===null?null:Ul}extendMaterialParams(e,t){let n=$O(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return n.transmissionFactor!==void 0&&(t.transmission=n.transmissionFactor),n.transmissionTexture!==void 0&&r.push(this.parser.assignTexture(t,`transmissionMap`,n.transmissionTexture)),Promise.all(r)}},Sk=class{constructor(e){this.parser=e,this.name=fk.KHR_MATERIALS_VOLUME}getMaterialType(e){return $O(this.parser,e,this.name)===null?null:Ul}extendMaterialParams(e,t){let n=$O(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];t.thickness=n.thicknessFactor===void 0?0:n.thicknessFactor,n.thicknessTexture!==void 0&&r.push(this.parser.assignTexture(t,`thicknessMap`,n.thicknessTexture)),t.attenuationDistance=n.attenuationDistance||1/0;let i=n.attenuationColor||[1,1,1];return t.attenuationColor=new H().setRGB(i[0],i[1],i[2],Vr),Promise.all(r)}},Ck=class{constructor(e){this.parser=e,this.name=fk.KHR_MATERIALS_IOR}getMaterialType(e){return $O(this.parser,e,this.name)===null?null:Ul}extendMaterialParams(e,t){let n=$O(this.parser,e,this.name);return n===null||(t.ior=n.ior===void 0?1.5:n.ior,t.ior===0&&(t.ior=1e3)),Promise.resolve()}},wk=class{constructor(e){this.parser=e,this.name=fk.KHR_MATERIALS_SPECULAR}getMaterialType(e){return $O(this.parser,e,this.name)===null?null:Ul}extendMaterialParams(e,t){let n=$O(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];t.specularIntensity=n.specularFactor===void 0?1:n.specularFactor,n.specularTexture!==void 0&&r.push(this.parser.assignTexture(t,`specularIntensityMap`,n.specularTexture));let i=n.specularColorFactor||[1,1,1];return t.specularColor=new H().setRGB(i[0],i[1],i[2],Vr),n.specularColorTexture!==void 0&&r.push(this.parser.assignTexture(t,`specularColorMap`,n.specularColorTexture,Br)),Promise.all(r)}},Tk=class{constructor(e){this.parser=e,this.name=fk.EXT_MATERIALS_BUMP}getMaterialType(e){return $O(this.parser,e,this.name)===null?null:Ul}extendMaterialParams(e,t){let n=$O(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return t.bumpScale=n.bumpFactor===void 0?1:n.bumpFactor,n.bumpTexture!==void 0&&r.push(this.parser.assignTexture(t,`bumpMap`,n.bumpTexture)),Promise.all(r)}},Ek=class{constructor(e){this.parser=e,this.name=fk.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){return $O(this.parser,e,this.name)===null?null:Ul}extendMaterialParams(e,t){let n=$O(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return n.anisotropyStrength!==void 0&&(t.anisotropy=n.anisotropyStrength),n.anisotropyRotation!==void 0&&(t.anisotropyRotation=n.anisotropyRotation),n.anisotropyTexture!==void 0&&r.push(this.parser.assignTexture(t,`anisotropyMap`,n.anisotropyTexture)),Promise.all(r)}},Dk=class{constructor(e){this.parser=e,this.name=fk.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,n=t.json,r=n.textures[e];if(!r.extensions||!r.extensions[this.name])return null;let i=r.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw Error(`THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures`);return null}return t.loadTextureImage(e,i.source,a)}},Ok=class{constructor(e){this.parser=e,this.name=fk.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){let e=n.options.manager.getHandler(o.uri);e!==null&&(s=e)}return n.loadTextureImage(e,a.source,s)}},kk=class{constructor(e){this.parser=e,this.name=fk.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){let e=n.options.manager.getHandler(o.uri);e!==null&&(s=e)}return n.loadTextureImage(e,a.source,s)}},Ak=class{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){let e=n.extensions[this.name],r=this.parser.getDependency(`buffer`,e.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw Error(`THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files`);return null}return r.then(function(t){let n=e.byteOffset||0,r=e.byteLength||0,a=e.count,o=e.byteStride,s=new Uint8Array(t,n,r);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(a,o,s,e.mode,e.filter).then(function(e){return e.buffer}):i.ready.then(function(){let t=new ArrayBuffer(a*o);return i.decodeGltfBuffer(new Uint8Array(t),a,o,s,e.mode,e.filter),t})})}return null}},jk=class{constructor(e){this.name=fk.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;let r=t.meshes[n.mesh];for(let e of r.primitives)if(e.mode!==Hk.TRIANGLES&&e.mode!==Hk.TRIANGLE_STRIP&&e.mode!==Hk.TRIANGLE_FAN&&e.mode!==void 0)return null;let i=n.extensions[this.name].attributes,a=[],o={};for(let e in i)a.push(this.parser.getDependency(`accessor`,i[e]).then(t=>(o[e]=t,o[e])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(e=>{let t=e.pop(),n=t.isGroup?t.children:[t],r=e[0].count,i=[];for(let e of n){let t=new V,n=new B,a=new wi,s=new B(1,1,1),c=new Hs(e.geometry,e.material,r);for(let e=0;e<r;e++)o.TRANSLATION&&n.fromBufferAttribute(o.TRANSLATION,e),o.ROTATION&&a.fromBufferAttribute(o.ROTATION,e),o.SCALE&&s.fromBufferAttribute(o.SCALE,e),c.setMatrixAt(e,t.compose(n,a,s));let l=null;for(let e in o)if(e===`_COLOR_0`){let t=o[e];c.instanceColor=new Ps(t.array,t.itemSize,t.normalized)}else if(e!==`TRANSLATION`&&e!==`ROTATION`&&e!==`SCALE`){if(l===null){let e=c.geometry;l=new G,l.name=e.name;for(let t in e.attributes)l.setAttribute(t,e.attributes[t]);for(let t in e.morphAttributes)l.morphAttributes[t]=e.morphAttributes[t];e.index!==null&&l.setIndex(e.index),l.morphTargetsRelative=e.morphTargetsRelative;for(let t of e.groups)l.addGroup(t.start,t.count,t.materialIndex);e.boundingBox!==null&&(l.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(l.boundingSphere=e.boundingSphere.clone()),l.drawRange.start=e.drawRange.start,l.drawRange.count=e.drawRange.count,l.userData=Object.assign({},e.userData),c.geometry=l}let t=o[e];l.setAttribute(e,new Ps(t.array,t.itemSize,t.normalized))}ya.prototype.copy.call(c,e),this.parser.assignFinalMaterial(c),i.push(c)}return t.isGroup?(t.clear(),t.add(...i),t):i[0]}))}},Mk=`glTF`,Nk=12,Pk={JSON:1313821514,BIN:5130562},Fk=class{constructor(e){this.name=fk.KHR_BINARY_GLTF,this.content=null,this.body=null;let t=new DataView(e,0,Nk),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Mk)throw Error(`THREE.GLTFLoader: Unsupported glTF-Binary header.`);if(this.header.version<2)throw Error(`THREE.GLTFLoader: Legacy binary file detected.`);let r=this.header.length-Nk,i=new DataView(e,Nk),a=0;for(;a<r;){let t=i.getUint32(a,!0);a+=4;let r=i.getUint32(a,!0);if(a+=4,r===Pk.JSON){let r=new Uint8Array(e,Nk+a,t);this.content=n.decode(r)}else if(r===Pk.BIN){let n=Nk+a;this.body=e.slice(n,n+t)}a+=t}if(this.content===null)throw Error(`THREE.GLTFLoader: JSON content not found.`)}},Ik=class{constructor(e,t){if(!t)throw Error(`THREE.GLTFLoader: No DRACOLoader instance provided.`);this.name=fk.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let n=this.json,r=this.dracoLoader,i=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},s={},c={};for(let e in a){let t=qk[e]||e.toLowerCase();o[t]=a[e]}for(let t in e.attributes){let r=qk[t]||t.toLowerCase();if(a[t]!==void 0){let i=n.accessors[e.attributes[t]];c[r]=Uk[i.componentType].name,s[r]=i.normalized===!0}}return t.getDependency(`bufferView`,i).then(function(e){return new Promise(function(t,n){r.decodeDracoFile(e,function(e){for(let t in e.attributes){let n=e.attributes[t],r=s[t];r!==void 0&&(n.normalized=r)}t(e)},o,c,Vr,n)})})}},Lk=class{constructor(){this.name=fk.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){if((t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0)return e;if(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),t.rotation!==void 0){let t=Math.cos(e.rotation),n=Math.sin(e.rotation);e.matrix.set(e.repeat.x*t,e.repeat.y*n,e.offset.x,-e.repeat.x*n,e.repeat.y*t,e.offset.y,0,0,1),e.matrixAutoUpdate=!1}return e.needsUpdate=!0,e}},Rk=class{constructor(){this.name=fk.KHR_MESH_QUANTIZATION}},zk=class extends $l{constructor(e,t,n,r){super(e,t,n,r)}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r*3+r;for(let e=0;e!==r;e++)t[e]=n[i+e];return t}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=o*2,c=o*3,l=r-t,u=(n-t)/l,d=u*u,f=d*u,p=e*c,m=p-c,h=-2*f+3*d,g=f-d,_=1-h,v=g-d+u;for(let e=0;e!==o;e++){let t=a[m+e+o],n=a[m+e+s]*l,r=a[p+e+o],c=a[p+e]*l;i[e]=_*t+v*n+h*r+g*c}return i}},Bk=new wi,Vk=class extends zk{interpolate_(e,t,n,r){let i=super.interpolate_(e,t,n,r);return Bk.fromArray(i).normalize().toArray(i),i}},Hk={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Uk={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Wk={9728:cn,9729:pn,9984:ln,9985:mn,9986:dn,9987:gn},Gk={33071:on,33648:sn,10497:an},Kk={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},qk={POSITION:`position`,NORMAL:`normal`,TANGENT:`tangent`,TEXCOORD_0:`uv`,TEXCOORD_1:`uv1`,TEXCOORD_2:`uv2`,TEXCOORD_3:`uv3`,COLOR_0:`color`,WEIGHTS_0:`skinWeight`,JOINTS_0:`skinIndex`},Jk={scale:`scale`,translation:`position`,rotation:`quaternion`,weights:`morphTargetInfluences`},Yk={CUBICSPLINE:void 0,LINEAR:Or,STEP:Dr},Xk={OPAQUE:`OPAQUE`,MASK:`MASK`,BLEND:`BLEND`},Zk=new V,Qk=class{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new QO,this.associations=/* @__PURE__ */ new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,r=-1,i=!1,a=-1;if(typeof navigator<`u`&&navigator.userAgent!==void 0){let e=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(e)===!0;let t=e.match(/Version\/(\d+)/);r=n&&t?parseInt(t[1],10):-1,i=e.indexOf(`Firefox`)>-1,a=i?e.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>`u`||n&&r<17||i&&a<98?(this.textureLoader=new Eu(this.options.manager),this.textureLoader.setPriority(this.options.priority),this.textureLoader.setCache(this.options.cache)):(this.textureLoader=new ld(this.options.manager),this.textureLoader.setPriority(this.options.priority),this.textureLoader.setCache(this.options.cache)),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setWithCredentials(this.options.withCredentials),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new yu(this.options.manager),this.fileLoader.setPriority(this.options.priority),this.fileLoader.setCache(this.options.cache),this.fileLoader.setResponseType(`arraybuffer`),(this.options.withCredentials||this.options.crossOrigin===`use-credentials`)&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([n.getDependencies(`scene`),n.getDependencies(`animation`),n.getDependencies(`camera`)])}).then(function(t){let a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};return tk(i,a,r),nk(a,r),Promise.all(n._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){for(let e of a.scenes)e.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,r=t.length;n<r;n++){let r=t[n].joints;for(let t=0,n=r.length;t<n;t++)e[r[t]].isBone=!0}for(let t=0,r=e.length;t<r;t++){let r=e[t];r.mesh!==void 0&&(this._addNodeRef(this.meshCache,r.mesh),r.skin!==void 0&&(n[r.mesh].isSkinnedMesh=!0)),r.camera!==void 0&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;let r=n.clone(),i=(e,t)=>{let n=this.associations.get(e);n!=null&&this.associations.set(t,n);for(let[n,r]of e.children.entries())i(r,t.children[n])};return i(n,r),r.name+=`_instance_`+e.uses[t]++,r}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){let r=e(t[n]);if(r)return r}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let n=[];for(let r=0;r<t.length;r++){let i=e(t[r]);i&&n.push(i)}return n}getDependency(e,t){let n=e+`:`+t,r=this.cache.get(n);if(!r){switch(e){case`scene`:r=this.loadScene(t);break;case`node`:r=this._invokeOne(function(e){return e.loadNode&&e.loadNode(t)});break;case`mesh`:r=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case`accessor`:r=this.loadAccessor(t);break;case`bufferView`:r=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case`buffer`:r=this.loadBuffer(t);break;case`material`:r=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case`texture`:r=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case`skin`:r=this.loadSkin(t);break;case`animation`:r=this._invokeOne(function(e){return e.loadAnimation&&e.loadAnimation(t)});break;case`camera`:r=this.loadCamera(t);break;default:if(r=this._invokeOne(function(n){return n!=this&&n.getDependency&&n.getDependency(e,t)}),!r)throw Error(`Unknown type: `+e)}this.cache.add(n,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){let n=this,r=this.json[e+(e===`mesh`?`es`:`s`)]||[];t=Promise.all(r.map(function(t,r){return n.getDependency(e,r)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!==`arraybuffer`)throw Error(`THREE.GLTFLoader: `+t.type+` buffer type is not supported.`);if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[fk.KHR_BINARY_GLTF].body);let r=this.options;return new Promise(function(e,i){n.load(ed.resolveURL(t.uri,r.path),e,void 0,function(){i(/* @__PURE__ */ Error(`THREE.GLTFLoader: Failed to load buffer "`+t.uri+`".`))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency(`buffer`,t.buffer).then(function(e){let n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)})}loadAccessor(e){let t=this,n=this.json,r=this.json.accessors[e];if(r.bufferView===void 0&&r.sparse===void 0){let e=Kk[r.type],t=Uk[r.componentType],n=r.normalized===!0,i=new t(r.count*e);return Promise.resolve(new co(i,e,n))}let i=[];return r.bufferView===void 0?i.push(null):i.push(this.getDependency(`bufferView`,r.bufferView)),r.sparse!==void 0&&(i.push(this.getDependency(`bufferView`,r.sparse.indices.bufferView)),i.push(this.getDependency(`bufferView`,r.sparse.values.bufferView))),Promise.all(i).then(function(e){let i=e[0],a=Kk[r.type],o=Uk[r.componentType],s=o.BYTES_PER_ELEMENT,c=s*a,l=r.byteOffset||0,u=r.bufferView===void 0?void 0:n.bufferViews[r.bufferView].byteStride,d=r.normalized===!0,f,p;if(u&&u!==c){let e=Math.floor(l/u),n=`InterleavedBuffer:`+r.bufferView+`:`+r.componentType+`:`+e+`:`+r.count,c=t.cache.get(n);c||(f=new o(i,e*u,r.count*u/s),c=new ko(f,u/s),t.cache.add(n,c)),p=new jo(c,a,l%u/s,d)}else f=i===null?new o(r.count*a):new o(i,l,r.count*a),p=new co(f,a,d);if(r.sparse!==void 0){let t=Kk.SCALAR,n=Uk[r.sparse.indices.componentType],s=r.sparse.indices.byteOffset||0,c=r.sparse.values.byteOffset||0,l=new n(e[1],s,r.sparse.count*t),u=new o(e[2],c,r.sparse.count*a);i!==null&&(p=new co(p.array.slice(),p.itemSize,p.normalized)),p.normalized=!1;for(let e=0,t=l.length;e<t;e++){let t=l[e];if(p.setX(t,u[e*a]),a>=2&&p.setY(t,u[e*a+1]),a>=3&&p.setZ(t,u[e*a+2]),a>=4&&p.setW(t,u[e*a+3]),a>=5)throw Error(`THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.`)}p.normalized=d}return p})}loadTexture(e){let t=this.json,n=this.options,r=t.textures[e].source,i=t.images[r],a=this.textureLoader;if(i.uri){let e=n.manager.getHandler(i.uri);e!==null&&(a=e)}return this.loadTextureImage(e,r,a)}loadTextureImage(e,t,n){let r=this,i=this.json,a=i.textures[e],o=i.images[t],s=(o.uri||o.bufferView)+`:`+a.sampler;if(this.textureCache[s])return this.textureCache[s];let c=this.loadImageSource(t,n).then(function(t){t.flipY=!1,t.name=a.name||o.name||``,t.name===``&&typeof o.uri==`string`&&o.uri.startsWith(`data:image/`)===!1&&(t.name=o.uri);let n=(i.samplers||{})[a.sampler]||{};return t.magFilter=Wk[n.magFilter]||1006,t.minFilter=Wk[n.minFilter]||1008,t.wrapS=Gk[n.wrapS]||1e3,t.wrapT=Gk[n.wrapT]||1e3,t.generateMipmaps=!t.isCompressedTexture&&t.minFilter!==1003&&t.minFilter!==1006,r.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[s]=c,c}loadImageSource(e,t){let n=this,r=this.json,i=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(e=>e.clone());let a=r.images[e],o=self.URL||self.webkitURL,s=a.uri||``,c=!1,l;if(t.isKTX2Loader===!0&&a.bufferView!==void 0)l=n.getDependency(`bufferView`,a.bufferView).then(function(e){return new Promise(function(n,r){t.parse(e,n,r)})});else{if(a.bufferView!==void 0)s=n.getDependency(`bufferView`,a.bufferView).then(function(e){c=!0;let t=new Blob([e],{type:a.mimeType});return s=o.createObjectURL(t),s});else if(a.uri===void 0)throw Error(`THREE.GLTFLoader: Image `+e+` is missing URI and bufferView`);l=Promise.resolve(s).then(function(e){return new Promise(function(n,r){let a=n;t.isImageBitmapLoader===!0&&(a=function(e){let t=new zi(e);t.needsUpdate=!0,n(t)}),t.load(ed.resolveURL(e,i.path),a,void 0,r)})})}let u=l.then(function(e){return c===!0&&o.revokeObjectURL(s),nk(e,a),e.userData.mimeType=a.mimeType||ck(a.uri),e}).catch(function(e){throw console.error(`THREE.GLTFLoader: Couldn't load texture`,s),e});return this.sourceCache[e]=u,u}assignTexture(e,t,n,r){let i=this;return this.getDependency(`texture`,n.index).then(function(a){if(!a)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(a=a.clone(),a.channel=n.texCoord),i.extensions[fk.KHR_TEXTURE_TRANSFORM]){let e=n.extensions===void 0?void 0:n.extensions[fk.KHR_TEXTURE_TRANSFORM];if(e){let t=i.associations.get(a);a=i.extensions[fk.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),i.associations.set(a,t)}}return r!==void 0&&(a.colorSpace=r),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,n=e.material,r=t.attributes.tangent===void 0,i=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){let e=`PointsMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new Cc,Lo.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){let e=`LineBasicMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new uc,Lo.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(r||i||a){let e=`ClonedMaterial:`+n.uuid+`:`;r&&(e+=`derivative-tangents:`),i&&(e+=`vertex-colors:`),a&&(e+=`flat-shading:`);let t=this.cache.get(e);t||(t=n.clone(),i&&(t.vertexColors=!0),a&&(t.flatShading=!0),r&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return Hl}loadMaterial(e){let t=this,n=this.json,r=this.extensions,i=n.materials[e],a,o={},s=i.extensions||{},c=[];if(s[fk.KHR_MATERIALS_UNLIT]){let e=r[fk.KHR_MATERIALS_UNLIT];a=e.getMaterialType(),c.push(e.extendParams(o,i,t))}else{let n=i.pbrMetallicRoughness||{};if(o.color=new H(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){let e=n.baseColorFactor;o.color.setRGB(e[0],e[1],e[2],Vr),o.opacity=e[3]}n.baseColorTexture!==void 0&&c.push(t.assignTexture(o,`map`,n.baseColorTexture,Br)),o.metalness=n.metallicFactor===void 0?1:n.metallicFactor,o.roughness=n.roughnessFactor===void 0?1:n.roughnessFactor,n.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(o,`metalnessMap`,n.metallicRoughnessTexture)),c.push(t.assignTexture(o,`roughnessMap`,n.metallicRoughnessTexture))),a=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)})))}i.doubleSided===!0&&(o.side=2);let l=i.alphaMode||Xk.OPAQUE;if(l===Xk.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,l===Xk.MASK&&(o.alphaTest=i.alphaCutoff===void 0?.5:i.alphaCutoff)),i.normalTexture!==void 0&&a!==ss&&(c.push(t.assignTexture(o,`normalMap`,i.normalTexture)),o.normalScale=new z(1,1),i.normalTexture.scale!==void 0)){let e=i.normalTexture.scale;o.normalScale.set(e,e)}if(i.occlusionTexture!==void 0&&a!==ss&&(c.push(t.assignTexture(o,`aoMap`,i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&a!==ss){let e=i.emissiveFactor;o.emissive=new H().setRGB(e[0],e[1],e[2],Vr)}return i.emissiveTexture!==void 0&&a!==ss&&c.push(t.assignTexture(o,`emissiveMap`,i.emissiveTexture,Br)),Promise.all(c).then(function(){let n=new a(o);return i.name&&(n.name=i.name),nk(n,i),t.associations.set(n,{materials:e}),i.extensions&&tk(r,n,i),n})}createUniqueName(e){let t=qd.sanitizeNodeName(e||``);return t in this.nodeNamesUsed?t+`_`+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,n=this.extensions,r=this.primitiveCache;function i(e){return n[fk.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(n){return uk(n,e,t)})}let a=[];for(let n=0,o=e.length;n<o;n++){let o=e[n],s=ak(o),c=r[s];if(c)a.push(c.promise);else{let e;e=o.extensions&&o.extensions[fk.KHR_DRACO_MESH_COMPRESSION]?i(o):uk(new G,o,t),o.mode===Hk.TRIANGLE_STRIP?e=e.then(e=>zv(e,1)):o.mode===Hk.TRIANGLE_FAN&&(e=e.then(e=>zv(e,2))),r[s]={primitive:o,promise:e},a.push(e)}}return Promise.all(a)}loadMesh(e){let t=this,n=this.json,r=this.extensions,i=n.meshes[e],a=i.primitives,o=[];for(let e=0,t=a.length;e<t;e++){let t=a[e].material===void 0?ek(this.cache):this.getDependency(`material`,a[e].material);o.push(t)}return o.push(t.loadGeometries(a)),Promise.all(o).then(async function(n){let o=n.slice(0,n.length-1),s=n[n.length-1],c=[];for(let n=0,l=s.length;n<l;n++){let l=s[n],u=a[n],d,f=o[n];if(u.mode===Hk.TRIANGLES||u.mode===Hk.TRIANGLE_STRIP||u.mode===Hk.TRIANGLE_FAN||u.mode===void 0){let e=i.isSkinnedMesh===!0,t=l.hasAttribute(`skinIndex`)&&l.hasAttribute(`skinWeight`);e&&t===!1&&console.warn(`THREE.GLTFLoader: Missing skinIndex or skinWeight attributes. Skinning disabled.`),d=e&&t?new Os(l,f):new K(l,f),d.isSkinnedMesh===!0&&d.normalizeSkinWeights()}else if(u.mode===Hk.LINES)d=new xc(l,f);else if(u.mode===Hk.LINE_STRIP)d=new vc(l,f);else if(u.mode===Hk.LINE_LOOP)d=new Sc(l,f);else if(u.mode===Hk.POINTS)d=new Oc(l,f);else throw Error(`THREE.GLTFLoader: Primitive mode unsupported: `+u.mode);Object.keys(d.geometry.morphAttributes).length>0&&ik(d,i),d.name=t.createUniqueName(i.name||`mesh_`+e),nk(d,i),u.extensions&&tk(r,d,u),t.assignFinalMaterial(d),c.push(d)}for(let n=0,r=c.length;n<r;n++)t.associations.set(c[n],{meshes:e,primitives:n});if(c.length===1)return i.extensions&&tk(r,c[0],i),c[0];let l=new ba;i.extensions&&tk(r,l,i),t.associations.set(l,{meshes:e});for(let e=0,t=c.length;e<t;e++)l.add(c[e]);return l})}loadCamera(e){let t,n=this.json.cameras[e],r=n[n.type];if(!r)console.warn(`THREE.GLTFLoader: Missing camera parameters.`);else return n.type===`perspective`?t=new Bu(Ci.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):n.type===`orthographic`&&(t=new Gu(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),nk(t,n),Promise.resolve(t)}loadSkin(e){let t=this.json.skins[e],n=[];for(let e=0,r=t.joints.length;e<r;e++)n.push(this._loadNodeShallow(t.joints[e]));return t.inverseBindMatrices===void 0?n.push(null):n.push(this.getDependency(`accessor`,t.inverseBindMatrices)),Promise.all(n).then(function(e){let n=e.pop(),r=e,i=[],a=[];for(let e=0,o=r.length;e<o;e++){let o=r[e];if(o){i.push(o);let t=new V;n!==null&&t.fromArray(n.array,e*16),a.push(t)}else console.warn(`THREE.GLTFLoader: Joint "%s" could not be found.`,t.joints[e])}return new Ns(i,a)})}loadAnimation(e){let t=this.json,n=this,r=t.animations[e],i=r.name?r.name:`animation_`+e,a=[],o=[],s=[],c=[],l=[];for(let e=0,t=r.channels.length;e<t;e++){let t=r.channels[e],n=r.samplers[t.sampler],i=t.target,u=i.node,d=r.parameters===void 0?n.input:r.parameters[n.input],f=r.parameters===void 0?n.output:r.parameters[n.output];i.node!==void 0&&(a.push(this.getDependency(`node`,u)),o.push(this.getDependency(`accessor`,d)),s.push(this.getDependency(`accessor`,f)),c.push(n),l.push(i))}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(s),Promise.all(c),Promise.all(l)]).then(function(e){let t=e[0],a=e[1],o=e[2],s=e[3],c=e[4],l=[];for(let e=0,r=t.length;e<r;e++){let r=t[e],i=a[e],u=o[e],d=s[e],f=c[e];if(r===void 0)continue;r.updateMatrix&&r.updateMatrix();let p=n._createAnimationTracks(r,i,u,d,f);if(p)for(let e=0;e<p.length;e++)l.push(p[e])}let u=new fu(i,void 0,l);return nk(u,r),u})}createNodeMesh(e){let t=this.json,n=this,r=t.nodes[e];return r.mesh===void 0?null:n.getDependency(`mesh`,r.mesh).then(function(e){let t=n._getNodeRef(n.meshCache,r.mesh,e);return r.weights!==void 0&&t.traverse(function(e){if(e.isMesh)for(let t=0,n=r.weights.length;t<n;t++)e.morphTargetInfluences[t]=r.weights[t]}),t})}loadNode(e){let t=this.json,n=this,r=t.nodes[e],i=n._loadNodeShallow(e),a=[],o=r.children||[];for(let e=0,t=o.length;e<t;e++)a.push(n.getDependency(`node`,o[e]));let s=r.skin===void 0?Promise.resolve(null):n.getDependency(`skin`,r.skin);return Promise.all([i,Promise.all(a),s]).then(function(e){let t=e[0],n=e[1],r=e[2];r!==null&&t.traverse(function(e){e.isSkinnedMesh&&e.bind(r,Zk)});for(let e=0,r=n.length;e<r;e++)t.add(n[e]);if(t.userData.pivot!==void 0&&n.length>0){let e=t.userData.pivot,r=n[0];t.pivot=new B().fromArray(e),t.position.x-=e[0],t.position.y-=e[1],t.position.z-=e[2],r.position.set(0,0,0),delete t.userData.pivot}return t})}_loadNodeShallow(e){let t=this.json,n=this.extensions,r=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];let i=t.nodes[e],a=i.name?r.createUniqueName(i.name):``,o=[],s=r._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return s&&o.push(s),i.camera!==void 0&&o.push(r.getDependency(`camera`,i.camera).then(function(e){return r._getNodeRef(r.cameraCache,i.camera,e)})),r._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){o.push(e)}),this.nodeCache[e]=Promise.all(o).then(function(t){let o;if(o=i.isBone===!0?new ks:t.length>1?new ba:t.length===1?t[0]:new ya,o!==t[0])for(let e=0,n=t.length;e<n;e++)o.add(t[e]);if(i.name&&(o.userData.name=i.name,o.name=a),nk(o,i),i.extensions&&tk(n,o,i),i.matrix!==void 0){let e=new V;e.fromArray(i.matrix),o.applyMatrix4(e)}else i.translation!==void 0&&o.position.fromArray(i.translation),i.rotation!==void 0&&o.quaternion.fromArray(i.rotation),i.scale!==void 0&&o.scale.fromArray(i.scale);if(!r.associations.has(o))r.associations.set(o,{});else if(i.mesh!==void 0&&r.meshCache.refs[i.mesh]>1){let e=r.associations.get(o);r.associations.set(o,{...e})}return r.associations.get(o).nodes=e,o}),this.nodeCache[e]}loadScene(e){let t=this.extensions,n=this.json.scenes[e],r=this,i=new ba;n.name&&(i.name=r.createUniqueName(n.name)),nk(i,n),n.extensions&&tk(t,i,n);let a=n.nodes||[],o=[];for(let e=0,t=a.length;e<t;e++)o.push(r.getDependency(`node`,a[e]));return Promise.all(o).then(function(e){for(let t=0,n=e.length;t<n;t++){let n=e[t];n.parent===null?i.add(n):i.add(GO(n))}return r.associations=(e=>{let t=/* @__PURE__ */ new Map;for(let[e,n]of r.associations)(e instanceof Lo||e instanceof zi)&&t.set(e,n);return e.traverse(e=>{let n=r.associations.get(e);n!=null&&t.set(e,n)}),t})(i),i})}_createAnimationTracks(e,t,n,r,i){let a=[],o=e.name?e.name:e.uuid,s=[];function c(e){e.morphTargetInfluences&&s.push(e.name?e.name:e.uuid)}Jk[i.path]===Jk.weights?(c(e),e.isGroup&&e.children.forEach(c)):s.push(o);let l;switch(Jk[i.path]){case Jk.weights:l=su;break;case Jk.rotation:l=lu;break;case Jk.translation:case Jk.scale:l=du;break;default:switch(n.itemSize){case 1:l=su;break;default:l=du}}let u=r.interpolation===void 0?Or:Yk[r.interpolation],d=this._getArrayFromAccessor(n);for(let e=0,n=s.length;e<n;e++){let n=new l(s[e]+`.`+Jk[i.path],t.array,d,u);r.interpolation===`CUBICSPLINE`&&this._createCubicSplineTrackInterpolant(n),a.push(n)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let e=sk(t.constructor),n=new Float32Array(t.length);for(let r=0,i=t.length;r<i;r++)n[r]=t[r]*e;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof lu?Vk:zk)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}})),eA=/* @__PURE__ */ n({MeshoptDecoder:()=>tA}),tA,nA=t((()=>{tA=(function(){var e=`b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuixkbeeeddddillviebeoweuecj:Gdkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WboY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbrl79IV9Rbwq:VZkdbk:XYi5ud9:du8Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaicefhxcj;abad9Uc;WFbGcjdadca0EhmaialfgPar9Rgoadfhsavaoadz:jjjjbgzceVhHcbhOdndninaeaO9nmeaPax9RaD6mdamaeaO9RaOamfgoae6EgAcsfglc9WGhCabaOad2fhXaAcethQaxaDfhiaOaeaoaeao6E9RhLalcl4cifcd4hKazcj;cbfaAfhYcbh8AazcjdfhEaHh3incbh5dnawTmbaxa8Acd4fRbbh5kcbh8Eazcj;cbfhqinaih8Fdndndndna5a8Ecet4ciGgoc9:fPdebdkaPa8F9RaA6mrazcj;cbfa8EaA2fa8FaAz:jjjjb8Aa8FaAfhixdkazcj;cbfa8EaA2fcbaAz:kjjjb8Aa8FhixekaPa8F9RaK6mva8FaKfhidnaCTmbaPai9RcK6mbaocdtc:q:G:cjbfcj:G:cjbawEhaczhrcbhlinargoc9Wfghaqfhrdndndndndndnaaa8Fahco4fRbbalcoG4ciGcdtfydbPDbedvivvvlvkar9cb83bwar9cb83bbxlkarcbaiRbdai8Xbb9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbaqaofgrcGfcbaicdfa8J9c8N1:NfghRbbag9cjjjjjw:dg8J9qE86bbarcVfcbaha8J9c8M1:NfghRbbag9cjjjjjl:dg8J9qE86bbarc7fcbaha8J9c8L1:NfghRbbag9cjjjjjd:dg8J9qE86bbarctfcbaha8J9c8K1:NfghRbbag9cjjjjje:dg8J9qE86bbarc91fcbaha8J9c8J1:NfghRbbag9cjjjj;ab:dg8J9qE86bbarc4fcbaha8J9cg1:NfghRbbag9cjjjja:dg8J9qE86bbarc93fcbaha8J9ch1:NfghRbbag9cjjjjz:dgg9qE86bbarc94fcbahag9ca1:NfghRbbai8Xbe9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbarc95fcbaha8J9c8N1:NfgiRbbag9cjjjjjw:dg8J9qE86bbarc96fcbaia8J9c8M1:NfgiRbbag9cjjjjjl:dg8J9qE86bbarc97fcbaia8J9c8L1:NfgiRbbag9cjjjjjd:dg8J9qE86bbarc98fcbaia8J9c8K1:NfgiRbbag9cjjjjje:dg8J9qE86bbarc99fcbaia8J9c8J1:NfgiRbbag9cjjjj;ab:dg8J9qE86bbarc9:fcbaia8J9cg1:NfgiRbbag9cjjjja:dg8J9qE86bbarcufcbaia8J9ch1:NfgiRbbag9cjjjjz:dgg9qE86bbaiag9ca1:NfhixikaraiRblaiRbbghco4g8Ka8KciSg8KE86bbaqaofgrcGfaiclfa8Kfg8KRbbahcl4ciGg8La8LciSg8LE86bbarcVfa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc7fa8Ka8Lfg8KRbbahciGghahciSghE86bbarctfa8Kahfg8KRbbaiRbeghco4g8La8LciSg8LE86bbarc91fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc4fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc93fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc94fa8Kahfg8KRbbaiRbdghco4g8La8LciSg8LE86bbarc95fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc96fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc97fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc98fa8KahfghRbbaiRbigico4g8Ka8KciSg8KE86bbarc99faha8KfghRbbaicl4ciGg8Ka8KciSg8KE86bbarc9:faha8KfghRbbaicd4ciGg8Ka8KciSg8KE86bbarcufaha8KfgrRbbaiciGgiaiciSgiE86bbaraifhixdkaraiRbwaiRbbghcl4g8Ka8KcsSg8KE86bbaqaofgrcGfaicwfa8Kfg8KRbbahcsGghahcsSghE86bbarcVfa8KahfghRbbaiRbeg8Kcl4g8La8LcsSg8LE86bbarc7faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarctfaha8KfghRbbaiRbdg8Kcl4g8La8LcsSg8LE86bbarc91faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc4faha8KfghRbbaiRbig8Kcl4g8La8LcsSg8LE86bbarc93faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc94faha8KfghRbbaiRblg8Kcl4g8La8LcsSg8LE86bbarc95faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc96faha8KfghRbbaiRbvg8Kcl4g8La8LcsSg8LE86bbarc97faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc98faha8KfghRbbaiRbog8Kcl4g8La8LcsSg8LE86bbarc99faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc9:faha8KfghRbbaiRbrgicl4g8Ka8KcsSg8KE86bbarcufaha8KfgrRbbaicsGgiaicsSgiE86bbaraifhixekarai8Pbw83bwarai8Pbb83bbaiczfhikdnaoaC9pmbalcdfhlaoczfhraPai9RcL0mekkaoaC6moaimexokaCmva8FTmvkaqaAfhqa8Ecefg8Ecl9hmbkdndndndnawTmbasa8Acd4fRbbgociGPlbedrbkaATmdaza8Afh8Fazcj;cbfhhcbh8EaEhaina8FRbbhraahocbhlinaoahalfRbbgqce4cbaqceG9R7arfgr86bbaoadfhoaAalcefgl9hmbkaacefhaa8Fcefh8FahaAfhha8Ecefg8Ecl9hmbxikkaATmeaza8Afhaazcj;cbfhhcbhoceh8EaYh8FinaEaofhlaa8Vbbhrcbhoinala8FaofRbbcwtahaofRbbgqVc;:FiGce4cbaqceG9R7arfgr87bbaladfhlaLaocefgofmbka8FaQfh8FcdhoaacdfhaahaQfhha8EceGhlcbh8EalmbxdkkaATmbaocl4h8Eaza8AfRbbhqcwhoa3hlinalRbbaotaqVhqalcefhlaocwfgoca9hmbkcbhhaEh8FaYhainazcj;cbfahfRbbhrcwhoaahlinalRbbaotarVhralaAfhlaocwfgoca9hmbkara8E94aq7hqcbhoa8Fhlinalaqao486bbalcefhlaocwfgoca9hmbka8Fadfh8FaacefhaahcefghaA9hmbkkaEclfhEa3clfh3a8Aclfg8Aad6mbkaXazcjdfaAad2z:jjjjb8AazazcjdfaAcufad2fadz:jjjjb8AaAaOfhOaihxaimbkc9:hoxdkcbc99aPax9RakSEhoxekc9:hokavcj;kbf8Kjjjjbaok:ysezu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnalaeci9UgrcHf6mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:kjjjb8Aav9cu83iUav9cu83i8Wav9cu83iyav9cu83iaav9cu83iKav9cu83izav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhldnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhoindnalaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfaoaDcu7gPcl4fcsGcitfgsydlhzasydbhHdndnaDcsGgsak9pmbavaiaPfcsGcdtfydbaxasEhDaxasTgOfhxxekdndnascsSmbcehOasc987asamffcefhDxekalcefhDal8SbbgscFeGhPdndnascu9mmbaDhlxekalcvfhlaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhlkcehOaPce4cbaPceG9R7amfhDkaDhmkavc;abfaocitfgsaDBdbasazBdlavaicdtfaDBdbavc;abfaocefcsGcitfgsaHBdbasaDBdlaocdfhoaOaifhidnadcd9hmbabarcetfgsaH87ebasclfaD87ebascdfaz87ebxdkabarcdtfgsaHBdbascwfaDBdbasclfazBdbxekdnaDcpe0mbavaiaqaDcsGfRbbgscl4gP9RcsGcdtfydbaxcefgOaPEhDavaias9RcsGcdtfydbaOaPTgzfgOascsGgPEhsaPThPdndnadcd9hmbabarcetfgHax87ebaHclfas87ebaHcdfaD87ebxekabarcdtfgHaxBdbaHcwfasBdbaHclfaDBdbkavaicdtfaxBdbavc;abfaocitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfaocefcsGcitfgHasBdbaHaDBdlavaiazfgicsGcdtfasBdbavc;abfaocdfcsGcitfgDaxBdbaDasBdlaocifhoaiaPfhiaOaPfhxxekaxcbalRbbgsEgHaDc;:eSgDfhOascsGhAdndnascl4gCmbaOcefhzxekaOhzavaiaC9RcsGcdtfydbhOkdndnaAmbazcefhxxekazhxavaias9RcsGcdtfydbhzkdndnaDTmbalcefhDxekalcdfhDal8SbegPcFeGhsdnaPcu9kmbalcofhHascFbGhscrhldninaD8SbbgPcFbGaltasVhsaPcu9kmeaDcefhDalcrfglc8J9hmbkaHhDxekaDcefhDkasce4cbasceG9R7amfgmhHkdndnaCcsSmbaDhsxekaDcefhsaD8SbbglcFeGhPdnalcu9kmbaDcvfhOaPcFbGhPcrhldninas8SbbgDcFbGaltaPVhPaDcu9kmeascefhsalcrfglc8J9hmbkaOhsxekascefhskaPce4cbaPceG9R7amfgmhOkdndnaAcsSmbashlxekascefhlas8SbbgDcFeGhPdnaDcu9kmbascvfhzaPcFbGhPcrhDdninal8SbbgscFbGaDtaPVhPascu9kmealcefhlaDcrfgDc8J9hmbkazhlxekalcefhlkaPce4cbaPceG9R7amfgmhzkdndnadcd9hmbabarcetfgDaH87ebaDclfaz87ebaDcdfaO87ebxekabarcdtfgDaHBdbaDcwfazBdbaDclfaOBdbkavc;abfaocitfgDaOBdbaDaHBdlavaicdtfaHBdbavc;abfaocefcsGcitfgDazBdbaDaOBdlavaicefgicsGcdtfaOBdbavc;abfaocdfcsGcitfgDaHBdbaDazBdlavaiaCTaCcsSVfgicsGcdtfazBdbaiaATaAcsSVfhiaocifhokawcefhwaocsGhoaicsGhiarcifgrae6mbkkcbc99alaqSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnalaecvf9pmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk:4ioiue99dud99dud99dnaeTmbcbhiabhlindndnal8Uebgv:YgoJ:ji:1Salcof8UebgrciVgw:Y:vgDNJbbbZJbbb:;avcu9kEMgq:lJbbb9p9DTmbaq:Ohkxekcjjjj94hkkalclf8Uebhvalcdf8UebhxalarcefciGcetfak87ebdndnax:YgqaDNJbbbZJbbb:;axcu9kEMgm:lJbbb9p9DTmbam:Ohxxekcjjjj94hxkabaiarciGgkfcd7cetfax87ebdndnav:YgmaDNJbbbZJbbb:;avcu9kEMgP:lJbbb9p9DTmbaP:Ohvxekcjjjj94hvkalarcufciGcetfav87ebdndnawaw2:ZgPaPMaoaoN:taqaqN:tamamN:tgoJbbbbaoJbbbb9GE:raDNJbbbZMgD:lJbbb9p9DTmbaD:Ohrxekcjjjj94hrkalakcetfar87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj98Gcjjj;8if::NUdbabclfhbadcufgdmbkkk:Tvirud99eudndnadcl9hmbaeTmeindndnabRbbgiabcefgl8Sbbgvabcdfgo8Sbbgrf9R:YJbbuJabcifgwRbbgdce4adVgDcd4aDVgDcl4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax86bbdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao86bbdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai86bbdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad86bbabclfhbaecufgembxdkkaeTmbindndnab8Vebgiabcdfgl8Uebgvabclfgo8Uebgrf9R:YJbFu9habcofgw8Vebgdce4adVgDcd4aDVgDcl4aDVgDcw4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax87ebdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao87ebdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai87ebdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad87ebabcwfhbaecufgembkkk9teiucbcbyd:K:G:cjbgeabcifc98GfgbBd:K:G:cjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkk83dbcj:Gdk8Kbbbbdbbblbbbwbbbbbbbebbbdbbblbbbwbbbbc:K:Gdkl8W:qbb`,t=`b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuixkbbebeeddddilve9Weeeviebeoweuecj:Gdkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WbwY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbDl79IV9Rbqq:W9Dklbzik94evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaeai86b:q:W:cjbaecitab8Piw83i:q:G:cjbaecefgecjd9hmbkk:JBl8Aud97dur978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaialfgxar9RhodnadTgmmbavaoad;8qbbkaicefhPcj;abad9Uc;WFbGcjdadca0EhsdndndnadTmbaoadfhzcbhHinaeaH9nmdaxaP9RaD6miabaHad2fhOaPaDfhAasaeaH9RaHasfae6EgCcsfgocl4cifcd4hXavcj;cbfaoc9WGgQcetfhLavcj;cbfaQci2fhKavcj;cbfaQfhYcbh8Aaoc;ab6hEincbh3dnawTmbaPa8Acd4fRbbh3kcbh5avcj;cbfh8Eindndndndna3a5cet4ciGgoc9:fPdebdkaxaA9RaQ6mwdnaQTmbavcj;cbfa5aQ2faAaQ;8qbbkaAaCfhAxdkaQTmeavcj;cbfa5aQ2fcbaQ;8kbxekaxaA9RaX6moaoclVcbawEhraAaXfhocbhidnaEmbaxao9Rc;Gb6mbcbhlina8EalfhidndndndndndnaAalco4fRbbgqciGarfPDbedibledibkaipxbbbbbbbbbbbbbbbbpklbxlkaiaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaiaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaiaopbbbpklbaoczfhoxekaiaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqcd4ciGarfPDbedibledibkaiczfpxbbbbbbbbbbbbbbbbpklbxlkaiczfaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaiczfaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaiczfaopbbbpklbaoczfhoxekaiczfaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqcl4ciGarfPDbedibledibkaicafpxbbbbbbbbbbbbbbbbpklbxlkaicafaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaicafaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaicafaopbbbpklbaoczfhoxekaicafaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqco4arfPDbedibledibkaic8Wfpxbbbbbbbbbbbbbbbbpklbxlkaic8Wfaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Ngicitpbi:q:G:cjbaiRb:q:W:cjbgipsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbaiaoclffaqRb:q:W:cjbfhoxikaic8Wfaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Ngicitpbi:q:G:cjbaiRb:q:W:cjbgipsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbaiaocwffaqRb:q:W:cjbfhoxdkaic8Wfaopbbbpklbaoczfhoxekaic8WfaopbbdaoRbbgicitpbi:q:G:cjbaiRb:q:W:cjbgipsaoRbegqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbaiaocdffaqRb:q:W:cjbfhokalc;abfhialcjefaQ0meaihlaxao9Rc;Fb0mbkkdnaiaQ9pmbaici4hlinaxao9RcK6mwa8EaifhqdndndndndndnaAaico4fRbbalcoG4ciGarfPDbedibledibkaqpxbbbbbbbbbbbbbbbbpkbbxlkaqaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spkbbahaoclffagRb:q:W:cjbfhoxikaqaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spkbbahaocwffagRb:q:W:cjbfhoxdkaqaopbbbpkbbaoczfhoxekaqaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpkbbahaocdffagRb:q:W:cjbfhokalcdfhlaiczfgiaQ6mbkkaohAaoTmoka8EaQfh8Ea5cefg5cl9hmbkdndndndnawTmbaza8Acd4fRbbglciGPlbedwbkaQTmdavcjdfa8Afhlava8Afpbdbh8Jcbhoinalavcj;cbfaofpblbg8KaYaofpblbg8LpmbzeHdOiAlCvXoQrLg8MaLaofpblbg8NaKaofpblbgypmbzeHdOiAlCvXoQrLg8PpmbezHdiOAlvCXorQLg8Fcep9Ta8Fpxeeeeeeeeeeeeeeeegap9op9Hp9rg8Fa8Jp9Ug8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9Abbbaladfgla8Ja8Ma8PpmwDKYqk8AExm35Ps8E8Fg8Fcep9Ta8Faap9op9Hp9rg8Fp9Ug8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9Abbbaladfgla8Ja8Ka8LpmwKDYq8AkEx3m5P8Es8Fg8Ka8NaypmwKDYq8AkEx3m5P8Es8Fg8LpmbezHdiOAlvCXorQLg8Fcep9Ta8Faap9op9Hp9rg8Fp9Ug8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9Abbbaladfgla8Ja8Ka8LpmwDKYqk8AExm35Ps8E8Fg8Fcep9Ta8Faap9op9Hp9rg8Fp9Ugap9Abbbaladfglaaa8Fa8Fpmlvorlvorlvorlvorp9Ugap9Abbbaladfglaaa8Fa8FpmwDqkwDqkwDqkwDqkp9Ugap9Abbbaladfglaaa8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9AbbbaladfhlaoczfgoaQ6mbxikkaQTmeavcjdfa8Afhlava8Afpbdbh8Jcbhoinalavcj;cbfaofpblbg8KaYaofpblbg8LpmbzeHdOiAlCvXoQrLg8MaLaofpblbg8NaKaofpblbgypmbzeHdOiAlCvXoQrLg8PpmbezHdiOAlvCXorQLg8Fcep:nea8Fpxebebebebebebebebgap9op:bep9rg8Fa8Jp:oeg8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9Abbbaladfgla8Ja8Ma8PpmwDKYqk8AExm35Ps8E8Fg8Fcep:nea8Faap9op:bep9rg8Fp:oeg8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9Abbbaladfgla8Ja8Ka8LpmwKDYq8AkEx3m5P8Es8Fg8Ka8NaypmwKDYq8AkEx3m5P8Es8Fg8LpmbezHdiOAlvCXorQLg8Fcep:nea8Faap9op:bep9rg8Fp:oeg8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9Abbbaladfgla8Ja8Ka8LpmwDKYqk8AExm35Ps8E8Fg8Fcep:nea8Faap9op:bep9rg8Fp:oegap9Abbbaladfglaaa8Fa8Fpmlvorlvorlvorlvorp:oegap9Abbbaladfglaaa8Fa8FpmwDqkwDqkwDqkwDqkp:oegap9Abbbaladfglaaa8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9AbbbaladfhlaoczfgoaQ6mbxdkkaQTmbcbhocbalcl4gl9Rc8FGhiavcjdfa8Afhrava8Afpbdbhainaravcj;cbfaofpblbg8JaYaofpblbg8KpmbzeHdOiAlCvXoQrLg8LaLaofpblbg8MaKaofpblbg8NpmbzeHdOiAlCvXoQrLgypmbezHdiOAlvCXorQLg8Faip:Rea8Falp:Tep9qg8Faap9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9Abbbaradfgraaa8LaypmwDKYqk8AExm35Ps8E8Fg8Faip:Rea8Falp:Tep9qg8Fp9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9Abbbaradfgraaa8Ja8KpmwKDYq8AkEx3m5P8Es8Fg8Ja8Ma8NpmwKDYq8AkEx3m5P8Es8Fg8KpmbezHdiOAlvCXorQLg8Faip:Rea8Falp:Tep9qg8Fp9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9Abbbaradfgraaa8Ja8KpmwDKYqk8AExm35Ps8E8Fg8Faip:Rea8Falp:Tep9qg8Fp9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9AbbbaradfhraoczfgoaQ6mbkka8Aclfg8Aad6mbkdnaCad2goTmbaOavcjdfao;8qbbkdnammbavavcjdfaCcufad2fad;8qbbkaCaHfhHc9:hoaAhPaAmbxlkkaeTmbaDalfhrcbhocuhlinaralaD9RglfaD6mdasaeao9Raoasfae6Eaofgoae6mbkaial9RhPkcbc99axaP9RakSEhoxekc9:hokavcj;kbf8Kjjjjbaokwbz:bjjjbkNsezu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnalaeci9UgrcHf6mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbav9cu83iUav9cu83i8Wav9cu83iyav9cu83iaav9cu83iKav9cu83izav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhldnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhoindnalaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfaoaDcu7gPcl4fcsGcitfgsydlhzasydbhHdndnaDcsGgsak9pmbavaiaPfcsGcdtfydbaxasEhDaxasTgOfhxxekdndnascsSmbcehOasc987asamffcefhDxekalcefhDal8SbbgscFeGhPdndnascu9mmbaDhlxekalcvfhlaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhlkcehOaPce4cbaPceG9R7amfhDkaDhmkavc;abfaocitfgsaDBdbasazBdlavaicdtfaDBdbavc;abfaocefcsGcitfgsaHBdbasaDBdlaocdfhoaOaifhidnadcd9hmbabarcetfgsaH87ebasclfaD87ebascdfaz87ebxdkabarcdtfgsaHBdbascwfaDBdbasclfazBdbxekdnaDcpe0mbavaiaqaDcsGfRbbgscl4gP9RcsGcdtfydbaxcefgOaPEhDavaias9RcsGcdtfydbaOaPTgzfgOascsGgPEhsaPThPdndnadcd9hmbabarcetfgHax87ebaHclfas87ebaHcdfaD87ebxekabarcdtfgHaxBdbaHcwfasBdbaHclfaDBdbkavaicdtfaxBdbavc;abfaocitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfaocefcsGcitfgHasBdbaHaDBdlavaiazfgicsGcdtfasBdbavc;abfaocdfcsGcitfgDaxBdbaDasBdlaocifhoaiaPfhiaOaPfhxxekaxcbalRbbgsEgHaDc;:eSgDfhOascsGhAdndnascl4gCmbaOcefhzxekaOhzavaiaC9RcsGcdtfydbhOkdndnaAmbazcefhxxekazhxavaias9RcsGcdtfydbhzkdndnaDTmbalcefhDxekalcdfhDal8SbegPcFeGhsdnaPcu9kmbalcofhHascFbGhscrhldninaD8SbbgPcFbGaltasVhsaPcu9kmeaDcefhDalcrfglc8J9hmbkaHhDxekaDcefhDkasce4cbasceG9R7amfgmhHkdndnaCcsSmbaDhsxekaDcefhsaD8SbbglcFeGhPdnalcu9kmbaDcvfhOaPcFbGhPcrhldninas8SbbgDcFbGaltaPVhPaDcu9kmeascefhsalcrfglc8J9hmbkaOhsxekascefhskaPce4cbaPceG9R7amfgmhOkdndnaAcsSmbashlxekascefhlas8SbbgDcFeGhPdnaDcu9kmbascvfhzaPcFbGhPcrhDdninal8SbbgscFbGaDtaPVhPascu9kmealcefhlaDcrfgDc8J9hmbkazhlxekalcefhlkaPce4cbaPceG9R7amfgmhzkdndnadcd9hmbabarcetfgDaH87ebaDclfaz87ebaDcdfaO87ebxekabarcdtfgDaHBdbaDcwfazBdbaDclfaOBdbkavc;abfaocitfgDaOBdbaDaHBdlavaicdtfaHBdbavc;abfaocefcsGcitfgDazBdbaDaOBdlavaicefgicsGcdtfaOBdbavc;abfaocdfcsGcitfgDaHBdbaDazBdlavaiaCTaCcsSVfgicsGcdtfazBdbaiaATaAcsSVfhiaocifhokawcefhwaocsGhoaicsGhiarcifgrae6mbkkcbc99alaqSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnalaecvf9pmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk;Toio97eue97aec98Ghedndnadcl9hmbaeTmecbhdinababpbbbgicKp:RecKp:Sep;6eglaicwp:RecKp:Sep;6ealp;Geaiczp:RecKp:Sep;6egvp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egralpxbbbjbbbjbbbjbbbjgwp9op9rp;Keglpxbb;:9cbb;:9cbb;:9cbb;:9calalp;Meaoaop;Meavaravawp9op9rp;Keglalp;Mep;Kep;Kep;Jep;Negvp;Mepxbbn0bbn0bbn0bbn0grp;KepxFbbbFbbbFbbbFbbbp9oaipxbbbFbbbFbbbFbbbFp9op9qalavp;Mearp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaoavp;Mearp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbabczfhbadclfgdae6mbxdkkaeTmbcbhdinabczfgDaDpbbbgipxbbbbbbFFbbbbbbFFgwp9oabpbbbgoaipmbediwDqkzHOAKY8AEgvczp:Reczp:Sep;6eglaoaipmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eavczp:Sep;6egvp;Gealp;Gep;Kep;Legipxbbbbbbbbbbbbbbbbp:2egralpxbbbjbbbjbbbjbbbjgqp9op9rp;Keglpxb;:FSb;:FSb;:FSb;:FSalalp;Meaiaip;Meavaravaqp9op9rp;Keglalp;Mep;Kep;Kep;Jep;Negvp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbp9oaiavp;Mearp;Keczp:Rep9qgialavp;Mearp;KepxFFbbFFbbFFbbFFbbp9oglpmwDKYqk8AExm35Ps8E8Fp9qpkbbabaoawp9oaialpmbezHdiOAlvCXorQLp9qpkbbabcafhbadclfgdae6mbkkk;2ileue97euo97dnaec98GgiTmbcbheinabcKfpx:ji:1S:ji:1S:ji:1S:ji:1SabpbbbglabczfgvpbbbgopmlvorxmPsCXQL358E8Fgrczp:Segwpxibbbibbbibbbibbbp9qp;6egDp;NegqaDaDp;MegDaDp;KealaopmbediwDqkzHOAKY8AEgDczp:Reczp:Sep;6eglalp;MeaDczp:Sep;6egoaop;Mearczp:Reczp:Sep;6egrarp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jep;Mepxbbn0bbn0bbn0bbn0gDp;KepxFFbbFFbbFFbbFFbbgkp9oaqaop;MeaDp;Keczp:Rep9qgoaqalp;MeaDp;Keakp9oaqarp;MeaDp;Keczp:Rep9qgDpmwDKYqk8AExm35Ps8E8Fglp5eawclp:RegqpEi:T:j83ibavalp5baqpEd:T:j83ibabcwfaoaDpmbezHdiOAlvCXorQLgDp5eaqpEe:T:j83ibabaDp5baqpEb:T:j83ibabcafhbaeclfgeai6mbkkkuee97dnadcd4ae2c98GgeTmbcbhdinababpbbbgicwp:Recwp:Sep;6eaicep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepkbbabczfhbadclfgdae6mbkkk:Sodw97euaec98Ghedndnadcl9hmbaeTmecbhdinabpxbbuJbbuJbbuJbbuJabpbbbgicKp:TeglaicYp:Tep9qgvcdp:Teavp9qgvclp:Teavp9qgop;6ep;Negvaicwp:RecKp:SegraipxFbbbFbbbFbbbFbbbgwp9ogDp:Uep;6ep;Mepxbbn0bbn0bbn0bbn0gqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9oavaDarp:Xeaiczp:RecKp:Segip:Uep;6ep;Meaqp;Keawp9op9qavaDaraip:Uep:Xep;6ep;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qavaoalcep:Rep9oalpxebbbebbbebbbebbbp9op9qp;6ep;Meaqp;KecKp:Rep9qpkbbabczfhbadclfgdae6mbxdkkaeTmbcbhdinabczfgkpxbFu9hbFu9hbFu9hbFu9habpbbbglakpbbbgrpmlvorxmPsCXQL358E8Fgvczp:TegqavcHp:Tep9qgicdp:Teaip9qgiclp:Teaip9qgicwp:Teaip9qgop;6ep;NegialarpmbediwDqkzHOAKY8AEgDpxFFbbFFbbFFbbFFbbglp9ograDczp:Segwp:Ueavczp:Reczp:SegDp:Xep;6ep;Mepxbbn0bbn0bbn0bbn0gvp;Kealp9oaiarawaDp:Uep:Xep;6ep;Meavp;Keczp:Rep9qgwaiaoaqcep:Rep9oaqpxebbbebbbebbbebbbp9op9qp;6ep;Meavp;Keczp:ReaiaDarp:Uep;6ep;Meavp;Kealp9op9qgipmwDKYqk8AExm35Ps8E8FpkbbabawaipmbezHdiOAlvCXorQLpkbbabcafhbadclfgdae6mbkkk9teiucbcbydj:G:cjbgeabcifc98GfgbBdj:G:cjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkxebcj:Gdklz:zbb`,n=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),r=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!=`object`)return{supported:!1};var i=WebAssembly.validate(n)?s(t):s(e),a,o=WebAssembly.instantiate(i,{}).then(function(e){a=e.instance,a.exports.__wasm_call_ctors()});function s(e){for(var t=new Uint8Array(e.length),n=0;n<e.length;++n){var i=e.charCodeAt(n);t[n]=i>96?i-97:i>64?i-39:i+4}for(var a=0,n=0;n<e.length;++n)t[a++]=t[n]<60?r[t[n]]:(t[n]-60)*64+t[++n];return t.buffer.slice(0,a)}function c(e,t,n,r,i,a,o){var s=e.exports.sbrk,c=r+3&-4,l=s(c*i),u=s(a.length),d=new Uint8Array(e.exports.memory.buffer);d.set(a,u);var f=t(l,r,i,u,a.length);if(f==0&&o&&o(l,c,i),n.set(d.subarray(l,l+r*i)),s(l-s(0)),f!=0)throw Error(`Malformed buffer data: `+f)}var l={NONE:``,OCTAHEDRAL:`meshopt_decodeFilterOct`,QUATERNION:`meshopt_decodeFilterQuat`,EXPONENTIAL:`meshopt_decodeFilterExp`,COLOR:`meshopt_decodeFilterColor`},u={ATTRIBUTES:`meshopt_decodeVertexBuffer`,TRIANGLES:`meshopt_decodeIndexBuffer`,INDICES:`meshopt_decodeIndexSequence`},d=[],f=0;function p(e){var t={object:new Worker(e),pending:0,requests:{}};return t.object.onmessage=function(e){var n=e.data;t.pending-=n.count,t.requests[n.id][n.action](n.value),delete t.requests[n.id]},t}function m(e){for(var t=`self.ready = WebAssembly.instantiate(new Uint8Array([`+new Uint8Array(i)+`]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = `+g.name+`;`+c.toString()+g.toString(),n=new Blob([t],{type:`text/javascript`}),r=URL.createObjectURL(n),a=d.length;a<e;++a)d[a]=p(r);for(var a=e;a<d.length;++a)d[a].object.postMessage({});d.length=e,URL.revokeObjectURL(r)}function h(e,t,n,r,i){for(var a=d[0],o=1;o<d.length;++o)d[o].pending<a.pending&&(a=d[o]);return new Promise(function(o,s){var c=new Uint8Array(n),l=++f;a.pending+=e,a.requests[l]={resolve:o,reject:s},a.object.postMessage({id:l,count:e,size:t,source:c,mode:r,filter:i},[c.buffer])})}function g(e){var t=e.data;self.ready.then(function(e){if(!t.id)return self.close();try{var n=new Uint8Array(t.count*t.size);c(e,e.exports[t.mode],n,t.count,t.size,t.source,e.exports[t.filter]),self.postMessage({id:t.id,count:t.count,action:`resolve`,value:n},[n.buffer])}catch(e){self.postMessage({id:t.id,count:t.count,action:`reject`,value:e})}})}return{ready:o,supported:!0,useWorkers:function(e){m(e)},decodeVertexBuffer:function(e,t,n,r,i){c(a,a.exports.meshopt_decodeVertexBuffer,e,t,n,r,a.exports[l[i]])},decodeIndexBuffer:function(e,t,n,r){c(a,a.exports.meshopt_decodeIndexBuffer,e,t,n,r)},decodeIndexSequence:function(e,t,n,r){c(a,a.exports.meshopt_decodeIndexSequence,e,t,n,r)},decodeGltfBuffer:function(e,t,n,r,i,o){c(a,a.exports[u[i]],e,t,n,r,a.exports[l[o]])},decodeGltfBufferAsync:function(e,t,n,r,i){return d.length>0?h(e,t,n,u[r],l[i]):o.then(function(){var o=new Uint8Array(e*t);return c(a,a.exports[u[r]],o,e,t,n,a.exports[l[i]]),o})}}})()})),rA=/* @__PURE__ */ n({applyMorph:()=>oA,buildModel:()=>sA,gltfExtensionsUsed:()=>iA});function iA(e){let t=new Uint8Array(e),n;if(t.byteLength>=20&&new DataView(e).getUint32(0,!0)===1179937895){let r=new DataView(e).getUint32(12,!0);n=new TextDecoder().decode(t.subarray(20,20+r))}else n=new TextDecoder().decode(t);try{let e=JSON.parse(n);return Array.isArray(e.extensionsUsed)?e.extensionsUsed.filter(e=>typeof e==`string`):[]}catch{return[]}}async function aA(e){let t=cA.get(e);return t||(t=(async()=>{let[{GLTFLoader:t},n]=await Promise.all([Promise.resolve().then(()=>($k(),ZO)),fetch(e)]);if(!n.ok)throw Error(`HTTP ${n.status} for ${e}`);let r=await n.arrayBuffer(),i=iA(r);if(i.includes(`KHR_draco_mesh_compression`))throw Error(`${e} uses Draco compression (KHR_draco_mesh_compression), which the Agent3D runtime does not decode. Re-export it without Draco (Blender: uncheck "Compression"), or convert it to meshopt with gltfpack (\`gltfpack -i in.glb -o out.glb -cc\`), then run \`agent3d assets optimize\`.`);let a=new t;if(i.includes(`EXT_meshopt_compression`)){let{MeshoptDecoder:e}=await Promise.resolve().then(()=>(nA(),eA));await e.ready,a.setMeshoptDecoder(e)}let o=e.slice(0,e.lastIndexOf(`/`)+1);return a.parseAsync(r,/^data:/.test(e)?``:o)})(),t.catch(()=>cA.delete(e)),cA.set(e,t)),t}function oA(e,t){e.traverse(e=>{let n=e;if(n.isMesh&&n.morphTargetDictionary&&n.morphTargetInfluences)for(let[e,r]of Object.entries(t)){let t=n.morphTargetDictionary[e];t!==void 0&&typeof r==`number`&&(n.morphTargetInfluences[t]=r)}})}async function sA(e,t){let n=await aA(t.resolveAsset(e.src)),{clone:r}=await Promise.resolve().then(()=>(XO(),VO)),i=r(n.scene),a=new ba;a.add(i),i.updateMatrixWorld(!0);let o=new Wa().setFromObject(i);if(!o.isEmpty()){let t=o.getSize(new B),n=Math.max(t.x,t.y,t.z),r=e.fit&&n>0?e.fit/n:1;if(i.scale.multiplyScalar(r),e.center!==!1){let e=o.getCenter(new B);i.position.set(-e.x*r,-o.min.y*r,-e.z*r)}}i.traverse(t=>{let n=t;n.isMesh&&(n.castShadow=e.castShadow??!0,n.receiveShadow=e.receiveShadow??!1)}),e.material&&await bw(i,e.material,t),e.morph&&oA(i,e.morph);let s;if(n.animations.length){let r=new Zd(i),a=null,o=e=>typeof e==`number`||/^\d+$/.test(String(e))?n.animations[Number(e)]:n.animations.find(t=>t.name===e)??n.animations.find(t=>t.name.toLowerCase().includes(String(e).toLowerCase())),c=/* @__PURE__ */ new Set,l=r=>{let i=o(r);return!i&&!c.has(String(r))&&(c.add(String(r)),t.issue(`asset-load`,`Model ${e.id} has no animation clip "${r}" (clips: ${n.animations.map(e=>e.name).join(`, `)})`,`objects#${e.id}.animation.clip`)),i},u=(e,t={})=>{let n=l(e);if(!n)return;let i=r.clipAction(n);i.setLoop(t.loop===!1?wr:Tr,1/0),i.clampWhenFinished=t.loop===!1,i.timeScale=Q(t.speed,1),i.enabled=!0,a&&a!==i?(i.reset().setEffectiveWeight(1).play(),a.crossFadeTo(i,Q(t.crossfade,.3),!1)):i.setEffectiveWeight(1).play(),a=i},d=e=>{let t=l(e);if(!t)return null;let n=r.clipAction(t);return n.isRunning()||(n.enabled=!0,n.setLoop(Tr,1/0),n.play()),n},f={weight(e,t){d(e)?.setEffectiveWeight(Math.max(0,t))},speed(e,t){let n=d(e);n&&(n.timeScale=t)},time(e,t){let n=d(e);n&&(n.paused=!0,n.time=Math.max(0,t))}},p=e.animation??{},m=()=>{r.stopAllAction(),a=null,u(p.clip??0,p),p.offset&&a&&(a.time=Math.max(0,p.offset));for(let[e,t]of Object.entries(p.blend??{}))f.weight(e,t);r.update(0)};s={mixer:r,clips:n.animations,play:u,control:f,reset:m},m()}return{object:a,animator:s}}var cA,lA=t((()=>{J(),zS(),jw(),cA=/* @__PURE__ */ new Map}));J(),Xg(),Tv(),zS(),jw();function uA(e){let t={position:e.position.clone(),quaternion:e.quaternion.clone(),scale:e.scale.clone(),visible:e.visible},n=e;return n.isLight&&(t.intensity=n.intensity,t.color=n.color.clone()),t}function dA(e,t){t.position&&e.position.set(t.position[0]??0,t.position[1]??0,t.position[2]??0),t.rotation&&e.rotation.set((t.rotation[0]??0)*LS,(t.rotation[1]??0)*LS,(t.rotation[2]??0)*LS),t.scale!==void 0&&(typeof t.scale==`number`?e.scale.setScalar(t.scale):e.scale.set(t.scale[0]??1,t.scale[1]??1,t.scale[2]??1))}var fA=/* @__PURE__ */ new Set([`hoverScale`,`hoverLift`,`clickBounce`,`spinOnClick`]),pA=class e{def;ctx;scene=new ka;camera;rig;env=null;entries=/* @__PURE__ */ new Map;timeline=null;settleEntrances=!1;updaters=[];cameraRest0={position:new B,target:new B,fov:45,zoom:10,focus:void 0};motionHost;overrides;shots=[];focusWritten=!1;postfxParam=null;viewportH=600;input={pointer:{x:0,y:0,inside:!1},scroll:0,hovered:/* @__PURE__ */ new Set,clicked:/* @__PURE__ */ new Set,timelineT:null};disposed=!1;constructor(e,t){this.def=e,this.ctx=t,t.onUpdate=e=>this.updaters.push(e)}static async create(t,n,r,i,a=!1){let o=new e(t,n);return await o.build(r,i,a),o}async build(e,t,n){let{def:r,ctx:i}=this;{this.camera=wT(r.camera,e),this.rig=await kT(r.camera,this.camera,t,i.deterministic),this.cameraRest0.position.copy(this.rig.rest.position),this.cameraRest0.target.copy(this.rig.rest.target),this.cameraRest0.fov=this.rig.rest.fov,this.cameraRest0.zoom=this.rig.rest.zoom;let a=r.postfx?.find(e=>e.type===`dof`);this.cameraRest0.focus=a&&typeof a.focus==`number`?a.focus:a?8:void 0,this.rig.rest.focus=this.cameraRest0.focus;let o=AD(r.environment??{background:`#ffffff`},this.scene,this.camera,!!r.target?.transparent,i),s=Promise.all((r.lights??[]).map((e,t)=>this.addLight(e,t))),c=/* @__PURE__ */ new Map,l=r.objects??[],u=e=>e.attach===`camera`?this.camera:this.scene;l.some(e=>e.attach===`camera`)&&this.scene.add(this.camera),await Promise.all(l.filter(e=>e.kind===`generator`&&e.generator===`terrain`).map(e=>this.addObject(e,u(e),void 0,c))),mA(c,l),await Promise.all(l.filter(e=>e.kind!==`generator`||e.generator!==`terrain`).map(e=>this.addObject(e,u(e),void 0,c)));let d=new Map(l.map((e,t)=>[e.id,t]));this.scene.children.sort((e,t)=>(d.get(e.userData.a3dId)??-1)-(d.get(t.userData.a3dId)??-1)),this.env=await o;for(let e of this.env.objects)this.scene.add(e);if(await s,this.canonicalOrder(r),n){let e=new Mf(20,20,8947848,4473924);e.userData.helper=!0,this.scene.add(e,Object.assign(new Yf(1.5),{userData:{helper:!0}}))}if(this.motionHost={object:e=>this.entries.get(e)?.object??null,select:e=>this.select(e),camera:this.rig.rest,scene:this.scene,renderer:i.renderer,postfx:{set:(e,t,n)=>this.postfxParam?.(e,t,n),base:(e,t)=>{let n=Ox(r.postfx).find(t=>t.type===e)?.[t];return typeof n==`number`||typeof n==`string`?n:void 0}},clips:e=>this.entries.get(e)?.animator?.control,issue:i.issue,seed:r.seed??1},this.overrides=new Gw(this.motionHost),this.shots=Zw(r.camera?.shots),r.timeline){this.timeline=Uw(r.timeline,this.motionHost);for(let e of this.timeline.targets){let t=this.entries.get(e);t&&(t.animated=!0)}}for(let e of r.interactions??[]){if(e.target&&(e.on===`click`||e.on===`hover`||e.on===`hoverEnd`)){let t=this.entries.get(e.target);t&&(t.interactive=!0)}for(let t of e.do??[]){let e=t.set?.path;if(typeof e==`string`)for(let t of this.overrides.idsOf(e)){let e=this.entries.get(t);e&&(e.animated=!0)}}}this.fitShadows()}}canonicalOrder(e){let t=this.entries,n=/* @__PURE__ */ new Map,r=e=>{let r=t.get(e);r&&!n.has(e)&&n.set(e,r)};(e.lights??[]).forEach((e,t)=>r(e.id??`light${t}`));let i=e=>{for(let n of e){r(n.id);let e=`${n.id}/`;for(let i of t.keys())i.startsWith(e)&&t.get(i).parentId===n.id&&r(i);if(!n.children?.length)continue;let a=t.get(n.id)?.object;if(a){let e=new Map(n.children.map((e,t)=>[e.id,t]));a.children.sort((t,n)=>(e.get(t.userData.a3dId)??-1)-(e.get(n.userData.a3dId)??-1))}i(n.children)}};i(e.objects??[]);for(let[e,r]of t)n.has(e)||n.set(e,r);this.entries=n}async overrideGeneratorMaterial(e,t,n){let r=lw(t),i=await yw(t,n,{vertexColors:r.type!==`shader`&&r.type!==`normal`&&r.type!==`gradient`&&!r.color&&!r.map}),a=[];e.traverse(e=>{e.isMesh&&e.userData.materialTarget&&a.push(e)});for(let e of a)e.material.dispose(),e.material=i,pw(i,e.geometry)}rngFor(e,t){return dv(t??fv(this.def.seed??1,e))}behaviourContext(e){let t=this;return{object:e.object,base:{position:e.rest.position,rotation:new na().setFromQuaternion(e.rest.quaternion),scale:e.rest.scale},get pointer(){return t.input.pointer},hovered:()=>t.input.hovered.has(e.id),clicked:()=>t.input.clicked.has(e.id),scroll:()=>t.input.scroll,get camera(){return t.camera},rng:this.rngFor(e.id+`:behaviours`),find:e=>e===`camera`?t.camera:t.entries.get(e)?.object??null}}attachBehaviours(e){let t=e.def.behaviours??[];e.runners=[];for(let n of t){let t=FC[n.type];t?(e.runners.push(HC(n,t,this.behaviourContext(e),{settled:()=>this.settleEntrances})),(fA.has(n.type)||n.when===`hover`||n.when===`click`)&&(e.interactive=!0)):this.ctx.issue(`unknown-catalog-id`,`Unknown behaviour "${n.type}"`,`objects#${e.id}.behaviours`)}e.runners.length&&(e.animated=!0)}resetBehaviours(){for(let e of this.entries.values()){for(let t of e.runners)t.dispose();e.def.behaviours?.length&&this.attachBehaviours(e),e.animator?.reset?e.animator.reset():e.animator?.mixer.setTime(0)}this.overrides?.reset()}async addLight(e,t){let n=await oE(e,this.def.environment?.shadows),r=e.id??`light${t}`;this.scene.add(n),(n instanceof qu||n instanceof Hu)&&this.scene.add(n.target),n.userData.a3dId=r;let i={id:r,kind:`light`,def:e,object:n,rest:uA(n),runners:[],animated:!1,topLevel:!1,interactive:!1};this.entries.set(r,i),this.attachBehaviours(i)}async addObject(e,t,n,r){let i=this.ctx,a,o,s,c,l=[],u=e.kind!==`particles`&&e.kind!==`generator`;try{switch(e.kind){case`mesh`:{let t=FD(e.geometry),n=await yw(e.material,i,{defaultColor:`#dddddd`});pw(n,t),a=new K(t,n);break}case`text`:{let{buildText:t}=await Promise.resolve().then(()=>(SO(),YD)),n=await i.track(t(e,i));a=n.object,l=n.letters;break}case`svg`:{let{buildSvg:t}=await Promise.resolve().then(()=>(BO(),jO));a=await i.track(t(e,i));break}case`model`:{let{buildModel:t}=await Promise.resolve().then(()=>(lA(),rA)),n=await i.track(t(e,i));a=n.object,s=n.animator;break}case`instances`:{let t=FD(e.geometry),n=await yw(e.material,i,{defaultColor:e.colors?.length?`#ffffff`:`#dddddd`});pw(n,t),a=LD(e,t,n,this.rngFor(e.id,e.layout.seed),e=>AS(e));break}case`particles`:{c=YC(e,this.rngFor(e.id,e.seed)),c.setViewport(this.viewportH),a=c.points;let t=c;this.updaters.push(e=>t.update(e));break}case`generator`:{let t=(await i.generators())[e.generator];if(!t){i.issue(`unknown-catalog-id`,`Unknown generator "${e.generator}"`,`objects#${e.id}.generator`),a=new ba;break}let n=Lg.find(t=>t.id===e.generator),s=jS(n,e.params??{}),c=e.scale,l={position:[...e.position??[0,0,0]],scale:typeof c==`number`?[c,c,c]:c?[...c]:[1,1,1]},u={...i,siblings:r,rng:this.rngFor(e.id,e.seed),placement:l};if(o=await i.track(Promise.resolve(t(s,u))),a=o.object,o.update){let e=o.update.bind(o);this.updaters.push((t,n)=>e(t,n))}r.set(e.id,o),e.material&&n?.material&&await this.overrideGeneratorMaterial(a,e.material,i);break}default:a=new ba}}catch(t){i.issue(e.kind===`model`||e.kind===`text`||e.kind===`svg`?`asset-load`:`build-error`,`${e.id}: ${t.message}`,`objects#${e.id}`),a=new ba}if(this.disposed)return null;a.name=e.name??e.id,a.userData={...e.userData??{},...a.userData,a3dId:e.id,tags:e.tags??[]},dA(a,e),e.visible===!1&&(a.visible=!1);let d=e.castShadow??(u?!0:void 0),f=e.receiveShadow??(u?!0:void 0);(d!==void 0||f!==void 0)&&a.traverse(e=>{e.isMesh&&(d!==void 0&&(e.castShadow=d),f!==void 0&&(e.receiveShadow=f))}),t.add(a);let p={id:e.id,kind:e.kind,def:e,object:a,rest:uA(a),runners:[],animated:!1,topLevel:t===this.scene||t===this.camera&&!n,parentId:n,built:o,animator:s,particles:c,interactive:!!e.href};this.entries.set(e.id,p),this.attachBehaviours(p);for(let t of l){let n={id:t.id,kind:`text`,def:t.def,object:t.object,rest:uA(t.object),runners:[],animated:!0,topLevel:!1,parentId:e.id,interactive:!1};t.reveal&&n.runners.push(HC(t.reveal.def,t.reveal.impl,this.behaviourContext(n),{settled:()=>this.settleEntrances})),this.entries.set(t.id,n)}if(e.children?.length){let t=/* @__PURE__ */ new Map,n=e.children;await Promise.all(n.filter(e=>e.kind===`generator`&&e.generator===`terrain`).map(n=>this.addObject(n,a,e.id,t))),mA(t,n),await Promise.all(n.filter(e=>e.kind!==`generator`||e.generator!==`terrain`).map(n=>this.addObject(n,a,e.id,t)))}return p}removeEntry(e){let t=this.entries.get(e);if(t){t.object.traverse(t=>{let n=t.userData.a3dId;n&&n!==e&&this.entries.delete(n)}),t.object.removeFromParent();for(let e of t.runners)e.dispose();this.entries.delete(e)}}idsFor(e){let t=[];for(let n=e;n;n=n.parent){let e=n.userData?.a3dId;e&&this.entries.has(e)&&t.push(e)}return t}select(e){if(e.startsWith(`tag:`)){let t=e.slice(4),n=[],r=e=>{for(let i of e??[])i.tags?.includes(t)&&this.entries.has(i.id)&&n.push(i.id),r(i.children)};return r(this.def.objects),n}if(e.startsWith(`children:`)){let t=e.slice(9);return[...this.entries.values()].filter(e=>e.parentId===t).map(e=>e.id)}return Vw(e,{object:()=>null,camera:null,issue:()=>void 0}).filter(e=>e!==``)}objectPosition(e){let t=this.entries.get(e);return t?t.object.getWorldPosition(new B):null}interactiveRoots(){let e=[];for(let t of this.entries.values())t.interactive&&t.kind!==`light`&&e.push(t.object);return e}fitShadows(){let e=[];if(this.scene.traverse(t=>{t instanceof qu&&t.castShadow&&e.push(t)}),!e.length)return;let t=new Wa,n=new Wa;this.scene.updateMatrixWorld(!0);for(let e of this.entries.values())e.topLevel&&e.kind!==`particles`&&e.def.attach!==`camera`&&(n.setFromObject(e.object),n.isEmpty()||n.getSize(new B).length()>200||t.union(n));t.isEmpty()&&t.set(new B(-5,-1,-5),new B(5,5,5));let r=this.env?.ground?this.env.ground.position.y:t.min.y;t.expandByPoint(new B(t.min.x,r,t.min.z)),t.expandByPoint(new B(t.max.x,r,t.max.z)),t.expandByScalar(.3);for(let n of e)sE(n,t)}setViewport(e,t,n){this.viewportH=t*n;let r=/^\s*([\d.]+)\s*[:/x]\s*([\d.]+)\s*$/.exec(this.def.target?.aspect??``),i=r?Number(r[1])/Number(r[2]):void 0;DT(this.camera,this.def.camera,e/Math.max(t,1),i&&Number.isFinite(i)&&i>0?i:void 0);for(let e of this.entries.values())e.particles?.setViewport(this.viewportH)}frame(e,t,n,r){this.input=n;for(let e of this.entries.values()){if(!e.animated)continue;let t=e.object;t.position.copy(e.rest.position),t.quaternion.copy(e.rest.quaternion),t.scale.copy(e.rest.scale),t.visible=e.rest.visible;let n=t;n.isLight&&e.rest.intensity!==void 0&&(n.intensity=e.rest.intensity,e.rest.color&&!this.timeline?.targets.has(e.id)&&n.color.copy(e.rest.color))}let i=this.def.timeline?n.timelineT??0:e;if(this.shots.length||this.timeline?.animatesCamera){let e=this.rig.rest;if(e.position.copy(this.cameraRest0.position),e.target.copy(this.cameraRest0.target),e.fov=this.cameraRest0.fov,e.zoom=this.cameraRest0.zoom,e.focus=this.cameraRest0.focus,this.shots.length){let t=Qw(this.shots,i,e,{objectPosition:e=>this.objectPosition(e)});e.position.copy(t.position),e.target.copy(t.target),e.fov=t.fov,e.focus=t.focus}}this.timeline&&n.timelineT!==null&&this.timeline.apply(n.timelineT),this.overrides?.apply(e),this.rig.rest.focus!==void 0&&(this.focusWritten||this.rig.rest.focus!==this.cameraRest0.focus)&&(this.postfxParam?.(`dof`,`focus`,this.rig.rest.focus),this.focusWritten=!0);for(let n of this.entries.values())for(let r of n.runners)r.late||r.step(e,t);for(let e of this.entries.values()){let t=e.object.userData.setPointer?e.object:e.object.children[0],r=t?.userData.setPointer;if(!r)continue;r(n.pointer.x,n.pointer.y);let i=t.userData.setPointerLocal;if(i&&this.camera){let e=this.pointerOnPlane(t,n.pointer.x,n.pointer.y);e&&i(e.x,e.z)}}for(let n of this.updaters)n(e,t);for(let e of this.entries.values())e.animator?.mixer.update(t);let a=this.def.camera?.lookAt;this.rig.update(e,t,{pointer:n.pointer,scroll:n.scroll,followTarget:r,lookAt:a?this.objectPosition(a):null}),this.camera.updateMatrixWorld();for(let n of this.entries.values())for(let r of n.runners)r.late&&r.step(e,t)}hasStatefulMotion(){if(this.def.camera?.controls===`follow`&&this.def.camera.follow)return!0;for(let e of this.entries.values())for(let t of e.runners)if(t.stateful)return!0;return!1}pointerRay=new of;pointerOnPlane(e,t,n){e.updateWorldMatrix(!0,!1),this.camera.updateMatrixWorld(),this.pointerRay.setFromCamera(new z(t,n),this.camera);let r=e.matrixWorld.clone().invert(),i=this.pointerRay.ray.clone().applyMatrix4(r);if(Math.abs(i.direction.y)<1e-6)return null;let a=-i.origin.y/i.direction.y;return a<0?null:i.origin.addScaledVector(i.direction,a)}dispose(){this.disposed=!0;for(let e of this.entries.values()){for(let t of e.runners)t.dispose();e.built?.dispose?.()}this.rig?.dispose(),this.env?.dispose(),PS(this.scene);let e=this.scene.environment;e&&e.dispose();let t=this.scene.background;t&&t.isTexture&&t.dispose(),this.scene.traverse(e=>e.shadow?.dispose?.()),this.entries.clear()}};function mA(e,t){let n=[...e.entries()],r=new Map(t.map((e,t)=>[e.id,t]));n.sort((e,t)=>(r.get(e[0])??1/0)-(r.get(t[0])??1/0)),e.clear();for(let[t,r]of n)e.set(t,r)}var hA=/* @__PURE__ */ new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Space`,`PageUp`,`PageDown`,`Home`,`End`]);function gA(){return{pointer:{x:0,y:0,inside:!1,down:!1,justPressed:!1},keys:/* @__PURE__ */ new Set,pressed:/* @__PURE__ */ new Set,swipe:null,clicks:[],scroll:0}}function _A(e){e.pressed.clear(),e.pointer.justPressed=!1,e.swipe=null,e.clicks.length=0}function vA(e,t,n){n?(e.keys.has(t)||e.pressed.add(t),e.keys.add(t)):e.keys.delete(t)}function yA(e,t,n){let r=e.ownerDocument.defaultView??window,i=!1,a=!1,o=null,s=t=>{let n=e.getBoundingClientRect();return{x:(t.clientX-n.left)/Math.max(n.width,1)*2-1,y:-((t.clientY-n.top)/Math.max(n.height,1)*2-1)}},c=e=>{let r=s(e);t.pointer.x=r.x,t.pointer.y=r.y,t.pointer.inside=!0,n.onPointerMove?.()},l=()=>{a=!0,t.pointer.inside=!0},u=()=>{a=!1,t.pointer.inside=!1,t.pointer.down=!1},d=e=>{i=!0;let n=s(e);t.pointer.x=n.x,t.pointer.y=n.y,t.pointer.down=!0,t.pointer.justPressed=!0,o={x:n.x,y:n.y,t:performance.now(),px:e.clientX,py:e.clientY}},f=e=>{if(t.pointer.down=!1,!o)return;let n=e.clientX-o.px,r=e.clientY-o.py,i=Math.hypot(n,r);i<8?t.clicks.push(s(e)):i>30&&performance.now()-o.t<600&&(t.swipe=Math.abs(n)>Math.abs(r)?n>0?`right`:`left`:r>0?`down`:`up`),o=null},p=()=>i||a||e.contains(e.ownerDocument.activeElement),m=e=>{if(!p())return;let r=e.target;(!r||r.tagName!==`INPUT`&&r.tagName!==`TEXTAREA`&&!r.isContentEditable)&&(vA(t,e.code,e.type===`keydown`),n.game&&hA.has(e.code)&&e.preventDefault())},h=()=>t.keys.clear(),g=t=>{e.contains(t.target)||(i=!1)};return e.addEventListener(`pointermove`,c),e.addEventListener(`pointerenter`,l),e.addEventListener(`pointerleave`,u),e.addEventListener(`pointerdown`,d),r.addEventListener(`pointerup`,f),r.addEventListener(`keydown`,m,{passive:!1}),r.addEventListener(`keyup`,m),r.addEventListener(`blur`,h),r.document.addEventListener(`pointerdown`,g,!0),n.game&&(e.style.touchAction=`none`,e.hasAttribute(`tabindex`)||e.setAttribute(`tabindex`,`0`)),{dispose(){e.removeEventListener(`pointermove`,c),e.removeEventListener(`pointerenter`,l),e.removeEventListener(`pointerleave`,u),e.removeEventListener(`pointerdown`,d),r.removeEventListener(`pointerup`,f),r.removeEventListener(`keydown`,m),r.removeEventListener(`keyup`,m),r.removeEventListener(`blur`,h),r.document.removeEventListener(`pointerdown`,g,!0)}}}function bA(e){let t=e.ownerDocument.defaultView;if(!t)return 0;let n=e.getBoundingClientRect(),r=t.innerHeight||1,i=(r-n.top)/(r+n.height);return i<0?0:i>1?1:i}var xA=(e,t,n)=>e<t?t:e>n?n:e;function SA(e,t,n){return typeof e==`number`&&Number.isFinite(e)?e:typeof e==`string`&&t&&typeof t[e]==`number`?t[e]:n}function CA(e,t){let n=Math.max(e.duration||0,.001);if(t===`timeline`)return{from:0,to:n,loop:e.loop,speed:1};let r=e.segments?.[t];if(!r)return null;let i=Array.isArray(r)?{from:r[0],to:r[1]}:r;return{from:xA(SA(i.from,e.markers,0),0,n),to:xA(SA(i.to,e.markers,n),0,n),loop:i.loop??!1,speed:typeof i.speed==`number`&&i.speed>0?i.speed:1}}function wA(e,t,n){let r=Math.abs(e.to-e.from),i=e.to>=e.from?1:-1,a=n===void 0?0:Math.abs(n-e.from),o=r<=0?0:YS(Math.max(0,t*e.speed+a),r,e.loop);return e.from+i*o}function TA(e,t,n){let r=Math.max(e.duration||0,.001),i=n&&n!==`seek`&&n!==`timeline`&&e.segments?.[n]?n:``;if(!i)for(let n of Object.keys(e.segments??{})){let a=CA(e,n);if(!a)continue;let o=Math.min(a.from,a.to),s=Math.max(a.from,a.to);if(t>=o&&(t<s||s>=r-1e-6&&t<=s)){i=n;break}}let a=``,o=-1/0;for(let[n,r]of Object.entries(e.markers??{}))typeof r==`number`&&r<=t+1e-6&&r>=o&&(o=r,a=n);return{time:t,duration:r,progress:xA(t/r,0,1),segment:i,marker:a}}var EA=class{def;hoverClock=0;clickAt=-1;active=null;toggled=/* @__PURE__ */ new Map;prevLocal=null;lastLocal=0;lastT=0;pending=[];constructor(e){this.def=e}get duration(){return Math.max(this.def.duration||0,.001)}reset(){this.hoverClock=0,this.clickAt=-1,this.active=null,this.toggled.clear(),this.prevLocal=null,this.lastLocal=0,this.lastT=0,this.pending=[]}get local(){return this.lastLocal}play(e,t,n={}){let r=CA(this.def,e);if(!r)return!1;let i=n.reverse?{...r,from:r.to,to:r.from}:r;return this.active={...i,name:e,start:t},this.toggled.set(e,!n.reverse),!0}toggle(e,t){let n=CA(this.def,e);if(!n)return!1;let r=!this.toggled.get(e),i=r?n:{...n,from:n.to,to:n.from},a=this.active?.name===e?this.lastLocal:void 0,o=a!==void 0&&a>=Math.min(n.from,n.to)&&a<=Math.max(n.from,n.to);return this.active={...i,loop:!1,name:e,start:t,startLocal:o?a:void 0},this.toggled.set(e,r),!0}seek(e,t){let n=xA(SA(e,this.def.markers,0),0,this.duration);this.active={name:`seek`,from:n,to:n,loop:!1,speed:1,start:t}}autoRange(){let e=typeof this.def.autoplay==`string`?this.def.autoplay:null,t=e?CA(this.def,e):null,n=typeof this.def.speed==`number`&&this.def.speed>0?this.def.speed:1;return t?{...t,speed:t.speed*n}:{from:0,to:this.duration,loop:this.def.loop,speed:n}}autoLocal(e){let t=this.autoRange(),n=this.def.trigger??`visible`;if(e.staticMotion)return typeof this.def.autoplay==`string`?t.to:wA({...t,speed:1},e.posterTime??0);if(n===`manual`||this.def.autoplay===!1)return t.from;if(n===`scroll`)return t.from+(t.to-t.from)*xA(e.scroll,0,1);if(e.deterministic)return wA(t,e.t);switch(n){case`hover`:{this.hoverClock+=e.hovered?e.dt:t.loop?0:-e.dt;let n=Math.abs(t.to-t.from)/t.speed;return t.loop||(this.hoverClock=xA(this.hoverClock,0,n)),wA(t,this.hoverClock)}case`click`:return e.clicked&&(this.clickAt=e.t),this.clickAt<0?t.from:wA(t,e.t-this.clickAt);default:return wA(t,e.t)}}update(e){let t;return t=this.active&&!e.staticMotion?wA(this.active,Math.max(0,e.t-this.active.start),this.active.startLocal):this.autoLocal(e),t=xA(t,0,this.duration),this.collectMarkers(this.prevLocal,t,e.t<this.lastT),this.prevLocal=t,this.lastLocal=t,this.lastT=e.t,t}collectMarkers(e,t,n){let r=this.def.markers;if(r&&!n)for(let[n,i]of Object.entries(r)){if(typeof i!=`number`)continue;let r;r=e===null?i<=t:t>e?i>e&&i<=t:t<e?this.isLoopingForward()?i>e||i<=t:i<e&&i>=t:!1,r&&this.pending.push({name:n,time:i})}}isLoopingForward(){let e=this.active??this.autoRange();return!!e.loop&&e.loop!==`pingpong`&&e.to>=e.from}info(){return TA(this.def,this.lastLocal,this.active?.name)}drainMarkers(){let e=this.pending;return this.pending=[],e}};function DA(e,t){if(typeof e!=`string`||!e.trim())return null;try{let n=new URL(e.trim(),t);return n.protocol===`http:`||n.protocol===`https:`?n.href:null}catch{return null}}var OA=/* @__PURE__ */ new Set([`click`,`key`]),kA=class{defs;host;hoverPrev=/* @__PURE__ */ new Set;insidePrev=!1;scrollPrev=null;visibleFired=!1;fired=/* @__PURE__ */ new Set;queue=[];constructor(e,t){this.defs=e,this.host=t}targets(){let e=/* @__PURE__ */ new Set;for(let t of this.defs)t.target&&(t.on===`click`||t.on===`hover`||t.on===`hoverEnd`)&&e.add(t.target);return e}reset(){this.hoverPrev.clear(),this.insidePrev=!1,this.scrollPrev=null,this.visibleFired=!1,this.fired.clear(),this.queue=[]}event(e,t){this.queue.length<64&&this.queue.push({name:e,payload:t})}fire(e,t,n){let r=0;return this.defs.forEach((i,a)=>{if(i.on===e&&!(e===`key`?i.key!==t:e===`event`?i.event!==t:(i.target??void 0)!==t)&&!(i.once&&this.fired.has(a))){this.fired.add(a),r++;for(let t of i.do??[])this.run(t,n&&OA.has(e))}}),r}step(e){for(let t of this.targets()){let n=e.hovered.has(t),r=this.hoverPrev.has(t);n&&!r&&this.fire(`hover`,t,!1),!n&&r&&this.fire(`hoverEnd`,t,!1)}this.hoverPrev=new Set([...e.hovered].filter(e=>this.isTarget(e))),e.pointerInside!==this.insidePrev&&this.fire(e.pointerInside?`hover`:`hoverEnd`,void 0,!1),this.insidePrev=e.pointerInside;for(let t of e.clicked)this.fire(`click`,t,e.userGesture);e.canvasClicked&&this.fire(`click`,void 0,e.userGesture);for(let t of e.pressed)this.fire(`key`,t,e.userGesture);e.visible&&!this.visibleFired&&(this.visibleFired=!0,this.fire(`visible`,void 0,!1)),this.scrollPrev!==null&&e.scroll!==this.scrollPrev&&this.defs.forEach((t,n)=>{if(t.on===`scroll`&&typeof t.at==`number`&&!(!(this.scrollPrev<t.at&&e.scroll>=t.at)||t.once&&this.fired.has(n))){this.fired.add(n);for(let e of t.do??[])this.run(e,!1)}}),this.scrollPrev=e.scroll,this.flush()}flush(){for(let e=0;this.queue.length&&e<16;e++){let e=this.queue;this.queue=[];for(let t of e)this.fire(`event`,t.name,!1)}this.queue=[]}isTarget(e){return this.defs.some(t=>t.target===e)}run(e,t){let n=e;if(typeof n.play==`string`)this.host.play(n.play,n.reverse===!0);else if(typeof n.toggle==`string`)this.host.toggle(n.toggle);else if(typeof n.seek==`number`||typeof n.seek==`string`)this.host.seek(n.seek);else if(n.set&&typeof n.set==`object`){let e=n.set;typeof e.path==`string`&&e.value!==void 0&&this.host.set(e.path,e.value,typeof n.duration==`number`?n.duration:0,typeof n.ease==`string`?n.ease:void 0)}else typeof n.emit==`string`?this.host.emit(n.emit,n.payload):typeof n.openUrl==`string`?t?this.host.openUrl(n.openUrl,typeof n.newTab==`boolean`?n.newTab:void 0):this.host.emit(`openUrl`,{url:n.openUrl,blocked:!0}):n.playClip!==void 0&&typeof n.target==`string`&&this.host.playClip(n.target,n.playClip,{loop:n.loop,speed:n.speed,crossfade:n.crossfade})}},AA=`top bottom`,jA=`bottom top`;function MA(e,t){return e===`top`?0:e===`center`?t/2:e===`bottom`?t:e.endsWith(`%`)?Number(e.slice(0,-1))/100*t:e.endsWith(`px`)?Number(e.slice(0,-2)):null}function NA(e,t,n){let r=e.trim().split(/\s+/);if(r.length!==2)return null;let i=MA(r[0],t),a=MA(r[1],n);return i===null||a===null?null:i-a}function PA(e,t,n,r=AA,i=jA){let a=NA(r,t,n)??-n,o=NA(i,t,n)??t,s=0-e;if(Math.abs(o-a)<1e-6)return+(s>=o);let c=(s-a)/(o-a);return c<0?0:c>1?1:c}J();var FA=8e3;function IA(e,t,n=FA){let r=[],i=0;if(e.traverseVisible(e=>{let t=e;if(!(t.isMesh||e.isLine)||e.isPoints)return;let n=t.geometry?.getAttribute(`position`);if(!n)return;let a=t.isInstancedMesh?t.count:1;a&&(r.push(t),i+=n.count*a)}),!r.length||!i)return null;let a=Math.max(1,Math.ceil(i/n)),o=new B,s=new V,c=new V,l=0,u=0;for(let e of r){let n=e.geometry.getAttribute(`position`),r=e,i=e.isSkinnedMesh?e:null,d=r.isInstancedMesh?r.count:1;for(let f=0;f<d;f++){r.isInstancedMesh?c.multiplyMatrices(e.matrixWorld,(r.getMatrixAt(f,s),s)):c.copy(e.matrixWorld);for(let e=f%a;e<n.count;e+=a)if(o.fromBufferAttribute(n,e),i&&i.applyBoneTransform(e,o),o.applyMatrix4(c),t.containsPoint(o)?l++:u++,l&&u)return`partial`}}return!l&&!u?null:u?`partial`:`full`}function LA(e,t,n){if(n!==`parts`){let r=e.worldToLocal(t.clone()),i=n.heightAt(r.x,r.z);return Number.isFinite(i)&&r.y<i}let r=new Wa,i=new V,a=!1;return e.traverseVisible(e=>{let n=e;if(a||!n.isMesh||!n.geometry)return;n.geometry.boundingBox||n.geometry.computeBoundingBox();let o=n.geometry.boundingBox,s=e;if(s.isInstancedMesh)for(let e=0;e<s.count&&!a;e++)s.getMatrixAt(e,i),r.copy(o).applyMatrix4(i.premultiply(s.matrixWorld)).containsPoint(t)&&(a=zA(n,t,r,e));else r.copy(o).applyMatrix4(n.matrixWorld).containsPoint(t)&&(a=zA(n,t,r))}),a}var RA=[new B(1,0,0),new B(-1,0,0),new B(0,1,0),new B(0,-1,0),new B(0,0,1),new B(0,0,-1)];function zA(e,t,n,r){let i=(Array.isArray(e.material)?e.material:[e.material]).filter(Boolean),a=i.map(e=>e.side);for(let e of i)e.side=2;try{let i=new of;return i.far=n.getSize(new B).length()+.001,RA.every(n=>(i.set(t,n),i.intersectObject(e,!1).some(e=>r===void 0||e.instanceId===r)))}finally{i.forEach((e,t)=>e.side=a[t])}}function BA(e,t,n){let r=e.createGain();return r.gain.value=Math.max(0,n),r.connect(t),{ctx:e,out:r,sources:[],timers:[],stopped:!1}}function VA(e,t=.06){if(e.stopped)return;e.stopped=!0;for(let t of e.timers)clearTimeout(t);let n=e.ctx.currentTime;try{e.out.gain.cancelScheduledValues(n),e.out.gain.setValueAtTime(e.out.gain.value,n),e.out.gain.linearRampToValueAtTime(0,n+t)}catch{}for(let r of e.sources)try{r.stop(n+t+.02)}catch{}setTimeout(()=>{try{e.out.disconnect()}catch{}},(t+.1)*1e3)}function HA(e,t){return e.timers.push(setTimeout(()=>VA(e,.01),(t+.2)*1e3)),{stop:()=>VA(e)}}function UA(e,t){let{ctx:n}=e,r=n.currentTime+(t.start??0),i=n.createOscillator();i.type=t.type??`square`,i.frequency.setValueAtTime(t.freq,r),t.to&&i.frequency.exponentialRampToValueAtTime(Math.max(1,t.to),r+t.dur),t.detune&&(i.detune.value=t.detune);let a=n.createGain(),o=t.gain??.3,s=t.attack??.005;a.gain.setValueAtTime(1e-4,r),a.gain.linearRampToValueAtTime(o,r+s);let c=Math.min(t.release??t.dur,t.dur);a.gain.setValueAtTime(o,r+Math.max(s,t.dur-c)),a.gain.exponentialRampToValueAtTime(1e-4,r+t.dur);let l=i;if(t.filter){let e=n.createBiquadFilter();e.type=t.filter.type,e.frequency.setValueAtTime(t.filter.freq,r),t.filter.to&&e.frequency.exponentialRampToValueAtTime(Math.max(10,t.filter.to),r+t.dur),e.Q.value=t.filter.q??1,i.connect(e),l=e}if(t.vibrato){let a=n.createOscillator();a.frequency.value=t.vibrato.rate;let o=n.createGain();o.gain.value=t.vibrato.depth,a.connect(o),o.connect(i.detune),a.start(r),a.stop(r+t.dur+.05),e.sources.push(a)}l.connect(a),a.connect(t.dest??e.out),i.start(r),i.stop(r+t.dur+.05),e.sources.push(i)}function WA(e){let t=qA.get(e);if(!t){t=e.createBuffer(1,Math.floor(e.sampleRate*2),e.sampleRate);let n=t.getChannelData(0),r=625341585;for(let e=0;e<n.length;e++)r^=r<<13,r^=r>>>17,r^=r<<5,n[e]=(r>>>0)/4294967296*2-1;qA.set(e,t)}return t}function GA(e,t){let{ctx:n}=e,r=n.currentTime+(t.start??0),i=n.createBufferSource();i.buffer=WA(n),i.loop=!0;let a=n.createGain(),o=t.gain??.3;a.gain.setValueAtTime(1e-4,r),a.gain.linearRampToValueAtTime(o,r+(t.attack??.003)),a.gain.exponentialRampToValueAtTime(1e-4,r+t.dur);let s=i;if(t.filter){let e=n.createBiquadFilter();e.type=t.filter.type,e.Q.value=t.filter.q??1,e.frequency.setValueAtTime(t.filter.freq,r),t.filter.mid&&e.frequency.exponentialRampToValueAtTime(t.filter.mid,r+t.dur*.45),t.filter.to&&e.frequency.exponentialRampToValueAtTime(t.filter.to,r+t.dur),i.connect(e),s=e}s.connect(a),a.connect(t.dest??e.out),i.start(r,r*.37%1.5),i.stop(r+t.dur+.05),e.sources.push(i)}function KA(e,t,n){let{ctx:r}=e,i=r.currentTime+.06,a=0,o=()=>{if(!e.stopped){for(;i<r.currentTime+.15;)n(a,i-r.currentTime),a++,i+=t;e.sources.length>400&&e.sources.splice(0,e.sources.length-200),e.timers.length=0,e.timers.push(setTimeout(o,40))}};o()}var qA,JA,YA=t((()=>{qA=/* @__PURE__ */ new WeakMap,JA=e=>440*2**((e-69)/12)})),XA=/* @__PURE__ */ n({SOUND_IMPLS:()=>uj}),ZA,QA,$A,ej,tj,nj,rj,ij,aj,oj,sj,cj,lj,uj,dj=t((()=>{YA(),ZA=(e,t)=>({play(n,r,i){let a=BA(n,r,i);return t(a),HA(a,e)}}),QA=ZA(.4,e=>{UA(e,{type:`square`,freq:JA(83),dur:.08,gain:.18,release:.02}),UA(e,{type:`square`,freq:JA(88),start:.075,dur:.32,gain:.18,release:.3}),UA(e,{type:`triangle`,freq:JA(100),start:.075,dur:.25,gain:.06,release:.24})}),$A=ZA(.3,e=>{UA(e,{type:`square`,freq:220,to:660,dur:.2,gain:.16,release:.12,filter:{type:`lowpass`,freq:2400}}),UA(e,{type:`triangle`,freq:330,to:990,dur:.18,gain:.12,release:.1})}),ej=ZA(.3,e=>{GA(e,{dur:.16,gain:.45,filter:{type:`lowpass`,freq:2200,to:300,q:.7}}),UA(e,{type:`sine`,freq:180,to:55,dur:.18,gain:.5,release:.15}),UA(e,{type:`square`,freq:120,to:60,dur:.08,gain:.12,release:.06})}),tj=ZA(1.6,e=>{GA(e,{dur:1.4,gain:.7,attack:.01,filter:{type:`lowpass`,freq:2600,to:90,q:.8}}),GA(e,{dur:.25,gain:.35,filter:{type:`highpass`,freq:1200,q:.5}}),UA(e,{type:`sine`,freq:90,to:28,dur:1.1,gain:.7,release:1}),UA(e,{type:`triangle`,freq:60,to:30,start:.05,dur:.8,gain:.3,release:.7})}),nj=ZA(.1,e=>{UA(e,{type:`sine`,freq:1700,to:900,dur:.035,gain:.25,release:.03}),GA(e,{dur:.02,gain:.12,filter:{type:`highpass`,freq:4e3}})}),rj=ZA(.8,e=>{let t=[60,64,67,72,76,79,84];t.forEach((t,n)=>{UA(e,{type:`square`,freq:JA(t),start:n*.06,dur:.1,gain:.13,release:.06,filter:{type:`lowpass`,freq:3500}}),UA(e,{type:`triangle`,freq:JA(t+12),start:n*.06+.02,dur:.12,gain:.07,release:.1})}),UA(e,{type:`square`,freq:JA(84),start:t.length*.06,dur:.3,gain:.1,release:.28,vibrato:{rate:9,depth:35},filter:{type:`lowpass`,freq:3e3}})}),ij=ZA(.35,e=>{UA(e,{type:`sawtooth`,freq:1800,to:160,dur:.24,gain:.16,release:.2,filter:{type:`bandpass`,freq:2400,to:400,q:2}}),UA(e,{type:`square`,freq:1200,to:120,dur:.18,gain:.07,release:.15})}),aj=ZA(1.6,e=>{let t=[72,76,79,84];t.forEach((t,n)=>{UA(e,{type:`square`,freq:JA(t),start:n*.12,dur:.14,gain:.12,release:.08,filter:{type:`lowpass`,freq:3200}}),UA(e,{type:`triangle`,freq:JA(t-12),start:n*.12,dur:.14,gain:.15,release:.1})});let n=t.length*.12+.04;for(let t of[79,84,88])UA(e,{type:`square`,freq:JA(t),start:n,dur:.9,gain:.08,attack:.01,release:.7,vibrato:{rate:6,depth:12},filter:{type:`lowpass`,freq:2800}});UA(e,{type:`triangle`,freq:JA(60),start:n,dur:.9,gain:.2,release:.6})}),oj=ZA(1.6,e=>{[67,66,65].forEach((t,n)=>UA(e,{type:`sawtooth`,freq:JA(t),start:n*.25,dur:.24,gain:.12,release:.1,filter:{type:`lowpass`,freq:1400}})),UA(e,{type:`sawtooth`,freq:JA(64),to:JA(52),start:.75,dur:.8,gain:.13,release:.5,vibrato:{rate:7,depth:40},filter:{type:`lowpass`,freq:1400,to:400}}),UA(e,{type:`triangle`,freq:JA(40),start:.75,dur:.8,gain:.18,release:.6})}),sj=ZA(.8,e=>{GA(e,{dur:.65,gain:.45,attack:.25,filter:{type:`bandpass`,freq:300,mid:2600,to:500,q:1.4}}),GA(e,{dur:.5,gain:.15,attack:.2,filter:{type:`lowpass`,freq:600,to:200}})}),cj={play(e,t,n){let r=BA(e,t,n),i=e.createBiquadFilter();i.type=`lowpass`,i.frequency.value=900,i.Q.value=.6;let a=e.createOscillator();a.frequency.value=.07;let o=e.createGain();o.gain.value=450,a.connect(o),o.connect(i.frequency),a.start(),r.sources.push(a);let s=e.createDelay(1);s.delayTime.value=.42;let c=e.createGain();c.gain.value=.38,s.connect(c),c.connect(s),i.connect(r.out),i.connect(s),s.connect(r.out);let l=[[48,55,59,64],[45,52,55,60],[41,48,52,57],[43,50,55,59]];return KA(r,4,(e,t)=>{let n=l[e%l.length];for(let e of n)for(let n of[-7,7])UA(r,{type:`sawtooth`,freq:JA(e),start:t,dur:5.6,gain:.035,attack:1.4,release:1.8,detune:n,dest:i});UA(r,{type:`sine`,freq:JA(n[0]-12),start:t,dur:5.2,gain:.12,attack:1,release:1.5}),UA(r,{type:`triangle`,freq:JA(n[3]+24),start:t+1.3,dur:1.5,gain:.025,attack:.05,release:1.4,dest:s})}),{stop:()=>VA(r,.8)}}},lj={play(e,t,n){let r=BA(e,t,n),i=[72,0,76,79,84,0,79,76,77,0,76,74,72,0,74,76,69,0,72,76,81,0,79,76,77,76,74,72,74,0,0,0,77,0,81,84,89,0,84,81,79,0,77,76,77,0,79,81,79,0,83,86,91,0,86,83,84,0,83,81,79,0,74,0],a=[48,45,41,43],o=60/140/4;return KA(r,o,(e,t)=>{let n=e%64,s=i[n];s&&UA(r,{type:`square`,freq:JA(s),start:t,dur:o*1.6,gain:.075,release:o*1.2,filter:{type:`lowpass`,freq:3800}});let c=a[Math.floor(n/16)];if(n%2==0){let e=c+(n/2%4==3?7:n/2%2?12:0);UA(r,{type:`triangle`,freq:JA(e-12),start:t,dur:o*1.8,gain:.22,release:o*1.2})}n%4==2&&UA(r,{type:`square`,freq:JA(c+24+(n/4%2?4:7)),start:t,dur:o*.8,gain:.03,release:o*.6}),n%4==0&&UA(r,{type:`sine`,freq:150,to:45,start:t,dur:.12,gain:.35,release:.1}),n%8==4&&GA(r,{start:t,dur:.12,gain:.16,filter:{type:`bandpass`,freq:1800,q:.8}}),n%2==1&&GA(r,{start:t,dur:.035,gain:.06,filter:{type:`highpass`,freq:7e3}})}),{stop:()=>VA(r,.1)}}},uj={coin:QA,jump:$A,hit:ej,explosion:tj,click:nj,powerup:rj,laser:ij,win:aj,lose:oj,whoosh:sj,"ambient-pad":cj,"chiptune-loop":lj}}));function fj(e,t,n){let r=null,i=null,a=!!e?.muted,o=null,s=/* @__PURE__ */ new Map,c=null,l=!!e?.music,u=()=>Promise.resolve().then(()=>(dj(),XA)).then(e=>o=e.SOUND_IMPLS).catch(()=>o={}),d=e=>{let i=s.get(e);if(!i&&r){let a=r;i=fetch(t(e)).then(e=>e.arrayBuffer()).then(e=>a.decodeAudioData(e)).catch(t=>(n(t.message,e),null)),s.set(e,i)}return i??Promise.resolve(null)},f=(e,t=!1)=>{if(!r||!i)return null;let n=e.volume??1;if(e.preset){let t=o?.[e.preset];return t?t.play(r,i,n):null}if(e.src){let a=r,o=i,s=null,c=!1;return d(e.src).then(e=>{if(!e||c)return;s=a.createBufferSource(),s.buffer=e,s.loop=t;let r=a.createGain();r.gain.value=n,s.connect(r).connect(o),s.start()}),{stop(){c=!0;try{s?.stop()}catch{}}}}return null},p=()=>{!c&&e?.music&&!a&&r&&(c=f(e.music,e.music.loop!==!1))};return u(),{play(t){if(a||!r)return;let n=e?.sounds?.[t];n?f(n):o?.[t]&&o[t].play(r,i,1)},music(e){l=e,e?p():(c?.stop(),c=null)},muted:()=>a,setMuted(t){a=t,i&&r&&i.gain.setTargetAtTime(+!t,r.currentTime,.02),t?(c?.stop(),c=null):(l||e?.music)&&(l=!0,p())},unlock(){if(r){r.state===`suspended`&&r.resume();return}let e=globalThis.AudioContext??globalThis.webkitAudioContext;if(e)try{r=new e,i=r.createGain(),i.gain.value=+!a,i.connect(r.destination),l&&p()}catch(e){n(e.message)}},dispose(){c?.stop(),r?.close().catch(()=>void 0),r=null}}}var pj=t((()=>{}));function mj(e){if(!/^[0-9a-f]+$/i.test(e)||((e.length===3||e.length===4)&&(e=[...e].map(e=>e+e).join(``)),e.length!==6&&e.length!==8))return null;let t=t=>parseInt(e.slice(t,t+2),16);return{r:t(0),g:t(2),b:t(4),a:e.length===8?t(6)/255:1}}function hj(e,t){let n=/^(-?\d*\.?\d+(?:e-?\d+)?)(%?)$/i.exec(e.trim());if(!n)return null;let r=Number(n[1]);return n[2]?r/100*t:r}function gj(e){let t=/^(-?\d*\.?\d+)(deg|rad|turn|grad)?$/i.exec(e.trim());if(!t)return null;let n=Number(t[1]);switch((t[2]??`deg`).toLowerCase()){case`rad`:return n*180/Math.PI;case`turn`:return n*360;case`grad`:return n*.9;default:return n}}function _j(e){let t=e.split(`/`);if(t.length>2)return null;let n=(t[0].includes(`,`)?t[0].split(`,`):t[0].trim().split(/\s+/)).map(e=>e.trim()).filter(e=>e!==``);return t.length===2&&n.push(t[1].trim()),n}function vj(e,t,n){e=(e%360+360)%360;let r=(1-Math.abs(2*n-1))*t,i=r*(1-Math.abs(e/60%2-1)),a=n-r/2,[o,s,c]=e<60?[r,i,0]:e<120?[i,r,0]:e<180?[0,r,i]:e<240?[0,i,r]:e<300?[i,0,r]:[r,0,i];return[(o+a)*255,(s+a)*255,(c+a)*255]}function yj(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase();if(!t)return null;if(t.startsWith(`#`))return mj(t.slice(1));if(t===`transparent`)return{r:0,g:0,b:0,a:0};let n=Cj[t];if(n)return mj(n);let r=/^(rgba?|hsla?)\((.*)\)$/.exec(t);if(!r)return null;let i=_j(r[2]);if(!i||i.length!==3&&i.length!==4)return null;let a=i.length===4?hj(i[3],1):1;if(a===null)return null;if(r[1].startsWith(`rgb`)){let[e,t,n]=i.slice(0,3).map(e=>hj(e,255));return e===null||t===null||n===null?null:{r:wj(e,0,255),g:wj(t,0,255),b:wj(n,0,255),a:wj(a,0,1)}}let o=gj(i[0]),s=hj(i[1],1),c=hj(i[2],1);if(o===null||s===null||c===null||!i[1].trim().endsWith(`%`)||!i[2].trim().endsWith(`%`))return null;let[l,u,d]=vj(o,wj(s,0,1),wj(c,0,1));return{r:l,g:u,b:d,a:wj(a,0,1)}}function bj(e){let t=e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*t(e.r)+.7152*t(e.g)+.0722*t(e.b)}function xj(e,t){let n=bj(e),r=bj(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Sj(e){let t=yj(e);return t?xj(t,{r:255,g:255,b:255,a:1})>=xj(t,{r:17,g:19,b:24,a:1})?`#ffffff`:`#111318`:`#ffffff`}var Cj,wj,Tj=t((()=>{Cj={aliceblue:`f0f8ff`,antiquewhite:`faebd7`,aqua:`00ffff`,aquamarine:`7fffd4`,azure:`f0ffff`,beige:`f5f5dc`,bisque:`ffe4c4`,black:`000000`,blanchedalmond:`ffebcd`,blue:`0000ff`,blueviolet:`8a2be2`,brown:`a52a2a`,burlywood:`deb887`,cadetblue:`5f9ea0`,chartreuse:`7fff00`,chocolate:`d2691e`,coral:`ff7f50`,cornflowerblue:`6495ed`,cornsilk:`fff8dc`,crimson:`dc143c`,cyan:`00ffff`,darkblue:`00008b`,darkcyan:`008b8b`,darkgoldenrod:`b8860b`,darkgray:`a9a9a9`,darkgreen:`006400`,darkgrey:`a9a9a9`,darkkhaki:`bdb76b`,darkmagenta:`8b008b`,darkolivegreen:`556b2f`,darkorange:`ff8c00`,darkorchid:`9932cc`,darkred:`8b0000`,darksalmon:`e9967a`,darkseagreen:`8fbc8f`,darkslateblue:`483d8b`,darkslategray:`2f4f4f`,darkslategrey:`2f4f4f`,darkturquoise:`00ced1`,darkviolet:`9400d3`,deeppink:`ff1493`,deepskyblue:`00bfff`,dimgray:`696969`,dimgrey:`696969`,dodgerblue:`1e90ff`,firebrick:`b22222`,floralwhite:`fffaf0`,forestgreen:`228b22`,fuchsia:`ff00ff`,gainsboro:`dcdcdc`,ghostwhite:`f8f8ff`,gold:`ffd700`,goldenrod:`daa520`,gray:`808080`,green:`008000`,greenyellow:`adff2f`,grey:`808080`,honeydew:`f0fff0`,hotpink:`ff69b4`,indianred:`cd5c5c`,indigo:`4b0082`,ivory:`fffff0`,khaki:`f0e68c`,lavender:`e6e6fa`,lavenderblush:`fff0f5`,lawngreen:`7cfc00`,lemonchiffon:`fffacd`,lightblue:`add8e6`,lightcoral:`f08080`,lightcyan:`e0ffff`,lightgoldenrodyellow:`fafad2`,lightgray:`d3d3d3`,lightgreen:`90ee90`,lightgrey:`d3d3d3`,lightpink:`ffb6c1`,lightsalmon:`ffa07a`,lightseagreen:`20b2aa`,lightskyblue:`87cefa`,lightslategray:`778899`,lightslategrey:`778899`,lightsteelblue:`b0c4de`,lightyellow:`ffffe0`,lime:`00ff00`,limegreen:`32cd32`,linen:`faf0e6`,magenta:`ff00ff`,maroon:`800000`,mediumaquamarine:`66cdaa`,mediumblue:`0000cd`,mediumorchid:`ba55d3`,mediumpurple:`9370db`,mediumseagreen:`3cb371`,mediumslateblue:`7b68ee`,mediumspringgreen:`00fa9a`,mediumturquoise:`48d1cc`,mediumvioletred:`c71585`,midnightblue:`191970`,mintcream:`f5fffa`,mistyrose:`ffe4e1`,moccasin:`ffe4b5`,navajowhite:`ffdead`,navy:`000080`,oldlace:`fdf5e6`,olive:`808000`,olivedrab:`6b8e23`,orange:`ffa500`,orangered:`ff4500`,orchid:`da70d6`,palegoldenrod:`eee8aa`,palegreen:`98fb98`,paleturquoise:`afeeee`,palevioletred:`db7093`,papayawhip:`ffefd5`,peachpuff:`ffdab9`,peru:`cd853f`,pink:`ffc0cb`,plum:`dda0dd`,powderblue:`b0e0e6`,purple:`800080`,rebeccapurple:`663399`,red:`ff0000`,rosybrown:`bc8f8f`,royalblue:`4169e1`,saddlebrown:`8b4513`,salmon:`fa8072`,sandybrown:`f4a460`,seagreen:`2e8b57`,seashell:`fff5ee`,sienna:`a0522d`,silver:`c0c0c0`,skyblue:`87ceeb`,slateblue:`6a5acd`,slategray:`708090`,slategrey:`708090`,snow:`fffafa`,springgreen:`00ff7f`,steelblue:`4682b4`,tan:`d2b48c`,teal:`008080`,thistle:`d8bfd8`,tomato:`ff6347`,turquoise:`40e0d0`,violet:`ee82ee`,wheat:`f5deb3`,white:`ffffff`,whitesmoke:`f5f5f5`,yellow:`ffff00`,yellowgreen:`9acd32`},wj=(e,t,n)=>Math.min(n,Math.max(t,e))}));function Ej(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(/\s/.test(r)){n++;continue}if(/[0-9]/.test(r)||r===`-`&&/[0-9]/.test(e[n+1]??``)&&(t.length===0||t[t.length-1].t===`op`)){let r=n+1;for(;r<e.length&&/[0-9.]/.test(e[r]);)r++;t.push({t:`num`,v:Number(e.slice(n,r))}),n=r;continue}if(r===`'`||r===`"`){let i=n+1,a=``;for(;i<e.length&&e[i]!==r;)e[i]===`\\`&&i+1<e.length&&i++,a+=e[i++];if(i>=e.length)throw Error(`Unterminated string`);t.push({t:`str`,v:a}),n=i+1;continue}if(/[A-Za-z_$]/.test(r)){let r=n+1;for(;r<e.length&&/[A-Za-z0-9_$.]/.test(e[r]);)r++;t.push({t:`id`,v:e.slice(n,r)}),n=r;continue}let i=e.slice(n,n+3),a=e.slice(n,n+2);if(i===`===`||i===`!==`)t.push({t:`op`,v:i.slice(0,2)}),n+=3;else if([`==`,`!=`,`>=`,`<=`,`&&`,`||`].includes(a))t.push({t:`op`,v:a}),n+=2;else if(`!<>()`.includes(r))t.push({t:`op`,v:r}),n++;else throw Error(`Unexpected "${r}"`)}return t}function Dj(e,t){let n=t.split(`.`);n[0]===`state`&&n.shift();let r=e;for(let e of n){if(jj.has(e)||typeof r!=`object`||!r||!Object.prototype.hasOwnProperty.call(r,e))return;r=r[e]}return r}function Oj(e,t){let n=Ej(e),r=0,i=()=>n[r],a=e=>i()?.t===`op`&&i().v===e;function o(){let e=n[r++];if(!e)throw Error(`Unexpected end`);if(e.t===`num`||e.t===`str`)return e.v;if(e.t===`id`)return e.v===`true`?!0:e.v===`false`?!1:e.v===`null`||e.v===`undefined`?null:Dj(t,e.v);if(e.v===`(`){let e=u();if(!a(`)`))throw Error(`Missing )`);return r++,e}throw Error(`Unexpected "${e.v}"`)}function s(){let e=o(),t=i();if(t?.t===`op`&&[`==`,`!=`,`>`,`<`,`>=`,`<=`].includes(t.v)){r++;let n=o(),i=e,a=n;switch(t.v){case`==`:return e==n||e==null&&n==null;case`!=`:return e!=n;case`>`:return i>a;case`<`:return i<a;case`>=`:return i>=a;default:return i<=a}}return e}function c(){return a(`!`)?(r++,!c()):s()}function l(){let e=c();for(;a(`&&`);){r++;let t=c();e&&=t}return e}function u(){let e=l();for(;a(`||`);){r++;let t=l();e||=t}return e}let d=u();if(r<n.length)throw Error(`Unexpected "${n[r].v}"`);return d}function kj(e,t){if(e===void 0)return!0;if(typeof e==`boolean`)return e;try{return!!Oj(e,t)}catch{return!1}}function Aj(e,t){return e.replace(/\{([^{}]+)\}/g,(e,n)=>{let r=n.trim(),i;try{i=/^[A-Za-z_$][A-Za-z0-9_$.]*$/.test(r)?Dj(t,r):Oj(r,t)}catch{i=void 0}return i==null?``:String(typeof i==`number`?Number.isInteger(i)?i:Math.round(i*100)/100:i)})}var jj,Mj=t((()=>{jj=/* @__PURE__ */ new Set([`__proto__`,`prototype`,`constructor`])}));function Nj(e,t,n){let r=e.ownerDocument,i=r.createElement(`div`);i.className=`a3d-hud`,i.setAttribute(`aria-live`,`polite`);let a=r.createElement(`style`),o=t?.accent??`#ff006e`;a.textContent=Ij(t?.font??`system-ui,-apple-system,'Segoe UI',Roboto,sans-serif`,t?.color??`#ffffff`,o,t?.buttonText??Sj(o)),i.appendChild(a);let s=/* @__PURE__ */ new Map,c=e=>{let t=s.get(e);return t||(t=r.createElement(`div`),t.className=`a3d-zone`,t.style.cssText=Pj[e]??Pj[`top-left`],t.dataset.anchor=e,i.appendChild(t),s.set(e,t)),t},l=[[`top-left`,`top`,`top-right`],[`left`,`center`,`right`],[`bottom-left`,`bottom`,`bottom-right`]],u=()=>{for(let[e,t,n]of l){let r=s.get(t);r&&(r.style.gridColumn=s.has(e)||s.has(n)?`2`:`1 / -1`)}},d=/* @__PURE__ */ new Map;for(let e of t?.elements??[]){let t,i;if(e.type===`button`){let i=r.createElement(`button`);i.type=`button`,i.className=`a3d-btn`,i.addEventListener(`click`,t=>{t.stopPropagation(),e.action&&n(e.action)}),i.addEventListener(`pointerdown`,e=>e.stopPropagation()),t=i}else e.type===`bar`?(t=r.createElement(`div`),t.className=`a3d-bar`,i=r.createElement(`i`),t.appendChild(i)):(t=r.createElement(`div`),t.className=`a3d-el a3d-${e.style??`plain`}`);e.color&&(t.style.color=e.color,e.type===`bar`&&i&&(i.style.background=e.color)),e.background&&(t.style.background=e.background),e.type===`button`&&e.background&&!e.color&&(t.style.color=Sj(e.background)),t.dataset.id=e.id,c(e.anchor??`top-left`).appendChild(t),d.set(e.id,{def:e,node:t,fill:i,override:{},last:``})}u(),e.appendChild(i);let f=null,p=0,m=null,h=null,g=null;return{root:i,setTimeline(e){g=e},set(e,t){let n=d.get(e);n&&Object.assign(n.override,t)},toast(e,t=2){m={text:e,seconds:t}},update(e,t){let n=g&&!Object.prototype.hasOwnProperty.call(e,`timeline`)?{...e,timeline:g}:e;for(let e of d.values()){let t=e.override.visible??kj(e.def.visible,n);if(e.node.style.display=t?``:`none`,!t)continue;if(e.def.type===`bar`){let t=e.override.value??Number(e.def.value?Dj(n,e.def.value):0),r=Math.max(0,Math.min(1,Number.isFinite(t)?t:0));e.fill.style.width=`${(r*100).toFixed(1)}%`;continue}let r=e.override.text??Aj(e.def.text??``,n);r!==e.last&&(e.node.textContent=r,e.last=r)}m&&=(f||(f=r.createElement(`div`),f.className=`a3d-toast`,i.appendChild(f)),f.textContent=m.text,f.style.opacity=`1`,p=t+m.seconds,null),f&&t>p&&(f.style.opacity=`0`)},setMuteButton(e,t){e===null?(h?.remove(),h=null):(h||(h=r.createElement(`button`),h.type=`button`,h.className=`a3d-mute`,h.addEventListener(`pointerdown`,e=>e.stopPropagation()),h.addEventListener(`click`,e=>{e.stopPropagation(),t?.()}),c(`bottom-right`).appendChild(h),u()),h.innerHTML=e?Rj:Lj,h.setAttribute(`aria-label`,e?`Unmute sound`:`Mute sound`))},dispose(){i.remove()}}}var Pj,Fj,Ij,Lj,Rj,zj=t((()=>{Tj(),Mj(),Pj={"top-left":`grid-row:1;grid-column:1;align-items:flex-start;align-self:start;`,top:`grid-row:1;grid-column:2;align-items:center;align-self:start;text-align:center;`,"top-right":`grid-row:1;grid-column:3;align-items:flex-end;align-self:start;text-align:right;`,left:`grid-row:2;grid-column:1;align-items:flex-start;align-self:center;`,center:`grid-row:2;grid-column:2;align-items:center;align-self:center;text-align:center;`,right:`grid-row:2;grid-column:3;align-items:flex-end;align-self:center;text-align:right;`,"bottom-left":`grid-row:3;grid-column:1;align-items:flex-start;align-self:end;`,bottom:`grid-row:3;grid-column:2;align-items:center;align-self:end;text-align:center;`,"bottom-right":`grid-row:3;grid-column:3;align-items:flex-end;align-self:end;text-align:right;`},Fj=(e,t,n)=>`font-size:${n}px;font-size:clamp(${e}px,min(${t}cqw,${(t*1.6).toFixed(1)}cqh),${n}px)`,Ij=(e,t,n,r)=>`
5796
+ `)){if(l===1/0){c.push(Array.from(e));continue}let t=e.split(/ +/),n=[];for(let e of t){let t=n.length?[...n,` `,...Array.from(e)]:Array.from(e);n.length&&s(t).width>l?(c.push(n),n=Array.from(e)):n=t}c.push(n)}let u=[],d=[],f=0;return c.forEach((e,n)=>{for(;e.length&&e[e.length-1]===` `;)e.pop();let{xs:r,width:a}=s(e);f=Math.max(f,a);let o=t.align===`left`?0:t.align===`right`?-a:-a/2;e.forEach((e,t)=>{e.trim()&&u.push({ch:e,x:r[t]+o,line:n})}),d.push({width:a,y:-n*i})}),{glyphs:u,lines:d,lineHeight:i,width:f}}function $D(e){let t=e.data;if(t.capHeight&&t.resolution)return t.capHeight/t.resolution;let n=e.generateShapes(`H`,1);if(!n.length)return .72;let r=new Ol(n);r.computeBoundingBox();let i=r.boundingBox.max.y-r.boundingBox.min.y;return r.dispose(),i>0?i:.72}function eO(e,t){let n=e.data,r=Q(t.size,1),i=r/$D(e),a=Math.max(0,Q(t.depth,.2)),o=a>0?Math.max(0,Math.min(Q(t.bevel,Math.min(a*.3,r*.035)),a*.45,r*.08)):0,s=Math.round(Math.max(2,Math.min(32,Q(t.curveSegments,a>0?5+r*3:8+r*4)))),c=QD(n,{text:t.text,em:i,letterSpacing:t.letterSpacing,lineHeight:t.lineHeight,align:t.align??`center`,maxWidth:t.maxWidth,kerning:t.kerning});return{size:r,em:i,depth:a,bevel:o,curveSegments:s,layout:c,offsetY:-(r+(c.lines.length?c.lines[c.lines.length-1].y:0))/2,frontZ:a/2,backZ:-a/2}}function tO(e){let t=e.bevel;return{depth:Math.max(e.depth-t*2,1e-4),curveSegments:e.curveSegments,bevelEnabled:t>0,bevelThickness:t,bevelSize:t*.6,bevelOffset:0,bevelSegments:3}}function nO(e,t,n){let r=n.em/(n.curveSegments*5);return e.generateShapes(t,n.em).map(e=>zD(e,r,1,n.curveSegments))}function rO(e,t,n,r){let i=nO(e,t,n);if(!i.length)return null;if(n.depth<=0)return new Ol(i,n.curveSegments);let a=new xl(i,tO(n));return a.translate(0,0,n.backZ+n.bevel),a.clearGroups(),BD(a,50*Math.PI/180,r)}function iO(e,t){let n=e.outline;if(!n)return null;let r=n===!0?{}:n,i=Math.max(1e-4,Q(r.width,t.size*.06)),a=t.depth>0?t.depth*.5:t.size*.01,o=t.frontZ-a;return{width:i,frontZ:o,backZ:o-Math.max(Q(r.depth,t.depth>0?t.depth*.6:t.size*.01),1e-4),material:r.material,color:r.color??`#111111`}}function aO(e){let t=0;for(let n=0,r=e.length-1;n<e.length;r=n++)t+=(e[r].x-e[n].x)*(e[r].y+e[n].y);return t/2}function oO(e,t,n=2){let r=e.filter((t,n)=>{let r=e[(n+1)%e.length];return Math.hypot(r.x-t.x,r.y-t.y)>1e-9}),i=r.length,a=[];if(i<3)return r.map(e=>new z(e.x,e.y));let o=(e,t)=>{let n=t.x-e.x,r=t.y-e.y,i=Math.hypot(n,r)||1;return{x:r/i,y:-n/i}};for(let e=0;e<i;e++){let s=r[(e-1+i)%i],c=r[e],l=r[(e+1)%i],u=o(s,c),d=o(c,l),f=(c.x-s.x)*(l.y-c.y)-(c.y-s.y)*(l.x-c.x),p=u.x*d.x+u.y*d.y;if(f>0&&p<.995){let e=Math.atan2(u.y,u.x),n=Math.atan2(d.y,d.x);for(;n<e;)n+=Math.PI*2;for(;n>e+Math.PI*2;)n-=Math.PI*2;let r=Math.max(1,Math.ceil(Math.abs(n-e)/(Math.PI/8)));for(let i=0;i<=r;i++){let o=e+(n-e)*i/r;a.push(new z(c.x+Math.cos(o)*t,c.y+Math.sin(o)*t))}}else{let e=u.x+d.x,r=u.y+d.y,i=Math.hypot(e,r)||1;e/=i,r/=i;let o=Math.max(e*u.x+r*u.y,1/n);a.push(new z(c.x+e*t/o,c.y+r*t/o))}}return a}function sO(e,t){let n=[];for(let r of e){let{shape:e,holes:i}=r.extractPoints(1),a=e.slice();aO(a)<0&&(a=a.reverse());let o=new vl(oO(a,t));for(let e of i){let n=e.slice(),r=Math.abs(aO(n));aO(n)>0&&(n=n.reverse());let i=n.map(e=>e.x),a=n.map(e=>e.y);if(Math.max(...i)-Math.min(...i)<=2*t||Math.max(...a)-Math.min(...a)<=2*t)continue;let s=oO(n,t),c=aO(s);c<0&&-c>r*.02&&o.holes.push(new _l(s))}n.push(o)}return n}function cO(e,t,n,r,i){let a=nO(e,t,n);if(!a.length)return null;let o=new xl(sO(a,r.width),{depth:r.frontZ-r.backZ,curveSegments:1,bevelEnabled:!1});return o.translate(0,0,r.backZ),o.clearGroups(),BD(o,40*Math.PI/180,i)}function lO(e,t,n){let r=eO(e,t);return uO(r,t=>rO(e,t,r,n),n)}function uO(e,t,n){let r=/* @__PURE__ */ new Map,i=[];for(let n of e.layout.glyphs){r.has(n.ch)||r.set(n.ch,t(n.ch));let a=r.get(n.ch);if(!a)continue;let o=a.clone();o.translate(n.x,e.layout.lines[n.line].y+e.offsetY,0),i.push(o)}for(let e of r.values())e?.dispose();let a;if(!i.length)a=new G;else{a=(i.length===1?i[0].clone():n.mergeGeometries(i,!1))??new G;for(let e of i)e.dispose()}return a.computeBoundingBox(),a.computeBoundingSphere(),a}function dO(e,t,n){let r=Q(e.stagger,.04),i=t;if(e.order===`reverse`)i=n-1-t;else if(e.order===`center`)i=Math.abs(t-(n-1)/2);else if(e.order===`random`){let e=(t+1)*2654435761;e=(e^e>>>13)>>>0,i=e%1e3/1e3*(n-1)}return Q(e.delay,0)+i*r}function fO(e,t){return(n,r)=>{let i=e.effect??`rise`,a=Math.max(Q(e.duration,.6),.001),o=e.ease??(i===`scale`||i===`spin`?`outBack`:`outCubic`),s=i!==`scale`,c=[],l=[];if(s){let e=[];r.object.traverse(t=>{let n=t.material;if(n&&!t.userData.depthTwin){e.push(t);for(let e of Array.isArray(n)?n:[n])e.userData.baseOpacity===void 0&&(e.userData.baseOpacity=e.opacity),e.userData.baseTransparent===void 0&&(e.userData.baseTransparent=e.transparent),c.push(e)}});for(let t of e)l.push(pO(t))}return{update(e){let n=Math.min(Math.max(e/a,0),1),u=eS(o,n),d=r.object;if(s){let e=eS(`outCubic`,Math.min(1,n*1.6));for(let t of c)t.opacity=t.userData.baseOpacity*e,t.transparent=e<1||t.userData.baseTransparent;for(let t of l)t.visible=e>0&&e<1}switch(n<=0&&(d.visible=!1),i){case`rise`:d.position.y-=(1-u)*t*.6;break;case`drop`:d.position.y+=(1-u)*t*1.2;break;case`scale`:d.scale.multiplyScalar(Math.max(1e-4,u));break;case`spin`:d.rotation.y+=(1-u)*Math.PI,d.scale.multiplyScalar(Math.max(1e-4,Math.min(1,n*2)))}}}}}function pO(e){xO??=new ss({colorWrite:!1,depthWrite:!0});let t=new K(e.geometry,xO);return t.name=`${e.name}#depth`,t.visible=!1,t.castShadow=!1,t.receiveShadow=!1,t.renderOrder=-1,t.userData.helper=!0,t.userData.depthTwin=!0,e.add(t),t}function mO(e,t){let n=e.font??`sans-bold`;return t.resolveAsset(n.includes(`/`)||n.includes(`:`)?n:`library:fonts/${n}`)}function hO(e,t,n){let r=e.userData.gradient;r&&(r.uGradMin.value=t,r.uGradMax.value=n)}async function gO(e,t){let[n,r]=await Promise.all([XD(mO(e,t)),Promise.resolve().then(()=>(Wv(),kv))]),i=eO(n,e),a=iO(e,i),o=!!e.splitLetters||!!e.reveal,s=i.depth<=0,c=()=>yw(e.material,t,{defaultColor:`#ffffff`}),l=()=>a?yw(a.material??{color:a.color,roughness:.55},t):null,u=(i.layout.lines.length?i.layout.lines[i.layout.lines.length-1].y:0)+i.offsetY,d=i.size+i.offsetY,f=e=>(s&&(e.side=2),e);if(!o){let t=uO(i,e=>rO(n,e,i,r),r),o=f(await c());hO(o,u,d);let s=new K(t,o);if(a){let t=uO(i,e=>cO(n,e,i,a,r),r),o=await l();if(o){hO(o,u,d);let n=new K(t,o);n.name=`${e.id}/outline`,s.add(n)}}return{object:s,letters:[]}}let p=new ba,m=/* @__PURE__ */ new Map,h=/* @__PURE__ */ new Map,g=i.size/2,_=[],v=i.layout.glyphs.length,y=0;for(let t of i.layout.glyphs){if(!m.has(t.ch)){let e=rO(n,t.ch,i,r),o=0;if(e&&(e.computeBoundingBox(),o=(e.boundingBox.min.x+e.boundingBox.max.x)/2,e.translate(-o,-g,0),e.computeBoundingSphere()),m.set(t.ch,e),a){let e=cO(n,t.ch,i,a,r);e?.translate(-o,-g,0),h.set(t.ch,e)}e&&(e.userData.cx=o)}let o=m.get(t.ch);if(!o)continue;let s=o.userData.cx,b=i.layout.lines[t.line].y+i.offsetY,x=f(await c());hO(x,u-b-g,d-b-g);let S=new K(o,x);S.position.set(t.x+s,b+g,0);let C=`${e.id}/${y}`;S.name=C,S.userData.a3dId=C;let w=h.get(t.ch);if(w){let e=await l();if(e){hO(e,u-b-g,d-b-g);let t=new K(w,e);t.name=`${C}/outline`,S.add(t)}}p.add(S);let T={id:C,object:S,def:{id:C,kind:`text`,text:t.ch}};e.reveal&&(T.reveal={def:{type:`appear`,when:`visible`,delay:dO(e.reveal,y,v)},impl:fO(e.reveal,i.size)}),_.push(T),y++}return{object:p,letters:_}}async function _O(e,t){let[n,r]=await Promise.all([XD(mO(e,t)),Promise.resolve().then(()=>(Wv(),kv))]);return lO(n,e,r)}var vO,yO,bO,xO,SO=t((()=>{J(),yg(),wS(),zS(),HD(),jw(),vO=/* @__PURE__ */ new Map,yO=e=>{let t=e.normalize(`NFD`);return t.length>1?t[0]:e},bO=[`rise`,`fade`,`scale`,`spin`,`drop`],xO=null})),CO=/* @__PURE__ */ n({SVGLoader:()=>OO});function wO(e,t,n=256){if(!e||!Array.isArray(e.stops)||e.stops.length===0)return null;let r=t.userData.transform,i=e.gradientUnits===`objectBoundingBox`,a=null;if(i&&(a=TO(t,r),a===null))return null;function o(t,n,o){o.set(t,n,1),e.gradientTransform&&o.applyMatrix3(e.gradientTransform),i&&o.set(a.minX+o.x*a.width,a.minY+o.y*a.height,1),r&&o.applyMatrix3(r)}let s=document.createElement(`canvas`),c;if(e.type===`linearGradient`){s.width=n,s.height=1;let t=s.getContext(`2d`),r=t.createLinearGradient(0,0,n,0);EO(r,e.stops),t.fillStyle=r,t.fillRect(0,0,n,1);let i=new B,a=new B;o(e.x1,e.y1,i),o(e.x2,e.y2,a);let l=a.x-i.x,u=a.y-i.y,d=l*l+u*u||1e-20,f=l/d,p=u/d,m=-(f*i.x+p*i.y);c=new Di().set(f,p,m,0,0,.5,0,0,1)}else{let t=e.cx,o=e.cy,l=e.fx,u=e.fy,d=e.r;if(e.gradientTransform){let n=new B;n.set(t,o,1).applyMatrix3(e.gradientTransform),t=n.x,o=n.y,n.set(l,u,1).applyMatrix3(e.gradientTransform),l=n.x,u=n.y}if(i&&(t=a.minX+t*a.width,o=a.minY+o*a.height,l=a.minX+l*a.width,u=a.minY+u*a.height,d*=Math.sqrt((a.width*a.width+a.height*a.height)/2)),d<=0)return null;s.width=n,s.height=n;let f=s.getContext(`2d`),p=t-d,m=o-d,h=2*d,g=n/h;f.setTransform(g,0,0,g,-p*g,-m*g);let _=f.createRadialGradient(l,u,0,t,o,d);EO(_,e.stops),f.fillStyle=_,f.fillRect(p,m,h,h);let v=r?r.clone().invert():new Di;c=new Di().set(1/h,0,-p/h,0,1/h,-m/h,0,0,1).multiply(v)}let l=new Ic(s);l.colorSpace=DO,l.flipY=!1,l.matrixAutoUpdate=!1,l.matrix=c;let u=e.spreadMethod===`reflect`?sn:e.spreadMethod===`repeat`?an:on;return l.wrapS=u,l.wrapT=u,l}function TO(e,t){let n=t?t.clone().invert():null,r=new z,i=new ff;for(let t of e.subPaths)for(let e of t.getPoints())r.copy(e),n&&r.applyMatrix3(n),i.expandByPoint(r);return i.isEmpty()?null:{minX:i.min.x,minY:i.min.y,width:i.max.x-i.min.x,height:i.max.y-i.min.y}}function EO(e,t){let n=new H;for(let r of t){let t=r.color;if(r.opacity<1){n.setStyle(r.color,DO);let e=/rgb\(([^)]+)\)/.exec(n.getStyle(DO));e&&(t=`rgba(${e[1]},${r.opacity})`)}e.addColorStop(Math.max(0,Math.min(1,r.offset)),t)}}var DO,OO,kO,AO=t((()=>{J(),DO=Br,OO=class e extends gu{constructor(e){super(e),this.defaultDPI=90,this.defaultUnit=`px`}load(e,t,n,r){let i=this,a=new yu(i.manager);a.setPriority(i.priority),a.setCache(i.cache),a.setPath(i.path),a.setRequestHeader(i.requestHeader),a.setWithCredentials(i.withCredentials),a.load(e,function(n){try{t(i.parse(n))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}parse(e){let t=this;function n(e,t){if(e.nodeType!==1)return;e.hasAttribute(`filter`)&&console.warn(`THREE.SVGLoader: Filters are not supported.`);let a=b(e),o=!1,p=null;switch(e.nodeName){case`svg`:t=m(e,t);break;case`style`:i(e);break;case`g`:t=m(e,t);break;case`path`:t=m(e,t),e.hasAttribute(`d`)&&(p=r(e));break;case`rect`:t=m(e,t),p=s(e);break;case`polygon`:t=m(e,t),p=c(e);break;case`polyline`:t=m(e,t),p=l(e);break;case`circle`:t=m(e,t),p=u(e);break;case`ellipse`:t=m(e,t),p=d(e);break;case`line`:t=m(e,t),p=f(e);break;case`defs`:o=!0;break;case`use`:t=m(e,t);let a=(e.getAttributeNS(`http://www.w3.org/1999/xlink`,`href`)||e.getAttribute(`href`)||``).substring(1),h=e.viewportElement.getElementById(a);h?n(h,t):console.warn(`SVGLoader: 'use node' references non-existent node id: `+a)}if(p){t.fill!==void 0&&t.fill!==`none`&&!t.fill.startsWith(`url`)&&p.color.setStyle(t.fill,DO),C(p,ie),A.push(p);let n=Object.assign({},t);n.strokeWidth=t.strokeWidth*O(ie),p.userData={node:e,style:n,transform:ie.clone(),gradients:M}}let h=e.childNodes;for(let e=0;e<h.length;e++){let r=h[e];o&&r.nodeName!==`style`&&r.nodeName!==`defs`||n(r,t)}a&&(N.pop(),N.length>0?ie.copy(N[N.length-1]):ie.identity())}function r(e){let t=new Xf,n=new z,r=new z,i=new z,o=!1,s=e.getAttribute(`d`);if(s===``||s===`none`)return null;let c=s.match(/[a-df-z][^a-df-z]*/gi);for(let e=0,s=c.length;e<s;e++){let s=c[e],l=s.charAt(0),u=s.slice(1).trim();o===!0&&(l!==`M`&&l!==`m`&&l!==`Z`&&l!==`z`&&t.moveTo(i.x,i.y),o=!1);let d;switch(l){case`M`:d=g(u);for(let e=0,a=d.length;e<a;e+=2)n.x=d[e+0],n.y=d[e+1],r.x=n.x,r.y=n.y,e===0?t.moveTo(n.x,n.y):t.lineTo(n.x,n.y),e===0&&i.copy(n);break;case`H`:d=g(u);for(let e=0,i=d.length;e<i;e++)n.x=d[e],r.x=n.x,r.y=n.y,t.lineTo(n.x,n.y);break;case`V`:d=g(u);for(let e=0,i=d.length;e<i;e++)n.y=d[e],r.x=n.x,r.y=n.y,t.lineTo(n.x,n.y);break;case`L`:d=g(u);for(let e=0,i=d.length;e<i;e+=2)n.x=d[e+0],n.y=d[e+1],r.x=n.x,r.y=n.y,t.lineTo(n.x,n.y);break;case`C`:d=g(u);for(let e=0,i=d.length;e<i;e+=6)t.bezierCurveTo(d[e+0],d[e+1],d[e+2],d[e+3],d[e+4],d[e+5]),r.x=d[e+2],r.y=d[e+3],n.x=d[e+4],n.y=d[e+5];break;case`S`:d=g(u);for(let e=0,i=d.length;e<i;e+=4)t.bezierCurveTo(h(n.x,r.x),h(n.y,r.y),d[e+0],d[e+1],d[e+2],d[e+3]),r.x=d[e+0],r.y=d[e+1],n.x=d[e+2],n.y=d[e+3];break;case`Q`:d=g(u);for(let e=0,i=d.length;e<i;e+=4)t.quadraticCurveTo(d[e+0],d[e+1],d[e+2],d[e+3]),r.x=d[e+0],r.y=d[e+1],n.x=d[e+2],n.y=d[e+3];break;case`T`:d=g(u);for(let e=0,i=d.length;e<i;e+=2){let i=h(n.x,r.x),a=h(n.y,r.y);t.quadraticCurveTo(i,a,d[e+0],d[e+1]),r.x=i,r.y=a,n.x=d[e+0],n.y=d[e+1]}break;case`A`:d=g(u,[3,4],7);for(let e=0,i=d.length;e<i;e+=7){if(d[e+5]==n.x&&d[e+6]==n.y)continue;let i=n.clone();n.x=d[e+5],n.y=d[e+6],r.x=n.x,r.y=n.y,a(t,d[e],d[e+1],d[e+2],d[e+3],d[e+4],i,n)}break;case`m`:d=g(u);for(let e=0,a=d.length;e<a;e+=2)n.x+=d[e+0],n.y+=d[e+1],r.x=n.x,r.y=n.y,e===0?t.moveTo(n.x,n.y):t.lineTo(n.x,n.y),e===0&&i.copy(n);break;case`h`:d=g(u);for(let e=0,i=d.length;e<i;e++)n.x+=d[e],r.x=n.x,r.y=n.y,t.lineTo(n.x,n.y);break;case`v`:d=g(u);for(let e=0,i=d.length;e<i;e++)n.y+=d[e],r.x=n.x,r.y=n.y,t.lineTo(n.x,n.y);break;case`l`:d=g(u);for(let e=0,i=d.length;e<i;e+=2)n.x+=d[e+0],n.y+=d[e+1],r.x=n.x,r.y=n.y,t.lineTo(n.x,n.y);break;case`c`:d=g(u);for(let e=0,i=d.length;e<i;e+=6)t.bezierCurveTo(n.x+d[e+0],n.y+d[e+1],n.x+d[e+2],n.y+d[e+3],n.x+d[e+4],n.y+d[e+5]),r.x=n.x+d[e+2],r.y=n.y+d[e+3],n.x+=d[e+4],n.y+=d[e+5];break;case`s`:d=g(u);for(let e=0,i=d.length;e<i;e+=4)t.bezierCurveTo(h(n.x,r.x),h(n.y,r.y),n.x+d[e+0],n.y+d[e+1],n.x+d[e+2],n.y+d[e+3]),r.x=n.x+d[e+0],r.y=n.y+d[e+1],n.x+=d[e+2],n.y+=d[e+3];break;case`q`:d=g(u);for(let e=0,i=d.length;e<i;e+=4)t.quadraticCurveTo(n.x+d[e+0],n.y+d[e+1],n.x+d[e+2],n.y+d[e+3]),r.x=n.x+d[e+0],r.y=n.y+d[e+1],n.x+=d[e+2],n.y+=d[e+3];break;case`t`:d=g(u);for(let e=0,i=d.length;e<i;e+=2){let i=h(n.x,r.x),a=h(n.y,r.y);t.quadraticCurveTo(i,a,n.x+d[e+0],n.y+d[e+1]),r.x=i,r.y=a,n.x+=d[e+0],n.y+=d[e+1]}break;case`a`:d=g(u,[3,4],7);for(let e=0,i=d.length;e<i;e+=7){if(d[e+5]==0&&d[e+6]==0)continue;let i=n.clone();n.x+=d[e+5],n.y+=d[e+6],r.x=n.x,r.y=n.y,a(t,d[e],d[e+1],d[e+2],d[e+3],d[e+4],i,n)}break;case`Z`:case`z`:t.currentPath.autoClose=!0,t.currentPath.curves.length>0&&(n.copy(i),t.currentPath.currentPoint.copy(n),o=!0);break;default:console.warn(s)}}return t}function i(e){if(e.sheet&&e.sheet.cssRules&&e.sheet.cssRules.length)for(let t=0;t<e.sheet.cssRules.length;t++){let n=e.sheet.cssRules[t];if(n.type!==1)continue;let r=n.selectorText.split(/,/gm).filter(Boolean).map(e=>e.trim()),i={};for(let e=0;e<n.style.length;e++){let t=n.style[e];i[t]=n.style.getPropertyValue(t)}for(let e=0;e<r.length;e++)j[r[e]]=Object.assign(j[r[e]]||{},i)}}function a(e,t,n,r,i,a,s,c){if(t==0||n==0){e.lineTo(c.x,c.y);return}r=r*Math.PI/180,t=Math.abs(t),n=Math.abs(n);let l=(s.x-c.x)/2,u=(s.y-c.y)/2,d=Math.cos(r)*l+Math.sin(r)*u,f=-Math.sin(r)*l+Math.cos(r)*u,p=t*t,m=n*n,h=d*d,g=f*f,_=h/p+g/m;if(_>1){let e=Math.sqrt(_);t=e*t,n=e*n,p=t*t,m=n*n}let v=p*g+m*h,y=(p*m-v)/v,b=Math.sqrt(Math.max(0,y));i===a&&(b=-b);let x=b*t*f/n,S=-b*n*d/t,C=Math.cos(r)*x-Math.sin(r)*S+(s.x+c.x)/2,w=Math.sin(r)*x+Math.cos(r)*S+(s.y+c.y)/2,T=o(1,0,(d-x)/t,(f-S)/n),E=o((d-x)/t,(f-S)/n,(-d-x)/t,(-f-S)/n)%(Math.PI*2);e.currentPath.absellipse(C,w,t,n,T,T+E,a===0,r)}function o(e,t,n,r){let i=e*n+t*r,a=Math.sqrt(e*e+t*t)*Math.sqrt(n*n+r*r),o=Math.acos(Math.max(-1,Math.min(1,i/a)));return e*r-t*n<0&&(o=-o),o}function s(e){let t=y(e.getAttribute(`x`)||0),n=y(e.getAttribute(`y`)||0),r=y(e.getAttribute(`rx`)||e.getAttribute(`ry`)||0),i=y(e.getAttribute(`ry`)||e.getAttribute(`rx`)||0),a=y(e.getAttribute(`width`)),o=y(e.getAttribute(`height`)),s=.448084975506,c=new Xf;return c.moveTo(t+r,n),c.lineTo(t+a-r,n),(r!==0||i!==0)&&c.bezierCurveTo(t+a-r*s,n,t+a,n+i*s,t+a,n+i),c.lineTo(t+a,n+o-i),(r!==0||i!==0)&&c.bezierCurveTo(t+a,n+o-i*s,t+a-r*s,n+o,t+a-r,n+o),c.lineTo(t+r,n+o),(r!==0||i!==0)&&c.bezierCurveTo(t+r*s,n+o,t,n+o-i*s,t,n+o-i),c.lineTo(t,n+i),(r!==0||i!==0)&&c.bezierCurveTo(t,n+i*s,t+r*s,n,t+r,n),c}function c(e){function t(e,t,n){let a=y(t),o=y(n);i===0?r.moveTo(a,o):r.lineTo(a,o),i++}let n=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)/g,r=new Xf,i=0;return e.getAttribute(`points`).replace(n,t),r.currentPath.autoClose=!0,r}function l(e){function t(e,t,n){let a=y(t),o=y(n);i===0?r.moveTo(a,o):r.lineTo(a,o),i++}let n=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)/g,r=new Xf,i=0;return e.getAttribute(`points`).replace(n,t),r.currentPath.autoClose=!1,r}function u(e){let t=y(e.getAttribute(`cx`)||0),n=y(e.getAttribute(`cy`)||0),r=y(e.getAttribute(`r`)||0),i=new _l;i.absarc(t,n,r,0,Math.PI*2);let a=new Xf;return a.subPaths.push(i),a}function d(e){let t=y(e.getAttribute(`cx`)||0),n=y(e.getAttribute(`cy`)||0),r=y(e.getAttribute(`rx`)||0),i=y(e.getAttribute(`ry`)||0),a=new _l;a.absellipse(t,n,r,i,0,Math.PI*2);let o=new Xf;return o.subPaths.push(a),o}function f(e){let t=y(e.getAttribute(`x1`)||0),n=y(e.getAttribute(`y1`)||0),r=y(e.getAttribute(`x2`)||0),i=y(e.getAttribute(`y2`)||0),a=new Xf;return a.moveTo(t,n),a.lineTo(r,i),a.currentPath.autoClose=!1,a}function p(e){let t=e.querySelectorAll(`linearGradient, radialGradient`),n=[`x1`,`y1`,`x2`,`y2`,`cx`,`cy`,`r`,`fx`,`fy`,`gradientUnits`,`gradientTransform`,`spreadMethod`],r={};for(let e of t){let t=e.getAttribute(`id`);if(!t)continue;let i={type:e.nodeName===`radialGradient`?`radialGradient`:`linearGradient`,attrs:{},stops:null,href:null},a=e.getAttributeNS(`http://www.w3.org/1999/xlink`,`href`)||e.getAttribute(`href`)||``;a.startsWith(`#`)&&(i.href=a.substring(1));for(let t of n)e.hasAttribute(t)&&(i.attrs[t]=e.getAttribute(t));let o=e.querySelectorAll(`stop`);if(o.length>0){i.stops=[];for(let e of o){let t=e.getAttribute(`stop-color`);!t&&e.style&&(t=e.style[`stop-color`]),t||=`#000`;let n=e.getAttribute(`stop-opacity`);(n===null||n===``)&&e.style&&(n=e.style[`stop-opacity`]),n=n===null||n===``||n===void 0?1:Math.max(0,Math.min(1,parseFloat(n)));let r=Math.max(0,Math.min(1,parseFloat(e.getAttribute(`offset`)||`0`)));i.stops.push({offset:r,color:t,opacity:n})}}r[t]=i}function i(e,t){let n=r[e];if(!n||t.has(e))return n;if(t.add(e),n.href&&r[n.href]){let e=i(n.href,t);if(e){n.stops||=e.stops;for(let t in e.attrs)t in n.attrs||(n.attrs[t]=e.attrs[t])}}return n}for(let e in r)i(e,/* @__PURE__ */ new Set);for(let e in r){let t=r[e],n=t.attrs,i=n.gradientUnits===`userSpaceOnUse`?`userSpaceOnUse`:`objectBoundingBox`,a={type:t.type,gradientUnits:i,spreadMethod:n.spreadMethod===`reflect`||n.spreadMethod===`repeat`?n.spreadMethod:`pad`,gradientTransform:null,stops:(t.stops||[]).slice().sort((e,t)=>e.offset-t.offset)};n.gradientTransform&&(a.gradientTransform=new Di,S(n.gradientTransform,a.gradientTransform));function o(e){return typeof e==`string`?e.endsWith(`%`)?parseFloat(e)/100:y(e):0}if(t.type===`linearGradient`)a.x1=n.x1===void 0?0:o(n.x1),a.y1=n.y1===void 0?0:o(n.y1),a.x2=n.x2===void 0?+(i===`objectBoundingBox`):o(n.x2),a.y2=n.y2===void 0?0:o(n.y2);else{let e=i===`objectBoundingBox`?.5:0,t=i===`objectBoundingBox`?.5:0;a.cx=n.cx===void 0?e:o(n.cx),a.cy=n.cy===void 0?e:o(n.cy),a.r=n.r===void 0?t:o(n.r),a.fx=n.fx===void 0?a.cx:o(n.fx),a.fy=n.fy===void 0?a.cy:o(n.fy)}M[e]=a}}function m(e,t){t=Object.assign({},t);let n={};if(e.hasAttribute(`class`)){let t=e.getAttribute(`class`).split(/\s/).filter(Boolean).map(e=>e.trim());for(let e=0;e<t.length;e++)n=Object.assign(n,j[`.`+t[e]])}e.hasAttribute(`id`)&&(n=Object.assign(n,j[`#`+e.getAttribute(`id`)]));function r(r,i,a){a===void 0&&(a=function(e){return e}),e.hasAttribute(r)&&(t[i]=a(e.getAttribute(r))),n[r]&&(t[i]=a(n[r])),e.style&&e.style[r]!==``&&(t[i]=a(e.style[r]))}function i(e){return Math.max(0,Math.min(1,y(e)))}function a(e){return Math.max(0,y(e))}return r(`fill`,`fill`),r(`fill-opacity`,`fillOpacity`,i),r(`fill-rule`,`fillRule`),r(`opacity`,`opacity`,i),r(`stroke`,`stroke`),r(`stroke-opacity`,`strokeOpacity`,i),r(`stroke-width`,`strokeWidth`,a),r(`stroke-linejoin`,`strokeLineJoin`),r(`stroke-linecap`,`strokeLineCap`),r(`stroke-miterlimit`,`strokeMiterLimit`,a),r(`visibility`,`visibility`),t}function h(e,t){return e-(t-e)}function g(e,t,n){if(typeof e!=`string`)throw TypeError(`Invalid input: `+typeof e);let r={SEPARATOR:/[ \t\r\n\,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/},i=0,a=!0,o=``,s=``,c=[];function l(e,t,n){let r=/* @__PURE__ */ SyntaxError(`Unexpected character "`+e+`" at index `+t+`.`);throw r.partial=n,r}function u(){o!==``&&(s===``?c.push(Number(o)):c.push(Number(o)*10**Number(s))),o=``,s=``}let d,f=e.length;for(let p=0;p<f;p++)if(d=e[p],Array.isArray(t)&&t.includes(c.length%n)&&r.FLAGS.test(d))i=1,o=d,u();else{if(i===0){if(r.WHITESPACE.test(d))continue;if(r.DIGIT.test(d)||r.SIGN.test(d)){i=1,o=d;continue}if(r.POINT.test(d)){i=2,o=d;continue}r.COMMA.test(d)&&(a&&l(d,p,c),a=!0)}if(i===1){if(r.DIGIT.test(d)){o+=d;continue}if(r.POINT.test(d)){o+=d,i=2;continue}if(r.EXP.test(d)){i=3;continue}r.SIGN.test(d)&&o.length===1&&r.SIGN.test(o[0])&&l(d,p,c)}if(i===2){if(r.DIGIT.test(d)){o+=d;continue}if(r.EXP.test(d)){i=3;continue}r.POINT.test(d)&&o[o.length-1]===`.`&&l(d,p,c)}if(i===3){if(r.DIGIT.test(d)){s+=d;continue}if(r.SIGN.test(d)){if(s===``){s+=d;continue}s.length===1&&r.SIGN.test(s)&&l(d,p,c)}}r.WHITESPACE.test(d)?(u(),i=0,a=!1):r.COMMA.test(d)?(u(),i=0,a=!0):r.SIGN.test(d)?(u(),i=1,o=d):r.POINT.test(d)?(u(),i=2,o=d):l(d,p,c)}return u(),c}let _=[`mm`,`cm`,`in`,`pt`,`pc`,`px`],v={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:12,pc:1,px:-1},px:{px:1}};function y(e){let n=`px`;if(typeof e==`string`||e instanceof String)for(let t=0,r=_.length;t<r;t++){let r=_[t];if(e.endsWith(r)){n=r,e=e.substring(0,e.length-r.length);break}}let r;return n===`px`&&t.defaultUnit!==`px`?r=v.in[t.defaultUnit]/t.defaultDPI:(r=v[n][t.defaultUnit],r<0&&(r=v[n].in*t.defaultDPI)),r*parseFloat(e)}function b(e){if(!(e.hasAttribute(`transform`)||e.nodeName===`use`&&(e.hasAttribute(`x`)||e.hasAttribute(`y`))))return null;let t=x(e);return N.length>0&&t.premultiply(N[N.length-1]),ie.copy(t),N.push(t),t}function x(e){let t=new Di;if(e.nodeName===`use`&&(e.hasAttribute(`x`)||e.hasAttribute(`y`))){let n=y(e.getAttribute(`x`)||0),r=y(e.getAttribute(`y`)||0);t.makeTranslation(n,r)}return e.hasAttribute(`transform`)&&S(e.getAttribute(`transform`),t),t}function S(e,t){let n=P,r=e.split(`)`);for(let e=r.length-1;e>=0;e--){let i=r[e].trim();if(i===``)continue;let a=i.indexOf(`(`),o=i.length;if(a>0&&a<o){let e=i.slice(0,a),r=g(i.slice(a+1));switch(n.identity(),e){case`translate`:if(r.length>=1){let e=r[0],t=0;r.length>=2&&(t=r[1]),n.makeTranslation(e,t)}break;case`rotate`:if(r.length>=1){let e=0,t=0,i=0;e=r[0]*Math.PI/180,r.length>=3&&(t=r[1],i=r[2]),F.makeTranslation(-t,-i),ee.makeRotation(e),te.multiplyMatrices(ee,F),F.makeTranslation(t,i),n.multiplyMatrices(F,te)}break;case`scale`:if(r.length>=1){let e=r[0],t=e;r.length>=2&&(t=r[1]),n.makeScale(e,t)}break;case`skewX`:r.length===1&&n.set(1,Math.tan(r[0]*Math.PI/180),0,0,1,0,0,0,1);break;case`skewY`:r.length===1&&n.set(1,0,0,Math.tan(r[0]*Math.PI/180),1,0,0,0,1);break;case`matrix`:r.length===6&&n.set(r[0],r[2],r[4],r[1],r[3],r[5],0,0,1)}t.premultiply(n)}}return t}function C(e,t){function n(e){re.set(e.x,e.y,1).applyMatrix3(t),e.set(re.x,re.y)}function r(e){let n=e.xRadius,r=e.yRadius,i=Math.cos(e.aRotation),a=Math.sin(e.aRotation),o=new B(n*i,n*a,0),s=new B(-r*a,r*i,0),c=o.applyMatrix3(t),l=s.applyMatrix3(t),u=P.set(c.x,l.x,0,c.y,l.y,0,0,0,1),d=F.copy(u).invert(),f=ee.copy(d).transpose().multiply(d).elements,p=k(f[0],f[1],f[4]),m=Math.sqrt(p.rt1),h=Math.sqrt(p.rt2);if(e.xRadius=1/m,e.yRadius=1/h,e.aRotation=Math.atan2(p.sn,p.cs),!((e.aEndAngle-e.aStartAngle)%(2*Math.PI)<2**-52)){let n=F.set(m,0,0,0,h,0,0,0,1),r=ee.set(p.cs,p.sn,0,-p.sn,p.cs,0,0,0,1),i=n.multiply(r).multiply(u),a=e=>{let{x:t,y:n}=new B(Math.cos(e),Math.sin(e),0).applyMatrix3(i);return Math.atan2(n,t)};e.aStartAngle=a(e.aStartAngle),e.aEndAngle=a(e.aEndAngle),w(t)&&(e.aClockwise=!e.aClockwise)}}function i(e){let n=E(t),r=D(t);e.xRadius*=n,e.yRadius*=r;let i=n>2**-52?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);e.aRotation+=i,w(t)&&(e.aStartAngle*=-1,e.aEndAngle*=-1,e.aClockwise=!e.aClockwise)}let a=e.subPaths;for(let e=0,o=a.length;e<o;e++){let o=a[e].curves;for(let e=0;e<o.length;e++){let a=o[e];a.isLineCurve?(n(a.v1),n(a.v2)):a.isCubicBezierCurve?(n(a.v0),n(a.v1),n(a.v2),n(a.v3)):a.isQuadraticBezierCurve?(n(a.v0),n(a.v1),n(a.v2)):a.isEllipseCurve&&(ne.set(a.aX,a.aY),n(ne),a.aX=ne.x,a.aY=ne.y,T(t)?r(a):i(a))}}}function w(e){let t=e.elements;return t[0]*t[4]-t[1]*t[3]<0}function T(e){let t=e.elements,n=t[0]*t[3]+t[1]*t[4];if(n===0)return!1;let r=E(e),i=D(e);return Math.abs(n/(r*i))>2**-52}function E(e){let t=e.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function D(e){let t=e.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function O(e){let t=e.elements,n=t[0]*t[4]-t[1]*t[3];return Math.sqrt(Math.abs(n))}function k(e,t,n){let r,i,a,o,s,c=e+n,l=e-n,u=Math.sqrt(l*l+4*t*t);return c>0?(r=.5*(c+u),s=1/r,i=e*s*n-t*s*t):c<0?i=.5*(c-u):(r=.5*u,i=-.5*u),a=l>0?l+u:l-u,Math.abs(a)>2*Math.abs(t)?(s=-2*t/a,o=1/Math.sqrt(1+s*s),a=s*o):Math.abs(t)===0?(a=1,o=0):(s=-.5*a/t,a=1/Math.sqrt(1+s*s),o=s*a),l>0&&(s=a,a=-o,o=s),{rt1:r,rt2:i,cs:a,sn:o}}let A=[],j={},M={},N=[],P=new Di,F=new Di,ee=new Di,te=new Di,ne=new z,re=new B,ie=new Di,ae=new DOMParser().parseFromString(e,`image/svg+xml`);return p(ae),n(ae.documentElement,{fill:`#000`,fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:`miter`,strokeLineCap:`butt`,strokeMiterLimit:4}),{paths:A,gradients:M,xml:ae.documentElement}}static createFillMaterial(e){let t=e.userData.style;if(t.fill===void 0||t.fill===`none`)return null;let n=e.color,r=null,i=kO.exec(t.fill);i&&(r=wO(e.userData.gradients&&e.userData.gradients[i[1]],e));let a=new ss({opacity:t.fillOpacity*(t.opacity||1),transparent:!0,side:2,depthWrite:!1});return r===null?a.color=n:a.map=r,a}static createStrokeMaterial(e){let t=e.userData.style;return t.stroke===void 0||t.stroke===`none`?null:(kO.test(t.stroke)&&console.warn(`THREE.SVGLoader: Gradient strokes are not supported.`),new ss({color:new H().setStyle(t.stroke,DO),opacity:t.strokeOpacity*(t.opacity||1),transparent:!0,side:2,depthWrite:!1}))}static createShapes(e){return console.warn(`SVGLoader: createShapes() is deprecated. Use shapePath.toShapes() instead.`),e.toShapes()}static getStrokeStyle(e,t,n,r,i){return e=e===void 0?1:e,t=t===void 0?`#000`:t,n=n===void 0?`miter`:n,r=r===void 0?`butt`:r,i=i===void 0?4:i,{strokeColor:t,strokeWidth:e,strokeLineJoin:n,strokeLineCap:r,strokeMiterLimit:i}}static pointsToStroke(t,n,r,i){let a=[],o=[],s=[];if(e.pointsToStrokeWithBuffers(t,n,r,i,a,o,s)===0)return null;let c=new G;return c.setAttribute(`position`,new W(a,3)),c.setAttribute(`normal`,new W(o,3)),c.setAttribute(`uv`,new W(s,2)),c}static pointsToStrokeWithBuffers(e,t,n,r,i,a,o,s){let c=new z,l=new z,u=new z,d=new z,f=new z,p=new z,m=new z,h=new z,g=new z,_=new z,v=new z,y=new z,b=new z,x=new z,S=new z,C=new z,w=new z;n=n===void 0?12:n,r=r===void 0?.001:r,s=s===void 0?0:s,e=de(e);let T=e.length;if(T<2)return 0;let E=e[0].equals(e[T-1]),D,O=e[0],k,A=t.strokeWidth/2,j=1/(T-1),M=0,N,P,F,ee,te=!1,ne=0,re=s*3,ie=s*2;ae(e[0],e[1],c).multiplyScalar(A),h.copy(e[0]).sub(c),g.copy(e[0]).add(c),_.copy(h),v.copy(g);for(let n=1;n<T;n++){D=e[n],k=n===T-1?E?e[1]:void 0:e[n+1];let r=c;if(ae(O,D,r),u.copy(r).multiplyScalar(A),y.copy(D).sub(u),b.copy(D).add(u),N=M+j,P=!1,k!==void 0){ae(D,k,l),u.copy(l).multiplyScalar(A),x.copy(D).sub(u),S.copy(D).add(u),F=!0,u.subVectors(k,O),r.dot(u)<0&&(F=!1),n===1&&(te=F),u.subVectors(k,D),u.normalize();let e=Math.abs(r.dot(u));if(e>2**-52){let n=A/e;u.multiplyScalar(-n),d.subVectors(D,O),f.copy(d).setLength(n).add(u),C.copy(f).negate();let r=f.length(),i=d.length();d.divideScalar(i),p.subVectors(k,D);let a=p.length();if(p.divideScalar(a),d.dot(C)<i&&p.dot(C)<a&&(P=!0),w.copy(f).add(D),C.add(D),P){let e=F?g:h,t=(w.x-e.x)*(C.y-e.y)-(w.y-e.y)*(C.x-e.x);(F&&t<0||!F&&t>0)&&C.copy(e)}switch(ee=!1,P?F?(S.copy(C),b.copy(C)):(x.copy(C),y.copy(C)):se(),t.strokeLineJoin){case`bevel`:ce(F,P,N);break;case`round`:le(F,P),F?oe(D,y,x,N,0):oe(D,S,b,N,1);break;default:let e=A*t.strokeMiterLimit/r;if(e<1){if(t.strokeLineJoin!==`miter-clip`){ce(F,P,N);break}le(F,P),F?(p.subVectors(w,y).multiplyScalar(e).add(y),m.subVectors(w,x).multiplyScalar(e).add(x),I(y,N,0),I(p,N,0),I(D,N,.5),I(D,N,.5),I(p,N,0),I(m,N,0),I(D,N,.5),I(m,N,0),I(x,N,0)):(p.subVectors(w,b).multiplyScalar(e).add(b),m.subVectors(w,S).multiplyScalar(e).add(S),I(b,N,1),I(p,N,1),I(D,N,.5),I(D,N,.5),I(p,N,1),I(m,N,1),I(D,N,.5),I(m,N,1),I(S,N,1))}else P?(F?(I(g,M,1),I(h,M,0),I(w,N,0),I(g,M,1),I(w,N,0),I(C,N,1)):(I(g,M,1),I(h,M,0),I(w,N,1),I(h,M,0),I(C,N,0),I(w,N,1)),F?x.copy(w):S.copy(w)):F?(I(y,N,0),I(w,N,0),I(D,N,.5),I(D,N,.5),I(w,N,0),I(x,N,0)):(I(b,N,1),I(w,N,1),I(D,N,.5),I(D,N,.5),I(w,N,1),I(S,N,1)),ee=!0}}else se()}else se();!E&&n===T-1&&ue(e[0],_,v,F,!0,M),M=N,O=D,h.copy(x),g.copy(S)}if(!E)ue(D,y,b,F,!1,N);else if(P&&i){let e=w,t=C;te!==F&&(e=C,t=w),F?(ee||te)&&(t.toArray(i,0),t.toArray(i,9),ee&&e.toArray(i,3)):(ee||!te)&&(t.toArray(i,3),t.toArray(i,9),ee&&e.toArray(i,0))}if(i){let e=[new z,new z,new z],t=s*3;for(let n=t;n<re;n+=9)e[0].set(i[n],i[n+1]),e[1].set(i[n+3],i[n+4]),e[2].set(i[n+6],i[n+7]),bl.area(e)<0&&(i[n+3]=e[0].x,i[n+4]=e[0].y)}return ne;function ae(e,t,n){return n.subVectors(t,e),n.set(-n.y,n.x).normalize()}function I(e,t,n){i&&(i[re]=e.x,i[re+1]=e.y,i[re+2]=0,a&&(a[re]=0,a[re+1]=0,a[re+2]=1),re+=3,o&&(o[ie]=t,o[ie+1]=n,ie+=2)),ne+=3}function oe(e,t,r,i,a){c.copy(t).sub(e).normalize(),l.copy(r).sub(e).normalize();let o=Math.PI,s=c.dot(l);Math.abs(s)<1&&(o=Math.abs(Math.acos(s))),o/=n,u.copy(t);for(let t=0,r=n-1;t<r;t++)d.copy(u).rotateAround(e,o),I(u,i,a),I(d,i,a),I(e,i,.5),u.copy(d);I(u,i,a),I(r,i,a),I(e,i,.5)}function se(){I(g,M,1),I(h,M,0),I(y,N,0),I(g,M,1),I(y,N,0),I(b,N,1)}function ce(e,t,n){t?e?(I(g,M,1),I(h,M,0),I(y,N,0),I(g,M,1),I(y,N,0),I(C,N,1),I(y,n,0),I(x,n,0),I(C,n,.5)):(I(g,M,1),I(h,M,0),I(b,N,1),I(h,M,0),I(C,N,0),I(b,N,1),I(b,n,1),I(C,n,0),I(S,n,1)):e?(I(y,n,0),I(x,n,0),I(D,n,.5)):(I(b,n,1),I(S,n,0),I(D,n,.5))}function le(e,t){t&&(e?(I(g,M,1),I(h,M,0),I(y,N,0),I(g,M,1),I(y,N,0),I(C,N,1),I(y,M,0),I(D,N,.5),I(C,N,1),I(D,N,.5),I(x,M,0),I(C,N,1)):(I(g,M,1),I(h,M,0),I(b,N,1),I(h,M,0),I(C,N,0),I(b,N,1),I(b,M,1),I(C,N,0),I(D,N,.5),I(D,N,.5),I(C,N,0),I(S,M,1)))}function ue(e,n,r,a,s,f){switch(t.strokeLineCap){case`round`:s?oe(e,r,n,f,.5):oe(e,n,r,f,.5);break;case`square`:if(s)c.subVectors(n,e),l.set(c.y,-c.x),u.addVectors(c,l).add(e),d.subVectors(l,c).add(e),a?(u.toArray(i,3),d.toArray(i,0),d.toArray(i,9)):(u.toArray(i,3),o[7]===1?d.toArray(i,9):u.toArray(i,9),d.toArray(i,0));else{c.subVectors(r,e),l.set(c.y,-c.x),u.addVectors(c,l).add(e),d.subVectors(l,c).add(e);let t=i.length;a?(u.toArray(i,t-3),d.toArray(i,t-6),d.toArray(i,t-12)):(d.toArray(i,t-6),u.toArray(i,t-3),d.toArray(i,t-12))}}}function de(e){let t=!1;for(let n=1,i=e.length-1;n<i;n++)if(e[n].distanceTo(e[n+1])<r){t=!0;break}if(!t)return e;let n=[];n.push(e[0]);for(let t=1,i=e.length-1;t<i;t++)e[t].distanceTo(e[t+1])>=r&&n.push(e[t]);return n.push(e[e.length-1]),n}}},kO=/^\s*url\(\s*(?:["']\s*)?#([^)'"\s]+)(?:\s*["'])?\s*\)\s*$/})),jO=/* @__PURE__ */ n({buildSvg:()=>RO,partsBounds:()=>IO,svgParts:()=>PO});function MO(e,t,n){if(e===`currentColor`)return n;let r=/^url\(\s*['"]?#([^'")]+)['"]?\s*\)/.exec(e);if(r){let e=t.userData?.gradients?.[r[1]]?.stops??[];if(!e.length)return n;let i=new H(e[0].color),a=new H(e[e.length-1].color);return`#${i.lerp(a,.5).getHexString()}`}try{let t=new H;return t.setStyle(e,Br),`#${t.getHexString(Br)}`}catch{return n}}function NO(e,t){let n=new ff;for(let t of e.paths)for(let e of t.subPaths)for(let t of e.getPoints(4))n.expandByPoint(t);return(n.isEmpty()?100:Math.max(n.max.x-n.min.x,n.max.y-n.min.y,1e-6))/(t*10)}function PO(e,t,n={}){let r=[],i=Math.max(1,Math.round(Q(n.curveSegments,12))),a=NO(e,i),o=n.currentColor??`#1f2330`;for(let s of e.paths){let e=s.userData?.style??{};if(e.visibility===`hidden`||e.visibility===`collapse`)continue;let c=Q(e.opacity,1);if(zO(e.fill)){let t=s.toShapes().map(e=>zD(e,a));t.length&&r.push({kind:`fill`,color:MO(e.fill,s,o),opacity:Q(e.fillOpacity,1)*c,shapes:t})}if(n.strokes!==!1&&zO(e.stroke)&&Q(e.strokeWidth,1)>0){let n=t.getStrokeStyle(Q(e.strokeWidth,1),`#000`,e.strokeLineJoin??`miter`,e.strokeLineCap??`butt`,Q(e.strokeMiterLimit,4)),l=[];for(let e of s.subPaths){let r=RD(e,a);if(r.length<2)continue;let o=t.pointsToStroke(r,n,i);o&&l.push(o)}if(l.length){let t=l.length===1?l[0]:FO(l);r.push({kind:`stroke`,color:MO(e.stroke,s,o),opacity:Q(e.strokeOpacity,1)*c,stroke:t})}}}return r}function FO(e){let t=0;for(let n of e)t+=n.getAttribute(`position`).count;let n=new Float32Array(t*3),r=0;for(let t of e){let e=t.getAttribute(`position`).array;n.set(e,r),r+=e.length,t.dispose()}let i=new G;return i.setAttribute(`position`,new co(n,3)),i}function IO(e,t=12){let n=new ff;for(let r of e){if(r.shapes)for(let e of r.shapes)for(let r of e.getPoints(t))n.expandByPoint(r);if(r.stroke){let e=r.stroke.getAttribute(`position`);for(let t=0;t<e.count;t++)n.expandByPoint(new z(e.getX(t),e.getY(t)))}}return n}function LO(e,t,n,r,i){if(e.kind===`stroke`)return e.stroke?VD(e.stroke,t):null;if(!e.shapes?.length)return null;if(t<=0)return new Ol(e.shapes,r);let a=Math.min(n,t*.45),o=new xl(e.shapes,{depth:Math.max(t-a*2,t*.05),curveSegments:r,bevelEnabled:a>0,bevelThickness:a,bevelSize:a*.6,bevelOffset:0,bevelSegments:3});return o.translate(0,0,a),o.clearGroups(),BD(o,50*Math.PI/180,i)}async function RO(e,t){let[{SVGLoader:n},r]=await Promise.all([Promise.resolve().then(()=>(AO(),CO)),Promise.resolve().then(()=>(Wv(),kv))]),i=e.src.trim().startsWith(`<`)?e.src:await mg(t.resolveAsset(e.src)),a=new n().parse(i),o=e.material?lw(e.material):void 0,s=typeof o?.color==`string`?o.color:void 0,c=Math.max(1,Math.round(Q(e.curveSegments,12))),l=PO(a,n,{strokes:e.strokes,curveSegments:c,currentColor:s}),u=new ba,d=IO(l,c);if(!l.length||d.isEmpty())return u;let f=Q(e.size,2),p=Math.max(d.max.x-d.min.x,1e-6),m=Math.max(d.max.y-d.min.y,1e-6),h=e.fit??`width`,g=f/(h===`height`?m:h===`max`?Math.max(p,m):p),_=Math.max(0,Q(e.depth,.2)),v=_/g,y=Q(e.bevel,0)/g,b=Q(e.layerGap,_>0?_*.02:f*.002),x=e.keepColors??!e.material,S=/* @__PURE__ */ new Map,C=async(n,r)=>{let i=x?`${n}|${r}`:`|${r}`,a=S.get(i);return a||(a=await yw(x?{roughness:.4,metalness:.1,...e.material??{},color:n,...r<1?{opacity:r}:{}}:e.material?{...e.material,...r<1?{opacity:r}:{}}:{color:`#dddddd`,roughness:.4,metalness:.1},t,{defaultColor:n}),r<1&&(a.transparent=!0),_<=0&&(a.side=2),S.set(i,a)),a},w=[];for(let e of l){let t=LO(e,v,y,c,r);if(!t)continue;t.getAttribute(`normal`)||t.computeVertexNormals();let n=x?`${e.color}|${e.opacity}`:`|${e.opacity}`,i=w[w.length-1];i&&i.key===n?i.geos.push(t):w.push({key:n,color:e.color,opacity:e.opacity,geos:[t]})}let T=new ba;for(let[e,t]of w.entries()){for(let e of t.geos){for(let t of Object.keys(e.attributes))[`position`,`normal`,`uv`].includes(t)||e.deleteAttribute(t);e.getAttribute(`uv`)||e.setAttribute(`uv`,new W(new Float32Array(e.getAttribute(`position`).count*2),2))}let n=t.geos.length===1?t.geos[0]:r.mergeGeometries(t.geos.map(e=>e.index?e.toNonIndexed():e),!1)??t.geos[0],i=new K(n,await C(t.color,t.opacity));i.position.z=e*b/g,T.add(i)}let E=(d.min.x+d.max.x)/2,D=(d.min.y+d.max.y)/2;return T.scale.set(g,-g,g),T.position.set(-E*g,D*g,-(_+Math.max(0,w.length-1)*b)/2),u.add(T),u}var zO,BO=t((()=>{J(),yg(),zS(),HD(),jw(),zO=e=>!!e&&e!==`none`&&e!==`transparent`})),VO=/* @__PURE__ */ n({clone:()=>GO,retarget:()=>UO,retargetClip:()=>WO});function HO(e,t){return t.getBoneName===void 0?t.names[e.name]:t.getBoneName(e)}function UO(e,t,n={}){let r=new wi,i=new B,a=new V,o=new V;n.preserveBoneMatrix=n.preserveBoneMatrix===void 0||n.preserveBoneMatrix,n.preserveBonePositions=n.preserveBonePositions===void 0||n.preserveBonePositions,n.useTargetMatrix=n.useTargetMatrix!==void 0&&n.useTargetMatrix,n.hip=n.hip===void 0?`hip`:n.hip,n.hipInfluence=n.hipInfluence===void 0?new B(1,1,1):n.hipInfluence,n.scale=n.scale===void 0?1:n.scale,n.names=n.names||{};let s=t.isObject3D?t.skeleton.bones:qO(t),c=e.isObject3D?e.skeleton.bones:qO(e),l,u,d,f;if(e.isObject3D?e.skeleton.pose():(n.useTargetMatrix=!0,n.preserveBoneMatrix=!1),n.preserveBonePositions){f=[];for(let e=0;e<c.length;e++)f.push(c[e].position.clone())}if(n.preserveBoneMatrix){e.updateMatrixWorld(),e.matrixWorld.identity();for(let t=0;t<e.children.length;++t)e.children[t].updateMatrixWorld(!0)}for(let t=0;t<c.length;++t)l=c[t],u=HO(l,n),d=KO(u,s),o.copy(l.matrixWorld),d&&(d.updateMatrixWorld(),n.useTargetMatrix?a.copy(d.matrixWorld):(a.copy(e.matrixWorld).invert(),a.multiply(d.matrixWorld)),i.setFromMatrixScale(a),a.scale(i.set(1/i.x,1/i.y,1/i.z)),o.makeRotationFromQuaternion(r.setFromRotationMatrix(a)),e.isObject3D&&n.localOffsets&&n.localOffsets[l.name]&&o.multiply(n.localOffsets[l.name]),o.copyPosition(a)),u===n.hip&&(o.elements[12]*=n.scale*n.hipInfluence.x,o.elements[13]*=n.scale*n.hipInfluence.y,o.elements[14]*=n.scale*n.hipInfluence.z,n.hipPosition!==void 0&&(o.elements[12]+=n.hipPosition.x*n.scale,o.elements[13]+=n.hipPosition.y*n.scale,o.elements[14]+=n.hipPosition.z*n.scale)),l.parent?(l.matrix.copy(l.parent.matrixWorld).invert(),l.matrix.multiply(o)):l.matrix.copy(o),l.matrix.decompose(l.position,l.quaternion,l.scale),l.updateMatrixWorld();if(n.preserveBonePositions)for(let e=0;e<c.length;++e)l=c[e],u=HO(l,n)||l.name,u!==n.hip&&l.position.copy(f[e]);n.preserveBoneMatrix&&e.updateMatrixWorld(!0)}function WO(e,t,n,r={}){r.useFirstFramePosition=r.useFirstFramePosition!==void 0&&r.useFirstFramePosition,r.fps=r.fps===void 0?Math.max(...n.tracks.map(e=>e.times.length))/n.duration:r.fps,r.names=r.names||[],t.isObject3D||(t=JO(t));let i=Math.round(n.duration*(r.fps/1e3)*1e3),a=n.duration/(i-1),o=[],s=new Zd(t),c=qO(e.skeleton),l=[],u,d,f,p,m;s.clipAction(n).play();let h=0,g=i;r.trim===void 0?s.update(0):(h=Math.round(r.trim[0]*r.fps),g=Math.min(Math.round(r.trim[1]*r.fps),i)-h,s.update(r.trim[0])),t.updateMatrixWorld();for(let n=0;n<g;++n){let i=n*a;UO(e,t,r);for(let e=0;e<c.length;++e)d=c[e],m=HO(d,r)||d.name,f=KO(m,t.skeleton),f&&(p=l[e]=l[e]||{bone:d},r.hip===m&&(p.pos||(p.pos={times:new Float32Array(g),values:new Float32Array(g*3)}),r.useFirstFramePosition&&(n===0&&(u=d.position.clone()),d.position.sub(u)),p.pos.times[n]=i,d.position.toArray(p.pos.values,n*3)),p.quat||(p.quat={times:new Float32Array(g),values:new Float32Array(g*4)}),p.quat.times[n]=i,d.quaternion.toArray(p.quat.values,n*4));n===g-2?s.update(a-1e-7):s.update(a),t.updateMatrixWorld()}for(let e=0;e<l.length;++e)p=l[e],p&&(p.pos&&o.push(new du(`.bones[`+p.bone.name+`].position`,p.pos.times,p.pos.values)),o.push(new lu(`.bones[`+p.bone.name+`].quaternion`,p.quat.times,p.quat.values)));return s.uncacheAction(n),new fu(n.name,-1,o)}function GO(e){let t=/* @__PURE__ */ new Map,n=/* @__PURE__ */ new Map,r=e.clone();return YO(e,r,function(e,r){t.set(r,e),n.set(e,r)}),r.traverse(function(e){if(!e.isSkinnedMesh)return;let r=e,i=t.get(e),a=i.skeleton.bones;r.skeleton=i.skeleton.clone(),r.bindMatrix.copy(i.bindMatrix),r.skeleton.bones=a.map(function(e){return n.get(e)}),r.bind(r.skeleton,r.bindMatrix)}),r}function KO(e,t){for(let n=0,r=qO(t);n<r.length;n++)if(e===r[n].name)return r[n]}function qO(e){return Array.isArray(e)?e:e.bones}function JO(e){let t=new Ef(e.bones[0]);return t.skeleton=e,t}function YO(e,t,n){n(e,t);for(let r=0;r<e.children.length;r++)YO(e.children[r],t.children[r],n)}var XO=t((()=>{J()})),ZO=/* @__PURE__ */ n({GLTFLoader:()=>dk});function QO(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}function $O(e,t,n){let r=e.json.materials[t];return r.extensions&&r.extensions[n]?r.extensions[n]:null}function ek(e){return e.DefaultMaterial===void 0&&(e.DefaultMaterial=new Hl({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0})),e.DefaultMaterial}function tk(e,t,n){for(let r in n.extensions)e[r]===void 0&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=n.extensions[r])}function nk(e,t){t.extras!==void 0&&(typeof t.extras==`object`?Object.assign(e.userData,t.extras):console.warn(`THREE.GLTFLoader: Ignoring primitive type .extras, `+t.extras))}function rk(e,t,n){let r=!1,i=!1,a=!1;for(let e=0,n=t.length;e<n;e++){let n=t[e];if(n.POSITION!==void 0&&(r=!0),n.NORMAL!==void 0&&(i=!0),n.COLOR_0!==void 0&&(a=!0),r&&i&&a)break}if(!r&&!i&&!a)return Promise.resolve(e);let o=[],s=[],c=[];for(let l=0,u=t.length;l<u;l++){let u=t[l];if(r){let t=u.POSITION===void 0?e.attributes.position:n.getDependency(`accessor`,u.POSITION);o.push(t)}if(i){let t=u.NORMAL===void 0?e.attributes.normal:n.getDependency(`accessor`,u.NORMAL);s.push(t)}if(a){let t=u.COLOR_0===void 0?e.attributes.color:n.getDependency(`accessor`,u.COLOR_0);c.push(t)}}return Promise.all([Promise.all(o),Promise.all(s),Promise.all(c)]).then(function(t){let n=t[0],o=t[1],s=t[2];return r&&(e.morphAttributes.position=n),i&&(e.morphAttributes.normal=o),a&&(e.morphAttributes.color=s),e.morphTargetsRelative=!0,e})}function ik(e,t){if(e.updateMorphTargets(),t.weights!==void 0)for(let n=0,r=t.weights.length;n<r;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){let n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(let t=0,r=n.length;t<r;t++)e.morphTargetDictionary[n[t]]=t}else console.warn(`THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.`)}}function ak(e){let t,n=e.extensions&&e.extensions[fk.KHR_DRACO_MESH_COMPRESSION];if(t=n?`draco:`+n.bufferView+`:`+n.indices+`:`+ok(n.attributes):e.indices+`:`+ok(e.attributes)+`:`+e.mode,e.targets!==void 0)for(let n=0,r=e.targets.length;n<r;n++)t+=`:`+ok(e.targets[n]);return t}function ok(e){let t=``,n=Object.keys(e).sort();for(let r=0,i=n.length;r<i;r++)t+=n[r]+`:`+e[n[r]]+`;`;return t}function sk(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw Error(`THREE.GLTFLoader: Unsupported normalized accessor component type.`)}}function ck(e){return e.search(/\.jpe?g($|\?)/i)>0||e.search(/^data\:image\/jpeg/)===0?`image/jpeg`:e.search(/\.webp($|\?)/i)>0||e.search(/^data\:image\/webp/)===0?`image/webp`:e.search(/\.ktx2($|\?)/i)>0||e.search(/^data\:image\/ktx2/)===0?`image/ktx2`:`image/png`}function lk(e,t,n){let r=t.attributes,i=new Wa;if(r.POSITION!==void 0){let e=n.json.accessors[r.POSITION],t=e.min,a=e.max;if(t!==void 0&&a!==void 0){if(i.set(new B(t[0],t[1],t[2]),new B(a[0],a[1],a[2])),e.normalized){let t=sk(Uk[e.componentType]);i.min.multiplyScalar(t),i.max.multiplyScalar(t)}}else{console.warn(`THREE.GLTFLoader: Missing min/max properties for accessor POSITION.`);return}}else return;let a=t.targets;if(a!==void 0){let e=new B,t=new B;for(let r=0,i=a.length;r<i;r++){let i=a[r];if(i.POSITION!==void 0){let r=n.json.accessors[i.POSITION],a=r.min,o=r.max;if(a!==void 0&&o!==void 0){if(t.setX(Math.max(Math.abs(a[0]),Math.abs(o[0]))),t.setY(Math.max(Math.abs(a[1]),Math.abs(o[1]))),t.setZ(Math.max(Math.abs(a[2]),Math.abs(o[2]))),r.normalized){let e=sk(Uk[r.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn(`THREE.GLTFLoader: Missing min/max properties for accessor POSITION.`)}}i.expandByVector(e)}e.boundingBox=i;let o=new xo;i.getCenter(o.center),o.radius=i.min.distanceTo(i.max)/2,e.boundingSphere=o}function uk(e,t,n){let r=t.attributes,i=[];function a(t,r){return n.getDependency(`accessor`,t).then(function(t){e.setAttribute(r,t)})}for(let t in r){let n=qk[t]||t.toLowerCase();n in e.attributes||i.push(a(r[t],n))}if(t.indices!==void 0&&!e.index){let r=n.getDependency(`accessor`,t.indices).then(function(t){e.setIndex(t)});i.push(r)}return ji.workingColorSpace!==`srgb-linear`&&`COLOR_0`in r&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${ji.workingColorSpace}" not supported.`),nk(e,t),lk(e,t,n),Promise.all(i).then(function(){return t.targets===void 0?e:rk(e,t.targets,n)})}var dk,fk,pk,mk,hk,gk,_k,vk,yk,bk,xk,Sk,Ck,wk,Tk,Ek,Dk,Ok,kk,Ak,jk,Mk,Nk,Pk,Fk,Ik,Lk,Rk,zk,Bk,Vk,Hk,Uk,Wk,Gk,Kk,qk,Jk,Yk,Xk,Zk,Qk,$k=t((()=>{J(),Wv(),XO(),dk=class extends gu{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new gk(e)}),this.register(function(e){return new _k(e)}),this.register(function(e){return new vk(e)}),this.register(function(e){return new Dk(e)}),this.register(function(e){return new Ok(e)}),this.register(function(e){return new kk(e)}),this.register(function(e){return new bk(e)}),this.register(function(e){return new xk(e)}),this.register(function(e){return new Sk(e)}),this.register(function(e){return new Ck(e)}),this.register(function(e){return new hk(e)}),this.register(function(e){return new wk(e)}),this.register(function(e){return new yk(e)}),this.register(function(e){return new Ek(e)}),this.register(function(e){return new Tk(e)}),this.register(function(e){return new pk(e)}),this.register(function(e){return new Ak(e,fk.EXT_MESHOPT_COMPRESSION)}),this.register(function(e){return new Ak(e,fk.KHR_MESHOPT_COMPRESSION)}),this.register(function(e){return new jk(e)})}load(e,t,n,r){let i=this,a;if(this.resourcePath!==``)a=this.resourcePath;else if(this.path!==``){let t=ed.extractUrlBase(e);a=ed.resolveURL(t,this.path)}else a=ed.extractUrlBase(e);this.manager.itemStart(e);let o=function(t){r?r(t):console.error(t),i.manager.itemError(e),i.manager.itemEnd(e)},s=new yu(this.manager);s.setPriority(this.priority),s.setCache(this.cache),s.setPath(this.path),s.setResponseType(`arraybuffer`),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(n){try{i.parse(n,a,function(n){t(n),i.manager.itemEnd(e)},o)}catch(e){o(e)}},n,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,r){let i,a={},o={},s=new TextDecoder;if(typeof e==`string`)i=JSON.parse(e);else if(e instanceof ArrayBuffer){if(s.decode(new Uint8Array(e,0,4))===Mk){try{a[fk.KHR_BINARY_GLTF]=new Fk(e)}catch(e){r&&r(e);return}i=JSON.parse(a[fk.KHR_BINARY_GLTF].content)}else i=JSON.parse(s.decode(e))}else i=e;if(i.asset===void 0||i.asset.version[0]<2){r&&r(/* @__PURE__ */ Error(`THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.`));return}let c=new Qk(i,{path:t||this.resourcePath||``,crossOrigin:this.crossOrigin,priority:this.priority,cache:this.cache,withCredentials:this.withCredentials,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){let t=this.pluginCallbacks[e](c);t.name||console.error(`THREE.GLTFLoader: Invalid plugin found: missing name`),o[t.name]=t,a[t.name]=!0}if(i.extensionsUsed)for(let e=0;e<i.extensionsUsed.length;++e){let t=i.extensionsUsed[e],n=i.extensionsRequired||[];switch(t){case fk.KHR_MATERIALS_UNLIT:a[t]=new mk;break;case fk.KHR_DRACO_MESH_COMPRESSION:a[t]=new Ik(i,this.dracoLoader);break;case fk.KHR_TEXTURE_TRANSFORM:a[t]=new Lk;break;case fk.KHR_MESH_QUANTIZATION:a[t]=new Rk;break;default:n.indexOf(t)>=0&&o[t]===void 0&&console.warn(`THREE.GLTFLoader: Unknown extension "`+t+`".`)}}c.setExtensions(a),c.setPlugins(o),c.parse(n,r)}parseAsync(e,t){let n=this;return new Promise(function(r,i){n.parse(e,t,r,i)})}},fk={KHR_BINARY_GLTF:`KHR_binary_glTF`,KHR_DRACO_MESH_COMPRESSION:`KHR_draco_mesh_compression`,KHR_LIGHTS_PUNCTUAL:`KHR_lights_punctual`,KHR_MATERIALS_CLEARCOAT:`KHR_materials_clearcoat`,KHR_MATERIALS_DIFFUSE_ROUGHNESS:`KHR_materials_diffuse_roughness`,KHR_MATERIALS_DISPERSION:`KHR_materials_dispersion`,KHR_MATERIALS_IOR:`KHR_materials_ior`,KHR_MATERIALS_SHEEN:`KHR_materials_sheen`,KHR_MATERIALS_SPECULAR:`KHR_materials_specular`,KHR_MATERIALS_TRANSMISSION:`KHR_materials_transmission`,KHR_MATERIALS_IRIDESCENCE:`KHR_materials_iridescence`,KHR_MATERIALS_ANISOTROPY:`KHR_materials_anisotropy`,KHR_MATERIALS_UNLIT:`KHR_materials_unlit`,KHR_MATERIALS_VOLUME:`KHR_materials_volume`,KHR_TEXTURE_BASISU:`KHR_texture_basisu`,KHR_TEXTURE_TRANSFORM:`KHR_texture_transform`,KHR_MESH_QUANTIZATION:`KHR_mesh_quantization`,KHR_MATERIALS_EMISSIVE_STRENGTH:`KHR_materials_emissive_strength`,EXT_MATERIALS_BUMP:`EXT_materials_bump`,EXT_TEXTURE_WEBP:`EXT_texture_webp`,EXT_TEXTURE_AVIF:`EXT_texture_avif`,EXT_MESHOPT_COMPRESSION:`EXT_meshopt_compression`,KHR_MESHOPT_COMPRESSION:`KHR_meshopt_compression`,EXT_MESH_GPU_INSTANCING:`EXT_mesh_gpu_instancing`},pk=class{constructor(e){this.parser=e,this.name=fk.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,r=t.length;n<r;n++){let r=t[n];r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){let t=this.parser,n=`light:`+e,r=t.cache.get(n);if(r)return r;let i=t.json,a=((i.extensions&&i.extensions[this.name]||{}).lights||[])[e],o,s=new H(16777215);a.color!==void 0&&s.setRGB(a.color[0],a.color[1],a.color[2],Vr);let c=a.range===void 0?0:a.range;switch(a.type){case`directional`:o=new qu(s),o.target.position.set(0,0,-1),o.add(o.target);break;case`point`:o=new Wu(s),o.distance=c;break;case`spot`:o=new Hu(s),o.distance=c,a.spot=a.spot||{},a.spot.innerConeAngle=a.spot.innerConeAngle===void 0?0:a.spot.innerConeAngle,a.spot.outerConeAngle=a.spot.outerConeAngle===void 0?Math.PI/4:a.spot.outerConeAngle,o.angle=a.spot.outerConeAngle,o.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,o.target.position.set(0,0,-1),o.add(o.target);break;default:throw Error(`THREE.GLTFLoader: Unexpected light type: `+a.type)}return o.position.set(0,0,0),nk(o,a),a.intensity!==void 0&&(o.intensity=a.intensity),o.name=t.createUniqueName(a.name||`light_`+e),r=Promise.resolve(o),t.cache.add(n,r),r}getDependency(e,t){if(e===`light`)return this._loadLight(t)}createNodeAttachment(e){let t=this,n=this.parser,r=n.json.nodes[e],i=(r.extensions&&r.extensions[this.name]||{}).light;return i===void 0?null:this._loadLight(i).then(function(e){return n._getNodeRef(t.cache,i,e)})}},mk=class{constructor(){this.name=fk.KHR_MATERIALS_UNLIT}getMaterialType(){return ss}extendParams(e,t,n){let r=[];e.color=new H(1,1,1),e.opacity=1;let i=t.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){let t=i.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],Vr),e.opacity=t[3]}i.baseColorTexture!==void 0&&r.push(n.assignTexture(e,`map`,i.baseColorTexture,Br))}return Promise.all(r)}},hk=class{constructor(e){this.parser=e,this.name=fk.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let n=$O(this.parser,e,this.name);return n===null||n.emissiveStrength!==void 0&&(t.emissiveIntensity=n.emissiveStrength),Promise.resolve()}},gk=class{constructor(e){this.parser=e,this.name=fk.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){return $O(this.parser,e,this.name)===null?null:Ul}extendMaterialParams(e,t){let n=$O(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];if(n.clearcoatFactor!==void 0&&(t.clearcoat=n.clearcoatFactor),n.clearcoatTexture!==void 0&&r.push(this.parser.assignTexture(t,`clearcoatMap`,n.clearcoatTexture)),n.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=n.clearcoatRoughnessFactor),n.clearcoatRoughnessTexture!==void 0&&r.push(this.parser.assignTexture(t,`clearcoatRoughnessMap`,n.clearcoatRoughnessTexture)),n.clearcoatNormalTexture!==void 0&&(r.push(this.parser.assignTexture(t,`clearcoatNormalMap`,n.clearcoatNormalTexture)),n.clearcoatNormalTexture.scale!==void 0)){let e=n.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new z(e,e)}return Promise.all(r)}},_k=class{constructor(e){this.parser=e,this.name=fk.KHR_MATERIALS_DIFFUSE_ROUGHNESS}getMaterialType(e){return $O(this.parser,e,this.name)===null?null:Ul}extendMaterialParams(e,t){let n=$O(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return t.diffuseRoughness=n.diffuseRoughnessFactor===void 0?0:n.diffuseRoughnessFactor,n.diffuseRoughnessTexture!==void 0&&r.push(this.parser.assignTexture(t,`diffuseRoughnessMap`,n.diffuseRoughnessTexture)),Promise.all(r)}},vk=class{constructor(e){this.parser=e,this.name=fk.KHR_MATERIALS_DISPERSION}getMaterialType(e){return $O(this.parser,e,this.name)===null?null:Ul}extendMaterialParams(e,t){let n=$O(this.parser,e,this.name);return n===null||(t.dispersion=n.dispersion===void 0?0:n.dispersion),Promise.resolve()}},yk=class{constructor(e){this.parser=e,this.name=fk.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){return $O(this.parser,e,this.name)===null?null:Ul}extendMaterialParams(e,t){let n=$O(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return n.iridescenceFactor!==void 0&&(t.iridescence=n.iridescenceFactor),n.iridescenceTexture!==void 0&&r.push(this.parser.assignTexture(t,`iridescenceMap`,n.iridescenceTexture)),n.iridescenceIor!==void 0&&(t.iridescenceIOR=n.iridescenceIor),n.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessMinimum=n.iridescenceThicknessMinimum),n.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessMaximum=n.iridescenceThicknessMaximum),n.iridescenceThicknessTexture!==void 0&&r.push(this.parser.assignTexture(t,`iridescenceThicknessMap`,n.iridescenceThicknessTexture)),Promise.all(r)}},bk=class{constructor(e){this.parser=e,this.name=fk.KHR_MATERIALS_SHEEN}getMaterialType(e){return $O(this.parser,e,this.name)===null?null:Ul}extendMaterialParams(e,t){let n=$O(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];if(t.sheenColor=new H(0,0,0),t.sheenRoughness=0,t.sheen=1,n.sheenColorFactor!==void 0){let e=n.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],Vr)}return n.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=n.sheenRoughnessFactor),n.sheenColorTexture!==void 0&&r.push(this.parser.assignTexture(t,`sheenColorMap`,n.sheenColorTexture,Br)),n.sheenRoughnessTexture!==void 0&&r.push(this.parser.assignTexture(t,`sheenRoughnessMap`,n.sheenRoughnessTexture)),Promise.all(r)}},xk=class{constructor(e){this.parser=e,this.name=fk.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){return $O(this.parser,e,this.name)===null?null:Ul}extendMaterialParams(e,t){let n=$O(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return n.transmissionFactor!==void 0&&(t.transmission=n.transmissionFactor),n.transmissionTexture!==void 0&&r.push(this.parser.assignTexture(t,`transmissionMap`,n.transmissionTexture)),Promise.all(r)}},Sk=class{constructor(e){this.parser=e,this.name=fk.KHR_MATERIALS_VOLUME}getMaterialType(e){return $O(this.parser,e,this.name)===null?null:Ul}extendMaterialParams(e,t){let n=$O(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];t.thickness=n.thicknessFactor===void 0?0:n.thicknessFactor,n.thicknessTexture!==void 0&&r.push(this.parser.assignTexture(t,`thicknessMap`,n.thicknessTexture)),t.attenuationDistance=n.attenuationDistance||1/0;let i=n.attenuationColor||[1,1,1];return t.attenuationColor=new H().setRGB(i[0],i[1],i[2],Vr),Promise.all(r)}},Ck=class{constructor(e){this.parser=e,this.name=fk.KHR_MATERIALS_IOR}getMaterialType(e){return $O(this.parser,e,this.name)===null?null:Ul}extendMaterialParams(e,t){let n=$O(this.parser,e,this.name);return n===null||(t.ior=n.ior===void 0?1.5:n.ior,t.ior===0&&(t.ior=1e3)),Promise.resolve()}},wk=class{constructor(e){this.parser=e,this.name=fk.KHR_MATERIALS_SPECULAR}getMaterialType(e){return $O(this.parser,e,this.name)===null?null:Ul}extendMaterialParams(e,t){let n=$O(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];t.specularIntensity=n.specularFactor===void 0?1:n.specularFactor,n.specularTexture!==void 0&&r.push(this.parser.assignTexture(t,`specularIntensityMap`,n.specularTexture));let i=n.specularColorFactor||[1,1,1];return t.specularColor=new H().setRGB(i[0],i[1],i[2],Vr),n.specularColorTexture!==void 0&&r.push(this.parser.assignTexture(t,`specularColorMap`,n.specularColorTexture,Br)),Promise.all(r)}},Tk=class{constructor(e){this.parser=e,this.name=fk.EXT_MATERIALS_BUMP}getMaterialType(e){return $O(this.parser,e,this.name)===null?null:Ul}extendMaterialParams(e,t){let n=$O(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return t.bumpScale=n.bumpFactor===void 0?1:n.bumpFactor,n.bumpTexture!==void 0&&r.push(this.parser.assignTexture(t,`bumpMap`,n.bumpTexture)),Promise.all(r)}},Ek=class{constructor(e){this.parser=e,this.name=fk.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){return $O(this.parser,e,this.name)===null?null:Ul}extendMaterialParams(e,t){let n=$O(this.parser,e,this.name);if(n===null)return Promise.resolve();let r=[];return n.anisotropyStrength!==void 0&&(t.anisotropy=n.anisotropyStrength),n.anisotropyRotation!==void 0&&(t.anisotropyRotation=n.anisotropyRotation),n.anisotropyTexture!==void 0&&r.push(this.parser.assignTexture(t,`anisotropyMap`,n.anisotropyTexture)),Promise.all(r)}},Dk=class{constructor(e){this.parser=e,this.name=fk.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,n=t.json,r=n.textures[e];if(!r.extensions||!r.extensions[this.name])return null;let i=r.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw Error(`THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures`);return null}return t.loadTextureImage(e,i.source,a)}},Ok=class{constructor(e){this.parser=e,this.name=fk.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){let e=n.options.manager.getHandler(o.uri);e!==null&&(s=e)}return n.loadTextureImage(e,a.source,s)}},kk=class{constructor(e){this.parser=e,this.name=fk.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){let e=n.options.manager.getHandler(o.uri);e!==null&&(s=e)}return n.loadTextureImage(e,a.source,s)}},Ak=class{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){let e=n.extensions[this.name],r=this.parser.getDependency(`buffer`,e.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw Error(`THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files`);return null}return r.then(function(t){let n=e.byteOffset||0,r=e.byteLength||0,a=e.count,o=e.byteStride,s=new Uint8Array(t,n,r);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(a,o,s,e.mode,e.filter).then(function(e){return e.buffer}):i.ready.then(function(){let t=new ArrayBuffer(a*o);return i.decodeGltfBuffer(new Uint8Array(t),a,o,s,e.mode,e.filter),t})})}return null}},jk=class{constructor(e){this.name=fk.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;let r=t.meshes[n.mesh];for(let e of r.primitives)if(e.mode!==Hk.TRIANGLES&&e.mode!==Hk.TRIANGLE_STRIP&&e.mode!==Hk.TRIANGLE_FAN&&e.mode!==void 0)return null;let i=n.extensions[this.name].attributes,a=[],o={};for(let e in i)a.push(this.parser.getDependency(`accessor`,i[e]).then(t=>(o[e]=t,o[e])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(e=>{let t=e.pop(),n=t.isGroup?t.children:[t],r=e[0].count,i=[];for(let e of n){let t=new V,n=new B,a=new wi,s=new B(1,1,1),c=new Hs(e.geometry,e.material,r);for(let e=0;e<r;e++)o.TRANSLATION&&n.fromBufferAttribute(o.TRANSLATION,e),o.ROTATION&&a.fromBufferAttribute(o.ROTATION,e),o.SCALE&&s.fromBufferAttribute(o.SCALE,e),c.setMatrixAt(e,t.compose(n,a,s));let l=null;for(let e in o)if(e===`_COLOR_0`){let t=o[e];c.instanceColor=new Ps(t.array,t.itemSize,t.normalized)}else if(e!==`TRANSLATION`&&e!==`ROTATION`&&e!==`SCALE`){if(l===null){let e=c.geometry;l=new G,l.name=e.name;for(let t in e.attributes)l.setAttribute(t,e.attributes[t]);for(let t in e.morphAttributes)l.morphAttributes[t]=e.morphAttributes[t];e.index!==null&&l.setIndex(e.index),l.morphTargetsRelative=e.morphTargetsRelative;for(let t of e.groups)l.addGroup(t.start,t.count,t.materialIndex);e.boundingBox!==null&&(l.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(l.boundingSphere=e.boundingSphere.clone()),l.drawRange.start=e.drawRange.start,l.drawRange.count=e.drawRange.count,l.userData=Object.assign({},e.userData),c.geometry=l}let t=o[e];l.setAttribute(e,new Ps(t.array,t.itemSize,t.normalized))}ya.prototype.copy.call(c,e),this.parser.assignFinalMaterial(c),i.push(c)}return t.isGroup?(t.clear(),t.add(...i),t):i[0]}))}},Mk=`glTF`,Nk=12,Pk={JSON:1313821514,BIN:5130562},Fk=class{constructor(e){this.name=fk.KHR_BINARY_GLTF,this.content=null,this.body=null;let t=new DataView(e,0,Nk),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Mk)throw Error(`THREE.GLTFLoader: Unsupported glTF-Binary header.`);if(this.header.version<2)throw Error(`THREE.GLTFLoader: Legacy binary file detected.`);let r=this.header.length-Nk,i=new DataView(e,Nk),a=0;for(;a<r;){let t=i.getUint32(a,!0);a+=4;let r=i.getUint32(a,!0);if(a+=4,r===Pk.JSON){let r=new Uint8Array(e,Nk+a,t);this.content=n.decode(r)}else if(r===Pk.BIN){let n=Nk+a;this.body=e.slice(n,n+t)}a+=t}if(this.content===null)throw Error(`THREE.GLTFLoader: JSON content not found.`)}},Ik=class{constructor(e,t){if(!t)throw Error(`THREE.GLTFLoader: No DRACOLoader instance provided.`);this.name=fk.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let n=this.json,r=this.dracoLoader,i=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},s={},c={};for(let e in a){let t=qk[e]||e.toLowerCase();o[t]=a[e]}for(let t in e.attributes){let r=qk[t]||t.toLowerCase();if(a[t]!==void 0){let i=n.accessors[e.attributes[t]];c[r]=Uk[i.componentType].name,s[r]=i.normalized===!0}}return t.getDependency(`bufferView`,i).then(function(e){return new Promise(function(t,n){r.decodeDracoFile(e,function(e){for(let t in e.attributes){let n=e.attributes[t],r=s[t];r!==void 0&&(n.normalized=r)}t(e)},o,c,Vr,n)})})}},Lk=class{constructor(){this.name=fk.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){if((t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0)return e;if(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),t.rotation!==void 0){let t=Math.cos(e.rotation),n=Math.sin(e.rotation);e.matrix.set(e.repeat.x*t,e.repeat.y*n,e.offset.x,-e.repeat.x*n,e.repeat.y*t,e.offset.y,0,0,1),e.matrixAutoUpdate=!1}return e.needsUpdate=!0,e}},Rk=class{constructor(){this.name=fk.KHR_MESH_QUANTIZATION}},zk=class extends $l{constructor(e,t,n,r){super(e,t,n,r)}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r*3+r;for(let e=0;e!==r;e++)t[e]=n[i+e];return t}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=o*2,c=o*3,l=r-t,u=(n-t)/l,d=u*u,f=d*u,p=e*c,m=p-c,h=-2*f+3*d,g=f-d,_=1-h,v=g-d+u;for(let e=0;e!==o;e++){let t=a[m+e+o],n=a[m+e+s]*l,r=a[p+e+o],c=a[p+e]*l;i[e]=_*t+v*n+h*r+g*c}return i}},Bk=new wi,Vk=class extends zk{interpolate_(e,t,n,r){let i=super.interpolate_(e,t,n,r);return Bk.fromArray(i).normalize().toArray(i),i}},Hk={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Uk={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Wk={9728:cn,9729:pn,9984:ln,9985:mn,9986:dn,9987:gn},Gk={33071:on,33648:sn,10497:an},Kk={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},qk={POSITION:`position`,NORMAL:`normal`,TANGENT:`tangent`,TEXCOORD_0:`uv`,TEXCOORD_1:`uv1`,TEXCOORD_2:`uv2`,TEXCOORD_3:`uv3`,COLOR_0:`color`,WEIGHTS_0:`skinWeight`,JOINTS_0:`skinIndex`},Jk={scale:`scale`,translation:`position`,rotation:`quaternion`,weights:`morphTargetInfluences`},Yk={CUBICSPLINE:void 0,LINEAR:Or,STEP:Dr},Xk={OPAQUE:`OPAQUE`,MASK:`MASK`,BLEND:`BLEND`},Zk=new V,Qk=class{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new QO,this.associations=/* @__PURE__ */ new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,r=-1,i=!1,a=-1;if(typeof navigator<`u`&&navigator.userAgent!==void 0){let e=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(e)===!0;let t=e.match(/Version\/(\d+)/);r=n&&t?parseInt(t[1],10):-1,i=e.indexOf(`Firefox`)>-1,a=i?e.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>`u`||n&&r<17||i&&a<98?(this.textureLoader=new Eu(this.options.manager),this.textureLoader.setPriority(this.options.priority),this.textureLoader.setCache(this.options.cache)):(this.textureLoader=new ld(this.options.manager),this.textureLoader.setPriority(this.options.priority),this.textureLoader.setCache(this.options.cache)),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setWithCredentials(this.options.withCredentials),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new yu(this.options.manager),this.fileLoader.setPriority(this.options.priority),this.fileLoader.setCache(this.options.cache),this.fileLoader.setResponseType(`arraybuffer`),(this.options.withCredentials||this.options.crossOrigin===`use-credentials`)&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([n.getDependencies(`scene`),n.getDependencies(`animation`),n.getDependencies(`camera`)])}).then(function(t){let a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};return tk(i,a,r),nk(a,r),Promise.all(n._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){for(let e of a.scenes)e.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,r=t.length;n<r;n++){let r=t[n].joints;for(let t=0,n=r.length;t<n;t++)e[r[t]].isBone=!0}for(let t=0,r=e.length;t<r;t++){let r=e[t];r.mesh!==void 0&&(this._addNodeRef(this.meshCache,r.mesh),r.skin!==void 0&&(n[r.mesh].isSkinnedMesh=!0)),r.camera!==void 0&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;let r=n.clone(),i=(e,t)=>{let n=this.associations.get(e);n!=null&&this.associations.set(t,n);for(let[n,r]of e.children.entries())i(r,t.children[n])};return i(n,r),r.name+=`_instance_`+e.uses[t]++,r}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){let r=e(t[n]);if(r)return r}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let n=[];for(let r=0;r<t.length;r++){let i=e(t[r]);i&&n.push(i)}return n}getDependency(e,t){let n=e+`:`+t,r=this.cache.get(n);if(!r){switch(e){case`scene`:r=this.loadScene(t);break;case`node`:r=this._invokeOne(function(e){return e.loadNode&&e.loadNode(t)});break;case`mesh`:r=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case`accessor`:r=this.loadAccessor(t);break;case`bufferView`:r=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case`buffer`:r=this.loadBuffer(t);break;case`material`:r=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case`texture`:r=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case`skin`:r=this.loadSkin(t);break;case`animation`:r=this._invokeOne(function(e){return e.loadAnimation&&e.loadAnimation(t)});break;case`camera`:r=this.loadCamera(t);break;default:if(r=this._invokeOne(function(n){return n!=this&&n.getDependency&&n.getDependency(e,t)}),!r)throw Error(`Unknown type: `+e)}this.cache.add(n,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){let n=this,r=this.json[e+(e===`mesh`?`es`:`s`)]||[];t=Promise.all(r.map(function(t,r){return n.getDependency(e,r)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!==`arraybuffer`)throw Error(`THREE.GLTFLoader: `+t.type+` buffer type is not supported.`);if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[fk.KHR_BINARY_GLTF].body);let r=this.options;return new Promise(function(e,i){n.load(ed.resolveURL(t.uri,r.path),e,void 0,function(){i(/* @__PURE__ */ Error(`THREE.GLTFLoader: Failed to load buffer "`+t.uri+`".`))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency(`buffer`,t.buffer).then(function(e){let n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)})}loadAccessor(e){let t=this,n=this.json,r=this.json.accessors[e];if(r.bufferView===void 0&&r.sparse===void 0){let e=Kk[r.type],t=Uk[r.componentType],n=r.normalized===!0,i=new t(r.count*e);return Promise.resolve(new co(i,e,n))}let i=[];return r.bufferView===void 0?i.push(null):i.push(this.getDependency(`bufferView`,r.bufferView)),r.sparse!==void 0&&(i.push(this.getDependency(`bufferView`,r.sparse.indices.bufferView)),i.push(this.getDependency(`bufferView`,r.sparse.values.bufferView))),Promise.all(i).then(function(e){let i=e[0],a=Kk[r.type],o=Uk[r.componentType],s=o.BYTES_PER_ELEMENT,c=s*a,l=r.byteOffset||0,u=r.bufferView===void 0?void 0:n.bufferViews[r.bufferView].byteStride,d=r.normalized===!0,f,p;if(u&&u!==c){let e=Math.floor(l/u),n=`InterleavedBuffer:`+r.bufferView+`:`+r.componentType+`:`+e+`:`+r.count,c=t.cache.get(n);c||(f=new o(i,e*u,r.count*u/s),c=new ko(f,u/s),t.cache.add(n,c)),p=new jo(c,a,l%u/s,d)}else f=i===null?new o(r.count*a):new o(i,l,r.count*a),p=new co(f,a,d);if(r.sparse!==void 0){let t=Kk.SCALAR,n=Uk[r.sparse.indices.componentType],s=r.sparse.indices.byteOffset||0,c=r.sparse.values.byteOffset||0,l=new n(e[1],s,r.sparse.count*t),u=new o(e[2],c,r.sparse.count*a);i!==null&&(p=new co(p.array.slice(),p.itemSize,p.normalized)),p.normalized=!1;for(let e=0,t=l.length;e<t;e++){let t=l[e];if(p.setX(t,u[e*a]),a>=2&&p.setY(t,u[e*a+1]),a>=3&&p.setZ(t,u[e*a+2]),a>=4&&p.setW(t,u[e*a+3]),a>=5)throw Error(`THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.`)}p.normalized=d}return p})}loadTexture(e){let t=this.json,n=this.options,r=t.textures[e].source,i=t.images[r],a=this.textureLoader;if(i.uri){let e=n.manager.getHandler(i.uri);e!==null&&(a=e)}return this.loadTextureImage(e,r,a)}loadTextureImage(e,t,n){let r=this,i=this.json,a=i.textures[e],o=i.images[t],s=(o.uri||o.bufferView)+`:`+a.sampler;if(this.textureCache[s])return this.textureCache[s];let c=this.loadImageSource(t,n).then(function(t){t.flipY=!1,t.name=a.name||o.name||``,t.name===``&&typeof o.uri==`string`&&o.uri.startsWith(`data:image/`)===!1&&(t.name=o.uri);let n=(i.samplers||{})[a.sampler]||{};return t.magFilter=Wk[n.magFilter]||1006,t.minFilter=Wk[n.minFilter]||1008,t.wrapS=Gk[n.wrapS]||1e3,t.wrapT=Gk[n.wrapT]||1e3,t.generateMipmaps=!t.isCompressedTexture&&t.minFilter!==1003&&t.minFilter!==1006,r.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[s]=c,c}loadImageSource(e,t){let n=this,r=this.json,i=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(e=>e.clone());let a=r.images[e],o=self.URL||self.webkitURL,s=a.uri||``,c=!1,l;if(t.isKTX2Loader===!0&&a.bufferView!==void 0)l=n.getDependency(`bufferView`,a.bufferView).then(function(e){return new Promise(function(n,r){t.parse(e,n,r)})});else{if(a.bufferView!==void 0)s=n.getDependency(`bufferView`,a.bufferView).then(function(e){c=!0;let t=new Blob([e],{type:a.mimeType});return s=o.createObjectURL(t),s});else if(a.uri===void 0)throw Error(`THREE.GLTFLoader: Image `+e+` is missing URI and bufferView`);l=Promise.resolve(s).then(function(e){return new Promise(function(n,r){let a=n;t.isImageBitmapLoader===!0&&(a=function(e){let t=new zi(e);t.needsUpdate=!0,n(t)}),t.load(ed.resolveURL(e,i.path),a,void 0,r)})})}let u=l.then(function(e){return c===!0&&o.revokeObjectURL(s),nk(e,a),e.userData.mimeType=a.mimeType||ck(a.uri),e}).catch(function(e){throw console.error(`THREE.GLTFLoader: Couldn't load texture`,s),e});return this.sourceCache[e]=u,u}assignTexture(e,t,n,r){let i=this;return this.getDependency(`texture`,n.index).then(function(a){if(!a)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(a=a.clone(),a.channel=n.texCoord),i.extensions[fk.KHR_TEXTURE_TRANSFORM]){let e=n.extensions===void 0?void 0:n.extensions[fk.KHR_TEXTURE_TRANSFORM];if(e){let t=i.associations.get(a);a=i.extensions[fk.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),i.associations.set(a,t)}}return r!==void 0&&(a.colorSpace=r),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,n=e.material,r=t.attributes.tangent===void 0,i=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){let e=`PointsMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new Cc,Lo.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){let e=`LineBasicMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new uc,Lo.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(r||i||a){let e=`ClonedMaterial:`+n.uuid+`:`;r&&(e+=`derivative-tangents:`),i&&(e+=`vertex-colors:`),a&&(e+=`flat-shading:`);let t=this.cache.get(e);t||(t=n.clone(),i&&(t.vertexColors=!0),a&&(t.flatShading=!0),r&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return Hl}loadMaterial(e){let t=this,n=this.json,r=this.extensions,i=n.materials[e],a,o={},s=i.extensions||{},c=[];if(s[fk.KHR_MATERIALS_UNLIT]){let e=r[fk.KHR_MATERIALS_UNLIT];a=e.getMaterialType(),c.push(e.extendParams(o,i,t))}else{let n=i.pbrMetallicRoughness||{};if(o.color=new H(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){let e=n.baseColorFactor;o.color.setRGB(e[0],e[1],e[2],Vr),o.opacity=e[3]}n.baseColorTexture!==void 0&&c.push(t.assignTexture(o,`map`,n.baseColorTexture,Br)),o.metalness=n.metallicFactor===void 0?1:n.metallicFactor,o.roughness=n.roughnessFactor===void 0?1:n.roughnessFactor,n.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(o,`metalnessMap`,n.metallicRoughnessTexture)),c.push(t.assignTexture(o,`roughnessMap`,n.metallicRoughnessTexture))),a=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)})))}i.doubleSided===!0&&(o.side=2);let l=i.alphaMode||Xk.OPAQUE;if(l===Xk.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,l===Xk.MASK&&(o.alphaTest=i.alphaCutoff===void 0?.5:i.alphaCutoff)),i.normalTexture!==void 0&&a!==ss&&(c.push(t.assignTexture(o,`normalMap`,i.normalTexture)),o.normalScale=new z(1,1),i.normalTexture.scale!==void 0)){let e=i.normalTexture.scale;o.normalScale.set(e,e)}if(i.occlusionTexture!==void 0&&a!==ss&&(c.push(t.assignTexture(o,`aoMap`,i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&a!==ss){let e=i.emissiveFactor;o.emissive=new H().setRGB(e[0],e[1],e[2],Vr)}return i.emissiveTexture!==void 0&&a!==ss&&c.push(t.assignTexture(o,`emissiveMap`,i.emissiveTexture,Br)),Promise.all(c).then(function(){let n=new a(o);return i.name&&(n.name=i.name),nk(n,i),t.associations.set(n,{materials:e}),i.extensions&&tk(r,n,i),n})}createUniqueName(e){let t=qd.sanitizeNodeName(e||``);return t in this.nodeNamesUsed?t+`_`+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,n=this.extensions,r=this.primitiveCache;function i(e){return n[fk.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(n){return uk(n,e,t)})}let a=[];for(let n=0,o=e.length;n<o;n++){let o=e[n],s=ak(o),c=r[s];if(c)a.push(c.promise);else{let e;e=o.extensions&&o.extensions[fk.KHR_DRACO_MESH_COMPRESSION]?i(o):uk(new G,o,t),o.mode===Hk.TRIANGLE_STRIP?e=e.then(e=>zv(e,1)):o.mode===Hk.TRIANGLE_FAN&&(e=e.then(e=>zv(e,2))),r[s]={primitive:o,promise:e},a.push(e)}}return Promise.all(a)}loadMesh(e){let t=this,n=this.json,r=this.extensions,i=n.meshes[e],a=i.primitives,o=[];for(let e=0,t=a.length;e<t;e++){let t=a[e].material===void 0?ek(this.cache):this.getDependency(`material`,a[e].material);o.push(t)}return o.push(t.loadGeometries(a)),Promise.all(o).then(async function(n){let o=n.slice(0,n.length-1),s=n[n.length-1],c=[];for(let n=0,l=s.length;n<l;n++){let l=s[n],u=a[n],d,f=o[n];if(u.mode===Hk.TRIANGLES||u.mode===Hk.TRIANGLE_STRIP||u.mode===Hk.TRIANGLE_FAN||u.mode===void 0){let e=i.isSkinnedMesh===!0,t=l.hasAttribute(`skinIndex`)&&l.hasAttribute(`skinWeight`);e&&t===!1&&console.warn(`THREE.GLTFLoader: Missing skinIndex or skinWeight attributes. Skinning disabled.`),d=e&&t?new Os(l,f):new K(l,f),d.isSkinnedMesh===!0&&d.normalizeSkinWeights()}else if(u.mode===Hk.LINES)d=new xc(l,f);else if(u.mode===Hk.LINE_STRIP)d=new vc(l,f);else if(u.mode===Hk.LINE_LOOP)d=new Sc(l,f);else if(u.mode===Hk.POINTS)d=new Oc(l,f);else throw Error(`THREE.GLTFLoader: Primitive mode unsupported: `+u.mode);Object.keys(d.geometry.morphAttributes).length>0&&ik(d,i),d.name=t.createUniqueName(i.name||`mesh_`+e),nk(d,i),u.extensions&&tk(r,d,u),t.assignFinalMaterial(d),c.push(d)}for(let n=0,r=c.length;n<r;n++)t.associations.set(c[n],{meshes:e,primitives:n});if(c.length===1)return i.extensions&&tk(r,c[0],i),c[0];let l=new ba;i.extensions&&tk(r,l,i),t.associations.set(l,{meshes:e});for(let e=0,t=c.length;e<t;e++)l.add(c[e]);return l})}loadCamera(e){let t,n=this.json.cameras[e],r=n[n.type];if(!r)console.warn(`THREE.GLTFLoader: Missing camera parameters.`);else return n.type===`perspective`?t=new Bu(Ci.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):n.type===`orthographic`&&(t=new Gu(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),nk(t,n),Promise.resolve(t)}loadSkin(e){let t=this.json.skins[e],n=[];for(let e=0,r=t.joints.length;e<r;e++)n.push(this._loadNodeShallow(t.joints[e]));return t.inverseBindMatrices===void 0?n.push(null):n.push(this.getDependency(`accessor`,t.inverseBindMatrices)),Promise.all(n).then(function(e){let n=e.pop(),r=e,i=[],a=[];for(let e=0,o=r.length;e<o;e++){let o=r[e];if(o){i.push(o);let t=new V;n!==null&&t.fromArray(n.array,e*16),a.push(t)}else console.warn(`THREE.GLTFLoader: Joint "%s" could not be found.`,t.joints[e])}return new Ns(i,a)})}loadAnimation(e){let t=this.json,n=this,r=t.animations[e],i=r.name?r.name:`animation_`+e,a=[],o=[],s=[],c=[],l=[];for(let e=0,t=r.channels.length;e<t;e++){let t=r.channels[e],n=r.samplers[t.sampler],i=t.target,u=i.node,d=r.parameters===void 0?n.input:r.parameters[n.input],f=r.parameters===void 0?n.output:r.parameters[n.output];i.node!==void 0&&(a.push(this.getDependency(`node`,u)),o.push(this.getDependency(`accessor`,d)),s.push(this.getDependency(`accessor`,f)),c.push(n),l.push(i))}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(s),Promise.all(c),Promise.all(l)]).then(function(e){let t=e[0],a=e[1],o=e[2],s=e[3],c=e[4],l=[];for(let e=0,r=t.length;e<r;e++){let r=t[e],i=a[e],u=o[e],d=s[e],f=c[e];if(r===void 0)continue;r.updateMatrix&&r.updateMatrix();let p=n._createAnimationTracks(r,i,u,d,f);if(p)for(let e=0;e<p.length;e++)l.push(p[e])}let u=new fu(i,void 0,l);return nk(u,r),u})}createNodeMesh(e){let t=this.json,n=this,r=t.nodes[e];return r.mesh===void 0?null:n.getDependency(`mesh`,r.mesh).then(function(e){let t=n._getNodeRef(n.meshCache,r.mesh,e);return r.weights!==void 0&&t.traverse(function(e){if(e.isMesh)for(let t=0,n=r.weights.length;t<n;t++)e.morphTargetInfluences[t]=r.weights[t]}),t})}loadNode(e){let t=this.json,n=this,r=t.nodes[e],i=n._loadNodeShallow(e),a=[],o=r.children||[];for(let e=0,t=o.length;e<t;e++)a.push(n.getDependency(`node`,o[e]));let s=r.skin===void 0?Promise.resolve(null):n.getDependency(`skin`,r.skin);return Promise.all([i,Promise.all(a),s]).then(function(e){let t=e[0],n=e[1],r=e[2];r!==null&&t.traverse(function(e){e.isSkinnedMesh&&e.bind(r,Zk)});for(let e=0,r=n.length;e<r;e++)t.add(n[e]);if(t.userData.pivot!==void 0&&n.length>0){let e=t.userData.pivot,r=n[0];t.pivot=new B().fromArray(e),t.position.x-=e[0],t.position.y-=e[1],t.position.z-=e[2],r.position.set(0,0,0),delete t.userData.pivot}return t})}_loadNodeShallow(e){let t=this.json,n=this.extensions,r=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];let i=t.nodes[e],a=i.name?r.createUniqueName(i.name):``,o=[],s=r._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return s&&o.push(s),i.camera!==void 0&&o.push(r.getDependency(`camera`,i.camera).then(function(e){return r._getNodeRef(r.cameraCache,i.camera,e)})),r._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){o.push(e)}),this.nodeCache[e]=Promise.all(o).then(function(t){let o;if(o=i.isBone===!0?new ks:t.length>1?new ba:t.length===1?t[0]:new ya,o!==t[0])for(let e=0,n=t.length;e<n;e++)o.add(t[e]);if(i.name&&(o.userData.name=i.name,o.name=a),nk(o,i),i.extensions&&tk(n,o,i),i.matrix!==void 0){let e=new V;e.fromArray(i.matrix),o.applyMatrix4(e)}else i.translation!==void 0&&o.position.fromArray(i.translation),i.rotation!==void 0&&o.quaternion.fromArray(i.rotation),i.scale!==void 0&&o.scale.fromArray(i.scale);if(!r.associations.has(o))r.associations.set(o,{});else if(i.mesh!==void 0&&r.meshCache.refs[i.mesh]>1){let e=r.associations.get(o);r.associations.set(o,{...e})}return r.associations.get(o).nodes=e,o}),this.nodeCache[e]}loadScene(e){let t=this.extensions,n=this.json.scenes[e],r=this,i=new ba;n.name&&(i.name=r.createUniqueName(n.name)),nk(i,n),n.extensions&&tk(t,i,n);let a=n.nodes||[],o=[];for(let e=0,t=a.length;e<t;e++)o.push(r.getDependency(`node`,a[e]));return Promise.all(o).then(function(e){for(let t=0,n=e.length;t<n;t++){let n=e[t];n.parent===null?i.add(n):i.add(GO(n))}return r.associations=(e=>{let t=/* @__PURE__ */ new Map;for(let[e,n]of r.associations)(e instanceof Lo||e instanceof zi)&&t.set(e,n);return e.traverse(e=>{let n=r.associations.get(e);n!=null&&t.set(e,n)}),t})(i),i})}_createAnimationTracks(e,t,n,r,i){let a=[],o=e.name?e.name:e.uuid,s=[];function c(e){e.morphTargetInfluences&&s.push(e.name?e.name:e.uuid)}Jk[i.path]===Jk.weights?(c(e),e.isGroup&&e.children.forEach(c)):s.push(o);let l;switch(Jk[i.path]){case Jk.weights:l=su;break;case Jk.rotation:l=lu;break;case Jk.translation:case Jk.scale:l=du;break;default:switch(n.itemSize){case 1:l=su;break;default:l=du}}let u=r.interpolation===void 0?Or:Yk[r.interpolation],d=this._getArrayFromAccessor(n);for(let e=0,n=s.length;e<n;e++){let n=new l(s[e]+`.`+Jk[i.path],t.array,d,u);r.interpolation===`CUBICSPLINE`&&this._createCubicSplineTrackInterpolant(n),a.push(n)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let e=sk(t.constructor),n=new Float32Array(t.length);for(let r=0,i=t.length;r<i;r++)n[r]=t[r]*e;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof lu?Vk:zk)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}})),eA=/* @__PURE__ */ n({MeshoptDecoder:()=>tA}),tA,nA=t((()=>{tA=(function(){var e=`b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuixkbeeeddddillviebeoweuecj:Gdkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WboY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbrl79IV9Rbwq:VZkdbk:XYi5ud9:du8Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaicefhxcj;abad9Uc;WFbGcjdadca0EhmaialfgPar9Rgoadfhsavaoadz:jjjjbgzceVhHcbhOdndninaeaO9nmeaPax9RaD6mdamaeaO9RaOamfgoae6EgAcsfglc9WGhCabaOad2fhXaAcethQaxaDfhiaOaeaoaeao6E9RhLalcl4cifcd4hKazcj;cbfaAfhYcbh8AazcjdfhEaHh3incbh5dnawTmbaxa8Acd4fRbbh5kcbh8Eazcj;cbfhqinaih8Fdndndndna5a8Ecet4ciGgoc9:fPdebdkaPa8F9RaA6mrazcj;cbfa8EaA2fa8FaAz:jjjjb8Aa8FaAfhixdkazcj;cbfa8EaA2fcbaAz:kjjjb8Aa8FhixekaPa8F9RaK6mva8FaKfhidnaCTmbaPai9RcK6mbaocdtc:q:G:cjbfcj:G:cjbawEhaczhrcbhlinargoc9Wfghaqfhrdndndndndndnaaa8Fahco4fRbbalcoG4ciGcdtfydbPDbedvivvvlvkar9cb83bwar9cb83bbxlkarcbaiRbdai8Xbb9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbaqaofgrcGfcbaicdfa8J9c8N1:NfghRbbag9cjjjjjw:dg8J9qE86bbarcVfcbaha8J9c8M1:NfghRbbag9cjjjjjl:dg8J9qE86bbarc7fcbaha8J9c8L1:NfghRbbag9cjjjjjd:dg8J9qE86bbarctfcbaha8J9c8K1:NfghRbbag9cjjjjje:dg8J9qE86bbarc91fcbaha8J9c8J1:NfghRbbag9cjjjj;ab:dg8J9qE86bbarc4fcbaha8J9cg1:NfghRbbag9cjjjja:dg8J9qE86bbarc93fcbaha8J9ch1:NfghRbbag9cjjjjz:dgg9qE86bbarc94fcbahag9ca1:NfghRbbai8Xbe9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbarc95fcbaha8J9c8N1:NfgiRbbag9cjjjjjw:dg8J9qE86bbarc96fcbaia8J9c8M1:NfgiRbbag9cjjjjjl:dg8J9qE86bbarc97fcbaia8J9c8L1:NfgiRbbag9cjjjjjd:dg8J9qE86bbarc98fcbaia8J9c8K1:NfgiRbbag9cjjjjje:dg8J9qE86bbarc99fcbaia8J9c8J1:NfgiRbbag9cjjjj;ab:dg8J9qE86bbarc9:fcbaia8J9cg1:NfgiRbbag9cjjjja:dg8J9qE86bbarcufcbaia8J9ch1:NfgiRbbag9cjjjjz:dgg9qE86bbaiag9ca1:NfhixikaraiRblaiRbbghco4g8Ka8KciSg8KE86bbaqaofgrcGfaiclfa8Kfg8KRbbahcl4ciGg8La8LciSg8LE86bbarcVfa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc7fa8Ka8Lfg8KRbbahciGghahciSghE86bbarctfa8Kahfg8KRbbaiRbeghco4g8La8LciSg8LE86bbarc91fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc4fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc93fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc94fa8Kahfg8KRbbaiRbdghco4g8La8LciSg8LE86bbarc95fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc96fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc97fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc98fa8KahfghRbbaiRbigico4g8Ka8KciSg8KE86bbarc99faha8KfghRbbaicl4ciGg8Ka8KciSg8KE86bbarc9:faha8KfghRbbaicd4ciGg8Ka8KciSg8KE86bbarcufaha8KfgrRbbaiciGgiaiciSgiE86bbaraifhixdkaraiRbwaiRbbghcl4g8Ka8KcsSg8KE86bbaqaofgrcGfaicwfa8Kfg8KRbbahcsGghahcsSghE86bbarcVfa8KahfghRbbaiRbeg8Kcl4g8La8LcsSg8LE86bbarc7faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarctfaha8KfghRbbaiRbdg8Kcl4g8La8LcsSg8LE86bbarc91faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc4faha8KfghRbbaiRbig8Kcl4g8La8LcsSg8LE86bbarc93faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc94faha8KfghRbbaiRblg8Kcl4g8La8LcsSg8LE86bbarc95faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc96faha8KfghRbbaiRbvg8Kcl4g8La8LcsSg8LE86bbarc97faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc98faha8KfghRbbaiRbog8Kcl4g8La8LcsSg8LE86bbarc99faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc9:faha8KfghRbbaiRbrgicl4g8Ka8KcsSg8KE86bbarcufaha8KfgrRbbaicsGgiaicsSgiE86bbaraifhixekarai8Pbw83bwarai8Pbb83bbaiczfhikdnaoaC9pmbalcdfhlaoczfhraPai9RcL0mekkaoaC6moaimexokaCmva8FTmvkaqaAfhqa8Ecefg8Ecl9hmbkdndndndnawTmbasa8Acd4fRbbgociGPlbedrbkaATmdaza8Afh8Fazcj;cbfhhcbh8EaEhaina8FRbbhraahocbhlinaoahalfRbbgqce4cbaqceG9R7arfgr86bbaoadfhoaAalcefgl9hmbkaacefhaa8Fcefh8FahaAfhha8Ecefg8Ecl9hmbxikkaATmeaza8Afhaazcj;cbfhhcbhoceh8EaYh8FinaEaofhlaa8Vbbhrcbhoinala8FaofRbbcwtahaofRbbgqVc;:FiGce4cbaqceG9R7arfgr87bbaladfhlaLaocefgofmbka8FaQfh8FcdhoaacdfhaahaQfhha8EceGhlcbh8EalmbxdkkaATmbaocl4h8Eaza8AfRbbhqcwhoa3hlinalRbbaotaqVhqalcefhlaocwfgoca9hmbkcbhhaEh8FaYhainazcj;cbfahfRbbhrcwhoaahlinalRbbaotarVhralaAfhlaocwfgoca9hmbkara8E94aq7hqcbhoa8Fhlinalaqao486bbalcefhlaocwfgoca9hmbka8Fadfh8FaacefhaahcefghaA9hmbkkaEclfhEa3clfh3a8Aclfg8Aad6mbkaXazcjdfaAad2z:jjjjb8AazazcjdfaAcufad2fadz:jjjjb8AaAaOfhOaihxaimbkc9:hoxdkcbc99aPax9RakSEhoxekc9:hokavcj;kbf8Kjjjjbaok:ysezu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnalaeci9UgrcHf6mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:kjjjb8Aav9cu83iUav9cu83i8Wav9cu83iyav9cu83iaav9cu83iKav9cu83izav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhldnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhoindnalaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfaoaDcu7gPcl4fcsGcitfgsydlhzasydbhHdndnaDcsGgsak9pmbavaiaPfcsGcdtfydbaxasEhDaxasTgOfhxxekdndnascsSmbcehOasc987asamffcefhDxekalcefhDal8SbbgscFeGhPdndnascu9mmbaDhlxekalcvfhlaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhlkcehOaPce4cbaPceG9R7amfhDkaDhmkavc;abfaocitfgsaDBdbasazBdlavaicdtfaDBdbavc;abfaocefcsGcitfgsaHBdbasaDBdlaocdfhoaOaifhidnadcd9hmbabarcetfgsaH87ebasclfaD87ebascdfaz87ebxdkabarcdtfgsaHBdbascwfaDBdbasclfazBdbxekdnaDcpe0mbavaiaqaDcsGfRbbgscl4gP9RcsGcdtfydbaxcefgOaPEhDavaias9RcsGcdtfydbaOaPTgzfgOascsGgPEhsaPThPdndnadcd9hmbabarcetfgHax87ebaHclfas87ebaHcdfaD87ebxekabarcdtfgHaxBdbaHcwfasBdbaHclfaDBdbkavaicdtfaxBdbavc;abfaocitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfaocefcsGcitfgHasBdbaHaDBdlavaiazfgicsGcdtfasBdbavc;abfaocdfcsGcitfgDaxBdbaDasBdlaocifhoaiaPfhiaOaPfhxxekaxcbalRbbgsEgHaDc;:eSgDfhOascsGhAdndnascl4gCmbaOcefhzxekaOhzavaiaC9RcsGcdtfydbhOkdndnaAmbazcefhxxekazhxavaias9RcsGcdtfydbhzkdndnaDTmbalcefhDxekalcdfhDal8SbegPcFeGhsdnaPcu9kmbalcofhHascFbGhscrhldninaD8SbbgPcFbGaltasVhsaPcu9kmeaDcefhDalcrfglc8J9hmbkaHhDxekaDcefhDkasce4cbasceG9R7amfgmhHkdndnaCcsSmbaDhsxekaDcefhsaD8SbbglcFeGhPdnalcu9kmbaDcvfhOaPcFbGhPcrhldninas8SbbgDcFbGaltaPVhPaDcu9kmeascefhsalcrfglc8J9hmbkaOhsxekascefhskaPce4cbaPceG9R7amfgmhOkdndnaAcsSmbashlxekascefhlas8SbbgDcFeGhPdnaDcu9kmbascvfhzaPcFbGhPcrhDdninal8SbbgscFbGaDtaPVhPascu9kmealcefhlaDcrfgDc8J9hmbkazhlxekalcefhlkaPce4cbaPceG9R7amfgmhzkdndnadcd9hmbabarcetfgDaH87ebaDclfaz87ebaDcdfaO87ebxekabarcdtfgDaHBdbaDcwfazBdbaDclfaOBdbkavc;abfaocitfgDaOBdbaDaHBdlavaicdtfaHBdbavc;abfaocefcsGcitfgDazBdbaDaOBdlavaicefgicsGcdtfaOBdbavc;abfaocdfcsGcitfgDaHBdbaDazBdlavaiaCTaCcsSVfgicsGcdtfazBdbaiaATaAcsSVfhiaocifhokawcefhwaocsGhoaicsGhiarcifgrae6mbkkcbc99alaqSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnalaecvf9pmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk:4ioiue99dud99dud99dnaeTmbcbhiabhlindndnal8Uebgv:YgoJ:ji:1Salcof8UebgrciVgw:Y:vgDNJbbbZJbbb:;avcu9kEMgq:lJbbb9p9DTmbaq:Ohkxekcjjjj94hkkalclf8Uebhvalcdf8UebhxalarcefciGcetfak87ebdndnax:YgqaDNJbbbZJbbb:;axcu9kEMgm:lJbbb9p9DTmbam:Ohxxekcjjjj94hxkabaiarciGgkfcd7cetfax87ebdndnav:YgmaDNJbbbZJbbb:;avcu9kEMgP:lJbbb9p9DTmbaP:Ohvxekcjjjj94hvkalarcufciGcetfav87ebdndnawaw2:ZgPaPMaoaoN:taqaqN:tamamN:tgoJbbbbaoJbbbb9GE:raDNJbbbZMgD:lJbbb9p9DTmbaD:Ohrxekcjjjj94hrkalakcetfar87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj98Gcjjj;8if::NUdbabclfhbadcufgdmbkkk:Tvirud99eudndnadcl9hmbaeTmeindndnabRbbgiabcefgl8Sbbgvabcdfgo8Sbbgrf9R:YJbbuJabcifgwRbbgdce4adVgDcd4aDVgDcl4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax86bbdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao86bbdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai86bbdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad86bbabclfhbaecufgembxdkkaeTmbindndnab8Vebgiabcdfgl8Uebgvabclfgo8Uebgrf9R:YJbFu9habcofgw8Vebgdce4adVgDcd4aDVgDcl4aDVgDcw4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax87ebdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao87ebdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai87ebdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad87ebabcwfhbaecufgembkkk9teiucbcbyd:K:G:cjbgeabcifc98GfgbBd:K:G:cjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkk83dbcj:Gdk8Kbbbbdbbblbbbwbbbbbbbebbbdbbblbbbwbbbbc:K:Gdkl8W:qbb`,t=`b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuixkbbebeeddddilve9Weeeviebeoweuecj:Gdkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WbwY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbDl79IV9Rbqq:W9Dklbzik94evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaeai86b:q:W:cjbaecitab8Piw83i:q:G:cjbaecefgecjd9hmbkk:JBl8Aud97dur978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaialfgxar9RhodnadTgmmbavaoad;8qbbkaicefhPcj;abad9Uc;WFbGcjdadca0EhsdndndnadTmbaoadfhzcbhHinaeaH9nmdaxaP9RaD6miabaHad2fhOaPaDfhAasaeaH9RaHasfae6EgCcsfgocl4cifcd4hXavcj;cbfaoc9WGgQcetfhLavcj;cbfaQci2fhKavcj;cbfaQfhYcbh8Aaoc;ab6hEincbh3dnawTmbaPa8Acd4fRbbh3kcbh5avcj;cbfh8Eindndndndna3a5cet4ciGgoc9:fPdebdkaxaA9RaQ6mwdnaQTmbavcj;cbfa5aQ2faAaQ;8qbbkaAaCfhAxdkaQTmeavcj;cbfa5aQ2fcbaQ;8kbxekaxaA9RaX6moaoclVcbawEhraAaXfhocbhidnaEmbaxao9Rc;Gb6mbcbhlina8EalfhidndndndndndnaAalco4fRbbgqciGarfPDbedibledibkaipxbbbbbbbbbbbbbbbbpklbxlkaiaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaiaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaiaopbbbpklbaoczfhoxekaiaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqcd4ciGarfPDbedibledibkaiczfpxbbbbbbbbbbbbbbbbpklbxlkaiczfaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaiczfaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaiczfaopbbbpklbaoczfhoxekaiczfaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqcl4ciGarfPDbedibledibkaicafpxbbbbbbbbbbbbbbbbpklbxlkaicafaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaoclffagRb:q:W:cjbfhoxikaicafaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbahaocwffagRb:q:W:cjbfhoxdkaicafaopbbbpklbaoczfhoxekaicafaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbahaocdffagRb:q:W:cjbfhokdndndndndndnaqco4arfPDbedibledibkaic8Wfpxbbbbbbbbbbbbbbbbpklbxlkaic8Wfaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Ngicitpbi:q:G:cjbaiRb:q:W:cjbgipsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbaiaoclffaqRb:q:W:cjbfhoxikaic8Wfaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Ngicitpbi:q:G:cjbaiRb:q:W:cjbgipsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spklbaiaocwffaqRb:q:W:cjbfhoxdkaic8Wfaopbbbpklbaoczfhoxekaic8WfaopbbdaoRbbgicitpbi:q:G:cjbaiRb:q:W:cjbgipsaoRbegqcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpklbaiaocdffaqRb:q:W:cjbfhokalc;abfhialcjefaQ0meaihlaxao9Rc;Fb0mbkkdnaiaQ9pmbaici4hlinaxao9RcK6mwa8EaifhqdndndndndndnaAaico4fRbbalcoG4ciGarfPDbedibledibkaqpxbbbbbbbbbbbbbbbbpkbbxlkaqaopbblaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLg8Fcdp:mea8FpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogapxiiiiiiiiiiiiiiiip8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spkbbahaoclffagRb:q:W:cjbfhoxikaqaopbbwaopbbbg8Fclp:mea8FpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogapxssssssssssssssssp8Jg8Fp5b9cjF;8;4;W;G;ab9:9cU1:Nghcitpbi:q:G:cjbahRb:q:W:cjbghpsa8Fp5e9cjF;8;4;W;G;ab9:9cU1:Nggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPaaa8Fp9spkbbahaocwffagRb:q:W:cjbfhoxdkaqaopbbbpkbbaoczfhoxekaqaopbbdaoRbbghcitpbi:q:G:cjbahRb:q:W:cjbghpsaoRbeggcitpbi:q:G:cjbp9UpmbedilvorzHOACXQLpPpkbbahaocdffagRb:q:W:cjbfhokalcdfhlaiczfgiaQ6mbkkaohAaoTmoka8EaQfh8Ea5cefg5cl9hmbkdndndndnawTmbaza8Acd4fRbbglciGPlbedwbkaQTmdavcjdfa8Afhlava8Afpbdbh8Jcbhoinalavcj;cbfaofpblbg8KaYaofpblbg8LpmbzeHdOiAlCvXoQrLg8MaLaofpblbg8NaKaofpblbgypmbzeHdOiAlCvXoQrLg8PpmbezHdiOAlvCXorQLg8Fcep9Ta8Fpxeeeeeeeeeeeeeeeegap9op9Hp9rg8Fa8Jp9Ug8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9Abbbaladfgla8Ja8Ma8PpmwDKYqk8AExm35Ps8E8Fg8Fcep9Ta8Faap9op9Hp9rg8Fp9Ug8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9Abbbaladfgla8Ja8Ka8LpmwKDYq8AkEx3m5P8Es8Fg8Ka8NaypmwKDYq8AkEx3m5P8Es8Fg8LpmbezHdiOAlvCXorQLg8Fcep9Ta8Faap9op9Hp9rg8Fp9Ug8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp9Ug8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9Abbbaladfgla8Ja8Ka8LpmwDKYqk8AExm35Ps8E8Fg8Fcep9Ta8Faap9op9Hp9rg8Fp9Ugap9Abbbaladfglaaa8Fa8Fpmlvorlvorlvorlvorp9Ugap9Abbbaladfglaaa8Fa8FpmwDqkwDqkwDqkwDqkp9Ugap9Abbbaladfglaaa8Fa8FpmxmPsxmPsxmPsxmPsp9Ug8Jp9AbbbaladfhlaoczfgoaQ6mbxikkaQTmeavcjdfa8Afhlava8Afpbdbh8Jcbhoinalavcj;cbfaofpblbg8KaYaofpblbg8LpmbzeHdOiAlCvXoQrLg8MaLaofpblbg8NaKaofpblbgypmbzeHdOiAlCvXoQrLg8PpmbezHdiOAlvCXorQLg8Fcep:nea8Fpxebebebebebebebebgap9op:bep9rg8Fa8Jp:oeg8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9Abbbaladfgla8Ja8Ma8PpmwDKYqk8AExm35Ps8E8Fg8Fcep:nea8Faap9op:bep9rg8Fp:oeg8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9Abbbaladfgla8Ja8Ka8LpmwKDYq8AkEx3m5P8Es8Fg8Ka8NaypmwKDYq8AkEx3m5P8Es8Fg8LpmbezHdiOAlvCXorQLg8Fcep:nea8Faap9op:bep9rg8Fp:oeg8Jp9Abbbaladfgla8Ja8Fa8Fpmlvorlvorlvorlvorp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmwDqkwDqkwDqkwDqkp:oeg8Jp9Abbbaladfgla8Ja8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9Abbbaladfgla8Ja8Ka8LpmwDKYqk8AExm35Ps8E8Fg8Fcep:nea8Faap9op:bep9rg8Fp:oegap9Abbbaladfglaaa8Fa8Fpmlvorlvorlvorlvorp:oegap9Abbbaladfglaaa8Fa8FpmwDqkwDqkwDqkwDqkp:oegap9Abbbaladfglaaa8Fa8FpmxmPsxmPsxmPsxmPsp:oeg8Jp9AbbbaladfhlaoczfgoaQ6mbxdkkaQTmbcbhocbalcl4gl9Rc8FGhiavcjdfa8Afhrava8Afpbdbhainaravcj;cbfaofpblbg8JaYaofpblbg8KpmbzeHdOiAlCvXoQrLg8LaLaofpblbg8MaKaofpblbg8NpmbzeHdOiAlCvXoQrLgypmbezHdiOAlvCXorQLg8Faip:Rea8Falp:Tep9qg8Faap9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9Abbbaradfgraaa8LaypmwDKYqk8AExm35Ps8E8Fg8Faip:Rea8Falp:Tep9qg8Fp9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9Abbbaradfgraaa8Ja8KpmwKDYq8AkEx3m5P8Es8Fg8Ja8Ma8NpmwKDYq8AkEx3m5P8Es8Fg8KpmbezHdiOAlvCXorQLg8Faip:Rea8Falp:Tep9qg8Fp9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9Abbbaradfgraaa8Ja8KpmwDKYqk8AExm35Ps8E8Fg8Faip:Rea8Falp:Tep9qg8Fp9rgap9Abbbaradfgraaa8Fa8Fpmlvorlvorlvorlvorp9rgap9Abbbaradfgraaa8Fa8FpmwDqkwDqkwDqkwDqkp9rgap9Abbbaradfgraaa8Fa8FpmxmPsxmPsxmPsxmPsp9rgap9AbbbaradfhraoczfgoaQ6mbkka8Aclfg8Aad6mbkdnaCad2goTmbaOavcjdfao;8qbbkdnammbavavcjdfaCcufad2fad;8qbbkaCaHfhHc9:hoaAhPaAmbxlkkaeTmbaDalfhrcbhocuhlinaralaD9RglfaD6mdasaeao9Raoasfae6Eaofgoae6mbkaial9RhPkcbc99axaP9RakSEhoxekc9:hokavcj;kbf8Kjjjjbaokwbz:bjjjbkNsezu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnalaeci9UgrcHf6mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbav9cu83iUav9cu83i8Wav9cu83iyav9cu83iaav9cu83iKav9cu83izav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhldnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhoindnalaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfaoaDcu7gPcl4fcsGcitfgsydlhzasydbhHdndnaDcsGgsak9pmbavaiaPfcsGcdtfydbaxasEhDaxasTgOfhxxekdndnascsSmbcehOasc987asamffcefhDxekalcefhDal8SbbgscFeGhPdndnascu9mmbaDhlxekalcvfhlaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhlkcehOaPce4cbaPceG9R7amfhDkaDhmkavc;abfaocitfgsaDBdbasazBdlavaicdtfaDBdbavc;abfaocefcsGcitfgsaHBdbasaDBdlaocdfhoaOaifhidnadcd9hmbabarcetfgsaH87ebasclfaD87ebascdfaz87ebxdkabarcdtfgsaHBdbascwfaDBdbasclfazBdbxekdnaDcpe0mbavaiaqaDcsGfRbbgscl4gP9RcsGcdtfydbaxcefgOaPEhDavaias9RcsGcdtfydbaOaPTgzfgOascsGgPEhsaPThPdndnadcd9hmbabarcetfgHax87ebaHclfas87ebaHcdfaD87ebxekabarcdtfgHaxBdbaHcwfasBdbaHclfaDBdbkavaicdtfaxBdbavc;abfaocitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfaocefcsGcitfgHasBdbaHaDBdlavaiazfgicsGcdtfasBdbavc;abfaocdfcsGcitfgDaxBdbaDasBdlaocifhoaiaPfhiaOaPfhxxekaxcbalRbbgsEgHaDc;:eSgDfhOascsGhAdndnascl4gCmbaOcefhzxekaOhzavaiaC9RcsGcdtfydbhOkdndnaAmbazcefhxxekazhxavaias9RcsGcdtfydbhzkdndnaDTmbalcefhDxekalcdfhDal8SbegPcFeGhsdnaPcu9kmbalcofhHascFbGhscrhldninaD8SbbgPcFbGaltasVhsaPcu9kmeaDcefhDalcrfglc8J9hmbkaHhDxekaDcefhDkasce4cbasceG9R7amfgmhHkdndnaCcsSmbaDhsxekaDcefhsaD8SbbglcFeGhPdnalcu9kmbaDcvfhOaPcFbGhPcrhldninas8SbbgDcFbGaltaPVhPaDcu9kmeascefhsalcrfglc8J9hmbkaOhsxekascefhskaPce4cbaPceG9R7amfgmhOkdndnaAcsSmbashlxekascefhlas8SbbgDcFeGhPdnaDcu9kmbascvfhzaPcFbGhPcrhDdninal8SbbgscFbGaDtaPVhPascu9kmealcefhlaDcrfgDc8J9hmbkazhlxekalcefhlkaPce4cbaPceG9R7amfgmhzkdndnadcd9hmbabarcetfgDaH87ebaDclfaz87ebaDcdfaO87ebxekabarcdtfgDaHBdbaDcwfazBdbaDclfaOBdbkavc;abfaocitfgDaOBdbaDaHBdlavaicdtfaHBdbavc;abfaocefcsGcitfgDazBdbaDaOBdlavaicefgicsGcdtfaOBdbavc;abfaocdfcsGcitfgDaHBdbaDazBdlavaiaCTaCcsSVfgicsGcdtfazBdbaiaATaAcsSVfhiaocifhokawcefhwaocsGhoaicsGhiarcifgrae6mbkkcbc99alaqSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnalaecvf9pmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk;Toio97eue97aec98Ghedndnadcl9hmbaeTmecbhdinababpbbbgicKp:RecKp:Sep;6eglaicwp:RecKp:Sep;6ealp;Geaiczp:RecKp:Sep;6egvp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egralpxbbbjbbbjbbbjbbbjgwp9op9rp;Keglpxbb;:9cbb;:9cbb;:9cbb;:9calalp;Meaoaop;Meavaravawp9op9rp;Keglalp;Mep;Kep;Kep;Jep;Negvp;Mepxbbn0bbn0bbn0bbn0grp;KepxFbbbFbbbFbbbFbbbp9oaipxbbbFbbbFbbbFbbbFp9op9qalavp;Mearp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaoavp;Mearp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbabczfhbadclfgdae6mbxdkkaeTmbcbhdinabczfgDaDpbbbgipxbbbbbbFFbbbbbbFFgwp9oabpbbbgoaipmbediwDqkzHOAKY8AEgvczp:Reczp:Sep;6eglaoaipmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eavczp:Sep;6egvp;Gealp;Gep;Kep;Legipxbbbbbbbbbbbbbbbbp:2egralpxbbbjbbbjbbbjbbbjgqp9op9rp;Keglpxb;:FSb;:FSb;:FSb;:FSalalp;Meaiaip;Meavaravaqp9op9rp;Keglalp;Mep;Kep;Kep;Jep;Negvp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbp9oaiavp;Mearp;Keczp:Rep9qgialavp;Mearp;KepxFFbbFFbbFFbbFFbbp9oglpmwDKYqk8AExm35Ps8E8Fp9qpkbbabaoawp9oaialpmbezHdiOAlvCXorQLp9qpkbbabcafhbadclfgdae6mbkkk;2ileue97euo97dnaec98GgiTmbcbheinabcKfpx:ji:1S:ji:1S:ji:1S:ji:1SabpbbbglabczfgvpbbbgopmlvorxmPsCXQL358E8Fgrczp:Segwpxibbbibbbibbbibbbp9qp;6egDp;NegqaDaDp;MegDaDp;KealaopmbediwDqkzHOAKY8AEgDczp:Reczp:Sep;6eglalp;MeaDczp:Sep;6egoaop;Mearczp:Reczp:Sep;6egrarp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jep;Mepxbbn0bbn0bbn0bbn0gDp;KepxFFbbFFbbFFbbFFbbgkp9oaqaop;MeaDp;Keczp:Rep9qgoaqalp;MeaDp;Keakp9oaqarp;MeaDp;Keczp:Rep9qgDpmwDKYqk8AExm35Ps8E8Fglp5eawclp:RegqpEi:T:j83ibavalp5baqpEd:T:j83ibabcwfaoaDpmbezHdiOAlvCXorQLgDp5eaqpEe:T:j83ibabaDp5baqpEb:T:j83ibabcafhbaeclfgeai6mbkkkuee97dnadcd4ae2c98GgeTmbcbhdinababpbbbgicwp:Recwp:Sep;6eaicep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepkbbabczfhbadclfgdae6mbkkk:Sodw97euaec98Ghedndnadcl9hmbaeTmecbhdinabpxbbuJbbuJbbuJbbuJabpbbbgicKp:TeglaicYp:Tep9qgvcdp:Teavp9qgvclp:Teavp9qgop;6ep;Negvaicwp:RecKp:SegraipxFbbbFbbbFbbbFbbbgwp9ogDp:Uep;6ep;Mepxbbn0bbn0bbn0bbn0gqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9oavaDarp:Xeaiczp:RecKp:Segip:Uep;6ep;Meaqp;Keawp9op9qavaDaraip:Uep:Xep;6ep;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qavaoalcep:Rep9oalpxebbbebbbebbbebbbp9op9qp;6ep;Meaqp;KecKp:Rep9qpkbbabczfhbadclfgdae6mbxdkkaeTmbcbhdinabczfgkpxbFu9hbFu9hbFu9hbFu9habpbbbglakpbbbgrpmlvorxmPsCXQL358E8Fgvczp:TegqavcHp:Tep9qgicdp:Teaip9qgiclp:Teaip9qgicwp:Teaip9qgop;6ep;NegialarpmbediwDqkzHOAKY8AEgDpxFFbbFFbbFFbbFFbbglp9ograDczp:Segwp:Ueavczp:Reczp:SegDp:Xep;6ep;Mepxbbn0bbn0bbn0bbn0gvp;Kealp9oaiarawaDp:Uep:Xep;6ep;Meavp;Keczp:Rep9qgwaiaoaqcep:Rep9oaqpxebbbebbbebbbebbbp9op9qp;6ep;Meavp;Keczp:ReaiaDarp:Uep;6ep;Meavp;Kealp9op9qgipmwDKYqk8AExm35Ps8E8FpkbbabawaipmbezHdiOAlvCXorQLpkbbabcafhbadclfgdae6mbkkk9teiucbcbydj:G:cjbgeabcifc98GfgbBdj:G:cjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkxebcj:Gdklz:zbb`,n=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),r=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!=`object`)return{supported:!1};var i=WebAssembly.validate(n)?s(t):s(e),a,o=WebAssembly.instantiate(i,{}).then(function(e){a=e.instance,a.exports.__wasm_call_ctors()});function s(e){for(var t=new Uint8Array(e.length),n=0;n<e.length;++n){var i=e.charCodeAt(n);t[n]=i>96?i-97:i>64?i-39:i+4}for(var a=0,n=0;n<e.length;++n)t[a++]=t[n]<60?r[t[n]]:(t[n]-60)*64+t[++n];return t.buffer.slice(0,a)}function c(e,t,n,r,i,a,o){var s=e.exports.sbrk,c=r+3&-4,l=s(c*i),u=s(a.length),d=new Uint8Array(e.exports.memory.buffer);d.set(a,u);var f=t(l,r,i,u,a.length);if(f==0&&o&&o(l,c,i),n.set(d.subarray(l,l+r*i)),s(l-s(0)),f!=0)throw Error(`Malformed buffer data: `+f)}var l={NONE:``,OCTAHEDRAL:`meshopt_decodeFilterOct`,QUATERNION:`meshopt_decodeFilterQuat`,EXPONENTIAL:`meshopt_decodeFilterExp`,COLOR:`meshopt_decodeFilterColor`},u={ATTRIBUTES:`meshopt_decodeVertexBuffer`,TRIANGLES:`meshopt_decodeIndexBuffer`,INDICES:`meshopt_decodeIndexSequence`},d=[],f=0;function p(e){var t={object:new Worker(e),pending:0,requests:{}};return t.object.onmessage=function(e){var n=e.data;t.pending-=n.count,t.requests[n.id][n.action](n.value),delete t.requests[n.id]},t}function m(e){for(var t=`self.ready = WebAssembly.instantiate(new Uint8Array([`+new Uint8Array(i)+`]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = `+g.name+`;`+c.toString()+g.toString(),n=new Blob([t],{type:`text/javascript`}),r=URL.createObjectURL(n),a=d.length;a<e;++a)d[a]=p(r);for(var a=e;a<d.length;++a)d[a].object.postMessage({});d.length=e,URL.revokeObjectURL(r)}function h(e,t,n,r,i){for(var a=d[0],o=1;o<d.length;++o)d[o].pending<a.pending&&(a=d[o]);return new Promise(function(o,s){var c=new Uint8Array(n),l=++f;a.pending+=e,a.requests[l]={resolve:o,reject:s},a.object.postMessage({id:l,count:e,size:t,source:c,mode:r,filter:i},[c.buffer])})}function g(e){var t=e.data;self.ready.then(function(e){if(!t.id)return self.close();try{var n=new Uint8Array(t.count*t.size);c(e,e.exports[t.mode],n,t.count,t.size,t.source,e.exports[t.filter]),self.postMessage({id:t.id,count:t.count,action:`resolve`,value:n},[n.buffer])}catch(e){self.postMessage({id:t.id,count:t.count,action:`reject`,value:e})}})}return{ready:o,supported:!0,useWorkers:function(e){m(e)},decodeVertexBuffer:function(e,t,n,r,i){c(a,a.exports.meshopt_decodeVertexBuffer,e,t,n,r,a.exports[l[i]])},decodeIndexBuffer:function(e,t,n,r){c(a,a.exports.meshopt_decodeIndexBuffer,e,t,n,r)},decodeIndexSequence:function(e,t,n,r){c(a,a.exports.meshopt_decodeIndexSequence,e,t,n,r)},decodeGltfBuffer:function(e,t,n,r,i,o){c(a,a.exports[u[i]],e,t,n,r,a.exports[l[o]])},decodeGltfBufferAsync:function(e,t,n,r,i){return d.length>0?h(e,t,n,u[r],l[i]):o.then(function(){var o=new Uint8Array(e*t);return c(a,a.exports[u[r]],o,e,t,n,a.exports[l[i]]),o})}}})()})),rA=/* @__PURE__ */ n({applyMorph:()=>oA,buildModel:()=>sA,gltfExtensionsUsed:()=>iA});function iA(e){let t=new Uint8Array(e),n;if(t.byteLength>=20&&new DataView(e).getUint32(0,!0)===1179937895){let r=new DataView(e).getUint32(12,!0);n=new TextDecoder().decode(t.subarray(20,20+r))}else n=new TextDecoder().decode(t);try{let e=JSON.parse(n);return Array.isArray(e.extensionsUsed)?e.extensionsUsed.filter(e=>typeof e==`string`):[]}catch{return[]}}async function aA(e){let t=cA.get(e);return t||(t=(async()=>{let[{GLTFLoader:t},n]=await Promise.all([Promise.resolve().then(()=>($k(),ZO)),fetch(e)]);if(!n.ok)throw Error(`HTTP ${n.status} for ${e}`);let r=await n.arrayBuffer(),i=iA(r);if(i.includes(`KHR_draco_mesh_compression`))throw Error(`${e} uses Draco compression (KHR_draco_mesh_compression), which the Agent3D runtime does not decode. Re-export it without Draco (Blender: uncheck "Compression"), or convert it to meshopt with gltfpack (\`gltfpack -i in.glb -o out.glb -cc\`), then run \`agent3d assets optimize\`.`);let a=new t;if(i.includes(`EXT_meshopt_compression`)){let{MeshoptDecoder:e}=await Promise.resolve().then(()=>(nA(),eA));await e.ready,a.setMeshoptDecoder(e)}let o=e.slice(0,e.lastIndexOf(`/`)+1);return a.parseAsync(r,/^data:/.test(e)?``:o)})(),t.catch(()=>cA.delete(e)),cA.set(e,t)),t}function oA(e,t){e.traverse(e=>{let n=e;if(n.isMesh&&n.morphTargetDictionary&&n.morphTargetInfluences)for(let[e,r]of Object.entries(t)){let t=n.morphTargetDictionary[e];t!==void 0&&typeof r==`number`&&(n.morphTargetInfluences[t]=r)}})}async function sA(e,t){let n=await aA(t.resolveAsset(e.src)),{clone:r}=await Promise.resolve().then(()=>(XO(),VO)),i=r(n.scene),a=new ba;a.add(i),i.updateMatrixWorld(!0);let o=new Wa().setFromObject(i);if(!o.isEmpty()){let t=o.getSize(new B),n=Math.max(t.x,t.y,t.z),r=e.fit&&n>0?e.fit/n:1;if(i.scale.multiplyScalar(r),e.center!==!1){let e=o.getCenter(new B);i.position.set(-e.x*r,-o.min.y*r,-e.z*r)}}i.traverse(t=>{let n=t;n.isMesh&&(n.castShadow=e.castShadow??!0,n.receiveShadow=e.receiveShadow??!1)}),e.material&&await bw(i,e.material,t),e.morph&&oA(i,e.morph);let s;if(n.animations.length){let r=new Zd(i),a=null,o=e=>typeof e==`number`||/^\d+$/.test(String(e))?n.animations[Number(e)]:n.animations.find(t=>t.name===e)??n.animations.find(t=>t.name.toLowerCase().includes(String(e).toLowerCase())),c=/* @__PURE__ */ new Set,l=r=>{let i=o(r);return!i&&!c.has(String(r))&&(c.add(String(r)),t.issue(`asset-load`,`Model ${e.id} has no animation clip "${r}" (clips: ${n.animations.map(e=>e.name).join(`, `)})`,`objects#${e.id}.animation.clip`)),i},u=(e,t={})=>{let n=l(e);if(!n)return;let i=r.clipAction(n);i.setLoop(t.loop===!1?wr:Tr,1/0),i.clampWhenFinished=t.loop===!1,i.timeScale=Q(t.speed,1),i.enabled=!0,a&&a!==i?(i.reset().setEffectiveWeight(1).play(),a.crossFadeTo(i,Q(t.crossfade,.3),!1)):i.setEffectiveWeight(1).play(),a=i},d=e=>{let t=l(e);if(!t)return null;let n=r.clipAction(t);return n.isRunning()||(n.enabled=!0,n.setLoop(Tr,1/0),n.play()),n},f={weight(e,t){d(e)?.setEffectiveWeight(Math.max(0,t))},speed(e,t){let n=d(e);n&&(n.timeScale=t)},time(e,t){let n=d(e);n&&(n.paused=!0,n.time=Math.max(0,t))}},p=e.animation??{},m=()=>{r.stopAllAction(),a=null,u(p.clip??0,p),p.offset&&a&&(a.time=Math.max(0,p.offset));for(let[e,t]of Object.entries(p.blend??{}))f.weight(e,t);r.update(0)};s={mixer:r,clips:n.animations,play:u,control:f,reset:m},m()}return{object:a,animator:s}}var cA,lA=t((()=>{J(),zS(),jw(),cA=/* @__PURE__ */ new Map}));J(),Xg(),Tv(),zS(),jw();function uA(e){let t={position:e.position.clone(),quaternion:e.quaternion.clone(),scale:e.scale.clone(),visible:e.visible},n=e;return n.isLight&&(t.intensity=n.intensity,t.color=n.color.clone()),t}function dA(e,t){t.position&&e.position.set(t.position[0]??0,t.position[1]??0,t.position[2]??0),t.rotation&&e.rotation.set((t.rotation[0]??0)*LS,(t.rotation[1]??0)*LS,(t.rotation[2]??0)*LS),t.scale!==void 0&&(typeof t.scale==`number`?e.scale.setScalar(t.scale):e.scale.set(t.scale[0]??1,t.scale[1]??1,t.scale[2]??1))}var fA=/* @__PURE__ */ new Set([`hoverScale`,`hoverLift`,`clickBounce`,`spinOnClick`]),pA=class e{def;ctx;scene=new ka;camera;rig;env=null;entries=/* @__PURE__ */ new Map;timeline=null;settleEntrances=!1;updaters=[];cameraRest0={position:new B,target:new B,fov:45,zoom:10,focus:void 0};motionHost;overrides;shots=[];focusWritten=!1;postfxParam=null;viewportH=600;input={pointer:{x:0,y:0,inside:!1},scroll:0,hovered:/* @__PURE__ */ new Set,clicked:/* @__PURE__ */ new Set,timelineT:null};disposed=!1;constructor(e,t){this.def=e,this.ctx=t,t.onUpdate=e=>this.updaters.push(e)}static async create(t,n,r,i,a=!1){let o=new e(t,n);return await o.build(r,i,a),o}async build(e,t,n){let{def:r,ctx:i}=this;{this.camera=wT(r.camera,e),this.rig=await kT(r.camera,this.camera,t,i.deterministic),this.cameraRest0.position.copy(this.rig.rest.position),this.cameraRest0.target.copy(this.rig.rest.target),this.cameraRest0.fov=this.rig.rest.fov,this.cameraRest0.zoom=this.rig.rest.zoom;let n=r.postfx?.find(e=>e.type===`dof`);this.cameraRest0.focus=n&&typeof n.focus==`number`?n.focus:n?8:void 0,this.rig.rest.focus=this.cameraRest0.focus;let a=AD(r.environment??{background:`#ffffff`},this.scene,this.camera,!!r.target?.transparent,i),o=Promise.all((r.lights??[]).map((e,t)=>this.addLight(e,t))),s=/* @__PURE__ */ new Map,c=r.objects??[],l=e=>e.attach===`camera`?this.camera:this.scene;c.some(e=>e.attach===`camera`)&&this.scene.add(this.camera),await Promise.all(c.filter(e=>e.kind===`generator`&&e.generator===`terrain`).map(e=>this.addObject(e,l(e),void 0,s))),mA(s,c),await Promise.all(c.filter(e=>e.kind!==`generator`||e.generator!==`terrain`).map(e=>this.addObject(e,l(e),void 0,s)));let u=new Map(c.map((e,t)=>[e.id,t]));this.scene.children.sort((e,t)=>(u.get(e.userData.a3dId)??-1)-(u.get(t.userData.a3dId)??-1)),this.env=await a;for(let e of this.env.objects)this.scene.add(e);if(await o,this.canonicalOrder(r),this.motionHost={object:e=>this.entries.get(e)?.object??null,select:e=>this.select(e),camera:this.rig.rest,scene:this.scene,renderer:i.renderer,postfx:{set:(e,t,n)=>this.postfxParam?.(e,t,n),base:(e,t)=>{let n=Ox(r.postfx).find(t=>t.type===e)?.[t];return typeof n==`number`||typeof n==`string`?n:void 0}},clips:e=>this.entries.get(e)?.animator?.control,issue:i.issue,seed:r.seed??1},this.overrides=new Gw(this.motionHost),this.shots=Zw(r.camera?.shots),r.timeline){this.timeline=Uw(r.timeline,this.motionHost);for(let e of this.timeline.targets){let t=this.entries.get(e);t&&(t.animated=!0)}}for(let e of r.interactions??[]){if(e.target&&(e.on===`click`||e.on===`hover`||e.on===`hoverEnd`)){let t=this.entries.get(e.target);t&&(t.interactive=!0)}for(let t of e.do??[]){let e=t.set?.path;if(typeof e==`string`)for(let t of this.overrides.idsOf(e)){let e=this.entries.get(t);e&&(e.animated=!0)}}}this.fitShadows()}}canonicalOrder(e){let t=this.entries,n=/* @__PURE__ */ new Map,r=e=>{let r=t.get(e);r&&!n.has(e)&&n.set(e,r)};(e.lights??[]).forEach((e,t)=>r(e.id??`light${t}`));let i=e=>{for(let n of e){r(n.id);let e=`${n.id}/`;for(let i of t.keys())i.startsWith(e)&&t.get(i).parentId===n.id&&r(i);if(!n.children?.length)continue;let a=t.get(n.id)?.object;if(a){let e=new Map(n.children.map((e,t)=>[e.id,t]));a.children.sort((t,n)=>(e.get(t.userData.a3dId)??-1)-(e.get(n.userData.a3dId)??-1))}i(n.children)}};i(e.objects??[]);for(let[e,r]of t)n.has(e)||n.set(e,r);this.entries=n}async overrideGeneratorMaterial(e,t,n){let r=lw(t),i=await yw(t,n,{vertexColors:r.type!==`shader`&&r.type!==`normal`&&r.type!==`gradient`&&!r.color&&!r.map}),a=[];e.traverse(e=>{e.isMesh&&e.userData.materialTarget&&a.push(e)});for(let e of a)e.material.dispose(),e.material=i,pw(i,e.geometry)}rngFor(e,t){return dv(t??fv(this.def.seed??1,e))}behaviourContext(e){let t=this;return{object:e.object,base:{position:e.rest.position,rotation:new na().setFromQuaternion(e.rest.quaternion),scale:e.rest.scale},get pointer(){return t.input.pointer},hovered:()=>t.input.hovered.has(e.id),clicked:()=>t.input.clicked.has(e.id),scroll:()=>t.input.scroll,get camera(){return t.camera},rng:this.rngFor(e.id+`:behaviours`),find:e=>e===`camera`?t.camera:t.entries.get(e)?.object??null}}attachBehaviours(e){let t=e.def.behaviours??[];e.runners=[];for(let n of t){let t=FC[n.type];t?(e.runners.push(HC(n,t,this.behaviourContext(e),{settled:()=>this.settleEntrances})),(fA.has(n.type)||n.when===`hover`||n.when===`click`)&&(e.interactive=!0)):this.ctx.issue(`unknown-catalog-id`,`Unknown behaviour "${n.type}"`,`objects#${e.id}.behaviours`)}e.runners.length&&(e.animated=!0)}resetBehaviours(){for(let e of this.entries.values()){for(let t of e.runners)t.dispose();e.def.behaviours?.length&&this.attachBehaviours(e),e.animator?.reset?e.animator.reset():e.animator?.mixer.setTime(0)}this.overrides?.reset()}async addLight(e,t){let n=await oE(e,this.def.environment?.shadows),r=e.id??`light${t}`;this.scene.add(n),(n instanceof qu||n instanceof Hu)&&this.scene.add(n.target),n.userData.a3dId=r;let i={id:r,kind:`light`,def:e,object:n,rest:uA(n),runners:[],animated:!1,topLevel:!1,interactive:!1};this.entries.set(r,i),this.attachBehaviours(i)}async addObject(e,t,n,r){let i=this.ctx,a,o,s,c,l=[],u=e.kind!==`particles`&&e.kind!==`generator`;try{switch(e.kind){case`mesh`:{let t=FD(e.geometry),n=await yw(e.material,i,{defaultColor:`#dddddd`});pw(n,t),a=new K(t,n);break}case`text`:{let{buildText:t}=await Promise.resolve().then(()=>(SO(),YD)),n=await i.track(t(e,i));a=n.object,l=n.letters;break}case`svg`:{let{buildSvg:t}=await Promise.resolve().then(()=>(BO(),jO));a=await i.track(t(e,i));break}case`model`:{let{buildModel:t}=await Promise.resolve().then(()=>(lA(),rA)),n=await i.track(t(e,i));a=n.object,s=n.animator;break}case`instances`:{let t=FD(e.geometry),n=await yw(e.material,i,{defaultColor:e.colors?.length?`#ffffff`:`#dddddd`});pw(n,t),a=LD(e,t,n,this.rngFor(e.id,e.layout.seed),e=>AS(e));break}case`particles`:{c=YC(e,this.rngFor(e.id,e.seed)),c.setViewport(this.viewportH),a=c.points;let t=c;this.updaters.push(e=>t.update(e));break}case`generator`:{let t=(await i.generators())[e.generator];if(!t){i.issue(`unknown-catalog-id`,`Unknown generator "${e.generator}"`,`objects#${e.id}.generator`),a=new ba;break}let n=Lg.find(t=>t.id===e.generator),s=jS(n,e.params??{}),c=e.scale,l={position:[...e.position??[0,0,0]],scale:typeof c==`number`?[c,c,c]:c?[...c]:[1,1,1]},u={...i,siblings:r,rng:this.rngFor(e.id,e.seed),placement:l};if(o=await i.track(Promise.resolve(t(s,u))),a=o.object,o.update){let e=o.update.bind(o);this.updaters.push((t,n)=>e(t,n))}r.set(e.id,o),e.material&&n?.material&&await this.overrideGeneratorMaterial(a,e.material,i);break}default:a=new ba}}catch(t){i.issue(e.kind===`model`||e.kind===`text`||e.kind===`svg`?`asset-load`:`build-error`,`${e.id}: ${t.message}`,`objects#${e.id}`),a=new ba}if(this.disposed)return null;a.name=e.name??e.id,a.userData={...e.userData??{},...a.userData,a3dId:e.id,tags:e.tags??[]},dA(a,e),e.visible===!1&&(a.visible=!1);let d=e.castShadow??(u?!0:void 0),f=e.receiveShadow??(u?!0:void 0);(d!==void 0||f!==void 0)&&a.traverse(e=>{e.isMesh&&(d!==void 0&&(e.castShadow=d),f!==void 0&&(e.receiveShadow=f))}),t.add(a);let p={id:e.id,kind:e.kind,def:e,object:a,rest:uA(a),runners:[],animated:!1,topLevel:t===this.scene||t===this.camera&&!n,parentId:n,built:o,animator:s,particles:c,interactive:!!e.href};this.entries.set(e.id,p),this.attachBehaviours(p);for(let t of l){let n={id:t.id,kind:`text`,def:t.def,object:t.object,rest:uA(t.object),runners:[],animated:!0,topLevel:!1,parentId:e.id,interactive:!1};t.reveal&&n.runners.push(HC(t.reveal.def,t.reveal.impl,this.behaviourContext(n),{settled:()=>this.settleEntrances})),this.entries.set(t.id,n)}if(e.children?.length){let t=/* @__PURE__ */ new Map,n=e.children;await Promise.all(n.filter(e=>e.kind===`generator`&&e.generator===`terrain`).map(n=>this.addObject(n,a,e.id,t))),mA(t,n),await Promise.all(n.filter(e=>e.kind!==`generator`||e.generator!==`terrain`).map(n=>this.addObject(n,a,e.id,t)))}return p}removeEntry(e){let t=this.entries.get(e);if(t){t.object.traverse(t=>{let n=t.userData.a3dId;n&&n!==e&&this.entries.delete(n)}),t.object.removeFromParent();for(let e of t.runners)e.dispose();this.entries.delete(e)}}idsFor(e){let t=[];for(let n=e;n;n=n.parent){let e=n.userData?.a3dId;e&&this.entries.has(e)&&t.push(e)}return t}select(e){if(e.startsWith(`tag:`)){let t=e.slice(4),n=[],r=e=>{for(let i of e??[])i.tags?.includes(t)&&this.entries.has(i.id)&&n.push(i.id),r(i.children)};return r(this.def.objects),n}if(e.startsWith(`children:`)){let t=e.slice(9);return[...this.entries.values()].filter(e=>e.parentId===t).map(e=>e.id)}return Vw(e,{object:()=>null,camera:null,issue:()=>void 0}).filter(e=>e!==``)}objectPosition(e){let t=this.entries.get(e);return t?t.object.getWorldPosition(new B):null}interactiveRoots(){let e=[];for(let t of this.entries.values())t.interactive&&t.kind!==`light`&&e.push(t.object);return e}fitShadows(){let e=[];if(this.scene.traverse(t=>{t instanceof qu&&t.castShadow&&e.push(t)}),!e.length)return;let t=new Wa,n=new Wa;this.scene.updateMatrixWorld(!0);for(let e of this.entries.values())e.topLevel&&e.kind!==`particles`&&e.def.attach!==`camera`&&(n.setFromObject(e.object),n.isEmpty()||n.getSize(new B).length()>200||t.union(n));t.isEmpty()&&t.set(new B(-5,-1,-5),new B(5,5,5));let r=this.env?.ground?this.env.ground.position.y:t.min.y;t.expandByPoint(new B(t.min.x,r,t.min.z)),t.expandByPoint(new B(t.max.x,r,t.max.z)),t.expandByScalar(.3);for(let n of e)sE(n,t)}setViewport(e,t,n){this.viewportH=t*n;let r=/^\s*([\d.]+)\s*[:/x]\s*([\d.]+)\s*$/.exec(this.def.target?.aspect??``),i=r?Number(r[1])/Number(r[2]):void 0;DT(this.camera,this.def.camera,e/Math.max(t,1),i&&Number.isFinite(i)&&i>0?i:void 0);for(let e of this.entries.values())e.particles?.setViewport(this.viewportH)}frame(e,t,n,r){this.input=n;for(let e of this.entries.values()){if(!e.animated)continue;let t=e.object;t.position.copy(e.rest.position),t.quaternion.copy(e.rest.quaternion),t.scale.copy(e.rest.scale),t.visible=e.rest.visible;let n=t;n.isLight&&e.rest.intensity!==void 0&&(n.intensity=e.rest.intensity,e.rest.color&&!this.timeline?.targets.has(e.id)&&n.color.copy(e.rest.color))}let i=this.def.timeline?n.timelineT??0:e;if(this.shots.length||this.timeline?.animatesCamera){let e=this.rig.rest;if(e.position.copy(this.cameraRest0.position),e.target.copy(this.cameraRest0.target),e.fov=this.cameraRest0.fov,e.zoom=this.cameraRest0.zoom,e.focus=this.cameraRest0.focus,this.shots.length){let t=Qw(this.shots,i,e,{objectPosition:e=>this.objectPosition(e)});e.position.copy(t.position),e.target.copy(t.target),e.fov=t.fov,e.focus=t.focus}}this.timeline&&n.timelineT!==null&&this.timeline.apply(n.timelineT),this.overrides?.apply(e),this.rig.rest.focus!==void 0&&(this.focusWritten||this.rig.rest.focus!==this.cameraRest0.focus)&&(this.postfxParam?.(`dof`,`focus`,this.rig.rest.focus),this.focusWritten=!0);for(let n of this.entries.values())for(let r of n.runners)r.late||r.step(e,t);for(let e of this.entries.values()){let t=e.object.userData.setPointer?e.object:e.object.children[0],r=t?.userData.setPointer;if(!r)continue;r(n.pointer.x,n.pointer.y);let i=t.userData.setPointerLocal;if(i&&this.camera){let e=this.pointerOnPlane(t,n.pointer.x,n.pointer.y);e&&i(e.x,e.z)}}for(let n of this.updaters)n(e,t);for(let e of this.entries.values())e.animator?.mixer.update(t);let a=this.def.camera?.lookAt;this.rig.update(e,t,{pointer:n.pointer,scroll:n.scroll,followTarget:r,lookAt:a?this.objectPosition(a):null}),this.camera.updateMatrixWorld();for(let n of this.entries.values())for(let r of n.runners)r.late&&r.step(e,t)}hasStatefulMotion(){if(this.def.camera?.controls===`follow`&&this.def.camera.follow)return!0;for(let e of this.entries.values())for(let t of e.runners)if(t.stateful)return!0;return!1}pointerRay=new of;pointerOnPlane(e,t,n){e.updateWorldMatrix(!0,!1),this.camera.updateMatrixWorld(),this.pointerRay.setFromCamera(new z(t,n),this.camera);let r=e.matrixWorld.clone().invert(),i=this.pointerRay.ray.clone().applyMatrix4(r);if(Math.abs(i.direction.y)<1e-6)return null;let a=-i.origin.y/i.direction.y;return a<0?null:i.origin.addScaledVector(i.direction,a)}dispose(){this.disposed=!0;for(let e of this.entries.values()){for(let t of e.runners)t.dispose();e.built?.dispose?.()}this.rig?.dispose(),this.env?.dispose(),PS(this.scene);let e=this.scene.environment;e&&e.dispose();let t=this.scene.background;t&&t.isTexture&&t.dispose(),this.scene.traverse(e=>e.shadow?.dispose?.()),this.entries.clear()}};function mA(e,t){let n=[...e.entries()],r=new Map(t.map((e,t)=>[e.id,t]));n.sort((e,t)=>(r.get(e[0])??1/0)-(r.get(t[0])??1/0)),e.clear();for(let[t,r]of n)e.set(t,r)}var hA=/* @__PURE__ */ new Set([`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`Space`,`PageUp`,`PageDown`,`Home`,`End`]);function gA(){return{pointer:{x:0,y:0,inside:!1,down:!1,justPressed:!1},keys:/* @__PURE__ */ new Set,pressed:/* @__PURE__ */ new Set,swipe:null,clicks:[],scroll:0}}function _A(e){e.pressed.clear(),e.pointer.justPressed=!1,e.swipe=null,e.clicks.length=0}function vA(e,t,n){n?(e.keys.has(t)||e.pressed.add(t),e.keys.add(t)):e.keys.delete(t)}function yA(e,t,n){let r=e.ownerDocument.defaultView??window,i=!1,a=!1,o=null,s=t=>{let n=e.getBoundingClientRect();return{x:(t.clientX-n.left)/Math.max(n.width,1)*2-1,y:-((t.clientY-n.top)/Math.max(n.height,1)*2-1)}},c=e=>{let r=s(e);t.pointer.x=r.x,t.pointer.y=r.y,t.pointer.inside=!0,n.onPointerMove?.()},l=()=>{a=!0,t.pointer.inside=!0},u=()=>{a=!1,t.pointer.inside=!1,t.pointer.down=!1},d=e=>{i=!0;let n=s(e);t.pointer.x=n.x,t.pointer.y=n.y,t.pointer.down=!0,t.pointer.justPressed=!0,o={x:n.x,y:n.y,t:performance.now(),px:e.clientX,py:e.clientY}},f=e=>{if(t.pointer.down=!1,!o)return;let n=e.clientX-o.px,r=e.clientY-o.py,i=Math.hypot(n,r);i<8?t.clicks.push(s(e)):i>30&&performance.now()-o.t<600&&(t.swipe=Math.abs(n)>Math.abs(r)?n>0?`right`:`left`:r>0?`down`:`up`),o=null},p=()=>i||a||e.contains(e.ownerDocument.activeElement),m=e=>{if(!p())return;let r=e.target;(!r||r.tagName!==`INPUT`&&r.tagName!==`TEXTAREA`&&!r.isContentEditable)&&(vA(t,e.code,e.type===`keydown`),n.game&&hA.has(e.code)&&e.preventDefault())},h=()=>t.keys.clear(),g=t=>{e.contains(t.target)||(i=!1)};return e.addEventListener(`pointermove`,c),e.addEventListener(`pointerenter`,l),e.addEventListener(`pointerleave`,u),e.addEventListener(`pointerdown`,d),r.addEventListener(`pointerup`,f),r.addEventListener(`keydown`,m,{passive:!1}),r.addEventListener(`keyup`,m),r.addEventListener(`blur`,h),r.document.addEventListener(`pointerdown`,g,!0),n.game&&(e.style.touchAction=`none`,e.hasAttribute(`tabindex`)||e.setAttribute(`tabindex`,`0`)),{dispose(){e.removeEventListener(`pointermove`,c),e.removeEventListener(`pointerenter`,l),e.removeEventListener(`pointerleave`,u),e.removeEventListener(`pointerdown`,d),r.removeEventListener(`pointerup`,f),r.removeEventListener(`keydown`,m),r.removeEventListener(`keyup`,m),r.removeEventListener(`blur`,h),r.document.removeEventListener(`pointerdown`,g,!0)}}}function bA(e){let t=e.ownerDocument.defaultView;if(!t)return 0;let n=e.getBoundingClientRect(),r=t.innerHeight||1,i=(r-n.top)/(r+n.height);return i<0?0:i>1?1:i}var xA=(e,t,n)=>e<t?t:e>n?n:e;function SA(e,t,n){return typeof e==`number`&&Number.isFinite(e)?e:typeof e==`string`&&t&&typeof t[e]==`number`?t[e]:n}function CA(e,t){let n=Math.max(e.duration||0,.001);if(t===`timeline`)return{from:0,to:n,loop:e.loop,speed:1};let r=e.segments?.[t];if(!r)return null;let i=Array.isArray(r)?{from:r[0],to:r[1]}:r;return{from:xA(SA(i.from,e.markers,0),0,n),to:xA(SA(i.to,e.markers,n),0,n),loop:i.loop??!1,speed:typeof i.speed==`number`&&i.speed>0?i.speed:1}}function wA(e,t,n){let r=Math.abs(e.to-e.from),i=e.to>=e.from?1:-1,a=n===void 0?0:Math.abs(n-e.from),o=r<=0?0:YS(Math.max(0,t*e.speed+a),r,e.loop);return e.from+i*o}function TA(e,t,n){let r=Math.max(e.duration||0,.001),i=n&&n!==`seek`&&n!==`timeline`&&e.segments?.[n]?n:``;if(!i)for(let n of Object.keys(e.segments??{})){let a=CA(e,n);if(!a)continue;let o=Math.min(a.from,a.to),s=Math.max(a.from,a.to);if(t>=o&&(t<s||s>=r-1e-6&&t<=s)){i=n;break}}let a=``,o=-1/0;for(let[n,r]of Object.entries(e.markers??{}))typeof r==`number`&&r<=t+1e-6&&r>=o&&(o=r,a=n);return{time:t,duration:r,progress:xA(t/r,0,1),segment:i,marker:a}}var EA=class{def;hoverClock=0;clickAt=-1;active=null;toggled=/* @__PURE__ */ new Map;prevLocal=null;lastLocal=0;lastT=0;pending=[];constructor(e){this.def=e}get duration(){return Math.max(this.def.duration||0,.001)}reset(){this.hoverClock=0,this.clickAt=-1,this.active=null,this.toggled.clear(),this.prevLocal=null,this.lastLocal=0,this.lastT=0,this.pending=[]}get local(){return this.lastLocal}play(e,t,n={}){let r=CA(this.def,e);if(!r)return!1;let i=n.reverse?{...r,from:r.to,to:r.from}:r;return this.active={...i,name:e,start:t},this.toggled.set(e,!n.reverse),!0}toggle(e,t){let n=CA(this.def,e);if(!n)return!1;let r=!this.toggled.get(e),i=r?n:{...n,from:n.to,to:n.from},a=this.active?.name===e?this.lastLocal:void 0,o=a!==void 0&&a>=Math.min(n.from,n.to)&&a<=Math.max(n.from,n.to);return this.active={...i,loop:!1,name:e,start:t,startLocal:o?a:void 0},this.toggled.set(e,r),!0}seek(e,t){let n=xA(SA(e,this.def.markers,0),0,this.duration);this.active={name:`seek`,from:n,to:n,loop:!1,speed:1,start:t}}autoRange(){let e=typeof this.def.autoplay==`string`?this.def.autoplay:null,t=e?CA(this.def,e):null,n=typeof this.def.speed==`number`&&this.def.speed>0?this.def.speed:1;return t?{...t,speed:t.speed*n}:{from:0,to:this.duration,loop:this.def.loop,speed:n}}autoLocal(e){let t=this.autoRange(),n=this.def.trigger??`visible`;if(e.staticMotion)return typeof this.def.autoplay==`string`?t.to:wA({...t,speed:1},e.posterTime??0);if(n===`manual`||this.def.autoplay===!1)return t.from;if(n===`scroll`)return t.from+(t.to-t.from)*xA(e.scroll,0,1);if(e.deterministic)return wA(t,e.t);switch(n){case`hover`:{this.hoverClock+=e.hovered?e.dt:t.loop?0:-e.dt;let n=Math.abs(t.to-t.from)/t.speed;return t.loop||(this.hoverClock=xA(this.hoverClock,0,n)),wA(t,this.hoverClock)}case`click`:return e.clicked&&(this.clickAt=e.t),this.clickAt<0?t.from:wA(t,e.t-this.clickAt);default:return wA(t,e.t)}}update(e){let t;return t=this.active&&!e.staticMotion?wA(this.active,Math.max(0,e.t-this.active.start),this.active.startLocal):this.autoLocal(e),t=xA(t,0,this.duration),this.collectMarkers(this.prevLocal,t,e.t<this.lastT),this.prevLocal=t,this.lastLocal=t,this.lastT=e.t,t}collectMarkers(e,t,n){let r=this.def.markers;if(r&&!n)for(let[n,i]of Object.entries(r)){if(typeof i!=`number`)continue;let r;r=e===null?i<=t:t>e?i>e&&i<=t:t<e?this.isLoopingForward()?i>e||i<=t:i<e&&i>=t:!1,r&&this.pending.push({name:n,time:i})}}isLoopingForward(){let e=this.active??this.autoRange();return!!e.loop&&e.loop!==`pingpong`&&e.to>=e.from}info(){return TA(this.def,this.lastLocal,this.active?.name)}drainMarkers(){let e=this.pending;return this.pending=[],e}};function DA(e,t){if(typeof e!=`string`||!e.trim())return null;try{let n=new URL(e.trim(),t);return n.protocol===`http:`||n.protocol===`https:`?n.href:null}catch{return null}}var OA=/* @__PURE__ */ new Set([`click`,`key`]),kA=class{defs;host;hoverPrev=/* @__PURE__ */ new Set;insidePrev=!1;scrollPrev=null;visibleFired=!1;fired=/* @__PURE__ */ new Set;queue=[];constructor(e,t){this.defs=e,this.host=t}targets(){let e=/* @__PURE__ */ new Set;for(let t of this.defs)t.target&&(t.on===`click`||t.on===`hover`||t.on===`hoverEnd`)&&e.add(t.target);return e}reset(){this.hoverPrev.clear(),this.insidePrev=!1,this.scrollPrev=null,this.visibleFired=!1,this.fired.clear(),this.queue=[]}event(e,t){this.queue.length<64&&this.queue.push({name:e,payload:t})}fire(e,t,n){let r=0;return this.defs.forEach((i,a)=>{if(i.on===e&&!(e===`key`?i.key!==t:e===`event`?i.event!==t:(i.target??void 0)!==t)&&!(i.once&&this.fired.has(a))){this.fired.add(a),r++;for(let t of i.do??[])this.run(t,n&&OA.has(e))}}),r}step(e){for(let t of this.targets()){let n=e.hovered.has(t),r=this.hoverPrev.has(t);n&&!r&&this.fire(`hover`,t,!1),!n&&r&&this.fire(`hoverEnd`,t,!1)}this.hoverPrev=new Set([...e.hovered].filter(e=>this.isTarget(e))),e.pointerInside!==this.insidePrev&&this.fire(e.pointerInside?`hover`:`hoverEnd`,void 0,!1),this.insidePrev=e.pointerInside;for(let t of e.clicked)this.fire(`click`,t,e.userGesture);e.canvasClicked&&this.fire(`click`,void 0,e.userGesture);for(let t of e.pressed)this.fire(`key`,t,e.userGesture);e.visible&&!this.visibleFired&&(this.visibleFired=!0,this.fire(`visible`,void 0,!1)),this.scrollPrev!==null&&e.scroll!==this.scrollPrev&&this.defs.forEach((t,n)=>{if(t.on===`scroll`&&typeof t.at==`number`&&!(!(this.scrollPrev<t.at&&e.scroll>=t.at)||t.once&&this.fired.has(n))){this.fired.add(n);for(let e of t.do??[])this.run(e,!1)}}),this.scrollPrev=e.scroll,this.flush()}flush(){for(let e=0;this.queue.length&&e<16;e++){let e=this.queue;this.queue=[];for(let t of e)this.fire(`event`,t.name,!1)}this.queue=[]}isTarget(e){return this.defs.some(t=>t.target===e)}run(e,t){let n=e;if(typeof n.play==`string`)this.host.play(n.play,n.reverse===!0);else if(typeof n.toggle==`string`)this.host.toggle(n.toggle);else if(typeof n.seek==`number`||typeof n.seek==`string`)this.host.seek(n.seek);else if(n.set&&typeof n.set==`object`){let e=n.set;typeof e.path==`string`&&e.value!==void 0&&this.host.set(e.path,e.value,typeof n.duration==`number`?n.duration:0,typeof n.ease==`string`?n.ease:void 0)}else typeof n.emit==`string`?this.host.emit(n.emit,n.payload):typeof n.openUrl==`string`?t?this.host.openUrl(n.openUrl,typeof n.newTab==`boolean`?n.newTab:void 0):this.host.emit(`openUrl`,{url:n.openUrl,blocked:!0}):n.playClip!==void 0&&typeof n.target==`string`&&this.host.playClip(n.target,n.playClip,{loop:n.loop,speed:n.speed,crossfade:n.crossfade})}},AA=`top bottom`,jA=`bottom top`;function MA(e,t){return e===`top`?0:e===`center`?t/2:e===`bottom`?t:e.endsWith(`%`)?Number(e.slice(0,-1))/100*t:e.endsWith(`px`)?Number(e.slice(0,-2)):null}function NA(e,t,n){let r=e.trim().split(/\s+/);if(r.length!==2)return null;let i=MA(r[0],t),a=MA(r[1],n);return i===null||a===null?null:i-a}function PA(e,t,n,r=AA,i=jA){let a=NA(r,t,n)??-n,o=NA(i,t,n)??t,s=0-e;if(Math.abs(o-a)<1e-6)return+(s>=o);let c=(s-a)/(o-a);return c<0?0:c>1?1:c}J();var FA=8e3;function IA(e,t,n=FA){let r=[],i=0;if(e.traverseVisible(e=>{let t=e;if(!(t.isMesh||e.isLine)||e.isPoints)return;let n=t.geometry?.getAttribute(`position`);if(!n)return;let a=t.isInstancedMesh?t.count:1;a&&(r.push(t),i+=n.count*a)}),!r.length||!i)return null;let a=Math.max(1,Math.ceil(i/n)),o=new B,s=new V,c=new V,l=0,u=0;for(let e of r){let n=e.geometry.getAttribute(`position`),r=e,i=e.isSkinnedMesh?e:null,d=r.isInstancedMesh?r.count:1;for(let f=0;f<d;f++){r.isInstancedMesh?c.multiplyMatrices(e.matrixWorld,(r.getMatrixAt(f,s),s)):c.copy(e.matrixWorld);for(let e=f%a;e<n.count;e+=a)if(o.fromBufferAttribute(n,e),i&&i.applyBoneTransform(e,o),o.applyMatrix4(c),t.containsPoint(o)?l++:u++,l&&u)return`partial`}}return!l&&!u?null:u?`partial`:`full`}function LA(e,t,n){if(n!==`parts`){let r=e.worldToLocal(t.clone()),i=n.heightAt(r.x,r.z);return Number.isFinite(i)&&r.y<i}let r=new Wa,i=new V,a=!1;return e.traverseVisible(e=>{let n=e;if(a||!n.isMesh||!n.geometry)return;n.geometry.boundingBox||n.geometry.computeBoundingBox();let o=n.geometry.boundingBox,s=e;if(s.isInstancedMesh)for(let e=0;e<s.count&&!a;e++)s.getMatrixAt(e,i),r.copy(o).applyMatrix4(i.premultiply(s.matrixWorld)).containsPoint(t)&&(a=zA(n,t,r,e));else r.copy(o).applyMatrix4(n.matrixWorld).containsPoint(t)&&(a=zA(n,t,r))}),a}var RA=[new B(1,0,0),new B(-1,0,0),new B(0,1,0),new B(0,-1,0),new B(0,0,1),new B(0,0,-1)];function zA(e,t,n,r){let i=(Array.isArray(e.material)?e.material:[e.material]).filter(Boolean),a=i.map(e=>e.side);for(let e of i)e.side=2;try{let i=new of;return i.far=n.getSize(new B).length()+.001,RA.every(n=>(i.set(t,n),i.intersectObject(e,!1).some(e=>r===void 0||e.instanceId===r)))}finally{i.forEach((e,t)=>e.side=a[t])}}function BA(e,t,n){let r=e.createGain();return r.gain.value=Math.max(0,n),r.connect(t),{ctx:e,out:r,sources:[],timers:[],stopped:!1}}function VA(e,t=.06){if(e.stopped)return;e.stopped=!0;for(let t of e.timers)clearTimeout(t);let n=e.ctx.currentTime;try{e.out.gain.cancelScheduledValues(n),e.out.gain.setValueAtTime(e.out.gain.value,n),e.out.gain.linearRampToValueAtTime(0,n+t)}catch{}for(let r of e.sources)try{r.stop(n+t+.02)}catch{}setTimeout(()=>{try{e.out.disconnect()}catch{}},(t+.1)*1e3)}function HA(e,t){return e.timers.push(setTimeout(()=>VA(e,.01),(t+.2)*1e3)),{stop:()=>VA(e)}}function UA(e,t){let{ctx:n}=e,r=n.currentTime+(t.start??0),i=n.createOscillator();i.type=t.type??`square`,i.frequency.setValueAtTime(t.freq,r),t.to&&i.frequency.exponentialRampToValueAtTime(Math.max(1,t.to),r+t.dur),t.detune&&(i.detune.value=t.detune);let a=n.createGain(),o=t.gain??.3,s=t.attack??.005;a.gain.setValueAtTime(1e-4,r),a.gain.linearRampToValueAtTime(o,r+s);let c=Math.min(t.release??t.dur,t.dur);a.gain.setValueAtTime(o,r+Math.max(s,t.dur-c)),a.gain.exponentialRampToValueAtTime(1e-4,r+t.dur);let l=i;if(t.filter){let e=n.createBiquadFilter();e.type=t.filter.type,e.frequency.setValueAtTime(t.filter.freq,r),t.filter.to&&e.frequency.exponentialRampToValueAtTime(Math.max(10,t.filter.to),r+t.dur),e.Q.value=t.filter.q??1,i.connect(e),l=e}if(t.vibrato){let a=n.createOscillator();a.frequency.value=t.vibrato.rate;let o=n.createGain();o.gain.value=t.vibrato.depth,a.connect(o),o.connect(i.detune),a.start(r),a.stop(r+t.dur+.05),e.sources.push(a)}l.connect(a),a.connect(t.dest??e.out),i.start(r),i.stop(r+t.dur+.05),e.sources.push(i)}function WA(e){let t=qA.get(e);if(!t){t=e.createBuffer(1,Math.floor(e.sampleRate*2),e.sampleRate);let n=t.getChannelData(0),r=625341585;for(let e=0;e<n.length;e++)r^=r<<13,r^=r>>>17,r^=r<<5,n[e]=(r>>>0)/4294967296*2-1;qA.set(e,t)}return t}function GA(e,t){let{ctx:n}=e,r=n.currentTime+(t.start??0),i=n.createBufferSource();i.buffer=WA(n),i.loop=!0;let a=n.createGain(),o=t.gain??.3;a.gain.setValueAtTime(1e-4,r),a.gain.linearRampToValueAtTime(o,r+(t.attack??.003)),a.gain.exponentialRampToValueAtTime(1e-4,r+t.dur);let s=i;if(t.filter){let e=n.createBiquadFilter();e.type=t.filter.type,e.Q.value=t.filter.q??1,e.frequency.setValueAtTime(t.filter.freq,r),t.filter.mid&&e.frequency.exponentialRampToValueAtTime(t.filter.mid,r+t.dur*.45),t.filter.to&&e.frequency.exponentialRampToValueAtTime(t.filter.to,r+t.dur),i.connect(e),s=e}s.connect(a),a.connect(t.dest??e.out),i.start(r,r*.37%1.5),i.stop(r+t.dur+.05),e.sources.push(i)}function KA(e,t,n){let{ctx:r}=e,i=r.currentTime+.06,a=0,o=()=>{if(!e.stopped){for(;i<r.currentTime+.15;)n(a,i-r.currentTime),a++,i+=t;e.sources.length>400&&e.sources.splice(0,e.sources.length-200),e.timers.length=0,e.timers.push(setTimeout(o,40))}};o()}var qA,JA,YA=t((()=>{qA=/* @__PURE__ */ new WeakMap,JA=e=>440*2**((e-69)/12)})),XA=/* @__PURE__ */ n({SOUND_IMPLS:()=>uj}),ZA,QA,$A,ej,tj,nj,rj,ij,aj,oj,sj,cj,lj,uj,dj=t((()=>{YA(),ZA=(e,t)=>({play(n,r,i){let a=BA(n,r,i);return t(a),HA(a,e)}}),QA=ZA(.4,e=>{UA(e,{type:`square`,freq:JA(83),dur:.08,gain:.18,release:.02}),UA(e,{type:`square`,freq:JA(88),start:.075,dur:.32,gain:.18,release:.3}),UA(e,{type:`triangle`,freq:JA(100),start:.075,dur:.25,gain:.06,release:.24})}),$A=ZA(.3,e=>{UA(e,{type:`square`,freq:220,to:660,dur:.2,gain:.16,release:.12,filter:{type:`lowpass`,freq:2400}}),UA(e,{type:`triangle`,freq:330,to:990,dur:.18,gain:.12,release:.1})}),ej=ZA(.3,e=>{GA(e,{dur:.16,gain:.45,filter:{type:`lowpass`,freq:2200,to:300,q:.7}}),UA(e,{type:`sine`,freq:180,to:55,dur:.18,gain:.5,release:.15}),UA(e,{type:`square`,freq:120,to:60,dur:.08,gain:.12,release:.06})}),tj=ZA(1.6,e=>{GA(e,{dur:1.4,gain:.7,attack:.01,filter:{type:`lowpass`,freq:2600,to:90,q:.8}}),GA(e,{dur:.25,gain:.35,filter:{type:`highpass`,freq:1200,q:.5}}),UA(e,{type:`sine`,freq:90,to:28,dur:1.1,gain:.7,release:1}),UA(e,{type:`triangle`,freq:60,to:30,start:.05,dur:.8,gain:.3,release:.7})}),nj=ZA(.1,e=>{UA(e,{type:`sine`,freq:1700,to:900,dur:.035,gain:.25,release:.03}),GA(e,{dur:.02,gain:.12,filter:{type:`highpass`,freq:4e3}})}),rj=ZA(.8,e=>{let t=[60,64,67,72,76,79,84];t.forEach((t,n)=>{UA(e,{type:`square`,freq:JA(t),start:n*.06,dur:.1,gain:.13,release:.06,filter:{type:`lowpass`,freq:3500}}),UA(e,{type:`triangle`,freq:JA(t+12),start:n*.06+.02,dur:.12,gain:.07,release:.1})}),UA(e,{type:`square`,freq:JA(84),start:t.length*.06,dur:.3,gain:.1,release:.28,vibrato:{rate:9,depth:35},filter:{type:`lowpass`,freq:3e3}})}),ij=ZA(.35,e=>{UA(e,{type:`sawtooth`,freq:1800,to:160,dur:.24,gain:.16,release:.2,filter:{type:`bandpass`,freq:2400,to:400,q:2}}),UA(e,{type:`square`,freq:1200,to:120,dur:.18,gain:.07,release:.15})}),aj=ZA(1.6,e=>{let t=[72,76,79,84];t.forEach((t,n)=>{UA(e,{type:`square`,freq:JA(t),start:n*.12,dur:.14,gain:.12,release:.08,filter:{type:`lowpass`,freq:3200}}),UA(e,{type:`triangle`,freq:JA(t-12),start:n*.12,dur:.14,gain:.15,release:.1})});let n=t.length*.12+.04;for(let t of[79,84,88])UA(e,{type:`square`,freq:JA(t),start:n,dur:.9,gain:.08,attack:.01,release:.7,vibrato:{rate:6,depth:12},filter:{type:`lowpass`,freq:2800}});UA(e,{type:`triangle`,freq:JA(60),start:n,dur:.9,gain:.2,release:.6})}),oj=ZA(1.6,e=>{[67,66,65].forEach((t,n)=>UA(e,{type:`sawtooth`,freq:JA(t),start:n*.25,dur:.24,gain:.12,release:.1,filter:{type:`lowpass`,freq:1400}})),UA(e,{type:`sawtooth`,freq:JA(64),to:JA(52),start:.75,dur:.8,gain:.13,release:.5,vibrato:{rate:7,depth:40},filter:{type:`lowpass`,freq:1400,to:400}}),UA(e,{type:`triangle`,freq:JA(40),start:.75,dur:.8,gain:.18,release:.6})}),sj=ZA(.8,e=>{GA(e,{dur:.65,gain:.45,attack:.25,filter:{type:`bandpass`,freq:300,mid:2600,to:500,q:1.4}}),GA(e,{dur:.5,gain:.15,attack:.2,filter:{type:`lowpass`,freq:600,to:200}})}),cj={play(e,t,n){let r=BA(e,t,n),i=e.createBiquadFilter();i.type=`lowpass`,i.frequency.value=900,i.Q.value=.6;let a=e.createOscillator();a.frequency.value=.07;let o=e.createGain();o.gain.value=450,a.connect(o),o.connect(i.frequency),a.start(),r.sources.push(a);let s=e.createDelay(1);s.delayTime.value=.42;let c=e.createGain();c.gain.value=.38,s.connect(c),c.connect(s),i.connect(r.out),i.connect(s),s.connect(r.out);let l=[[48,55,59,64],[45,52,55,60],[41,48,52,57],[43,50,55,59]];return KA(r,4,(e,t)=>{let n=l[e%l.length];for(let e of n)for(let n of[-7,7])UA(r,{type:`sawtooth`,freq:JA(e),start:t,dur:5.6,gain:.035,attack:1.4,release:1.8,detune:n,dest:i});UA(r,{type:`sine`,freq:JA(n[0]-12),start:t,dur:5.2,gain:.12,attack:1,release:1.5}),UA(r,{type:`triangle`,freq:JA(n[3]+24),start:t+1.3,dur:1.5,gain:.025,attack:.05,release:1.4,dest:s})}),{stop:()=>VA(r,.8)}}},lj={play(e,t,n){let r=BA(e,t,n),i=[72,0,76,79,84,0,79,76,77,0,76,74,72,0,74,76,69,0,72,76,81,0,79,76,77,76,74,72,74,0,0,0,77,0,81,84,89,0,84,81,79,0,77,76,77,0,79,81,79,0,83,86,91,0,86,83,84,0,83,81,79,0,74,0],a=[48,45,41,43],o=60/140/4;return KA(r,o,(e,t)=>{let n=e%64,s=i[n];s&&UA(r,{type:`square`,freq:JA(s),start:t,dur:o*1.6,gain:.075,release:o*1.2,filter:{type:`lowpass`,freq:3800}});let c=a[Math.floor(n/16)];if(n%2==0){let e=c+(n/2%4==3?7:n/2%2?12:0);UA(r,{type:`triangle`,freq:JA(e-12),start:t,dur:o*1.8,gain:.22,release:o*1.2})}n%4==2&&UA(r,{type:`square`,freq:JA(c+24+(n/4%2?4:7)),start:t,dur:o*.8,gain:.03,release:o*.6}),n%4==0&&UA(r,{type:`sine`,freq:150,to:45,start:t,dur:.12,gain:.35,release:.1}),n%8==4&&GA(r,{start:t,dur:.12,gain:.16,filter:{type:`bandpass`,freq:1800,q:.8}}),n%2==1&&GA(r,{start:t,dur:.035,gain:.06,filter:{type:`highpass`,freq:7e3}})}),{stop:()=>VA(r,.1)}}},uj={coin:QA,jump:$A,hit:ej,explosion:tj,click:nj,powerup:rj,laser:ij,win:aj,lose:oj,whoosh:sj,"ambient-pad":cj,"chiptune-loop":lj}}));function fj(e,t,n){let r=null,i=null,a=!!e?.muted,o=null,s=/* @__PURE__ */ new Map,c=null,l=!!e?.music,u=()=>Promise.resolve().then(()=>(dj(),XA)).then(e=>o=e.SOUND_IMPLS).catch(()=>o={}),d=e=>{let i=s.get(e);if(!i&&r){let a=r;i=fetch(t(e)).then(e=>e.arrayBuffer()).then(e=>a.decodeAudioData(e)).catch(t=>(n(t.message,e),null)),s.set(e,i)}return i??Promise.resolve(null)},f=(e,t=!1)=>{if(!r||!i)return null;let n=e.volume??1;if(e.preset){let t=o?.[e.preset];return t?t.play(r,i,n):null}if(e.src){let a=r,o=i,s=null,c=!1;return d(e.src).then(e=>{if(!e||c)return;s=a.createBufferSource(),s.buffer=e,s.loop=t;let r=a.createGain();r.gain.value=n,s.connect(r).connect(o),s.start()}),{stop(){c=!0;try{s?.stop()}catch{}}}}return null},p=()=>{!c&&e?.music&&!a&&r&&(c=f(e.music,e.music.loop!==!1))};return u(),{play(t){if(a||!r)return;let n=e?.sounds?.[t];n?f(n):o?.[t]&&o[t].play(r,i,1)},music(e){l=e,e?p():(c?.stop(),c=null)},muted:()=>a,setMuted(t){a=t,i&&r&&i.gain.setTargetAtTime(+!t,r.currentTime,.02),t?(c?.stop(),c=null):(l||e?.music)&&(l=!0,p())},unlock(){if(r){r.state===`suspended`&&r.resume();return}let e=globalThis.AudioContext??globalThis.webkitAudioContext;if(e)try{r=new e,i=r.createGain(),i.gain.value=+!a,i.connect(r.destination),l&&p()}catch(e){n(e.message)}},dispose(){c?.stop(),r?.close().catch(()=>void 0),r=null}}}var pj=t((()=>{}));function mj(e){if(!/^[0-9a-f]+$/i.test(e)||((e.length===3||e.length===4)&&(e=[...e].map(e=>e+e).join(``)),e.length!==6&&e.length!==8))return null;let t=t=>parseInt(e.slice(t,t+2),16);return{r:t(0),g:t(2),b:t(4),a:e.length===8?t(6)/255:1}}function hj(e,t){let n=/^(-?\d*\.?\d+(?:e-?\d+)?)(%?)$/i.exec(e.trim());if(!n)return null;let r=Number(n[1]);return n[2]?r/100*t:r}function gj(e){let t=/^(-?\d*\.?\d+)(deg|rad|turn|grad)?$/i.exec(e.trim());if(!t)return null;let n=Number(t[1]);switch((t[2]??`deg`).toLowerCase()){case`rad`:return n*180/Math.PI;case`turn`:return n*360;case`grad`:return n*.9;default:return n}}function _j(e){let t=e.split(`/`);if(t.length>2)return null;let n=(t[0].includes(`,`)?t[0].split(`,`):t[0].trim().split(/\s+/)).map(e=>e.trim()).filter(e=>e!==``);return t.length===2&&n.push(t[1].trim()),n}function vj(e,t,n){e=(e%360+360)%360;let r=(1-Math.abs(2*n-1))*t,i=r*(1-Math.abs(e/60%2-1)),a=n-r/2,[o,s,c]=e<60?[r,i,0]:e<120?[i,r,0]:e<180?[0,r,i]:e<240?[0,i,r]:e<300?[i,0,r]:[r,0,i];return[(o+a)*255,(s+a)*255,(c+a)*255]}function yj(e){if(typeof e!=`string`)return null;let t=e.trim().toLowerCase();if(!t)return null;if(t.startsWith(`#`))return mj(t.slice(1));if(t===`transparent`)return{r:0,g:0,b:0,a:0};let n=Cj[t];if(n)return mj(n);let r=/^(rgba?|hsla?)\((.*)\)$/.exec(t);if(!r)return null;let i=_j(r[2]);if(!i||i.length!==3&&i.length!==4)return null;let a=i.length===4?hj(i[3],1):1;if(a===null)return null;if(r[1].startsWith(`rgb`)){let[e,t,n]=i.slice(0,3).map(e=>hj(e,255));return e===null||t===null||n===null?null:{r:wj(e,0,255),g:wj(t,0,255),b:wj(n,0,255),a:wj(a,0,1)}}let o=gj(i[0]),s=hj(i[1],1),c=hj(i[2],1);if(o===null||s===null||c===null||!i[1].trim().endsWith(`%`)||!i[2].trim().endsWith(`%`))return null;let[l,u,d]=vj(o,wj(s,0,1),wj(c,0,1));return{r:l,g:u,b:d,a:wj(a,0,1)}}function bj(e){let t=e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*t(e.r)+.7152*t(e.g)+.0722*t(e.b)}function xj(e,t){let n=bj(e),r=bj(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function Sj(e){let t=yj(e);return t?xj(t,{r:255,g:255,b:255,a:1})>=xj(t,{r:17,g:19,b:24,a:1})?`#ffffff`:`#111318`:`#ffffff`}var Cj,wj,Tj=t((()=>{Cj={aliceblue:`f0f8ff`,antiquewhite:`faebd7`,aqua:`00ffff`,aquamarine:`7fffd4`,azure:`f0ffff`,beige:`f5f5dc`,bisque:`ffe4c4`,black:`000000`,blanchedalmond:`ffebcd`,blue:`0000ff`,blueviolet:`8a2be2`,brown:`a52a2a`,burlywood:`deb887`,cadetblue:`5f9ea0`,chartreuse:`7fff00`,chocolate:`d2691e`,coral:`ff7f50`,cornflowerblue:`6495ed`,cornsilk:`fff8dc`,crimson:`dc143c`,cyan:`00ffff`,darkblue:`00008b`,darkcyan:`008b8b`,darkgoldenrod:`b8860b`,darkgray:`a9a9a9`,darkgreen:`006400`,darkgrey:`a9a9a9`,darkkhaki:`bdb76b`,darkmagenta:`8b008b`,darkolivegreen:`556b2f`,darkorange:`ff8c00`,darkorchid:`9932cc`,darkred:`8b0000`,darksalmon:`e9967a`,darkseagreen:`8fbc8f`,darkslateblue:`483d8b`,darkslategray:`2f4f4f`,darkslategrey:`2f4f4f`,darkturquoise:`00ced1`,darkviolet:`9400d3`,deeppink:`ff1493`,deepskyblue:`00bfff`,dimgray:`696969`,dimgrey:`696969`,dodgerblue:`1e90ff`,firebrick:`b22222`,floralwhite:`fffaf0`,forestgreen:`228b22`,fuchsia:`ff00ff`,gainsboro:`dcdcdc`,ghostwhite:`f8f8ff`,gold:`ffd700`,goldenrod:`daa520`,gray:`808080`,green:`008000`,greenyellow:`adff2f`,grey:`808080`,honeydew:`f0fff0`,hotpink:`ff69b4`,indianred:`cd5c5c`,indigo:`4b0082`,ivory:`fffff0`,khaki:`f0e68c`,lavender:`e6e6fa`,lavenderblush:`fff0f5`,lawngreen:`7cfc00`,lemonchiffon:`fffacd`,lightblue:`add8e6`,lightcoral:`f08080`,lightcyan:`e0ffff`,lightgoldenrodyellow:`fafad2`,lightgray:`d3d3d3`,lightgreen:`90ee90`,lightgrey:`d3d3d3`,lightpink:`ffb6c1`,lightsalmon:`ffa07a`,lightseagreen:`20b2aa`,lightskyblue:`87cefa`,lightslategray:`778899`,lightslategrey:`778899`,lightsteelblue:`b0c4de`,lightyellow:`ffffe0`,lime:`00ff00`,limegreen:`32cd32`,linen:`faf0e6`,magenta:`ff00ff`,maroon:`800000`,mediumaquamarine:`66cdaa`,mediumblue:`0000cd`,mediumorchid:`ba55d3`,mediumpurple:`9370db`,mediumseagreen:`3cb371`,mediumslateblue:`7b68ee`,mediumspringgreen:`00fa9a`,mediumturquoise:`48d1cc`,mediumvioletred:`c71585`,midnightblue:`191970`,mintcream:`f5fffa`,mistyrose:`ffe4e1`,moccasin:`ffe4b5`,navajowhite:`ffdead`,navy:`000080`,oldlace:`fdf5e6`,olive:`808000`,olivedrab:`6b8e23`,orange:`ffa500`,orangered:`ff4500`,orchid:`da70d6`,palegoldenrod:`eee8aa`,palegreen:`98fb98`,paleturquoise:`afeeee`,palevioletred:`db7093`,papayawhip:`ffefd5`,peachpuff:`ffdab9`,peru:`cd853f`,pink:`ffc0cb`,plum:`dda0dd`,powderblue:`b0e0e6`,purple:`800080`,rebeccapurple:`663399`,red:`ff0000`,rosybrown:`bc8f8f`,royalblue:`4169e1`,saddlebrown:`8b4513`,salmon:`fa8072`,sandybrown:`f4a460`,seagreen:`2e8b57`,seashell:`fff5ee`,sienna:`a0522d`,silver:`c0c0c0`,skyblue:`87ceeb`,slateblue:`6a5acd`,slategray:`708090`,slategrey:`708090`,snow:`fffafa`,springgreen:`00ff7f`,steelblue:`4682b4`,tan:`d2b48c`,teal:`008080`,thistle:`d8bfd8`,tomato:`ff6347`,turquoise:`40e0d0`,violet:`ee82ee`,wheat:`f5deb3`,white:`ffffff`,whitesmoke:`f5f5f5`,yellow:`ffff00`,yellowgreen:`9acd32`},wj=(e,t,n)=>Math.min(n,Math.max(t,e))}));function Ej(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(/\s/.test(r)){n++;continue}if(/[0-9]/.test(r)||r===`-`&&/[0-9]/.test(e[n+1]??``)&&(t.length===0||t[t.length-1].t===`op`)){let r=n+1;for(;r<e.length&&/[0-9.]/.test(e[r]);)r++;t.push({t:`num`,v:Number(e.slice(n,r))}),n=r;continue}if(r===`'`||r===`"`){let i=n+1,a=``;for(;i<e.length&&e[i]!==r;)e[i]===`\\`&&i+1<e.length&&i++,a+=e[i++];if(i>=e.length)throw Error(`Unterminated string`);t.push({t:`str`,v:a}),n=i+1;continue}if(/[A-Za-z_$]/.test(r)){let r=n+1;for(;r<e.length&&/[A-Za-z0-9_$.]/.test(e[r]);)r++;t.push({t:`id`,v:e.slice(n,r)}),n=r;continue}let i=e.slice(n,n+3),a=e.slice(n,n+2);if(i===`===`||i===`!==`)t.push({t:`op`,v:i.slice(0,2)}),n+=3;else if([`==`,`!=`,`>=`,`<=`,`&&`,`||`].includes(a))t.push({t:`op`,v:a}),n+=2;else if(`!<>()`.includes(r))t.push({t:`op`,v:r}),n++;else throw Error(`Unexpected "${r}"`)}return t}function Dj(e,t){let n=t.split(`.`);n[0]===`state`&&n.shift();let r=e;for(let e of n){if(jj.has(e)||typeof r!=`object`||!r||!Object.prototype.hasOwnProperty.call(r,e))return;r=r[e]}return r}function Oj(e,t){let n=Ej(e),r=0,i=()=>n[r],a=e=>i()?.t===`op`&&i().v===e;function o(){let e=n[r++];if(!e)throw Error(`Unexpected end`);if(e.t===`num`||e.t===`str`)return e.v;if(e.t===`id`)return e.v===`true`?!0:e.v===`false`?!1:e.v===`null`||e.v===`undefined`?null:Dj(t,e.v);if(e.v===`(`){let e=u();if(!a(`)`))throw Error(`Missing )`);return r++,e}throw Error(`Unexpected "${e.v}"`)}function s(){let e=o(),t=i();if(t?.t===`op`&&[`==`,`!=`,`>`,`<`,`>=`,`<=`].includes(t.v)){r++;let n=o(),i=e,a=n;switch(t.v){case`==`:return e==n||e==null&&n==null;case`!=`:return e!=n;case`>`:return i>a;case`<`:return i<a;case`>=`:return i>=a;default:return i<=a}}return e}function c(){return a(`!`)?(r++,!c()):s()}function l(){let e=c();for(;a(`&&`);){r++;let t=c();e&&=t}return e}function u(){let e=l();for(;a(`||`);){r++;let t=l();e||=t}return e}let d=u();if(r<n.length)throw Error(`Unexpected "${n[r].v}"`);return d}function kj(e,t){if(e===void 0)return!0;if(typeof e==`boolean`)return e;try{return!!Oj(e,t)}catch{return!1}}function Aj(e,t){return e.replace(/\{([^{}]+)\}/g,(e,n)=>{let r=n.trim(),i;try{i=/^[A-Za-z_$][A-Za-z0-9_$.]*$/.test(r)?Dj(t,r):Oj(r,t)}catch{i=void 0}return i==null?``:String(typeof i==`number`?Number.isInteger(i)?i:Math.round(i*100)/100:i)})}var jj,Mj=t((()=>{jj=/* @__PURE__ */ new Set([`__proto__`,`prototype`,`constructor`])}));function Nj(e,t,n){let r=e.ownerDocument,i=r.createElement(`div`);i.className=`a3d-hud`,i.setAttribute(`aria-live`,`polite`);let a=r.createElement(`style`),o=t?.accent??`#ff006e`;a.textContent=Ij(t?.font??`system-ui,-apple-system,'Segoe UI',Roboto,sans-serif`,t?.color??`#ffffff`,o,t?.buttonText??Sj(o)),i.appendChild(a);let s=/* @__PURE__ */ new Map,c=e=>{let t=s.get(e);return t||(t=r.createElement(`div`),t.className=`a3d-zone`,t.style.cssText=Pj[e]??Pj[`top-left`],t.dataset.anchor=e,i.appendChild(t),s.set(e,t)),t},l=[[`top-left`,`top`,`top-right`],[`left`,`center`,`right`],[`bottom-left`,`bottom`,`bottom-right`]],u=()=>{for(let[e,t,n]of l){let r=s.get(t);r&&(r.style.gridColumn=s.has(e)||s.has(n)?`2`:`1 / -1`)}},d=/* @__PURE__ */ new Map;for(let e of t?.elements??[]){let t,i;if(e.type===`button`){let i=r.createElement(`button`);i.type=`button`,i.className=`a3d-btn`,i.addEventListener(`click`,t=>{t.stopPropagation(),e.action&&n(e.action)}),i.addEventListener(`pointerdown`,e=>e.stopPropagation()),t=i}else e.type===`bar`?(t=r.createElement(`div`),t.className=`a3d-bar`,i=r.createElement(`i`),t.appendChild(i)):(t=r.createElement(`div`),t.className=`a3d-el a3d-${e.style??`plain`}`);e.color&&(t.style.color=e.color,e.type===`bar`&&i&&(i.style.background=e.color)),e.background&&(t.style.background=e.background),e.type===`button`&&e.background&&!e.color&&(t.style.color=Sj(e.background)),t.dataset.id=e.id,c(e.anchor??`top-left`).appendChild(t),d.set(e.id,{def:e,node:t,fill:i,override:{},last:``})}u(),e.appendChild(i);let f=null,p=0,m=null,h=null,g=null;return{root:i,setTimeline(e){g=e},set(e,t){let n=d.get(e);n&&Object.assign(n.override,t)},toast(e,t=2){m={text:e,seconds:t}},update(e,t){let n=g&&!Object.prototype.hasOwnProperty.call(e,`timeline`)?{...e,timeline:g}:e;for(let e of d.values()){let t=e.override.visible??kj(e.def.visible,n);if(e.node.style.display=t?``:`none`,!t)continue;if(e.def.type===`bar`){let t=e.override.value??Number(e.def.value?Dj(n,e.def.value):0),r=Math.max(0,Math.min(1,Number.isFinite(t)?t:0));e.fill.style.width=`${(r*100).toFixed(1)}%`;continue}let r=e.override.text??Aj(e.def.text??``,n);r!==e.last&&(e.node.textContent=r,e.last=r)}m&&=(f||(f=r.createElement(`div`),f.className=`a3d-toast`,i.appendChild(f)),f.textContent=m.text,f.style.opacity=`1`,p=t+m.seconds,null),f&&t>p&&(f.style.opacity=`0`)},setMuteButton(e,t){e===null?(h?.remove(),h=null):(h||(h=r.createElement(`button`),h.type=`button`,h.className=`a3d-mute`,h.addEventListener(`pointerdown`,e=>e.stopPropagation()),h.addEventListener(`click`,e=>{e.stopPropagation(),t?.()}),c(`bottom-right`).appendChild(h),u()),h.innerHTML=e?Rj:Lj,h.setAttribute(`aria-label`,e?`Unmute sound`:`Mute sound`))},dispose(){i.remove()}}}var Pj,Fj,Ij,Lj,Rj,zj=t((()=>{Tj(),Mj(),Pj={"top-left":`grid-row:1;grid-column:1;align-items:flex-start;align-self:start;`,top:`grid-row:1;grid-column:2;align-items:center;align-self:start;text-align:center;`,"top-right":`grid-row:1;grid-column:3;align-items:flex-end;align-self:start;text-align:right;`,left:`grid-row:2;grid-column:1;align-items:flex-start;align-self:center;`,center:`grid-row:2;grid-column:2;align-items:center;align-self:center;text-align:center;`,right:`grid-row:2;grid-column:3;align-items:flex-end;align-self:center;text-align:right;`,"bottom-left":`grid-row:3;grid-column:1;align-items:flex-start;align-self:end;`,bottom:`grid-row:3;grid-column:2;align-items:center;align-self:end;text-align:center;`,"bottom-right":`grid-row:3;grid-column:3;align-items:flex-end;align-self:end;text-align:right;`},Fj=(e,t,n)=>`font-size:${n}px;font-size:clamp(${e}px,min(${t}cqw,${(t*1.6).toFixed(1)}cqh),${n}px)`,Ij=(e,t,n,r)=>`
5797
5797
  .a3d-hud{position:absolute;inset:0;pointer-events:none;font-family:${e};color:${t};z-index:2;overflow:hidden;user-select:none;-webkit-user-select:none;container-type:size;display:grid;grid-template-columns:minmax(min-content,1fr) fit-content(56%) minmax(min-content,1fr);grid-template-rows:auto minmax(0,1fr) auto}
5798
5798
  .a3d-zone{display:flex;flex-direction:column;gap:8px;gap:clamp(4px,1.6cqw,8px);padding:14px;padding:clamp(8px,2.6cqw,14px);min-width:0;max-width:100%;box-sizing:border-box}
5799
5799
  .a3d-el{line-height:1.2;text-shadow:0 1px 3px rgba(0,0,0,.45);white-space:pre-line;overflow-wrap:break-word}