vis-core 0.33.19 → 0.33.20
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.
- package/README.md +6 -2
- package/dist/{dist-6e_r_Ils.js → dist-CBwlzuju.js} +1 -1
- package/dist/e-DsI3lCu-.js +1 -0
- package/dist/index.d.ts +9 -4
- package/dist/index.js +1 -1
- package/dist/io.d.ts +12 -3
- package/dist/io.js +1 -1
- package/dist/resource-url-MTT03G1N.js +1 -0
- package/dist/runtimeImages-CJx9KQkc.js +1 -0
- package/dist/{schema-Brre1WzE.js → schema-DCtwlcYa.js} +1 -1
- package/dist/validation-BOlQdEPC.js +1 -0
- package/package.json +2 -2
- package/dist/e-BTBbEYEO.js +0 -1
- package/dist/runtimeImages-DCG8lEY9.js +0 -1
- package/dist/sha2-BCqd-su1.js +0 -1
- package/dist/validation-DDQJc7mH.js +0 -1
package/README.md
CHANGED
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
运行时使用 ZIP 分包:`manifest.json` 引用场景 JSON 和独立资源文件,场景沿用 Three.js 的 `images`、`textures`、`materials` 结构;`images[].url` 直接写相对文件路径(立方体贴图为路径数组),纹理保留原生采样参数。SHA-256、MIME、文件大小及 HDR/像素解码信息统一放在 `manifest.assets`。平台预览使用同一分包结构,资源文件保存在 IndexedDB。
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
平台通过“地图下钻”统一配置预览与导出的导航。关闭时使用保存的地图和城市几何,不重复打包行政边界或建筑、道路、河流、绿地源数据。宿主仍可通过 SDK 的 `switchScene` / `back` 控制已保存场景。未完成几何创建的对象仍会收集初始化所需资源。
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
下钻路径为世界 → 中国 → 省 → 市 → 区,模板按目标区域的实际行政层级选择。世界范围仅展开中国及其行政区;北京、天津、上海、重庆直接从省进入区模板。配置起始区域、最深层级与模板后,导出枚举全部目标区域。启用下钻后统一接管所选模板主地图的点击下钻与地图外部返回。到达终点或范围之外的点击不再导航;SDK 的显式区域切换仍严格检查范围。旧的 `scene.interactions` 配置直接忽略,导入和导出时移除,不迁移为新的导航规则。
|
|
10
|
+
|
|
11
|
+
导出页只选择“完整离线包”或“共用地图目录”,直接复用项目下钻配置。同一模板可以用于多个层级;未选作模板的场景按固定场景保存。层级模板键为 `world`、`country`、`province`、`city`、`district`;`scope.rootAdcode` 为 0 时表示世界,100000 表示中国。
|
|
10
12
|
|
|
11
13
|
配置保存在 `manifest.json` 的 `runtimeAssets.mapNavigation`,`runtimeAssets.regions` 列出每个模板允许切换的行政区。宿主调用 `manager.switchMapRegion(templateSceneId, adcode)`、`loadMapRegion` 或 `requestMapRegion` 时必须使用配置内的模板和区域;超出范围会在创建场景前报错,`strictBundleAssets: false` 也不会放开范围。SDK 不会根据未来的宿主调用自动扩大导出范围。预览沿用同一配置,自定义脚本也不能突破该范围,脚本额外请求的文件仍需登记。重新导出会移除旧包中不再需要的原始地理数据。
|
|
12
14
|
|
|
@@ -21,3 +23,5 @@
|
|
|
21
23
|
SDK 仅接受当前场景 schema 6 和运行清单 schema 5,旧资源池和旧清单的迁移只在平台导入入口执行。`packSceneDocumentResources`、`expandSceneDocumentResources` 和 `ScenePackingCache` 已移除。普通所有权拷贝使用 `cloneSceneDocument`。
|
|
22
24
|
|
|
23
25
|
平台模板、物体库和跨项目复制均使用含 `manifest.json` 与 `files/<sha256>` 的可编辑 ZIP;模板包括静态资源包和项目设置,复制包只携带选中资产的依赖。`ProjectResourceRepository` 统一管理媒体、地图数据、长脚本与静态资源包,历史差异仅持有路径。
|
|
26
|
+
|
|
27
|
+
地图导出和模板保存按场景、材质及预制体的实际图片引用收集水面纹理。`assetSources.waterNormalMaps` 只是编辑默认配置,不会让默认 JPG 自动进入 ZIP;程序波浪水面无需图片,材质已引用的 `normalMap` 仍随包保存。重新导出会移除旧包中未再引用的默认水面文件,显式登记的额外资源仍会保留。
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as _objectSpread2,i as _asyncToGenerator,n as bytesToHex,r as e,t as sha256}from"./sha2-BCqd-su1.js";import{WorkerPool,makePromiseCreator}from"esus-lite";var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__commonJSMin=(t,e)=>()=>(e||(t((e={exports:{}}).exports,e),t=null),e.exports),__exportAll=(t,e)=>{let i={};for(var A in t)__defProp(i,A,{get:t[A],enumerable:!0});return e||__defProp(i,Symbol.toStringTag,{value:"Module"}),i},__copyProps=(t,e,i,A)=>{if(e&&"object"==typeof e||"function"==typeof e)for(var n,r=__getOwnPropNames(e),s=0,o=r.length;s<o;s++)n=r[s],__hasOwnProp.call(t,n)||n===i||__defProp(t,n,{get:(t=>e[t]).bind(null,n),enumerable:!(A=__getOwnPropDesc(e,n))||A.enumerable});return t},__toESM=(t,e,i)=>(i=null!=t?__create(__getProtoOf(t)):{},__copyProps(!e&&t&&t.__esModule?i:__defProp(i,"default",{value:t,enumerable:!0}),t)),_Vector,_Vector2,_Matrix,_Vector3,_Matrix2,_Matrix3,_Symbol$iterator,_Symbol$iterator2,_Symbol$iterator3,REVISION="186",MOUSE={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},TOUCH={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},FrontSide=0,BackSide=1,NormalBlending=1,AddEquation=100,SrcAlphaFactor=204,OneMinusSrcAlphaFactor=205,NeverDepth=0,AlwaysDepth=1,LessDepth=2,LessEqualDepth=3,EqualDepth=4,GreaterEqualDepth=5,GreaterDepth=6,NotEqualDepth=7,MultiplyOperation=0,AttachedBindMode="attached",DetachedBindMode="detached",UVMapping=300,CubeReflectionMapping=301,CubeRefractionMapping=302,EquirectangularReflectionMapping=303,EquirectangularRefractionMapping=304,CubeUVReflectionMapping=306,RepeatWrapping=1e3,ClampToEdgeWrapping=1001,MirroredRepeatWrapping=1002,NearestFilter=1003,NearestMipmapNearestFilter=1004,NearestMipMapNearestFilter=1004,NearestMipmapLinearFilter=1005,NearestMipMapLinearFilter=1005,LinearFilter=1006,LinearMipmapNearestFilter=1007,LinearMipMapNearestFilter=1007,LinearMipmapLinearFilter=1008,LinearMipMapLinearFilter=1008,UnsignedByteType=1009,ByteType=1010,ShortType=1011,UnsignedShortType=1012,IntType=1013,UnsignedIntType=1014,FloatType=1015,HalfFloatType=1016,UnsignedShort4444Type=1017,UnsignedShort5551Type=1018,UnsignedInt248Type=1020,UnsignedInt5999Type=35902,UnsignedInt101111Type=35899,AlphaFormat=1021,RGBFormat=1022,RGBAFormat=1023,DepthFormat=1026,DepthStencilFormat=1027,RedFormat=1028,RedIntegerFormat=1029,RGFormat=1030,RGIntegerFormat=1031,RGBIntegerFormat=1032,RGBAIntegerFormat=1033,RGB_S3TC_DXT1_Format=33776,RGBA_S3TC_DXT1_Format=33777,RGBA_S3TC_DXT3_Format=33778,RGBA_S3TC_DXT5_Format=33779,RGB_PVRTC_4BPPV1_Format=35840,RGB_PVRTC_2BPPV1_Format=35841,RGBA_PVRTC_4BPPV1_Format=35842,RGBA_PVRTC_2BPPV1_Format=35843,RGB_ETC1_Format=36196,RGB_ETC2_Format=37492,RGBA_ETC2_EAC_Format=37496,R11_EAC_Format=37488,SIGNED_R11_EAC_Format=37489,RG11_EAC_Format=37490,SIGNED_RG11_EAC_Format=37491,RGBA_ASTC_4x4_Format=37808,RGBA_ASTC_5x4_Format=37809,RGBA_ASTC_5x5_Format=37810,RGBA_ASTC_6x5_Format=37811,RGBA_ASTC_6x6_Format=37812,RGBA_ASTC_8x5_Format=37813,RGBA_ASTC_8x6_Format=37814,RGBA_ASTC_8x8_Format=37815,RGBA_ASTC_10x5_Format=37816,RGBA_ASTC_10x6_Format=37817,RGBA_ASTC_10x8_Format=37818,RGBA_ASTC_10x10_Format=37819,RGBA_ASTC_12x10_Format=37820,RGBA_ASTC_12x12_Format=37821,RGBA_BPTC_Format=36492,RGB_BPTC_SIGNED_Format=36494,RGB_BPTC_UNSIGNED_Format=36495,RED_RGTC1_Format=36283,SIGNED_RED_RGTC1_Format=36284,RED_GREEN_RGTC2_Format=36285,SIGNED_RED_GREEN_RGTC2_Format=36286,LoopOnce=2200,LoopRepeat=2201,LoopPingPong=2202,InterpolateDiscrete=2300,InterpolateLinear=2301,InterpolateSmooth=2302,InterpolateBezier=2303,ZeroCurvatureEnding=2400,ZeroSlopeEnding=2401,WrapAroundEnding=2402,NormalAnimationBlendMode=2500,AdditiveAnimationBlendMode=2501,BasicDepthPacking=3200,RGBADepthPacking=3201,RGBDepthPacking=3202,RGDepthPacking=3203,TangentSpaceNormalMap=0,NoColorSpace="",SRGBColorSpace="srgb",LinearSRGBColorSpace="srgb-linear",LinearTransfer="linear",SRGBTransfer="srgb",KeepStencilOp=7680,ReplaceStencilOp=7681,IncrementStencilOp=7682,DecrementStencilOp=7683,IncrementWrapStencilOp=34055,DecrementWrapStencilOp=34056,InvertStencilOp=5386,AlwaysStencilFunc=519,StaticDrawUsage=35044,DynamicDrawUsage=35048,StreamDrawUsage=35040,StaticReadUsage=35045,DynamicReadUsage=35049,StreamReadUsage=35041,StaticCopyUsage=35046,DynamicCopyUsage=35050,StreamCopyUsage=35042,GLSL3="300 es",WebGLCoordinateSystem=2e3,WebGPUCoordinateSystem=2001,TimestampQuery={COMPUTE:"compute",RENDER:"render"},InterpolationSamplingType={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},InterpolationSamplingMode={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},Compatibility={TEXTURE_COMPARE:"depthTextureCompare"},RenderObjectRefreshType={NONE:0,SHARED:1,FULL:2};function arrayNeedsUint32(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}var TYPED_ARRAYS={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function getTypedArray(t,e){return new TYPED_ARRAYS[t](e)}function isTypedArray(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function createElementNS(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function createCanvasElement(){const t=createElementNS("canvas");return t.style.display="block",t}var _cache$2={},_setConsoleFunction=null;function setConsoleFunction(t){_setConsoleFunction=t}function getConsoleFunction(){return _setConsoleFunction}function log$3(...t){const e="THREE."+t.shift();_setConsoleFunction?_setConsoleFunction("log",e,...t):console.log(e,...t)}function enhanceLogMessage(t){const e=t[0];if("string"==typeof e&&e.startsWith("TSL:")){const e=t[1];e&&e.isStackTrace?t[0]+=" "+e.getLocation():t[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return t}function warn(...t){const e="THREE."+(t=enhanceLogMessage(t)).shift();if(_setConsoleFunction)_setConsoleFunction("warn",e,...t);else{const i=t[0];i&&i.isStackTrace?console.warn(i.getError(e)):console.warn(e,...t)}}function error$1(...t){const e="THREE."+(t=enhanceLogMessage(t)).shift();if(_setConsoleFunction)_setConsoleFunction("error",e,...t);else{const i=t[0];i&&i.isStackTrace?console.error(i.getError(e)):console.error(e,...t)}}function warnOnce(...t){const e=t.join(" ");e in _cache$2||(_cache$2[e]=!0,warn(...t))}function yieldToMain(){return"undefined"!=typeof self&&void 0!==self.scheduler&&void 0!==self.scheduler.yield?self.scheduler.yield():new Promise(t=>{requestAnimationFrame(t)})}function probeAsync(t,e,i){return new Promise(function(A,n){setTimeout(function r(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:n();break;case t.TIMEOUT_EXPIRED:setTimeout(r,i);break;default:A()}},i)})}var ReversedDepthFuncs={0:1,2:6,4:7,3:5,1:0,6:2,7:4,5:3},EventDispatcher=class{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){const i=this._listeners;return void 0!==i&&(void 0!==i[t]&&-1!==i[t].indexOf(e))}removeEventListener(t,e){const i=this._listeners;if(void 0===i)return;const A=i[t];if(void 0!==A){const t=A.indexOf(e);-1!==t&&A.splice(t,1)}}dispatchEvent(t){const e=this._listeners;if(void 0===e)return;const i=e[t.type];if(void 0!==i){t.target=this;const e=i.slice(0);for(let i=0,A=e.length;i<A;i++)e[i].call(this,t);t.target=null}}},_lut=["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"],_seed=1234567,DEG2RAD=Math.PI/180,RAD2DEG=180/Math.PI;function generateUUID(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,A=4294967295*Math.random()|0;return(_lut[255&t]+_lut[t>>8&255]+_lut[t>>16&255]+_lut[t>>24&255]+"-"+_lut[255&e]+_lut[e>>8&255]+"-"+_lut[e>>16&15|64]+_lut[e>>24&255]+"-"+_lut[63&i|128]+_lut[i>>8&255]+"-"+_lut[i>>16&255]+_lut[i>>24&255]+_lut[255&A]+_lut[A>>8&255]+_lut[A>>16&255]+_lut[A>>24&255]).toLowerCase()}function clamp$2(t,e,i){return Math.max(e,Math.min(i,t))}function euclideanModulo(t,e){return(t%e+e)%e}function mapLinear(t,e,i,A,n){return A+(t-e)*(n-A)/(i-e)}function inverseLerp(t,e,i){return t!==e?(i-t)/(e-t):0}function lerp(t,e,i){return(1-i)*t+i*e}function damp(t,e,i,A){return lerp(t,e,1-Math.exp(-i*A))}function pingpong(t,e=1){return e-Math.abs(euclideanModulo(t,2*e)-e)}function smoothstep$2(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)}function smootherstep(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)}function randInt(t,e){return t+Math.floor(Math.random()*(e-t+1))}function randFloat(t,e){return t+Math.random()*(e-t)}function randFloatSpread(t){return t*(.5-Math.random())}function seededRandom(t){void 0!==t&&(_seed=t);let e=_seed+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}function degToRad(t){return t*DEG2RAD}function radToDeg(t){return t*RAD2DEG}function isPowerOfTwo(t){return t>0&&Number.isInteger(t)&&Math.pow(2,Math.round(Math.log2(t)))===t}function ceilPowerOfTwo(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function floorPowerOfTwo(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function setQuaternionFromProperEuler(t,e,i,A,n){const r=Math.cos,s=Math.sin,o=r(i/2),a=s(i/2),l=r((e+A)/2),h=s((e+A)/2),g=r((e-A)/2),c=s((e-A)/2),d=r((A-e)/2),I=s((A-e)/2);switch(n){case"XYX":t.set(o*h,a*g,a*c,o*l);break;case"YZY":t.set(a*c,o*h,a*g,o*l);break;case"ZXZ":t.set(a*g,a*c,o*h,o*l);break;case"XZX":t.set(o*h,a*I,a*d,o*l);break;case"YXY":t.set(a*d,o*h,a*I,o*l);break;case"ZYZ":t.set(a*I,a*d,o*h,o*l);break;default:warn("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+n)}}function denormalize(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:case Uint8ClampedArray:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function normalize$3(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:case Uint8ClampedArray:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("THREE.MathUtils: Invalid component type.")}}var MathUtils={DEG2RAD:DEG2RAD,RAD2DEG:RAD2DEG,generateUUID:generateUUID,clamp:clamp$2,euclideanModulo:euclideanModulo,mapLinear:mapLinear,inverseLerp:inverseLerp,lerp:lerp,damp:damp,pingpong:pingpong,smoothstep:smoothstep$2,smootherstep:smootherstep,randInt:randInt,randFloat:randFloat,randFloatSpread:randFloatSpread,seededRandom:seededRandom,degToRad:degToRad,radToDeg:radToDeg,isPowerOfTwo:isPowerOfTwo,ceilPowerOfTwo:ceilPowerOfTwo,floorPowerOfTwo:floorPowerOfTwo,setQuaternionFromProperEuler:setQuaternionFromProperEuler,normalize:normalize$3,denormalize:denormalize};_Symbol$iterator=Symbol.iterator;var Vector2=class{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("THREE.Vector2: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,i=this.y,A=t.elements;return this.x=A[0]*e+A[3]*i+A[6],this.y=A[1]*e+A[4]*i+A[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=clamp$2(this.x,t.x,e.x),this.y=clamp$2(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=clamp$2(this.x,t,e),this.y=clamp$2(this.y,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(clamp$2(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(clamp$2(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const i=Math.cos(e),A=Math.sin(e),n=this.x-t.x,r=this.y-t.y;return this.x=n*i-r*A+t.x,this.y=n*A+r*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[_Symbol$iterator](){yield this.x,yield this.y}};_Vector=Vector2,_Vector.prototype.isVector2=!0;var Quaternion=class{constructor(t=0,e=0,i=0,A=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=A}static slerpFlat(t,e,i,A,n,r,s){let o=i[A+0],a=i[A+1],l=i[A+2],h=i[A+3],g=n[r+0],c=n[r+1],d=n[r+2],I=n[r+3];if(h!==I||o!==g||a!==c||l!==d){let t=o*g+a*c+l*d+h*I;t<0&&(g=-g,c=-c,d=-d,I=-I,t=-t);let e=1-s;if(t<.9995){const i=Math.acos(t),A=Math.sin(i);e=Math.sin(e*i)/A,o=o*e+g*(s=Math.sin(s*i)/A),a=a*e+c*s,l=l*e+d*s,h=h*e+I*s}else{o=o*e+g*s,a=a*e+c*s,l=l*e+d*s,h=h*e+I*s;const t=1/Math.sqrt(o*o+a*a+l*l+h*h);o*=t,a*=t,l*=t,h*=t}}t[e]=o,t[e+1]=a,t[e+2]=l,t[e+3]=h}static multiplyQuaternionsFlat(t,e,i,A,n,r){const s=i[A],o=i[A+1],a=i[A+2],l=i[A+3],h=n[r],g=n[r+1],c=n[r+2],d=n[r+3];return t[e]=s*d+l*h+o*c-a*g,t[e+1]=o*d+l*g+a*h-s*c,t[e+2]=a*d+l*c+s*g-o*h,t[e+3]=l*d-s*h-o*g-a*c,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,A){return this._x=t,this._y=e,this._z=i,this._w=A,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const i=t._x,A=t._y,n=t._z,r=t._order,s=Math.cos,o=Math.sin,a=s(i/2),l=s(A/2),h=s(n/2),g=o(i/2),c=o(A/2),d=o(n/2);switch(r){case"XYZ":this._x=g*l*h+a*c*d,this._y=a*c*h-g*l*d,this._z=a*l*d+g*c*h,this._w=a*l*h-g*c*d;break;case"YXZ":this._x=g*l*h+a*c*d,this._y=a*c*h-g*l*d,this._z=a*l*d-g*c*h,this._w=a*l*h+g*c*d;break;case"ZXY":this._x=g*l*h-a*c*d,this._y=a*c*h+g*l*d,this._z=a*l*d+g*c*h,this._w=a*l*h-g*c*d;break;case"ZYX":this._x=g*l*h-a*c*d,this._y=a*c*h+g*l*d,this._z=a*l*d-g*c*h,this._w=a*l*h+g*c*d;break;case"YZX":this._x=g*l*h+a*c*d,this._y=a*c*h+g*l*d,this._z=a*l*d-g*c*h,this._w=a*l*h-g*c*d;break;case"XZY":this._x=g*l*h-a*c*d,this._y=a*c*h-g*l*d,this._z=a*l*d+g*c*h,this._w=a*l*h+g*c*d;break;default:warn("Quaternion: .setFromEuler() encountered an unknown order: "+r)}return!0===e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,A=Math.sin(i);return this._x=t.x*A,this._y=t.y*A,this._z=t.z*A,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],A=e[4],n=e[8],r=e[1],s=e[5],o=e[9],a=e[2],l=e[6],h=e[10],g=i+s+h;if(g>0){const t=.5/Math.sqrt(g+1);this._w=.25/t,this._x=(l-o)*t,this._y=(n-a)*t,this._z=(r-A)*t}else if(i>s&&i>h){const t=2*Math.sqrt(1+i-s-h);this._w=(l-o)/t,this._x=.25*t,this._y=(A+r)/t,this._z=(n+a)/t}else if(s>h){const t=2*Math.sqrt(1+s-i-h);this._w=(n-a)/t,this._x=(A+r)/t,this._y=.25*t,this._z=(o+l)/t}else{const t=2*Math.sqrt(1+h-i-s);this._w=(r-A)/t,this._x=(n+a)/t,this._y=(o+l)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<1e-8?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(clamp$2(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(0===i)return this;const A=Math.min(1,e/i);return this.slerp(t,A),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,A=t._y,n=t._z,r=t._w,s=e._x,o=e._y,a=e._z,l=e._w;return this._x=i*l+r*s+A*a-n*o,this._y=A*l+r*o+n*s-i*a,this._z=n*l+r*a+i*o-A*s,this._w=r*l-i*s-A*o-n*a,this._onChangeCallback(),this}slerp(t,e){let i=t._x,A=t._y,n=t._z,r=t._w,s=this.dot(t);s<0&&(i=-i,A=-A,n=-n,r=-r,s=-s);let o=1-e;if(s<.9995){const t=Math.acos(s),a=Math.sin(t);o=Math.sin(o*t)/a,e=Math.sin(e*t)/a,this._x=this._x*o+i*e,this._y=this._y*o+A*e,this._z=this._z*o+n*e,this._w=this._w*o+r*e,this._onChangeCallback()}else this._x=this._x*o+i*e,this._y=this._y*o+A*e,this._z=this._z*o+n*e,this._w=this._w*o+r*e,this.normalize();return this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),A=Math.sqrt(1-i),n=Math.sqrt(i);return this.set(A*Math.sin(t),A*Math.cos(t),n*Math.sin(e),n*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}};_Symbol$iterator2=Symbol.iterator;var Vector3=class{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("THREE.Vector3: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(_quaternion$5.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(_quaternion$5.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,A=this.z,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6]*A,this.y=n[1]*e+n[4]*i+n[7]*A,this.z=n[2]*e+n[5]*i+n[8]*A,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,A=this.z,n=t.elements,r=1/(n[3]*e+n[7]*i+n[11]*A+n[15]);return this.x=(n[0]*e+n[4]*i+n[8]*A+n[12])*r,this.y=(n[1]*e+n[5]*i+n[9]*A+n[13])*r,this.z=(n[2]*e+n[6]*i+n[10]*A+n[14])*r,this}applyQuaternion(t){const e=this.x,i=this.y,A=this.z,n=t.x,r=t.y,s=t.z,o=t.w,a=2*(r*A-s*i),l=2*(s*e-n*A),h=2*(n*i-r*e);return this.x=e+o*a+r*h-s*l,this.y=i+o*l+s*a-n*h,this.z=A+o*h+n*l-r*a,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,i=this.y,A=this.z,n=t.elements;return this.x=n[0]*e+n[4]*i+n[8]*A,this.y=n[1]*e+n[5]*i+n[9]*A,this.z=n[2]*e+n[6]*i+n[10]*A,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=clamp$2(this.x,t.x,e.x),this.y=clamp$2(this.y,t.y,e.y),this.z=clamp$2(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=clamp$2(this.x,t,e),this.y=clamp$2(this.y,t,e),this.z=clamp$2(this.z,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(clamp$2(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,A=t.y,n=t.z,r=e.x,s=e.y,o=e.z;return this.x=A*o-n*s,this.y=n*r-i*o,this.z=i*s-A*r,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return _vector$c.copy(this).projectOnVector(t),this.sub(_vector$c)}reflect(t){return this.sub(_vector$c.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(clamp$2(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,A=this.z-t.z;return e*e+i*i+A*A}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){const A=Math.sin(e)*t;return this.x=A*Math.sin(i),this.y=Math.cos(e)*t,this.z=A*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),A=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=A,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=2*Math.random()-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[_Symbol$iterator2](){yield this.x,yield this.y,yield this.z}};_Vector2=Vector3,_Vector2.prototype.isVector3=!0;var _vector$c=/*@__PURE__*/new Vector3,_quaternion$5=/*@__PURE__*/new Quaternion,Matrix3=class{constructor(t,e,i,A,n,r,s,o,a){this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,i,A,n,r,s,o,a)}set(t,e,i,A,n,r,s,o,a){const l=this.elements;return l[0]=t,l[1]=A,l[2]=s,l[3]=e,l[4]=n,l[5]=o,l[6]=i,l[7]=r,l[8]=a,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,A=e.elements,n=this.elements,r=i[0],s=i[3],o=i[6],a=i[1],l=i[4],h=i[7],g=i[2],c=i[5],d=i[8],I=A[0],u=A[3],p=A[6],C=A[1],m=A[4],y=A[7],E=A[2],f=A[5],M=A[8];return n[0]=r*I+s*C+o*E,n[3]=r*u+s*m+o*f,n[6]=r*p+s*y+o*M,n[1]=a*I+l*C+h*E,n[4]=a*u+l*m+h*f,n[7]=a*p+l*y+h*M,n[2]=g*I+c*C+d*E,n[5]=g*u+c*m+d*f,n[8]=g*p+c*y+d*M,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],A=t[2],n=t[3],r=t[4],s=t[5],o=t[6],a=t[7],l=t[8];return e*r*l-e*s*a-i*n*l+i*s*o+A*n*a-A*r*o}invert(){const t=this.elements,e=t[0],i=t[1],A=t[2],n=t[3],r=t[4],s=t[5],o=t[6],a=t[7],l=t[8],h=l*r-s*a,g=s*o-l*n,c=a*n-r*o,d=e*h+i*g+A*c;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);const I=1/d;return t[0]=h*I,t[1]=(A*a-l*i)*I,t[2]=(s*i-A*r)*I,t[3]=g*I,t[4]=(l*e-A*o)*I,t[5]=(A*n-s*e)*I,t[6]=c*I,t[7]=(i*o-a*e)*I,t[8]=(r*e-i*n)*I,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,A,n,r,s){const o=Math.cos(n),a=Math.sin(n);return this.set(i*o,i*a,-i*(o*r+a*s)+r+t,-A*a,A*o,-A*(-a*r+o*s)+s+e,0,0,1),this}scale(t,e){return warnOnce("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(_m3.makeScale(t,e)),this}rotate(t){return warnOnce("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(_m3.makeRotation(-t)),this}translate(t,e){return warnOnce("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(_m3.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,i=t.elements;for(let A=0;A<9;A++)if(e[A]!==i[A])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return(new this.constructor).fromArray(this.elements)}};_Matrix=Matrix3,_Matrix.prototype.isMatrix3=!0;var _m3=/*@__PURE__*/new Matrix3,LINEAR_REC709_TO_XYZ=/*@__PURE__*/(new Matrix3).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),XYZ_TO_LINEAR_REC709=/*@__PURE__*/(new Matrix3).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function createColorManagement(){const t={enabled:!0,workingColorSpace:LinearSRGBColorSpace,spaces:{},convert:function(t,e,i){return!1!==this.enabled&&e!==i&&e&&i?("srgb"===this.spaces[e].transfer&&(t.r=SRGBToLinear(t.r),t.g=SRGBToLinear(t.g),t.b=SRGBToLinear(t.b)),this.spaces[e].primaries!==this.spaces[i].primaries&&(t.applyMatrix3(this.spaces[e].toXYZ),t.applyMatrix3(this.spaces[i].fromXYZ)),"srgb"===this.spaces[i].transfer&&(t.r=LinearToSRGB(t.r),t.g=LinearToSRGB(t.g),t.b=LinearToSRGB(t.b)),t):t},workingToColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},colorSpaceToWorking:function(t,e){return this.convert(t,e,this.workingColorSpace)},getPrimaries:function(t){return this.spaces[t].primaries},getTransfer:function(t){return""===t?LinearTransfer:this.spaces[t].transfer},getToneMappingMode:function(t){return this.spaces[t].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(t,e=this.workingColorSpace){return t.fromArray(this.spaces[e].luminanceCoefficients)},define:function(t){Object.assign(this.spaces,t)},_getMatrix:function(t,e,i){return t.copy(this.spaces[e].toXYZ).multiply(this.spaces[i].fromXYZ)},_getDrawingBufferColorSpace:function(t){return this.spaces[t].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(t=this.workingColorSpace){return this.spaces[t].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(e,i){return warnOnce("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(e,i)},toWorkingColorSpace:function(e,i){return warnOnce("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),t.colorSpaceToWorking(e,i)}},e=[.64,.33,.3,.6,.15,.06],i=[.2126,.7152,.0722],A=[.3127,.329];return t.define({[LinearSRGBColorSpace]:{primaries:e,whitePoint:A,transfer:LinearTransfer,toXYZ:LINEAR_REC709_TO_XYZ,fromXYZ:XYZ_TO_LINEAR_REC709,luminanceCoefficients:i,workingColorSpaceConfig:{unpackColorSpace:SRGBColorSpace},outputColorSpaceConfig:{drawingBufferColorSpace:SRGBColorSpace}},[SRGBColorSpace]:{primaries:e,whitePoint:A,transfer:SRGBTransfer,toXYZ:LINEAR_REC709_TO_XYZ,fromXYZ:XYZ_TO_LINEAR_REC709,luminanceCoefficients:i,outputColorSpaceConfig:{drawingBufferColorSpace:SRGBColorSpace}}}),t}var ColorManagement=/*@__PURE__*/createColorManagement(),_canvas;function SRGBToLinear(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function LinearToSRGB(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}var ImageUtils=class{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let i;if(t instanceof HTMLCanvasElement)i=t;else{void 0===_canvas&&(_canvas=createElementNS("canvas")),_canvas.width=t.width,_canvas.height=t.height;const e=_canvas.getContext("2d");t instanceof ImageData?e.putImageData(t,0,0):e.drawImage(t,0,0,t.width,t.height),i=_canvas}return i.toDataURL(e)}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=createElementNS("canvas");e.width=t.width,e.height=t.height;const i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);const A=i.getImageData(0,0,t.width,t.height),n=A.data;for(let t=0;t<n.length;t++)n[t]=255*SRGBToLinear(n[t]/255);return i.putImageData(A,0,0),e}if(t.data){const e=t.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(255*SRGBToLinear(e[t]/255)):e[t]=SRGBToLinear(e[t]);return{data:e,width:t.width,height:t.height}}return warn("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}},_sourceId=0,TextureSource=class{constructor(t=null){this.isTextureSource=!0,Object.defineProperty(this,"id",{value:_sourceId++}),this.uuid=generateUUID(),this.data=t,this.dataReady=!0,this.version=0}getSize(t){const e=this.data;return"undefined"!=typeof HTMLVideoElement&&e instanceof HTMLVideoElement?t.set(e.videoWidth,e.videoHeight,0):"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?t.set(e.displayWidth,e.displayHeight,0):null!==e?t.set(e.width,e.height,e.depth||0):t.set(0,0,0),t}set needsUpdate(t){!0===t&&this.version++}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];const i={uuid:this.uuid,url:""},A=this.data;if(null!==A){let t;if(Array.isArray(A)){t=[];for(let e=0,i=A.length;e<i;e++)A[e].isDataTexture?t.push(serializeImage(A[e].image)):t.push(serializeImage(A[e]))}else t=serializeImage(A);i.url=t}return e||(t.images[this.uuid]=i),i}};function serializeImage(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?ImageUtils.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(warn("Texture: Unable to serialize Texture."),{})}var Source=class extends TextureSource{constructor(t=null){warnOnce('Source: "Source" has been renamed to "TextureSource". Please update your code to use "THREE.TextureSource" instead.'),super(t),this.isSource=!0}},_textureId=0,_tempVec3=/*@__PURE__*/new Vector3,Texture=class t extends EventDispatcher{constructor(e=t.DEFAULT_IMAGE,i=t.DEFAULT_MAPPING,A=ClampToEdgeWrapping,n=ClampToEdgeWrapping,r=LinearFilter,s=LinearMipmapLinearFilter,o=RGBAFormat,a=UnsignedByteType,l=t.DEFAULT_ANISOTROPY,h=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:_textureId++}),this.uuid=generateUUID(),this.name="",this.source=new TextureSource(e),this.mipmaps=[],this.mapping=i,this.channel=0,this.wrapS=A,this.wrapT=n,this.magFilter=r,this.minFilter=s,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=a,this.offset=new Vector2(0,0),this.repeat=new Vector2(1,1),this.center=new Vector2(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Matrix3,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(_tempVec3).x}get height(){return this.source.getSize(_tempVec3).y}get depth(){return this.source.getSize(_tempVec3).z}get image(){return this.source.data}set image(t){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.normalized=t.normalized,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(const e in t){const i=t[e];if(void 0===i){warn(`Texture.setValues(): parameter '${e}' has value of undefined.`);continue}const A=this[e];void 0!==A?A&&i&&A.isVector2&&i.isVector2||A&&i&&A.isVector3&&i.isVector3||A&&i&&A.isMatrix3&&i.isMatrix3?A.copy(i):this[e]=i:warn(`Texture.setValues(): property '${e}' does not exist.`)}}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case RepeatWrapping:t.x=t.x-Math.floor(t.x);break;case ClampToEdgeWrapping:t.x=t.x<0?0:1;break;case MirroredRepeatWrapping:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case RepeatWrapping:t.y=t.y-Math.floor(t.y);break;case ClampToEdgeWrapping:t.y=t.y<0?0:1;break;case MirroredRepeatWrapping:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}};Texture.DEFAULT_IMAGE=null,Texture.DEFAULT_MAPPING=300,Texture.DEFAULT_ANISOTROPY=1,_Symbol$iterator3=Symbol.iterator;var Vector4=class{constructor(t=0,e=0,i=0,A=1){this.x=t,this.y=e,this.z=i,this.w=A}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,A){return this.x=t,this.y=e,this.z=i,this.w=A,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("THREE.Vector4: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,i=this.y,A=this.z,n=this.w,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*A+r[12]*n,this.y=r[1]*e+r[5]*i+r[9]*A+r[13]*n,this.z=r[2]*e+r[6]*i+r[10]*A+r[14]*n,this.w=r[3]*e+r[7]*i+r[11]*A+r[15]*n,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,A,n;const r=.01,s=.1,o=t.elements,a=o[0],l=o[4],h=o[8],g=o[1],c=o[5],d=o[9],I=o[2],u=o[6],p=o[10];if(Math.abs(l-g)<r&&Math.abs(h-I)<r&&Math.abs(d-u)<r){if(Math.abs(l+g)<s&&Math.abs(h+I)<s&&Math.abs(d+u)<s&&Math.abs(a+c+p-3)<s)return this.set(1,0,0,0),this;e=Math.PI;const t=(a+1)/2,o=(c+1)/2,C=(p+1)/2,m=(l+g)/4,y=(h+I)/4,E=(d+u)/4;return t>o&&t>C?t<r?(i=0,A=.707106781,n=.707106781):(i=Math.sqrt(t),A=m/i,n=y/i):o>C?o<r?(i=.707106781,A=0,n=.707106781):(A=Math.sqrt(o),i=m/A,n=E/A):C<r?(i=.707106781,A=.707106781,n=0):(n=Math.sqrt(C),i=y/n,A=E/n),this.set(i,A,n,e),this}let C=Math.sqrt((u-d)*(u-d)+(h-I)*(h-I)+(g-l)*(g-l));return Math.abs(C)<.001&&(C=1),this.x=(u-d)/C,this.y=(h-I)/C,this.z=(g-l)/C,this.w=Math.acos((a+c+p-1)/2),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=clamp$2(this.x,t.x,e.x),this.y=clamp$2(this.y,t.y,e.y),this.z=clamp$2(this.z,t.z,e.z),this.w=clamp$2(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=clamp$2(this.x,t,e),this.y=clamp$2(this.y,t,e),this.z=clamp$2(this.z,t,e),this.w=clamp$2(this.w,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(clamp$2(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[_Symbol$iterator3](){yield this.x,yield this.y,yield this.z,yield this.w}};_Vector3=Vector4,_Vector3.prototype.isVector4=!0;var RenderTarget=class extends EventDispatcher{constructor(t=1,e=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:LinearFilter,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},i),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=i.depth,this.scissor=new Vector4(0,0,t,e),this.scissorTest=!1,this.viewport=new Vector4(0,0,t,e),this.textures=[];const A=new Texture({width:t,height:e,depth:i.depth}),n=i.count;for(let r=0;r<n;r++)this.textures[r]=A.clone(),this.textures[r].isRenderTargetTexture=!0,this.textures[r].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveColorBuffer=i.resolveColorBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this.storeMultisampledColorBuffer=i.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=i.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=i.storeMultisampledStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview,this.useArrayDepthTexture=i.useArrayDepthTexture}_setTextureOptions(t={}){const e={minFilter:LinearFilter,generateMipmaps:!1,flipY:!1,internalFormat:null};void 0!==t.mapping&&(e.mapping=t.mapping),void 0!==t.wrapS&&(e.wrapS=t.wrapS),void 0!==t.wrapT&&(e.wrapT=t.wrapT),void 0!==t.wrapR&&(e.wrapR=t.wrapR),void 0!==t.magFilter&&(e.magFilter=t.magFilter),void 0!==t.minFilter&&(e.minFilter=t.minFilter),void 0!==t.format&&(e.format=t.format),void 0!==t.type&&(e.type=t.type),void 0!==t.anisotropy&&(e.anisotropy=t.anisotropy),void 0!==t.colorSpace&&(e.colorSpace=t.colorSpace),void 0!==t.flipY&&(e.flipY=t.flipY),void 0!==t.generateMipmaps&&(e.generateMipmaps=t.generateMipmaps),void 0!==t.internalFormat&&(e.internalFormat=t.internalFormat);for(let i=0;i<this.textures.length;i++)this.textures[i].setValues(e)}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}set depthTexture(t){null!==this._depthTexture&&this._depthTexture.renderTarget===this&&(this._depthTexture.renderTarget=null),null!==t&&null===t.renderTarget&&(t.renderTarget=this),this._depthTexture=t}get depthTexture(){return this._depthTexture}setSize(t,e,i=1){if(this.width!==t||this.height!==e||this.depth!==i){this.width=t,this.height=e,this.depth=i;for(let A=0,n=this.textures.length;A<n;A++)this.textures[A].image.width=t,this.textures[A].image.height=e,this.textures[A].image.depth=i,!0!==this.textures[A].isData3DTexture&&(this.textures[A].isArrayTexture=this.textures[A].image.depth>1);this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,i=t.textures.length;e<i;e++){this.textures[e]=t.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;const i=Object.assign({},t.textures[e].image);this.textures[e].source=new TextureSource(i)}if(this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveColorBuffer=t.resolveColorBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,this.storeMultisampledColorBuffer=t.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=t.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=t.storeMultisampledStencilBuffer,null!==t.depthTexture)if(t.depthTexture.renderTarget===t){const e=t.depthTexture.clone();e.renderTarget=null,this.depthTexture=e}else this.depthTexture=t.depthTexture;return this.samples=t.samples,this.multiview=t.multiview,this.useArrayDepthTexture=t.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}},WebGLRenderTarget=class extends RenderTarget{constructor(t=1,e=1,i={}){super(t,e,i),this.isWebGLRenderTarget=!0}},DataArrayTexture=class extends Texture{constructor(t=null,e=1,i=1,A=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:i,depth:A},this.magFilter=NearestFilter,this.minFilter=NearestFilter,this.wrapR=ClampToEdgeWrapping,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=/* @__PURE__ */new Set}copy(t){return super.copy(t),this.wrapR=t.wrapR,this}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}},WebGLArrayRenderTarget=class extends WebGLRenderTarget{constructor(t=1,e=1,i=1,A={}){super(t,e,A),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new DataArrayTexture(null,t,e,i),this._setTextureOptions(A),this.texture.isRenderTargetTexture=!0}},Data3DTexture=class extends Texture{constructor(t=null,e=1,i=1,A=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:i,depth:A},this.magFilter=NearestFilter,this.minFilter=NearestFilter,this.wrapR=ClampToEdgeWrapping,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}copy(t){return super.copy(t),this.wrapR=t.wrapR,this}},WebGL3DRenderTarget=class extends WebGLRenderTarget{constructor(t=1,e=1,i=1,A={}){super(t,e,A),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new Data3DTexture(null,t,e,i),this._setTextureOptions(A),this.texture.isRenderTargetTexture=!0}},Matrix4=class t{constructor(t,e,i,A,n,r,s,o,a,l,h,g,c,d,I,u){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,i,A,n,r,s,o,a,l,h,g,c,d,I,u)}set(t,e,i,A,n,r,s,o,a,l,h,g,c,d,I,u){const p=this.elements;return p[0]=t,p[4]=e,p[8]=i,p[12]=A,p[1]=n,p[5]=r,p[9]=s,p[13]=o,p[2]=a,p[6]=l,p[10]=h,p[14]=g,p[3]=c,p[7]=d,p[11]=I,p[15]=u,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 t).fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return 0===this.determinantAffine()?(t.set(1,0,0),e.set(0,1,0),i.set(0,0,1),this):(t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){if(0===t.determinantAffine())return this.identity();const e=this.elements,i=t.elements,A=1/_v1$7.setFromMatrixColumn(t,0).length(),n=1/_v1$7.setFromMatrixColumn(t,1).length(),r=1/_v1$7.setFromMatrixColumn(t,2).length();return e[0]=i[0]*A,e[1]=i[1]*A,e[2]=i[2]*A,e[3]=0,e[4]=i[4]*n,e[5]=i[5]*n,e[6]=i[6]*n,e[7]=0,e[8]=i[8]*r,e[9]=i[9]*r,e[10]=i[10]*r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,i=t.x,A=t.y,n=t.z,r=Math.cos(i),s=Math.sin(i),o=Math.cos(A),a=Math.sin(A),l=Math.cos(n),h=Math.sin(n);if("XYZ"===t.order){const t=r*l,i=r*h,A=s*l,n=s*h;e[0]=o*l,e[4]=-o*h,e[8]=a,e[1]=i+A*a,e[5]=t-n*a,e[9]=-s*o,e[2]=n-t*a,e[6]=A+i*a,e[10]=r*o}else if("YXZ"===t.order){const t=o*l,i=o*h,A=a*l,n=a*h;e[0]=t+n*s,e[4]=A*s-i,e[8]=r*a,e[1]=r*h,e[5]=r*l,e[9]=-s,e[2]=i*s-A,e[6]=n+t*s,e[10]=r*o}else if("ZXY"===t.order){const t=o*l,i=o*h,A=a*l,n=a*h;e[0]=t-n*s,e[4]=-r*h,e[8]=A+i*s,e[1]=i+A*s,e[5]=r*l,e[9]=n-t*s,e[2]=-r*a,e[6]=s,e[10]=r*o}else if("ZYX"===t.order){const t=r*l,i=r*h,A=s*l,n=s*h;e[0]=o*l,e[4]=A*a-i,e[8]=t*a+n,e[1]=o*h,e[5]=n*a+t,e[9]=i*a-A,e[2]=-a,e[6]=s*o,e[10]=r*o}else if("YZX"===t.order){const t=r*o,i=r*a,A=s*o,n=s*a;e[0]=o*l,e[4]=n-t*h,e[8]=A*h+i,e[1]=h,e[5]=r*l,e[9]=-s*l,e[2]=-a*l,e[6]=i*h+A,e[10]=t-n*h}else if("XZY"===t.order){const t=r*o,i=r*a,A=s*o,n=s*a;e[0]=o*l,e[4]=-h,e[8]=a*l,e[1]=t*h+n,e[5]=r*l,e[9]=i*h-A,e[2]=A*h-i,e[6]=s*l,e[10]=n*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(_zero,t,_one)}lookAt(t,e,i){const A=this.elements;return _z.subVectors(t,e),0===_z.lengthSq()&&(_z.z=1),_z.normalize(),_x.crossVectors(i,_z),0===_x.lengthSq()&&(1===Math.abs(i.z)?_z.x+=1e-4:_z.z+=1e-4,_z.normalize(),_x.crossVectors(i,_z)),_x.normalize(),_y.crossVectors(_z,_x),A[0]=_x.x,A[4]=_y.x,A[8]=_z.x,A[1]=_x.y,A[5]=_y.y,A[9]=_z.y,A[2]=_x.z,A[6]=_y.z,A[10]=_z.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,A=e.elements,n=this.elements,r=i[0],s=i[4],o=i[8],a=i[12],l=i[1],h=i[5],g=i[9],c=i[13],d=i[2],I=i[6],u=i[10],p=i[14],C=i[3],m=i[7],y=i[11],E=i[15],f=A[0],M=A[4],B=A[8],P=A[12],w=A[1],Q=A[5],D=A[9],S=A[13],b=A[2],T=A[6],j=A[10],Y=A[14],W=A[3],F=A[7],x=A[11],K=A[15];return n[0]=r*f+s*w+o*b+a*W,n[4]=r*M+s*Q+o*T+a*F,n[8]=r*B+s*D+o*j+a*x,n[12]=r*P+s*S+o*Y+a*K,n[1]=l*f+h*w+g*b+c*W,n[5]=l*M+h*Q+g*T+c*F,n[9]=l*B+h*D+g*j+c*x,n[13]=l*P+h*S+g*Y+c*K,n[2]=d*f+I*w+u*b+p*W,n[6]=d*M+I*Q+u*T+p*F,n[10]=d*B+I*D+u*j+p*x,n[14]=d*P+I*S+u*Y+p*K,n[3]=C*f+m*w+y*b+E*W,n[7]=C*M+m*Q+y*T+E*F,n[11]=C*B+m*D+y*j+E*x,n[15]=C*P+m*S+y*Y+E*K,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[4],A=t[8],n=t[12],r=t[1],s=t[5],o=t[9],a=t[13],l=t[2],h=t[6],g=t[10],c=t[14],d=t[3],I=t[7],u=t[11],p=t[15],C=o*c-a*g,m=s*c-a*h,y=s*g-o*h,E=r*c-a*l,f=r*g-o*l,M=r*h-s*l;return e*(I*C-u*m+p*y)-i*(d*C-u*E+p*f)+A*(d*m-I*E+p*M)-n*(d*y-I*f+u*M)}determinantAffine(){const t=this.elements,e=t[0],i=t[4],A=t[8],n=t[1],r=t[5],s=t[9],o=t[2],a=t[6],l=t[10];return e*(r*l-s*a)-i*(n*l-s*o)+A*(n*a-r*o)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,i){const A=this.elements;return t.isVector3?(A[12]=t.x,A[13]=t.y,A[14]=t.z):(A[12]=t,A[13]=e,A[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],A=t[2],n=t[3],r=t[4],s=t[5],o=t[6],a=t[7],l=t[8],h=t[9],g=t[10],c=t[11],d=t[12],I=t[13],u=t[14],p=t[15],C=e*s-i*r,m=e*o-A*r,y=e*a-n*r,E=i*o-A*s,f=i*a-n*s,M=A*a-n*o,B=l*I-h*d,P=l*u-g*d,w=l*p-c*d,Q=h*u-g*I,D=h*p-c*I,S=g*p-c*u,b=C*S-m*D+y*Q+E*w-f*P+M*B;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const T=1/b;return t[0]=(s*S-o*D+a*Q)*T,t[1]=(A*D-i*S-n*Q)*T,t[2]=(I*M-u*f+p*E)*T,t[3]=(g*f-h*M-c*E)*T,t[4]=(o*w-r*S-a*P)*T,t[5]=(e*S-A*w+n*P)*T,t[6]=(u*y-d*M-p*m)*T,t[7]=(l*M-g*y+c*m)*T,t[8]=(r*D-s*w+a*B)*T,t[9]=(i*w-e*D-n*B)*T,t[10]=(d*f-I*y+p*C)*T,t[11]=(h*y-l*f-c*C)*T,t[12]=(s*P-r*Q-o*B)*T,t[13]=(e*Q-i*P+A*B)*T,t[14]=(I*m-d*E-u*C)*T,t[15]=(l*E-h*m+g*C)*T,this}scale(t){const e=this.elements,i=t.x,A=t.y,n=t.z;return e[0]*=i,e[4]*=A,e[8]*=n,e[1]*=i,e[5]*=A,e[9]*=n,e[2]*=i,e[6]*=A,e[10]*=n,e[3]*=i,e[7]*=A,e[11]*=n,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],A=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,A))}makeTranslation(t,e,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),A=Math.sin(e),n=1-i,r=t.x,s=t.y,o=t.z,a=n*r,l=n*s;return this.set(a*r+i,a*s-A*o,a*o+A*s,0,a*s+A*o,l*s+i,l*o-A*r,0,a*o-A*s,l*o+A*r,n*o*o+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,A,n,r){return this.set(1,i,n,0,t,1,r,0,e,A,1,0,0,0,0,1),this}compose(t,e,i){const A=this.elements,n=e._x,r=e._y,s=e._z,o=e._w,a=n+n,l=r+r,h=s+s,g=n*a,c=n*l,d=n*h,I=r*l,u=r*h,p=s*h,C=o*a,m=o*l,y=o*h,E=i.x,f=i.y,M=i.z;return A[0]=(1-(I+p))*E,A[1]=(c+y)*E,A[2]=(d-m)*E,A[3]=0,A[4]=(c-y)*f,A[5]=(1-(g+p))*f,A[6]=(u+C)*f,A[7]=0,A[8]=(d+m)*M,A[9]=(u-C)*M,A[10]=(1-(g+I))*M,A[11]=0,A[12]=t.x,A[13]=t.y,A[14]=t.z,A[15]=1,this}decompose(t,e,i){const A=this.elements;t.x=A[12],t.y=A[13],t.z=A[14];const n=this.determinantAffine();if(0===n)return i.set(1,1,1),e.identity(),this;let r=_v1$7.set(A[0],A[1],A[2]).length();const s=_v1$7.set(A[4],A[5],A[6]).length(),o=_v1$7.set(A[8],A[9],A[10]).length();n<0&&(r=-r),_m1$2$1.copy(this);const a=1/r,l=1/s,h=1/o;return _m1$2$1.elements[0]*=a,_m1$2$1.elements[1]*=a,_m1$2$1.elements[2]*=a,_m1$2$1.elements[4]*=l,_m1$2$1.elements[5]*=l,_m1$2$1.elements[6]*=l,_m1$2$1.elements[8]*=h,_m1$2$1.elements[9]*=h,_m1$2$1.elements[10]*=h,e.setFromRotationMatrix(_m1$2$1),i.x=r,i.y=s,i.z=o,this}makePerspective(t,e,i,A,n,r,s=WebGLCoordinateSystem,o=!1){const a=this.elements,l=2*n/(e-t),h=2*n/(i-A),g=(e+t)/(e-t),c=(i+A)/(i-A);let d,I;if(o)d=n/(r-n),I=r*n/(r-n);else if(2e3===s)d=-(r+n)/(r-n),I=-2*r*n/(r-n);else{if(2001!==s)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+s);d=-r/(r-n),I=-r*n/(r-n)}return a[0]=l,a[4]=0,a[8]=g,a[12]=0,a[1]=0,a[5]=h,a[9]=c,a[13]=0,a[2]=0,a[6]=0,a[10]=d,a[14]=I,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(t,e,i,A,n,r,s=WebGLCoordinateSystem,o=!1){const a=this.elements,l=2/(e-t),h=2/(i-A),g=-(e+t)/(e-t),c=-(i+A)/(i-A);let d,I;if(o)d=1/(r-n),I=r/(r-n);else if(2e3===s)d=-2/(r-n),I=-(r+n)/(r-n);else{if(2001!==s)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);d=-1/(r-n),I=-n/(r-n)}return a[0]=l,a[4]=0,a[8]=0,a[12]=g,a[1]=0,a[5]=h,a[9]=0,a[13]=c,a[2]=0,a[6]=0,a[10]=d,a[14]=I,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(t){const e=this.elements,i=t.elements;for(let A=0;A<16;A++)if(e[A]!==i[A])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}};_Matrix2=Matrix4,_Matrix2.prototype.isMatrix4=!0;var _v1$7=/*@__PURE__*/new Vector3,_m1$2$1=/*@__PURE__*/new Matrix4,_zero=/*@__PURE__*/new Vector3(0,0,0),_one=/*@__PURE__*/new Vector3(1,1,1),_x=/*@__PURE__*/new Vector3,_y=/*@__PURE__*/new Vector3,_z=/*@__PURE__*/new Vector3,_matrix$2$1=/*@__PURE__*/new Matrix4,_quaternion$4=/*@__PURE__*/new Quaternion,Euler=class t{constructor(e=0,i=0,A=0,n=t.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=i,this._z=A,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,A=this._order){return this._x=t,this._y=e,this._z=i,this._order=A,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){const A=t.elements,n=A[0],r=A[4],s=A[8],o=A[1],a=A[5],l=A[9],h=A[2],g=A[6],c=A[10];switch(e){case"XYZ":this._y=Math.asin(clamp$2(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,c),this._z=Math.atan2(-r,n)):(this._x=Math.atan2(g,a),this._z=0);break;case"YXZ":this._x=Math.asin(-clamp$2(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(s,c),this._z=Math.atan2(o,a)):(this._y=Math.atan2(-h,n),this._z=0);break;case"ZXY":this._x=Math.asin(clamp$2(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(-h,c),this._z=Math.atan2(-r,a)):(this._y=0,this._z=Math.atan2(o,n));break;case"ZYX":this._y=Math.asin(-clamp$2(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(g,c),this._z=Math.atan2(o,n)):(this._x=0,this._z=Math.atan2(-r,a));break;case"YZX":this._z=Math.asin(clamp$2(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,a),this._y=Math.atan2(-h,n)):(this._x=0,this._y=Math.atan2(s,c));break;case"XZY":this._z=Math.asin(-clamp$2(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(g,a),this._y=Math.atan2(s,n)):(this._x=Math.atan2(-l,c),this._y=0);break;default:warn("Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===i&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return _matrix$2$1.makeRotationFromQuaternion(t),this.setFromRotationMatrix(_matrix$2$1,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return _quaternion$4.setFromEuler(this),this.setFromQuaternion(_quaternion$4,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Euler.DEFAULT_ORDER="XYZ";var Layers=class{constructor(){this.mask=1}set(t){this.mask=1<<t>>>0}enable(t){this.mask|=1<<t}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t}disable(t){this.mask&=~(1<<t)}disableAll(){this.mask=0}test(t){return 0!==(this.mask&t.mask)}isEnabled(t){return!!(this.mask&1<<t)}},_object3DId=0,_v1$6=/*@__PURE__*/new Vector3,_q1=/*@__PURE__*/new Quaternion,_m1$1$3=/*@__PURE__*/new Matrix4,_target$1=/*@__PURE__*/new Vector3,_position$4=/*@__PURE__*/new Vector3,_scale$3=/*@__PURE__*/new Vector3,_quaternion$3=/*@__PURE__*/new Quaternion,_xAxis=/*@__PURE__*/new Vector3(1,0,0),_yAxis=/*@__PURE__*/new Vector3(0,1,0),_zAxis=/*@__PURE__*/new Vector3(0,0,1),_addedEvent={type:"added"},_removedEvent={type:"removed"},_childaddedEvent={type:"childadded",child:null},_childremovedEvent={type:"childremoved",child:null},Object3D=class t extends EventDispatcher{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:_object3DId++}),this.uuid=generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=t.DEFAULT_UP.clone();const e=new Vector3,i=new Euler,A=new Quaternion,n=new Vector3(1,1,1);i._onChange(function(){A.setFromEuler(i,!1)}),A._onChange(function(){i.setFromQuaternion(A,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:i},quaternion:{configurable:!0,enumerable:!0,value:A},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new Matrix4},normalMatrix:{value:new Matrix3}}),this.matrix=new Matrix4,this.matrixWorld=new Matrix4,this.matrixAutoUpdate=t.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=t.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Layers,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(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return _q1.setFromAxisAngle(t,e),this.quaternion.multiply(_q1),this}rotateOnWorldAxis(t,e){return _q1.setFromAxisAngle(t,e),this.quaternion.premultiply(_q1),this}rotateX(t){return this.rotateOnAxis(_xAxis,t)}rotateY(t){return this.rotateOnAxis(_yAxis,t)}rotateZ(t){return this.rotateOnAxis(_zAxis,t)}translateOnAxis(t,e){return _v1$6.copy(t).applyQuaternion(this.quaternion),this.position.add(_v1$6.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(_xAxis,t)}translateY(t){return this.translateOnAxis(_yAxis,t)}translateZ(t){return this.translateOnAxis(_zAxis,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(_m1$1$3.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?_target$1.copy(t):_target$1.set(t,e,i);const A=this.parent;this.updateWorldMatrix(!0,!1),_position$4.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?_m1$1$3.lookAt(_position$4,_target$1,this.up):_m1$1$3.lookAt(_target$1,_position$4,this.up),this.quaternion.setFromRotationMatrix(_m1$1$3),A&&(_m1$1$3.extractRotation(A.matrixWorld),_q1.setFromRotationMatrix(_m1$1$3),this.quaternion.premultiply(_q1.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(error$1("Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(_addedEvent),_childaddedEvent.child=t,this.dispatchEvent(_childaddedEvent),_childaddedEvent.child=null):error$1("Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(_removedEvent),_childremovedEvent.child=t,this.dispatchEvent(_childremovedEvent),_childremovedEvent.child=null),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),_m1$1$3.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),_m1$1$3.multiply(t.parent.matrixWorld)),t.applyMatrix4(_m1$1$3),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(_addedEvent),_childaddedEvent.child=t,this.dispatchEvent(_childaddedEvent),_childaddedEvent.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,A=this.children.length;i<A;i++){const A=this.children[i].getObjectByProperty(t,e);if(void 0!==A)return A}}getObjectsByProperty(t,e,i=[]){this[t]===e&&i.push(this);const A=this.children;for(let n=0,r=A.length;n<r;n++)A[n].getObjectsByProperty(t,e,i);return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_position$4,t,_scale$3),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_position$4,_quaternion$3,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}intersectsFrustum(){}traverse(t){t(this);const e=this.children;for(let i=0,A=e.length;i<A;i++)e[i].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let i=0,A=e.length;i<A;i++)e[i].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const t=this.pivot;if(null!==t){const e=t.x,i=t.y,A=t.z,n=this.matrix.elements;n[12]+=e-n[0]*e-n[4]*i-n[8]*A,n[13]+=i-n[1]*e-n[5]*i-n[9]*A,n[14]+=A-n[2]*e-n[6]*i-n[10]*A}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let i=0,A=e.length;i<A;i++)e[i].updateMatrixWorld(t)}updateWorldMatrix(t,e,i=!1){const A=this.parent;if(!0===t&&null!==A&&A.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||i)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,i=!0),!0===e){const t=this.children;for(let e=0,A=t.length;e<A;e++)t[e].updateWorldMatrix(!1,!0,i)}}toJSON(t){const e=void 0===t||"string"==typeof t,i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const A={};function n(e,i){return void 0===e[i.uuid]&&(e[i.uuid]=i.toJSON(t)),i.uuid}if(A.uuid=this.uuid,A.type=this.type,A.name=this.name,A.castShadow=this.castShadow,A.receiveShadow=this.receiveShadow,A.visible=this.visible,A.frustumCulled=this.frustumCulled,A.renderOrder=this.renderOrder,A.static=this.static,A.matrixAutoUpdate=this.matrixAutoUpdate,Object.keys(this.userData).length>0&&(A.userData=this.userData),A.layers=this.layers.mask,A.matrix=this.matrix.toArray(),A.up=this.up.toArray(),null!==this.pivot&&(A.pivot=this.pivot.toArray()),void 0!==this.morphTargetDictionary&&(A.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),void 0!==this.morphTargetInfluences&&(A.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(A.type="InstancedMesh",A.count=this.count,A.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(A.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(A.type="BatchedMesh",A.perObjectFrustumCulled=this.perObjectFrustumCulled,A.sortObjects=this.sortObjects,A.drawRanges=this._drawRanges,A.reservedRanges=this._reservedRanges,A.geometryInfo=this._geometryInfo.map(t=>_objectSpread2(_objectSpread2({},t),{},{boundingBox:t.boundingBox?t.boundingBox.toJSON():void 0,boundingSphere:t.boundingSphere?t.boundingSphere.toJSON():void 0})),A.instanceInfo=this._instanceInfo.map(t=>_objectSpread2({},t)),A.availableInstanceIds=this._availableInstanceIds.slice(),A.availableGeometryIds=this._availableGeometryIds.slice(),A.nextIndexStart=this._nextIndexStart,A.nextVertexStart=this._nextVertexStart,A.geometryCount=this._geometryCount,A.maxInstanceCount=this._maxInstanceCount,A.maxVertexCount=this._maxVertexCount,A.maxIndexCount=this._maxIndexCount,A.geometryInitialized=this._geometryInitialized,A.matricesTexture=this._matricesTexture.toJSON(t),A.indirectTexture=this._indirectTexture.toJSON(t),null!==this._colorsTexture&&(A.colorsTexture=this._colorsTexture.toJSON(t)),null!==this.boundingSphere&&(A.boundingSphere=this.boundingSphere.toJSON()),null!==this.boundingBox&&(A.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?A.background=this.background.toJSON():this.background.isTexture&&(A.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(A.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){A.geometry=n(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const i=e.shapes;if(Array.isArray(i))for(let e=0,A=i.length;e<A;e++){const A=i[e];n(t.shapes,A)}else n(t.shapes,i)}}if(this.isSkinnedMesh&&(A.bindMode=this.bindMode,A.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(n(t.skeletons,this.skeleton),A.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let i=0,A=this.material.length;i<A;i++)e.push(n(t.materials,this.material[i]));A.material=e}else A.material=n(t.materials,this.material);if(this.children.length>0){A.children=[];for(let e=0;e<this.children.length;e++)A.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){A.animations=[];for(let e=0;e<this.animations.length;e++){const i=this.animations[e];A.animations.push(n(t.animations,i))}}if(e){const e=r(t.geometries),A=r(t.materials),n=r(t.textures),s=r(t.images),o=r(t.shapes),a=r(t.skeletons),l=r(t.animations),h=r(t.nodes);e.length>0&&(i.geometries=e),A.length>0&&(i.materials=A),n.length>0&&(i.textures=n),s.length>0&&(i.images=s),o.length>0&&(i.shapes=o),a.length>0&&(i.skeletons=a),l.length>0&&(i.animations=l),h.length>0&&(i.nodes=h)}return i.object=A,i;function r(t){const e=[];for(const i in t){const A=t[i];delete A.metadata,e.push(A)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.pivot=null!==t.pivot?t.pivot.clone():null,this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.static=t.static,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let i=0;i<t.children.length;i++){const e=t.children[i];this.add(e.clone())}return this}dispose(){this.dispatchEvent({type:"dispose"})}};Object3D.DEFAULT_UP=/*@__PURE__*/new Vector3(0,1,0),Object3D.DEFAULT_MATRIX_AUTO_UPDATE=!0,Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Group$1=class extends Object3D{constructor(){super(),this.isGroup=!0,this.type="Group"}},_moveEvent={type:"move"},WebXRController=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new Group$1,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new Group$1,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Vector3),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new Group$1,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Vector3,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const e=this._hand;if(e)for(const i of t.hand.values())this._getHandJoint(e,i)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,i){let A=null,n=null,r=null;const s=this._targetRay,o=this._grip,a=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(a&&t.hand){r=!0;for(const r of t.hand.values()){const t=e.getJointPose(r,i),A=this._getHandJoint(a,r);null!==t&&(A.matrix.fromArray(t.transform.matrix),A.matrix.decompose(A.position,A.rotation,A.scale),A.matrixWorldNeedsUpdate=!0,A.jointRadius=t.radius),A.visible=null!==t}const A=a.joints["index-finger-tip"],n=a.joints["thumb-tip"],s=A.position.distanceTo(n.position),o=.02,l=.005;a.inputState.pinching&&s>.025?(a.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!a.inputState.pinching&&s<=o-l&&(a.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&(n=e.getPose(t.gripSpace,i),null!==n&&(o.matrix.fromArray(n.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,n.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(n.linearVelocity)):o.hasLinearVelocity=!1,n.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(n.angularVelocity)):o.hasAngularVelocity=!1,o.eventsEnabled&&o.dispatchEvent({type:"gripUpdated",data:t,target:this})));null!==s&&(A=e.getPose(t.targetRaySpace,i),null===A&&null!==n&&(A=n),null!==A&&(s.matrix.fromArray(A.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,A.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(A.linearVelocity)):s.hasLinearVelocity=!1,A.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(A.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(_moveEvent)))}return null!==s&&(s.visible=null!==A),null!==o&&(o.visible=null!==n),null!==a&&(a.visible=null!==r),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){const i=new Group$1;i.matrixAutoUpdate=!1,i.visible=!1,t.joints[e.jointName]=i,t.add(i)}return t.joints[e.jointName]}},_colorKeywords={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},_hslA={h:0,s:0,l:0},_hslB={h:0,s:0,l:0};function hue2rgb(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}var Color$1=class{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){if(void 0===e&&void 0===i){const e=t;e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e)}else this.setRGB(t,e,i);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=SRGBColorSpace){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,ColorManagement.colorSpaceToWorking(this,e),this}setRGB(t,e,i,A=ColorManagement.workingColorSpace){return this.r=t,this.g=e,this.b=i,ColorManagement.colorSpaceToWorking(this,A),this}setHSL(t,e,i,A=ColorManagement.workingColorSpace){if(t=euclideanModulo(t,1),e=clamp$2(e,0,1),i=clamp$2(i,0,1),0===e)this.r=this.g=this.b=i;else{const A=i<=.5?i*(1+e):i+e-i*e,n=2*i-A;this.r=hue2rgb(n,A,t+1/3),this.g=hue2rgb(n,A,t),this.b=hue2rgb(n,A,t-1/3)}return ColorManagement.colorSpaceToWorking(this,A),this}setStyle(t,e=SRGBColorSpace){function i(e){void 0!==e&&parseFloat(e)<1&&warn("Color: Alpha component of "+t+" will be ignored.")}let A;if(A=/^(\w+)\(([^\)]*)\)/.exec(t)){let n;const r=A[1],s=A[2];switch(r){case"rgb":case"rgba":if(n=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(n[4]),this.setRGB(Math.min(255,parseInt(n[1],10))/255,Math.min(255,parseInt(n[2],10))/255,Math.min(255,parseInt(n[3],10))/255,e);if(n=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(n[4]),this.setRGB(Math.min(100,parseInt(n[1],10))/100,Math.min(100,parseInt(n[2],10))/100,Math.min(100,parseInt(n[3],10))/100,e);break;case"hsl":case"hsla":if(n=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(n[4]),this.setHSL(parseFloat(n[1])/360,parseFloat(n[2])/100,parseFloat(n[3])/100,e);break;default:warn("Color: Unknown color model "+t)}}else if(A=/^\#([A-Fa-f\d]+)$/.exec(t)){const i=A[1],n=i.length;if(3===n)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,e);if(6===n)return this.setHex(parseInt(i,16),e);warn("Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=SRGBColorSpace){const i=_colorKeywords[t.toLowerCase()];return void 0!==i?this.setHex(i,e):warn("Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=SRGBToLinear(t.r),this.g=SRGBToLinear(t.g),this.b=SRGBToLinear(t.b),this}copyLinearToSRGB(t){return this.r=LinearToSRGB(t.r),this.g=LinearToSRGB(t.g),this.b=LinearToSRGB(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=SRGBColorSpace){return ColorManagement.workingToColorSpace(_color.copy(this),t),65536*Math.round(clamp$2(255*_color.r,0,255))+256*Math.round(clamp$2(255*_color.g,0,255))+Math.round(clamp$2(255*_color.b,0,255))}getHexString(t=SRGBColorSpace){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=ColorManagement.workingColorSpace){ColorManagement.workingToColorSpace(_color.copy(this),e);const i=_color.r,A=_color.g,n=_color.b,r=Math.max(i,A,n),s=Math.min(i,A,n);let o,a;const l=(s+r)/2;if(s===r)o=0,a=0;else{const t=r-s;switch(a=l<=.5?t/(r+s):t/(2-r-s),r){case i:o=(A-n)/t+(A<n?6:0);break;case A:o=(n-i)/t+2;break;case n:o=(i-A)/t+4}o/=6}return t.h=o,t.s=a,t.l=l,t}getRGB(t,e=ColorManagement.workingColorSpace){return ColorManagement.workingToColorSpace(_color.copy(this),e),t.r=_color.r,t.g=_color.g,t.b=_color.b,t}getStyle(t=SRGBColorSpace){ColorManagement.workingToColorSpace(_color.copy(this),t);const e=_color.r,i=_color.g,A=_color.b;return"srgb"!==t?`color(${t} ${e.toFixed(3)} ${i.toFixed(3)} ${A.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*A)})`}offsetHSL(t,e,i){return this.getHSL(_hslA),this.setHSL(_hslA.h+t,_hslA.s+e,_hslA.l+i)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(_hslA),t.getHSL(_hslB);const i=lerp(_hslA.h,_hslB.h,e),A=lerp(_hslA.s,_hslB.s,e),n=lerp(_hslA.l,_hslB.l,e);return this.setHSL(i,A,n),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,i=this.g,A=this.b,n=t.elements;return this.r=n[0]*e+n[3]*i+n[6]*A,this.g=n[1]*e+n[4]*i+n[7]*A,this.b=n[2]*e+n[5]*i+n[8]*A,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},_color=/*@__PURE__*/new Color$1;Color$1.NAMES=_colorKeywords;var FogExp2=class t{constructor(t,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new Color$1(t),this.density=e}clone(){return new t(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}},Fog=class t{constructor(t,e=1,i=1e3){this.isFog=!0,this.name="",this.color=new Color$1(t),this.near=e,this.far=i}clone(){return new t(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}},Scene=class extends Object3D{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 Euler,this.environmentIntensity=1,this.environmentRotation=new Euler,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),e.object.backgroundBlurriness=this.backgroundBlurriness,e.object.backgroundIntensity=this.backgroundIntensity,e.object.backgroundRotation=this.backgroundRotation.toArray(),e.object.environmentIntensity=this.environmentIntensity,e.object.environmentRotation=this.environmentRotation.toArray(),e}},_v0$2=/*@__PURE__*/new Vector3,_v1$5=/*@__PURE__*/new Vector3,_v2$4=/*@__PURE__*/new Vector3,_v3$2=/*@__PURE__*/new Vector3,_vab=/*@__PURE__*/new Vector3,_vac=/*@__PURE__*/new Vector3,_vbc=/*@__PURE__*/new Vector3,_vap=/*@__PURE__*/new Vector3,_vbp=/*@__PURE__*/new Vector3,_vcp=/*@__PURE__*/new Vector3,_v40=/*@__PURE__*/new Vector4,_v41=/*@__PURE__*/new Vector4,_v42=/*@__PURE__*/new Vector4,Triangle=class t{constructor(t=new Vector3,e=new Vector3,i=new Vector3){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,A){A.subVectors(i,e),_v0$2.subVectors(t,e),A.cross(_v0$2);const n=A.lengthSq();return n>0?A.multiplyScalar(1/Math.sqrt(n)):A.set(0,0,0)}static getBarycoord(t,e,i,A,n){_v0$2.subVectors(A,e),_v1$5.subVectors(i,e),_v2$4.subVectors(t,e);const r=_v0$2.dot(_v0$2),s=_v0$2.dot(_v1$5),o=_v0$2.dot(_v2$4),a=_v1$5.dot(_v1$5),l=_v1$5.dot(_v2$4),h=r*a-s*s;if(0===h)return n.set(0,0,0),null;const g=1/h,c=(a*o-s*l)*g,d=(r*l-s*o)*g;return n.set(1-c-d,d,c)}static containsPoint(t,e,i,A){return null!==this.getBarycoord(t,e,i,A,_v3$2)&&(_v3$2.x>=0&&_v3$2.y>=0&&_v3$2.x+_v3$2.y<=1)}static getInterpolation(t,e,i,A,n,r,s,o){return null===this.getBarycoord(t,e,i,A,_v3$2)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(n,_v3$2.x),o.addScaledVector(r,_v3$2.y),o.addScaledVector(s,_v3$2.z),o)}static getInterpolatedAttribute(t,e,i,A,n,r){return _v40.setScalar(0),_v41.setScalar(0),_v42.setScalar(0),_v40.fromBufferAttribute(t,e),_v41.fromBufferAttribute(t,i),_v42.fromBufferAttribute(t,A),r.setScalar(0),r.addScaledVector(_v40,n.x),r.addScaledVector(_v41,n.y),r.addScaledVector(_v42,n.z),r}static isFrontFacing(t,e,i,A){return _v0$2.subVectors(i,e),_v1$5.subVectors(t,e),_v0$2.cross(_v1$5).dot(A)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,A){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[A]),this}setFromAttributeAndIndices(t,e,i,A){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,A),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return _v0$2.subVectors(this.c,this.b),_v1$5.subVectors(this.a,this.b),.5*_v0$2.cross(_v1$5).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return t.getNormal(this.a,this.b,this.c,e)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,i){return t.getBarycoord(e,this.a,this.b,this.c,i)}getInterpolation(e,i,A,n,r){return t.getInterpolation(e,this.a,this.b,this.c,i,A,n,r)}containsPoint(e){return t.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return t.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const i=this.a,A=this.b,n=this.c;let r,s;_vab.subVectors(A,i),_vac.subVectors(n,i),_vap.subVectors(t,i);const o=_vab.dot(_vap),a=_vac.dot(_vap);if(o<=0&&a<=0)return e.copy(i);_vbp.subVectors(t,A);const l=_vab.dot(_vbp),h=_vac.dot(_vbp);if(l>=0&&h<=l)return e.copy(A);const g=o*h-l*a;if(g<=0&&o>=0&&l<=0)return r=o/(o-l),e.copy(i).addScaledVector(_vab,r);_vcp.subVectors(t,n);const c=_vab.dot(_vcp),d=_vac.dot(_vcp);if(d>=0&&c<=d)return e.copy(n);const I=c*a-o*d;if(I<=0&&a>=0&&d<=0)return s=a/(a-d),e.copy(i).addScaledVector(_vac,s);const u=l*d-c*h;if(u<=0&&h-l>=0&&c-d>=0)return _vbc.subVectors(n,A),s=(h-l)/(h-l+(c-d)),e.copy(A).addScaledVector(_vbc,s);const p=1/(u+I+g);return r=I*p,s=g*p,e.copy(i).addScaledVector(_vab,r).addScaledVector(_vac,s)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},Box3=class{constructor(t=new Vector3(1/0,1/0,1/0),e=new Vector3(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e+=3)this.expandByPoint(_vector$b.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(_vector$b.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=_vector$b.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.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(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const i=t.geometry;if(void 0!==i){const A=i.getAttribute("position");if(!0===e&&void 0!==A&&!0!==t.isInstancedMesh)for(let e=0,i=A.count;e<i;e++)!0===t.isMesh?t.getVertexPosition(e,_vector$b):_vector$b.fromBufferAttribute(A,e),_vector$b.applyMatrix4(t.matrixWorld),this.expandByPoint(_vector$b);else void 0!==t.boundingBox?(null===t.boundingBox&&t.computeBoundingBox(),_box$4.copy(t.boundingBox)):(null===i.boundingBox&&i.computeBoundingBox(),_box$4.copy(i.boundingBox)),_box$4.applyMatrix4(t.matrixWorld),this.union(_box$4)}const A=t.children;for(let n=0,r=A.length;n<r;n++)this.expandByObject(A[n],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,_vector$b),_vector$b.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(_center),_extents.subVectors(this.max,_center),_v0$1$1.subVectors(t.a,_center),_v1$4.subVectors(t.b,_center),_v2$3.subVectors(t.c,_center),_f0.subVectors(_v1$4,_v0$1$1),_f1.subVectors(_v2$3,_v1$4),_f2.subVectors(_v0$1$1,_v2$3);let e=[0,-_f0.z,_f0.y,0,-_f1.z,_f1.y,0,-_f2.z,_f2.y,_f0.z,0,-_f0.x,_f1.z,0,-_f1.x,_f2.z,0,-_f2.x,-_f0.y,_f0.x,0,-_f1.y,_f1.x,0,-_f2.y,_f2.x,0];return!!satForAxes(e,_v0$1$1,_v1$4,_v2$3,_extents)&&(e=[1,0,0,0,1,0,0,0,1],!!satForAxes(e,_v0$1$1,_v1$4,_v2$3,_extents)&&(_triangleNormal$1.crossVectors(_f0,_f1),e=[_triangleNormal$1.x,_triangleNormal$1.y,_triangleNormal$1.z],satForAxes(e,_v0$1$1,_v1$4,_v2$3,_extents)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,_vector$b).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(_vector$b).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(_points[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),_points[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),_points[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),_points[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),_points[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),_points[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),_points[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),_points[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(_points)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}},_points=[
|
|
1
|
+
import{a as _objectSpread2,i as _asyncToGenerator,n as sha256,r as bytesToHex,t as e}from"./resource-url-MTT03G1N.js";import{WorkerPool,makePromiseCreator}from"esus-lite";var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__commonJSMin=(t,e)=>()=>(e||(t((e={exports:{}}).exports,e),t=null),e.exports),__exportAll=(t,e)=>{let i={};for(var A in t)__defProp(i,A,{get:t[A],enumerable:!0});return e||__defProp(i,Symbol.toStringTag,{value:"Module"}),i},__copyProps=(t,e,i,A)=>{if(e&&"object"==typeof e||"function"==typeof e)for(var n,r=__getOwnPropNames(e),s=0,o=r.length;s<o;s++)n=r[s],__hasOwnProp.call(t,n)||n===i||__defProp(t,n,{get:(t=>e[t]).bind(null,n),enumerable:!(A=__getOwnPropDesc(e,n))||A.enumerable});return t},__toESM=(t,e,i)=>(i=null!=t?__create(__getProtoOf(t)):{},__copyProps(!e&&t&&t.__esModule?i:__defProp(i,"default",{value:t,enumerable:!0}),t)),_Vector,_Vector2,_Matrix,_Vector3,_Matrix2,_Matrix3,_Symbol$iterator,_Symbol$iterator2,_Symbol$iterator3,REVISION="186",MOUSE={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},TOUCH={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},FrontSide=0,BackSide=1,NormalBlending=1,AddEquation=100,SrcAlphaFactor=204,OneMinusSrcAlphaFactor=205,NeverDepth=0,AlwaysDepth=1,LessDepth=2,LessEqualDepth=3,EqualDepth=4,GreaterEqualDepth=5,GreaterDepth=6,NotEqualDepth=7,MultiplyOperation=0,AttachedBindMode="attached",DetachedBindMode="detached",UVMapping=300,CubeReflectionMapping=301,CubeRefractionMapping=302,EquirectangularReflectionMapping=303,EquirectangularRefractionMapping=304,CubeUVReflectionMapping=306,RepeatWrapping=1e3,ClampToEdgeWrapping=1001,MirroredRepeatWrapping=1002,NearestFilter=1003,NearestMipmapNearestFilter=1004,NearestMipMapNearestFilter=1004,NearestMipmapLinearFilter=1005,NearestMipMapLinearFilter=1005,LinearFilter=1006,LinearMipmapNearestFilter=1007,LinearMipMapNearestFilter=1007,LinearMipmapLinearFilter=1008,LinearMipMapLinearFilter=1008,UnsignedByteType=1009,ByteType=1010,ShortType=1011,UnsignedShortType=1012,IntType=1013,UnsignedIntType=1014,FloatType=1015,HalfFloatType=1016,UnsignedShort4444Type=1017,UnsignedShort5551Type=1018,UnsignedInt248Type=1020,UnsignedInt5999Type=35902,UnsignedInt101111Type=35899,AlphaFormat=1021,RGBFormat=1022,RGBAFormat=1023,DepthFormat=1026,DepthStencilFormat=1027,RedFormat=1028,RedIntegerFormat=1029,RGFormat=1030,RGIntegerFormat=1031,RGBIntegerFormat=1032,RGBAIntegerFormat=1033,RGB_S3TC_DXT1_Format=33776,RGBA_S3TC_DXT1_Format=33777,RGBA_S3TC_DXT3_Format=33778,RGBA_S3TC_DXT5_Format=33779,RGB_PVRTC_4BPPV1_Format=35840,RGB_PVRTC_2BPPV1_Format=35841,RGBA_PVRTC_4BPPV1_Format=35842,RGBA_PVRTC_2BPPV1_Format=35843,RGB_ETC1_Format=36196,RGB_ETC2_Format=37492,RGBA_ETC2_EAC_Format=37496,R11_EAC_Format=37488,SIGNED_R11_EAC_Format=37489,RG11_EAC_Format=37490,SIGNED_RG11_EAC_Format=37491,RGBA_ASTC_4x4_Format=37808,RGBA_ASTC_5x4_Format=37809,RGBA_ASTC_5x5_Format=37810,RGBA_ASTC_6x5_Format=37811,RGBA_ASTC_6x6_Format=37812,RGBA_ASTC_8x5_Format=37813,RGBA_ASTC_8x6_Format=37814,RGBA_ASTC_8x8_Format=37815,RGBA_ASTC_10x5_Format=37816,RGBA_ASTC_10x6_Format=37817,RGBA_ASTC_10x8_Format=37818,RGBA_ASTC_10x10_Format=37819,RGBA_ASTC_12x10_Format=37820,RGBA_ASTC_12x12_Format=37821,RGBA_BPTC_Format=36492,RGB_BPTC_SIGNED_Format=36494,RGB_BPTC_UNSIGNED_Format=36495,RED_RGTC1_Format=36283,SIGNED_RED_RGTC1_Format=36284,RED_GREEN_RGTC2_Format=36285,SIGNED_RED_GREEN_RGTC2_Format=36286,LoopOnce=2200,LoopRepeat=2201,LoopPingPong=2202,InterpolateDiscrete=2300,InterpolateLinear=2301,InterpolateSmooth=2302,InterpolateBezier=2303,ZeroCurvatureEnding=2400,ZeroSlopeEnding=2401,WrapAroundEnding=2402,NormalAnimationBlendMode=2500,AdditiveAnimationBlendMode=2501,BasicDepthPacking=3200,RGBADepthPacking=3201,RGBDepthPacking=3202,RGDepthPacking=3203,TangentSpaceNormalMap=0,NoColorSpace="",SRGBColorSpace="srgb",LinearSRGBColorSpace="srgb-linear",LinearTransfer="linear",SRGBTransfer="srgb",KeepStencilOp=7680,ReplaceStencilOp=7681,IncrementStencilOp=7682,DecrementStencilOp=7683,IncrementWrapStencilOp=34055,DecrementWrapStencilOp=34056,InvertStencilOp=5386,AlwaysStencilFunc=519,StaticDrawUsage=35044,DynamicDrawUsage=35048,StreamDrawUsage=35040,StaticReadUsage=35045,DynamicReadUsage=35049,StreamReadUsage=35041,StaticCopyUsage=35046,DynamicCopyUsage=35050,StreamCopyUsage=35042,GLSL3="300 es",WebGLCoordinateSystem=2e3,WebGPUCoordinateSystem=2001,TimestampQuery={COMPUTE:"compute",RENDER:"render"},InterpolationSamplingType={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},InterpolationSamplingMode={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},Compatibility={TEXTURE_COMPARE:"depthTextureCompare"},RenderObjectRefreshType={NONE:0,SHARED:1,FULL:2};function arrayNeedsUint32(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}var TYPED_ARRAYS={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function getTypedArray(t,e){return new TYPED_ARRAYS[t](e)}function isTypedArray(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function createElementNS(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function createCanvasElement(){const t=createElementNS("canvas");return t.style.display="block",t}var _cache$2={},_setConsoleFunction=null;function setConsoleFunction(t){_setConsoleFunction=t}function getConsoleFunction(){return _setConsoleFunction}function log$3(...t){const e="THREE."+t.shift();_setConsoleFunction?_setConsoleFunction("log",e,...t):console.log(e,...t)}function enhanceLogMessage(t){const e=t[0];if("string"==typeof e&&e.startsWith("TSL:")){const e=t[1];e&&e.isStackTrace?t[0]+=" "+e.getLocation():t[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return t}function warn(...t){const e="THREE."+(t=enhanceLogMessage(t)).shift();if(_setConsoleFunction)_setConsoleFunction("warn",e,...t);else{const i=t[0];i&&i.isStackTrace?console.warn(i.getError(e)):console.warn(e,...t)}}function error$1(...t){const e="THREE."+(t=enhanceLogMessage(t)).shift();if(_setConsoleFunction)_setConsoleFunction("error",e,...t);else{const i=t[0];i&&i.isStackTrace?console.error(i.getError(e)):console.error(e,...t)}}function warnOnce(...t){const e=t.join(" ");e in _cache$2||(_cache$2[e]=!0,warn(...t))}function yieldToMain(){return"undefined"!=typeof self&&void 0!==self.scheduler&&void 0!==self.scheduler.yield?self.scheduler.yield():new Promise(t=>{requestAnimationFrame(t)})}function probeAsync(t,e,i){return new Promise(function(A,n){setTimeout(function r(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:n();break;case t.TIMEOUT_EXPIRED:setTimeout(r,i);break;default:A()}},i)})}var ReversedDepthFuncs={0:1,2:6,4:7,3:5,1:0,6:2,7:4,5:3},EventDispatcher=class{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){const i=this._listeners;return void 0!==i&&(void 0!==i[t]&&-1!==i[t].indexOf(e))}removeEventListener(t,e){const i=this._listeners;if(void 0===i)return;const A=i[t];if(void 0!==A){const t=A.indexOf(e);-1!==t&&A.splice(t,1)}}dispatchEvent(t){const e=this._listeners;if(void 0===e)return;const i=e[t.type];if(void 0!==i){t.target=this;const e=i.slice(0);for(let i=0,A=e.length;i<A;i++)e[i].call(this,t);t.target=null}}},_lut=["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"],_seed=1234567,DEG2RAD=Math.PI/180,RAD2DEG=180/Math.PI;function generateUUID(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,A=4294967295*Math.random()|0;return(_lut[255&t]+_lut[t>>8&255]+_lut[t>>16&255]+_lut[t>>24&255]+"-"+_lut[255&e]+_lut[e>>8&255]+"-"+_lut[e>>16&15|64]+_lut[e>>24&255]+"-"+_lut[63&i|128]+_lut[i>>8&255]+"-"+_lut[i>>16&255]+_lut[i>>24&255]+_lut[255&A]+_lut[A>>8&255]+_lut[A>>16&255]+_lut[A>>24&255]).toLowerCase()}function clamp$2(t,e,i){return Math.max(e,Math.min(i,t))}function euclideanModulo(t,e){return(t%e+e)%e}function mapLinear(t,e,i,A,n){return A+(t-e)*(n-A)/(i-e)}function inverseLerp(t,e,i){return t!==e?(i-t)/(e-t):0}function lerp(t,e,i){return(1-i)*t+i*e}function damp(t,e,i,A){return lerp(t,e,1-Math.exp(-i*A))}function pingpong(t,e=1){return e-Math.abs(euclideanModulo(t,2*e)-e)}function smoothstep$2(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)}function smootherstep(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)}function randInt(t,e){return t+Math.floor(Math.random()*(e-t+1))}function randFloat(t,e){return t+Math.random()*(e-t)}function randFloatSpread(t){return t*(.5-Math.random())}function seededRandom(t){void 0!==t&&(_seed=t);let e=_seed+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}function degToRad(t){return t*DEG2RAD}function radToDeg(t){return t*RAD2DEG}function isPowerOfTwo(t){return t>0&&Number.isInteger(t)&&Math.pow(2,Math.round(Math.log2(t)))===t}function ceilPowerOfTwo(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function floorPowerOfTwo(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function setQuaternionFromProperEuler(t,e,i,A,n){const r=Math.cos,s=Math.sin,o=r(i/2),a=s(i/2),l=r((e+A)/2),h=s((e+A)/2),g=r((e-A)/2),c=s((e-A)/2),d=r((A-e)/2),I=s((A-e)/2);switch(n){case"XYX":t.set(o*h,a*g,a*c,o*l);break;case"YZY":t.set(a*c,o*h,a*g,o*l);break;case"ZXZ":t.set(a*g,a*c,o*h,o*l);break;case"XZX":t.set(o*h,a*I,a*d,o*l);break;case"YXY":t.set(a*d,o*h,a*I,o*l);break;case"ZYZ":t.set(a*I,a*d,o*h,o*l);break;default:warn("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+n)}}function denormalize(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:case Uint8ClampedArray:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function normalize$3(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:case Uint8ClampedArray:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("THREE.MathUtils: Invalid component type.")}}var MathUtils={DEG2RAD:DEG2RAD,RAD2DEG:RAD2DEG,generateUUID:generateUUID,clamp:clamp$2,euclideanModulo:euclideanModulo,mapLinear:mapLinear,inverseLerp:inverseLerp,lerp:lerp,damp:damp,pingpong:pingpong,smoothstep:smoothstep$2,smootherstep:smootherstep,randInt:randInt,randFloat:randFloat,randFloatSpread:randFloatSpread,seededRandom:seededRandom,degToRad:degToRad,radToDeg:radToDeg,isPowerOfTwo:isPowerOfTwo,ceilPowerOfTwo:ceilPowerOfTwo,floorPowerOfTwo:floorPowerOfTwo,setQuaternionFromProperEuler:setQuaternionFromProperEuler,normalize:normalize$3,denormalize:denormalize};_Symbol$iterator=Symbol.iterator;var Vector2=class{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("THREE.Vector2: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,i=this.y,A=t.elements;return this.x=A[0]*e+A[3]*i+A[6],this.y=A[1]*e+A[4]*i+A[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=clamp$2(this.x,t.x,e.x),this.y=clamp$2(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=clamp$2(this.x,t,e),this.y=clamp$2(this.y,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(clamp$2(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(clamp$2(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const i=Math.cos(e),A=Math.sin(e),n=this.x-t.x,r=this.y-t.y;return this.x=n*i-r*A+t.x,this.y=n*A+r*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[_Symbol$iterator](){yield this.x,yield this.y}};_Vector=Vector2,_Vector.prototype.isVector2=!0;var Quaternion=class{constructor(t=0,e=0,i=0,A=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=A}static slerpFlat(t,e,i,A,n,r,s){let o=i[A+0],a=i[A+1],l=i[A+2],h=i[A+3],g=n[r+0],c=n[r+1],d=n[r+2],I=n[r+3];if(h!==I||o!==g||a!==c||l!==d){let t=o*g+a*c+l*d+h*I;t<0&&(g=-g,c=-c,d=-d,I=-I,t=-t);let e=1-s;if(t<.9995){const i=Math.acos(t),A=Math.sin(i);e=Math.sin(e*i)/A,o=o*e+g*(s=Math.sin(s*i)/A),a=a*e+c*s,l=l*e+d*s,h=h*e+I*s}else{o=o*e+g*s,a=a*e+c*s,l=l*e+d*s,h=h*e+I*s;const t=1/Math.sqrt(o*o+a*a+l*l+h*h);o*=t,a*=t,l*=t,h*=t}}t[e]=o,t[e+1]=a,t[e+2]=l,t[e+3]=h}static multiplyQuaternionsFlat(t,e,i,A,n,r){const s=i[A],o=i[A+1],a=i[A+2],l=i[A+3],h=n[r],g=n[r+1],c=n[r+2],d=n[r+3];return t[e]=s*d+l*h+o*c-a*g,t[e+1]=o*d+l*g+a*h-s*c,t[e+2]=a*d+l*c+s*g-o*h,t[e+3]=l*d-s*h-o*g-a*c,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,A){return this._x=t,this._y=e,this._z=i,this._w=A,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const i=t._x,A=t._y,n=t._z,r=t._order,s=Math.cos,o=Math.sin,a=s(i/2),l=s(A/2),h=s(n/2),g=o(i/2),c=o(A/2),d=o(n/2);switch(r){case"XYZ":this._x=g*l*h+a*c*d,this._y=a*c*h-g*l*d,this._z=a*l*d+g*c*h,this._w=a*l*h-g*c*d;break;case"YXZ":this._x=g*l*h+a*c*d,this._y=a*c*h-g*l*d,this._z=a*l*d-g*c*h,this._w=a*l*h+g*c*d;break;case"ZXY":this._x=g*l*h-a*c*d,this._y=a*c*h+g*l*d,this._z=a*l*d+g*c*h,this._w=a*l*h-g*c*d;break;case"ZYX":this._x=g*l*h-a*c*d,this._y=a*c*h+g*l*d,this._z=a*l*d-g*c*h,this._w=a*l*h+g*c*d;break;case"YZX":this._x=g*l*h+a*c*d,this._y=a*c*h+g*l*d,this._z=a*l*d-g*c*h,this._w=a*l*h-g*c*d;break;case"XZY":this._x=g*l*h-a*c*d,this._y=a*c*h-g*l*d,this._z=a*l*d+g*c*h,this._w=a*l*h+g*c*d;break;default:warn("Quaternion: .setFromEuler() encountered an unknown order: "+r)}return!0===e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,A=Math.sin(i);return this._x=t.x*A,this._y=t.y*A,this._z=t.z*A,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],A=e[4],n=e[8],r=e[1],s=e[5],o=e[9],a=e[2],l=e[6],h=e[10],g=i+s+h;if(g>0){const t=.5/Math.sqrt(g+1);this._w=.25/t,this._x=(l-o)*t,this._y=(n-a)*t,this._z=(r-A)*t}else if(i>s&&i>h){const t=2*Math.sqrt(1+i-s-h);this._w=(l-o)/t,this._x=.25*t,this._y=(A+r)/t,this._z=(n+a)/t}else if(s>h){const t=2*Math.sqrt(1+s-i-h);this._w=(n-a)/t,this._x=(A+r)/t,this._y=.25*t,this._z=(o+l)/t}else{const t=2*Math.sqrt(1+h-i-s);this._w=(r-A)/t,this._x=(n+a)/t,this._y=(o+l)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<1e-8?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(clamp$2(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(0===i)return this;const A=Math.min(1,e/i);return this.slerp(t,A),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,A=t._y,n=t._z,r=t._w,s=e._x,o=e._y,a=e._z,l=e._w;return this._x=i*l+r*s+A*a-n*o,this._y=A*l+r*o+n*s-i*a,this._z=n*l+r*a+i*o-A*s,this._w=r*l-i*s-A*o-n*a,this._onChangeCallback(),this}slerp(t,e){let i=t._x,A=t._y,n=t._z,r=t._w,s=this.dot(t);s<0&&(i=-i,A=-A,n=-n,r=-r,s=-s);let o=1-e;if(s<.9995){const t=Math.acos(s),a=Math.sin(t);o=Math.sin(o*t)/a,e=Math.sin(e*t)/a,this._x=this._x*o+i*e,this._y=this._y*o+A*e,this._z=this._z*o+n*e,this._w=this._w*o+r*e,this._onChangeCallback()}else this._x=this._x*o+i*e,this._y=this._y*o+A*e,this._z=this._z*o+n*e,this._w=this._w*o+r*e,this.normalize();return this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),A=Math.sqrt(1-i),n=Math.sqrt(i);return this.set(A*Math.sin(t),A*Math.cos(t),n*Math.sin(e),n*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}};_Symbol$iterator2=Symbol.iterator;var Vector3=class{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("THREE.Vector3: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(_quaternion$5.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(_quaternion$5.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,A=this.z,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6]*A,this.y=n[1]*e+n[4]*i+n[7]*A,this.z=n[2]*e+n[5]*i+n[8]*A,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,A=this.z,n=t.elements,r=1/(n[3]*e+n[7]*i+n[11]*A+n[15]);return this.x=(n[0]*e+n[4]*i+n[8]*A+n[12])*r,this.y=(n[1]*e+n[5]*i+n[9]*A+n[13])*r,this.z=(n[2]*e+n[6]*i+n[10]*A+n[14])*r,this}applyQuaternion(t){const e=this.x,i=this.y,A=this.z,n=t.x,r=t.y,s=t.z,o=t.w,a=2*(r*A-s*i),l=2*(s*e-n*A),h=2*(n*i-r*e);return this.x=e+o*a+r*h-s*l,this.y=i+o*l+s*a-n*h,this.z=A+o*h+n*l-r*a,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,i=this.y,A=this.z,n=t.elements;return this.x=n[0]*e+n[4]*i+n[8]*A,this.y=n[1]*e+n[5]*i+n[9]*A,this.z=n[2]*e+n[6]*i+n[10]*A,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=clamp$2(this.x,t.x,e.x),this.y=clamp$2(this.y,t.y,e.y),this.z=clamp$2(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=clamp$2(this.x,t,e),this.y=clamp$2(this.y,t,e),this.z=clamp$2(this.z,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(clamp$2(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,A=t.y,n=t.z,r=e.x,s=e.y,o=e.z;return this.x=A*o-n*s,this.y=n*r-i*o,this.z=i*s-A*r,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return _vector$c.copy(this).projectOnVector(t),this.sub(_vector$c)}reflect(t){return this.sub(_vector$c.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(clamp$2(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,A=this.z-t.z;return e*e+i*i+A*A}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){const A=Math.sin(e)*t;return this.x=A*Math.sin(i),this.y=Math.cos(e)*t,this.z=A*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),A=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=A,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=2*Math.random()-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[_Symbol$iterator2](){yield this.x,yield this.y,yield this.z}};_Vector2=Vector3,_Vector2.prototype.isVector3=!0;var _vector$c=/*@__PURE__*/new Vector3,_quaternion$5=/*@__PURE__*/new Quaternion,Matrix3=class{constructor(t,e,i,A,n,r,s,o,a){this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,i,A,n,r,s,o,a)}set(t,e,i,A,n,r,s,o,a){const l=this.elements;return l[0]=t,l[1]=A,l[2]=s,l[3]=e,l[4]=n,l[5]=o,l[6]=i,l[7]=r,l[8]=a,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,A=e.elements,n=this.elements,r=i[0],s=i[3],o=i[6],a=i[1],l=i[4],h=i[7],g=i[2],c=i[5],d=i[8],I=A[0],u=A[3],p=A[6],C=A[1],m=A[4],y=A[7],E=A[2],f=A[5],M=A[8];return n[0]=r*I+s*C+o*E,n[3]=r*u+s*m+o*f,n[6]=r*p+s*y+o*M,n[1]=a*I+l*C+h*E,n[4]=a*u+l*m+h*f,n[7]=a*p+l*y+h*M,n[2]=g*I+c*C+d*E,n[5]=g*u+c*m+d*f,n[8]=g*p+c*y+d*M,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],A=t[2],n=t[3],r=t[4],s=t[5],o=t[6],a=t[7],l=t[8];return e*r*l-e*s*a-i*n*l+i*s*o+A*n*a-A*r*o}invert(){const t=this.elements,e=t[0],i=t[1],A=t[2],n=t[3],r=t[4],s=t[5],o=t[6],a=t[7],l=t[8],h=l*r-s*a,g=s*o-l*n,c=a*n-r*o,d=e*h+i*g+A*c;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);const I=1/d;return t[0]=h*I,t[1]=(A*a-l*i)*I,t[2]=(s*i-A*r)*I,t[3]=g*I,t[4]=(l*e-A*o)*I,t[5]=(A*n-s*e)*I,t[6]=c*I,t[7]=(i*o-a*e)*I,t[8]=(r*e-i*n)*I,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,A,n,r,s){const o=Math.cos(n),a=Math.sin(n);return this.set(i*o,i*a,-i*(o*r+a*s)+r+t,-A*a,A*o,-A*(-a*r+o*s)+s+e,0,0,1),this}scale(t,e){return warnOnce("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(_m3.makeScale(t,e)),this}rotate(t){return warnOnce("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(_m3.makeRotation(-t)),this}translate(t,e){return warnOnce("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(_m3.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,i=t.elements;for(let A=0;A<9;A++)if(e[A]!==i[A])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return(new this.constructor).fromArray(this.elements)}};_Matrix=Matrix3,_Matrix.prototype.isMatrix3=!0;var _m3=/*@__PURE__*/new Matrix3,LINEAR_REC709_TO_XYZ=/*@__PURE__*/(new Matrix3).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),XYZ_TO_LINEAR_REC709=/*@__PURE__*/(new Matrix3).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function createColorManagement(){const t={enabled:!0,workingColorSpace:LinearSRGBColorSpace,spaces:{},convert:function(t,e,i){return!1!==this.enabled&&e!==i&&e&&i?("srgb"===this.spaces[e].transfer&&(t.r=SRGBToLinear(t.r),t.g=SRGBToLinear(t.g),t.b=SRGBToLinear(t.b)),this.spaces[e].primaries!==this.spaces[i].primaries&&(t.applyMatrix3(this.spaces[e].toXYZ),t.applyMatrix3(this.spaces[i].fromXYZ)),"srgb"===this.spaces[i].transfer&&(t.r=LinearToSRGB(t.r),t.g=LinearToSRGB(t.g),t.b=LinearToSRGB(t.b)),t):t},workingToColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},colorSpaceToWorking:function(t,e){return this.convert(t,e,this.workingColorSpace)},getPrimaries:function(t){return this.spaces[t].primaries},getTransfer:function(t){return""===t?LinearTransfer:this.spaces[t].transfer},getToneMappingMode:function(t){return this.spaces[t].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(t,e=this.workingColorSpace){return t.fromArray(this.spaces[e].luminanceCoefficients)},define:function(t){Object.assign(this.spaces,t)},_getMatrix:function(t,e,i){return t.copy(this.spaces[e].toXYZ).multiply(this.spaces[i].fromXYZ)},_getDrawingBufferColorSpace:function(t){return this.spaces[t].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(t=this.workingColorSpace){return this.spaces[t].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(e,i){return warnOnce("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(e,i)},toWorkingColorSpace:function(e,i){return warnOnce("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),t.colorSpaceToWorking(e,i)}},e=[.64,.33,.3,.6,.15,.06],i=[.2126,.7152,.0722],A=[.3127,.329];return t.define({[LinearSRGBColorSpace]:{primaries:e,whitePoint:A,transfer:LinearTransfer,toXYZ:LINEAR_REC709_TO_XYZ,fromXYZ:XYZ_TO_LINEAR_REC709,luminanceCoefficients:i,workingColorSpaceConfig:{unpackColorSpace:SRGBColorSpace},outputColorSpaceConfig:{drawingBufferColorSpace:SRGBColorSpace}},[SRGBColorSpace]:{primaries:e,whitePoint:A,transfer:SRGBTransfer,toXYZ:LINEAR_REC709_TO_XYZ,fromXYZ:XYZ_TO_LINEAR_REC709,luminanceCoefficients:i,outputColorSpaceConfig:{drawingBufferColorSpace:SRGBColorSpace}}}),t}var ColorManagement=/*@__PURE__*/createColorManagement(),_canvas;function SRGBToLinear(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function LinearToSRGB(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}var ImageUtils=class{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let i;if(t instanceof HTMLCanvasElement)i=t;else{void 0===_canvas&&(_canvas=createElementNS("canvas")),_canvas.width=t.width,_canvas.height=t.height;const e=_canvas.getContext("2d");t instanceof ImageData?e.putImageData(t,0,0):e.drawImage(t,0,0,t.width,t.height),i=_canvas}return i.toDataURL(e)}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=createElementNS("canvas");e.width=t.width,e.height=t.height;const i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);const A=i.getImageData(0,0,t.width,t.height),n=A.data;for(let t=0;t<n.length;t++)n[t]=255*SRGBToLinear(n[t]/255);return i.putImageData(A,0,0),e}if(t.data){const e=t.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(255*SRGBToLinear(e[t]/255)):e[t]=SRGBToLinear(e[t]);return{data:e,width:t.width,height:t.height}}return warn("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}},_sourceId=0,TextureSource=class{constructor(t=null){this.isTextureSource=!0,Object.defineProperty(this,"id",{value:_sourceId++}),this.uuid=generateUUID(),this.data=t,this.dataReady=!0,this.version=0}getSize(t){const e=this.data;return"undefined"!=typeof HTMLVideoElement&&e instanceof HTMLVideoElement?t.set(e.videoWidth,e.videoHeight,0):"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?t.set(e.displayWidth,e.displayHeight,0):null!==e?t.set(e.width,e.height,e.depth||0):t.set(0,0,0),t}set needsUpdate(t){!0===t&&this.version++}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];const i={uuid:this.uuid,url:""},A=this.data;if(null!==A){let t;if(Array.isArray(A)){t=[];for(let e=0,i=A.length;e<i;e++)A[e].isDataTexture?t.push(serializeImage(A[e].image)):t.push(serializeImage(A[e]))}else t=serializeImage(A);i.url=t}return e||(t.images[this.uuid]=i),i}};function serializeImage(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?ImageUtils.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(warn("Texture: Unable to serialize Texture."),{})}var Source=class extends TextureSource{constructor(t=null){warnOnce('Source: "Source" has been renamed to "TextureSource". Please update your code to use "THREE.TextureSource" instead.'),super(t),this.isSource=!0}},_textureId=0,_tempVec3=/*@__PURE__*/new Vector3,Texture=class t extends EventDispatcher{constructor(e=t.DEFAULT_IMAGE,i=t.DEFAULT_MAPPING,A=ClampToEdgeWrapping,n=ClampToEdgeWrapping,r=LinearFilter,s=LinearMipmapLinearFilter,o=RGBAFormat,a=UnsignedByteType,l=t.DEFAULT_ANISOTROPY,h=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:_textureId++}),this.uuid=generateUUID(),this.name="",this.source=new TextureSource(e),this.mipmaps=[],this.mapping=i,this.channel=0,this.wrapS=A,this.wrapT=n,this.magFilter=r,this.minFilter=s,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=a,this.offset=new Vector2(0,0),this.repeat=new Vector2(1,1),this.center=new Vector2(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Matrix3,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(_tempVec3).x}get height(){return this.source.getSize(_tempVec3).y}get depth(){return this.source.getSize(_tempVec3).z}get image(){return this.source.data}set image(t){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.normalized=t.normalized,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(const e in t){const i=t[e];if(void 0===i){warn(`Texture.setValues(): parameter '${e}' has value of undefined.`);continue}const A=this[e];void 0!==A?A&&i&&A.isVector2&&i.isVector2||A&&i&&A.isVector3&&i.isVector3||A&&i&&A.isMatrix3&&i.isMatrix3?A.copy(i):this[e]=i:warn(`Texture.setValues(): property '${e}' does not exist.`)}}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case RepeatWrapping:t.x=t.x-Math.floor(t.x);break;case ClampToEdgeWrapping:t.x=t.x<0?0:1;break;case MirroredRepeatWrapping:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case RepeatWrapping:t.y=t.y-Math.floor(t.y);break;case ClampToEdgeWrapping:t.y=t.y<0?0:1;break;case MirroredRepeatWrapping:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}};Texture.DEFAULT_IMAGE=null,Texture.DEFAULT_MAPPING=300,Texture.DEFAULT_ANISOTROPY=1,_Symbol$iterator3=Symbol.iterator;var Vector4=class{constructor(t=0,e=0,i=0,A=1){this.x=t,this.y=e,this.z=i,this.w=A}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,A){return this.x=t,this.y=e,this.z=i,this.w=A,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("THREE.Vector4: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,i=this.y,A=this.z,n=this.w,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*A+r[12]*n,this.y=r[1]*e+r[5]*i+r[9]*A+r[13]*n,this.z=r[2]*e+r[6]*i+r[10]*A+r[14]*n,this.w=r[3]*e+r[7]*i+r[11]*A+r[15]*n,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,A,n;const r=.01,s=.1,o=t.elements,a=o[0],l=o[4],h=o[8],g=o[1],c=o[5],d=o[9],I=o[2],u=o[6],p=o[10];if(Math.abs(l-g)<r&&Math.abs(h-I)<r&&Math.abs(d-u)<r){if(Math.abs(l+g)<s&&Math.abs(h+I)<s&&Math.abs(d+u)<s&&Math.abs(a+c+p-3)<s)return this.set(1,0,0,0),this;e=Math.PI;const t=(a+1)/2,o=(c+1)/2,C=(p+1)/2,m=(l+g)/4,y=(h+I)/4,E=(d+u)/4;return t>o&&t>C?t<r?(i=0,A=.707106781,n=.707106781):(i=Math.sqrt(t),A=m/i,n=y/i):o>C?o<r?(i=.707106781,A=0,n=.707106781):(A=Math.sqrt(o),i=m/A,n=E/A):C<r?(i=.707106781,A=.707106781,n=0):(n=Math.sqrt(C),i=y/n,A=E/n),this.set(i,A,n,e),this}let C=Math.sqrt((u-d)*(u-d)+(h-I)*(h-I)+(g-l)*(g-l));return Math.abs(C)<.001&&(C=1),this.x=(u-d)/C,this.y=(h-I)/C,this.z=(g-l)/C,this.w=Math.acos((a+c+p-1)/2),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=clamp$2(this.x,t.x,e.x),this.y=clamp$2(this.y,t.y,e.y),this.z=clamp$2(this.z,t.z,e.z),this.w=clamp$2(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=clamp$2(this.x,t,e),this.y=clamp$2(this.y,t,e),this.z=clamp$2(this.z,t,e),this.w=clamp$2(this.w,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(clamp$2(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[_Symbol$iterator3](){yield this.x,yield this.y,yield this.z,yield this.w}};_Vector3=Vector4,_Vector3.prototype.isVector4=!0;var RenderTarget=class extends EventDispatcher{constructor(t=1,e=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:LinearFilter,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},i),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=i.depth,this.scissor=new Vector4(0,0,t,e),this.scissorTest=!1,this.viewport=new Vector4(0,0,t,e),this.textures=[];const A=new Texture({width:t,height:e,depth:i.depth}),n=i.count;for(let r=0;r<n;r++)this.textures[r]=A.clone(),this.textures[r].isRenderTargetTexture=!0,this.textures[r].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveColorBuffer=i.resolveColorBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this.storeMultisampledColorBuffer=i.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=i.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=i.storeMultisampledStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview,this.useArrayDepthTexture=i.useArrayDepthTexture}_setTextureOptions(t={}){const e={minFilter:LinearFilter,generateMipmaps:!1,flipY:!1,internalFormat:null};void 0!==t.mapping&&(e.mapping=t.mapping),void 0!==t.wrapS&&(e.wrapS=t.wrapS),void 0!==t.wrapT&&(e.wrapT=t.wrapT),void 0!==t.wrapR&&(e.wrapR=t.wrapR),void 0!==t.magFilter&&(e.magFilter=t.magFilter),void 0!==t.minFilter&&(e.minFilter=t.minFilter),void 0!==t.format&&(e.format=t.format),void 0!==t.type&&(e.type=t.type),void 0!==t.anisotropy&&(e.anisotropy=t.anisotropy),void 0!==t.colorSpace&&(e.colorSpace=t.colorSpace),void 0!==t.flipY&&(e.flipY=t.flipY),void 0!==t.generateMipmaps&&(e.generateMipmaps=t.generateMipmaps),void 0!==t.internalFormat&&(e.internalFormat=t.internalFormat);for(let i=0;i<this.textures.length;i++)this.textures[i].setValues(e)}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}set depthTexture(t){null!==this._depthTexture&&this._depthTexture.renderTarget===this&&(this._depthTexture.renderTarget=null),null!==t&&null===t.renderTarget&&(t.renderTarget=this),this._depthTexture=t}get depthTexture(){return this._depthTexture}setSize(t,e,i=1){if(this.width!==t||this.height!==e||this.depth!==i){this.width=t,this.height=e,this.depth=i;for(let A=0,n=this.textures.length;A<n;A++)this.textures[A].image.width=t,this.textures[A].image.height=e,this.textures[A].image.depth=i,!0!==this.textures[A].isData3DTexture&&(this.textures[A].isArrayTexture=this.textures[A].image.depth>1);this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,i=t.textures.length;e<i;e++){this.textures[e]=t.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;const i=Object.assign({},t.textures[e].image);this.textures[e].source=new TextureSource(i)}if(this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveColorBuffer=t.resolveColorBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,this.storeMultisampledColorBuffer=t.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=t.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=t.storeMultisampledStencilBuffer,null!==t.depthTexture)if(t.depthTexture.renderTarget===t){const e=t.depthTexture.clone();e.renderTarget=null,this.depthTexture=e}else this.depthTexture=t.depthTexture;return this.samples=t.samples,this.multiview=t.multiview,this.useArrayDepthTexture=t.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}},WebGLRenderTarget=class extends RenderTarget{constructor(t=1,e=1,i={}){super(t,e,i),this.isWebGLRenderTarget=!0}},DataArrayTexture=class extends Texture{constructor(t=null,e=1,i=1,A=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:i,depth:A},this.magFilter=NearestFilter,this.minFilter=NearestFilter,this.wrapR=ClampToEdgeWrapping,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=/* @__PURE__ */new Set}copy(t){return super.copy(t),this.wrapR=t.wrapR,this}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}},WebGLArrayRenderTarget=class extends WebGLRenderTarget{constructor(t=1,e=1,i=1,A={}){super(t,e,A),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new DataArrayTexture(null,t,e,i),this._setTextureOptions(A),this.texture.isRenderTargetTexture=!0}},Data3DTexture=class extends Texture{constructor(t=null,e=1,i=1,A=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:i,depth:A},this.magFilter=NearestFilter,this.minFilter=NearestFilter,this.wrapR=ClampToEdgeWrapping,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}copy(t){return super.copy(t),this.wrapR=t.wrapR,this}},WebGL3DRenderTarget=class extends WebGLRenderTarget{constructor(t=1,e=1,i=1,A={}){super(t,e,A),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new Data3DTexture(null,t,e,i),this._setTextureOptions(A),this.texture.isRenderTargetTexture=!0}},Matrix4=class t{constructor(t,e,i,A,n,r,s,o,a,l,h,g,c,d,I,u){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,i,A,n,r,s,o,a,l,h,g,c,d,I,u)}set(t,e,i,A,n,r,s,o,a,l,h,g,c,d,I,u){const p=this.elements;return p[0]=t,p[4]=e,p[8]=i,p[12]=A,p[1]=n,p[5]=r,p[9]=s,p[13]=o,p[2]=a,p[6]=l,p[10]=h,p[14]=g,p[3]=c,p[7]=d,p[11]=I,p[15]=u,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 t).fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return 0===this.determinantAffine()?(t.set(1,0,0),e.set(0,1,0),i.set(0,0,1),this):(t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){if(0===t.determinantAffine())return this.identity();const e=this.elements,i=t.elements,A=1/_v1$7.setFromMatrixColumn(t,0).length(),n=1/_v1$7.setFromMatrixColumn(t,1).length(),r=1/_v1$7.setFromMatrixColumn(t,2).length();return e[0]=i[0]*A,e[1]=i[1]*A,e[2]=i[2]*A,e[3]=0,e[4]=i[4]*n,e[5]=i[5]*n,e[6]=i[6]*n,e[7]=0,e[8]=i[8]*r,e[9]=i[9]*r,e[10]=i[10]*r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,i=t.x,A=t.y,n=t.z,r=Math.cos(i),s=Math.sin(i),o=Math.cos(A),a=Math.sin(A),l=Math.cos(n),h=Math.sin(n);if("XYZ"===t.order){const t=r*l,i=r*h,A=s*l,n=s*h;e[0]=o*l,e[4]=-o*h,e[8]=a,e[1]=i+A*a,e[5]=t-n*a,e[9]=-s*o,e[2]=n-t*a,e[6]=A+i*a,e[10]=r*o}else if("YXZ"===t.order){const t=o*l,i=o*h,A=a*l,n=a*h;e[0]=t+n*s,e[4]=A*s-i,e[8]=r*a,e[1]=r*h,e[5]=r*l,e[9]=-s,e[2]=i*s-A,e[6]=n+t*s,e[10]=r*o}else if("ZXY"===t.order){const t=o*l,i=o*h,A=a*l,n=a*h;e[0]=t-n*s,e[4]=-r*h,e[8]=A+i*s,e[1]=i+A*s,e[5]=r*l,e[9]=n-t*s,e[2]=-r*a,e[6]=s,e[10]=r*o}else if("ZYX"===t.order){const t=r*l,i=r*h,A=s*l,n=s*h;e[0]=o*l,e[4]=A*a-i,e[8]=t*a+n,e[1]=o*h,e[5]=n*a+t,e[9]=i*a-A,e[2]=-a,e[6]=s*o,e[10]=r*o}else if("YZX"===t.order){const t=r*o,i=r*a,A=s*o,n=s*a;e[0]=o*l,e[4]=n-t*h,e[8]=A*h+i,e[1]=h,e[5]=r*l,e[9]=-s*l,e[2]=-a*l,e[6]=i*h+A,e[10]=t-n*h}else if("XZY"===t.order){const t=r*o,i=r*a,A=s*o,n=s*a;e[0]=o*l,e[4]=-h,e[8]=a*l,e[1]=t*h+n,e[5]=r*l,e[9]=i*h-A,e[2]=A*h-i,e[6]=s*l,e[10]=n*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(_zero,t,_one)}lookAt(t,e,i){const A=this.elements;return _z.subVectors(t,e),0===_z.lengthSq()&&(_z.z=1),_z.normalize(),_x.crossVectors(i,_z),0===_x.lengthSq()&&(1===Math.abs(i.z)?_z.x+=1e-4:_z.z+=1e-4,_z.normalize(),_x.crossVectors(i,_z)),_x.normalize(),_y.crossVectors(_z,_x),A[0]=_x.x,A[4]=_y.x,A[8]=_z.x,A[1]=_x.y,A[5]=_y.y,A[9]=_z.y,A[2]=_x.z,A[6]=_y.z,A[10]=_z.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,A=e.elements,n=this.elements,r=i[0],s=i[4],o=i[8],a=i[12],l=i[1],h=i[5],g=i[9],c=i[13],d=i[2],I=i[6],u=i[10],p=i[14],C=i[3],m=i[7],y=i[11],E=i[15],f=A[0],M=A[4],B=A[8],P=A[12],w=A[1],Q=A[5],D=A[9],S=A[13],b=A[2],T=A[6],j=A[10],Y=A[14],W=A[3],F=A[7],x=A[11],K=A[15];return n[0]=r*f+s*w+o*b+a*W,n[4]=r*M+s*Q+o*T+a*F,n[8]=r*B+s*D+o*j+a*x,n[12]=r*P+s*S+o*Y+a*K,n[1]=l*f+h*w+g*b+c*W,n[5]=l*M+h*Q+g*T+c*F,n[9]=l*B+h*D+g*j+c*x,n[13]=l*P+h*S+g*Y+c*K,n[2]=d*f+I*w+u*b+p*W,n[6]=d*M+I*Q+u*T+p*F,n[10]=d*B+I*D+u*j+p*x,n[14]=d*P+I*S+u*Y+p*K,n[3]=C*f+m*w+y*b+E*W,n[7]=C*M+m*Q+y*T+E*F,n[11]=C*B+m*D+y*j+E*x,n[15]=C*P+m*S+y*Y+E*K,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[4],A=t[8],n=t[12],r=t[1],s=t[5],o=t[9],a=t[13],l=t[2],h=t[6],g=t[10],c=t[14],d=t[3],I=t[7],u=t[11],p=t[15],C=o*c-a*g,m=s*c-a*h,y=s*g-o*h,E=r*c-a*l,f=r*g-o*l,M=r*h-s*l;return e*(I*C-u*m+p*y)-i*(d*C-u*E+p*f)+A*(d*m-I*E+p*M)-n*(d*y-I*f+u*M)}determinantAffine(){const t=this.elements,e=t[0],i=t[4],A=t[8],n=t[1],r=t[5],s=t[9],o=t[2],a=t[6],l=t[10];return e*(r*l-s*a)-i*(n*l-s*o)+A*(n*a-r*o)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,i){const A=this.elements;return t.isVector3?(A[12]=t.x,A[13]=t.y,A[14]=t.z):(A[12]=t,A[13]=e,A[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],A=t[2],n=t[3],r=t[4],s=t[5],o=t[6],a=t[7],l=t[8],h=t[9],g=t[10],c=t[11],d=t[12],I=t[13],u=t[14],p=t[15],C=e*s-i*r,m=e*o-A*r,y=e*a-n*r,E=i*o-A*s,f=i*a-n*s,M=A*a-n*o,B=l*I-h*d,P=l*u-g*d,w=l*p-c*d,Q=h*u-g*I,D=h*p-c*I,S=g*p-c*u,b=C*S-m*D+y*Q+E*w-f*P+M*B;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const T=1/b;return t[0]=(s*S-o*D+a*Q)*T,t[1]=(A*D-i*S-n*Q)*T,t[2]=(I*M-u*f+p*E)*T,t[3]=(g*f-h*M-c*E)*T,t[4]=(o*w-r*S-a*P)*T,t[5]=(e*S-A*w+n*P)*T,t[6]=(u*y-d*M-p*m)*T,t[7]=(l*M-g*y+c*m)*T,t[8]=(r*D-s*w+a*B)*T,t[9]=(i*w-e*D-n*B)*T,t[10]=(d*f-I*y+p*C)*T,t[11]=(h*y-l*f-c*C)*T,t[12]=(s*P-r*Q-o*B)*T,t[13]=(e*Q-i*P+A*B)*T,t[14]=(I*m-d*E-u*C)*T,t[15]=(l*E-h*m+g*C)*T,this}scale(t){const e=this.elements,i=t.x,A=t.y,n=t.z;return e[0]*=i,e[4]*=A,e[8]*=n,e[1]*=i,e[5]*=A,e[9]*=n,e[2]*=i,e[6]*=A,e[10]*=n,e[3]*=i,e[7]*=A,e[11]*=n,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],A=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,A))}makeTranslation(t,e,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),A=Math.sin(e),n=1-i,r=t.x,s=t.y,o=t.z,a=n*r,l=n*s;return this.set(a*r+i,a*s-A*o,a*o+A*s,0,a*s+A*o,l*s+i,l*o-A*r,0,a*o-A*s,l*o+A*r,n*o*o+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,A,n,r){return this.set(1,i,n,0,t,1,r,0,e,A,1,0,0,0,0,1),this}compose(t,e,i){const A=this.elements,n=e._x,r=e._y,s=e._z,o=e._w,a=n+n,l=r+r,h=s+s,g=n*a,c=n*l,d=n*h,I=r*l,u=r*h,p=s*h,C=o*a,m=o*l,y=o*h,E=i.x,f=i.y,M=i.z;return A[0]=(1-(I+p))*E,A[1]=(c+y)*E,A[2]=(d-m)*E,A[3]=0,A[4]=(c-y)*f,A[5]=(1-(g+p))*f,A[6]=(u+C)*f,A[7]=0,A[8]=(d+m)*M,A[9]=(u-C)*M,A[10]=(1-(g+I))*M,A[11]=0,A[12]=t.x,A[13]=t.y,A[14]=t.z,A[15]=1,this}decompose(t,e,i){const A=this.elements;t.x=A[12],t.y=A[13],t.z=A[14];const n=this.determinantAffine();if(0===n)return i.set(1,1,1),e.identity(),this;let r=_v1$7.set(A[0],A[1],A[2]).length();const s=_v1$7.set(A[4],A[5],A[6]).length(),o=_v1$7.set(A[8],A[9],A[10]).length();n<0&&(r=-r),_m1$2$1.copy(this);const a=1/r,l=1/s,h=1/o;return _m1$2$1.elements[0]*=a,_m1$2$1.elements[1]*=a,_m1$2$1.elements[2]*=a,_m1$2$1.elements[4]*=l,_m1$2$1.elements[5]*=l,_m1$2$1.elements[6]*=l,_m1$2$1.elements[8]*=h,_m1$2$1.elements[9]*=h,_m1$2$1.elements[10]*=h,e.setFromRotationMatrix(_m1$2$1),i.x=r,i.y=s,i.z=o,this}makePerspective(t,e,i,A,n,r,s=WebGLCoordinateSystem,o=!1){const a=this.elements,l=2*n/(e-t),h=2*n/(i-A),g=(e+t)/(e-t),c=(i+A)/(i-A);let d,I;if(o)d=n/(r-n),I=r*n/(r-n);else if(2e3===s)d=-(r+n)/(r-n),I=-2*r*n/(r-n);else{if(2001!==s)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+s);d=-r/(r-n),I=-r*n/(r-n)}return a[0]=l,a[4]=0,a[8]=g,a[12]=0,a[1]=0,a[5]=h,a[9]=c,a[13]=0,a[2]=0,a[6]=0,a[10]=d,a[14]=I,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(t,e,i,A,n,r,s=WebGLCoordinateSystem,o=!1){const a=this.elements,l=2/(e-t),h=2/(i-A),g=-(e+t)/(e-t),c=-(i+A)/(i-A);let d,I;if(o)d=1/(r-n),I=r/(r-n);else if(2e3===s)d=-2/(r-n),I=-(r+n)/(r-n);else{if(2001!==s)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);d=-1/(r-n),I=-n/(r-n)}return a[0]=l,a[4]=0,a[8]=0,a[12]=g,a[1]=0,a[5]=h,a[9]=0,a[13]=c,a[2]=0,a[6]=0,a[10]=d,a[14]=I,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(t){const e=this.elements,i=t.elements;for(let A=0;A<16;A++)if(e[A]!==i[A])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}};_Matrix2=Matrix4,_Matrix2.prototype.isMatrix4=!0;var _v1$7=/*@__PURE__*/new Vector3,_m1$2$1=/*@__PURE__*/new Matrix4,_zero=/*@__PURE__*/new Vector3(0,0,0),_one=/*@__PURE__*/new Vector3(1,1,1),_x=/*@__PURE__*/new Vector3,_y=/*@__PURE__*/new Vector3,_z=/*@__PURE__*/new Vector3,_matrix$2$1=/*@__PURE__*/new Matrix4,_quaternion$4=/*@__PURE__*/new Quaternion,Euler=class t{constructor(e=0,i=0,A=0,n=t.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=i,this._z=A,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,A=this._order){return this._x=t,this._y=e,this._z=i,this._order=A,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){const A=t.elements,n=A[0],r=A[4],s=A[8],o=A[1],a=A[5],l=A[9],h=A[2],g=A[6],c=A[10];switch(e){case"XYZ":this._y=Math.asin(clamp$2(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,c),this._z=Math.atan2(-r,n)):(this._x=Math.atan2(g,a),this._z=0);break;case"YXZ":this._x=Math.asin(-clamp$2(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(s,c),this._z=Math.atan2(o,a)):(this._y=Math.atan2(-h,n),this._z=0);break;case"ZXY":this._x=Math.asin(clamp$2(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(-h,c),this._z=Math.atan2(-r,a)):(this._y=0,this._z=Math.atan2(o,n));break;case"ZYX":this._y=Math.asin(-clamp$2(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(g,c),this._z=Math.atan2(o,n)):(this._x=0,this._z=Math.atan2(-r,a));break;case"YZX":this._z=Math.asin(clamp$2(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,a),this._y=Math.atan2(-h,n)):(this._x=0,this._y=Math.atan2(s,c));break;case"XZY":this._z=Math.asin(-clamp$2(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(g,a),this._y=Math.atan2(s,n)):(this._x=Math.atan2(-l,c),this._y=0);break;default:warn("Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===i&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return _matrix$2$1.makeRotationFromQuaternion(t),this.setFromRotationMatrix(_matrix$2$1,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return _quaternion$4.setFromEuler(this),this.setFromQuaternion(_quaternion$4,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Euler.DEFAULT_ORDER="XYZ";var Layers=class{constructor(){this.mask=1}set(t){this.mask=1<<t>>>0}enable(t){this.mask|=1<<t}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t}disable(t){this.mask&=~(1<<t)}disableAll(){this.mask=0}test(t){return 0!==(this.mask&t.mask)}isEnabled(t){return!!(this.mask&1<<t)}},_object3DId=0,_v1$6=/*@__PURE__*/new Vector3,_q1=/*@__PURE__*/new Quaternion,_m1$1$3=/*@__PURE__*/new Matrix4,_target$1=/*@__PURE__*/new Vector3,_position$4=/*@__PURE__*/new Vector3,_scale$3=/*@__PURE__*/new Vector3,_quaternion$3=/*@__PURE__*/new Quaternion,_xAxis=/*@__PURE__*/new Vector3(1,0,0),_yAxis=/*@__PURE__*/new Vector3(0,1,0),_zAxis=/*@__PURE__*/new Vector3(0,0,1),_addedEvent={type:"added"},_removedEvent={type:"removed"},_childaddedEvent={type:"childadded",child:null},_childremovedEvent={type:"childremoved",child:null},Object3D=class t extends EventDispatcher{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:_object3DId++}),this.uuid=generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=t.DEFAULT_UP.clone();const e=new Vector3,i=new Euler,A=new Quaternion,n=new Vector3(1,1,1);i._onChange(function(){A.setFromEuler(i,!1)}),A._onChange(function(){i.setFromQuaternion(A,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:i},quaternion:{configurable:!0,enumerable:!0,value:A},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new Matrix4},normalMatrix:{value:new Matrix3}}),this.matrix=new Matrix4,this.matrixWorld=new Matrix4,this.matrixAutoUpdate=t.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=t.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Layers,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(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return _q1.setFromAxisAngle(t,e),this.quaternion.multiply(_q1),this}rotateOnWorldAxis(t,e){return _q1.setFromAxisAngle(t,e),this.quaternion.premultiply(_q1),this}rotateX(t){return this.rotateOnAxis(_xAxis,t)}rotateY(t){return this.rotateOnAxis(_yAxis,t)}rotateZ(t){return this.rotateOnAxis(_zAxis,t)}translateOnAxis(t,e){return _v1$6.copy(t).applyQuaternion(this.quaternion),this.position.add(_v1$6.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(_xAxis,t)}translateY(t){return this.translateOnAxis(_yAxis,t)}translateZ(t){return this.translateOnAxis(_zAxis,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(_m1$1$3.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?_target$1.copy(t):_target$1.set(t,e,i);const A=this.parent;this.updateWorldMatrix(!0,!1),_position$4.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?_m1$1$3.lookAt(_position$4,_target$1,this.up):_m1$1$3.lookAt(_target$1,_position$4,this.up),this.quaternion.setFromRotationMatrix(_m1$1$3),A&&(_m1$1$3.extractRotation(A.matrixWorld),_q1.setFromRotationMatrix(_m1$1$3),this.quaternion.premultiply(_q1.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(error$1("Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(_addedEvent),_childaddedEvent.child=t,this.dispatchEvent(_childaddedEvent),_childaddedEvent.child=null):error$1("Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(_removedEvent),_childremovedEvent.child=t,this.dispatchEvent(_childremovedEvent),_childremovedEvent.child=null),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),_m1$1$3.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),_m1$1$3.multiply(t.parent.matrixWorld)),t.applyMatrix4(_m1$1$3),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(_addedEvent),_childaddedEvent.child=t,this.dispatchEvent(_childaddedEvent),_childaddedEvent.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,A=this.children.length;i<A;i++){const A=this.children[i].getObjectByProperty(t,e);if(void 0!==A)return A}}getObjectsByProperty(t,e,i=[]){this[t]===e&&i.push(this);const A=this.children;for(let n=0,r=A.length;n<r;n++)A[n].getObjectsByProperty(t,e,i);return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_position$4,t,_scale$3),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_position$4,_quaternion$3,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}intersectsFrustum(){}traverse(t){t(this);const e=this.children;for(let i=0,A=e.length;i<A;i++)e[i].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let i=0,A=e.length;i<A;i++)e[i].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const t=this.pivot;if(null!==t){const e=t.x,i=t.y,A=t.z,n=this.matrix.elements;n[12]+=e-n[0]*e-n[4]*i-n[8]*A,n[13]+=i-n[1]*e-n[5]*i-n[9]*A,n[14]+=A-n[2]*e-n[6]*i-n[10]*A}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let i=0,A=e.length;i<A;i++)e[i].updateMatrixWorld(t)}updateWorldMatrix(t,e,i=!1){const A=this.parent;if(!0===t&&null!==A&&A.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||i)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,i=!0),!0===e){const t=this.children;for(let e=0,A=t.length;e<A;e++)t[e].updateWorldMatrix(!1,!0,i)}}toJSON(t){const e=void 0===t||"string"==typeof t,i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const A={};function n(e,i){return void 0===e[i.uuid]&&(e[i.uuid]=i.toJSON(t)),i.uuid}if(A.uuid=this.uuid,A.type=this.type,A.name=this.name,A.castShadow=this.castShadow,A.receiveShadow=this.receiveShadow,A.visible=this.visible,A.frustumCulled=this.frustumCulled,A.renderOrder=this.renderOrder,A.static=this.static,A.matrixAutoUpdate=this.matrixAutoUpdate,Object.keys(this.userData).length>0&&(A.userData=this.userData),A.layers=this.layers.mask,A.matrix=this.matrix.toArray(),A.up=this.up.toArray(),null!==this.pivot&&(A.pivot=this.pivot.toArray()),void 0!==this.morphTargetDictionary&&(A.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),void 0!==this.morphTargetInfluences&&(A.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(A.type="InstancedMesh",A.count=this.count,A.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(A.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(A.type="BatchedMesh",A.perObjectFrustumCulled=this.perObjectFrustumCulled,A.sortObjects=this.sortObjects,A.drawRanges=this._drawRanges,A.reservedRanges=this._reservedRanges,A.geometryInfo=this._geometryInfo.map(t=>_objectSpread2(_objectSpread2({},t),{},{boundingBox:t.boundingBox?t.boundingBox.toJSON():void 0,boundingSphere:t.boundingSphere?t.boundingSphere.toJSON():void 0})),A.instanceInfo=this._instanceInfo.map(t=>_objectSpread2({},t)),A.availableInstanceIds=this._availableInstanceIds.slice(),A.availableGeometryIds=this._availableGeometryIds.slice(),A.nextIndexStart=this._nextIndexStart,A.nextVertexStart=this._nextVertexStart,A.geometryCount=this._geometryCount,A.maxInstanceCount=this._maxInstanceCount,A.maxVertexCount=this._maxVertexCount,A.maxIndexCount=this._maxIndexCount,A.geometryInitialized=this._geometryInitialized,A.matricesTexture=this._matricesTexture.toJSON(t),A.indirectTexture=this._indirectTexture.toJSON(t),null!==this._colorsTexture&&(A.colorsTexture=this._colorsTexture.toJSON(t)),null!==this.boundingSphere&&(A.boundingSphere=this.boundingSphere.toJSON()),null!==this.boundingBox&&(A.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?A.background=this.background.toJSON():this.background.isTexture&&(A.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(A.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){A.geometry=n(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const i=e.shapes;if(Array.isArray(i))for(let e=0,A=i.length;e<A;e++){const A=i[e];n(t.shapes,A)}else n(t.shapes,i)}}if(this.isSkinnedMesh&&(A.bindMode=this.bindMode,A.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(n(t.skeletons,this.skeleton),A.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let i=0,A=this.material.length;i<A;i++)e.push(n(t.materials,this.material[i]));A.material=e}else A.material=n(t.materials,this.material);if(this.children.length>0){A.children=[];for(let e=0;e<this.children.length;e++)A.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){A.animations=[];for(let e=0;e<this.animations.length;e++){const i=this.animations[e];A.animations.push(n(t.animations,i))}}if(e){const e=r(t.geometries),A=r(t.materials),n=r(t.textures),s=r(t.images),o=r(t.shapes),a=r(t.skeletons),l=r(t.animations),h=r(t.nodes);e.length>0&&(i.geometries=e),A.length>0&&(i.materials=A),n.length>0&&(i.textures=n),s.length>0&&(i.images=s),o.length>0&&(i.shapes=o),a.length>0&&(i.skeletons=a),l.length>0&&(i.animations=l),h.length>0&&(i.nodes=h)}return i.object=A,i;function r(t){const e=[];for(const i in t){const A=t[i];delete A.metadata,e.push(A)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.pivot=null!==t.pivot?t.pivot.clone():null,this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.static=t.static,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let i=0;i<t.children.length;i++){const e=t.children[i];this.add(e.clone())}return this}dispose(){this.dispatchEvent({type:"dispose"})}};Object3D.DEFAULT_UP=/*@__PURE__*/new Vector3(0,1,0),Object3D.DEFAULT_MATRIX_AUTO_UPDATE=!0,Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Group$1=class extends Object3D{constructor(){super(),this.isGroup=!0,this.type="Group"}},_moveEvent={type:"move"},WebXRController=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new Group$1,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new Group$1,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Vector3,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Vector3),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new Group$1,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Vector3,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Vector3,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const e=this._hand;if(e)for(const i of t.hand.values())this._getHandJoint(e,i)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,i){let A=null,n=null,r=null;const s=this._targetRay,o=this._grip,a=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(a&&t.hand){r=!0;for(const r of t.hand.values()){const t=e.getJointPose(r,i),A=this._getHandJoint(a,r);null!==t&&(A.matrix.fromArray(t.transform.matrix),A.matrix.decompose(A.position,A.rotation,A.scale),A.matrixWorldNeedsUpdate=!0,A.jointRadius=t.radius),A.visible=null!==t}const A=a.joints["index-finger-tip"],n=a.joints["thumb-tip"],s=A.position.distanceTo(n.position),o=.02,l=.005;a.inputState.pinching&&s>.025?(a.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!a.inputState.pinching&&s<=o-l&&(a.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&(n=e.getPose(t.gripSpace,i),null!==n&&(o.matrix.fromArray(n.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,n.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(n.linearVelocity)):o.hasLinearVelocity=!1,n.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(n.angularVelocity)):o.hasAngularVelocity=!1,o.eventsEnabled&&o.dispatchEvent({type:"gripUpdated",data:t,target:this})));null!==s&&(A=e.getPose(t.targetRaySpace,i),null===A&&null!==n&&(A=n),null!==A&&(s.matrix.fromArray(A.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,A.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(A.linearVelocity)):s.hasLinearVelocity=!1,A.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(A.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(_moveEvent)))}return null!==s&&(s.visible=null!==A),null!==o&&(o.visible=null!==n),null!==a&&(a.visible=null!==r),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){const i=new Group$1;i.matrixAutoUpdate=!1,i.visible=!1,t.joints[e.jointName]=i,t.add(i)}return t.joints[e.jointName]}},_colorKeywords={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},_hslA={h:0,s:0,l:0},_hslB={h:0,s:0,l:0};function hue2rgb(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}var Color$1=class{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){if(void 0===e&&void 0===i){const e=t;e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e)}else this.setRGB(t,e,i);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=SRGBColorSpace){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,ColorManagement.colorSpaceToWorking(this,e),this}setRGB(t,e,i,A=ColorManagement.workingColorSpace){return this.r=t,this.g=e,this.b=i,ColorManagement.colorSpaceToWorking(this,A),this}setHSL(t,e,i,A=ColorManagement.workingColorSpace){if(t=euclideanModulo(t,1),e=clamp$2(e,0,1),i=clamp$2(i,0,1),0===e)this.r=this.g=this.b=i;else{const A=i<=.5?i*(1+e):i+e-i*e,n=2*i-A;this.r=hue2rgb(n,A,t+1/3),this.g=hue2rgb(n,A,t),this.b=hue2rgb(n,A,t-1/3)}return ColorManagement.colorSpaceToWorking(this,A),this}setStyle(t,e=SRGBColorSpace){function i(e){void 0!==e&&parseFloat(e)<1&&warn("Color: Alpha component of "+t+" will be ignored.")}let A;if(A=/^(\w+)\(([^\)]*)\)/.exec(t)){let n;const r=A[1],s=A[2];switch(r){case"rgb":case"rgba":if(n=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(n[4]),this.setRGB(Math.min(255,parseInt(n[1],10))/255,Math.min(255,parseInt(n[2],10))/255,Math.min(255,parseInt(n[3],10))/255,e);if(n=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(n[4]),this.setRGB(Math.min(100,parseInt(n[1],10))/100,Math.min(100,parseInt(n[2],10))/100,Math.min(100,parseInt(n[3],10))/100,e);break;case"hsl":case"hsla":if(n=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(n[4]),this.setHSL(parseFloat(n[1])/360,parseFloat(n[2])/100,parseFloat(n[3])/100,e);break;default:warn("Color: Unknown color model "+t)}}else if(A=/^\#([A-Fa-f\d]+)$/.exec(t)){const i=A[1],n=i.length;if(3===n)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,e);if(6===n)return this.setHex(parseInt(i,16),e);warn("Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=SRGBColorSpace){const i=_colorKeywords[t.toLowerCase()];return void 0!==i?this.setHex(i,e):warn("Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=SRGBToLinear(t.r),this.g=SRGBToLinear(t.g),this.b=SRGBToLinear(t.b),this}copyLinearToSRGB(t){return this.r=LinearToSRGB(t.r),this.g=LinearToSRGB(t.g),this.b=LinearToSRGB(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=SRGBColorSpace){return ColorManagement.workingToColorSpace(_color.copy(this),t),65536*Math.round(clamp$2(255*_color.r,0,255))+256*Math.round(clamp$2(255*_color.g,0,255))+Math.round(clamp$2(255*_color.b,0,255))}getHexString(t=SRGBColorSpace){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=ColorManagement.workingColorSpace){ColorManagement.workingToColorSpace(_color.copy(this),e);const i=_color.r,A=_color.g,n=_color.b,r=Math.max(i,A,n),s=Math.min(i,A,n);let o,a;const l=(s+r)/2;if(s===r)o=0,a=0;else{const t=r-s;switch(a=l<=.5?t/(r+s):t/(2-r-s),r){case i:o=(A-n)/t+(A<n?6:0);break;case A:o=(n-i)/t+2;break;case n:o=(i-A)/t+4}o/=6}return t.h=o,t.s=a,t.l=l,t}getRGB(t,e=ColorManagement.workingColorSpace){return ColorManagement.workingToColorSpace(_color.copy(this),e),t.r=_color.r,t.g=_color.g,t.b=_color.b,t}getStyle(t=SRGBColorSpace){ColorManagement.workingToColorSpace(_color.copy(this),t);const e=_color.r,i=_color.g,A=_color.b;return"srgb"!==t?`color(${t} ${e.toFixed(3)} ${i.toFixed(3)} ${A.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*A)})`}offsetHSL(t,e,i){return this.getHSL(_hslA),this.setHSL(_hslA.h+t,_hslA.s+e,_hslA.l+i)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(_hslA),t.getHSL(_hslB);const i=lerp(_hslA.h,_hslB.h,e),A=lerp(_hslA.s,_hslB.s,e),n=lerp(_hslA.l,_hslB.l,e);return this.setHSL(i,A,n),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,i=this.g,A=this.b,n=t.elements;return this.r=n[0]*e+n[3]*i+n[6]*A,this.g=n[1]*e+n[4]*i+n[7]*A,this.b=n[2]*e+n[5]*i+n[8]*A,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},_color=/*@__PURE__*/new Color$1;Color$1.NAMES=_colorKeywords;var FogExp2=class t{constructor(t,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new Color$1(t),this.density=e}clone(){return new t(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}},Fog=class t{constructor(t,e=1,i=1e3){this.isFog=!0,this.name="",this.color=new Color$1(t),this.near=e,this.far=i}clone(){return new t(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}},Scene=class extends Object3D{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 Euler,this.environmentIntensity=1,this.environmentRotation=new Euler,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),e.object.backgroundBlurriness=this.backgroundBlurriness,e.object.backgroundIntensity=this.backgroundIntensity,e.object.backgroundRotation=this.backgroundRotation.toArray(),e.object.environmentIntensity=this.environmentIntensity,e.object.environmentRotation=this.environmentRotation.toArray(),e}},_v0$2=/*@__PURE__*/new Vector3,_v1$5=/*@__PURE__*/new Vector3,_v2$4=/*@__PURE__*/new Vector3,_v3$2=/*@__PURE__*/new Vector3,_vab=/*@__PURE__*/new Vector3,_vac=/*@__PURE__*/new Vector3,_vbc=/*@__PURE__*/new Vector3,_vap=/*@__PURE__*/new Vector3,_vbp=/*@__PURE__*/new Vector3,_vcp=/*@__PURE__*/new Vector3,_v40=/*@__PURE__*/new Vector4,_v41=/*@__PURE__*/new Vector4,_v42=/*@__PURE__*/new Vector4,Triangle=class t{constructor(t=new Vector3,e=new Vector3,i=new Vector3){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,A){A.subVectors(i,e),_v0$2.subVectors(t,e),A.cross(_v0$2);const n=A.lengthSq();return n>0?A.multiplyScalar(1/Math.sqrt(n)):A.set(0,0,0)}static getBarycoord(t,e,i,A,n){_v0$2.subVectors(A,e),_v1$5.subVectors(i,e),_v2$4.subVectors(t,e);const r=_v0$2.dot(_v0$2),s=_v0$2.dot(_v1$5),o=_v0$2.dot(_v2$4),a=_v1$5.dot(_v1$5),l=_v1$5.dot(_v2$4),h=r*a-s*s;if(0===h)return n.set(0,0,0),null;const g=1/h,c=(a*o-s*l)*g,d=(r*l-s*o)*g;return n.set(1-c-d,d,c)}static containsPoint(t,e,i,A){return null!==this.getBarycoord(t,e,i,A,_v3$2)&&(_v3$2.x>=0&&_v3$2.y>=0&&_v3$2.x+_v3$2.y<=1)}static getInterpolation(t,e,i,A,n,r,s,o){return null===this.getBarycoord(t,e,i,A,_v3$2)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(n,_v3$2.x),o.addScaledVector(r,_v3$2.y),o.addScaledVector(s,_v3$2.z),o)}static getInterpolatedAttribute(t,e,i,A,n,r){return _v40.setScalar(0),_v41.setScalar(0),_v42.setScalar(0),_v40.fromBufferAttribute(t,e),_v41.fromBufferAttribute(t,i),_v42.fromBufferAttribute(t,A),r.setScalar(0),r.addScaledVector(_v40,n.x),r.addScaledVector(_v41,n.y),r.addScaledVector(_v42,n.z),r}static isFrontFacing(t,e,i,A){return _v0$2.subVectors(i,e),_v1$5.subVectors(t,e),_v0$2.cross(_v1$5).dot(A)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,A){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[A]),this}setFromAttributeAndIndices(t,e,i,A){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,A),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return _v0$2.subVectors(this.c,this.b),_v1$5.subVectors(this.a,this.b),.5*_v0$2.cross(_v1$5).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return t.getNormal(this.a,this.b,this.c,e)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,i){return t.getBarycoord(e,this.a,this.b,this.c,i)}getInterpolation(e,i,A,n,r){return t.getInterpolation(e,this.a,this.b,this.c,i,A,n,r)}containsPoint(e){return t.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return t.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const i=this.a,A=this.b,n=this.c;let r,s;_vab.subVectors(A,i),_vac.subVectors(n,i),_vap.subVectors(t,i);const o=_vab.dot(_vap),a=_vac.dot(_vap);if(o<=0&&a<=0)return e.copy(i);_vbp.subVectors(t,A);const l=_vab.dot(_vbp),h=_vac.dot(_vbp);if(l>=0&&h<=l)return e.copy(A);const g=o*h-l*a;if(g<=0&&o>=0&&l<=0)return r=o/(o-l),e.copy(i).addScaledVector(_vab,r);_vcp.subVectors(t,n);const c=_vab.dot(_vcp),d=_vac.dot(_vcp);if(d>=0&&c<=d)return e.copy(n);const I=c*a-o*d;if(I<=0&&a>=0&&d<=0)return s=a/(a-d),e.copy(i).addScaledVector(_vac,s);const u=l*d-c*h;if(u<=0&&h-l>=0&&c-d>=0)return _vbc.subVectors(n,A),s=(h-l)/(h-l+(c-d)),e.copy(A).addScaledVector(_vbc,s);const p=1/(u+I+g);return r=I*p,s=g*p,e.copy(i).addScaledVector(_vab,r).addScaledVector(_vac,s)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},Box3=class{constructor(t=new Vector3(1/0,1/0,1/0),e=new Vector3(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e+=3)this.expandByPoint(_vector$b.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(_vector$b.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=_vector$b.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.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(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const i=t.geometry;if(void 0!==i){const A=i.getAttribute("position");if(!0===e&&void 0!==A&&!0!==t.isInstancedMesh)for(let e=0,i=A.count;e<i;e++)!0===t.isMesh?t.getVertexPosition(e,_vector$b):_vector$b.fromBufferAttribute(A,e),_vector$b.applyMatrix4(t.matrixWorld),this.expandByPoint(_vector$b);else void 0!==t.boundingBox?(null===t.boundingBox&&t.computeBoundingBox(),_box$4.copy(t.boundingBox)):(null===i.boundingBox&&i.computeBoundingBox(),_box$4.copy(i.boundingBox)),_box$4.applyMatrix4(t.matrixWorld),this.union(_box$4)}const A=t.children;for(let n=0,r=A.length;n<r;n++)this.expandByObject(A[n],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,_vector$b),_vector$b.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(_center),_extents.subVectors(this.max,_center),_v0$1$1.subVectors(t.a,_center),_v1$4.subVectors(t.b,_center),_v2$3.subVectors(t.c,_center),_f0.subVectors(_v1$4,_v0$1$1),_f1.subVectors(_v2$3,_v1$4),_f2.subVectors(_v0$1$1,_v2$3);let e=[0,-_f0.z,_f0.y,0,-_f1.z,_f1.y,0,-_f2.z,_f2.y,_f0.z,0,-_f0.x,_f1.z,0,-_f1.x,_f2.z,0,-_f2.x,-_f0.y,_f0.x,0,-_f1.y,_f1.x,0,-_f2.y,_f2.x,0];return!!satForAxes(e,_v0$1$1,_v1$4,_v2$3,_extents)&&(e=[1,0,0,0,1,0,0,0,1],!!satForAxes(e,_v0$1$1,_v1$4,_v2$3,_extents)&&(_triangleNormal$1.crossVectors(_f0,_f1),e=[_triangleNormal$1.x,_triangleNormal$1.y,_triangleNormal$1.z],satForAxes(e,_v0$1$1,_v1$4,_v2$3,_extents)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,_vector$b).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(_vector$b).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(_points[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),_points[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),_points[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),_points[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),_points[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),_points[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),_points[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),_points[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(_points)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}},_points=[
|
|
2
2
|
/*@__PURE__*/new Vector3,
|
|
3
3
|
/*@__PURE__*/new Vector3,
|
|
4
4
|
/*@__PURE__*/new Vector3,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,i as t,n as r,o as s,r as i,t as n}from"./resource-url-MTT03G1N.js";var o=["world","country","province","city","district"];function a(e,t,r,s){var i;return s&&"dynamic"===(null==e?void 0:e.mode)&&o.includes(t)&&null!==(i=e.templates[t])&&void 0!==i?i:r}var l=e=>"string"==typeof e&&!!e&&!/[:\\?#\0]/.test(e)&&!e.split("/").some(e=>!e||"."===e||".."===e);function c(e,t,r){var s,i;if(!(null==e?void 0:e.mapNavigation))return;if("static"===e.mapNavigation.mode)throw Error("此作品为固定场景展示,不支持运行时区域切换或重建。请以动态模式重新导出。");const n=void 0===r?Object.values(null!==(s=e.regions)&&void 0!==s?s:{}).flat():null===(i=e.regions)||void 0===i?void 0:i[r];if(void 0!==r&&!Object.values(e.mapNavigation.templates).includes(r)||!(null==n?void 0:n.includes(t)))throw Error(`区域 ${t} 或场景模板不在动态导出范围内,请调整范围和模板后重新导出。`)}function d(e){if(void 0===e)return;const t=e;if(!t||1!==t.version||!Array.isArray(t.entries))throw Error("Invalid runtime asset catalog");const r=/* @__PURE__ */new Set,s=/* @__PURE__ */new Set,i=/* @__PURE__ */new Set;for(const o of t.entries){var n;if(!o||"string"!=typeof o.id||!o.id||r.has(o.id)||!l(o.path)||s.has(o.path)||!Array.isArray(o.sources)||!o.sources.length||o.sources.some(e=>"string"!=typeof e||!e||i.has(e))||new Set(o.sources).size!==o.sources.length||"string"!=typeof o.mimeType||!/^[\w.+-]+\/[\w.+-]+$/.test(o.mimeType)||!["identity","gzip"].includes(o.encoding)||!Number.isSafeInteger(o.bytes)||o.bytes<0||!/^[a-f0-9]{64}$/.test(o.sha256)||void 0!==o.data&&!(o.data instanceof ArrayBuffer))throw Error(`Invalid runtime asset: ${null!==(n=null==o?void 0:o.path)&&void 0!==n?n:"unknown"}`);r.add(o.id),s.add(o.path),o.sources.forEach(e=>i.add(e))}if(t.scope&&(!Number.isInteger(t.scope.rootAdcode)||t.scope.rootAdcode<0||!o.includes(t.scope.maxLevel)))throw Error("Invalid map export scope");const a=t.mapNavigation;if(void 0!==a){if(!a||!["static","dynamic"].includes(a.mode))throw Error("Invalid map navigation mode");if("dynamic"===a.mode&&(!a.scope||!Number.isInteger(a.scope.rootAdcode)||a.scope.rootAdcode<0||!o.includes(a.scope.maxLevel)||!a.templates||"object"!=typeof a.templates||Array.isArray(a.templates)||Object.entries(a.templates).some(([e,t])=>!o.includes(e)||"string"!=typeof t||!t.trim())))throw Error("Invalid map navigation templates or scope")}if(t.regions&&("object"!=typeof t.regions||Array.isArray(t.regions)||Object.values(t.regions).some(e=>!Array.isArray(e)||e.some(e=>!Number.isInteger(e)||e<0))))throw Error("Invalid runtime region catalog");if(void 0!==t.declaredSources&&(!Array.isArray(t.declaredSources)||t.declaredSources.some(e=>"string"!=typeof e||!e.trim())))throw Error("Invalid declared asset sources");if(void 0!==t.externalSources&&(!Array.isArray(t.externalSources)||t.externalSources.some(e=>"string"!=typeof e||!e.trim()||/[{}\0]/.test(e)||/^(?:data:|blob:|asset:)/i.test(e)||i.has(e))||new Set(t.externalSources).size!==t.externalSources.length))throw Error("Invalid external asset sources");if(void 0!==t.mapDataMode&&!["bundled","external"].includes(t.mapDataMode))throw Error("Invalid map data mode");if(void 0!==t.mapSwitchKey&&("string"!=typeof t.mapSwitchKey||!t.mapSwitchKey.trim()))throw Error("Invalid bundled map switch key");if(void 0!==t.projectId&&("string"!=typeof t.projectId||!t.projectId.trim()||t.projectId.length>64))throw Error("Invalid runtime asset project")}function u(e){const t=[];for(let r=0;r<e.length;r+=32768)t.push(String.fromCharCode(...e.subarray(r,r+32768)));return btoa(t.join(""))}function p(e){return e instanceof ArrayBuffer?new Uint8Array(e):Uint8Array.from(atob(e),e=>e.charCodeAt(0))}function f(e){return h.apply(this,arguments)}function h(){return h=t(function*(e){const t=yield crypto.subtle.digest("SHA-256",e);return Array.from(new Uint8Array(t),e=>e.toString(16).padStart(2,"0")).join("")}),h.apply(this,arguments)}function y(e,t){return m.apply(this,arguments)}function m(){return(m=t(function*(e,t){if(t.length!==e.bytes||(yield f(t))!==e.sha256)throw Error(`资源校验失败:${e.path}`)})).apply(this,arguments)}function g(t,r){var s,i,n,o;if(!r)return t;if(!t)return structuredClone(r);const a=structuredClone(t),l=new Map(a.entries.map(e=>[e.id,e])),c=new Map(a.entries.flatMap(e=>e.sources.map(t=>[t,e.sha256])));for(const e of r.entries){for(const r of e.sources)if(c.has(r)&&c.get(r)!==e.sha256)throw Error(`资源地址存在不同内容:${r}。请修改资源地址或使用“打开项目”导入。`);const t=l.get(e.id);if(t)t.sources=[.../* @__PURE__ */new Set([...t.sources,...e.sources])];else{const t=structuredClone(e);a.entries.push(t),l.set(t.id,t)}for(const r of e.sources)c.set(r,e.sha256)}a.regions=e(e({},t.regions),r.regions),a.declaredSources=[.../* @__PURE__ */new Set([...null!==(s=t.declaredSources)&&void 0!==s?s:[],...null!==(i=r.declaredSources)&&void 0!==i?i:[]])];const u=[.../* @__PURE__ */new Set([...null!==(n=t.externalSources)&&void 0!==n?n:[],...null!==(o=r.externalSources)&&void 0!==o?o:[]])].filter(e=>!c.has(e));return u.length?a.externalSources=u:delete a.externalSources,d(a),a}var v=class{constructor(e,t="",o=!0){var a;s(this,"sources",/* @__PURE__ */new Map),s(this,"resolved",/* @__PURE__ */new Map),s(this,"externals",/* @__PURE__ */new Map),s(this,"catalog",void 0),s(this,"strict",void 0),s(this,"prefix",void 0),s(this,"resolve",e=>{var t;if(/^(data:|blob:)/i.test(e))return e;const s=n(e,this.prefix),o=null!==(t=this.sources.get(e))&&void 0!==t?t:this.sources.get(s);if(!o){var a;const t=null!==(a=this.externals.get(e))&&void 0!==a?a:this.externals.get(s);if(void 0!==t)return t;if(!this.strict)return s;throw Error(`资源包未包含:${e}。请扩大导出范围或补充资源后重新导出。`)}let l=this.resolved.get(o.id);if(!l){if(void 0!==o.data){const e=p(o.data);if(e.byteLength!==o.bytes||i(r(e))!==o.sha256)throw Error(`资源校验失败:${o.path}`);l=URL.createObjectURL(new Blob([e],{type:"gzip"===o.encoding?"application/gzip":o.mimeType}))}else{const e=this.catalog.baseUrl;if(!e)throw Error(`资源缺少文件内容或部署地址:${o.path}`);const t="undefined"==typeof location?"https://bundle.invalid/":location.href;l=new URL(o.path,new URL(e,t)).href}this.resolved.set(o.id,l)}return l}),this.catalog=e,this.prefix=t,this.strict=o,d(e);const l=(e,t)=>{const r=this.sources.get(e);if(r&&r.id!==t.id)throw Error(`资源地址重复:${e}`);this.sources.set(e,t)},c=e=>/^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(e)?[e]:[e,n(e,t),`/${e.replace(/^\/+/,"")}`];for(const r of e.entries)for(const e of[...r.sources,`asset://${r.id}`])for(const t of c(e))l(t,r);for(const r of null!==(a=e.externalSources)&&void 0!==a?a:[]){const e=n(r,t);for(const t of c(r))this.externals.set(t,e)}}dispose(){for(const e of this.resolved.values())e.startsWith("blob:")&&URL.revokeObjectURL(e);this.resolved.clear()}};function w(e,t){if(null==e)return{};var r,s,i=function(e,t){if(null==e)return{};var r={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(t.includes(s))continue;r[s]=e[s]}return r}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(s=0;s<n.length;s++)r=n[s],t.includes(r)||{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var b,A,x,S=new class{constructor(e=32,t=67108864){s(this,"pending",/* @__PURE__ */new Map),s(this,"values",/* @__PURE__ */new Map),s(this,"bytes",0),s(this,"maxEntries",void 0),s(this,"maxBytes",void 0),this.maxEntries=e,this.maxBytes=t}load(e,t){const r=this.values.get(e);if(r)return this.values.delete(e),this.values.set(e,r),Promise.resolve(r);const s=this.pending.get(e);if(s)return s;const i=Promise.resolve().then(t).then(t=>{if(this.pending.get(e)===i&&(this.pending.delete(e),this.maxEntries>0&&t.bytes<=this.maxBytes))for(this.values.set(e,t),this.bytes+=t.bytes;this.values.size>this.maxEntries||this.bytes>this.maxBytes;)this.deleteValue(this.values.keys().next().value);return t},t=>{throw this.pending.get(e)===i&&this.pending.delete(e),t});return this.pending.set(e,i),i}deleteValue(e){const t=this.values.get(e);t&&(this.bytes-=t.bytes),this.values.delete(e)}clear(e){void 0!==e?(this.pending.delete(e),this.deleteValue(e)):(this.pending.clear(),this.values.clear(),this.bytes=0)}},E=e=>!!/\.(gzip|gz)(?:[?#]|$)/i.test(e),I=(b=t(function*(e,t,r=E){const s=yield window.fetch(e);if(!s.ok){try{var i;yield null===(i=s.body)||void 0===i?void 0:i.cancel()}catch(l){}throw new Error("Network response was not ok.")}let n=s;if(t)try{n=((e,t)=>{const r=Number(e.headers.get("content-length"))||0;let s=0;return e.body?new globalThis.Response(e.body.pipeThrough(new globalThis.TransformStream({start(){t({percent:0,transferredBytes:0,totalBytes:r})},transform(e,i){s+=e.byteLength,t({percent:0===r?0:s/r,transferredBytes:s,totalBytes:r}),i.enqueue(e)},flush(){t({percent:1,transferredBytes:s,totalBytes:r})}})),{status:e.status,statusText:e.statusText,headers:e.headers}):(t({percent:1,totalBytes:r,transferredBytes:s}),new globalThis.Response(null,{status:e.status,statusText:e.statusText,headers:e.headers}))})(n,t)}catch(c){try{var o;yield null===(o=s.body)||void 0===o?void 0:o.cancel(c)}catch(d){}throw c}if(r(e)&&"gzip"!==n.headers.get("content-encoding")){const e=new DecompressionStream("gzip"),t=n.body.pipeThrough(e);n=new Response(t)}const a=yield n.text();return{json:JSON.parse(a),bytes:2*a.length}}),function(e,t){return b.apply(this,arguments)}),j=(A=t(function*(e,t,r=E,s){try{var i,n;const o=null!==(i=null==s||null===(n=s.resolveURL)||void 0===n?void 0:n.call(s,e))&&void 0!==i?i:e,a=((e,t)=>{const r=null==t?void 0:t.cache;if(!1===r)return{enabled:!1,key:e,clone:!1};if(!0===r)return{enabled:!0,key:e,clone:!0};if(r&&"object"==typeof r){var s,i,n;const t=null===(s=r.enabled)||void 0===s||s;return{enabled:t,key:null!==(i=r.key)&&void 0!==i?i:e,clone:!!t&&(null===(n=r.clone)||void 0===n||n)}}return{enabled:!1,key:e,clone:!1}})(o,s),l=()=>I(o,t,()=>r(e)),c=(yield a.enabled?S.load(a.key,l):l()).json;return{res:a.enabled&&a.clone?structuredClone(c):c,err:void 0}}catch(o){return{res:void 0,err:o}}}),function(e,t){return A.apply(this,arguments)}),B=n,$=(x=t(function*(e,t){const{res:r,err:s}=yield j(B(e,null==t?void 0:t.assetsPrefix),void 0,void 0,(null==t?void 0:t.fetchOptions)||{cache:!0});if(s)throw s;return r}),function(e,t){return x.apply(this,arguments)}),U=["format","schemaVersion","scenes","assets"];function k(e){const t=e.replace(/[?#].*$/,""),r=e.slice(t.length),s=new URL(e,"https://bundle.invalid").pathname;if(/\.zip$/i.test(s)||/(?:^|\/)manifest\.json$/i.test(s))return e;if(/\.[^/]+$/.test(s))throw Error("vis-core 仅支持 ZIP、分包目录或 manifest.json;独立 JSON/GZ 请先通过编辑平台导入并导出 ZIP。");return`${t.replace(/\/$/,"")}/manifest.json${r}`}function O(e,t){return T.apply(this,arguments)}function T(){return(T=t(function*(e,t){try{const r=new Uint8Array(yield e.slice(0,2).arrayBuffer()),s=/\.(gz|gzip)$/i.test(t)||31===r[0]&&139===r[1]?yield new Response(e.stream().pipeThrough(new DecompressionStream("gzip"))).text():yield e.text(),i=JSON.parse(s);if(!i||"object"!=typeof i||Array.isArray(i))throw Error("需要 JSON 对象");return i}catch(r){throw new Error(`无法读取文件 ${t}:${r instanceof Error?r.message:String(r)}`,{cause:r})}})).apply(this,arguments)}function L(e){return N.apply(this,arguments)}function N(){return N=t(function*(r,s="project.zip"){var i;const[{default:n},o,{createTextureFile:a},{SCENE_DOCUMENT_FORMAT:l},{resolveRuntimeImages:c}]=yield Promise.all([import("jszip"),import("./validation-BOlQdEPC.js").then(e=>e.r),import("./dist-CBwlzuju.js").then(e=>e.R),import("./schema-DCtwlcYa.js").then(e=>e.c),import("./runtimeImages-CJx9KQkc.js").then(e=>e.a)]),d=o;let u;try{u=yield n.loadAsync(r instanceof Blob?yield r.arrayBuffer():r)}catch(N){throw new Error(`无法解压 ZIP 文件 ${s}`,{cause:N})}const p=Object.values(u.files).filter(e=>!e.dir&&/(^|\/)manifest\.json$/.test(e.name)&&!e.name.startsWith("__MACOSX/")),f=null!==(i=u.file("manifest.json"))&&void 0!==i?i:1===p.length?p[0]:void 0;if(!f)throw new Error(p.length>1?"ZIP 中有多个 manifest.json,无法确定要导入的项目":"ZIP 中缺少 manifest.json,请选择平台导出的场景分包 ZIP");const h=f.name.slice(0,-13),m=yield O(new Blob([yield f.async("uint8array")]),f.name);d.assertSceneManifest(m);const g=function(){var e=t(function*(e){if(/[:\\?#\0]/.test(e)||e.split("/").some(e=>!e||"."===e||".."===e))throw new Error(`ZIP 内文件路径无效:${e}`);const t=u.file(h+e);if(!t)throw new Error(`ZIP 中缺少文件:${e}`);if(t.unsafeOriginalName&&t.unsafeOriginalName!==t.name)throw new Error(`ZIP 内文件路径无效:${e}`);return new Blob([yield t.async("uint8array")])});return function(t){return e.apply(this,arguments)}}(),v=[];for(const e of m.scenes){var b,A;const t=yield O(yield g(e.source),e.source);if(!(null===(b=t.scene)||void 0===b?void 0:b.object)||t.id!==e.id||(null===(A=t.vis)||void 0===A?void 0:A.type)!==e.vis.type)throw new Error(`场景文件与 manifest 不匹配:${e.source}`);v.push(t)}const{format:x,schemaVersion:S,scenes:E,assets:I}=m,j=e(e({},w(m,U)),{},{format:l,schemaVersion:6,scenes:v});if(d.assertRuntimeSceneDocument(j),j.runtimeAssets){delete j.runtimeAssets.baseUrl;for(const e of j.runtimeAssets.entries){const t=new Uint8Array(yield(yield g(e.path)).arrayBuffer());yield y(e,t),e.data=t.buffer}}const B=/* @__PURE__ */new Map,$={png:"image/png",jpg:"image/jpeg",webp:"image/webp",gif:"image/gif",avif:"image/avif",bmp:"image/bmp"};for(const e of Object.keys(null!=I?I:{})){var k,T,L;const t=new Uint8Array(yield(yield g(e)).arrayBuffer()),r=null!==(k=null!==(T=null==I||null===(L=I[e])||void 0===L?void 0:L.mimeType)&&void 0!==T?T:$[e.split(".").pop()])&&void 0!==k?k:"application/octet-stream";B.set(e,a(t.buffer,r))}return c(j,I,e=>B.get(e)),j}),N.apply(this,arguments)}var M=["assets"],C=e=>i(r(new Uint8Array(e))),P={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array},z={"image/png":"png","image/jpeg":"jpg","image/webp":"webp","image/gif":"gif","image/avif":"avif","image/bmp":"bmp","image/svg+xml":"svg","image/vnd.radiance":"hdr","image/x-tga":"tga","video/mp4":"mp4","video/webm":"webm","video/ogg":"ogv","video/quicktime":"mov","video/x-m4v":"m4v"},D=e=>"string"==typeof e&&/^assets\/[\w.-]+$/.test(e)&&!e.includes("..");function R(e){if(void 0!==e){if(!e||"object"!=typeof e||Array.isArray(e))throw Error("Invalid media asset manifest");for(const[t,r]of Object.entries(e)){if(!D(t)||!r||!/^[a-f0-9]{64}$/.test(r.sha256)||!Number.isSafeInteger(r.bytes)||r.bytes<0||!/^[\w.+-]+\/[\w.+-]+$/.test(r.mimeType)||!["image","hdr","tga","video","pixels"].includes(r.kind))throw Error(`Invalid media asset: ${t}`);if("pixels"===r.kind){const e=r.pixels;if(!e||!Object.hasOwn(P,e.type)||!Number.isSafeInteger(e.width)||e.width<=0||!Number.isSafeInteger(e.height)||e.height<=0||void 0!==e.depth&&(!Number.isSafeInteger(e.depth)||e.depth<=0)||r.bytes%P[e.type].BYTES_PER_ELEMENT)throw Error(`Invalid pixel asset: ${t}`)}else if(void 0!==r.pixels)throw Error(`Unexpected pixel metadata: ${t}`)}}}function _(t,r){if(r instanceof ArrayBuffer&&(r.byteLength!==t.bytes||C(r)!==t.sha256))throw Error("Media resource checksum mismatch");return"pixels"===t.kind?e(e({},t.pixels),{},{encoding:"binary",sha256:t.sha256,data:r}):{encoding:"file",kind:t.kind,mimeType:t.mimeType,sha256:t.sha256,data:r}}var Z=class{constructor(){s(this,"payloads",/* @__PURE__ */new WeakMap),s(this,"graphs",/* @__PURE__ */new WeakMap),s(this,"rows",/* @__PURE__ */new WeakMap)}row(t,r,s){const i=this.rows.get(t);if(i&&i.graph===s)return i.row;const n=e(e({},t),{},{[r]:s});return this.rows.set(t,{graph:s,row:n}),n}writePayload(t){var r;if("string"==typeof t){const e=/^data:((?:image|video)\/[^;,]+);base64,([\s\S]*)$/i.exec(t);if(!e)return;const r=p(e[2]).buffer;t={encoding:"file",kind:e[1].toLowerCase().startsWith("video/")?"video":"image",mimeType:e[1],sha256:C(r),data:r}}if(!t||"object"!=typeof t)return;const s=this.payloads.get(t);if(s)return s;let i,n;if("file"===t.encoding){if(!(t.data instanceof ArrayBuffer))throw Error("Media export requires owned file bytes");if(i=t.data,n={kind:t.kind,mimeType:t.mimeType,sha256:C(i),bytes:i.byteLength},n.sha256!==t.sha256)throw Error("Media resource checksum mismatch")}else{if(!("binary"===t.encoding||Object.hasOwn(P,t.type)&&(Array.isArray(t.data)||ArrayBuffer.isView(t.data))))return;{const r=P[t.type];if(!r)throw Error("Invalid pixel array type");if("binary"===t.encoding){if(!(t.data instanceof ArrayBuffer)||C(t.data)!==t.sha256)throw Error("Invalid binary pixel resource");i=t.data}else{const e=Array.isArray(t.data)?new r(t.data):t.data;i=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}n={kind:"pixels",mimeType:"application/octet-stream",sha256:C(i),bytes:i.byteLength,pixels:e({type:t.type,width:t.width,height:t.height},void 0===t.depth?{}:{depth:t.depth})}}}const o=n.pixels?"-"+C((new TextEncoder).encode(JSON.stringify(n.pixels)).buffer).slice(0,16):"",a="pixels"===n.kind?"bin":null!==(r=z[n.mimeType])&&void 0!==r?r:"bin",l=`assets/${"video"===n.kind?"video":"image"}-${n.sha256}${o}.${a}`;R({[l]:n});const c={path:l,info:n,file:{data:new Uint8Array(i),mimeType:n.mimeType}};return this.payloads.set(t,c),c}prepare(t){var r;const s={},i={};if(void 0!==t._resourcePool||void 0!==t.imageAssets)throw Error("Import legacy resources in editor-platform");const n=e=>{s[e.path]=e.info,i[e.path]=e.file},o=t=>{if(!t)return t;const r=this.graphs.get(t);if(r)return r.files.forEach(n),r.graph;const s=/* @__PURE__ */new Map,i=e=>{const t=e;if(Array.isArray(t))return t.map(i);const r=this.writePayload(t);return r?(s.set(r.path,r),r.path):t},o=e({},t);t.images&&(o.images=t.images.map(t=>e(e({},t),{},{url:i(t.url)}))),t.textures&&(o.textures=t.textures.map(r=>{let s=r.userData;if(!s)return r;if(void 0!==s._dataTexBase64||"number"==typeof s._videoSrc||void 0!==t._texDataPool)throw Error("Import legacy texture data in editor-platform");return void 0!==s._videoSrc&&(s=e(e({},s),{},{_videoSrc:i(s._videoSrc)})),s===r.userData?r:e(e({},r),{},{userData:s})}));const a=[...s.values()];return a.forEach(n),this.graphs.set(t,{graph:o,files:a}),o},{assets:a}=t,l=e({},w(t,M));if(t.scene&&(l.scene=o(t.scene)),t.scenes&&(l.scenes=t.scenes.map(e=>this.row(e,"scene",o(e.scene)))),t.materialLibrary&&(l.materialLibrary=t.materialLibrary.map(e=>this.row(e,"material",o(e.material)))),t.prefabLibrary&&(l.prefabLibrary=t.prefabLibrary.map(e=>this.row(e,"snapshot",o(e.snapshot)))),null===(r=t.d)||void 0===r?void 0:r.chartBg){const r=t.d.chartBg,s=o({images:r.images,textures:[r]});l.d=e(e({},t.d),{},{chartBg:e(e({},s.textures[0]),s.images?{images:s.images}:{})})}return{document:l,assets:s,files:i}}};function K(e,t,r){var s,i,n,o;if(!t)return;R(t);const a=/* @__PURE__ */new Map,l=e=>{if(Array.isArray(e))return e.map(l);if("string"!=typeof e)return e;if(!Object.hasOwn(t,e)){if(/^assets\/(image|video)-[a-f0-9]{64}[.-]/.test(e))throw Error(`Missing media asset metadata: ${e}`);return e}return a.has(e)||a.set(e,_(t[e],r(e,t[e]))),a.get(e)},c=e=>{var t,r,s;for(const i of null!==(t=null==e?void 0:e.images)&&void 0!==t?t:[])i.url=l(i.url);for(const i of null!==(r=null==e?void 0:e.textures)&&void 0!==r?r:[])void 0!==(null===(s=i.userData)||void 0===s?void 0:s._videoSrc)&&(i.userData._videoSrc=l(i.userData._videoSrc))};c(e.scene);for(const d of null!==(s=e.scenes)&&void 0!==s?s:[])c(d.scene);for(const d of null!==(i=e.materialLibrary)&&void 0!==i?i:[])c(d.material);for(const d of null!==(n=e.prefabLibrary)&&void 0!==n?n:[])c(d.snapshot);(null===(o=e.d)||void 0===o?void 0:o.chartBg)&&c({images:e.d.chartBg.images,textures:[e.d.chartBg]})}var V="undefined"!=typeof crypto&&void 0!==crypto.subtle;function F(e){const t=e.replace(/-----BEGIN PUBLIC KEY-----/g,"").replace(/-----END PUBLIC KEY-----/g,"").replace(/\s/g,""),r=atob(t),s=new Uint8Array(r.length);for(let i=0;i<r.length;i++)s[i]=r.charCodeAt(i);return s.buffer}function Y(){return(Y=t(function*(e){return crypto.subtle.importKey("spki",F(e),{name:"ECDSA",namedCurve:"P-256"},!1,["verify"])})).apply(this,arguments)}var J="-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEEU2vGIjpJQFRkGxVrw4gZL3dXm/1\nfrZBlUc8gjzam/VNZbT1swQSq/kLPmYH7ZykBvLzp7SpNdvOQ8rAqdSdvg==\n-----END PUBLIC KEY-----";var Q=V?function(e){return Y.apply(this,arguments)}(J):null,W=V?null:new Uint8Array(F(J)).slice(26);function q(e){return G.apply(this,arguments)}function G(){return(G=t(function*(e){let t;try{t=function(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),r=(4-t.length%4)%4,s=atob(t+"=".repeat(r)),i=new Uint8Array(s.length);for(let n=0;n<s.length;n++)i[n]=s.charCodeAt(n);return i}(e)}catch(o){return null}if(t.length<=64)return null;const r=t.slice(0,t.length-64),s=t.slice(t.length-64);let i;try{if(V){const e=yield Q;i=yield crypto.subtle.verify({name:"ECDSA",hash:"SHA-256"},e,s,r)}else{const{p256:e}=yield import("@noble/curves/nist.js");i=e.verify(s,r,W,{lowS:!1})}}catch(a){return null}if(!i)return null;const n=function(e){if(e.length<1)return null;if(123===e[0])try{const t=JSON.parse((new TextDecoder).decode(e));return 2!==t.version||!["runtime","preview"].includes(t.purpose)||"string"!=typeof t.projectId||!t.projectId.trim()||t.projectId.length>64||!Array.isArray(t.adcodes)||!t.adcodes.length||t.adcodes.length>65535||t.adcodes.some(e=>!Number.isInteger(e)||e<0||e>16777215)||new Set(t.adcodes).size!==t.adcodes.length||void 0!==t.expire&&(!Number.isSafeInteger(t.expire)||t.expire<=0)||"preview"===t.purpose&&!t.expire?null:{purpose:t.purpose,projectId:t.projectId,adcodes:t.adcodes,expire:t.expire}}catch(l){return null}const t=e[0],r=!!(2&t),s=!!(4&t),i=!!(8&t);if(-16&t||r&&(s||i))return null;let n,o=1;if(1&t){if(e.length<o+4)return null;n=36e5*((e[o]<<24|e[o+1]<<16|e[o+2]<<8|e[o+3])>>>0),o+=4}let a=null;if(!r){if(e.length<o+1)return null;let t=e[o++];if(i){if(e.length<o+1)return null;t=t<<8|e[o++]}if(!t||e.length!==o+3*t)return null;a=[];for(let r=0;r<t;r++){const t=e[o]<<16|e[o+1]<<8|e[o+2];a.push(t),o+=3}}return o!==e.length?null:{adcodes:a,expire:n,prefixMatch:s}}(r);return n?n.expire&&Date.now()>n.expire?null:n:null})).apply(this,arguments)}function H(e,t,r){return X.apply(this,arguments)}function X(){return(X=t(function*(e,t,r){const s=yield q(t);if(!(null==s?void 0:s.adcodes)||s.prefixMatch||"preview"===s.purpose||void 0!==r&&s.projectId!==r)return!1;const i=new Set(e),n=new Set(s.adcodes);return i.size>0&&i.size===n.size&&[...i].every(e=>n.has(e))})).apply(this,arguments)}function ee(e,t){return te.apply(this,arguments)}function te(){return(te=t(function*(e,t){const r=yield q(t);return!(!(null==r?void 0:r.adcodes)||r.prefixMatch||"preview"===r.purpose)&&r.adcodes.includes(e)})).apply(this,arguments)}var re=(e,t)=>{const r=se(e),s=se(t).map(function(e,t){return e^r[Math.floor(t%r.length)]}).join(",");return btoa(s)};function se(e){const t=[];let r=0;for(let s=0;s<e.length;s++){let i=e.charCodeAt(s);i<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=63&i|128):55296==(64512&i)&&s+1<e.length&&56320==(64512&e.charCodeAt(s+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++s)),t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=63&i|128):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=63&i|128)}return t}export{y as C,a as S,f as _,R as a,o as b,L as c,j as d,$ as f,d as g,c as h,Z as i,k as l,v as m,ee as n,_ as o,w as p,H as r,K as s,re as t,E as u,p as v,g as x,u as y};
|