soonspacejs 2.6.16 → 2.6.17

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/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import*as e from"three";import{Vector3 as t,Euler as n,Box3 as i,Quaternion as r,CubeTextureLoader as s,HalfFloatType as o,EquirectangularReflectionMapping as a,TextureLoader as l,Color as c,Texture as u,Vector2 as h,Matrix4 as d,BufferAttribute as f,BufferGeometry as p,Float32BufferAttribute as g,LineBasicMaterial as m,Line as v,Line3 as y,MathUtils as w,CurvePath as b,LineCurve as A,LineCurve3 as x,Bone as S,Uint16BufferAttribute as T,SkinnedMesh as E,Skeleton as D,AnimationClip as C,VectorKeyframeTrack as I,QuaternionKeyframeTrack as B,Object3D as M,InterpolateLinear as P,InterpolateDiscrete as O,Scene as R,Fog as _,Mesh as k,EdgesGeometry as L,LineSegments as N,MeshStandardMaterial as U,PerspectiveCamera as j,OrthographicCamera as F,WebGLRenderer as z,PCFSoftShadowMap as G,Sphere as H,Camera as V,sRGBEncoding as W,BasicDepthPacking as Y,UnsignedByteType as Q,MeshNormalMaterial as X,WebGLRenderTarget as Z,NearestFilter as K,DepthTexture as q,DepthStencilFormat as J,UnsignedInt248Type as $,UnsignedIntType as ee,LinearEncoding as te,Uniform as ne,RepeatWrapping as ie,LoadingManager as re,LinearFilter as se,RGBAFormat as oe,ShaderMaterial as ae,NoBlending as le,RGBADepthPacking as ce,REVISION as ue,EventDispatcher as he,BackSide as de,DoubleSide as fe,FrontSide as pe,MeshDepthMaterial as ge,FloatType as me,DataTexture as ve,LuminanceFormat as ye,Vector4 as we,Material as be,RedFormat as Ae,RGFormat as xe,ShaderChunk as Se,WebGLCubeRenderTarget as Te,CubeCamera as Ee,PMREMGenerator as De,WebGLMultipleRenderTargets as Ce,FramebufferTexture as Ie,Matrix3 as Be,TangentSpaceNormalMap as Me,GLSL3 as Pe,VideoTexture as Oe,GLBufferAttribute as Re,InterleavedBufferAttribute as _e,Frustum as ke,MOUSE as Le,TOUCH as Ne,Spherical as Ue,MeshBasicMaterial as je,PlaneGeometry as Fe,Clock as ze,Raycaster as Ge,AnimationMixer as He,UVMapping as Ve,ACESFilmicToneMapping as We,NoToneMapping as Ye,LinearToneMapping as Qe,ReinhardToneMapping as Xe,CineonToneMapping as Ze,Sprite as Ke,SpriteMaterial as qe,SphereGeometry as Je,CircleGeometry as $e,ShapeGeometry as et,Shape as tt,AmbientLight as nt,DirectionalLight as it,HemisphereLight as rt,SpotLight as st,PointLight as ot,RectAreaLight as at,Loader as lt,LoaderUtils as ct,FileLoader as ut,ClampToEdgeWrapping as ht,Group as dt,PropertyBinding as ft,NumberKeyframeTrack as pt,LinearMipMapLinearFilter as gt,ImageLoader as mt,InstancedMesh as vt,GridHelper as yt,AxesHelper as wt,Box3Helper as bt,DirectionalLightHelper as At,HemisphereLightHelper as xt,SpotLightHelper as St,PointLightHelper as Tt,Box2 as Et,Plane as Dt,CanvasTexture as Ct,MeshPhongMaterial as It}from"three";export*from"three";import{RGBELoader as Bt}from"three/examples/jsm/loaders/RGBELoader.js";import{GLTFExporter as Mt}from"three/examples/jsm/exporters/GLTFExporter.js";import{RoomEnvironment as Pt}from"three/examples/jsm/environments/RoomEnvironment.js";import Ot from"three/examples/jsm/libs/stats.module.js";import{Sky as Rt}from"three/examples/jsm/objects/Sky.js";import{deinterleaveGeometry as _t}from"three/examples/jsm/utils/BufferGeometryUtils.js";import{WorkerPool as kt}from"three/examples/jsm/utils/WorkerPool.js";import{MeshBVH as Lt,computeBoundsTree as Nt,disposeBoundsTree as Ut,acceleratedRaycast as jt}from"three-mesh-bvh";import{RectAreaLightUniformsLib as Ft}from"three/examples/jsm/lights/RectAreaLightUniformsLib.js";import{TGALoader as zt}from"three/examples/jsm/loaders/TGALoader.js";import{GLTFLoader as Gt}from"three/examples/jsm/loaders/GLTFLoader.js";import{DRACOLoader as Ht}from"three/examples/jsm/loaders/DRACOLoader.js";import*as Vt from"three/examples/jsm/libs/fflate.module.js";import{NURBSCurve as Wt}from"three/examples/jsm/curves/NURBSCurve.js";import{RectAreaLightHelper as Yt}from"three/examples/jsm/helpers/RectAreaLightHelper.js";var Qt,Xt="soonspacejs",Zt="2.6.16",Kt={Linear:{None:function(e){return e}},Quadratic:{In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}},Cubic:{In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},Quartic:{In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}},Quintic:{In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}},Sinusoidal:{In:function(e){return 1-Math.cos(e*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return.5*(1-Math.cos(Math.PI*e))}},Exponential:{In:function(e){return 0===e?0:Math.pow(1024,e-1)},Out:function(e){return 1===e?1:1-Math.pow(2,-10*e)},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(2-Math.pow(2,-10*(e-1)))}},Circular:{In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}},Elastic:{In:function(e){return 0===e?0:1===e?1:-Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)},Out:function(e){return 0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin(5*(e-.1)*Math.PI)+1},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?-.5*Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)+1}},Back:{In:function(e){var t=1.70158;return e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}},Bounce:{In:function(e){return 1-Kt.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?.5*Kt.Bounce.In(2*e):.5*Kt.Bounce.Out(2*e-1)+.5}}},qt="undefined"==typeof self&&"undefined"!=typeof process&&process.hrtime?function(){var e=process.hrtime();return 1e3*e[0]+e[1]/1e6}:"undefined"!=typeof self&&void 0!==self.performance&&void 0!==self.performance.now?self.performance.now.bind(self.performance):void 0!==Date.now?Date.now:function(){return(new Date).getTime()},Jt=function(){function e(){this._tweens={},this._tweensAddedDuringUpdate={}}return e.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map((function(t){return e._tweens[t]}))},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},e.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},e.prototype.update=function(e,t){void 0===e&&(e=qt()),void 0===t&&(t=!1);var n=Object.keys(this._tweens);if(0===n.length)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<n.length;i++){var r=this._tweens[n[i]],s=!t;r&&!1===r.update(e,s)&&!t&&delete this._tweens[n[i]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},e}(),$t={Linear:function(e,t){var n=e.length-1,i=n*t,r=Math.floor(i),s=$t.Utils.Linear;return t<0?s(e[0],e[1],i):t>1?s(e[n],e[n-1],n-i):s(e[r],e[r+1>n?n:r+1],i-r)},Bezier:function(e,t){for(var n=0,i=e.length-1,r=Math.pow,s=$t.Utils.Bernstein,o=0;o<=i;o++)n+=r(1-t,i-o)*r(t,o)*e[o]*s(i,o);return n},CatmullRom:function(e,t){var n=e.length-1,i=n*t,r=Math.floor(i),s=$t.Utils.CatmullRom;return e[0]===e[n]?(t<0&&(r=Math.floor(i=n*(1+t))),s(e[(r-1+n)%n],e[r],e[(r+1)%n],e[(r+2)%n],i-r)):t<0?e[0]-(s(e[0],e[0],e[1],e[1],-i)-e[0]):t>1?e[n]-(s(e[n],e[n],e[n-1],e[n-1],i-n)-e[n]):s(e[r?r-1:0],e[r],e[n<r+1?n:r+1],e[n<r+2?n:r+2],i-r)},Utils:{Linear:function(e,t,n){return(t-e)*n+e},Bernstein:function(e,t){var n=$t.Utils.Factorial;return n(e)/n(t)/n(e-t)},Factorial:(Qt=[1],function(e){var t=1;if(Qt[e])return Qt[e];for(var n=e;n>1;n--)t*=n;return Qt[e]=t,t}),CatmullRom:function(e,t,n,i,r){var s=.5*(n-e),o=.5*(i-t),a=r*r;return(2*t-2*n+s+o)*(r*a)+(-3*t+3*n-2*s-o)*a+s*r+t}}},en=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),tn=new Jt,nn=function(){function e(e,t){void 0===t&&(t=tn),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Kt.Linear.None,this._interpolationFunction=$t.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=en.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.to=function(e,t){return this._valuesEnd=Object.create(e),void 0!==t&&(this._duration=t),this},e.prototype.duration=function(e){return this._duration=e,this},e.prototype.start=function(e){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed)for(var t in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(t),this._valuesStart[t]=this._valuesStartRepeat[t];return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=void 0!==e?"string"==typeof e?qt()+parseFloat(e):e:qt(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},e.prototype._setupProperties=function(e,t,n,i){for(var r in n){var s=e[r],o=Array.isArray(s),a=o?"array":typeof s,l=!o&&Array.isArray(n[r]);if("undefined"!==a&&"function"!==a){if(l){var c=n[r];if(0===c.length)continue;c=c.map(this._handleRelativeValue.bind(this,s)),n[r]=[s].concat(c)}if("object"!==a&&!o||!s||l)void 0===t[r]&&(t[r]=s),o||(t[r]*=1),i[r]=l?n[r].slice().reverse():t[r]||0;else{for(var u in t[r]=o?[]:{},s)t[r][u]=s[u];i[r]=o?[]:{},this._setupProperties(s,t[r],n[r],i[r])}}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},e.prototype.pause=function(e){return void 0===e&&(e=qt()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this)),this},e.prototype.resume=function(e){return void 0===e&&(e=qt()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this):this},e.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},e.prototype.group=function(e){return this._group=e,this},e.prototype.delay=function(e){return this._delayTime=e,this},e.prototype.repeat=function(e){return this._initialRepeat=e,this._repeat=e,this},e.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},e.prototype.yoyo=function(e){return this._yoyo=e,this},e.prototype.easing=function(e){return this._easingFunction=e,this},e.prototype.interpolation=function(e){return this._interpolationFunction=e,this},e.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},e.prototype.onStart=function(e){return this._onStartCallback=e,this},e.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},e.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},e.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},e.prototype.onStop=function(e){return this._onStopCallback=e,this},e.prototype.update=function(e,t){if(void 0===e&&(e=qt()),void 0===t&&(t=!0),this._isPaused)return!0;var n,i,r=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>r)return!1;t&&this.start(e)}if(this._goToEnd=!1,e<this._startTime)return!0;!1===this._onStartCallbackFired&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),i=(e-this._startTime)/this._duration,i=0===this._duration||i>1?1:i;var s=this._easingFunction(i);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,s),this._onUpdateCallback&&this._onUpdateCallback(this._object,i),1===i){if(this._repeat>0){for(n in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[n]||(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=e+this._repeatDelayTime:this._startTime=e+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var o=0,a=this._chainedTweens.length;o<a;o++)this._chainedTweens[o].start(this._startTime+this._duration);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(e,t,n,i){for(var r in n)if(void 0!==t[r]){var s=t[r]||0,o=n[r],a=Array.isArray(e[r]),l=Array.isArray(o);!a&&l?e[r]=this._interpolationFunction(o,i):"object"==typeof o&&o?this._updateProperties(e[r],s,o,i):"number"==typeof(o=this._handleRelativeValue(s,o))&&(e[r]=s+(o-s)*i)}},e.prototype._handleRelativeValue=function(e,t){return"string"!=typeof t?t:"+"===t.charAt(0)||"-"===t.charAt(0)?e+parseFloat(t):parseFloat(t)},e.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];this._valuesStartRepeat[e]="string"==typeof n?this._valuesStartRepeat[e]+parseFloat(n):this._valuesEnd[e],this._valuesEnd[e]=t},e}(),rn=en.nextId,sn=tn,on=sn.getAll.bind(sn),an=sn.removeAll.bind(sn),ln=sn.add.bind(sn),cn=sn.remove.bind(sn),un=sn.update.bind(sn),hn={Easing:Kt,Group:Jt,Interpolation:$t,now:qt,Sequence:en,nextId:rn,Tween:nn,VERSION:"18.6.4",getAll:on,removeAll:an,add:ln,remove:cn,update:un};const dn="[soonspacejs]: ",fn="Group",pn="Light",gn="Model",mn="Poi",vn="PoiNode",yn="Canvas3D",wn="Topology",bn="Helper",An="PluginObject",xn="In soonspacejs: ",Sn=(e,t)=>{let n="";for(const e in t)n+=`${e}: ${t[e]};`;console.log(`%c${e}`,n)},Tn=e=>{console.warn(xn+e)};function En(e){return e instanceof t?e:new t(e.x,e.y,e.z)}function Dn(e){return e instanceof n?e:new n(e.x,e.y,e.z)}function Cn(e){const n=new i(new t,new t).setFromObject(e);return n.isEmpty()&&(e.getWorldPosition(n.min),n.max.copy(n.min)),n}function In(e,t,n){const i=n.clone();return Math.abs(t[e]-n[e])>Math.PI&&(t[e]>n[e]?i[e]+=2*Math.PI:i[e]-=2*Math.PI),i}function Bn(e,t){const i=In("x",e,t),r=In("y",e,t),s=In("z",e,t);return new n(i.x,r.y,s.z,t.order)}function Mn(e){return Math.PI/180*e}function Pn(e){return!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?{position:e.getWorldPosition(new t),rotation:(new n).setFromQuaternion(e.getWorldQuaternion(new r)),scale:e.getWorldScale(new t)}:{position:e.position.clone(),rotation:e.rotation.clone(),scale:e.scale.clone()}}function On(e,t){const n=Pn(t,!(arguments.length>2&&void 0!==arguments[2])||arguments[2]);e.position.copy(n.position),e.rotation.copy(n.rotation),e.scale.copy(n.scale)}function Rn(e){return!!e.visible&&(!e.parent||Rn(e.parent))}class _n{constructor(){this.min=null,this.roots=[],this.nodes=new Map}shift(){const e=this.min;if(null===e||this.roots.length<1)return this.min=null,e;this.remove(e),this.roots.length>50&&this.consolidate();let t=1/0;const n=this.roots.length;for(let e=0;e<n;e++){const n=this.roots[e],i=this.getDistance(n);i<t&&(t=i,this.min=n)}return e}consolidate(){const e=[[],[],[],[],[],[],[]],t=e.length-1,n=this.roots.length;for(let i=0;i<n;i++){const n=this.roots[i],r=this.nodes.get(n);r&&r.depth<t&&e[r.depth].push(n)}for(let n=0;n<=t;n++)for(;e[n].length>1;){const i=e[n].shift(),r=e[n].shift(),s=n+1;let o=-1;if(void 0!==i&&void 0!==r){const n=this.nodes.get(i),a=this.nodes.get(r);n&&a&&(n.distance<a.distance?(n.depth=s,n.children.push(r),a.parent=i,s<=t&&e[s].push(i),o=this.roots.indexOf(r)):(a.depth=s,a.children.push(i),n.parent=r,s<=t&&e[s].push(r),o=this.roots.indexOf(i)))}o>-1&&this.roots.splice(o,1)}}add(e,t){if(this.nodes.set(e,{nodeIndex:e,distance:t,depth:0,parent:null,children:[]}),null===this.min)this.min=e;else{const n=this.nodes.get(this.min);n&&t<n.distance&&(this.min=e)}this.roots.push(e)}update(e,t){this.remove(e),this.add(e,t)}remove(e){var t,n;if(!this.nodes.has(e))return;const i=null===(t=this.nodes.get(e))||void 0===t?void 0:t.children;if(i&&i.length>0)for(let t=0;t<i.length;t++){const n=i[t],r=this.nodes.get(n),s=this.nodes.get(e);r&&s&&(r.parent=s.parent),r&&null===r.parent&&this.roots.push(n)}let r=null===(n=this.nodes.get(e))||void 0===n?void 0:n.parent;if(null===r){const t=this.roots.indexOf(e);t>-1&&this.roots.splice(t,1)}else for(;r;){const e=this.nodes.get(r);e&&(e.depth--,r=e.parent)}}getDistance(e){const t=this.nodes.get(e);return t?t.distance:1/0}}async function kn(e){let{path:t="",file:n}=e;if(Array.isArray(n))return(new s).setPath(t).loadAsync(n);{const e=li(n);if("hdr"===e||"pic"===e){const e=await(new Bt).setPath(t).setDataType(o).loadAsync(n);return e.mapping=a,e}{const e=await(new l).setPath(t).loadAsync(n);return e.mapping=a,e}}}function Ln(e){if(!e)return null;const{colors:t,stops:n,size:i=1024}=e,r=document.createElement("canvas"),s=r.getContext("2d");if(!s)return null;r.width=16,r.height=i;const o=s.createLinearGradient(0,0,0,i),a=new c,l=t.map((e=>a.set(e).getStyle()));for(let e=0,t=l.length-1;e<=t;e++)o.addColorStop(n?n[e]:e/t,l[e]);s.fillStyle=o,s.fillRect(0,0,16,i);const h=new u(r);return h.needsUpdate=!0,h}const Nn=e=>{const t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)};function Un(e){return ni(e)?function(e){return e.map((e=>Un(e)))}(e):ii(e)?function(e){if(ii(e)){const t={};for(const n in e)t[n]=Un(e[n]);return t}return e}(e):e}const jn=(e,t)=>ni(e)?e.map(t):t(e),Fn=e=>jn(e,(e=>e.clone())),zn=e=>jn(e,(e=>e.dispose())),Gn=async e=>{const t=await fetch(e);if(200===t.status)return t;throw new Error(`Failed to fetch file: ${e}`)},Hn=new t,Vn=new t,Wn=new t;function Yn(e,t){const n=Hn.setFromMatrixPosition(e.matrixWorld),i=Vn.setFromMatrixPosition(t.matrixWorld),r=n.sub(i),s=t.getWorldDirection(Wn);return r.angleTo(s)>Math.PI/2}function Qn(e,t,n,i){const r=Hn.setFromMatrixPosition(e.matrixWorld),s=r.clone();s.project(t),n.setFromCamera(new h(s.x,s.y),t);const o=n.intersectObjects(i,!0);if(o.length){const e=o[0].distance;return r.distanceTo(n.ray.origin)<e}return!0}const Xn=e=>{"function"==typeof requestIdleCallback?requestIdleCallback(e):setTimeout(e)};var Zn=function(){function e(){}return e.prototype.toJson=function(e,t){var n=this.xmlStringToXmlDom(e),i=this.xmlToJson(n);return t?(t.removeLineBreaks&&this.removeLineBreaks(i),t.removeComments&&this.removeCommentProperties(i),t.transformTextOnly&&this.transformTextOnly(i),i):i},e.prototype.xmlStringToXmlDom=function(e){return(new DOMParser).parseFromString(e,"text/xml")},e.prototype.removeLineBreaks=function(e){var t=this;Object.keys(e).forEach((function(n,i){"#text"===n&&Array.isArray(e[n])&&delete e[n],"object"==typeof e[n]&&t.removeLineBreaks(e[n])}))},e.prototype.removeCommentProperties=function(e){var t=this;Object.keys(e).forEach((function(n,i){"#comment"===n&&delete e[n],"object"==typeof e[n]&&t.removeCommentProperties(e[n])}))},e.prototype.transformTextOnly=function(e){var t=this;Object.keys(e).forEach((function(n,i){var r=Object.keys(e[n]).length>1,s=Object.keys(e[n])[0];r||"object"==typeof e[n][s]?t.transformTextOnly(e[n]):"object"==typeof e[n]&&e[n]["#text"]&&(e[n]=e[n]["#text"])}))},e.prototype.xmlToJson=function(e){var t={};if(1==e.nodeType){if(e.attributes.length>0){t._attributes={};for(var n=0;n<e.attributes.length;n++){var i=e.attributes.item(n);t._attributes[i.nodeName]=i.nodeValue}}}else 3==e.nodeType&&(t=e.nodeValue);if(e.hasChildNodes())for(var r=0;r<e.childNodes.length;r++){var s=e.childNodes.item(r),o=s.nodeName;if(void 0===t[o])t[o]=this.xmlToJson(s);else{if(void 0===t[o].push){var a=t[o];t[o]=[],t[o].push(a)}t[o].push(this.xmlToJson(s))}}return t},e}();function Kn(e){return Gn(e).then((e=>e.text())).then((e=>Promise.resolve(function(e){return(new Zn).toJson(e,{transformTextOnly:!0,removeComments:!0,removeLineBreaks:!0})}(e))))}class qn{name="EXT_mesh_gpu_instancing";constructor(e){this.writer=e}writeNode(e,n){if(!0!==e.isInstancedMesh)return;const i=e.count,s=new d,o=new Float32Array(3*i),a=new Float32Array(4*i),l=new Float32Array(3*i),c=new t,u=new r,h=new t;for(let t=0;t<i;t++)e.getMatrixAt(t,s),s.decompose(c,u,h),o[3*t]=c.x,o[3*t+1]=c.y,o[3*t+2]=c.z,a[4*t]=u.x,a[4*t+1]=u.y,a[4*t+2]=u.z,a[4*t+3]=u.w,l[3*t]=h.x,l[3*t+1]=h.y,l[3*t+2]=h.z;const p=this.writer,g={};g.attributes={TRANSLATION:p.processAccessor(new f(o,3)),ROTATION:p.processAccessor(new f(a,4)),SCALE:p.processAccessor(new f(l,3))},n.extensions=n.extensions||{},n.extensions[this.name]=g,p.extensionsUsed[this.name]=!0}}const Jn=Object.prototype.hasOwnProperty,$n=e=>"String"===si(e),ei=e=>"Boolean"===si(e),ti=e=>"Number"===si(e),ni=Array.isArray,ii=e=>"Object"===si(e),ri=e=>"Function"===si(e),si=e=>Object.prototype.toString.call(e).slice(8,-1),oi=(e,t,n)=>String.fromCodePoint(...new Uint8Array(e,t,n)),ai=()=>dn+Math.random().toString(36).substring(7).split("").join("_"),li=e=>{var t;const{pathname:n}=new URL(e,location.origin);return null===(t=n.split(".").pop())||void 0===t?void 0:t.toLowerCase()};var ci=Object.freeze({__proto__:null,IVector3ToEuler:Dn,IVector3ToVector3:En,MinHeap:_n,cloneDeep:Un,cloneMaterials:Fn,deg2Euler:Mn,disposeMaterials:zn,error:e=>{console.error(xn+e)},euler2Deg:function(e){return e/(Math.PI/180)},exportGltf:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((n,i)=>{const r=new Mt;r.register((e=>new qn(e))),r.parse(e,(e=>n(e)),(e=>i(e)),t)}))},fetchFile:Gn,getAsciiString:oi,getBoundingBox:Cn,getExtension:li,getSpaceAttributeFromObject:Pn,getTexture:kn,getValueType:si,gradientTexture:Ln,hasOwn:(e,t)=>Jn.call(e,t),idleTask:Xn,isArray:ni,isBoolean:ei,isDate:e=>"Date"===si(e),isFunction:ri,isNull:e=>"Null"===si(e),isNumber:ti,isObject:ii,isObjectBehindCamera:Yn,isObjectOccludeVisible:Qn,isObjectVisible:Rn,isPromise:e=>"Promise"===si(e),isString:$n,isSymbol:e=>"Symbol"===si(e),isUndefined:e=>"Undefined"===si(e),log:Sn,materialHandle:jn,parseFilePath:Nn,randomString:ai,rotationAFix:Bn,rotationAxisFix:In,sleep:e=>new Promise((t=>setTimeout((()=>t()),e))),syncSpaceAttributeToObject:On,warn:Tn,xmlToJson:Kn});const ui={"Linear.None":Kt.Linear.None,"Quadratic.In":Kt.Quadratic.In,"Quadratic.Out":Kt.Quadratic.Out,"Quadratic.InOut":Kt.Quadratic.InOut,"Cubic.In":Kt.Cubic.In,"Cubic.Out":Kt.Cubic.Out,"Cubic.InOut":Kt.Cubic.InOut,"Quartic.In":Kt.Quartic.In,"Quartic.Out":Kt.Quartic.Out,"Quartic.InOut":Kt.Quartic.InOut,"Quintic.In":Kt.Quintic.In,"Quintic.Out":Kt.Quintic.Out,"Quintic.InOut":Kt.Quintic.InOut,"Sinusoidal.In":Kt.Sinusoidal.In,"Sinusoidal.Out":Kt.Sinusoidal.Out,"Sinusoidal.InOut":Kt.Sinusoidal.InOut,"Exponential.In":Kt.Exponential.In,"Exponential.Out":Kt.Exponential.Out,"Exponential.InOut":Kt.Exponential.InOut,"Circular.In":Kt.Circular.In,"Circular.Out":Kt.Circular.Out,"Circular.InOut":Kt.Circular.InOut,"Elastic.In":Kt.Elastic.In,"Elastic.Out":Kt.Elastic.Out,"Elastic.InOut":Kt.Elastic.InOut,"Back.In":Kt.Back.In,"Back.Out":Kt.Back.Out,"Back.InOut":Kt.Back.InOut,"Bounce.In":Kt.Bounce.In,"Bounce.Out":Kt.Bounce.Out,"Bounce.InOut":Kt.Bounce.InOut};function hi(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;return new Promise(((o,a)=>{const{duration:l=1e3,delay:c=0,repeat:u=!1,mode:h="Linear.None",yoyo:d=!1}=i,f=ui[h],p=new nn(e).to(t,l).easing(f).delay(c).onUpdate((i=>{e instanceof n&&t instanceof n&&i instanceof n&&(i.order=t.order),null==r||r(i,p)})).onComplete((()=>{o()})).onStop((()=>{a("animation stop")})).onStart((()=>{null==s||s(p)}));ti(u)?p.repeat(u):ei(u)&&u&&p.repeat(1/0),p.yoyo(d),p.start()}))}class di{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.target=e,this.points=t,this.speed=1,this.reverse=!1,this.needsRotate=!0,this.index=1,this._tween=null,Object.assign(this,n)}get isPlaying(){var e;return!!(null===(e=this._tween)||void 0===e?void 0:e.isPlaying())}async play(){if(this.isPlaying)return!1;this.index=1;let e=this.points.slice();return this.reverse&&(e=e.reverse()),this._play(e)}async _play(e){var t,n;const{target:i}=this,r=null!==(t=this.speed)&&void 0!==t?t:1,s=this.index;let o=e[s-1];if(!o)return!0;o.isVector3||(o=En(o)),o=o.clone();let a=e[s];if(!a)return!0;a.isVector3||(a=En(a).clone()),a=a.clone();const l=o.distanceTo(a)/r;this.needsRotate&&(1===s&&i.parent&&i.position.copy(i.parent.worldToLocal(o.clone())),i.lookAt(a)),await hi(o,a,{duration:l},((e,t)=>{var n;if(i.parent){const t=i.parent.worldToLocal(e.clone());i.position.copy(t)}null===(n=this.onUpdate)||void 0===n||n.call(this,e,t)}),(e=>{var t,n;1===s&&(null===(t=this.onStart)||void 0===t||t.call(this,e)),null===(n=this.onEveryStart)||void 0===n||n.call(this,e),this._tween=e})),null===(n=this.onPoint)||void 0===n||n.call(this,s,a),this.index++,await this._play(e)}pause(){var e;null===(e=this._tween)||void 0===e||e.pause()}resume(){var e;null===(e=this._tween)||void 0===e||e.resume()}stop(){var e;null===(e=this._tween)||void 0===e||e.stop(),this._tween=null}}var fi=Object.defineProperty,pi=(e,t,n)=>(((e,t,n)=>{t in e?fi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);function gi(e,t){if(t=t??e.arcLengthDivisions,e.cacheArcULengths&&e.cacheArcULengths.length===t+1&&!e.needsUpdate){const n=e.cacheArcULengths;return{lengths:n,length:n[t]}}e.needsUpdate=!1;const n=[0];let i=e.getPoint(0),r=0;for(let s=1;s<=t;s++){const o=e.getPointAt(s/t);r+=o.distanceTo(i),n.push(r),i=o}return e.cacheArcULengths=n,{lengths:n,length:r}}function mi(e,t,n){const i=n?t=>e.getPointAt(t):t=>e.getPoint(t);let r=i(0),s=0;const o=[],a=t.length;for(let e=0;e<a;e++){const n=i(t[e]);s+=n.distanceTo(r),o.push(s),r=n}return{lengths:o,length:o[a-1]}}function vi(e,t){let n=e.sampleLength;if(!n){const t=e.sampleNum;if(t)return t;n=1}return Math.ceil(t/n)}function yi(e){const{curve:t}=e;let n=t.getLength();const i=vi(e,n);return t.arcLengthDivisions<i&&(t.arcLengthDivisions=i,t.updateArcLengths(),n=t.getLength()),{length:n,division:i}}function wi(e,t){const n=vi(t??{},e.getLength()),i=e.getPoints(n),r=e.getLengths(n);return bi(i,{...t,lengths:r})}function bi(e,t){const{startColor:n,endColor:i,color:r,lengths:s}=t??{},o=r?new c(r):null,a=n?new c(n):o??new c(0,1,0),l=i?new c(i):o??new c(0,0,1),u=[],h=[];e[0].toArray(u,0);const d=u.length,f=s??xi(e).lengths,m=f[f.length-1],v=new c;e.forEach(((e,t)=>{e.toArray(u,t*d);const n=f[t]/m;v.lerpColors(a,l,n),v.toArray(h,3*t)}));const y=new p;return y.setAttribute("position",new g(u,d)),y.setAttribute("color",new g(h,3)),y}function Ai(e,t){t=t??{};let{material:n,linewidth:i}=t;i=i??1,n=n??new m({vertexColors:!0,linewidth:i});const r=Array.isArray(e)?bi(e,t):wi(e,t);return new v(r,n)}function xi(e){const t=Si(e),n=[0],i=t.reduce(((e,t)=>(e+=t.distance(),n.push(e),e)),0);return{lines:t,lengths:n,length:i}}function Si(e){const t=[];return e.reduce(((e,n)=>{const i=new y(e,n);return t.push(i),n})),t}function Ti(e,t){const n=[];return{lines:t.filter(((t,i)=>{const r=t.closestPointToPointParameter(e),s=0<=r||r>=1;return s&&n.push(i),s})),indexs:n}}function Ei(e,t){const{distSortIndexs:n,clampDists:i,clampPoints:r,ts:s,clampTs:o}=Di(e,t),a=n[0];return{line:t[a],index:a,clampDist:i[a],clampPoint:r[a],t:s[a],clampT:o[a]}}function Di(e,n){const i={clampDists:[],clampPoints:[],distSortIndexs:[],ts:[],clampTs:[]};return n.forEach(((n,r)=>{const s=n.closestPointToPointParameter(e),o=w.clamp(s,0,1),a=n.at(o,new t),l=e.distanceTo(a);i.clampDists.push(l),i.clampPoints.push(a),i.distSortIndexs.push(r),i.ts.push(s),i.clampTs.push(o)})),i.distSortIndexs.sort(((e,t)=>i.clampDists[e]-i.clampDists[t])),i}function Ci(e){const t=new b,n=null==e[0].z?A:x;return e.reduce(((e,i)=>{const r=new n(e,i);return t.add(r),i})),t}var Ii=(e=>(e.back="back",e.front="front",e))(Ii||{});function Bi(e){const{curve:t,distance:n,fromU:i=0,side:r,tolerance:s=.1*n}=e,o=e.length??t.getLength(),a=t.getPointAt(i);let l=n/o;const c="front"===r?-1:1;let u=!0,h=i,d=a,f=0,p=!0;do{h=c*l+i;let e=!1;h>1?(h=1,e=!0):h<0&&(h=0,e=!0),d=t.getPointAt(h),f=d.distanceTo(a),u=Math.abs(n-f)>s;const r=n/f;if(e&&u&&r>1){p=!1;break}l*=r}while(u);return{succeed:p,u:h,point:d,distance:f}}function Mi(e){const{curve:t,distance:n,fromU:i=0,tolerance:r=.1*n,origin:s}=e,o=e.length??t.getLength(),a=t.getPointAt(i),l=a.distanceTo(s),c=n-l;let u=c/o,h=!0,d=i,f=a;do{d=u+i;let e=!1;d>1?(d=1,e=!0):d<0&&(d=0,e=!0),f=t.getPointAt(d);const o=f.distanceTo(s);h=Math.abs(n-o)>r;const a=c/(o-l);if(e&&h&&a>1)return null;u*=a}while(h);return{u:d,point:f}}const Pi=new t,Oi=new t(1,1,1);new r;const Ri=new d;function _i(e){const{joints:t,axials:n}=e;if(t)var i=Li(t);else i=n?ki(e):Ni(e);return i}function ki(e){const{axials:t,start:n}=e,i=new S;n&&(i.position.copy(n),i.updateMatrix());const r=[i];return t.reduce(((e,t)=>{const n=new S;return n.position.copy(t),e.add(n),r.push(n),n.updateMatrix(),n}),i),i.updateWorldMatrix(!0,!0),r}function Li(e){const t=[];return e.reduce(((e,n)=>{const i=n.clone().sub(e);return t.push(i),n})),ki({axials:t,start:e[0]})}function Ni(e){const{start:t,axial:n}=e;let i=e.number;const r=new Array(i-1);return r.fill(n),ki({axials:r,start:t})}function Ui(e){const{geometry:n,flexible:i=1,axial:s,number:o}=e,a=e.start??new t,l=s.clone().normalize(),c=s.length(),u=o-1,h=(new r).setFromUnitVectors(new t(1,0,0),l),f=(new d).compose(a,h,new t(1,1,1)).invert(),p=n.getAttribute("position").clone(),m=p.count;p.applyMatrix4(f);const v=[],y=[];for(let e=0;e<m;e++){const t=p.getX(e);if(t<0){v.push(0,0,0,0),y.push(1,0,0,0);continue}const n=Math.trunc(t/c);if(n<u){const e=t%c/c*i;v.push(n,n+1,0,0),y.push(1-e,e,0,0)}else v.push(u,0,0,0),y.push(1,0,0,0)}return n.setAttribute("skinIndex",new T(v,4)),n.setAttribute("skinWeight",new g(y,4)),n}function ji(e){const{skeleton:n,geometryFrame:i}=e,r=n.boneInverses[0].clone().invert(),s=n.boneInverses[1].clone().invert();if(i){const e=i.clone().invert();r.premultiply(e),s.premultiply(e)}const o=(new t).setFromMatrixPosition(r),a=(new t).setFromMatrixPosition(s);return a.sub(o),Ui({...e,start:o,axial:a,number:n.bones.length})}function Fi(e){const{skeleton:n,geometry:i,flexible:r=1,geometryFrame:s}=e,o=(null==s?void 0:s.clone().invert())??Ri.clone(),a=n.boneInverses.map((e=>{const n=e.clone().invert().premultiply(o);return(new t).setFromMatrixPosition(n)})),l=Si(a),c=i.getAttribute("position"),u=c.count,h=[],d=[],f=new t;for(let e=0;e<u;e++){f.fromBufferAttribute(c,e);const{index:t,clampT:n}=Ei(f,l),i=n*r;h.push(t,t+1,0,0),d.push(1-i,i,0,0)}return i.setAttribute("skinIndex",new T(h,4)),i.setAttribute("skinWeight",new g(d,4)),i}function zi(e){const{geometry:t}=e,n=e.material??void 0,i=new E(t,n),r=_i(e);i.add(r[0]);const s=new D(r);return i.bind(s),Fi({...e,skeleton:s}),i}function Gi(e){const{skeleton:t}=e,n=Hi(e);return n.updateMatrix(),n.updateMatrixWorld(),n.bind(t),n}function Hi(e){const{target:t,skeleton:n}=e,i=t.geometry,r=new E;return t.copy.call(r,t,!1),Fi({...e,geometry:i,skeleton:n,geometryFrame:t.matrixWorld}),r}function Vi(e){const{target:t}=e;let{skeleton:n}=e;if(n)var i=n.bones[0];else{const t=_i(e);n=new D(t),i=t[0]}t.add(i),t.updateWorldMatrix(!1,!0),n.calculateInverses(),i.removeFromParent();const r=Wi({...e,target:t,skeleton:n});return r.add(i),{model:r,skeleton:n,rootBone:i}}function Wi(e){const{target:t,skeleton:n,parent:i}=e,r=t.isMesh,s=r?Hi({...e,skeleton:n}):t.clone(!1);i&&i.add(s),s.updateMatrixWorld(!0),r&&s.bind(n,t.matrixWorld);const o=t.children;for(const t of o)Wi({...e,target:t,parent:s});return s}function Yi(e){return e.filter((e=>{var t;return!(null!=(t=e.parent)&&t.isBone)}))}function Qi(e){return e.find((e=>{var t;return!(null!=(t=e.parent)&&t.isBone)}))}function Xi(e){return Qi(e)??e[0]}function Zi(e){return e.curve?Ki(e):nr(e)}function Ki(e){const{keyframeTracks:t,duration:n}=qi(e);return new C(e.name,n,t)}function qi(e){const{curve:t,lookDistance:n}=e,i=e.targetPath??"",r=yi(e).division,s=Ji(e,t.getLength()),o=P,a=[],l=er(r),c={...e,duration:s,division:r,ts:l,lookPoint:{distance:n}},u=tr(c),{points:h,rotates:d}=$i(c);if(h.length){const e=[];h.forEach(((t,n)=>{t.toArray(e,3*n)}));const t=new I(`${i}.position`,u,e,o);a.push(t)}if(d.length){const e=[];d.forEach(((t,n)=>{t.toArray(e,4*n)}));const t=new B(`${i}.quaternion`,u,e,o);a.push(t)}return{keyframeTracks:a,duration:s}}function Ji(e,t){let n=e.duration;if(!n){const i=e.speed;if(null==i)throw"缺少选项 duration 或者 speed";if(!t)throw"缺少参数 length";n=t/i}return n}function $i(e){var n,i;const{curve:s,target:o,lookPoint:a,enableUp:l,fixUp:c}=e,u=e.position??!0,h=e.rotate??!0,f=[],p=[],g=[],m={rotates:f,points:p};if(!u&&!h)return m;const v=(e.anchor??Pi).clone(),y=e.ts??e.us,w=!e.ts;if(!y)throw"缺少参数:至少传递 ts 和 us 任意之一";let b=Ri.clone(),A=Ri.clone(),x=Oi.clone(),S=M.DEFAULT_UP;o&&(o.updateWorldMatrix(!0,!1),b=o.matrix,A=o.matrixWorld,x=o.scale,S=o.up);const T=b.clone().invert(),E=A.clone().multiply(T).clone().invert(),D=s.getTangent(0);D.transformDirection(E);const C=(null==(n=e.front)?void 0:n.clone().normalize())??D,I=(null==(i=e.up)?void 0:i.clone().normalize())??S.clone().transformDirection(E);let B=b.clone().setPosition(0,0,0),P=e=>s.getPoint(e),O=e=>s.getTangent(e);w&&(P=e=>s.getPointAt(e),O=e=>s.getTangentAt(e));const R=y.length,_=R-1;let{distance:k,curveLength:L,lengths:N}=a??{};k=k??0;let U=O;0!==k&&(N||(N=mi(s,y,w).lengths),null==L&&(L=N[_]),U=(e,t)=>{const n=P(e);let i=(N[t]+k)/L;return i>1&&(i=1),s.getPointAt(i).sub(n).normalize()});let j=e=>{const t=y[e],n=U(t,e);n.transformDirection(E),g.push(n);const i=e-1,s=i<0,o=s?C:g[i],a=(new r).setFromUnitVectors(o,n);if(!s){const e=f[i];a.multiply(e)}return a};if(l){const e=new t(0,1,0);j=c?function(t){const n=y[t],i=U(n,t);i.transformDirection(E),g.push(i);const s=t-1;let o;if(s<0)o=(new r).setFromUnitVectors(C,i);else{const e=f[s],t=C.clone().applyQuaternion(e);o=(new r).setFromUnitVectors(t,i),o.multiply(e)}const a=I.clone().applyQuaternion(o),l=(new r).setFromUnitVectors(a,e);return o.premultiply(l),o}:function(t){const n=y[t],i=U(n,t);i.transformDirection(E),g.push(i);const s=t-1,o=s<0,a=o?C:g[s],l=(new r).setFromUnitVectors(a,i);if(o){const t=I.clone().applyQuaternion(l);t.projectOnPlane(i);const n=e.clone().projectOnPlane(i),s=(new r).setFromUnitVectors(t,n);l.premultiply(s)}else{const e=f[s];l.multiply(e)}return l}}for(let e=0;e<R;e++){const t=y[e];if(h){const t=j(e);f.push(t),B=(new d).compose(Pi,t,x)}if(u){const e=P(t);e.applyMatrix4(E);const n=v.clone().applyMatrix4(B);e.sub(n),p.push(e)}}return m}function er(e){const t=[];for(let n=0;n<=e;n++)t.push(n/e);return t}function tr(e){const{curve:t,division:n,duration:i}=e,r=t.getLengths(n),s=r[r.length-1];return r.map((e=>e/s*i))}function nr(e){const{smooth:t,points:n}=e;if(!1===t)var{keyframeTracks:i,duration:r}=ir(e);else{const t=Ci(n);var{keyframeTracks:i,duration:r}=qi({...e,curve:t})}return new C(e.name,r,i)}function ir(e){const t=e.targetPath??"",n=e.points,{lines:i,length:r,lengths:s}=xi(n),o=Ji(e,r),a=[],l=s.map((e=>e/r*o)),{points:c,pointTimes:u,rotates:h,rotateTimes:d}=rr({...e,times:l},i);if(c.length){const e=[];c.forEach(((t,n)=>{t.toArray(e,3*n)}));const n=new I(`${t}.position`,u,e,P);a.push(n)}if(h.length){const e=[];h.forEach(((t,n)=>{t.toArray(e,4*n)}));const n=new B(`${t}.quaternion`,d,e,O);a.push(n)}return{keyframeTracks:a,duration:o}}function rr(e,n){var i,s;const{points:o,target:a,times:l,enableUp:c,fixUp:u}=e,h=e.position??!0,f=e.rotate??!0,p=o.length,g=p-1;n=n??Si(o);const m=[],v=[],y=[],w=[],b={rotates:m,points:v,rotateTimes:l,pointTimes:y};if(!h&&!f)return b;const A=(e.anchor??Pi).clone();let x=Ri.clone(),S=Ri.clone(),T=Oi.clone(),E=M.DEFAULT_UP;a&&(a.updateWorldMatrix(!0,!1),x=a.matrix,S=a.matrixWorld,T=a.scale,E=a.up);const D=x.clone().invert(),C=S.clone().multiply(D).clone().invert(),I=n[0].delta(new t);I.transformDirection(C);const B=(null==(i=e.front)?void 0:i.clone().normalize())??I,P=(null==(s=e.up)?void 0:s.clone().normalize())??E.clone().transformDirection(C);let O=x.clone().setPosition(0,0,0),R=O,_=e=>{const i=n[e].delta(new t).normalize();i.transformDirection(C),w.push(i);const s=e-1,o=s<0,a=o?B:w[s],l=(new r).setFromUnitVectors(a,i);if(!o){const e=m[s];l.multiply(e)}return l};if(c){const e=new t(0,1,0);_=u?function(i){const s=n[i].delta(new t).normalize();s.transformDirection(C),w.push(s);const o=i-1;let a;if(o<0)a=(new r).setFromUnitVectors(B,s);else{const e=m[o],t=B.clone().applyQuaternion(e);a=(new r).setFromUnitVectors(t,s),a.multiply(e)}const l=P.clone().applyQuaternion(a),c=(new r).setFromUnitVectors(l,e);return a.premultiply(c),a}:function(i){const s=n[i].delta(new t).normalize();s.transformDirection(C),w.push(s);const o=i-1,a=o<0,l=a?B:w[o],c=(new r).setFromUnitVectors(l,s);if(a){const t=P.clone().applyQuaternion(c);t.projectOnPlane(s);const n=e.clone().projectOnPlane(s),i=(new r).setFromUnitVectors(t,n);c.premultiply(i)}else{const e=m[o];c.multiply(e)}return c}}for(let e=0;e<p;e++){if(f)if(e<g){const t=_(e);m.push(t),O=(new d).compose(Pi,t,T)}else m.push(m[e-1].clone());if(h){const t=l[e],n=o[e].clone();if(n.applyMatrix4(C),e>0){const e=A.clone().applyMatrix4(R),i=n.clone().sub(e);v.push(i),y.push(t)}const i=A.clone().applyMatrix4(O);n.sub(i),v.push(n),y.push(t)}R=O}return b}function sr(e){const t=e.mixer,n=Vi(e),{model:i,skeleton:r}=n,s=or({...e,target:i,skeleton:r});i.animations.push(s);const o=null==t?void 0:t.clipAction(s,i);return{...n,clip:s,action:o}}function or(e){const{boneTracks:t,duration:n}=ar(e),i=t.flat();return new C(e.name,n,i)}function ar(e){const{skeleton:t,targetPath:n}=e,i=t.bones,{times:r,boneSampleDatas:s,duration:o}=lr(e),a=r.length,l=P;return{boneTracks:s.map(((e,t)=>{const{points:s,rotates:o}=e,c=i[t],u=n?`${n}.skeleton.bones[${t}]`:`${c.name||c.uuid}`,h=[],d=[];for(let e=0;e<a;e++)s&&s[e].toArray(h,3*e),o[e].toArray(d,4*e);const f=[];if(s){const e=new I(`${u}.position`,r,h,l);f.push(e)}const p=new B(`${u}.quaternion`,r,d,l);return f.push(p),f})),duration:o}}function lr(e){var n;const{curve:i,skeleton:s,stretch:o}=e,{bones:a,boneInverses:l}=s,c=a[0],u=e.target??c.parent;if(!u)throw"target 或 根骨骼的 parent 不存在";const h=e.tolerance??.1;c.updateWorldMatrix(!0,!0);const{division:f,length:p}=yi(e),{matrixWorld:g}=u,m=g.clone().invert(),v=[],y=[];l.reduce(((e,t)=>{const n=t.clone().invert();v.push(n);const i=e.clone().multiply(n);return y.push(i),t}),m);const w=y[0],b=new t,A=new r,x=new t;w.decompose(b,A,x);const S=Ji(e,p),T=er(f),E=tr({curve:i,division:f,duration:S}),D=T.length,C=[],I=(new t).setFromMatrixPosition(y[1]).negate(),B=l[0],M=null==(n=e.up)?void 0:n.clone().applyMatrix4(g).transformDirection(B),{points:P,rotates:O}=$i({...e,curve:i,ts:T,target:c,rotate:!0,front:I,up:M,anchor:null});for(let e=0;e<D;e++)C.push(g.clone());const R=P.map(((e,t)=>{const n=O[t];n.premultiply(A);const i=(new d).compose(e,n,x);return i.premultiply(g),i})),_=i.getLengths(f).map((e=>e/p)),k=[{points:P,rotates:O,us:_,matrixs:R}],L=o?function(e,t,n){const r=k[e].us[t]-n/p;return{u:r,point:r<0?null:i.getPointAt(r)}}:function(e,t,n){const r=k[e].us[t],{u:s,point:o,succeed:a}=Bi({curve:i,distance:n,fromU:r,length:p,side:Ii.front,tolerance:h*n});return{u:s,point:a?o:null}},N=l.length,U=N-1;for(let e=1;e<N;e++){const n=[],s=[],o=[],a=[];k.push({points:n,rotates:s,us:o,matrixs:a});const l=y[e],c=v[e],u=e-1,h=k[u],f=y[u],p=v[u],{matrixs:g,points:m,rotates:w}=h,b=(new t).setFromMatrixScale(f),A=u-1,x=A<0?C:k[A].matrixs,S=new t,T=new r,E=new t;l.decompose(S,T,E);const I=(new t).setFromMatrixPosition(c).sub((new t).setFromMatrixPosition(p)).length(),B=S.length();for(let t=0;t<D;t++){const{point:c,u:h}=L(u,t,I);o.push(h),s.push(T.clone());const f=g[t];if(h<0||!c){n.push(S);const e=f.clone().multiply(l);a.push(e);continue}const p=x[t];let v=p.clone().invert();const y=c.clone().applyMatrix4(v),A=m[t];y.sub(A).normalize();const D=w[t],C=(new d).compose(A,D,b),M=S.clone().transformDirection(C),P=(new r).setFromUnitVectors(M,y);D.premultiply(P),f.compose(A,D,b),f.premultiply(p);const O=f.clone().invert();c.applyMatrix4(O);const R=c.length();c.copy(S).multiplyScalar(R/B),n.push(c);const _=(new d).compose(c,T,E);if(e===U){const e=i.getTangentAt(h);e.negate().transformDirection(O);const n=(new r).setFromUnitVectors(c.clone().normalize(),e);n.premultiply(T),s[t]=n,_.compose(c,n,E)}_.premultiply(f),a.push(_)}}return{times:E,boneSampleDatas:k,duration:S}}function cr(e){const{boneTracks:t,targetTracks:n,duration:i}=ur(e),r=n.concat(t.flat());return new C(e.name,i,r)}function ur(e){const{skeleton:t,targetPath:n}=e,{times:i,boneSampleDatas:r,duration:s,targetSampleDatas:o}=hr(e),a=i.length,l=t.bones,c=P,u=[],h=[],{points:d,rotates:f}=o;for(let e=0;e<a;e++)d[e].toArray(u,3*e),f[e].toArray(h,4*e);const p=n??"",g=[new I(`${p}.position`,i,u,c),new B(`${p}.quaternion`,i,h,c)];return{boneTracks:r.map(((e,t)=>{const{points:r,rotates:s}=e,o=l[t],u=n?`${n}.skeleton.bones[${t}]`:`${o.name||o.uuid}`,h=[],d=[];for(let e=0;e<a;e++)r&&r[e].toArray(h,3*e),s[e].toArray(d,4*e);const f=[];if(r){const e=new I(`${u}.position`,i,h,c);f.push(e)}const p=new B(`${u}.quaternion`,i,d,c);return f.push(p),f})),targetTracks:g,duration:s}}function hr(e){const{curve:n,skeleton:i,stretch:s}=e,{bones:o,boneInverses:a}=i,l=o[0],c=e.target??l.parent;if(!c)throw"target 或 根骨骼的 parent 不存在";const u=e.tolerance??.1;l.updateWorldMatrix(!0,!0);const{division:h,length:f}=yi(e),{matrix:p,matrixWorld:g,scale:m}=c,v=g.clone().multiply(p.clone().invert()),y=g.clone().invert(),w=[],b=[];a.reduce(((e,t)=>{const n=t.clone().invert();w.push(n);const i=e.clone().multiply(n);return b.push(i),t}),y);const A=b[0],x=new t,S=new r,T=new t;A.decompose(x,S,T);const E=Ji(e,f),D=er(h),C=w[0],I=(new t).setFromMatrixPosition(b[1]).negate().transformDirection(C).transformDirection(y),{rotates:B,points:M}=$i({...e,curve:n,target:c,position:!0,rotate:!0,anchor:x,front:I,ts:D}),P=tr({curve:n,division:h,duration:E}),O=M.map(((e,t)=>{const n=B[t],i=(new d).compose(e,n,m);return i.premultiply(v),i})),R={points:M,rotates:B,matrixs:O},_=[],k=O.map((e=>(_.push(S.clone()),e.clone().multiply(A)))),L=D.length,N=n.getLengths(h).map((e=>e/f)),U=[{rotates:_,us:N,matrixs:k}],j=s?function(e,t,i){const r=U[e].us[t]-i/f;return{u:r,point:r<0?null:n.getPointAt(r)}}:function(e,t,i){const r=U[e].us[t],{u:s,point:o,succeed:a}=Bi({curve:n,distance:i,fromU:r,length:f,side:Ii.front,tolerance:u*i});return{u:s,point:a?o:null}},F=a.length,z=F-1;for(let e=1;e<F;e++){const i=[],s=[],o=[],a=[];U.push({points:i,rotates:s,us:o,matrixs:a});const l=b[e],c=w[e],u=e-1,h=U[u],f=b[u],p=w[u],{matrixs:g,points:m,rotates:v}=h,y=new t,A=new r,x=new t;f.decompose(y,A,x);const S=u-1,T=S<0?O:U[S].matrixs,E=new t,D=new r,C=new t;l.decompose(E,D,C);const I=(new t).setFromMatrixPosition(c).sub((new t).setFromMatrixPosition(p)).length(),B=E.length();for(let t=0;t<L;t++){const{point:c,u:h}=j(u,t,I);o.push(h),s.push(D.clone());const f=g[t];if(h<0||!c){i.push(E);const e=f.clone().multiply(l);a.push(e);continue}const p=T[t];let w=p.clone().invert();const b=c.clone().applyMatrix4(w),S=(null==m?void 0:m[t])??y;b.sub(S).normalize();const M=v[t],P=(new d).compose(S,M,x),O=E.clone().transformDirection(P);M.setFromUnitVectors(O,b),M.premultiply(A),f.compose(S,M,x),f.premultiply(p);const R=f.clone().invert();c.applyMatrix4(R);const _=c.length();c.copy(E).multiplyScalar(_/B),i.push(c);const k=(new d).compose(c,D,C);if(e===z){const e=n.getTangentAt(h);e.negate().transformDirection(R);const i=(new r).setFromUnitVectors(c.clone().normalize(),e);i.premultiply(D),s[t]=i,k.compose(c,i,C)}k.premultiply(f),a.push(k)}}return{times:P,boneSampleDatas:U,targetSampleDatas:R,duration:E}}function dr(e){const{duration:t,tracks:n}=e;return n.map((e=>Array.from(e.times.map((e=>e/t)))))}class fr{constructor(e){pi(this,"_tracksTimeRatios",null),pi(this,"_lastGetTime",0),pi(this,"_lastGetKeyframeIndexs",null),this.clip=e}get tracksTimeRatios(){return this._tracksTimeRatios??(this._tracksTimeRatios=dr(this.clip))}getTracksKeyframeIndexs(e){const{clip:t,_lastGetTime:n}=this,i=e/t.duration,r=this.tracksTimeRatios;this._lastGetTime=e,e<n&&(this._lastGetKeyframeIndexs=null),this._lastGetTime=e;const s=this._lastGetKeyframeIndexs;return this._lastGetKeyframeIndexs=r.map(((e,t)=>{const n=(null==s?void 0:s[t])??0,r=e.length;for(let t=n;t<r;t++)if(i<e[t])return t-1;return r-1}))}getTracksKeyframes(e){const t=this.getTracksKeyframeIndexs(e),n=this.clip.tracks;return t.map(((e,t)=>{let i=null;if(-1!==e){const r=n[t],s=r.getValueSize(),o=e*s,a=o+s;i=Array.from(r.values.slice(o,a))}return{index:e,value:i}}))}}class pr extends fr{constructor(e){super(e.getClip()),pi(this,"_trackNames"),pi(this,"_positionTrackName"),pi(this,"_quaternionTrackName"),pi(this,"_rotationTrackName"),pi(this,"_scaleTrackName"),this.action=e}get time(){return this.action.time}get duration(){return this.clip.duration}get progress(){return this.time/this.duration}set progress(e){this.action.time=e*this.duration}get trackNames(){return this._trackNames??(this._trackNames=this.clip.tracks.map((e=>e.name)))}get keyframeIndexs(){const e=this.getTracksKeyframeIndexs(this.time);return this.trackNames.reduce(((t,n,i)=>(t[n]=e[i],t)),{})}get keyframes(){const e=this.getTracksKeyframes(this.time);return this.trackNames.reduce(((t,n,i)=>(t[n]=e[i],t)),{})}get positionTrackName(){return void 0===this._positionTrackName&&(this._positionTrackName=this.trackNames.find((e=>e.endsWith(".position")))??null),this._positionTrackName}get positionkeyframeIndex(){const e=this.positionTrackName;return e?this.keyframeIndexs[e]:null}get positionKeyframe(){const e=this.positionTrackName;if(e){const{index:n,value:i}=this.keyframes[e];return{index:n,value:i?new t(...i):null}}return null}get quaternionTrackName(){return void 0===this._quaternionTrackName&&(this._quaternionTrackName=this.trackNames.find((e=>e.endsWith(".quaternion")))??null),this._quaternionTrackName}get quaternionKeyframeIndex(){const e=this.quaternionTrackName;return e?this.keyframeIndexs[e]:null}get quaternionKeyframe(){const e=this.quaternionTrackName;if(e){const{index:t,value:n}=this.keyframes[e];return{index:t,value:n?new r(...n):null}}return null}get rotationTrackName(){return void 0===this._rotationTrackName&&(this._rotationTrackName=this.trackNames.find((e=>e.endsWith(".rotation")))??null),this._rotationTrackName}get rotationkeyframeIndex(){const e=this.rotationTrackName;return e?this.keyframeIndexs[e]:null}get rotationKeyframe(){const e=this.rotationTrackName;if(e){const{index:t,value:i}=this.keyframes[e];return{index:t,value:i?new n(...i):null}}return null}get scaleTrackName(){return void 0===this._scaleTrackName&&(this._scaleTrackName=this.trackNames.find((e=>e.endsWith(".scale")))??null),this._scaleTrackName}get scaleKeyframeIndex(){const e=this.scaleTrackName;return e?this.keyframeIndexs[e]:null}get scaleKeyframe(){const e=this.scaleTrackName;if(e){const{index:n,value:i}=this.keyframes[e];return{index:n,value:i?new t(...i):null}}return null}}class gr extends pr{forward(e){const t=this.action;e=Math.abs(e??t.timeScale),t.timeScale=e}backward(e){const t=this.action;e=Math.abs(e??t.timeScale),t.timeScale=-e}}function mr(e){const t=new gr(e);return new Proxy(t,{get:function(e,t,n){return t in e.action?e.action[t]:e[t]},set:function(e,t,n,i){return t in e.action?e.action[t]=n:e[t]=n,!0},deleteProperty:function(e,t){return t in e.action?Reflect.deleteProperty(e.action,t):Reflect.deleteProperty(e,t)},has:function(e,t){return t in e.action||t in e},ownKeys:function(e){return Reflect.ownKeys(e.action).concat(Reflect.ownKeys(e))}})}class vr{constructor(e){pi(this,"_action"),this.setAction(e)}get action(){return this._action}set action(e){this.setAction(e)}setAction(e){this._action=e&&mr(e)}get play(){const e=this.action;return Boolean(e&&e._mixer._isActiveAction(e)&&!e.paused)}set play(e){const t=this.action;t&&(t.paused=!e,e&&0===t.time&&t.play())}stop(){var e;null==(e=this.action)||e.stop()}}function yr(e){var t;null==(t=e.reset)||t.call(e,!0)}class wr extends vr{constructor(e,t=[]){super(e),pi(this,"_updateGUI",null),this.guis=t}get updateGUI(){return this._updateGUI??this.constructor.updateGUI??yr}set updateGUI(e){this._updateGUI=e}get action(){return this._action}set action(e){this.setAction(e),this.updateAllGUI()}updateAllGUI(){for(const e of this.guis)this.updateGUI(e)}}function br(e){const t=new wr(e);return new Proxy(t,{get:function(e,t,n){var i;return t in e?e[t]:null==(i=e.action)?void 0:i[t]},set:function(e,t,n,i){if(t in e)e[t]=n;else{if(!e.action)return!1;e.action[t]=n}return!0},deleteProperty:function(e,t){return t in e?Reflect.deleteProperty(e,t):!!e.action&&Reflect.deleteProperty(e.action,t)},has:function(e,t){return t in e||!!e.action&&t in e.action},ownKeys:function(e){return e.action?Reflect.ownKeys(e).concat(Reflect.ownKeys(e.action)):Reflect.ownKeys(e)}})}function Ar(e,t=1){const n=e.slice().sort(((e,t)=>e-t)),i=[[]];return n.reduce((function(e,n){const r=e[e.length-1];return null==r||n-r<=t?e.push(n):(e=[n],i.push(e)),e}),i[0]),i}function xr(e,t){let{count:n=4,min:i=-1/0,max:r=1/0}=t??{};const s=e[0];i=Math.max(s-n+1,i),r=Math.min(s+n-1,r),n=Math.min(n,r-i+1);const o=[];for(const t of e)i<=t&&t<=r&&o.push(t);const a=Ar(o);a.sort(((e,t)=>t.length-e.length));let l=a.find((e=>e.includes(s)));if(l.length>=n)return l.sort(((t,n)=>e.indexOf(t)-e.indexOf(n))),l=l.slice(0,n),l.sort(((e,t)=>e-t)),l;for(const e of o){i=l[0],r=l[l.length-1];let t=i-e,s=n-l.length;if(t>0&&t<=s)for(let t=e;t<i;t++)l.unshift(t);else if(t=e-r,t>0&&t<=s)for(let t=r+1;t<=e;t++)l.push(t);else;}return l}pi(wr,"updateGUI",yr);var Sr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Tr(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){if(this instanceof e){var n=[null];return n.push.apply(n,arguments),new(Function.bind.apply(t,n))}return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,i.get?i:{enumerable:!0,get:function(){return e[t]}})})),n}var Er={},Dr={},Cr=function(e,t){return Cr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Cr(e,t)};var Ir=function(){return Ir=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Ir.apply(this,arguments)};function Br(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}var Mr=Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]};function Pr(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Or(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,s=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return o}function Rr(e){return this instanceof Rr?(this.v=e,this):new Rr(e)}var _r=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function kr(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function Lr(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}var Nr=Object.freeze({__proto__:null,get __assign(){return Ir},__asyncDelegator:function(e){var t,n;return t={},i("next"),i("throw",(function(e){throw e})),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,r){t[i]=e[i]?function(t){return(n=!n)?{value:Rr(e[i](t)),done:!1}:r?r(t):t}:r}},__asyncGenerator:function(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=n.apply(e,t||[]),s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(e){r[e]&&(i[e]=function(t){return new Promise((function(n,i){s.push([e,t,n,i])>1||a(e,t)}))})}function a(e,t){try{(n=r[e](t)).value instanceof Rr?Promise.resolve(n.value.v).then(l,c):u(s[0][2],n)}catch(e){u(s[0][3],e)}var n}function l(e){a("next",e)}function c(e){a("throw",e)}function u(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}},__asyncValues:function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=Pr(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(n){t[n]=e[n]&&function(t){return new Promise((function(i,r){(function(e,t,n,i){Promise.resolve(i).then((function(t){e({value:t,done:n})}),t)})(i,r,(t=e[n](t)).done,t.value)}))}}},__await:Rr,__awaiter:function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))},__classPrivateFieldGet:kr,__classPrivateFieldIn:function(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)},__classPrivateFieldSet:Lr,__createBinding:Mr,__decorate:function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},__esDecorate:function(e,t,n,i,r,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,l=i.kind,c="getter"===l?"get":"setter"===l?"set":"value",u=!t&&e?i.static?e:e.prototype:null,h=t||(u?Object.getOwnPropertyDescriptor(u,i.name):{}),d=!1,f=n.length-1;f>=0;f--){var p={};for(var g in i)p[g]="access"===g?{}:i[g];for(var g in i.access)p.access[g]=i.access[g];p.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var m=(0,n[f])("accessor"===l?{get:h.get,set:h.set}:h[c],p);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(a=o(m.get))&&(h.get=a),(a=o(m.set))&&(h.set=a),(a=o(m.init))&&r.push(a)}else(a=o(m))&&("field"===l?r.push(a):h[c]=a)}u&&Object.defineProperty(u,i.name,h),d=!0},__exportStar:function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||Mr(t,e,n)},__extends:function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Cr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},__generator:function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},__importDefault:function(e){return e&&e.__esModule?e:{default:e}},__importStar:function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Mr(t,e,n);return _r(t,e),t},__makeTemplateObject:function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},__metadata:function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},__param:function(e,t){return function(n,i){t(n,i,e)}},__propKey:function(e){return"symbol"==typeof e?e:"".concat(e)},__read:Or,__rest:Br,__runInitializers:function(e,t,n){for(var i=arguments.length>2,r=0;r<t.length;r++)n=i?t[r].call(e,n):t[r].call(e);return i?n:void 0},__setFunctionName:function(e,t,n){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})},__spread:function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Or(arguments[t]));return e},__spreadArray:function(e,t,n){if(n||2===arguments.length)for(var i,r=0,s=t.length;r<s;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))},__spreadArrays:function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var i=Array(e),r=0;for(t=0;t<n;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,r++)i[r]=s[o];return i},__values:Pr}),Ur=Tr(Nr),jr={},Fr={},zr={},Gr={};Object.defineProperty(Gr,"__esModule",{value:!0});var Hr=function(){function e(t,n){if(void 0===n&&(n=null),this.nonEmpty=!1,t||n){if(!t)throw new Error("Parameter head cannot be null.");this.head=t,this.tail=n||e.NIL,this.nonEmpty=!0}else{if(e.NIL)throw new Error("Parameters head and tail are null. Use the NIL element instead.");this.nonEmpty=!1}}return Object.defineProperty(e.prototype,"length",{get:function(){if(!this.nonEmpty)return 0;if(this.tail===e.NIL)return 1;for(var t=0,n=this;n.nonEmpty;)++t,n=n.tail;return t},enumerable:!0,configurable:!0}),e.prototype.prepend=function(t){return new e(t,this)},e.prototype.append=function(t){if(!t)return this;if(!this.nonEmpty)return new e(t);if(this.tail===e.NIL)return new e(t).prepend(this.head);for(var n=new e(this.head),i=n,r=this.tail;r.nonEmpty;)i=i.tail=new e(r.head),r=r.tail;return i.tail=new e(t),n},e.prototype.insertWithPriority=function(t){if(!this.nonEmpty)return new e(t);var n=t.priority;if(n>this.head.priority)return this.prepend(t);for(var i=new e(this.head),r=i,s=this.tail;s.nonEmpty;){if(n>s.head.priority)return r.tail=s.prepend(t),i;r=r.tail=new e(s.head),s=s.tail}return r.tail=new e(t),i},e.prototype.filterNot=function(t){if(!this.nonEmpty||null==t)return this;if(t===this.head.listener)return this.tail;for(var n=new e(this.head),i=n,r=this.tail;r.nonEmpty;){if(r.head.listener===t)return i.tail=r.tail,n;i=i.tail=new e(r.head),r=r.tail}return this},e.prototype.contains=function(e){if(!this.nonEmpty)return!1;for(var t=this;t.nonEmpty;){if(t.head.listener===e)return!0;t=t.tail}return!1},e.prototype.find=function(e){if(!this.nonEmpty)return null;for(var t=this;t.nonEmpty;){if(t.head.listener===e)return t.head;t=t.tail}return null},e.prototype.toString=function(){for(var e="",t=this;t.nonEmpty;)e+=t.head+" -> ",t=t.tail;return"[List "+(e+="NIL")+"]"},e.NIL=new e(null,null),e}();Gr.SlotList=Hr;var Vr={};Object.defineProperty(Vr,"__esModule",{value:!0});var Wr=function(){function e(e,t,n,i){void 0===n&&(n=!1),void 0===i&&(i=0),this._enabled=!0,this._once=!1,this._priority=0,this._listener=e,this._once=n,this._signal=t,this._priority=i,this.verifyListener(e)}return e.prototype.execute0=function(){this._enabled&&(this._once&&this.remove(),this._params&&this._params.length?this._listener.apply(null,this._params):this._listener())},e.prototype.execute1=function(e){this._enabled&&(this._once&&this.remove(),this._params&&this._params.length?this._listener.apply(null,[e].concat(this._params)):this._listener(e))},e.prototype.execute=function(e){if(this._enabled){this._once&&this.remove(),this._params&&this._params.length&&(e=e.concat(this._params));var t=e.length;0===t?this._listener():1===t?this._listener(e[0]):2===t?this._listener(e[0],e[1]):3===t?this._listener(e[0],e[1],e[2]):this._listener.apply(null,e)}},Object.defineProperty(e.prototype,"listener",{get:function(){return this._listener},set:function(e){if(null==e)throw new Error("Given listener is null.\nDid you want to set enabled to false instead?");this.verifyListener(e),this._listener=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"once",{get:function(){return this._once},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"priority",{get:function(){return this._priority},enumerable:!0,configurable:!0}),e.prototype.toString=function(){return"[Slot listener: "+this._listener+", once: "+this._once+", priority: "+this._priority+", enabled: "+this._enabled+"]"},Object.defineProperty(e.prototype,"enabled",{get:function(){return this._enabled},set:function(e){this._enabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"params",{get:function(){return this._params},set:function(e){this._params=e},enumerable:!0,configurable:!0}),e.prototype.remove=function(){this._signal.remove(this._listener)},e.prototype.verifyListener=function(e){if(null==e)throw new Error("Given listener is null.");if(null==this._signal)throw new Error("Internal signal reference has not been set yet.")},e}();Vr.Slot=Wr,Object.defineProperty(zr,"__esModule",{value:!0});var Yr=Gr,Qr=Vr,Xr=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.slots=Yr.SlotList.NIL,this.valueClasses=1===e.length&&e[0]instanceof Array?e[0]:e}return Object.defineProperty(e.prototype,"valueClasses",{get:function(){return this._valueClasses},set:function(e){this._valueClasses=e?e.slice():[];for(var t=this._valueClasses.length;t--;)if(!(this._valueClasses[t]instanceof Object))throw new Error("Invalid valueClasses argument: item at index "+t+" should be a Class but was:<"+this._valueClasses[t]+">."+this._valueClasses[t])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numListeners",{get:function(){return this.slots.length},enumerable:!0,configurable:!0}),e.prototype.addOnce=function(e){return this.registerListener(e,!0)},e.prototype.remove=function(e){var t=this.slots.find(e);return t?(this.slots=this.slots.filterNot(e),t):null},e.prototype.removeAll=function(){this.slots=Yr.SlotList.NIL},e.prototype.dispatch=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this._valueClasses.length,i=e.length;if(i<n)throw new Error("Incorrect number of arguments. Expected at least "+n+" but received "+i+".");for(var r=0;r<n;r++)if(!(null===e[r]||e[r]instanceof this._valueClasses[r]||e[r].constructor===this._valueClasses[r]))throw new Error("Value object <"+e[r]+"> is not an instance of <"+this._valueClasses[r]+">.");var s=this.slots;if(s.nonEmpty)for(;s.nonEmpty;)s.head.execute(e),s=s.tail},e.prototype.registerListener=function(e,t){if(void 0===t&&(t=!1),this.registrationPossible(e,t)){var n=new Qr.Slot(e,this,t);return this.slots=this.slots.prepend(n),n}return this.slots.find(e)},e.prototype.registrationPossible=function(e,t){if(!this.slots.nonEmpty)return!0;var n=this.slots.find(e);if(!n)return!0;if(n.once!==t)throw new Error("You cannot addOnce() then add() the same listener without removing the relationship first.");return!1},e}();zr.OnceSignal=Xr,Object.defineProperty(Fr,"__esModule",{value:!0});var Zr=Ur,Kr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Zr.__extends(t,e),t.prototype.add=function(e){return this.registerListener(e)},t}(zr.OnceSignal);Fr.Signal=Kr,Object.defineProperty(jr,"__esModule",{value:!0});var qr=Ur,Jr=Vr,$r=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return qr.__extends(t,e),t.prototype.addWithPriority=function(e,t){return void 0===t&&(t=0),this.registerListenerWithPriority(e,!1,t)},t.prototype.addOnceWithPriority=function(e,t){return void 0===t&&(t=0),this.registerListenerWithPriority(e,!0,t)},t.prototype.registerListener=function(e,t){return void 0===t&&(t=!1),this.registerListenerWithPriority(e,t)},t.prototype.registerListenerWithPriority=function(e,t,n){if(void 0===n&&(n=0),this.registrationPossible(e,t)){var i=new Jr.Slot(e,this,t,n);return this.slots=this.slots.insertWithPriority(i),i}return this.slots.find(e)},t}(Fr.Signal);jr.PrioritySignal=$r,Object.defineProperty(Dr,"__esModule",{value:!0});var es=Ur,ts=function(e){function t(t){void 0===t&&(t=null);for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var r=this;return n=1===n.length&&n[0]instanceof Array?n[0]:n,(r=e.call(this,n)||this)._target=t,r}return es.__extends(t,e),Object.defineProperty(t.prototype,"target",{get:function(){return this._target},set:function(e){e!==this._target&&(this.removeAll(),this._target=e)},enumerable:!0,configurable:!0}),t.prototype.dispatch=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this._valueClasses.length,i=e.length;if(i<n)throw new Error("Incorrect number of arguments. Expected at least "+n+" but received "+i+".");for(var r=0;r<n;r++)if(null!==e[r]&&e[r].constructor!==this._valueClasses[r])throw new Error("Value object <"+e[r]+"> is not an instance of <"+this._valueClasses[r]+">.");var s=e[0];s&&(s.target&&(s=s.clone(),e[0]=s),s.target=this.target,s.currentTarget=this.target,s.signal=this);for(var o=this.slots;o.nonEmpty;)o.head.execute(e),o=o.tail;if(s&&s.bubbles)for(var a=this.target;a&&a.hasOwnProperty("parent")&&(null===(a=a.parent).onEventBubbled||(s.currentTarget=a,a.onEventBubbled(s))););},t}(jr.PrioritySignal);Dr.DeluxeSignal=ts;var ns={};Object.defineProperty(ns,"__esModule",{value:!0});var is=function(){function e(e){void 0===e&&(e=!1),this._bubbles=e}return Object.defineProperty(e.prototype,"signal",{get:function(){return this._signal},set:function(e){this._signal=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},set:function(e){this._target=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentTarget",{get:function(){return this._currentTarget},set:function(e){this._currentTarget=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bubbles",{get:function(){return this._bubbles},set:function(e){this._bubbles=e},enumerable:!0,configurable:!0}),e.prototype.clone=function(){return new e(this._bubbles)},e}();ns.GenericEvent=is;var rs={};Object.defineProperty(rs,"__esModule",{value:!0}),rs.IOnceSignal=Symbol("IOnceSignal");var ss={};Object.defineProperty(ss,"__esModule",{value:!0}),ss.IPrioritySignal=Symbol("IPrioritySignal");var os={};Object.defineProperty(os,"__esModule",{value:!0}),os.ISignal=Symbol("ISignal");var as={};Object.defineProperty(as,"__esModule",{value:!0}),as.ISlot=Symbol("ISlot");var ls={};Object.defineProperty(ls,"__esModule",{value:!0});var cs=Vr,us=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.valueClasses=1===e.length&&e[0]instanceof Array?e[0]:e}return Object.defineProperty(e.prototype,"valueClasses",{get:function(){return this._valueClasses},set:function(e){this._valueClasses=e?e.slice():[];for(var t=this._valueClasses.length;t--;)if("function"!=typeof this._valueClasses[t])throw new Error("Invalid valueClasses argument: item at index "+t+" should be a Class but was:<"+this._valueClasses[t]+"'>."+this._valueClasses[t])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numListeners",{get:function(){return this.slot?1:0},enumerable:!0,configurable:!0}),e.prototype.add=function(e){return this.registerListener(e)},e.prototype.addOnce=function(e){return this.registerListener(e,!0)},e.prototype.remove=function(e){if(this.slot&&this.slot.listener===e){var t=this.slot;return this.slot=null,t}return null},e.prototype.removeAll=function(){this.slot&&this.slot.remove()},e.prototype.dispatch=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this._valueClasses.length,i=e.length;if(i<n)throw new Error("Incorrect number of arguments. Expected at least "+n+" but received "+i+".");for(var r=0;r<n;r++)if(!(null===e[r]||e[r]instanceof this._valueClasses[r]||e[r].constructor===this._valueClasses[r]))throw new Error("Value object <"+e[r]+"> is not an instance of <"+this._valueClasses[r]+">.");this.slot&&this.slot.execute(e)},e.prototype.registerListener=function(e,t){if(void 0===t&&(t=!1),this.slot)throw new Error("You cannot add or addOnce with a listener already added, remove the current listener first.");return this.slot=new cs.Slot(e,this,t)},e}();ls.MonoSignal=us;var hs={};Object.defineProperty(hs,"__esModule",{value:!0});var ds=Ur,fs=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ds.__extends(t,e),t.prototype.addOnce=function(t){var n=e.prototype.addOnce.call(this,t);return this.isDispatched&&(n.execute(this.valueObjects),n.remove()),n},t.prototype.dispatch=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];if(this.isDispatched)throw new Error("You cannot dispatch() a Promise more than once");this.isDispatched=!0,this.valueObjects=t,e.prototype.dispatch.apply(this,t)},t}(zr.OnceSignal);hs.Promise=fs,Object.defineProperty(Er,"__esModule",{value:!0});var ps=Dr;Er.DeluxeSignal=ps.DeluxeSignal;var gs=ns;Er.GenericEvent=gs.GenericEvent;var ms=rs;Er.IOnceSignal=ms.IOnceSignal;var vs=ss;Er.IPrioritySignal=vs.IPrioritySignal;var ys=os;Er.ISignal=ys.ISignal;var ws=as;Er.ISlot=ws.ISlot;var bs=ls;Er.MonoSignal=bs.MonoSignal;var As=zr;Er.OnceSignal=As.OnceSignal;var xs=jr;Er.PrioritySignal=xs.PrioritySignal;var Ss=hs;Er.Promise=Ss.Promise;var Ts=Fr,Es=Er.Signal=Ts.Signal,Ds=Vr;Er.Slot=Ds.Slot;var Cs=Gr;Er.SlotList=Cs.SlotList;const Is=new R;Is.name="Scene";class Bs{constructor(e,t){this.signals=e,this.viewportState=t,this.scene=Is.clone(),this.selectedObjects={edge:[],stroke:[],opacity:[],highlight:[],emissive:[]},this.intersectsList={meshOfModelList:[],poiIconList:[],otherObjList:[],getAll:function(){return[...this.meshOfModelList,...this.poiIconList,...this.otherObjList]}}}addObject(e,t){if(this.viewportState.isDisposed)return this.removeObject(e),void Tn("Scene is disposed");t?t.add(e):this.scene.add(e),this._triggerObjectAdded(e),this.signals.objectAdded.dispatch(e)}removeObject(e){function t(e){var t;e.map&&((t=e.map)&&t.isTexture&&t.dispose()),e.dispose()}e.traverse((e=>{if("Mesh"===e.type){const n=e;n.geometry.dispose(),jn(n.material,t)}e instanceof Eu&&e.element.remove();const{meshOfModelList:n,poiIconList:i,otherObjList:r}=this.intersectsList,s=n.findIndex((t=>t.uuid===e.uuid)),o=i.findIndex((t=>t.uuid===e.uuid)),a=r.findIndex((t=>t.uuid===e.uuid));s>-1&&this.intersectsList.meshOfModelList.splice(s,1),o>-1&&this.intersectsList.poiIconList.splice(o,1),a>-1&&this.intersectsList.otherObjList.splice(a,1)})),e.removeFromParent(),this.signals.objectRemoved.dispatch(e)}openSceneFog(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{color:t=13426943,near:n=500,far:i=5e4}=e;this.scene.fog=new _(t,n,i),this.signals.sceneChanged.dispatch()}closeSceneFog(){this.scene.fog=null,this.signals.sceneChanged.dispatch()}edgeShow(e,t){const n=[],i=e=>{-1===this.selectedObjects.edge.findIndex((t=>t.uuid===e.uuid))&&n.push(e)};return ni(e)?e.forEach((e=>i(e))):ii(e)&&i(e),this.selectedObjects.edge=[...this.selectedObjects.edge,...n],this.signals.outlineChange.dispatch({objects:this.selectedObjects.edge,options:t}),Promise.resolve()}unEdgeShow(e){e||(e=[...this.selectedObjects.edge]);const t=e=>{const t=this.selectedObjects.edge.findIndex((t=>t.uuid===e.uuid));return-1===t||(this.selectedObjects.edge.splice(t,1),this.signals.outlineChange.dispatch({objects:this.selectedObjects.edge})),Promise.resolve()};return ni(e)?Promise.all(e.map((e=>t(e)))):ii(e)?t(e):Promise.resolve()}strokeShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{isOpacityShow:n=!0,color:i=4647927,opacity:r=.2,edgeColor:s=61183,edgeOpacity:o=1}=t,a=e=>{if(-1!==this.selectedObjects.stroke.findIndex((t=>t.uuid===e.uuid)))return Promise.resolve();if(e.userData.strokeGroup)return Promise.resolve();const t=new Su({id:e.uuid});return e.traverse((n=>{if(n instanceof k){const i=new L(n.geometry,89),r=new N(i,new m({color:s,transparent:!0,opacity:o}));On(r,n),e.attach(r),t.add(r)}})),e.userData.strokeGroup=t,this.addObject(t,e),this.selectedObjects.stroke.push(e),Promise.resolve()};return n&&this.opacityShow(e,{color:i,opacity:r}),ni(e)?Promise.all(e.map((e=>a(e)))):ii(e)?a(e):Promise.resolve()}unStrokeShow(e){e||(e=[...this.selectedObjects.stroke]);const t=e=>{if(!e.userData.strokeGroup)return Promise.resolve();this.removeObject(e.userData.strokeGroup),Reflect.deleteProperty(e.userData,"strokeGroup");const t=this.selectedObjects.stroke.findIndex((t=>t.uuid===e.uuid));return-1===t||(this.selectedObjects.stroke.splice(t,1),this.signals.geometryChanged.dispatch(),this.unOpacityShow(e)),Promise.resolve()};return ni(e)?Promise.all(e.map((e=>t(e)))):ii(e)?t(e):Promise.resolve()}opacityShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{color:n="#fff",opacity:i=.8}=t;function r(e){const t=Fn(e);return t.map=null,t.transparent=i<1,t.depthWrite=!t.transparent,t.color.set(n),t.opacity=i,t}const s=e=>(-1!==this.selectedObjects.opacity.findIndex((t=>t.uuid===e.uuid))||(e.traverse((e=>{if(e instanceof k){if(e.userData.material)return;e.userData.material=e.material,e.material=jn(e.material,r)}})),this.signals.materialChanged.dispatch(),this.selectedObjects.opacity.push(e)),Promise.resolve());return ni(e)?Promise.all(e.map((e=>s(e)))):ii(e)?s(e):Promise.resolve()}unOpacityShow(e){e||(e=[...this.selectedObjects.opacity]);const t=e=>new Promise((t=>{const n=this.selectedObjects.opacity.findIndex((t=>t.uuid===e.uuid));-1===n&&t(),this.selectedObjects.opacity.splice(n,1),e.traverse((e=>{if(e instanceof k){if(!e.userData.material)return;zn(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),t()}));return ni(e)?Promise.all(e.map((e=>t(e)))):ii(e)?t(e):Promise.resolve()}highlightShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{color:n="red",opacity:i=1}=t;function r(e){e instanceof U&&(e.color=new c(n),e.opacity=i,e.transparent=i<1,e.depthWrite=!e.transparent)}const s=e=>(-1!==this.selectedObjects.highlight.findIndex((t=>t.uuid===e.uuid))||(e.traverse((e=>{if(e instanceof k){if(e.userData.material)return;e.userData.material=e.material,e.material=Fn(e.material),jn(e.material,r)}})),this.signals.materialChanged.dispatch(),this.selectedObjects.highlight.push(e)),Promise.resolve());return ni(e)?Promise.all(e.map((e=>s(e)))):ii(e)?s(e):Promise.resolve()}unHighlightShow(e){e||(e=[...this.selectedObjects.highlight]);const t=e=>new Promise((t=>{const n=this.selectedObjects.highlight.findIndex((t=>t.uuid===e.uuid));-1===n&&t(),this.selectedObjects.highlight.splice(n,1),e.traverse((e=>{if(e instanceof k){if(!e.userData.material)return;zn(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),t()}));return ni(e)?Promise.all(e.map((e=>t(e)))):ii(e)?t(e):Promise.resolve()}emissiveShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{color:n="red",opacity:i=.3,maxOpacity:r=1,minOpacity:s=0,duration:o=1e3}=t;function a(e){e instanceof U&&(e.emissive.set(n),e.emissiveIntensity=i,0!==o&&hi({emissiveIntensity:r},{emissiveIntensity:s},{duration:o,repeat:!0},(t=>e.emissiveIntensity=t.emissiveIntensity),(t=>e.userData.animation=t)))}const l=e=>(-1!==this.selectedObjects.emissive.findIndex((t=>t.uuid===e.uuid))||(e.traverse((e=>{if(e instanceof k){if(e.userData.material)return;e.userData.material=e.material,e.material=Fn(e.material),jn(e.material,a)}})),this.selectedObjects.emissive.push(e),this.signals.materialChanged.dispatch()),Promise.resolve());return ni(e)?Promise.all(e.map((e=>l(e)))):ii(e)?l(e):Promise.resolve()}unEmissiveShow(e){function t(e){e.userData.animation&&hn.remove(e.userData.animation)}e||(e=[...this.selectedObjects.emissive]);const n=e=>new Promise((n=>{const i=this.selectedObjects.emissive.findIndex((t=>t.uuid===e.uuid));-1===i&&n(),this.selectedObjects.emissive.splice(i,1),e.traverse((e=>{if(e instanceof k){if(!e.userData.material)return;jn(e.material,t),zn(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),n()}));return ni(e)?Promise.all(e.map((e=>n(e)))):ii(e)?n(e):Promise.resolve()}_triggerObjectAdded(e){if(e instanceof xu)if("Model"===e.stype)e.traverse((e=>{if(e instanceof k){-1===this.intersectsList.meshOfModelList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.meshOfModelList.push(e)}}));else if("Poi"===e.stype){-1===this.intersectsList.poiIconList.findIndex((t=>t.uuid===e.icon.uuid))&&this.intersectsList.poiIconList.push(e.icon)}else"Group"===e.stype?e.children.forEach((e=>this._triggerObjectAdded(e))):e.isObject3D&&e.traverse((e=>{if(e instanceof k){-1===this.intersectsList.otherObjList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.otherObjList.push(e)}}));else e.isObject3D&&e.traverse((e=>{if(e instanceof k){-1===this.intersectsList.otherObjList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.otherObjList.push(e)}}))}}class Ms extends M{constructor(e){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof Ms&&e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this}}const Ps=new t,Os=new d,Rs=new d,_s=new t,ks=new t;class Ls{constructor(e){let t,n,i,r;this.viewport=e,this.domElement=document.createElement("div");const s={objects:new WeakMap};this.domElement.style.overflow="hidden",this.getSize=function(){return{width:t,height:n}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),Os.copy(t.matrixWorldInverse),Rs.multiplyMatrices(t.projectionMatrix,Os),o(e,e,t),function(e){const t=function(e){const t=[];return e.traverse((function(e){e instanceof Ms&&t.push(e)})),t}(e).sort((function(e,t){if(e.renderOrder!==t.renderOrder)return t.renderOrder-e.renderOrder;return s.objects.get(e).distanceToCameraSquared-s.objects.get(t).distanceToCameraSquared})),n=t.length;for(let e=0,i=t.length;e<i;e++)t[e].element.style.zIndex=""+(n-e)}(e)},this.setSize=(e,s)=>{t=e,n=s,i=t/2,r=n/2,this.domElement.style.width=e+"px",this.domElement.style.height=s+"px"};const o=(e,t,n)=>{var l;if(e instanceof Ms){const t=e.parent;if(t.occlude){const t=!Yn(e,this.viewport.camera)&&Qn(e,this.viewport.camera,this.viewport.raycaster,this.viewport.scener.intersectsList.getAll());e.visible=t}Ps.setFromMatrixPosition(e.matrixWorld),Ps.applyMatrix4(Rs);const o=Rn(e)&&Ps.z>=-1&&Ps.z<=1&&!0===e.layers.test(n.layers);if(e.userData.prevVisible!==o&&(null===(l=t.onChange)||void 0===l||l.call(t,o),t.elementAutoDisplay&&(e.element.style.display=!0===o?"":"none")),e.userData.prevVisible=o,!0===o){const t=e.element;t.style.transform="translate(-50%,-50%) translate("+(Ps.x*i+i)+"px,"+(-Ps.y*r+r)+"px)",t.parentNode!==this.domElement&&this.domElement.appendChild(t)}const c={distanceToCameraSquared:a(n,e)};s.objects.set(e,c)}for(let i=0,r=e.children.length;i<r;i++)o(e.children[i],t,n)};function a(e,t){return _s.setFromMatrixPosition(e.matrixWorld),ks.setFromMatrixPosition(t.matrixWorld),_s.distanceToSquared(ks)}}}const Ns=new t,Us=new r,js=new t;class Fs extends M{constructor(e){super(),this.isCSS3DObject=!0,this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof Fs&&e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this}}class zs extends Fs{constructor(e){super(e),this.isCSS3DSprite=!0,this.rotation2D=0}copy(e,t){return super.copy(e,t),this.rotation2D=e.rotation2D,this}}const Gs=new d,Hs=new d;class Vs{constructor(e){let t,n,i,r;this.viewport=e,this.domElement=document.createElement("div");const s={camera:{fov:0,style:""},objects:new WeakMap};this.domElement.style.overflow="hidden";const o=document.createElement("div");o.style.transformOrigin="0 0",this.domElement.appendChild(o);const a=document.createElement("div");function l(e){return Math.abs(e)<1e-10?0:e}function c(e){const t=e.elements;return"matrix3d("+l(t[0])+","+l(-t[1])+","+l(t[2])+","+l(t[3])+","+l(t[4])+","+l(-t[5])+","+l(t[6])+","+l(t[7])+","+l(t[8])+","+l(-t[9])+","+l(t[10])+","+l(t[11])+","+l(t[12])+","+l(-t[13])+","+l(t[14])+","+l(t[15])+")"}function u(e){const t=e.elements;return"translate(-50%,-50%)"+("matrix3d("+l(t[0])+","+l(t[1])+","+l(t[2])+","+l(t[3])+","+l(-t[4])+","+l(-t[5])+","+l(-t[6])+","+l(-t[7])+","+l(t[8])+","+l(t[9])+","+l(t[10])+","+l(t[11])+","+l(t[12])+","+l(t[13])+","+l(t[14])+","+l(t[15])+")")}a.style.transformStyle="preserve-3d",o.appendChild(a),this.getSize=()=>({width:t,height:n}),this.render=(e,u)=>{const d=u.projectionMatrix.elements[5]*r;s.camera.fov!==d&&(o.style.perspective=u instanceof j?d+"px":"",s.camera.fov=d),u.view&&u.view.enabled?(o.style.transform=`translate( ${-u.view.offsetX*(t/u.view.width)}px, ${-u.view.offsetY*(n/u.view.height)}px )`,o.style.transform+=`scale( ${u.view.fullWidth/u.view.width}, ${u.view.fullHeight/u.view.height} )`):o.style.transform="",!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===u.parent&&!0===u.matrixWorldAutoUpdate&&u.updateMatrixWorld();let f=0,p=0;u instanceof F&&(f=-(u.right+u.left)/2,p=(u.top+u.bottom)/2);const g=u.view&&u.view.enabled?u.view.height/u.view.fullHeight:1,m=(u instanceof F?`scale( ${g} )scale(`+d+")translate("+l(f)+"px,"+l(p)+"px)"+c(u.matrixWorldInverse):`scale( ${g} )translateZ(`+d+"px)"+c(u.matrixWorldInverse))+"translate("+i+"px,"+r+"px)";s.camera.style!==m&&(a.style.transform=m,s.camera.style=m),h(e,e,u)},this.setSize=(e,s)=>{t=e,n=s,i=t/2,r=n/2,this.domElement.style.width=e+"px",this.domElement.style.height=s+"px",o.style.width=e+"px",o.style.height=s+"px",a.style.width=e+"px",a.style.height=s+"px"};const h=(e,t,n,i)=>{var r;if(e instanceof Fs){const t=e.parent;if(t.occlude){const t=!Yn(e,this.viewport.camera)&&Qn(e,this.viewport.camera,this.viewport.raycaster,this.viewport.scener.intersectsList.getAll());e.visible=t}const i=Rn(e)&&!0===e.layers.test(n.layers);if(e.userData.prevVisible!==i&&(null===(r=t.onChange)||void 0===r||r.call(t,i),t.elementAutoDisplay&&(e.element.style.display=!0===i?"":"none")),e.userData.prevVisible=i,!0===i){let t;e instanceof zs?(Gs.copy(n.matrixWorldInverse),Gs.transpose(),0!==e.rotation2D&&Gs.multiply(Hs.makeRotationZ(e.rotation2D)),e.matrixWorld.decompose(Ns,Us,js),Gs.setPosition(Ns),Gs.scale(js),Gs.elements[3]=0,Gs.elements[7]=0,Gs.elements[11]=0,Gs.elements[15]=1,t=u(Gs)):t=u(e.matrixWorld);const i=e.element,r=s.objects.get(e);if(void 0===r||r.style!==t){i.style.transform=t;const n={style:t};s.objects.set(e,n)}i.parentNode!==a&&a.appendChild(i)}}for(let i=0,r=e.children.length;i<r;i++)h(e.children[i],t,n)}}}class Ws{constructor(e){this.viewport=e,this.internalOptions={enableRenderCss2D:!1,enableRenderCss3D:!1},this.container=this._initContainer(),this.renderer=this._initRenderer(),this.rendererCSS2D=this._initRenderCSS2D(),this.rendererCSS3D=this._initRenderCSS3D(),this.interactiveContainer=this._initInteractiveContainer()}setInternalState(e,t){this.internalOptions[e]=t}getWidth(){return this.renderer.domElement.width}getHeight(){return this.renderer.domElement.height}getMouseRelativeConRatio(e){const t=this.container.getBoundingClientRect();return[(e.offsetX-t.left)/t.width,(e.offsetY-t.top)/t.height]}getMousePoint(e){const t=new h(0,0);return t.fromArray(this.getMouseRelativeConRatio(e)),t}_initContainer(){const e=document.createElement("div");return e.style.position="relative",e.style.width="100%",e.style.height="100%",e}_initRenderer(){const{background:e={},logarithmicDepthBuffer:t}=this.viewport.options,{alpha:n}=e,{offsetWidth:i,offsetHeight:r}=this.container,s=new z({powerPreference:"high-performance",premultipliedAlpha:!0,stencil:!1,antialias:!1,alpha:!1,preserveDrawingBuffer:!0,logarithmicDepthBuffer:t});return s.autoClear=!1,s.setSize(i,r),s.setPixelRatio(self.devicePixelRatio),s.setClearAlpha(n?0:1),s.localClippingEnabled=!0,s.sortObjects=!0,s.shadowMap.enabled=!0,s.shadowMap.type=G,this.container.appendChild(s.domElement),s}_initRenderCSS2D(){const e=new Ls(this.viewport);return e.domElement.id="ssp_view_2DPoi",e.domElement.style.position="absolute",e.domElement.style.top="0",e.domElement.style.width="100%",e.domElement.style.height="100%",e.setSize(this.container.offsetWidth,this.container.offsetHeight),this.container.appendChild(e.domElement),e}_initRenderCSS3D(){const e=new Vs(this.viewport);return e.domElement.id="ssp_view_3DPoi",e.domElement.style.position="absolute",e.domElement.style.top="0",e.domElement.style.width="100%",e.domElement.style.height="100%",e.setSize(this.container.offsetWidth,this.container.offsetHeight),this.container.appendChild(e.domElement),e}_initInteractiveContainer(){return this.rendererCSS3D.domElement}}const Ys=new d,Qs=(e,t)=>{const i=Ys.clone(),r=Ys.clone(),s=Ys.clone();i.makeRotationY(e),r.makeRotationX(t);const o=new n;return s.multiplyMatrices(i,r),o.setFromRotationMatrix(s),o},Xs=Qs(-Math.PI/2,-Math.PI/4),Zs=Qs(Math.PI/2,-Math.PI/4),Ks=Qs(-Math.PI/4,-Math.PI/4),qs=Qs(Math.PI/4,-Math.PI/4),Js=Qs(1.25*Math.PI,-Math.PI/4),$s=Qs(.75*Math.PI,-Math.PI/4),eo={LEFT:new n(0,-Math.PI/2,0),RIGHT:new n(0,Math.PI/2,0),FRONT:new n(0,0,0),BACK:new n(0,Math.PI,0),TOP:new n(-Math.PI/2,0,0),BOTTOM:new n(Math.PI/2,0,0),FRONTTOP:new n(-Math.PI/4,0,0),BACKTOP:new n(Math.PI/4,Math.PI,0),LEFTTOP:new n(Xs.x,Xs.y,Xs.z),RIGHTTOP:new n(Zs.x,Zs.y,Zs.z),LEFTFRONTTOP:new n(Ks.x,Ks.y,Ks.z),RIGHTFRONTTOP:new n(qs.x,qs.y,qs.z),LEFTBACKTOP:new n(Js.x,Js.y,Js.z),RIGHTBACKTOP:new n($s.x,$s.y,$s.z)},to=e=>ti(e)?e:e.includes("%")?.01*Number(e.split("%")[0]):isNaN(+e)?0:Number(e),no=new t,io=new n,ro=new j(50,1,.1,5e5);ro.position.set(500,1e3,500),ro.lookAt(no.set(0,0,0)),ro.name="Camera";class so{constructor(e){this.viewport=e,this.mainCamera=ro.clone(),this.mainCamera.name="freeCamera",this.currentCamera=this.mainCamera,this.cameras={}}createCamera(e){const t=ro.clone();return t.name=e,this.cameras[e]=t,t}removeCamera(e){return"fullFreeCamera"!==e&&(delete this.cameras[e],!0)}setCurrentCamera(e){this.currentCamera=this.viewport.camera=e,this.viewport.signals.cameraObjectChange.dispatch()}getMainCamera(){return this.mainCamera}getCameraViewpoint(){if("free"===this.viewport.controls.options.type)return{position:this.currentCamera.position.clone(),rotation:{x:this.currentCamera.rotation.x,y:this.currentCamera.rotation.y,z:this.currentCamera.rotation.z}};{const e=this.viewport.controls.currentControls;return{position:this.currentCamera.position.clone(),target:e.target.clone()}}}setCameraViewpoint(e){if("free"===this.viewport.controls.options.type&&ii(e)){const{position:t,rotation:n}=e;this.currentCamera.position.set(t.x,t.y,t.z),this.currentCamera.rotation.set(n.x,n.y,n.z)}else if(ii(e)){const{position:t,target:n}=e,i=this.viewport.controls.currentControls;this.currentCamera.position.set(t.x,t.y,t.z),i.target.set(n.x,n.y,n.z)}this.viewport.signals.cameraChange.dispatch(this.currentCamera.position.clone())}moveTo(e,t){return hi(this.currentCamera.position,e,t,(e=>this.viewport.signals.cameraChange.dispatch(e)))}rotateTo(e,t){const n=this.currentCamera.quaternion.clone(),i=(new r).setFromEuler(e);return hi({t:0},{t:1},t,(e=>{let{t:t}=e;this.currentCamera.quaternion.slerpQuaternions(n,i,t)}))}async flyTo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",i=arguments.length>2?arguments[2]:void 0;if($n(t)){const e=t.toLocaleUpperCase();"CURRENT"===e?io.copy(this.currentCamera.rotation):eo[e]&&io.copy(eo[e])}else t instanceof n?io.copy(t):ii(t)&&io.set(t.x,t.y,t.z);io.copy(Bn(this.currentCamera.rotation,io.clone())),await Promise.all([this.moveTo(e,i),this.rotateTo(io,i)])}async flyToBoundingBox(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",i=arguments.length>2?arguments[2]:void 0;if(e.isEmpty())return void Tn("target box is empty");const r=this.viewport.controls.options.type,s=new t;if($n(n)){if("CURRENT"===n.toLocaleUpperCase())s.copy(this.getMovePosByBBox(e));else{const t=eo[n.toLocaleUpperCase()],i=this.getObjectLabelPos(e,t);s.copy(i)}}else{"orbit"===r&&Tn("orbit 控制器不支持 Rotation 类型 的 rotation 参数");const t=Dn(n),i=this.getObjectLabelPos(e,t);s.copy(i)}if("orbit"===r){const t=e.getCenter(no),i=this.viewport.controls.currentControls;i.target.copy(t);const r=new d;r.lookAt(s,t,i.object.up),n=io.setFromRotationMatrix(r)}await this.flyTo(s,n,i)}flyToObj(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e instanceof Bu||e instanceof Eu){const{padding:t=50}=i,r=to(t);return this.flyToBoundingBox(e.getBoundingBox(r),n,i)}{const{padding:r="30%"}=i,s=Cn(e),o=s.getSize(no);let a=0;if($n(r)){const e=Math.max(o.x,o.y,o.z);a=to(r)*e}else a=r;let l=a,c=a;if(a<0){const e=Math.min(o.x,o.z),t=o.y-1;l=Math.abs(a)>e?-e:a,c=Math.abs(l)>t?-t:l}return 0!==r&&(s.max.add(no.set(l/2,c/2,l/2)),s.min.sub(no.set(l/2,c/2,l/2))),s.isEmpty()&&(no.setFromMatrixPosition(e.matrixWorld),s.setFromCenterAndSize(no,new t(0,0,0))),this.flyToBoundingBox(s,n,i)}}surroundOnTarget(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{speed:n=1,angle:i=360,onStart:r}=t,s=En(e),o=s.clone().setY(this.currentCamera.position.y).distanceTo(this.currentCamera.position),a=Math.abs(i);return hi({angle:0},{angle:Math.PI/180*a},{duration:a/360*5e3/n},(e=>{const t=i>0?e.angle:2*Math.PI-e.angle;if(this.currentCamera.position.x=Math.sin(t)*o+s.x,this.currentCamera.position.z=Math.cos(t)*o+s.z,"orbit"===this.viewport.controls.options.type){const e=this.viewport.controls.currentControls;e.target.copy(s),e.update()}else this.currentCamera.lookAt(s)}),r)}surroundOnObject(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=(new i).setFromObject(e).getCenter(no);return this.surroundOnTarget(n,t)}getMovePosByBBox(e){const n=this.currentCamera.position,i=e.getCenter(no);(new t).subVectors(i,n).normalize();let r=new H;r=e.getBoundingSphere(r);const s=this.currentCamera.fov/2*Math.PI/180,o=Math.sin(s),a=r.radius/o,l=new t;this.currentCamera.getWorldDirection(l);const c=l.clone();return c.multiplyScalar(-a),i.clone().add(c)}getObjectLabelPos(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e instanceof xu&&(e=(new i).setFromObject(e)),e.isEmpty())return Tn("target box is empty"),new t;const{extendScale:s=1.6,mode:o="scene"}=r;if("scene"===o){const t=e.getCenter(no),i=e.max.clone().sub(e.min),r=Math.max(i.x,i.y,i.z),o=t.clone(),a=e=>{const t=(s-.5)*Math.abs(r),n=Math.max(t,this.viewport.camera.near);o.add(e.multiplyScalar(n))};let l;return l=$n(n)?eo[n.toLocaleUpperCase()]:Dn(n),a(no.set(0,0,1).applyEuler(l)),o}return"screen"===o?e.getCenter(no).clone():new t}}
1
+ import*as e from"three";import{Vector3 as t,Euler as n,Box3 as i,Quaternion as r,CubeTextureLoader as s,HalfFloatType as o,EquirectangularReflectionMapping as a,TextureLoader as l,Color as c,Texture as u,Vector2 as h,Matrix4 as d,BufferAttribute as f,BufferGeometry as p,Float32BufferAttribute as g,LineBasicMaterial as m,Line as v,Line3 as y,MathUtils as w,CurvePath as b,LineCurve as A,LineCurve3 as x,Bone as S,Uint16BufferAttribute as T,SkinnedMesh as E,Skeleton as D,AnimationClip as C,VectorKeyframeTrack as I,QuaternionKeyframeTrack as B,Object3D as M,InterpolateLinear as P,InterpolateDiscrete as O,Scene as R,Fog as _,Mesh as k,EdgesGeometry as L,LineSegments as N,MeshStandardMaterial as U,PerspectiveCamera as j,OrthographicCamera as F,WebGLRenderer as z,PCFSoftShadowMap as G,Sphere as H,Camera as V,sRGBEncoding as W,BasicDepthPacking as Y,UnsignedByteType as Q,MeshNormalMaterial as X,WebGLRenderTarget as Z,NearestFilter as K,DepthTexture as q,DepthStencilFormat as J,UnsignedInt248Type as $,UnsignedIntType as ee,LinearEncoding as te,Uniform as ne,RepeatWrapping as ie,LoadingManager as re,LinearFilter as se,RGBAFormat as oe,ShaderMaterial as ae,NoBlending as le,RGBADepthPacking as ce,REVISION as ue,EventDispatcher as he,BackSide as de,DoubleSide as fe,FrontSide as pe,MeshDepthMaterial as ge,FloatType as me,DataTexture as ve,LuminanceFormat as ye,Vector4 as we,Material as be,RedFormat as Ae,RGFormat as xe,ShaderChunk as Se,WebGLCubeRenderTarget as Te,CubeCamera as Ee,PMREMGenerator as De,WebGLMultipleRenderTargets as Ce,FramebufferTexture as Ie,Matrix3 as Be,TangentSpaceNormalMap as Me,GLSL3 as Pe,VideoTexture as Oe,GLBufferAttribute as Re,InterleavedBufferAttribute as _e,Frustum as ke,MOUSE as Le,TOUCH as Ne,Spherical as Ue,MeshBasicMaterial as je,PlaneGeometry as Fe,Clock as ze,Raycaster as Ge,AnimationMixer as He,UVMapping as Ve,ACESFilmicToneMapping as We,NoToneMapping as Ye,LinearToneMapping as Qe,ReinhardToneMapping as Xe,CineonToneMapping as Ze,Sprite as Ke,SpriteMaterial as qe,SphereGeometry as Je,CircleGeometry as $e,ShapeGeometry as et,Shape as tt,AmbientLight as nt,DirectionalLight as it,HemisphereLight as rt,SpotLight as st,PointLight as ot,RectAreaLight as at,Loader as lt,LoaderUtils as ct,FileLoader as ut,ClampToEdgeWrapping as ht,Group as dt,PropertyBinding as ft,NumberKeyframeTrack as pt,LinearMipMapLinearFilter as gt,ImageLoader as mt,InstancedMesh as vt,GridHelper as yt,AxesHelper as wt,Box3Helper as bt,DirectionalLightHelper as At,HemisphereLightHelper as xt,SpotLightHelper as St,PointLightHelper as Tt,Box2 as Et,Plane as Dt,CanvasTexture as Ct,MeshPhongMaterial as It}from"three";export*from"three";import{RGBELoader as Bt}from"three/examples/jsm/loaders/RGBELoader.js";import{GLTFExporter as Mt}from"three/examples/jsm/exporters/GLTFExporter.js";import{RoomEnvironment as Pt}from"three/examples/jsm/environments/RoomEnvironment.js";import Ot from"three/examples/jsm/libs/stats.module.js";import{Sky as Rt}from"three/examples/jsm/objects/Sky.js";import{deinterleaveGeometry as _t}from"three/examples/jsm/utils/BufferGeometryUtils.js";import{WorkerPool as kt}from"three/examples/jsm/utils/WorkerPool.js";import{MeshBVH as Lt,computeBoundsTree as Nt,disposeBoundsTree as Ut,acceleratedRaycast as jt}from"three-mesh-bvh";import{RectAreaLightUniformsLib as Ft}from"three/examples/jsm/lights/RectAreaLightUniformsLib.js";import{TGALoader as zt}from"three/examples/jsm/loaders/TGALoader.js";import{GLTFLoader as Gt}from"three/examples/jsm/loaders/GLTFLoader.js";import{DRACOLoader as Ht}from"three/examples/jsm/loaders/DRACOLoader.js";import*as Vt from"three/examples/jsm/libs/fflate.module.js";import{NURBSCurve as Wt}from"three/examples/jsm/curves/NURBSCurve.js";import{RectAreaLightHelper as Yt}from"three/examples/jsm/helpers/RectAreaLightHelper.js";var Qt,Xt="soonspacejs",Zt="2.6.17",Kt={Linear:{None:function(e){return e}},Quadratic:{In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}},Cubic:{In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},Quartic:{In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}},Quintic:{In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}},Sinusoidal:{In:function(e){return 1-Math.cos(e*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return.5*(1-Math.cos(Math.PI*e))}},Exponential:{In:function(e){return 0===e?0:Math.pow(1024,e-1)},Out:function(e){return 1===e?1:1-Math.pow(2,-10*e)},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(2-Math.pow(2,-10*(e-1)))}},Circular:{In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}},Elastic:{In:function(e){return 0===e?0:1===e?1:-Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)},Out:function(e){return 0===e?0:1===e?1:Math.pow(2,-10*e)*Math.sin(5*(e-.1)*Math.PI)+1},InOut:function(e){return 0===e?0:1===e?1:(e*=2)<1?-.5*Math.pow(2,10*(e-1))*Math.sin(5*(e-1.1)*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin(5*(e-1.1)*Math.PI)+1}},Back:{In:function(e){var t=1.70158;return e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}},Bounce:{In:function(e){return 1-Kt.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?.5*Kt.Bounce.In(2*e):.5*Kt.Bounce.Out(2*e-1)+.5}}},qt="undefined"==typeof self&&"undefined"!=typeof process&&process.hrtime?function(){var e=process.hrtime();return 1e3*e[0]+e[1]/1e6}:"undefined"!=typeof self&&void 0!==self.performance&&void 0!==self.performance.now?self.performance.now.bind(self.performance):void 0!==Date.now?Date.now:function(){return(new Date).getTime()},Jt=function(){function e(){this._tweens={},this._tweensAddedDuringUpdate={}}return e.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map((function(t){return e._tweens[t]}))},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},e.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},e.prototype.update=function(e,t){void 0===e&&(e=qt()),void 0===t&&(t=!1);var n=Object.keys(this._tweens);if(0===n.length)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<n.length;i++){var r=this._tweens[n[i]],s=!t;r&&!1===r.update(e,s)&&!t&&delete this._tweens[n[i]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},e}(),$t={Linear:function(e,t){var n=e.length-1,i=n*t,r=Math.floor(i),s=$t.Utils.Linear;return t<0?s(e[0],e[1],i):t>1?s(e[n],e[n-1],n-i):s(e[r],e[r+1>n?n:r+1],i-r)},Bezier:function(e,t){for(var n=0,i=e.length-1,r=Math.pow,s=$t.Utils.Bernstein,o=0;o<=i;o++)n+=r(1-t,i-o)*r(t,o)*e[o]*s(i,o);return n},CatmullRom:function(e,t){var n=e.length-1,i=n*t,r=Math.floor(i),s=$t.Utils.CatmullRom;return e[0]===e[n]?(t<0&&(r=Math.floor(i=n*(1+t))),s(e[(r-1+n)%n],e[r],e[(r+1)%n],e[(r+2)%n],i-r)):t<0?e[0]-(s(e[0],e[0],e[1],e[1],-i)-e[0]):t>1?e[n]-(s(e[n],e[n],e[n-1],e[n-1],i-n)-e[n]):s(e[r?r-1:0],e[r],e[n<r+1?n:r+1],e[n<r+2?n:r+2],i-r)},Utils:{Linear:function(e,t,n){return(t-e)*n+e},Bernstein:function(e,t){var n=$t.Utils.Factorial;return n(e)/n(t)/n(e-t)},Factorial:(Qt=[1],function(e){var t=1;if(Qt[e])return Qt[e];for(var n=e;n>1;n--)t*=n;return Qt[e]=t,t}),CatmullRom:function(e,t,n,i,r){var s=.5*(n-e),o=.5*(i-t),a=r*r;return(2*t-2*n+s+o)*(r*a)+(-3*t+3*n-2*s-o)*a+s*r+t}}},en=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),tn=new Jt,nn=function(){function e(e,t){void 0===t&&(t=tn),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Kt.Linear.None,this._interpolationFunction=$t.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=en.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.to=function(e,t){return this._valuesEnd=Object.create(e),void 0!==t&&(this._duration=t),this},e.prototype.duration=function(e){return this._duration=e,this},e.prototype.start=function(e){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed)for(var t in this._reversed=!1,this._valuesStartRepeat)this._swapEndStartRepeatValues(t),this._valuesStart[t]=this._valuesStartRepeat[t];return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=void 0!==e?"string"==typeof e?qt()+parseFloat(e):e:qt(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},e.prototype._setupProperties=function(e,t,n,i){for(var r in n){var s=e[r],o=Array.isArray(s),a=o?"array":typeof s,l=!o&&Array.isArray(n[r]);if("undefined"!==a&&"function"!==a){if(l){var c=n[r];if(0===c.length)continue;c=c.map(this._handleRelativeValue.bind(this,s)),n[r]=[s].concat(c)}if("object"!==a&&!o||!s||l)void 0===t[r]&&(t[r]=s),o||(t[r]*=1),i[r]=l?n[r].slice().reverse():t[r]||0;else{for(var u in t[r]=o?[]:{},s)t[r][u]=s[u];i[r]=o?[]:{},this._setupProperties(s,t[r],n[r],i[r])}}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},e.prototype.pause=function(e){return void 0===e&&(e=qt()),this._isPaused||!this._isPlaying||(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this)),this},e.prototype.resume=function(e){return void 0===e&&(e=qt()),this._isPaused&&this._isPlaying?(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this):this},e.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},e.prototype.group=function(e){return this._group=e,this},e.prototype.delay=function(e){return this._delayTime=e,this},e.prototype.repeat=function(e){return this._initialRepeat=e,this._repeat=e,this},e.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},e.prototype.yoyo=function(e){return this._yoyo=e,this},e.prototype.easing=function(e){return this._easingFunction=e,this},e.prototype.interpolation=function(e){return this._interpolationFunction=e,this},e.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},e.prototype.onStart=function(e){return this._onStartCallback=e,this},e.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},e.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},e.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},e.prototype.onStop=function(e){return this._onStopCallback=e,this},e.prototype.update=function(e,t){if(void 0===e&&(e=qt()),void 0===t&&(t=!0),this._isPaused)return!0;var n,i,r=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>r)return!1;t&&this.start(e)}if(this._goToEnd=!1,e<this._startTime)return!0;!1===this._onStartCallbackFired&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),i=(e-this._startTime)/this._duration,i=0===this._duration||i>1?1:i;var s=this._easingFunction(i);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,s),this._onUpdateCallback&&this._onUpdateCallback(this._object,i),1===i){if(this._repeat>0){for(n in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat)this._yoyo||"string"!=typeof this._valuesEnd[n]||(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo&&this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n];return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=e+this._repeatDelayTime:this._startTime=e+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var o=0,a=this._chainedTweens.length;o<a;o++)this._chainedTweens[o].start(this._startTime+this._duration);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(e,t,n,i){for(var r in n)if(void 0!==t[r]){var s=t[r]||0,o=n[r],a=Array.isArray(e[r]),l=Array.isArray(o);!a&&l?e[r]=this._interpolationFunction(o,i):"object"==typeof o&&o?this._updateProperties(e[r],s,o,i):"number"==typeof(o=this._handleRelativeValue(s,o))&&(e[r]=s+(o-s)*i)}},e.prototype._handleRelativeValue=function(e,t){return"string"!=typeof t?t:"+"===t.charAt(0)||"-"===t.charAt(0)?e+parseFloat(t):parseFloat(t)},e.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];this._valuesStartRepeat[e]="string"==typeof n?this._valuesStartRepeat[e]+parseFloat(n):this._valuesEnd[e],this._valuesEnd[e]=t},e}(),rn=en.nextId,sn=tn,on=sn.getAll.bind(sn),an=sn.removeAll.bind(sn),ln=sn.add.bind(sn),cn=sn.remove.bind(sn),un=sn.update.bind(sn),hn={Easing:Kt,Group:Jt,Interpolation:$t,now:qt,Sequence:en,nextId:rn,Tween:nn,VERSION:"18.6.4",getAll:on,removeAll:an,add:ln,remove:cn,update:un};const dn="[soonspacejs]: ",fn="Group",pn="Light",gn="Model",mn="Poi",vn="PoiNode",yn="Canvas3D",wn="Topology",bn="Helper",An="PluginObject",xn="In soonspacejs: ",Sn=(e,t)=>{let n="";for(const e in t)n+=`${e}: ${t[e]};`;console.log(`%c${e}`,n)},Tn=e=>{console.warn(xn+e)};function En(e){return e instanceof t?e:new t(e.x,e.y,e.z)}function Dn(e){return e instanceof n?e:new n(e.x,e.y,e.z)}function Cn(e){const n=new i(new t,new t).setFromObject(e);return n.isEmpty()&&(e.getWorldPosition(n.min),n.max.copy(n.min)),n}function In(e,t,n){const i=n.clone();return Math.abs(t[e]-n[e])>Math.PI&&(t[e]>n[e]?i[e]+=2*Math.PI:i[e]-=2*Math.PI),i}function Bn(e,t){const i=In("x",e,t),r=In("y",e,t),s=In("z",e,t);return new n(i.x,r.y,s.z,t.order)}function Mn(e){return Math.PI/180*e}function Pn(e){return!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?{position:e.getWorldPosition(new t),rotation:(new n).setFromQuaternion(e.getWorldQuaternion(new r)),scale:e.getWorldScale(new t)}:{position:e.position.clone(),rotation:e.rotation.clone(),scale:e.scale.clone()}}function On(e,t){const n=Pn(t,!(arguments.length>2&&void 0!==arguments[2])||arguments[2]);e.position.copy(n.position),e.rotation.copy(n.rotation),e.scale.copy(n.scale)}function Rn(e){return!!e.visible&&(!e.parent||Rn(e.parent))}class _n{constructor(){this.min=null,this.roots=[],this.nodes=new Map}shift(){const e=this.min;if(null===e||this.roots.length<1)return this.min=null,e;this.remove(e),this.roots.length>50&&this.consolidate();let t=1/0;const n=this.roots.length;for(let e=0;e<n;e++){const n=this.roots[e],i=this.getDistance(n);i<t&&(t=i,this.min=n)}return e}consolidate(){const e=[[],[],[],[],[],[],[]],t=e.length-1,n=this.roots.length;for(let i=0;i<n;i++){const n=this.roots[i],r=this.nodes.get(n);r&&r.depth<t&&e[r.depth].push(n)}for(let n=0;n<=t;n++)for(;e[n].length>1;){const i=e[n].shift(),r=e[n].shift(),s=n+1;let o=-1;if(void 0!==i&&void 0!==r){const n=this.nodes.get(i),a=this.nodes.get(r);n&&a&&(n.distance<a.distance?(n.depth=s,n.children.push(r),a.parent=i,s<=t&&e[s].push(i),o=this.roots.indexOf(r)):(a.depth=s,a.children.push(i),n.parent=r,s<=t&&e[s].push(r),o=this.roots.indexOf(i)))}o>-1&&this.roots.splice(o,1)}}add(e,t){if(this.nodes.set(e,{nodeIndex:e,distance:t,depth:0,parent:null,children:[]}),null===this.min)this.min=e;else{const n=this.nodes.get(this.min);n&&t<n.distance&&(this.min=e)}this.roots.push(e)}update(e,t){this.remove(e),this.add(e,t)}remove(e){var t,n;if(!this.nodes.has(e))return;const i=null===(t=this.nodes.get(e))||void 0===t?void 0:t.children;if(i&&i.length>0)for(let t=0;t<i.length;t++){const n=i[t],r=this.nodes.get(n),s=this.nodes.get(e);r&&s&&(r.parent=s.parent),r&&null===r.parent&&this.roots.push(n)}let r=null===(n=this.nodes.get(e))||void 0===n?void 0:n.parent;if(null===r){const t=this.roots.indexOf(e);t>-1&&this.roots.splice(t,1)}else for(;r;){const e=this.nodes.get(r);e&&(e.depth--,r=e.parent)}}getDistance(e){const t=this.nodes.get(e);return t?t.distance:1/0}}async function kn(e){let{path:t="",file:n}=e;if(Array.isArray(n))return(new s).setPath(t).loadAsync(n);{const e=li(n);if("hdr"===e||"pic"===e){const e=await(new Bt).setPath(t).setDataType(o).loadAsync(n);return e.mapping=a,e}{const e=await(new l).setPath(t).loadAsync(n);return e.mapping=a,e}}}function Ln(e){if(!e)return null;const{colors:t,stops:n,size:i=1024}=e,r=document.createElement("canvas"),s=r.getContext("2d");if(!s)return null;r.width=16,r.height=i;const o=s.createLinearGradient(0,0,0,i),a=new c,l=t.map((e=>a.set(e).getStyle()));for(let e=0,t=l.length-1;e<=t;e++)o.addColorStop(n?n[e]:e/t,l[e]);s.fillStyle=o,s.fillRect(0,0,16,i);const h=new u(r);return h.needsUpdate=!0,h}const Nn=e=>{const t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)};function Un(e){return ni(e)?function(e){return e.map((e=>Un(e)))}(e):ii(e)?function(e){if(ii(e)){const t={};for(const n in e)t[n]=Un(e[n]);return t}return e}(e):e}const jn=(e,t)=>ni(e)?e.map(t):t(e),Fn=e=>jn(e,(e=>e.clone())),zn=e=>jn(e,(e=>e.dispose())),Gn=async e=>{const t=await fetch(e);if(200===t.status)return t;throw new Error(`Failed to fetch file: ${e}`)},Hn=new t,Vn=new t,Wn=new t;function Yn(e,t){const n=Hn.setFromMatrixPosition(e.matrixWorld),i=Vn.setFromMatrixPosition(t.matrixWorld),r=n.sub(i),s=t.getWorldDirection(Wn);return r.angleTo(s)>Math.PI/2}function Qn(e,t,n,i){const r=Hn.setFromMatrixPosition(e.matrixWorld),s=r.clone();s.project(t),n.setFromCamera(new h(s.x,s.y),t);const o=n.intersectObjects(i,!0);if(o.length){const e=o[0].distance;return r.distanceTo(n.ray.origin)<e}return!0}const Xn=e=>{"function"==typeof requestIdleCallback?requestIdleCallback(e):setTimeout(e)};var Zn=function(){function e(){}return e.prototype.toJson=function(e,t){var n=this.xmlStringToXmlDom(e),i=this.xmlToJson(n);return t?(t.removeLineBreaks&&this.removeLineBreaks(i),t.removeComments&&this.removeCommentProperties(i),t.transformTextOnly&&this.transformTextOnly(i),i):i},e.prototype.xmlStringToXmlDom=function(e){return(new DOMParser).parseFromString(e,"text/xml")},e.prototype.removeLineBreaks=function(e){var t=this;Object.keys(e).forEach((function(n,i){"#text"===n&&Array.isArray(e[n])&&delete e[n],"object"==typeof e[n]&&t.removeLineBreaks(e[n])}))},e.prototype.removeCommentProperties=function(e){var t=this;Object.keys(e).forEach((function(n,i){"#comment"===n&&delete e[n],"object"==typeof e[n]&&t.removeCommentProperties(e[n])}))},e.prototype.transformTextOnly=function(e){var t=this;Object.keys(e).forEach((function(n,i){var r=Object.keys(e[n]).length>1,s=Object.keys(e[n])[0];r||"object"==typeof e[n][s]?t.transformTextOnly(e[n]):"object"==typeof e[n]&&e[n]["#text"]&&(e[n]=e[n]["#text"])}))},e.prototype.xmlToJson=function(e){var t={};if(1==e.nodeType){if(e.attributes.length>0){t._attributes={};for(var n=0;n<e.attributes.length;n++){var i=e.attributes.item(n);t._attributes[i.nodeName]=i.nodeValue}}}else 3==e.nodeType&&(t=e.nodeValue);if(e.hasChildNodes())for(var r=0;r<e.childNodes.length;r++){var s=e.childNodes.item(r),o=s.nodeName;if(void 0===t[o])t[o]=this.xmlToJson(s);else{if(void 0===t[o].push){var a=t[o];t[o]=[],t[o].push(a)}t[o].push(this.xmlToJson(s))}}return t},e}();function Kn(e){return Gn(e).then((e=>e.text())).then((e=>Promise.resolve(function(e){return(new Zn).toJson(e,{transformTextOnly:!0,removeComments:!0,removeLineBreaks:!0})}(e))))}class qn{name="EXT_mesh_gpu_instancing";constructor(e){this.writer=e}writeNode(e,n){if(!0!==e.isInstancedMesh)return;const i=e.count,s=new d,o=new Float32Array(3*i),a=new Float32Array(4*i),l=new Float32Array(3*i),c=new t,u=new r,h=new t;for(let t=0;t<i;t++)e.getMatrixAt(t,s),s.decompose(c,u,h),o[3*t]=c.x,o[3*t+1]=c.y,o[3*t+2]=c.z,a[4*t]=u.x,a[4*t+1]=u.y,a[4*t+2]=u.z,a[4*t+3]=u.w,l[3*t]=h.x,l[3*t+1]=h.y,l[3*t+2]=h.z;const p=this.writer,g={};g.attributes={TRANSLATION:p.processAccessor(new f(o,3)),ROTATION:p.processAccessor(new f(a,4)),SCALE:p.processAccessor(new f(l,3))},n.extensions=n.extensions||{},n.extensions[this.name]=g,p.extensionsUsed[this.name]=!0}}const Jn=Object.prototype.hasOwnProperty,$n=e=>"String"===si(e),ei=e=>"Boolean"===si(e),ti=e=>"Number"===si(e),ni=Array.isArray,ii=e=>"Object"===si(e),ri=e=>"Function"===si(e),si=e=>Object.prototype.toString.call(e).slice(8,-1),oi=(e,t,n)=>String.fromCodePoint(...new Uint8Array(e,t,n)),ai=()=>dn+Math.random().toString(36).substring(7).split("").join("_"),li=e=>{var t;const{pathname:n}=new URL(e,location.origin);return null===(t=n.split(".").pop())||void 0===t?void 0:t.toLowerCase()};var ci=Object.freeze({__proto__:null,IVector3ToEuler:Dn,IVector3ToVector3:En,MinHeap:_n,cloneDeep:Un,cloneMaterials:Fn,deg2Euler:Mn,disposeMaterials:zn,error:e=>{console.error(xn+e)},euler2Deg:function(e){return e/(Math.PI/180)},exportGltf:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((n,i)=>{const r=new Mt;r.register((e=>new qn(e))),r.parse(e,(e=>n(e)),(e=>i(e)),t)}))},fetchFile:Gn,getAsciiString:oi,getBoundingBox:Cn,getExtension:li,getSpaceAttributeFromObject:Pn,getTexture:kn,getValueType:si,gradientTexture:Ln,hasOwn:(e,t)=>Jn.call(e,t),idleTask:Xn,isArray:ni,isBoolean:ei,isDate:e=>"Date"===si(e),isFunction:ri,isNull:e=>"Null"===si(e),isNumber:ti,isObject:ii,isObjectBehindCamera:Yn,isObjectOccludeVisible:Qn,isObjectVisible:Rn,isPromise:e=>"Promise"===si(e),isString:$n,isSymbol:e=>"Symbol"===si(e),isUndefined:e=>"Undefined"===si(e),log:Sn,materialHandle:jn,parseFilePath:Nn,randomString:ai,rotationAFix:Bn,rotationAxisFix:In,sleep:e=>new Promise((t=>setTimeout((()=>t()),e))),syncSpaceAttributeToObject:On,warn:Tn,xmlToJson:Kn});const ui={"Linear.None":Kt.Linear.None,"Quadratic.In":Kt.Quadratic.In,"Quadratic.Out":Kt.Quadratic.Out,"Quadratic.InOut":Kt.Quadratic.InOut,"Cubic.In":Kt.Cubic.In,"Cubic.Out":Kt.Cubic.Out,"Cubic.InOut":Kt.Cubic.InOut,"Quartic.In":Kt.Quartic.In,"Quartic.Out":Kt.Quartic.Out,"Quartic.InOut":Kt.Quartic.InOut,"Quintic.In":Kt.Quintic.In,"Quintic.Out":Kt.Quintic.Out,"Quintic.InOut":Kt.Quintic.InOut,"Sinusoidal.In":Kt.Sinusoidal.In,"Sinusoidal.Out":Kt.Sinusoidal.Out,"Sinusoidal.InOut":Kt.Sinusoidal.InOut,"Exponential.In":Kt.Exponential.In,"Exponential.Out":Kt.Exponential.Out,"Exponential.InOut":Kt.Exponential.InOut,"Circular.In":Kt.Circular.In,"Circular.Out":Kt.Circular.Out,"Circular.InOut":Kt.Circular.InOut,"Elastic.In":Kt.Elastic.In,"Elastic.Out":Kt.Elastic.Out,"Elastic.InOut":Kt.Elastic.InOut,"Back.In":Kt.Back.In,"Back.Out":Kt.Back.Out,"Back.InOut":Kt.Back.InOut,"Bounce.In":Kt.Bounce.In,"Bounce.Out":Kt.Bounce.Out,"Bounce.InOut":Kt.Bounce.InOut};function hi(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;return new Promise(((o,a)=>{const{duration:l=1e3,delay:c=0,repeat:u=!1,mode:h="Linear.None",yoyo:d=!1}=i,f=ui[h],p=new nn(e).to(t,l).easing(f).delay(c).onUpdate((i=>{e instanceof n&&t instanceof n&&i instanceof n&&(i.order=t.order),null==r||r(i,p)})).onComplete((()=>{o()})).onStop((()=>{a("animation stop")})).onStart((()=>{null==s||s(p)}));ti(u)?p.repeat(u):ei(u)&&u&&p.repeat(1/0),p.yoyo(d),p.start()}))}class di{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.target=e,this.points=t,this.speed=1,this.reverse=!1,this.needsRotate=!0,this.index=1,this._tween=null,Object.assign(this,n)}get isPlaying(){var e;return!!(null===(e=this._tween)||void 0===e?void 0:e.isPlaying())}async play(){if(this.isPlaying)return!1;this.index=1;let e=this.points.slice();return this.reverse&&(e=e.reverse()),this._play(e)}async _play(e){var t,n;const{target:i}=this,r=null!==(t=this.speed)&&void 0!==t?t:1,s=this.index;let o=e[s-1];if(!o)return!0;o.isVector3||(o=En(o)),o=o.clone();let a=e[s];if(!a)return!0;a.isVector3||(a=En(a).clone()),a=a.clone();const l=o.distanceTo(a)/r;this.needsRotate&&(1===s&&i.parent&&i.position.copy(i.parent.worldToLocal(o.clone())),i.lookAt(a)),await hi(o,a,{duration:l},((e,t)=>{var n;if(i.parent){const t=i.parent.worldToLocal(e.clone());i.position.copy(t)}null===(n=this.onUpdate)||void 0===n||n.call(this,e,t)}),(e=>{var t,n;1===s&&(null===(t=this.onStart)||void 0===t||t.call(this,e)),null===(n=this.onEveryStart)||void 0===n||n.call(this,e),this._tween=e})),null===(n=this.onPoint)||void 0===n||n.call(this,s,a),this.index++,await this._play(e)}pause(){var e;null===(e=this._tween)||void 0===e||e.pause()}resume(){var e;null===(e=this._tween)||void 0===e||e.resume()}stop(){var e;null===(e=this._tween)||void 0===e||e.stop(),this._tween=null}}var fi=Object.defineProperty,pi=(e,t,n)=>(((e,t,n)=>{t in e?fi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);function gi(e,t){if(t=t??e.arcLengthDivisions,e.cacheArcULengths&&e.cacheArcULengths.length===t+1&&!e.needsUpdate){const n=e.cacheArcULengths;return{lengths:n,length:n[t]}}e.needsUpdate=!1;const n=[0];let i=e.getPoint(0),r=0;for(let s=1;s<=t;s++){const o=e.getPointAt(s/t);r+=o.distanceTo(i),n.push(r),i=o}return e.cacheArcULengths=n,{lengths:n,length:r}}function mi(e,t,n){const i=n?t=>e.getPointAt(t):t=>e.getPoint(t);let r=i(0),s=0;const o=[],a=t.length;for(let e=0;e<a;e++){const n=i(t[e]);s+=n.distanceTo(r),o.push(s),r=n}return{lengths:o,length:o[a-1]}}function vi(e,t){let n=e.sampleLength;if(!n){const t=e.sampleNum;if(t)return t;n=1}return Math.ceil(t/n)}function yi(e){const{curve:t}=e;let n=t.getLength();const i=vi(e,n);return t.arcLengthDivisions<i&&(t.arcLengthDivisions=i,t.updateArcLengths(),n=t.getLength()),{length:n,division:i}}function wi(e,t){const n=vi(t??{},e.getLength()),i=e.getPoints(n),r=e.getLengths(n);return bi(i,{...t,lengths:r})}function bi(e,t){const{startColor:n,endColor:i,color:r,lengths:s}=t??{},o=r?new c(r):null,a=n?new c(n):o??new c(0,1,0),l=i?new c(i):o??new c(0,0,1),u=[],h=[];e[0].toArray(u,0);const d=u.length,f=s??xi(e).lengths,m=f[f.length-1],v=new c;e.forEach(((e,t)=>{e.toArray(u,t*d);const n=f[t]/m;v.lerpColors(a,l,n),v.toArray(h,3*t)}));const y=new p;return y.setAttribute("position",new g(u,d)),y.setAttribute("color",new g(h,3)),y}function Ai(e,t){t=t??{};let{material:n,linewidth:i}=t;i=i??1,n=n??new m({vertexColors:!0,linewidth:i});const r=Array.isArray(e)?bi(e,t):wi(e,t);return new v(r,n)}function xi(e){const t=Si(e),n=[0],i=t.reduce(((e,t)=>(e+=t.distance(),n.push(e),e)),0);return{lines:t,lengths:n,length:i}}function Si(e){const t=[];return e.reduce(((e,n)=>{const i=new y(e,n);return t.push(i),n})),t}function Ti(e,t){const n=[];return{lines:t.filter(((t,i)=>{const r=t.closestPointToPointParameter(e),s=0<=r||r>=1;return s&&n.push(i),s})),indexs:n}}function Ei(e,t){const{distSortIndexs:n,clampDists:i,clampPoints:r,ts:s,clampTs:o}=Di(e,t),a=n[0];return{line:t[a],index:a,clampDist:i[a],clampPoint:r[a],t:s[a],clampT:o[a]}}function Di(e,n){const i={clampDists:[],clampPoints:[],distSortIndexs:[],ts:[],clampTs:[]};return n.forEach(((n,r)=>{const s=n.closestPointToPointParameter(e),o=w.clamp(s,0,1),a=n.at(o,new t),l=e.distanceTo(a);i.clampDists.push(l),i.clampPoints.push(a),i.distSortIndexs.push(r),i.ts.push(s),i.clampTs.push(o)})),i.distSortIndexs.sort(((e,t)=>i.clampDists[e]-i.clampDists[t])),i}function Ci(e){const t=new b,n=null==e[0].z?A:x;return e.reduce(((e,i)=>{const r=new n(e,i);return t.add(r),i})),t}var Ii=(e=>(e.back="back",e.front="front",e))(Ii||{});function Bi(e){const{curve:t,distance:n,fromU:i=0,side:r,tolerance:s=.1*n}=e,o=e.length??t.getLength(),a=t.getPointAt(i);let l=n/o;const c="front"===r?-1:1;let u=!0,h=i,d=a,f=0,p=!0;do{h=c*l+i;let e=!1;h>1?(h=1,e=!0):h<0&&(h=0,e=!0),d=t.getPointAt(h),f=d.distanceTo(a),u=Math.abs(n-f)>s;const r=n/f;if(e&&u&&r>1){p=!1;break}l*=r}while(u);return{succeed:p,u:h,point:d,distance:f}}function Mi(e){const{curve:t,distance:n,fromU:i=0,tolerance:r=.1*n,origin:s}=e,o=e.length??t.getLength(),a=t.getPointAt(i),l=a.distanceTo(s),c=n-l;let u=c/o,h=!0,d=i,f=a;do{d=u+i;let e=!1;d>1?(d=1,e=!0):d<0&&(d=0,e=!0),f=t.getPointAt(d);const o=f.distanceTo(s);h=Math.abs(n-o)>r;const a=c/(o-l);if(e&&h&&a>1)return null;u*=a}while(h);return{u:d,point:f}}const Pi=new t,Oi=new t(1,1,1);new r;const Ri=new d;function _i(e){const{joints:t,axials:n}=e;if(t)var i=Li(t);else i=n?ki(e):Ni(e);return i}function ki(e){const{axials:t,start:n}=e,i=new S;n&&(i.position.copy(n),i.updateMatrix());const r=[i];return t.reduce(((e,t)=>{const n=new S;return n.position.copy(t),e.add(n),r.push(n),n.updateMatrix(),n}),i),i.updateWorldMatrix(!0,!0),r}function Li(e){const t=[];return e.reduce(((e,n)=>{const i=n.clone().sub(e);return t.push(i),n})),ki({axials:t,start:e[0]})}function Ni(e){const{start:t,axial:n}=e;let i=e.number;const r=new Array(i-1);return r.fill(n),ki({axials:r,start:t})}function Ui(e){const{geometry:n,flexible:i=1,axial:s,number:o}=e,a=e.start??new t,l=s.clone().normalize(),c=s.length(),u=o-1,h=(new r).setFromUnitVectors(new t(1,0,0),l),f=(new d).compose(a,h,new t(1,1,1)).invert(),p=n.getAttribute("position").clone(),m=p.count;p.applyMatrix4(f);const v=[],y=[];for(let e=0;e<m;e++){const t=p.getX(e);if(t<0){v.push(0,0,0,0),y.push(1,0,0,0);continue}const n=Math.trunc(t/c);if(n<u){const e=t%c/c*i;v.push(n,n+1,0,0),y.push(1-e,e,0,0)}else v.push(u,0,0,0),y.push(1,0,0,0)}return n.setAttribute("skinIndex",new T(v,4)),n.setAttribute("skinWeight",new g(y,4)),n}function ji(e){const{skeleton:n,geometryFrame:i}=e,r=n.boneInverses[0].clone().invert(),s=n.boneInverses[1].clone().invert();if(i){const e=i.clone().invert();r.premultiply(e),s.premultiply(e)}const o=(new t).setFromMatrixPosition(r),a=(new t).setFromMatrixPosition(s);return a.sub(o),Ui({...e,start:o,axial:a,number:n.bones.length})}function Fi(e){const{skeleton:n,geometry:i,flexible:r=1,geometryFrame:s}=e,o=(null==s?void 0:s.clone().invert())??Ri.clone(),a=n.boneInverses.map((e=>{const n=e.clone().invert().premultiply(o);return(new t).setFromMatrixPosition(n)})),l=Si(a),c=i.getAttribute("position"),u=c.count,h=[],d=[],f=new t;for(let e=0;e<u;e++){f.fromBufferAttribute(c,e);const{index:t,clampT:n}=Ei(f,l),i=n*r;h.push(t,t+1,0,0),d.push(1-i,i,0,0)}return i.setAttribute("skinIndex",new T(h,4)),i.setAttribute("skinWeight",new g(d,4)),i}function zi(e){const{geometry:t}=e,n=e.material??void 0,i=new E(t,n),r=_i(e);i.add(r[0]);const s=new D(r);return i.bind(s),Fi({...e,skeleton:s}),i}function Gi(e){const{skeleton:t}=e,n=Hi(e);return n.updateMatrix(),n.updateMatrixWorld(),n.bind(t),n}function Hi(e){const{target:t,skeleton:n}=e,i=t.geometry,r=new E;return t.copy.call(r,t,!1),Fi({...e,geometry:i,skeleton:n,geometryFrame:t.matrixWorld}),r}function Vi(e){const{target:t}=e;let{skeleton:n}=e;if(n)var i=n.bones[0];else{const t=_i(e);n=new D(t),i=t[0]}t.add(i),t.updateWorldMatrix(!1,!0),n.calculateInverses(),i.removeFromParent();const r=Wi({...e,target:t,skeleton:n});return r.add(i),{model:r,skeleton:n,rootBone:i}}function Wi(e){const{target:t,skeleton:n,parent:i}=e,r=t.isMesh,s=r?Hi({...e,skeleton:n}):t.clone(!1);i&&i.add(s),s.updateMatrixWorld(!0),r&&s.bind(n,t.matrixWorld);const o=t.children;for(const t of o)Wi({...e,target:t,parent:s});return s}function Yi(e){return e.filter((e=>{var t;return!(null!=(t=e.parent)&&t.isBone)}))}function Qi(e){return e.find((e=>{var t;return!(null!=(t=e.parent)&&t.isBone)}))}function Xi(e){return Qi(e)??e[0]}function Zi(e){return e.curve?Ki(e):nr(e)}function Ki(e){const{keyframeTracks:t,duration:n}=qi(e);return new C(e.name,n,t)}function qi(e){const{curve:t,lookDistance:n}=e,i=e.targetPath??"",r=yi(e).division,s=Ji(e,t.getLength()),o=P,a=[],l=er(r),c={...e,duration:s,division:r,ts:l,lookPoint:{distance:n}},u=tr(c),{points:h,rotates:d}=$i(c);if(h.length){const e=[];h.forEach(((t,n)=>{t.toArray(e,3*n)}));const t=new I(`${i}.position`,u,e,o);a.push(t)}if(d.length){const e=[];d.forEach(((t,n)=>{t.toArray(e,4*n)}));const t=new B(`${i}.quaternion`,u,e,o);a.push(t)}return{keyframeTracks:a,duration:s}}function Ji(e,t){let n=e.duration;if(!n){const i=e.speed;if(null==i)throw"缺少选项 duration 或者 speed";if(!t)throw"缺少参数 length";n=t/i}return n}function $i(e){var n,i;const{curve:s,target:o,lookPoint:a,enableUp:l,fixUp:c}=e,u=e.position??!0,h=e.rotate??!0,f=[],p=[],g=[],m={rotates:f,points:p};if(!u&&!h)return m;const v=(e.anchor??Pi).clone(),y=e.ts??e.us,w=!e.ts;if(!y)throw"缺少参数:至少传递 ts 和 us 任意之一";let b=Ri.clone(),A=Ri.clone(),x=Oi.clone(),S=M.DEFAULT_UP;o&&(o.updateWorldMatrix(!0,!1),b=o.matrix,A=o.matrixWorld,x=o.scale,S=o.up);const T=b.clone().invert(),E=A.clone().multiply(T).clone().invert(),D=s.getTangent(0);D.transformDirection(E);const C=(null==(n=e.front)?void 0:n.clone().normalize())??D,I=(null==(i=e.up)?void 0:i.clone().normalize())??S.clone().transformDirection(E);let B=b.clone().setPosition(0,0,0),P=e=>s.getPoint(e),O=e=>s.getTangent(e);w&&(P=e=>s.getPointAt(e),O=e=>s.getTangentAt(e));const R=y.length,_=R-1;let{distance:k,curveLength:L,lengths:N}=a??{};k=k??0;let U=O;0!==k&&(N||(N=mi(s,y,w).lengths),null==L&&(L=N[_]),U=(e,t)=>{const n=P(e);let i=(N[t]+k)/L;return i>1&&(i=1),s.getPointAt(i).sub(n).normalize()});let j=e=>{const t=y[e],n=U(t,e);n.transformDirection(E),g.push(n);const i=e-1,s=i<0,o=s?C:g[i],a=(new r).setFromUnitVectors(o,n);if(!s){const e=f[i];a.multiply(e)}return a};if(l){const e=new t(0,1,0);j=c?function(t){const n=y[t],i=U(n,t);i.transformDirection(E),g.push(i);const s=t-1;let o;if(s<0)o=(new r).setFromUnitVectors(C,i);else{const e=f[s],t=C.clone().applyQuaternion(e);o=(new r).setFromUnitVectors(t,i),o.multiply(e)}const a=I.clone().applyQuaternion(o),l=(new r).setFromUnitVectors(a,e);return o.premultiply(l),o}:function(t){const n=y[t],i=U(n,t);i.transformDirection(E),g.push(i);const s=t-1,o=s<0,a=o?C:g[s],l=(new r).setFromUnitVectors(a,i);if(o){const t=I.clone().applyQuaternion(l);t.projectOnPlane(i);const n=e.clone().projectOnPlane(i),s=(new r).setFromUnitVectors(t,n);l.premultiply(s)}else{const e=f[s];l.multiply(e)}return l}}for(let e=0;e<R;e++){const t=y[e];if(h){const t=j(e);f.push(t),B=(new d).compose(Pi,t,x)}if(u){const e=P(t);e.applyMatrix4(E);const n=v.clone().applyMatrix4(B);e.sub(n),p.push(e)}}return m}function er(e){const t=[];for(let n=0;n<=e;n++)t.push(n/e);return t}function tr(e){const{curve:t,division:n,duration:i}=e,r=t.getLengths(n),s=r[r.length-1];return r.map((e=>e/s*i))}function nr(e){const{smooth:t,points:n}=e;if(!1===t)var{keyframeTracks:i,duration:r}=ir(e);else{const t=Ci(n);var{keyframeTracks:i,duration:r}=qi({...e,curve:t})}return new C(e.name,r,i)}function ir(e){const t=e.targetPath??"",n=e.points,{lines:i,length:r,lengths:s}=xi(n),o=Ji(e,r),a=[],l=s.map((e=>e/r*o)),{points:c,pointTimes:u,rotates:h,rotateTimes:d}=rr({...e,times:l},i);if(c.length){const e=[];c.forEach(((t,n)=>{t.toArray(e,3*n)}));const n=new I(`${t}.position`,u,e,P);a.push(n)}if(h.length){const e=[];h.forEach(((t,n)=>{t.toArray(e,4*n)}));const n=new B(`${t}.quaternion`,d,e,O);a.push(n)}return{keyframeTracks:a,duration:o}}function rr(e,n){var i,s;const{points:o,target:a,times:l,enableUp:c,fixUp:u}=e,h=e.position??!0,f=e.rotate??!0,p=o.length,g=p-1;n=n??Si(o);const m=[],v=[],y=[],w=[],b={rotates:m,points:v,rotateTimes:l,pointTimes:y};if(!h&&!f)return b;const A=(e.anchor??Pi).clone();let x=Ri.clone(),S=Ri.clone(),T=Oi.clone(),E=M.DEFAULT_UP;a&&(a.updateWorldMatrix(!0,!1),x=a.matrix,S=a.matrixWorld,T=a.scale,E=a.up);const D=x.clone().invert(),C=S.clone().multiply(D).clone().invert(),I=n[0].delta(new t);I.transformDirection(C);const B=(null==(i=e.front)?void 0:i.clone().normalize())??I,P=(null==(s=e.up)?void 0:s.clone().normalize())??E.clone().transformDirection(C);let O=x.clone().setPosition(0,0,0),R=O,_=e=>{const i=n[e].delta(new t).normalize();i.transformDirection(C),w.push(i);const s=e-1,o=s<0,a=o?B:w[s],l=(new r).setFromUnitVectors(a,i);if(!o){const e=m[s];l.multiply(e)}return l};if(c){const e=new t(0,1,0);_=u?function(i){const s=n[i].delta(new t).normalize();s.transformDirection(C),w.push(s);const o=i-1;let a;if(o<0)a=(new r).setFromUnitVectors(B,s);else{const e=m[o],t=B.clone().applyQuaternion(e);a=(new r).setFromUnitVectors(t,s),a.multiply(e)}const l=P.clone().applyQuaternion(a),c=(new r).setFromUnitVectors(l,e);return a.premultiply(c),a}:function(i){const s=n[i].delta(new t).normalize();s.transformDirection(C),w.push(s);const o=i-1,a=o<0,l=a?B:w[o],c=(new r).setFromUnitVectors(l,s);if(a){const t=P.clone().applyQuaternion(c);t.projectOnPlane(s);const n=e.clone().projectOnPlane(s),i=(new r).setFromUnitVectors(t,n);c.premultiply(i)}else{const e=m[o];c.multiply(e)}return c}}for(let e=0;e<p;e++){if(f)if(e<g){const t=_(e);m.push(t),O=(new d).compose(Pi,t,T)}else m.push(m[e-1].clone());if(h){const t=l[e],n=o[e].clone();if(n.applyMatrix4(C),e>0){const e=A.clone().applyMatrix4(R),i=n.clone().sub(e);v.push(i),y.push(t)}const i=A.clone().applyMatrix4(O);n.sub(i),v.push(n),y.push(t)}R=O}return b}function sr(e){const t=e.mixer,n=Vi(e),{model:i,skeleton:r}=n,s=or({...e,target:i,skeleton:r});i.animations.push(s);const o=null==t?void 0:t.clipAction(s,i);return{...n,clip:s,action:o}}function or(e){const{boneTracks:t,duration:n}=ar(e),i=t.flat();return new C(e.name,n,i)}function ar(e){const{skeleton:t,targetPath:n}=e,i=t.bones,{times:r,boneSampleDatas:s,duration:o}=lr(e),a=r.length,l=P;return{boneTracks:s.map(((e,t)=>{const{points:s,rotates:o}=e,c=i[t],u=n?`${n}.skeleton.bones[${t}]`:`${c.name||c.uuid}`,h=[],d=[];for(let e=0;e<a;e++)s&&s[e].toArray(h,3*e),o[e].toArray(d,4*e);const f=[];if(s){const e=new I(`${u}.position`,r,h,l);f.push(e)}const p=new B(`${u}.quaternion`,r,d,l);return f.push(p),f})),duration:o}}function lr(e){var n;const{curve:i,skeleton:s,stretch:o}=e,{bones:a,boneInverses:l}=s,c=a[0],u=e.target??c.parent;if(!u)throw"target 或 根骨骼的 parent 不存在";const h=e.tolerance??.1;c.updateWorldMatrix(!0,!0);const{division:f,length:p}=yi(e),{matrixWorld:g}=u,m=g.clone().invert(),v=[],y=[];l.reduce(((e,t)=>{const n=t.clone().invert();v.push(n);const i=e.clone().multiply(n);return y.push(i),t}),m);const w=y[0],b=new t,A=new r,x=new t;w.decompose(b,A,x);const S=Ji(e,p),T=er(f),E=tr({curve:i,division:f,duration:S}),D=T.length,C=[],I=(new t).setFromMatrixPosition(y[1]).negate(),B=l[0],M=null==(n=e.up)?void 0:n.clone().applyMatrix4(g).transformDirection(B),{points:P,rotates:O}=$i({...e,curve:i,ts:T,target:c,rotate:!0,front:I,up:M,anchor:null});for(let e=0;e<D;e++)C.push(g.clone());const R=P.map(((e,t)=>{const n=O[t];n.premultiply(A);const i=(new d).compose(e,n,x);return i.premultiply(g),i})),_=i.getLengths(f).map((e=>e/p)),k=[{points:P,rotates:O,us:_,matrixs:R}],L=o?function(e,t,n){const r=k[e].us[t]-n/p;return{u:r,point:r<0?null:i.getPointAt(r)}}:function(e,t,n){const r=k[e].us[t],{u:s,point:o,succeed:a}=Bi({curve:i,distance:n,fromU:r,length:p,side:Ii.front,tolerance:h*n});return{u:s,point:a?o:null}},N=l.length,U=N-1;for(let e=1;e<N;e++){const n=[],s=[],o=[],a=[];k.push({points:n,rotates:s,us:o,matrixs:a});const l=y[e],c=v[e],u=e-1,h=k[u],f=y[u],p=v[u],{matrixs:g,points:m,rotates:w}=h,b=(new t).setFromMatrixScale(f),A=u-1,x=A<0?C:k[A].matrixs,S=new t,T=new r,E=new t;l.decompose(S,T,E);const I=(new t).setFromMatrixPosition(c).sub((new t).setFromMatrixPosition(p)).length(),B=S.length();for(let t=0;t<D;t++){const{point:c,u:h}=L(u,t,I);o.push(h),s.push(T.clone());const f=g[t];if(h<0||!c){n.push(S);const e=f.clone().multiply(l);a.push(e);continue}const p=x[t];let v=p.clone().invert();const y=c.clone().applyMatrix4(v),A=m[t];y.sub(A).normalize();const D=w[t],C=(new d).compose(A,D,b),M=S.clone().transformDirection(C),P=(new r).setFromUnitVectors(M,y);D.premultiply(P),f.compose(A,D,b),f.premultiply(p);const O=f.clone().invert();c.applyMatrix4(O);const R=c.length();c.copy(S).multiplyScalar(R/B),n.push(c);const _=(new d).compose(c,T,E);if(e===U){const e=i.getTangentAt(h);e.negate().transformDirection(O);const n=(new r).setFromUnitVectors(c.clone().normalize(),e);n.premultiply(T),s[t]=n,_.compose(c,n,E)}_.premultiply(f),a.push(_)}}return{times:E,boneSampleDatas:k,duration:S}}function cr(e){const{boneTracks:t,targetTracks:n,duration:i}=ur(e),r=n.concat(t.flat());return new C(e.name,i,r)}function ur(e){const{skeleton:t,targetPath:n}=e,{times:i,boneSampleDatas:r,duration:s,targetSampleDatas:o}=hr(e),a=i.length,l=t.bones,c=P,u=[],h=[],{points:d,rotates:f}=o;for(let e=0;e<a;e++)d[e].toArray(u,3*e),f[e].toArray(h,4*e);const p=n??"",g=[new I(`${p}.position`,i,u,c),new B(`${p}.quaternion`,i,h,c)];return{boneTracks:r.map(((e,t)=>{const{points:r,rotates:s}=e,o=l[t],u=n?`${n}.skeleton.bones[${t}]`:`${o.name||o.uuid}`,h=[],d=[];for(let e=0;e<a;e++)r&&r[e].toArray(h,3*e),s[e].toArray(d,4*e);const f=[];if(r){const e=new I(`${u}.position`,i,h,c);f.push(e)}const p=new B(`${u}.quaternion`,i,d,c);return f.push(p),f})),targetTracks:g,duration:s}}function hr(e){const{curve:n,skeleton:i,stretch:s}=e,{bones:o,boneInverses:a}=i,l=o[0],c=e.target??l.parent;if(!c)throw"target 或 根骨骼的 parent 不存在";const u=e.tolerance??.1;l.updateWorldMatrix(!0,!0);const{division:h,length:f}=yi(e),{matrix:p,matrixWorld:g,scale:m}=c,v=g.clone().multiply(p.clone().invert()),y=g.clone().invert(),w=[],b=[];a.reduce(((e,t)=>{const n=t.clone().invert();w.push(n);const i=e.clone().multiply(n);return b.push(i),t}),y);const A=b[0],x=new t,S=new r,T=new t;A.decompose(x,S,T);const E=Ji(e,f),D=er(h),C=w[0],I=(new t).setFromMatrixPosition(b[1]).negate().transformDirection(C).transformDirection(y),{rotates:B,points:M}=$i({...e,curve:n,target:c,position:!0,rotate:!0,anchor:x,front:I,ts:D}),P=tr({curve:n,division:h,duration:E}),O=M.map(((e,t)=>{const n=B[t],i=(new d).compose(e,n,m);return i.premultiply(v),i})),R={points:M,rotates:B,matrixs:O},_=[],k=O.map((e=>(_.push(S.clone()),e.clone().multiply(A)))),L=D.length,N=n.getLengths(h).map((e=>e/f)),U=[{rotates:_,us:N,matrixs:k}],j=s?function(e,t,i){const r=U[e].us[t]-i/f;return{u:r,point:r<0?null:n.getPointAt(r)}}:function(e,t,i){const r=U[e].us[t],{u:s,point:o,succeed:a}=Bi({curve:n,distance:i,fromU:r,length:f,side:Ii.front,tolerance:u*i});return{u:s,point:a?o:null}},F=a.length,z=F-1;for(let e=1;e<F;e++){const i=[],s=[],o=[],a=[];U.push({points:i,rotates:s,us:o,matrixs:a});const l=b[e],c=w[e],u=e-1,h=U[u],f=b[u],p=w[u],{matrixs:g,points:m,rotates:v}=h,y=new t,A=new r,x=new t;f.decompose(y,A,x);const S=u-1,T=S<0?O:U[S].matrixs,E=new t,D=new r,C=new t;l.decompose(E,D,C);const I=(new t).setFromMatrixPosition(c).sub((new t).setFromMatrixPosition(p)).length(),B=E.length();for(let t=0;t<L;t++){const{point:c,u:h}=j(u,t,I);o.push(h),s.push(D.clone());const f=g[t];if(h<0||!c){i.push(E);const e=f.clone().multiply(l);a.push(e);continue}const p=T[t];let w=p.clone().invert();const b=c.clone().applyMatrix4(w),S=(null==m?void 0:m[t])??y;b.sub(S).normalize();const M=v[t],P=(new d).compose(S,M,x),O=E.clone().transformDirection(P);M.setFromUnitVectors(O,b),M.premultiply(A),f.compose(S,M,x),f.premultiply(p);const R=f.clone().invert();c.applyMatrix4(R);const _=c.length();c.copy(E).multiplyScalar(_/B),i.push(c);const k=(new d).compose(c,D,C);if(e===z){const e=n.getTangentAt(h);e.negate().transformDirection(R);const i=(new r).setFromUnitVectors(c.clone().normalize(),e);i.premultiply(D),s[t]=i,k.compose(c,i,C)}k.premultiply(f),a.push(k)}}return{times:P,boneSampleDatas:U,targetSampleDatas:R,duration:E}}function dr(e){const{duration:t,tracks:n}=e;return n.map((e=>Array.from(e.times.map((e=>e/t)))))}class fr{constructor(e){pi(this,"_tracksTimeRatios",null),pi(this,"_lastGetTime",0),pi(this,"_lastGetKeyframeIndexs",null),this.clip=e}get tracksTimeRatios(){return this._tracksTimeRatios??(this._tracksTimeRatios=dr(this.clip))}getTracksKeyframeIndexs(e){const{clip:t,_lastGetTime:n}=this,i=e/t.duration,r=this.tracksTimeRatios;this._lastGetTime=e,e<n&&(this._lastGetKeyframeIndexs=null),this._lastGetTime=e;const s=this._lastGetKeyframeIndexs;return this._lastGetKeyframeIndexs=r.map(((e,t)=>{const n=(null==s?void 0:s[t])??0,r=e.length;for(let t=n;t<r;t++)if(i<e[t])return t-1;return r-1}))}getTracksKeyframes(e){const t=this.getTracksKeyframeIndexs(e),n=this.clip.tracks;return t.map(((e,t)=>{let i=null;if(-1!==e){const r=n[t],s=r.getValueSize(),o=e*s,a=o+s;i=Array.from(r.values.slice(o,a))}return{index:e,value:i}}))}}class pr extends fr{constructor(e){super(e.getClip()),pi(this,"_trackNames"),pi(this,"_positionTrackName"),pi(this,"_quaternionTrackName"),pi(this,"_rotationTrackName"),pi(this,"_scaleTrackName"),this.action=e}get time(){return this.action.time}get duration(){return this.clip.duration}get progress(){return this.time/this.duration}set progress(e){this.action.time=e*this.duration}get trackNames(){return this._trackNames??(this._trackNames=this.clip.tracks.map((e=>e.name)))}get keyframeIndexs(){const e=this.getTracksKeyframeIndexs(this.time);return this.trackNames.reduce(((t,n,i)=>(t[n]=e[i],t)),{})}get keyframes(){const e=this.getTracksKeyframes(this.time);return this.trackNames.reduce(((t,n,i)=>(t[n]=e[i],t)),{})}get positionTrackName(){return void 0===this._positionTrackName&&(this._positionTrackName=this.trackNames.find((e=>e.endsWith(".position")))??null),this._positionTrackName}get positionkeyframeIndex(){const e=this.positionTrackName;return e?this.keyframeIndexs[e]:null}get positionKeyframe(){const e=this.positionTrackName;if(e){const{index:n,value:i}=this.keyframes[e];return{index:n,value:i?new t(...i):null}}return null}get quaternionTrackName(){return void 0===this._quaternionTrackName&&(this._quaternionTrackName=this.trackNames.find((e=>e.endsWith(".quaternion")))??null),this._quaternionTrackName}get quaternionKeyframeIndex(){const e=this.quaternionTrackName;return e?this.keyframeIndexs[e]:null}get quaternionKeyframe(){const e=this.quaternionTrackName;if(e){const{index:t,value:n}=this.keyframes[e];return{index:t,value:n?new r(...n):null}}return null}get rotationTrackName(){return void 0===this._rotationTrackName&&(this._rotationTrackName=this.trackNames.find((e=>e.endsWith(".rotation")))??null),this._rotationTrackName}get rotationkeyframeIndex(){const e=this.rotationTrackName;return e?this.keyframeIndexs[e]:null}get rotationKeyframe(){const e=this.rotationTrackName;if(e){const{index:t,value:i}=this.keyframes[e];return{index:t,value:i?new n(...i):null}}return null}get scaleTrackName(){return void 0===this._scaleTrackName&&(this._scaleTrackName=this.trackNames.find((e=>e.endsWith(".scale")))??null),this._scaleTrackName}get scaleKeyframeIndex(){const e=this.scaleTrackName;return e?this.keyframeIndexs[e]:null}get scaleKeyframe(){const e=this.scaleTrackName;if(e){const{index:n,value:i}=this.keyframes[e];return{index:n,value:i?new t(...i):null}}return null}}class gr extends pr{forward(e){const t=this.action;e=Math.abs(e??t.timeScale),t.timeScale=e}backward(e){const t=this.action;e=Math.abs(e??t.timeScale),t.timeScale=-e}}function mr(e){const t=new gr(e);return new Proxy(t,{get:function(e,t,n){return t in e.action?e.action[t]:e[t]},set:function(e,t,n,i){return t in e.action?e.action[t]=n:e[t]=n,!0},deleteProperty:function(e,t){return t in e.action?Reflect.deleteProperty(e.action,t):Reflect.deleteProperty(e,t)},has:function(e,t){return t in e.action||t in e},ownKeys:function(e){return Reflect.ownKeys(e.action).concat(Reflect.ownKeys(e))}})}class vr{constructor(e){pi(this,"_action"),this.setAction(e)}get action(){return this._action}set action(e){this.setAction(e)}setAction(e){this._action=e&&mr(e)}get play(){const e=this.action;return Boolean(e&&e._mixer._isActiveAction(e)&&!e.paused)}set play(e){const t=this.action;t&&(t.paused=!e,e&&0===t.time&&t.play())}stop(){var e;null==(e=this.action)||e.stop()}}function yr(e){var t;null==(t=e.reset)||t.call(e,!0)}class wr extends vr{constructor(e,t=[]){super(e),pi(this,"_updateGUI",null),this.guis=t}get updateGUI(){return this._updateGUI??this.constructor.updateGUI??yr}set updateGUI(e){this._updateGUI=e}get action(){return this._action}set action(e){this.setAction(e),this.updateAllGUI()}updateAllGUI(){for(const e of this.guis)this.updateGUI(e)}}function br(e){const t=new wr(e);return new Proxy(t,{get:function(e,t,n){var i;return t in e?e[t]:null==(i=e.action)?void 0:i[t]},set:function(e,t,n,i){if(t in e)e[t]=n;else{if(!e.action)return!1;e.action[t]=n}return!0},deleteProperty:function(e,t){return t in e?Reflect.deleteProperty(e,t):!!e.action&&Reflect.deleteProperty(e.action,t)},has:function(e,t){return t in e||!!e.action&&t in e.action},ownKeys:function(e){return e.action?Reflect.ownKeys(e).concat(Reflect.ownKeys(e.action)):Reflect.ownKeys(e)}})}function Ar(e,t=1){const n=e.slice().sort(((e,t)=>e-t)),i=[[]];return n.reduce((function(e,n){const r=e[e.length-1];return null==r||n-r<=t?e.push(n):(e=[n],i.push(e)),e}),i[0]),i}function xr(e,t){let{count:n=4,min:i=-1/0,max:r=1/0}=t??{};const s=e[0];i=Math.max(s-n+1,i),r=Math.min(s+n-1,r),n=Math.min(n,r-i+1);const o=[];for(const t of e)i<=t&&t<=r&&o.push(t);const a=Ar(o);a.sort(((e,t)=>t.length-e.length));let l=a.find((e=>e.includes(s)));if(l.length>=n)return l.sort(((t,n)=>e.indexOf(t)-e.indexOf(n))),l=l.slice(0,n),l.sort(((e,t)=>e-t)),l;for(const e of o){i=l[0],r=l[l.length-1];let t=i-e,s=n-l.length;if(t>0&&t<=s)for(let t=e;t<i;t++)l.unshift(t);else if(t=e-r,t>0&&t<=s)for(let t=r+1;t<=e;t++)l.push(t);else;}return l}pi(wr,"updateGUI",yr);var Sr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Tr(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){if(this instanceof e){var n=[null];return n.push.apply(n,arguments),new(Function.bind.apply(t,n))}return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,i.get?i:{enumerable:!0,get:function(){return e[t]}})})),n}var Er={},Dr={},Cr=function(e,t){return Cr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Cr(e,t)};var Ir=function(){return Ir=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Ir.apply(this,arguments)};function Br(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}var Mr=Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]};function Pr(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Or(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,s=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return o}function Rr(e){return this instanceof Rr?(this.v=e,this):new Rr(e)}var _r=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function kr(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function Lr(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}var Nr=Object.freeze({__proto__:null,get __assign(){return Ir},__asyncDelegator:function(e){var t,n;return t={},i("next"),i("throw",(function(e){throw e})),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,r){t[i]=e[i]?function(t){return(n=!n)?{value:Rr(e[i](t)),done:!1}:r?r(t):t}:r}},__asyncGenerator:function(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=n.apply(e,t||[]),s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(e){r[e]&&(i[e]=function(t){return new Promise((function(n,i){s.push([e,t,n,i])>1||a(e,t)}))})}function a(e,t){try{(n=r[e](t)).value instanceof Rr?Promise.resolve(n.value.v).then(l,c):u(s[0][2],n)}catch(e){u(s[0][3],e)}var n}function l(e){a("next",e)}function c(e){a("throw",e)}function u(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}},__asyncValues:function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=Pr(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(n){t[n]=e[n]&&function(t){return new Promise((function(i,r){(function(e,t,n,i){Promise.resolve(i).then((function(t){e({value:t,done:n})}),t)})(i,r,(t=e[n](t)).done,t.value)}))}}},__await:Rr,__awaiter:function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))},__classPrivateFieldGet:kr,__classPrivateFieldIn:function(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)},__classPrivateFieldSet:Lr,__createBinding:Mr,__decorate:function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},__esDecorate:function(e,t,n,i,r,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,l=i.kind,c="getter"===l?"get":"setter"===l?"set":"value",u=!t&&e?i.static?e:e.prototype:null,h=t||(u?Object.getOwnPropertyDescriptor(u,i.name):{}),d=!1,f=n.length-1;f>=0;f--){var p={};for(var g in i)p[g]="access"===g?{}:i[g];for(var g in i.access)p.access[g]=i.access[g];p.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var m=(0,n[f])("accessor"===l?{get:h.get,set:h.set}:h[c],p);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(a=o(m.get))&&(h.get=a),(a=o(m.set))&&(h.set=a),(a=o(m.init))&&r.push(a)}else(a=o(m))&&("field"===l?r.push(a):h[c]=a)}u&&Object.defineProperty(u,i.name,h),d=!0},__exportStar:function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||Mr(t,e,n)},__extends:function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Cr(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},__generator:function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},__importDefault:function(e){return e&&e.__esModule?e:{default:e}},__importStar:function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&Mr(t,e,n);return _r(t,e),t},__makeTemplateObject:function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},__metadata:function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},__param:function(e,t){return function(n,i){t(n,i,e)}},__propKey:function(e){return"symbol"==typeof e?e:"".concat(e)},__read:Or,__rest:Br,__runInitializers:function(e,t,n){for(var i=arguments.length>2,r=0;r<t.length;r++)n=i?t[r].call(e,n):t[r].call(e);return i?n:void 0},__setFunctionName:function(e,t,n){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})},__spread:function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Or(arguments[t]));return e},__spreadArray:function(e,t,n){if(n||2===arguments.length)for(var i,r=0,s=t.length;r<s;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))},__spreadArrays:function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var i=Array(e),r=0;for(t=0;t<n;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,r++)i[r]=s[o];return i},__values:Pr}),Ur=Tr(Nr),jr={},Fr={},zr={},Gr={};Object.defineProperty(Gr,"__esModule",{value:!0});var Hr=function(){function e(t,n){if(void 0===n&&(n=null),this.nonEmpty=!1,t||n){if(!t)throw new Error("Parameter head cannot be null.");this.head=t,this.tail=n||e.NIL,this.nonEmpty=!0}else{if(e.NIL)throw new Error("Parameters head and tail are null. Use the NIL element instead.");this.nonEmpty=!1}}return Object.defineProperty(e.prototype,"length",{get:function(){if(!this.nonEmpty)return 0;if(this.tail===e.NIL)return 1;for(var t=0,n=this;n.nonEmpty;)++t,n=n.tail;return t},enumerable:!0,configurable:!0}),e.prototype.prepend=function(t){return new e(t,this)},e.prototype.append=function(t){if(!t)return this;if(!this.nonEmpty)return new e(t);if(this.tail===e.NIL)return new e(t).prepend(this.head);for(var n=new e(this.head),i=n,r=this.tail;r.nonEmpty;)i=i.tail=new e(r.head),r=r.tail;return i.tail=new e(t),n},e.prototype.insertWithPriority=function(t){if(!this.nonEmpty)return new e(t);var n=t.priority;if(n>this.head.priority)return this.prepend(t);for(var i=new e(this.head),r=i,s=this.tail;s.nonEmpty;){if(n>s.head.priority)return r.tail=s.prepend(t),i;r=r.tail=new e(s.head),s=s.tail}return r.tail=new e(t),i},e.prototype.filterNot=function(t){if(!this.nonEmpty||null==t)return this;if(t===this.head.listener)return this.tail;for(var n=new e(this.head),i=n,r=this.tail;r.nonEmpty;){if(r.head.listener===t)return i.tail=r.tail,n;i=i.tail=new e(r.head),r=r.tail}return this},e.prototype.contains=function(e){if(!this.nonEmpty)return!1;for(var t=this;t.nonEmpty;){if(t.head.listener===e)return!0;t=t.tail}return!1},e.prototype.find=function(e){if(!this.nonEmpty)return null;for(var t=this;t.nonEmpty;){if(t.head.listener===e)return t.head;t=t.tail}return null},e.prototype.toString=function(){for(var e="",t=this;t.nonEmpty;)e+=t.head+" -> ",t=t.tail;return"[List "+(e+="NIL")+"]"},e.NIL=new e(null,null),e}();Gr.SlotList=Hr;var Vr={};Object.defineProperty(Vr,"__esModule",{value:!0});var Wr=function(){function e(e,t,n,i){void 0===n&&(n=!1),void 0===i&&(i=0),this._enabled=!0,this._once=!1,this._priority=0,this._listener=e,this._once=n,this._signal=t,this._priority=i,this.verifyListener(e)}return e.prototype.execute0=function(){this._enabled&&(this._once&&this.remove(),this._params&&this._params.length?this._listener.apply(null,this._params):this._listener())},e.prototype.execute1=function(e){this._enabled&&(this._once&&this.remove(),this._params&&this._params.length?this._listener.apply(null,[e].concat(this._params)):this._listener(e))},e.prototype.execute=function(e){if(this._enabled){this._once&&this.remove(),this._params&&this._params.length&&(e=e.concat(this._params));var t=e.length;0===t?this._listener():1===t?this._listener(e[0]):2===t?this._listener(e[0],e[1]):3===t?this._listener(e[0],e[1],e[2]):this._listener.apply(null,e)}},Object.defineProperty(e.prototype,"listener",{get:function(){return this._listener},set:function(e){if(null==e)throw new Error("Given listener is null.\nDid you want to set enabled to false instead?");this.verifyListener(e),this._listener=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"once",{get:function(){return this._once},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"priority",{get:function(){return this._priority},enumerable:!0,configurable:!0}),e.prototype.toString=function(){return"[Slot listener: "+this._listener+", once: "+this._once+", priority: "+this._priority+", enabled: "+this._enabled+"]"},Object.defineProperty(e.prototype,"enabled",{get:function(){return this._enabled},set:function(e){this._enabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"params",{get:function(){return this._params},set:function(e){this._params=e},enumerable:!0,configurable:!0}),e.prototype.remove=function(){this._signal.remove(this._listener)},e.prototype.verifyListener=function(e){if(null==e)throw new Error("Given listener is null.");if(null==this._signal)throw new Error("Internal signal reference has not been set yet.")},e}();Vr.Slot=Wr,Object.defineProperty(zr,"__esModule",{value:!0});var Yr=Gr,Qr=Vr,Xr=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.slots=Yr.SlotList.NIL,this.valueClasses=1===e.length&&e[0]instanceof Array?e[0]:e}return Object.defineProperty(e.prototype,"valueClasses",{get:function(){return this._valueClasses},set:function(e){this._valueClasses=e?e.slice():[];for(var t=this._valueClasses.length;t--;)if(!(this._valueClasses[t]instanceof Object))throw new Error("Invalid valueClasses argument: item at index "+t+" should be a Class but was:<"+this._valueClasses[t]+">."+this._valueClasses[t])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numListeners",{get:function(){return this.slots.length},enumerable:!0,configurable:!0}),e.prototype.addOnce=function(e){return this.registerListener(e,!0)},e.prototype.remove=function(e){var t=this.slots.find(e);return t?(this.slots=this.slots.filterNot(e),t):null},e.prototype.removeAll=function(){this.slots=Yr.SlotList.NIL},e.prototype.dispatch=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this._valueClasses.length,i=e.length;if(i<n)throw new Error("Incorrect number of arguments. Expected at least "+n+" but received "+i+".");for(var r=0;r<n;r++)if(!(null===e[r]||e[r]instanceof this._valueClasses[r]||e[r].constructor===this._valueClasses[r]))throw new Error("Value object <"+e[r]+"> is not an instance of <"+this._valueClasses[r]+">.");var s=this.slots;if(s.nonEmpty)for(;s.nonEmpty;)s.head.execute(e),s=s.tail},e.prototype.registerListener=function(e,t){if(void 0===t&&(t=!1),this.registrationPossible(e,t)){var n=new Qr.Slot(e,this,t);return this.slots=this.slots.prepend(n),n}return this.slots.find(e)},e.prototype.registrationPossible=function(e,t){if(!this.slots.nonEmpty)return!0;var n=this.slots.find(e);if(!n)return!0;if(n.once!==t)throw new Error("You cannot addOnce() then add() the same listener without removing the relationship first.");return!1},e}();zr.OnceSignal=Xr,Object.defineProperty(Fr,"__esModule",{value:!0});var Zr=Ur,Kr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Zr.__extends(t,e),t.prototype.add=function(e){return this.registerListener(e)},t}(zr.OnceSignal);Fr.Signal=Kr,Object.defineProperty(jr,"__esModule",{value:!0});var qr=Ur,Jr=Vr,$r=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return qr.__extends(t,e),t.prototype.addWithPriority=function(e,t){return void 0===t&&(t=0),this.registerListenerWithPriority(e,!1,t)},t.prototype.addOnceWithPriority=function(e,t){return void 0===t&&(t=0),this.registerListenerWithPriority(e,!0,t)},t.prototype.registerListener=function(e,t){return void 0===t&&(t=!1),this.registerListenerWithPriority(e,t)},t.prototype.registerListenerWithPriority=function(e,t,n){if(void 0===n&&(n=0),this.registrationPossible(e,t)){var i=new Jr.Slot(e,this,t,n);return this.slots=this.slots.insertWithPriority(i),i}return this.slots.find(e)},t}(Fr.Signal);jr.PrioritySignal=$r,Object.defineProperty(Dr,"__esModule",{value:!0});var es=Ur,ts=function(e){function t(t){void 0===t&&(t=null);for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var r=this;return n=1===n.length&&n[0]instanceof Array?n[0]:n,(r=e.call(this,n)||this)._target=t,r}return es.__extends(t,e),Object.defineProperty(t.prototype,"target",{get:function(){return this._target},set:function(e){e!==this._target&&(this.removeAll(),this._target=e)},enumerable:!0,configurable:!0}),t.prototype.dispatch=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this._valueClasses.length,i=e.length;if(i<n)throw new Error("Incorrect number of arguments. Expected at least "+n+" but received "+i+".");for(var r=0;r<n;r++)if(null!==e[r]&&e[r].constructor!==this._valueClasses[r])throw new Error("Value object <"+e[r]+"> is not an instance of <"+this._valueClasses[r]+">.");var s=e[0];s&&(s.target&&(s=s.clone(),e[0]=s),s.target=this.target,s.currentTarget=this.target,s.signal=this);for(var o=this.slots;o.nonEmpty;)o.head.execute(e),o=o.tail;if(s&&s.bubbles)for(var a=this.target;a&&a.hasOwnProperty("parent")&&(null===(a=a.parent).onEventBubbled||(s.currentTarget=a,a.onEventBubbled(s))););},t}(jr.PrioritySignal);Dr.DeluxeSignal=ts;var ns={};Object.defineProperty(ns,"__esModule",{value:!0});var is=function(){function e(e){void 0===e&&(e=!1),this._bubbles=e}return Object.defineProperty(e.prototype,"signal",{get:function(){return this._signal},set:function(e){this._signal=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},set:function(e){this._target=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentTarget",{get:function(){return this._currentTarget},set:function(e){this._currentTarget=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bubbles",{get:function(){return this._bubbles},set:function(e){this._bubbles=e},enumerable:!0,configurable:!0}),e.prototype.clone=function(){return new e(this._bubbles)},e}();ns.GenericEvent=is;var rs={};Object.defineProperty(rs,"__esModule",{value:!0}),rs.IOnceSignal=Symbol("IOnceSignal");var ss={};Object.defineProperty(ss,"__esModule",{value:!0}),ss.IPrioritySignal=Symbol("IPrioritySignal");var os={};Object.defineProperty(os,"__esModule",{value:!0}),os.ISignal=Symbol("ISignal");var as={};Object.defineProperty(as,"__esModule",{value:!0}),as.ISlot=Symbol("ISlot");var ls={};Object.defineProperty(ls,"__esModule",{value:!0});var cs=Vr,us=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.valueClasses=1===e.length&&e[0]instanceof Array?e[0]:e}return Object.defineProperty(e.prototype,"valueClasses",{get:function(){return this._valueClasses},set:function(e){this._valueClasses=e?e.slice():[];for(var t=this._valueClasses.length;t--;)if("function"!=typeof this._valueClasses[t])throw new Error("Invalid valueClasses argument: item at index "+t+" should be a Class but was:<"+this._valueClasses[t]+"'>."+this._valueClasses[t])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numListeners",{get:function(){return this.slot?1:0},enumerable:!0,configurable:!0}),e.prototype.add=function(e){return this.registerListener(e)},e.prototype.addOnce=function(e){return this.registerListener(e,!0)},e.prototype.remove=function(e){if(this.slot&&this.slot.listener===e){var t=this.slot;return this.slot=null,t}return null},e.prototype.removeAll=function(){this.slot&&this.slot.remove()},e.prototype.dispatch=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this._valueClasses.length,i=e.length;if(i<n)throw new Error("Incorrect number of arguments. Expected at least "+n+" but received "+i+".");for(var r=0;r<n;r++)if(!(null===e[r]||e[r]instanceof this._valueClasses[r]||e[r].constructor===this._valueClasses[r]))throw new Error("Value object <"+e[r]+"> is not an instance of <"+this._valueClasses[r]+">.");this.slot&&this.slot.execute(e)},e.prototype.registerListener=function(e,t){if(void 0===t&&(t=!1),this.slot)throw new Error("You cannot add or addOnce with a listener already added, remove the current listener first.");return this.slot=new cs.Slot(e,this,t)},e}();ls.MonoSignal=us;var hs={};Object.defineProperty(hs,"__esModule",{value:!0});var ds=Ur,fs=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return ds.__extends(t,e),t.prototype.addOnce=function(t){var n=e.prototype.addOnce.call(this,t);return this.isDispatched&&(n.execute(this.valueObjects),n.remove()),n},t.prototype.dispatch=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];if(this.isDispatched)throw new Error("You cannot dispatch() a Promise more than once");this.isDispatched=!0,this.valueObjects=t,e.prototype.dispatch.apply(this,t)},t}(zr.OnceSignal);hs.Promise=fs,Object.defineProperty(Er,"__esModule",{value:!0});var ps=Dr;Er.DeluxeSignal=ps.DeluxeSignal;var gs=ns;Er.GenericEvent=gs.GenericEvent;var ms=rs;Er.IOnceSignal=ms.IOnceSignal;var vs=ss;Er.IPrioritySignal=vs.IPrioritySignal;var ys=os;Er.ISignal=ys.ISignal;var ws=as;Er.ISlot=ws.ISlot;var bs=ls;Er.MonoSignal=bs.MonoSignal;var As=zr;Er.OnceSignal=As.OnceSignal;var xs=jr;Er.PrioritySignal=xs.PrioritySignal;var Ss=hs;Er.Promise=Ss.Promise;var Ts=Fr,Es=Er.Signal=Ts.Signal,Ds=Vr;Er.Slot=Ds.Slot;var Cs=Gr;Er.SlotList=Cs.SlotList;const Is=new R;Is.name="Scene";class Bs{constructor(e,t){this.signals=e,this.viewportState=t,this.scene=Is.clone(),this.selectedObjects={edge:[],stroke:[],opacity:[],highlight:[],emissive:[]},this.intersectsList={meshOfModelList:[],poiIconList:[],otherObjList:[],getAll:function(){return[...this.meshOfModelList,...this.poiIconList,...this.otherObjList]}}}addObject(e,t){if(this.viewportState.isDisposed)return this.removeObject(e),void Tn("Scene is disposed");t?t.add(e):this.scene.add(e),this._triggerObjectAdded(e),this.signals.objectAdded.dispatch(e)}removeObject(e){function t(e){var t;e.map&&((t=e.map)&&t.isTexture&&t.dispose()),e.dispose()}e.traverse((e=>{if("Mesh"===e.type){const n=e;n.geometry.dispose(),jn(n.material,t)}e instanceof Eu&&e.element.remove();const{meshOfModelList:n,poiIconList:i,otherObjList:r}=this.intersectsList,s=n.findIndex((t=>t.uuid===e.uuid)),o=i.findIndex((t=>t.uuid===e.uuid)),a=r.findIndex((t=>t.uuid===e.uuid));s>-1&&this.intersectsList.meshOfModelList.splice(s,1),o>-1&&this.intersectsList.poiIconList.splice(o,1),a>-1&&this.intersectsList.otherObjList.splice(a,1)})),e.removeFromParent(),this.signals.objectRemoved.dispatch(e)}openSceneFog(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{color:t=13426943,near:n=500,far:i=5e4}=e;this.scene.fog=new _(t,n,i),this.signals.sceneChanged.dispatch()}closeSceneFog(){this.scene.fog=null,this.signals.sceneChanged.dispatch()}edgeShow(e,t){const n=[],i=e=>{-1===this.selectedObjects.edge.findIndex((t=>t.uuid===e.uuid))&&n.push(e)};return ni(e)?e.forEach((e=>i(e))):ii(e)&&i(e),this.selectedObjects.edge=[...this.selectedObjects.edge,...n],this.signals.outlineChange.dispatch({objects:this.selectedObjects.edge,options:t}),Promise.resolve()}unEdgeShow(e){e||(e=[...this.selectedObjects.edge]);const t=e=>{const t=this.selectedObjects.edge.findIndex((t=>t.uuid===e.uuid));return-1===t||(this.selectedObjects.edge.splice(t,1),this.signals.outlineChange.dispatch({objects:this.selectedObjects.edge})),Promise.resolve()};return ni(e)?Promise.all(e.map((e=>t(e)))):ii(e)?t(e):Promise.resolve()}strokeShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{isOpacityShow:n=!0,color:i=4647927,opacity:r=.2,edgeColor:s=61183,edgeOpacity:o=1}=t,a=e=>{if(-1!==this.selectedObjects.stroke.findIndex((t=>t.uuid===e.uuid)))return Promise.resolve();if(e.userData.strokeGroup)return Promise.resolve();const t=new Su({id:e.uuid});return e.traverse((n=>{if(n instanceof k){const i=new L(n.geometry,89),r=new N(i,new m({color:s,transparent:!0,opacity:o}));On(r,n),e.attach(r),t.add(r)}})),e.userData.strokeGroup=t,this.addObject(t,e),this.selectedObjects.stroke.push(e),Promise.resolve()};return n&&this.opacityShow(e,{color:i,opacity:r}),ni(e)?Promise.all(e.map((e=>a(e)))):ii(e)?a(e):Promise.resolve()}unStrokeShow(e){e||(e=[...this.selectedObjects.stroke]);const t=e=>{if(!e.userData.strokeGroup)return Promise.resolve();this.removeObject(e.userData.strokeGroup),Reflect.deleteProperty(e.userData,"strokeGroup");const t=this.selectedObjects.stroke.findIndex((t=>t.uuid===e.uuid));return-1===t||(this.selectedObjects.stroke.splice(t,1),this.signals.geometryChanged.dispatch(),this.unOpacityShow(e)),Promise.resolve()};return ni(e)?Promise.all(e.map((e=>t(e)))):ii(e)?t(e):Promise.resolve()}opacityShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{color:n="#fff",opacity:i=.8}=t;function r(e){const t=Fn(e);return t.map=null,t.transparent=i<1,t.depthWrite=!t.transparent,t.color.set(n),t.opacity=i,t}const s=e=>(-1!==this.selectedObjects.opacity.findIndex((t=>t.uuid===e.uuid))||(e.traverse((e=>{if(e instanceof k){if(e.userData.material)return;e.userData.material=e.material,e.material=jn(e.material,r)}})),this.signals.materialChanged.dispatch(),this.selectedObjects.opacity.push(e)),Promise.resolve());return ni(e)?Promise.all(e.map((e=>s(e)))):ii(e)?s(e):Promise.resolve()}unOpacityShow(e){e||(e=[...this.selectedObjects.opacity]);const t=e=>new Promise((t=>{const n=this.selectedObjects.opacity.findIndex((t=>t.uuid===e.uuid));-1===n&&t(),this.selectedObjects.opacity.splice(n,1),e.traverse((e=>{if(e instanceof k){if(!e.userData.material)return;zn(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),t()}));return ni(e)?Promise.all(e.map((e=>t(e)))):ii(e)?t(e):Promise.resolve()}highlightShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{color:n="red",opacity:i=1}=t;function r(e){e instanceof U&&(e.color=new c(n),e.opacity=i,e.transparent=i<1,e.depthWrite=!e.transparent)}const s=e=>(-1!==this.selectedObjects.highlight.findIndex((t=>t.uuid===e.uuid))||(e.traverse((e=>{if(e instanceof k){if(e.userData.material)return;e.userData.material=e.material,e.material=Fn(e.material),jn(e.material,r)}})),this.signals.materialChanged.dispatch(),this.selectedObjects.highlight.push(e)),Promise.resolve());return ni(e)?Promise.all(e.map((e=>s(e)))):ii(e)?s(e):Promise.resolve()}unHighlightShow(e){e||(e=[...this.selectedObjects.highlight]);const t=e=>new Promise((t=>{const n=this.selectedObjects.highlight.findIndex((t=>t.uuid===e.uuid));-1===n&&t(),this.selectedObjects.highlight.splice(n,1),e.traverse((e=>{if(e instanceof k){if(!e.userData.material)return;zn(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),t()}));return ni(e)?Promise.all(e.map((e=>t(e)))):ii(e)?t(e):Promise.resolve()}emissiveShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{color:n="red",opacity:i=.3,maxOpacity:r=1,minOpacity:s=0,duration:o=1e3}=t;function a(e){e instanceof U&&(e.emissive.set(n),e.emissiveIntensity=i,0!==o&&hi({emissiveIntensity:r},{emissiveIntensity:s},{duration:o,repeat:!0},(t=>e.emissiveIntensity=t.emissiveIntensity),(t=>e.userData.animation=t)))}const l=e=>(-1!==this.selectedObjects.emissive.findIndex((t=>t.uuid===e.uuid))||(e.traverse((e=>{if(e instanceof k){if(e.userData.material)return;e.userData.material=e.material,e.material=Fn(e.material),jn(e.material,a)}})),this.selectedObjects.emissive.push(e),this.signals.materialChanged.dispatch()),Promise.resolve());return ni(e)?Promise.all(e.map((e=>l(e)))):ii(e)?l(e):Promise.resolve()}unEmissiveShow(e){function t(e){e.userData.animation&&hn.remove(e.userData.animation)}e||(e=[...this.selectedObjects.emissive]);const n=e=>new Promise((n=>{const i=this.selectedObjects.emissive.findIndex((t=>t.uuid===e.uuid));-1===i&&n(),this.selectedObjects.emissive.splice(i,1),e.traverse((e=>{if(e instanceof k){if(!e.userData.material)return;jn(e.material,t),zn(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),n()}));return ni(e)?Promise.all(e.map((e=>n(e)))):ii(e)?n(e):Promise.resolve()}_triggerObjectAdded(e){if(e instanceof xu)if("Model"===e.stype)e.traverse((e=>{if(e instanceof k){-1===this.intersectsList.meshOfModelList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.meshOfModelList.push(e)}}));else if("Poi"===e.stype){-1===this.intersectsList.poiIconList.findIndex((t=>t.uuid===e.icon.uuid))&&this.intersectsList.poiIconList.push(e.icon)}else"Group"===e.stype?e.children.forEach((e=>this._triggerObjectAdded(e))):e.isObject3D&&e.traverse((e=>{if(e instanceof k){-1===this.intersectsList.otherObjList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.otherObjList.push(e)}}));else e.isObject3D&&e.traverse((e=>{if(e instanceof k){-1===this.intersectsList.otherObjList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.otherObjList.push(e)}}))}}class Ms extends M{constructor(e){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof Ms&&e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this}}const Ps=new t,Os=new d,Rs=new d,_s=new t,ks=new t;class Ls{constructor(e){let t,n,i,r;this.viewport=e,this.domElement=document.createElement("div");const s={objects:new WeakMap};this.domElement.style.overflow="hidden",this.getSize=function(){return{width:t,height:n}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),Os.copy(t.matrixWorldInverse),Rs.multiplyMatrices(t.projectionMatrix,Os),o(e,e,t),function(e){const t=function(e){const t=[];return e.traverse((function(e){e instanceof Ms&&t.push(e)})),t}(e).sort((function(e,t){if(e.renderOrder!==t.renderOrder)return t.renderOrder-e.renderOrder;return s.objects.get(e).distanceToCameraSquared-s.objects.get(t).distanceToCameraSquared})),n=t.length;for(let e=0,i=t.length;e<i;e++)t[e].element.style.zIndex=""+(n-e)}(e)},this.setSize=(e,s)=>{t=e,n=s,i=t/2,r=n/2,this.domElement.style.width=e+"px",this.domElement.style.height=s+"px"};const o=(e,t,n)=>{var l;if(e instanceof Ms){const t=e.parent;if(t.occlude){const t=!Yn(e,this.viewport.camera)&&Qn(e,this.viewport.camera,this.viewport.raycaster,this.viewport.scener.intersectsList.getAll());e.visible=t}Ps.setFromMatrixPosition(e.matrixWorld),Ps.applyMatrix4(Rs);const o=Rn(e)&&Ps.z>=-1&&Ps.z<=1&&!0===e.layers.test(n.layers);if(e.userData.prevVisible!==o&&(null===(l=t.onChange)||void 0===l||l.call(t,o),t.elementAutoDisplay&&(e.element.style.display=!0===o?"":"none")),e.userData.prevVisible=o,!0===o){const t=e.element;t.style.transform="translate(-50%,-50%) translate("+(Ps.x*i+i)+"px,"+(-Ps.y*r+r)+"px)",t.parentNode!==this.domElement&&this.domElement.appendChild(t)}const c={distanceToCameraSquared:a(n,e)};s.objects.set(e,c)}for(let i=0,r=e.children.length;i<r;i++)o(e.children[i],t,n)};function a(e,t){return _s.setFromMatrixPosition(e.matrixWorld),ks.setFromMatrixPosition(t.matrixWorld),_s.distanceToSquared(ks)}}}const Ns=new t,Us=new r,js=new t;class Fs extends M{constructor(e){super(),this.isCSS3DObject=!0,this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof Fs&&e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this}}class zs extends Fs{constructor(e){super(e),this.isCSS3DSprite=!0,this.rotation2D=0}copy(e,t){return super.copy(e,t),this.rotation2D=e.rotation2D,this}}const Gs=new d,Hs=new d;class Vs{constructor(e){let t,n,i,r;this.viewport=e,this.domElement=document.createElement("div");const s={camera:{fov:0,style:""},objects:new WeakMap};this.domElement.style.overflow="hidden";const o=document.createElement("div");o.style.transformOrigin="0 0",this.domElement.appendChild(o);const a=document.createElement("div");function l(e){return Math.abs(e)<1e-10?0:e}function c(e){const t=e.elements;return"matrix3d("+l(t[0])+","+l(-t[1])+","+l(t[2])+","+l(t[3])+","+l(t[4])+","+l(-t[5])+","+l(t[6])+","+l(t[7])+","+l(t[8])+","+l(-t[9])+","+l(t[10])+","+l(t[11])+","+l(t[12])+","+l(-t[13])+","+l(t[14])+","+l(t[15])+")"}function u(e){const t=e.elements;return"translate(-50%,-50%)"+("matrix3d("+l(t[0])+","+l(t[1])+","+l(t[2])+","+l(t[3])+","+l(-t[4])+","+l(-t[5])+","+l(-t[6])+","+l(-t[7])+","+l(t[8])+","+l(t[9])+","+l(t[10])+","+l(t[11])+","+l(t[12])+","+l(t[13])+","+l(t[14])+","+l(t[15])+")")}a.style.transformStyle="preserve-3d",o.appendChild(a),this.getSize=()=>({width:t,height:n}),this.render=(e,u)=>{const d=u.projectionMatrix.elements[5]*r;s.camera.fov!==d&&(o.style.perspective=u instanceof j?d+"px":"",s.camera.fov=d),u.view&&u.view.enabled?(o.style.transform=`translate( ${-u.view.offsetX*(t/u.view.width)}px, ${-u.view.offsetY*(n/u.view.height)}px )`,o.style.transform+=`scale( ${u.view.fullWidth/u.view.width}, ${u.view.fullHeight/u.view.height} )`):o.style.transform="",!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===u.parent&&!0===u.matrixWorldAutoUpdate&&u.updateMatrixWorld();let f=0,p=0;u instanceof F&&(f=-(u.right+u.left)/2,p=(u.top+u.bottom)/2);const g=u.view&&u.view.enabled?u.view.height/u.view.fullHeight:1,m=(u instanceof F?`scale( ${g} )scale(`+d+")translate("+l(f)+"px,"+l(p)+"px)"+c(u.matrixWorldInverse):`scale( ${g} )translateZ(`+d+"px)"+c(u.matrixWorldInverse))+"translate("+i+"px,"+r+"px)";s.camera.style!==m&&(a.style.transform=m,s.camera.style=m),h(e,e,u)},this.setSize=(e,s)=>{t=e,n=s,i=t/2,r=n/2,this.domElement.style.width=e+"px",this.domElement.style.height=s+"px",o.style.width=e+"px",o.style.height=s+"px",a.style.width=e+"px",a.style.height=s+"px"};const h=(e,t,n,i)=>{var r;if(e instanceof Fs){const t=e.parent;if(t.occlude){const t=!Yn(e,this.viewport.camera)&&Qn(e,this.viewport.camera,this.viewport.raycaster,this.viewport.scener.intersectsList.getAll());e.visible=t}const i=Rn(e)&&!0===e.layers.test(n.layers);if(e.userData.prevVisible!==i&&(null===(r=t.onChange)||void 0===r||r.call(t,i),t.elementAutoDisplay&&(e.element.style.display=!0===i?"":"none")),e.userData.prevVisible=i,!0===i){let t;e instanceof zs?(Gs.copy(n.matrixWorldInverse),Gs.transpose(),0!==e.rotation2D&&Gs.multiply(Hs.makeRotationZ(e.rotation2D)),e.matrixWorld.decompose(Ns,Us,js),Gs.setPosition(Ns),Gs.scale(js),Gs.elements[3]=0,Gs.elements[7]=0,Gs.elements[11]=0,Gs.elements[15]=1,t=u(Gs)):t=u(e.matrixWorld);const i=e.element,r=s.objects.get(e);if(void 0===r||r.style!==t){i.style.transform=t;const n={style:t};s.objects.set(e,n)}i.parentNode!==a&&a.appendChild(i)}}for(let i=0,r=e.children.length;i<r;i++)h(e.children[i],t,n)}}}class Ws{constructor(e){this.viewport=e,this.internalOptions={enableRenderCss2D:!1,enableRenderCss3D:!1},this.container=this._initContainer(),this.renderer=this._initRenderer(),this.rendererCSS2D=this._initRenderCSS2D(),this.rendererCSS3D=this._initRenderCSS3D(),this.interactiveContainer=this._initInteractiveContainer()}setInternalState(e,t){this.internalOptions[e]=t}getWidth(){return this.renderer.domElement.width}getHeight(){return this.renderer.domElement.height}getMouseRelativeConRatio(e){const t=this.container.getBoundingClientRect();return[(e.offsetX-t.left)/t.width,(e.offsetY-t.top)/t.height]}getMousePoint(e){const t=new h(0,0);return t.fromArray(this.getMouseRelativeConRatio(e)),t}_initContainer(){const e=document.createElement("div");return e.style.position="relative",e.style.width="100%",e.style.height="100%",e}_initRenderer(){const{background:e={},logarithmicDepthBuffer:t}=this.viewport.options,{alpha:n}=e,{offsetWidth:i,offsetHeight:r}=this.container,s=new z({powerPreference:"high-performance",premultipliedAlpha:!0,stencil:!1,antialias:!1,alpha:!1,preserveDrawingBuffer:!0,logarithmicDepthBuffer:t});return s.autoClear=!1,s.setSize(i,r),s.setPixelRatio(self.devicePixelRatio),s.setClearAlpha(n?0:1),s.localClippingEnabled=!0,s.sortObjects=!0,s.shadowMap.enabled=!0,s.shadowMap.type=G,this.container.appendChild(s.domElement),s}_initRenderCSS2D(){const e=new Ls(this.viewport);return e.domElement.id="ssp_view_2DPoi",e.domElement.style.position="absolute",e.domElement.style.top="0",e.domElement.style.width="100%",e.domElement.style.height="100%",e.setSize(this.container.offsetWidth,this.container.offsetHeight),this.container.appendChild(e.domElement),e}_initRenderCSS3D(){const e=new Vs(this.viewport);return e.domElement.id="ssp_view_3DPoi",e.domElement.style.position="absolute",e.domElement.style.top="0",e.domElement.style.width="100%",e.domElement.style.height="100%",e.setSize(this.container.offsetWidth,this.container.offsetHeight),this.container.appendChild(e.domElement),e}_initInteractiveContainer(){return this.rendererCSS3D.domElement}}const Ys=new d,Qs=(e,t)=>{const i=Ys.clone(),r=Ys.clone(),s=Ys.clone();i.makeRotationY(e),r.makeRotationX(t);const o=new n;return s.multiplyMatrices(i,r),o.setFromRotationMatrix(s),o},Xs=Qs(-Math.PI/2,-Math.PI/4),Zs=Qs(Math.PI/2,-Math.PI/4),Ks=Qs(-Math.PI/4,-Math.PI/4),qs=Qs(Math.PI/4,-Math.PI/4),Js=Qs(1.25*Math.PI,-Math.PI/4),$s=Qs(.75*Math.PI,-Math.PI/4),eo={LEFT:new n(0,-Math.PI/2,0),RIGHT:new n(0,Math.PI/2,0),FRONT:new n(0,0,0),BACK:new n(0,Math.PI,0),TOP:new n(-Math.PI/2,0,0),BOTTOM:new n(Math.PI/2,0,0),FRONTTOP:new n(-Math.PI/4,0,0),BACKTOP:new n(Math.PI/4,Math.PI,0),LEFTTOP:new n(Xs.x,Xs.y,Xs.z),RIGHTTOP:new n(Zs.x,Zs.y,Zs.z),LEFTFRONTTOP:new n(Ks.x,Ks.y,Ks.z),RIGHTFRONTTOP:new n(qs.x,qs.y,qs.z),LEFTBACKTOP:new n(Js.x,Js.y,Js.z),RIGHTBACKTOP:new n($s.x,$s.y,$s.z)},to=e=>ti(e)?e:e.includes("%")?.01*Number(e.split("%")[0]):isNaN(+e)?0:Number(e),no=new t,io=new n,ro=new j(50,1,.1,5e5);ro.position.set(500,1e3,500),ro.lookAt(no.set(0,0,0)),ro.name="Camera";class so{constructor(e){this.viewport=e,this.mainCamera=ro.clone(),this.mainCamera.name="freeCamera",this.currentCamera=this.mainCamera,this.cameras={}}createCamera(e){const t=ro.clone();return t.name=e,this.cameras[e]=t,t}removeCamera(e){return"fullFreeCamera"!==e&&(delete this.cameras[e],!0)}setCurrentCamera(e){this.currentCamera=this.viewport.camera=e,this.viewport.signals.cameraObjectChange.dispatch()}getMainCamera(){return this.mainCamera}getCameraViewpoint(){if("free"===this.viewport.controls.options.type)return{position:this.currentCamera.position.clone(),rotation:{x:this.currentCamera.rotation.x,y:this.currentCamera.rotation.y,z:this.currentCamera.rotation.z}};{const e=this.viewport.controls.currentControls;return{position:this.currentCamera.position.clone(),target:e.target.clone()}}}setCameraViewpoint(e){if("free"===this.viewport.controls.options.type&&ii(e)){const{position:t,rotation:n}=e;this.currentCamera.position.set(t.x,t.y,t.z),this.currentCamera.rotation.set(n.x,n.y,n.z)}else if(ii(e)){const{position:t,target:n}=e,i=this.viewport.controls.currentControls;this.currentCamera.position.set(t.x,t.y,t.z),i.target.set(n.x,n.y,n.z)}this.viewport.signals.cameraChange.dispatch(this.currentCamera.position.clone())}moveTo(e,t){return hi(this.currentCamera.position,e,t,(e=>this.viewport.signals.cameraChange.dispatch(e)))}rotateTo(e,t){const n=this.currentCamera.quaternion.clone(),i=(new r).setFromEuler(e);return hi({t:0},{t:1},t,(e=>{let{t:t}=e;this.currentCamera.quaternion.slerpQuaternions(n,i,t)}))}async flyTo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",i=arguments.length>2?arguments[2]:void 0;if($n(t)){const e=t.toLocaleUpperCase();"CURRENT"===e?io.copy(this.currentCamera.rotation):eo[e]&&io.copy(eo[e])}else t instanceof n?io.copy(t):ii(t)&&io.set(t.x,t.y,t.z);io.copy(Bn(this.currentCamera.rotation,io.clone())),await Promise.all([this.moveTo(e,i),this.rotateTo(io,i)])}async flyToBoundingBox(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",i=arguments.length>2?arguments[2]:void 0;if(e.isEmpty())return void Tn("target box is empty");const r=this.viewport.controls.options.type,s=new t;if($n(n)){if("CURRENT"===n.toLocaleUpperCase())s.copy(this.getMovePosByBBox(e));else{const t=eo[n.toLocaleUpperCase()],i=this.getObjectLabelPos(e,t);s.copy(i)}}else{"orbit"===r&&Tn("orbit 控制器不支持 Rotation 类型 的 rotation 参数");const t=Dn(n),i=this.getObjectLabelPos(e,t);s.copy(i)}if("orbit"===r){const t=e.getCenter(no),i=this.viewport.controls.currentControls;i.target.copy(t);const r=new d;r.lookAt(s,t,i.object.up),n=io.setFromRotationMatrix(r)}await this.flyTo(s,n,i)}flyToObj(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e instanceof Bu||e instanceof Eu){const{padding:t=50}=i,r=to(t);return this.flyToBoundingBox(e.getBoundingBox(r),n,i)}{const{padding:r="30%"}=i,s=Cn(e),o=s.getSize(no);let a=0;if($n(r)){const e=Math.max(o.x,o.y,o.z);a=to(r)*e}else a=r;let l=a,c=a;if(a<0){const e=Math.min(o.x,o.z),t=o.y-1;l=Math.abs(a)>e?-e:a,c=Math.abs(l)>t?-t:l}return 0!==r&&(s.max.add(no.set(l/2,c/2,l/2)),s.min.sub(no.set(l/2,c/2,l/2))),s.isEmpty()&&(no.setFromMatrixPosition(e.matrixWorld),s.setFromCenterAndSize(no,new t(0,0,0))),this.flyToBoundingBox(s,n,i)}}surroundOnTarget(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{speed:n=1,angle:i=360,onStart:r}=t,s=En(e),o=s.clone().setY(this.currentCamera.position.y).distanceTo(this.currentCamera.position),a=Math.abs(i);return hi({angle:0},{angle:Math.PI/180*a},{duration:a/360*5e3/n},(e=>{const t=i>0?e.angle:2*Math.PI-e.angle;if(this.currentCamera.position.x=Math.sin(t)*o+s.x,this.currentCamera.position.z=Math.cos(t)*o+s.z,"orbit"===this.viewport.controls.options.type){const e=this.viewport.controls.currentControls;e.target.copy(s),e.update()}else this.currentCamera.lookAt(s)}),r)}surroundOnObject(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=(new i).setFromObject(e).getCenter(no);return this.surroundOnTarget(n,t)}getMovePosByBBox(e){const n=this.currentCamera.position,i=e.getCenter(no);(new t).subVectors(i,n).normalize();let r=new H;r=e.getBoundingSphere(r);const s=this.currentCamera.fov/2*Math.PI/180,o=Math.sin(s),a=r.radius/o,l=new t;this.currentCamera.getWorldDirection(l);const c=l.clone();return c.multiplyScalar(-a),i.clone().add(c)}getObjectLabelPos(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e instanceof xu&&(e=(new i).setFromObject(e)),e.isEmpty())return Tn("target box is empty"),new t;const{extendScale:s=1.6,mode:o="scene"}=r;if("scene"===o){const t=e.getCenter(no),i=e.max.clone().sub(e.min),r=Math.max(i.x,i.y,i.z),o=t.clone(),a=e=>{const t=(s-.5)*Math.abs(r),n=Math.max(t,this.viewport.camera.near);o.add(e.multiplyScalar(n))};let l;return l=$n(n)?eo[n.toLocaleUpperCase()]:Dn(n),a(no.set(0,0,1).applyEuler(l)),o}return"screen"===o?e.getCenter(no).clone():new t}}
2
2
  /**
3
3
  * postprocessing v6.30.2 build Fri Mar 31 2023
4
4
  * https://github.com/pmndrs/postprocessing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soonspacejs",
3
- "version": "2.6.16",
3
+ "version": "2.6.17",
4
4
  "homepage": "http://www.xwbuilders.com:8800/",
5
5
  "description": "soonspacejs 2.x",
6
6
  "module": "./dist/index.esm.js",
@@ -22,11 +22,13 @@
22
22
  "license": "UNLICENSED",
23
23
  "dependencies": {
24
24
  "@robotlegsjs/signals": "^1.1.0",
25
+ "@three3d/animation": "^1.2.2",
26
+ "@three3d/tools": "^1.3.6",
25
27
  "@tweenjs/tween.js": "^18.6.4",
26
28
  "three-mesh-bvh": "0.5.23"
27
29
  },
28
30
  "peerDependencies": {
29
31
  "three": ">=0.151.3"
30
32
  },
31
- "gitHead": "cefaa55c88bbbee734c4be0eafb154225adb20fc"
33
+ "gitHead": "9744d9240f5c2016dd4a9c0641bd6c25ab3c82cc"
32
34
  }