soonspacejs 2.8.14 → 2.8.15
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 +1 -1
- package/package.json +2 -2
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,Scene as r,Quaternion as s,CubeTextureLoader as o,HalfFloatType as a,EquirectangularReflectionMapping as l,TextureLoader as c,Color as u,Texture as h,FileLoader as d,Vector2 as p,Matrix4 as f,BufferAttribute as m,BufferGeometry as g,Float32BufferAttribute as v,LineBasicMaterial as y,Line as w,Line3 as b,MathUtils as x,CurvePath as A,LineCurve as S,LineCurve3 as E,Bone as T,Uint16BufferAttribute as D,SkinnedMesh as C,Skeleton as I,AnimationClip as M,VectorKeyframeTrack as B,QuaternionKeyframeTrack as P,Object3D as O,InterpolateLinear as R,InterpolateDiscrete as L,EventDispatcher as k,LoopPingPong as N,Fog as F,Mesh as z,LineSegments as U,EdgesGeometry as j,MeshStandardMaterial as G,PerspectiveCamera as H,OrthographicCamera as V,WebGLRenderer as Q,PCFSoftShadowMap as _,Sphere as Y,REVISION as W,Camera as X,BasicDepthPacking as Z,UnsignedByteType as K,DepthTexture as q,DepthStencilFormat as J,UnsignedInt248Type as $,UnsignedIntType as ee,WebGLRenderTarget as te,Uniform as ne,RepeatWrapping as ie,LoadingManager as re,NearestFilter as se,LinearFilter as oe,ShaderMaterial as ae,NoBlending as le,RGBADepthPacking as ce,BackSide as ue,DoubleSide as he,FrontSide as de,MeshDepthMaterial as pe,LinearEncoding as fe,sRGBEncoding as me,Vector4 as ge,Material as ve,DataTexture as ye,NoColorSpace as we,WebGLMultipleRenderTargets as be,RedFormat as xe,FloatType as Ae,RGBAFormat as Se,ShaderChunk as Ee,WebGLCubeRenderTarget as Te,CubeCamera as De,PMREMGenerator as Ce,FramebufferTexture as Ie,Matrix3 as Me,TangentSpaceNormalMap as Be,GLSL3 as Pe,VideoTexture as Oe,GLBufferAttribute as Re,InterleavedBufferAttribute as Le,Frustum as ke,MOUSE as Ne,TOUCH as Fe,Spherical as ze,Raycaster as Ue,Clock as je,AnimationMixer as Ge,SRGBColorSpace as He,LinearSRGBColorSpace as Ve,UVMapping as Qe,ACESFilmicToneMapping as _e,CubeTexture as Ye,NoToneMapping as We,LinearToneMapping as Xe,ReinhardToneMapping as Ze,CineonToneMapping as Ke,Sprite 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,ClampToEdgeWrapping as ut,Group as ht,PropertyBinding as dt,NumberKeyframeTrack as pt,LinearMipMapLinearFilter as ft,ImageLoader as mt,InstancedMesh as gt,SpriteMaterial as vt,GridHelper as yt,AxesHelper as wt,Box3Helper as bt,PlaneGeometry as xt,MeshBasicMaterial as At,DirectionalLightHelper as St,HemisphereLightHelper as Et,SpotLightHelper as Tt,PointLightHelper as Dt,Box2 as Ct,Plane as It,CanvasTexture as Mt,MeshPhongMaterial as Bt}from"three";export*from"three";import{RGBELoader as Pt}from"three/examples/jsm/loaders/RGBELoader.js";import{GLTFExporter as Ot}from"three/examples/jsm/exporters/GLTFExporter.js";import{RoomEnvironment as Rt}from"three/examples/jsm/environments/RoomEnvironment.js";import Lt from"three/examples/jsm/libs/stats.module.js";import{Sky as kt}from"three/examples/jsm/objects/Sky.js";import{mergeGeometries as Nt,deinterleaveGeometry as Ft}from"three/examples/jsm/utils/BufferGeometryUtils.js";import"three/examples/jsm/postprocessing/Pass.js";import{WorkerPool as zt}from"three/examples/jsm/utils/WorkerPool.js";import{MeshBVH as Ut,computeBoundsTree as jt,disposeBoundsTree as Gt,acceleratedRaycast as Ht}from"three-mesh-bvh";import{RectAreaLightUniformsLib as Vt}from"three/examples/jsm/lights/RectAreaLightUniformsLib.js";import{TGALoader as Qt}from"three/examples/jsm/loaders/TGALoader.js";import{GLTFLoader as _t}from"three/examples/jsm/loaders/GLTFLoader.js";import{DRACOLoader as Yt}from"three/examples/jsm/loaders/DRACOLoader.js";import*as Wt from"three/examples/jsm/utils/SkeletonUtils.js";import*as Xt from"three/examples/jsm/libs/fflate.module.js";import{NURBSCurve as Zt}from"three/examples/jsm/curves/NURBSCurve.js";import{RectAreaLightHelper as Kt}from"three/examples/jsm/helpers/RectAreaLightHelper.js";var qt="soonspacejs",Jt="2.8.14",$t="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function en(){throw new Error("setTimeout has not been defined")}function tn(){throw new Error("clearTimeout has not been defined")}var nn=en,rn=tn;function sn(e){if(nn===setTimeout)return setTimeout(e,0);if((nn===en||!nn)&&setTimeout)return nn=setTimeout,setTimeout(e,0);try{return nn(e,0)}catch(t){try{return nn.call(null,e,0)}catch(t){return nn.call(this,e,0)}}}"function"==typeof $t.setTimeout&&(nn=setTimeout),"function"==typeof $t.clearTimeout&&(rn=clearTimeout);var on,an=[],ln=!1,cn=-1;function un(){ln&&on&&(ln=!1,on.length?an=on.concat(an):cn=-1,an.length&&hn())}function hn(){if(!ln){var e=sn(un);ln=!0;for(var t=an.length;t;){for(on=an,an=[];++cn<t;)on&&on[cn].run();cn=-1,t=an.length}on=null,ln=!1,function(e){if(rn===clearTimeout)return clearTimeout(e);if((rn===tn||!rn)&&clearTimeout)return rn=clearTimeout,clearTimeout(e);try{return rn(e)}catch(t){try{return rn.call(null,e)}catch(t){return rn.call(this,e)}}}(e)}}function dn(e,t){this.fun=e,this.array=t}dn.prototype.run=function(){this.fun.apply(null,this.array)};function pn(){}var fn=pn,mn=pn,gn=pn,vn=pn,yn=pn,wn=pn,bn=pn;var xn=$t.performance||{},An=xn.now||xn.mozNow||xn.msNow||xn.oNow||xn.webkitNow||function(){return(new Date).getTime()};var Sn=new Date;var En,Tn={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];an.push(new dn(e,t)),1!==an.length||ln||sn(hn)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:fn,addListener:mn,once:gn,off:vn,removeListener:yn,removeAllListeners:wn,emit:bn,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*An.call(xn),n=Math.floor(t),i=Math.floor(t%1*1e9);return e&&(n-=e[0],(i-=e[1])<0&&(n--,i+=1e9)),[n,i]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-Sn)/1e3}},Dn={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-Dn.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*Dn.Bounce.In(2*e):.5*Dn.Bounce.Out(2*e-1)+.5}}},Cn="undefined"==typeof self&&void 0!==Tn&&Tn.hrtime?function(){var e=Tn.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()},In=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=Cn()),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}(),Mn={Linear:function(e,t){var n=e.length-1,i=n*t,r=Math.floor(i),s=Mn.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=Mn.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=Mn.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=Mn.Utils.Factorial;return n(e)/n(t)/n(e-t)},Factorial:(En=[1],function(e){var t=1;if(En[e])return En[e];for(var n=e;n>1;n--)t*=n;return En[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}}},Bn=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Pn=new In,On=function(){function e(e,t){void 0===t&&(t=Pn),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=Dn.Linear.None,this._interpolationFunction=Mn.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=Bn.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?Cn()+parseFloat(e):e:Cn(),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=Cn()),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=Cn()),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=Cn()),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=Bn.nextId,Ln=Pn,kn=Ln.getAll.bind(Ln),Nn=Ln.removeAll.bind(Ln),Fn=Ln.add.bind(Ln),zn=Ln.remove.bind(Ln),Un=Ln.update.bind(Ln),jn={Easing:Dn,Group:In,Interpolation:Mn,now:Cn,Sequence:Bn,nextId:Rn,Tween:On,VERSION:"18.6.4",getAll:kn,removeAll:Nn,add:Fn,remove:zn,update:Un};const Gn="[soonspacejs]: ";var Hn,Vn;!function(e){e.Group="Group",e.Light="Light",e.Model="Model",e.Poi="Poi",e.PoiNode="PoiNode",e.Canvas3D="Canvas3D",e.Topology="Topology",e.Helper="Helper",e.PluginObject="PluginObject"}(Hn||(Hn={})),function(e){e.sbm="SBM",e.sbmx="SBMX",e.dat="DAT",e.glb="GLB",e.gltf="GLTF",e.fbx="FBX"}(Vn||(Vn={}));const Qn="In soonspacejs: ",_n=(e,t)=>{let n="";for(const e in t)n+=`${e}: ${t[e]};`;console.log(`%c${e}`,n)},Yn=e=>{console.warn(Qn+e)},Wn=e=>{console.error(Qn+e)};function Xn(e){return e instanceof t?e:new t(e.x,e.y,e.z)}function Zn(e){return e instanceof n?e:new n(e.x,e.y,e.z)}function Kn(e){const t=new i;return e instanceof r?e.children.filter((e=>!("isTransformControls"in e))).reduce(((e,t)=>e.union((new i).setFromObject(t))),t):t.setFromObject(e),t.isEmpty()&&(e.getWorldPosition(t.min),t.max.copy(t.min)),t}function qn(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 Jn(e,t){const i=qn("x",e,t),r=qn("y",e,t),s=qn("z",e,t);return new n(i.x,r.y,s.z,t.order)}function $n(e){return Math.PI/180*e}function ei(e){return!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?{position:e.getWorldPosition(new t),rotation:(new n).setFromQuaternion(e.getWorldQuaternion(new s)),scale:e.getWorldScale(new t)}:{position:e.position.clone(),rotation:e.rotation.clone(),scale:e.scale.clone()}}function ti(e,t){const n=ei(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 ni(e){return!!e.visible&&(!e.parent||ni(e.parent))}const ii=new t,ri=new t,si=new t,oi=function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;const r=ii.set(e.x/n.width*2-1,-e.y/n.height*2+1,i);return r.unproject(t),r},ai=(e,t,n,i)=>{const r=((e,t,n)=>{const i=n.width/2,r=n.height/2;t.updateMatrixWorld();const s=e.project(t);return s.x=s.x*i+i,s.y=-s.y*r+r,s})(si.copy(e),n,i);let s=0;for(let o=0;o<2;++o){const a=ri.copy(r).setComponent(o,r.getComponent(o)+t),l=oi(a,n,i,a.z);s=Math.max(s,e.distanceTo(l))}return s};class li{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 ci(e){let{path:t="",file:n}=e;if(Array.isArray(n))return(new o).setPath(t).loadAsync(n);{const e=Fi(n);if("hdr"===e||"pic"===e){const e=await(new Pt).setPath(t).setDataType(a).loadAsync(n);return e.mapping=l,e}{const e=await(new c).setPath(t).loadAsync(n);return e.mapping=l,e}}}function ui(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 u,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 c=new h(r);return c.needsUpdate=!0,c}const hi=e=>{const t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)};function di(e){return Pi(e)?function(e){return e.map((e=>di(e)))}(e):Oi(e)?function(e){if(Oi(e)){const t={};for(const n in e)t[n]=di(e[n]);return t}return e}(e):e}const pi=(e,t)=>Pi(e)?e.map(t):t(e),fi=e=>pi(e,(e=>e.clone())),mi=e=>pi(e,(e=>e.dispose())),gi=new d,vi=async(e,t)=>(gi.setResponseType(t),gi.loadAsync(e)),yi=new t,wi=new t,bi=new t;function xi(e,t){const n=yi.setFromMatrixPosition(e.matrixWorld),i=wi.setFromMatrixPosition(t.matrixWorld),r=n.sub(i),s=t.getWorldDirection(bi);return r.angleTo(s)>Math.PI/2}function Ai(e,t,n,i){const r=yi.setFromMatrixPosition(e.matrixWorld),s=r.clone();s.project(t),n.setFromCamera(new p(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 Si=e=>{"function"==typeof requestIdleCallback?requestIdleCallback(e):setTimeout(e)};var Ei=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 Ti(e){return vi(e,"text").then((e=>Promise.resolve(function(e){return(new Ei).toJson(e,{transformTextOnly:!0,removeComments:!0,removeLineBreaks:!0})}(e))))}class Di{name="EXT_mesh_gpu_instancing";constructor(e){this.writer=e}writeNode(e,n){if(!0!==e.isInstancedMesh)return;const i=e.count,r=new f,o=new Float32Array(3*i),a=new Float32Array(4*i),l=new Float32Array(3*i),c=new t,u=new s,h=new t;for(let t=0;t<i;t++)e.getMatrixAt(t,r),r.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 d=this.writer,p={};p.attributes={TRANSLATION:d.processAccessor(new m(o,3)),ROTATION:d.processAccessor(new m(a,4)),SCALE:d.processAccessor(new m(l,3))},n.extensions=n.extensions||{},n.extensions[this.name]=p,d.extensionsUsed[this.name]=!0}}const Ci=Object.prototype.hasOwnProperty,Ii=e=>"String"===Li(e),Mi=e=>"Boolean"===Li(e),Bi=e=>"Number"===Li(e),Pi=Array.isArray,Oi=e=>"Object"===Li(e),Ri=e=>"Function"===Li(e),Li=e=>Object.prototype.toString.call(e).slice(8,-1),ki=(e,t,n)=>String.fromCodePoint(...new Uint8Array(e,t,n)),Ni=()=>Gn+Math.random().toString(36).substring(7).split("").join("_"),Fi=e=>{var t;const{href:n}=new URL(e,location.origin);if(n.includes(".")){const e=n.split(".").pop();if(!e)return;return e.includes("?")?null===(t=e.split("?").shift())||void 0===t?void 0:t.toLowerCase():e}};var zi=Object.freeze({__proto__:null,IVector3ToEuler:Zn,IVector3ToVector3:Xn,MinHeap:li,calculateScaleFactor:ai,cloneDeep:di,cloneMaterials:fi,consoleSspTitle:Qn,deg2Euler:$n,disposeMaterials:mi,error:Wn,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 Ot;r.register((e=>new Di(e))),r.parse(e,(e=>n(e)),(e=>i(e)),t)}))},fetchFile:vi,getAsciiString:ki,getBoundingBox:Kn,getExtension:Fi,getSpaceAttributeFromObject:ei,getTexture:ci,getValueType:Li,gradientTexture:ui,hasOwn:(e,t)=>Ci.call(e,t),idleTask:Si,isArray:Pi,isBoolean:Mi,isDate:e=>"Date"===Li(e),isFunction:Ri,isNull:e=>"Null"===Li(e),isNumber:Bi,isObject:Oi,isObjectBehindCamera:xi,isObjectOccludeVisible:Ai,isObjectVisible:ni,isPromise:e=>"Promise"===Li(e),isString:Ii,isSymbol:e=>"Symbol"===Li(e),isUndefined:e=>"Undefined"===Li(e),log:_n,materialHandle:pi,parseFilePath:hi,randomString:Ni,rotationAFix:Jn,rotationAxisFix:qn,sleep:e=>new Promise((t=>setTimeout((()=>t()),e))),syncSpaceAttributeToObject:ti,warn:Yn,xmlToJson:Ti});const Ui={"Linear.None":Dn.Linear.None,"Quadratic.In":Dn.Quadratic.In,"Quadratic.Out":Dn.Quadratic.Out,"Quadratic.InOut":Dn.Quadratic.InOut,"Cubic.In":Dn.Cubic.In,"Cubic.Out":Dn.Cubic.Out,"Cubic.InOut":Dn.Cubic.InOut,"Quartic.In":Dn.Quartic.In,"Quartic.Out":Dn.Quartic.Out,"Quartic.InOut":Dn.Quartic.InOut,"Quintic.In":Dn.Quintic.In,"Quintic.Out":Dn.Quintic.Out,"Quintic.InOut":Dn.Quintic.InOut,"Sinusoidal.In":Dn.Sinusoidal.In,"Sinusoidal.Out":Dn.Sinusoidal.Out,"Sinusoidal.InOut":Dn.Sinusoidal.InOut,"Exponential.In":Dn.Exponential.In,"Exponential.Out":Dn.Exponential.Out,"Exponential.InOut":Dn.Exponential.InOut,"Circular.In":Dn.Circular.In,"Circular.Out":Dn.Circular.Out,"Circular.InOut":Dn.Circular.InOut,"Elastic.In":Dn.Elastic.In,"Elastic.Out":Dn.Elastic.Out,"Elastic.InOut":Dn.Elastic.InOut,"Back.In":Dn.Back.In,"Back.Out":Dn.Back.Out,"Back.InOut":Dn.Back.InOut,"Bounce.In":Dn.Bounce.In,"Bounce.Out":Dn.Bounce.Out,"Bounce.InOut":Dn.Bounce.InOut};function ji(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,p=Ui[h],f=new On(e).to(t,l).easing(p).delay(c).onUpdate((i=>{e instanceof n&&t instanceof n&&i instanceof n&&(i.order=t.order),null==r||r(i,f)})).onComplete((()=>{o()})).onStop((()=>{a("animation stop")})).onStart((()=>{null==s||s(f)}));Bi(u)?f.repeat(u):Mi(u)&&u&&f.repeat(1/0),f.yoyo(d),f.start()}))}class Gi{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=Xn(o)),o=o.clone();let a=e[s];if(!a)return!0;a.isVector3||(a=Xn(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 ji(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 Hi=Object.defineProperty,Vi=(e,t,n)=>(((e,t,n)=>{t in e?Hi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);function Qi(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 _i(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 Yi(e,t){let n=e.sampleLength;if(!n){const t=e.sampleNum;if(t)return t;n=1}return Math.ceil(t/n)}function Wi(e){const{curve:t}=e;let n=t.getLength();const i=Yi(e,n);return t.arcLengthDivisions<i&&(t.arcLengthDivisions=i,t.updateArcLengths(),n=t.getLength()),{length:n,division:i}}function Xi(e,t){const n=Yi(t??{},e.getLength()),i=e.getPoints(n),r=e.getLengths(n);return Zi(i,{...t,lengths:r})}function Zi(e,t){const{startColor:n,endColor:i,color:r,lengths:s}=t??{},o=r?new u(r):null,a=n?new u(n):o??new u(0,1,0),l=i?new u(i):o??new u(0,0,1),c=[],h=[];e[0].toArray(c,0);const d=c.length,p=s??qi(e).lengths,f=p[p.length-1],m=new u;e.forEach(((e,t)=>{e.toArray(c,t*d);const n=p[t]/f;m.lerpColors(a,l,n),m.toArray(h,3*t)}));const y=new g;return y.setAttribute("position",new v(c,d)),y.setAttribute("color",new v(h,3)),y}function Ki(e,t){t=t??{};let{material:n,linewidth:i}=t;i=i??1,n=n??new y({vertexColors:!0,linewidth:i});const r=Array.isArray(e)?Zi(e,t):Xi(e,t);return new w(r,n)}function qi(e){const t=Ji(e),n=[0],i=t.reduce(((e,t)=>(e+=t.distance(),n.push(e),e)),0);return{lines:t,lengths:n,length:i}}function Ji(e){const t=[];return e.reduce(((e,n)=>{const i=new b(e,n);return t.push(i),n})),t}function $i(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 er(e,t){const{distSortIndexs:n,clampDists:i,clampPoints:r,ts:s,clampTs:o}=tr(e,t),a=n[0];return{line:t[a],index:a,clampDist:i[a],clampPoint:r[a],t:s[a],clampT:o[a]}}function tr(e,n){const i={clampDists:[],clampPoints:[],distSortIndexs:[],ts:[],clampTs:[]};return n.forEach(((n,r)=>{const s=n.closestPointToPointParameter(e),o=x.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 nr(e){const t=new A,n=null==e[0].z?S:E;return e.reduce(((e,i)=>{const r=new n(e,i);return t.add(r),i})),t}var ir=(e=>(e.back="back",e.front="front",e))(ir||{});function rr(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,p=0,f=!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),p=d.distanceTo(a),u=Math.abs(n-p)>s;const r=n/p;if(e&&u&&r>1){f=!1;break}l*=r}while(u);return{succeed:f,u:h,point:d,distance:p}}function sr(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,p=a;do{d=u+i;let e=!1;d>1?(d=1,e=!0):d<0&&(d=0,e=!0),p=t.getPointAt(d);const o=p.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:p}}const or=new t,ar=new t(1,1,1);new s;const lr=new f;function cr(e){const{joints:t,axials:n}=e;if(t)var i=hr(t);else i=n?ur(e):dr(e);return i}function ur(e){const{axials:t,start:n}=e,i=new T;n&&(i.position.copy(n),i.updateMatrix());const r=[i];return t.reduce(((e,t)=>{const n=new T;return n.position.copy(t),e.add(n),r.push(n),n.updateMatrix(),n}),i),i.updateWorldMatrix(!0,!0),r}function hr(e){const t=[];return e.reduce(((e,n)=>{const i=n.clone().sub(e);return t.push(i),n})),ur({axials:t,start:e[0]})}function dr(e){const{start:t,axial:n}=e;let i=e.number;const r=new Array(i-1);return r.fill(n),ur({axials:r,start:t})}function pr(e){const{geometry:n,flexible:i=1,axial:r,number:o}=e,a=e.start??new t,l=r.clone().normalize(),c=r.length(),u=o-1,h=(new s).setFromUnitVectors(new t(1,0,0),l),d=(new f).compose(a,h,new t(1,1,1)).invert(),p=n.getAttribute("position").clone(),m=p.count;p.applyMatrix4(d);const g=[],y=[];for(let e=0;e<m;e++){const t=p.getX(e);if(t<0){g.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;g.push(n,n+1,0,0),y.push(1-e,e,0,0)}else g.push(u,0,0,0),y.push(1,0,0,0)}return n.setAttribute("skinIndex",new D(g,4)),n.setAttribute("skinWeight",new v(y,4)),n}function fr(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),pr({...e,start:o,axial:a,number:n.bones.length})}function mr(e){const{skeleton:n,geometry:i,flexible:r=1,geometryFrame:s}=e,o=(null==s?void 0:s.clone().invert())??lr.clone(),a=n.boneInverses.map((e=>{const n=e.clone().invert().premultiply(o);return(new t).setFromMatrixPosition(n)})),l=Ji(a),c=i.getAttribute("position"),u=c.count,h=[],d=[],p=new t;for(let e=0;e<u;e++){p.fromBufferAttribute(c,e);const{index:t,clampT:n}=er(p,l),i=n*r;h.push(t,t+1,0,0),d.push(1-i,i,0,0)}return i.setAttribute("skinIndex",new D(h,4)),i.setAttribute("skinWeight",new v(d,4)),i}function gr(e){const{geometry:t}=e,n=e.material??void 0,i=new C(t,n),r=cr(e);i.add(r[0]);const s=new I(r);return i.bind(s),mr({...e,skeleton:s}),i}function vr(e){const{skeleton:t}=e,n=yr(e);return n.updateMatrix(),n.updateMatrixWorld(),n.bind(t),n}function yr(e){const{target:t,skeleton:n}=e,i=t.geometry,r=new C;return t.copy.call(r,t,!1),mr({...e,geometry:i,skeleton:n,geometryFrame:t.matrixWorld}),r}function wr(e){const{target:t}=e;let{skeleton:n}=e;if(n)var i=n.bones[0];else{const t=cr(e);n=new I(t),i=t[0]}t.add(i),t.updateWorldMatrix(!1,!0),n.calculateInverses(),i.removeFromParent();const r=br({...e,target:t,skeleton:n});return r.add(i),{model:r,skeleton:n,rootBone:i}}function br(e){const{target:t,skeleton:n,parent:i,posOnBone:r}=e,s=t.isMesh,o=s?yr({...e,skeleton:n}):t.clone(!1);i&&i.add(o),o.updateMatrixWorld(!0),s&&(o.bind(n,t.matrixWorld),r&&(o.frustumCulled=!1));const a=t.children;for(const t of a)br({...e,target:t,parent:o});return o}function xr(e){return e.filter((e=>{var t;return!(null!=(t=e.parent)&&t.isBone)}))}function Ar(e){return e.find((e=>{var t;return!(null!=(t=e.parent)&&t.isBone)}))}function Sr(e){return Ar(e)??e[0]}function Er(e){return e.curve?Tr(e):Pr(e)}function Tr(e){const{keyframeTracks:t,duration:n,...i}=Dr(e);return{...i,clip:new M(e.name,n,t)}}function Dr(e){const{curve:t,lookDistance:n}=e,i=e.targetPath??"",r=Wi(e).division,s=Cr(e,t.getLength()),o=R,a=[],l=Mr(r),c={...e,duration:s,division:r,ts:l,lookPoint:{distance:n}},u=Br(c),{points:h,rotates:d,...p}=Ir(c);if(h.length){const e=[];h.forEach(((t,n)=>{t.toArray(e,3*n)}));const t=new B(`${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 P(`${i}.quaternion`,u,e,o);a.push(t)}return{...p,keyframeTracks:a,duration:s}}function Cr(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 Ir(e){var n,i;const{curve:r,target:o,lookPoint:a,enableUp:l,fixUp:c}=e,u=e.position??!0,h=e.rotate??!0,d=[],p=[],m=[];if(!u&&!h)return{rotates:d,points:p,curveLength:void 0,lengths:void 0};const g=(e.anchor??or).clone(),v=e.ts??e.us,y=!e.ts;if(!v)throw"缺少参数:至少传递 ts 和 us 任意之一";let w=lr.clone(),b=lr.clone(),x=ar.clone(),A=O.DEFAULT_UP;o&&(o.updateWorldMatrix(!0,!1),w=o.matrix,b=o.matrixWorld,x=o.scale,A=o.up);const S=w.clone().invert(),E=b.clone().multiply(S).clone().invert(),T=r.getTangent(0);T.transformDirection(E);const D=(null==(n=e.front)?void 0:n.clone().normalize())??T,C=(null==(i=e.up)?void 0:i.clone().normalize())??A.clone().transformDirection(E);let I=w.clone().setPosition(0,0,0),M=e=>r.getPoint(e),B=e=>r.getTangent(e);y&&(M=e=>r.getPointAt(e),B=e=>r.getTangentAt(e));const P=v.length,R=P-1;let{distance:L,curveLength:k,lengths:N}=a??{};L=L??0;let F=B;0!==L&&(N||(N=_i(r,v,y).lengths),null==k&&(k=N[R]),F=(e,t)=>{const n=M(e);let i=(N[t]+L)/k;return i>1&&(i=1),r.getPointAt(i).sub(n).normalize()});let z=e=>{const t=v[e],n=F(t,e);n.transformDirection(E),m.push(n);const i=e-1,r=i<0,o=r?D:m[i],a=(new s).setFromUnitVectors(o,n);if(!r){const e=d[i];a.multiply(e)}return a.normalize()};if(l){const e=new t(0,1,0);z=c?function(t){const n=v[t],i=F(n,t);i.transformDirection(E),m.push(i);const r=t-1;let o;if(r<0)o=(new s).setFromUnitVectors(D,i);else{const e=d[r],t=D.clone().applyQuaternion(e).normalize();o=(new s).setFromUnitVectors(t,i),o.multiply(e)}const a=C.clone().applyQuaternion(o).normalize(),l=(new s).setFromUnitVectors(a,e);return o.premultiply(l),o.normalize()}:function(t){const n=v[t],i=F(n,t);i.transformDirection(E),m.push(i);const r=t-1,o=r<0,a=o?D:m[r],l=(new s).setFromUnitVectors(a,i);if(o){const t=C.clone().applyQuaternion(l);t.projectOnPlane(i).normalize();const n=e.clone().projectOnPlane(i).normalize(),r=(new s).setFromUnitVectors(t,n);l.premultiply(r)}else{const e=d[r];l.multiply(e)}return l.normalize()}}for(let e=0;e<P;e++){const t=v[e];if(h){const t=z(e);d.push(t),I=(new f).compose(or,t,x)}if(u){const e=M(t);e.applyMatrix4(E);const n=g.clone().applyMatrix4(I);e.sub(n),p.push(e)}}return{rotates:d,points:p,curveLength:k??void 0,lengths:N??void 0}}function Mr(e){const t=[];for(let n=0;n<=e;n++)t.push(n/e);return t}function Br(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 Pr(e){const{smooth:t,points:n}=e;if(!1===t)var{keyframeTracks:i,duration:r,...s}=Or(e);else{const t=nr(n);var{keyframeTracks:i,duration:r,...s}=Dr({...e,curve:t})}return{...s,clip:new M(e.name,r,i)}}function Or(e){const t=e.targetPath??"",n=e.points,{lines:i,length:r,lengths:s}=qi(n),o=Cr(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 B(`${t}.position`,u,e,R);a.push(n)}if(h.length){const e=[];h.forEach(((t,n)=>{t.toArray(e,4*n)}));const n=new P(`${t}.quaternion`,d,e,L);a.push(n)}return{keyframeTracks:a,duration:o,lengths:s,curveLength:r}}function Rr(e,n){var i,r;const{points:o,target:a,times:l,enableUp:c,fixUp:u}=e,h=e.position??!0,d=e.rotate??!0,p=o.length,m=p-1;n=n??Ji(o);const g=[],v=[],y=[],w=[],b={rotates:g,points:v,rotateTimes:l,pointTimes:y};if(!h&&!d)return b;const x=(e.anchor??or).clone();let A=lr.clone(),S=lr.clone(),E=ar.clone(),T=O.DEFAULT_UP;a&&(a.updateWorldMatrix(!0,!1),A=a.matrix,S=a.matrixWorld,E=a.scale,T=a.up);const D=A.clone().invert(),C=S.clone().multiply(D).clone().invert(),I=n[0].delta(new t);I.transformDirection(C);const M=(null==(i=e.front)?void 0:i.clone().normalize())??I,B=(null==(r=e.up)?void 0:r.clone().normalize())??T.clone().transformDirection(C);let P=A.clone().setPosition(0,0,0),R=P,L=e=>{const i=n[e].delta(new t).normalize();i.transformDirection(C),w.push(i);const r=e-1,o=r<0,a=o?M:w[r],l=(new s).setFromUnitVectors(a,i);if(!o){const e=g[r];l.multiply(e)}return l.normalize()};if(c){const e=new t(0,1,0);L=u?function(i){const r=n[i].delta(new t).normalize();r.transformDirection(C),w.push(r);const o=i-1;let a;if(o<0)a=(new s).setFromUnitVectors(M,r);else{const e=g[o],t=M.clone().applyQuaternion(e).normalize();a=(new s).setFromUnitVectors(t,r),a.multiply(e)}const l=B.clone().applyQuaternion(a).normalize(),c=(new s).setFromUnitVectors(l,e);return a.premultiply(c),a.normalize()}:function(i){const r=n[i].delta(new t).normalize();r.transformDirection(C),w.push(r);const o=i-1,a=o<0,l=a?M:w[o],c=(new s).setFromUnitVectors(l,r);if(a){const t=B.clone().applyQuaternion(c);t.projectOnPlane(r).normalize();const n=e.clone().projectOnPlane(r).normalize(),i=(new s).setFromUnitVectors(t,n);c.premultiply(i)}else{const e=g[o];c.multiply(e)}return c.normalize()}}for(let e=0;e<p;e++){if(d)if(e<m){const t=L(e);g.push(t),P=(new f).compose(or,t,E)}else g.push(g[e-1].clone());if(h){const t=l[e],n=o[e].clone();if(n.applyMatrix4(C),e>0){const e=x.clone().applyMatrix4(R),i=n.clone().sub(e);v.push(i),y.push(t)}const i=x.clone().applyMatrix4(P);n.sub(i),v.push(n),y.push(t)}R=P}return b}function Lr(e){const t=e.mixer,n=wr(e),{model:i,skeleton:r}=n,s={...e,target:i,skeleton:r},{clip:o,...a}=e.posOnBone?kr(s):zr(s);i.animations.push(o);const l=null==t?void 0:t.clipAction(o,i);return{...a,...n,clip:o,action:l}}function kr(e){const{boneTracks:t,duration:n,...i}=Nr(e),r=t.flat();return{...i,clip:new M(e.name,n,r)}}function Nr(e){const{skeleton:t,targetPath:n}=e,i=t.bones,{times:r,boneSampleDatas:s,duration:o,...a}=Fr(e),l=r.length,c=R,u=s.map(((e,t)=>{const{points:s,rotates:o}=e,a=i[t],u=n?`${n}.skeleton.bones[${t}]`:`${a.name||a.uuid}`,h=[],d=[];for(let e=0;e<l;e++)s&&s[e].toArray(h,3*e),o[e].toArray(d,4*e);const p=[];if(s){const e=new B(`${u}.position`,r,h,c);p.push(e)}const f=new P(`${u}.quaternion`,r,d,c);return p.push(f),p}));return{...a,boneTracks:u,duration:o}}function Fr(e){var n;const{curve:i,skeleton:r,stretch:o}=e,{bones:a,boneInverses:l}=r,c=a[0],u=e.target??c.parent;if(!u)throw"target 或 根骨骼的 parent 不存在";const h=e.tolerance??.1;c.updateWorldMatrix(!0,!0);const{division:d,length:p}=Wi(e),{matrixWorld:m}=u,g=m.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}),g);const w=y[0],b=new t,x=new s,A=new t;w.decompose(b,x,A);const S=Cr(e,p),E=Mr(d),T=Br({curve:i,division:d,duration:S}),D=E.length,C=[],I=(new t).setFromMatrixPosition(y[1]).negate(),M=l[0],B=null==(n=e.up)?void 0:n.clone().applyMatrix4(m).transformDirection(M),{points:P,rotates:O,...R}=Ir({...e,curve:i,ts:E,target:c,rotate:!0,front:I,up:B,anchor:null});for(let e=0;e<D;e++)C.push(m.clone());const L=P.map(((e,t)=>{const n=O[t];n.premultiply(x).normalize();const i=(new f).compose(e,n,A);return i.premultiply(m),i})),k=i.getLengths(d).map((e=>e/p)),N=[{points:P,rotates:O,us:k,matrixs:L}],F=o?function(e,t,n){const r=N[e].us[t]-n/p;return{u:r,point:r<0?null:i.getPointAt(r)}}:function(e,t,n){const r=N[e].us[t],{u:s,point:o,succeed:a}=rr({curve:i,distance:n,fromU:r,length:p,side:ir.front,tolerance:h*n});return{u:s,point:a?o:null}},z=l.length,U=z-1;for(let e=1;e<z;e++){const n=[],r=[],o=[],a=[];N.push({points:n,rotates:r,us:o,matrixs:a});const l=y[e],c=v[e],u=e-1,h=N[u],d=y[u],p=v[u],{matrixs:m,points:g,rotates:w}=h,b=(new t).setFromMatrixScale(d),x=u-1,A=x<0?C:N[x].matrixs,S=new t,E=new s,T=new t;l.decompose(S,E,T);const I=(new t).setFromMatrixPosition(c).sub((new t).setFromMatrixPosition(p)).length(),M=S.length();for(let t=0;t<D;t++){const{point:c,u:h}=F(u,t,I);o.push(h),r.push(E.clone());const d=m[t];if(h<0||!c){n.push(S);const e=d.clone().multiply(l);a.push(e);continue}const p=A[t];let v=p.clone().invert();const y=c.clone().applyMatrix4(v),x=g[t];y.sub(x).normalize();const D=w[t],C=(new f).compose(x,D,b),B=S.clone().transformDirection(C),P=(new s).setFromUnitVectors(B,y);D.premultiply(P).normalize(),d.compose(x,D,b),d.premultiply(p);const O=d.clone().invert();c.applyMatrix4(O);const R=c.length();c.copy(S).multiplyScalar(R/M),n.push(c);const L=(new f).compose(c,E,T);if(e===U){const e=i.getTangentAt(h);e.negate().transformDirection(O);const n=(new s).setFromUnitVectors(c.clone().normalize(),e);n.premultiply(E).normalize(),r[t]=n,L.compose(c,n,T)}L.premultiply(d),a.push(L)}}return{...R,times:T,boneSampleDatas:N,duration:S}}function zr(e){const{boneTracks:t,targetTracks:n,duration:i,...r}=Ur(e),s=n.concat(t.flat());return{...r,clip:new M(e.name,i,s)}}function Ur(e){const{skeleton:t,targetPath:n}=e,{times:i,boneSampleDatas:r,duration:s,targetSampleDatas:o,...a}=jr(e),l=i.length,c=t.bones,u=R,h=[],d=[],{points:p,rotates:f}=o;for(let e=0;e<l;e++)p[e].toArray(h,3*e),f[e].toArray(d,4*e);const m=n??"",g=[new B(`${m}.position`,i,h,u),new P(`${m}.quaternion`,i,d,u)],v=r.map(((e,t)=>{const{points:r,rotates:s}=e,o=c[t],a=n?`${n}.skeleton.bones[${t}]`:`${o.name||o.uuid}`,h=[],d=[];for(let e=0;e<l;e++)r&&r[e].toArray(h,3*e),s[e].toArray(d,4*e);const p=[];if(r){const e=new B(`${a}.position`,i,h,u);p.push(e)}const f=new P(`${a}.quaternion`,i,d,u);return p.push(f),p}));return{...a,boneTracks:v,targetTracks:g,duration:s}}function jr(e){const{curve:n,skeleton:i,stretch:r}=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:d}=Wi(e),{matrix:p,matrixWorld:m,scale:g}=c,v=m.clone().multiply(p.clone().invert()),y=m.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 x=b[0],A=new t,S=new s,E=new t;x.decompose(A,S,E);const T=Cr(e,d),D=Mr(h),C=w[0],I=(new t).setFromMatrixPosition(b[1]).negate().transformDirection(C).transformDirection(y),{rotates:M,points:B,...P}=Ir({...e,curve:n,target:c,position:!0,rotate:!0,anchor:A,front:I,ts:D}),O=Br({curve:n,division:h,duration:T}),R=B.map(((e,t)=>{const n=M[t],i=(new f).compose(e,n,g);return i.premultiply(v),i})),L={points:B,rotates:M,matrixs:R},k=[],N=R.map((e=>(k.push(S.clone()),e.clone().multiply(x)))),F=D.length,z=n.getLengths(h).map((e=>e/d)),U=[{rotates:k,us:z,matrixs:N}],j=r?function(e,t,i){const r=U[e].us[t]-i/d;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}=rr({curve:n,distance:i,fromU:r,length:d,side:ir.front,tolerance:u*i});return{u:s,point:a?o:null}},G=a.length,H=G-1;for(let e=1;e<G;e++){const i=[],r=[],o=[],a=[];U.push({points:i,rotates:r,us:o,matrixs:a});const l=b[e],c=w[e],u=e-1,h=U[u],d=b[u],p=w[u],{matrixs:m,points:g,rotates:v}=h,y=new t,x=new s,A=new t;d.decompose(y,x,A);const S=u-1,E=S<0?R:U[S].matrixs,T=new t,D=new s,C=new t;l.decompose(T,D,C);const I=(new t).setFromMatrixPosition(c).sub((new t).setFromMatrixPosition(p)).length(),M=T.length();for(let t=0;t<F;t++){const{point:c,u:h}=j(u,t,I);o.push(h),r.push(D.clone());const d=m[t];if(h<0||!c){i.push(T);const e=d.clone().multiply(l);a.push(e);continue}const p=E[t];let w=p.clone().invert();const b=c.clone().applyMatrix4(w),S=(null==g?void 0:g[t])??y;b.sub(S).normalize();const B=v[t],P=(new f).compose(S,B,A),O=T.clone().transformDirection(P);B.setFromUnitVectors(O,b),B.premultiply(x).normalize(),d.compose(S,B,A),d.premultiply(p);const R=d.clone().invert();c.applyMatrix4(R);const L=c.length();c.copy(T).multiplyScalar(L/M),i.push(c);const k=(new f).compose(c,D,C);if(e===H){const e=n.getTangentAt(h);e.negate().transformDirection(R);const i=(new s).setFromUnitVectors(c.clone().normalize(),e);i.premultiply(D).normalize(),r[t]=i,k.compose(c,i,C)}k.premultiply(d),a.push(k)}}return{...P,times:O,boneSampleDatas:U,targetSampleDatas:L,duration:T}}class Gr{constructor(e){Vi(this,"isAnimationClipKeyframe",!0),Vi(this,"_tracksTimes",null),Vi(this,"lastGetTime",0),Vi(this,"lastGetKeyframeIndexs",[]),this.clip=e}get tracksTimes(){return this._tracksTimes??(this._tracksTimes=this.clip.tracks.map((e=>e.times)))}getTracksKeyframeIndexs(e){const{lastGetTime:t,tracksTimes:n}=this;e<t&&(this.lastGetKeyframeIndexs=[]),this.lastGetTime=e;const i=this.lastGetKeyframeIndexs;return this.lastGetKeyframeIndexs=n.map(((t,n)=>{const r=i[n]??0,s=t.length;for(let n=r;n<s;n++)if(e<t[n])return n-1;return s-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}}))}}var Hr=(e=>(e.keyframe="keyframe",e.position=".position",e.quaternion=".quaternion",e.rotation=".rotation",e.scale=".scale",e.loop="loop",e.finished="finished",e.point="point",e))(Hr||{});const Vr=["loop","finished"];class Qr extends Gr{constructor(e){super(e.getClip()),Vi(this,"isAnimationActionKeyframe",!0),Vi(this,"_trackNames"),Vi(this,"_positionTrackName"),Vi(this,"_quaternionTrackName"),Vi(this,"_rotationTrackName"),Vi(this,"_scaleTrackName"),Vi(this,"event",new k),Vi(this,"_frameEventNames",null),Vi(this,"mixerListener",(e=>{(e.action.isAnimationActionKeyframe?e.action.action:e.action)===this.action&&this.event.dispatchEvent(e)})),Vi(this,"_points",[]),Vi(this,"_polyline"),Vi(this,"_polylineLengths",[]),Vi(this,"_pointsProgress",[]),Vi(this,"lastGetProgress",0),Vi(this,"lastGetPointIndex",0),Vi(this,"_enablePointEvent",!0),Vi(this,"_enableKeyframeEvent",!0),Vi(this,"lastKeyframes",null),Vi(this,"lastPolylineKeyframe",null),Vi(this,"frameFun",(()=>{var e;if(this.enableKeyframeEvent){const{keyframes:e,lastKeyframes:t}=this;let n=!1;for(const[i,r]of Object.entries(e)){const e=null==t?void 0:t[i];r.index!==(null==e?void 0:e.index)&&(n=!0,this.event.dispatchEvent({type:i,preFrame:e,frame:r}))}n&&(this.event.dispatchEvent({type:"keyframe",preFrame:t,frame:e}),this.lastKeyframes=e)}if(this.pointEventEnabled){const{pointIndex:t,lastPolylineKeyframe:n}=this;if(t!==(null==n?void 0:n.index)){const i={index:t,value:this.points[t]??(null==(e=this.polyline)?void 0:e.getPoint(this.progress)),length:this.polylineLengths[t]};this.event.dispatchEvent({type:"point",preFrame:n,frame:i}),this.lastPolylineKeyframe=i}}})),Vi(this,"_stopListenFun"),this.action=e}get time(){return this.action.time}get duration(){return this.clip.duration}get progressTime(){const{isReverseLoop:e,duration:t,time:n}=this;return e?t-n:n}set progressTime(e){const{action:t,isReverseLoop:n,duration:i}=this;n&&(e=i-e),t.time=e}get progress(){return this.progressTime/this.duration}set progress(e){this.progressTime=e*this.duration}get loopCount(){const e=this.action._loopCount;return-1===e?0:e}get isReverseLoop(){return this.action.loop===N&&this.loopCount%2==1}get loopDirFactor(){return this.isReverseLoop?-1:1}get isReverse(){const e=this.action.timeScale<0;return this.isReverseLoop?!e:e}get dirFactor(){return this.isReverse?-1:1}get trackNames(){return this._trackNames??(this._trackNames=this.clip.tracks.map((e=>e.name)))}get keyframeIndexs(){const e=this.getTracksKeyframeIndexs(this.progressTime);return this.trackNames.reduce(((t,n,i)=>(t[n]=e[i],t)),{})}get keyframes(){const e=this.getTracksKeyframes(this.progressTime);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 s(...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}get frameEventNames(){return this._frameEventNames??(this._frameEventNames=[...this.trackNames,"keyframe","point"])}get mixer(){return this.action._mixer}addEventListener(e,t){const n=this.mixerListener;return Vr.includes(e)&&!this.mixer.hasEventListener(e,n)?(this.mixer.addEventListener(e,n),this.event.addEventListener(e,t),!0):!!this.frameEventNames.includes(e)&&(this.event.addEventListener(e,t),!this._stopListenFun&&this.enableFrameEvent&&(this._stopListenFun=_r(this.frameFun)),!0)}removeEventListener(e,t){if(Vr.includes(e)&&1===this.getListeners(e).length){const t=this.mixerListener;this.mixer.removeEventListener(e,t)}this.event.removeEventListener(e,t),this.stopListenFun&&!this.hasListeners&&(this.stopListenFun=null)}get points(){return this._points}set points(e){e.length>1?(this._points=e,this.polyline=nr(e)):(this._points=[],this.polyline=null)}get polyline(){return this._polyline}set polyline(e){this._polyline=e;const t=(null==e?void 0:e.getCurveLengths())??[];this.polylineLengths=[0,...t]}get polylineLengths(){return this._polylineLengths}set polylineLengths(e){this._polylineLengths=e;const t=1/e[e.length-1];this.pointsProgress=e.map((e=>e*t))}get polylineLength(){return this.polylineLengths[this.polylineLengths.length-1]}get polylineProgressLength(){return this.polylineLength*this.progress}get pointsProgress(){return this._pointsProgress}set pointsProgress(e){this._pointsProgress=e}get pointIndex(){return this.getPointIndex(this.progress)}getPointIndex(e){const{lastGetProgress:t,pointsProgress:n}=this;e<t&&(this.lastGetPointIndex=0),this.lastGetProgress=e;const i=Math.max(this.lastGetPointIndex,0),r=n.length;for(let t=i;t<r;t++)if(e<n[t])return this.lastGetPointIndex=t-1;return this.lastGetPointIndex=r-1}get enablePointEvent(){return this._enablePointEvent}set enablePointEvent(e){this._enablePointEvent=e,e&&this.autoStartListen()}get pointEventEnabled(){return this.enablePointEvent&&this.pointsProgress.length>0&&this.getListeners("point").length>0}get enableKeyframeEvent(){return this._enableKeyframeEvent}set enableKeyframeEvent(e){this._enableKeyframeEvent=e,e&&this.autoStartListen()}get enableFrameEvent(){return this.enableKeyframeEvent||this.enablePointEvent}get stopListenFun(){return this._stopListenFun}set stopListenFun(e){const t=this._stopListenFun;t&&t(),this._stopListenFun=e}startListen(){this.stopListenFun||(this.stopListenFun=_r(this.frameFun))}stopListen(){this.stopListenFun=null}autoStartListen(){!this.stopListenFun&&this.enableFrameEvent&&this.hasListeners&&(this.stopListenFun=_r(this.frameFun))}get listeners(){return this.event._listeners}get hasListeners(){const e=this.listeners;return!!e&&Object.values(e).some((e=>e&&e.length>0))}getListeners(e){var t;return(null==(t=this.listeners)?void 0:t[e])??[]}destroy(e){const{action:t,mixer:n,mixerListener:i}=this;this.stopListen(),n.removeEventListener("loop",i),n.removeEventListener("finished",i),this.event._listeners=null,!e&&(t.stop(),t.reset(),n._deactivateAction(t),n._removeInactiveAction(t))}}function _r(e){let t;const n=i=>{e(i),t=requestAnimationFrame(n)};return t=requestAnimationFrame(n),()=>{cancelAnimationFrame(t)}}class Yr extends Qr{constructor(){super(...arguments),Vi(this,"isAnimationActionOperate",!0)}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 Wr(e){const t=new Yr(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 Xr{constructor(e){Vi(this,"_action"),this.setAction(e)}get action(){return this._action}set action(e){this.setAction(e)}setAction(e){this._action=e&&Wr(e)}get play(){const e=this.action;return!(!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 Zr(e){var t;null==(t=e.reset)||t.call(e,!0)}class Kr extends Xr{constructor(e,t=[]){super(e),Vi(this,"_updateGUI",null),this.guis=t}get updateGUI(){return this._updateGUI??this.constructor.updateGUI??Zr}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 qr(e){const t=new Kr(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 Jr(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 $r(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=Jr(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}Vi(Kr,"updateGUI",Zr);var es="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ts(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 ns={},is={},rs=function(e,t){return rs=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])},rs(e,t)};function ss(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}rs(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var os=function(){return os=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},os.apply(this,arguments)};function as(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}function ls(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}function cs(e,t){return function(n,i){t(n,i,e)}}function us(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function hs(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())}))}function ds(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])}}}var ps=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 fs(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||ps(t,e,n)}function ms(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 gs(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 vs(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(gs(arguments[t]));return e}function ys(){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}function ws(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))}function bs(e){return this instanceof bs?(this.v=e,this):new bs(e)}function xs(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 bs?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])}}function As(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:bs(e[i](t)),done:!1}:r?r(t):t}:r}}function Ss(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=ms(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)}))}}}function Es(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var Ts=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function Ds(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)&&ps(t,e,n);return Ts(t,e),t}function Cs(e){return e&&e.__esModule?e:{default:e}}function Is(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 Ms(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}function Bs(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)}function Ps(e,t,n){if(null!=t){if("object"!=typeof t)throw new TypeError("Object expected.");var i;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=t[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=t[Symbol.dispose]}if("function"!=typeof i)throw new TypeError("Object not disposable.");e.stack.push({value:t,dispose:i,async:n})}else n&&e.stack.push({async:!0});return t}var Os="function"==typeof SuppressedError?SuppressedError:function(e,t,n){var i=new Error(n);return i.name="SuppressedError",i.error=e,i.suppressed=t,i};function Rs(e){function t(t){e.error=e.hasError?new Os(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function n(){for(;e.stack.length;){var i=e.stack.pop();try{var r=i.dispose&&i.dispose.call(i.value);if(i.async)return Promise.resolve(r).then(n,(function(e){return t(e),n()}))}catch(e){t(e)}}if(e.hasError)throw e.error}()}var Ls={__extends:ss,__assign:os,__rest:as,__decorate:ls,__param:cs,__metadata:us,__awaiter:hs,__generator:ds,__createBinding:ps,__exportStar:fs,__values:ms,__read:gs,__spread:vs,__spreadArrays:ys,__spreadArray:ws,__await:bs,__asyncGenerator:xs,__asyncDelegator:As,__asyncValues:Ss,__makeTemplateObject:Es,__importStar:Ds,__importDefault:Cs,__classPrivateFieldGet:Is,__classPrivateFieldSet:Ms,__classPrivateFieldIn:Bs,__addDisposableResource:Ps,__disposeResources:Rs},ks=Object.freeze({__proto__:null,__addDisposableResource:Ps,get __assign(){return os},__asyncDelegator:As,__asyncGenerator:xs,__asyncValues:Ss,__await:bs,__awaiter:hs,__classPrivateFieldGet:Is,__classPrivateFieldIn:Bs,__classPrivateFieldSet:Ms,__createBinding:ps,__decorate:ls,__disposeResources:Rs,__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,p=n.length-1;p>=0;p--){var f={};for(var m in i)f[m]="access"===m?{}:i[m];for(var m in i.access)f.access[m]=i.access[m];f.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var g=(0,n[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===g)continue;if(null===g||"object"!=typeof g)throw new TypeError("Object expected");(a=o(g.get))&&(h.get=a),(a=o(g.set))&&(h.set=a),(a=o(g.init))&&r.unshift(a)}else(a=o(g))&&("field"===l?r.unshift(a):h[c]=a)}u&&Object.defineProperty(u,i.name,h),d=!0},__exportStar:fs,__extends:ss,__generator:ds,__importDefault:Cs,__importStar:Ds,__makeTemplateObject:Es,__metadata:us,__param:cs,__propKey:function(e){return"symbol"==typeof e?e:"".concat(e)},__read:gs,__rest:as,__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:vs,__spreadArray:ws,__spreadArrays:ys,__values:ms,default:Ls}),Ns=ts(ks),Fs={},zs={},Us={},js={};Object.defineProperty(js,"__esModule",{value:!0});var Gs=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}();js.SlotList=Gs;var Hs={};Object.defineProperty(Hs,"__esModule",{value:!0});var Vs=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}();Hs.Slot=Vs,Object.defineProperty(Us,"__esModule",{value:!0});var Qs=js,_s=Hs,Ys=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.slots=Qs.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=Qs.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 _s.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}();Us.OnceSignal=Ys,Object.defineProperty(zs,"__esModule",{value:!0});var Ws=Ns,Xs=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ws.__extends(t,e),t.prototype.add=function(e){return this.registerListener(e)},t}(Us.OnceSignal);zs.Signal=Xs,Object.defineProperty(Fs,"__esModule",{value:!0});var Zs=Ns,Ks=Hs,qs=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Zs.__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 Ks.Slot(e,this,t,n);return this.slots=this.slots.insertWithPriority(i),i}return this.slots.find(e)},t}(zs.Signal);Fs.PrioritySignal=qs,Object.defineProperty(is,"__esModule",{value:!0});var Js=Ns,$s=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 Js.__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}(Fs.PrioritySignal);is.DeluxeSignal=$s;var eo={};Object.defineProperty(eo,"__esModule",{value:!0});var to=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}();eo.GenericEvent=to;var no={};Object.defineProperty(no,"__esModule",{value:!0}),no.IOnceSignal=Symbol("IOnceSignal");var io={};Object.defineProperty(io,"__esModule",{value:!0}),io.IPrioritySignal=Symbol("IPrioritySignal");var ro={};Object.defineProperty(ro,"__esModule",{value:!0}),ro.ISignal=Symbol("ISignal");var so={};Object.defineProperty(so,"__esModule",{value:!0}),so.ISlot=Symbol("ISlot");var oo={};Object.defineProperty(oo,"__esModule",{value:!0});var ao=Hs,lo=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 ao.Slot(e,this,t)},e}();oo.MonoSignal=lo;var co={};Object.defineProperty(co,"__esModule",{value:!0});var uo=Ns,ho=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return uo.__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}(Us.OnceSignal);co.Promise=ho,Object.defineProperty(ns,"__esModule",{value:!0});var po=is;ns.DeluxeSignal=po.DeluxeSignal;var fo=eo;ns.GenericEvent=fo.GenericEvent;var mo=no;ns.IOnceSignal=mo.IOnceSignal;var go=io;ns.IPrioritySignal=go.IPrioritySignal;var vo=ro;ns.ISignal=vo.ISignal;var yo=so;ns.ISlot=yo.ISlot;var wo=oo;ns.MonoSignal=wo.MonoSignal;var bo=Us;ns.OnceSignal=bo.OnceSignal;var xo=Fs;ns.PrioritySignal=xo.PrioritySignal;var Ao=co;ns.Promise=Ao.Promise;var So=zs,Eo=ns.Signal=So.Signal,To=Hs;ns.Slot=To.Slot;var Do=js;ns.SlotList=Do.SlotList;function Co(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Io={};({get exports(){return Io},set exports(e){Io=e}}).exports=function e(t,n,i){function r(o,a){if(!n[o]){if(!t[o]){if(!a&&Co)return Co(o);if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[o]={exports:{}};t[o][0].call(c.exports,(function(e){var n=t[o][1][e];return r(n||e)}),c,c.exports,e,t,n,i)}return n[o].exports}for(var s=Co,o=0;o<i.length;o++)r(i[o]);return r}({1:[function(e,t,n){(function(e){var n,i,r=e.MutationObserver||e.WebKitMutationObserver;if(r){var s=0,o=new r(u),a=e.document.createTextNode("");o.observe(a,{characterData:!0}),n=function(){a.data=s=++s%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){u(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(u,0)};else{var l=new e.MessageChannel;l.port1.onmessage=u,n=function(){l.port2.postMessage(0)}}var c=[];function u(){var e,t;i=!0;for(var n=c.length;n;){for(t=c,c=[],e=-1;++e<n;)t[e]();n=c.length}i=!1}function h(e){1!==c.push(e)||i||n()}t.exports=h}).call(this,void 0!==es?es:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){var i=e(1);function r(){}var s={},o=["REJECTED"],a=["FULFILLED"],l=["PENDING"];function c(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,e!==r&&p(this,e)}function u(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function h(e,t,n){i((function(){var i;try{i=t(n)}catch(t){return s.reject(e,t)}i===e?s.reject(e,new TypeError("Cannot resolve promise with itself")):s.resolve(e,i)}))}function d(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function p(e,t){var n=!1;function i(t){n||(n=!0,s.reject(e,t))}function r(t){n||(n=!0,s.resolve(e,t))}function o(){t(r,i)}var a=f(o);"error"===a.status&&i(a.value)}function f(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}function m(e){return e instanceof this?e:s.resolve(new this(r),e)}function g(e){var t=new this(r);return s.reject(t,e)}function v(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);for(var o=new Array(n),a=0,l=-1,c=new this(r);++l<n;)u(e[l],l);return c;function u(e,r){function l(e){o[r]=e,++a!==n||i||(i=!0,s.resolve(c,o))}t.resolve(e).then(l,(function(e){i||(i=!0,s.reject(c,e))}))}}function y(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);for(var o=-1,a=new this(r);++o<n;)l(e[o]);return a;function l(e){t.resolve(e).then((function(e){i||(i=!0,s.resolve(a,e))}),(function(e){i||(i=!0,s.reject(a,e))}))}}t.exports=c,c.prototype.catch=function(e){return this.then(null,e)},c.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===o)return this;var n=new this.constructor(r);return this.state!==l?h(n,this.state===a?e:t,this.outcome):this.queue.push(new u(n,e,t)),n},u.prototype.callFulfilled=function(e){s.resolve(this.promise,e)},u.prototype.otherCallFulfilled=function(e){h(this.promise,this.onFulfilled,e)},u.prototype.callRejected=function(e){s.reject(this.promise,e)},u.prototype.otherCallRejected=function(e){h(this.promise,this.onRejected,e)},s.resolve=function(e,t){var n=f(d,t);if("error"===n.status)return s.reject(e,n.value);var i=n.value;if(i)p(e,i);else{e.state=a,e.outcome=t;for(var r=-1,o=e.queue.length;++r<o;)e.queue[r].callFulfilled(t)}return e},s.reject=function(e,t){e.state=o,e.outcome=t;for(var n=-1,i=e.queue.length;++n<i;)e.queue[n].callRejected(t);return e},c.resolve=m,c.reject=g,c.all=v,c.race=y},{1:1}],3:[function(e,t,n){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==es?es:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,n){var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}var o=s();function a(){try{if(!o||!o.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}function l(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(r){if("TypeError"!==r.name)throw r;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),i=0;i<e.length;i+=1)n.append(e[i]);return n.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var c=Promise;function u(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function h(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function d(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function p(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var f="local-forage-detect-blob-support",m=void 0,g={},v=Object.prototype.toString,y="readonly",w="readwrite";function b(e){for(var t=e.length,n=new ArrayBuffer(t),i=new Uint8Array(n),r=0;r<t;r++)i[r]=e.charCodeAt(r);return n}function x(e){return new c((function(t){var n=e.transaction(f,w),i=l([""]);n.objectStore(f).put(i,"key"),n.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},n.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);t(n||!e||parseInt(e[1],10)>=43)}})).catch((function(){return!1}))}function A(e){return"boolean"==typeof m?c.resolve(m):x(e).then((function(e){return m=e}))}function S(e){var t=g[e.name],n={};n.promise=new c((function(e,t){n.resolve=e,n.reject=t})),t.deferredOperations.push(n),t.dbReady?t.dbReady=t.dbReady.then((function(){return n.promise})):t.dbReady=n.promise}function E(e){var t=g[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function T(e,t){var n=g[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function D(e,t){return new c((function(n,i){if(g[e.name]=g[e.name]||N(),e.db){if(!t)return n(e.db);S(e),e.db.close()}var r=[e.name];t&&r.push(e.version);var s=o.open.apply(o,r);t&&(s.onupgradeneeded=function(t){var n=s.result;try{n.createObjectStore(e.storeName),t.oldVersion<=1&&n.createObjectStore(f)}catch(n){if("ConstraintError"!==n.name)throw n;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),s.onerror=function(e){e.preventDefault(),i(s.error)},s.onsuccess=function(){n(s.result),E(e)}}))}function C(e){return D(e,!1)}function I(e){return D(e,!0)}function M(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),i=e.version<e.db.version,r=e.version>e.db.version;if(i&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),r||n){if(n){var s=e.db.version+1;s>e.version&&(e.version=s)}return!0}return!1}function B(e){return new c((function(t,n){var i=new FileReader;i.onerror=n,i.onloadend=function(n){var i=btoa(n.target.result||"");t({__local_forage_encoded_blob:!0,data:i,type:e.type})},i.readAsBinaryString(e)}))}function P(e){return l([b(atob(e.data))],{type:e.type})}function O(e){return e&&e.__local_forage_encoded_blob}function R(e){var t=this,n=t._initReady().then((function(){var e=g[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return h(n,e,e),n}function L(e){S(e);for(var t=g[e.name],n=t.forages,i=0;i<n.length;i++){var r=n[i];r._dbInfo.db&&(r._dbInfo.db.close(),r._dbInfo.db=null)}return e.db=null,C(e).then((function(t){return e.db=t,M(e)?I(e):t})).then((function(i){e.db=t.db=i;for(var r=0;r<n.length;r++)n[r]._dbInfo.db=i})).catch((function(t){throw T(e,t),t}))}function k(e,t,n,i){void 0===i&&(i=1);try{var r=e.db.transaction(e.storeName,t);n(null,r)}catch(r){if(i>0&&(!e.db||"InvalidStateError"===r.name||"NotFoundError"===r.name))return c.resolve().then((function(){if(!e.db||"NotFoundError"===r.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),I(e)})).then((function(){return L(e).then((function(){k(e,t,n,i-1)}))})).catch(n);n(r)}}function N(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function F(e){var t=this,n={db:null};if(e)for(var i in e)n[i]=e[i];var r=g[n.name];r||(r=N(),g[n.name]=r),r.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=R);var s=[];function o(){return c.resolve()}for(var a=0;a<r.forages.length;a++){var l=r.forages[a];l!==t&&s.push(l._initReady().catch(o))}var u=r.forages.slice(0);return c.all(s).then((function(){return n.db=r.db,C(n)})).then((function(e){return n.db=e,M(n,t._defaultConfig.version)?I(n):e})).then((function(e){n.db=r.db=e,t._dbInfo=n;for(var i=0;i<u.length;i++){var s=u[i];s!==t&&(s._dbInfo.db=n.db,s._dbInfo.version=n.version)}}))}function z(e,t){var n=this;e=d(e);var i=new c((function(t,i){n.ready().then((function(){k(n._dbInfo,y,(function(r,s){if(r)return i(r);try{var o=s.objectStore(n._dbInfo.storeName).get(e);o.onsuccess=function(){var e=o.result;void 0===e&&(e=null),O(e)&&(e=P(e)),t(e)},o.onerror=function(){i(o.error)}}catch(e){i(e)}}))})).catch(i)}));return u(i,t),i}function U(e,t){var n=this,i=new c((function(t,i){n.ready().then((function(){k(n._dbInfo,y,(function(r,s){if(r)return i(r);try{var o=s.objectStore(n._dbInfo.storeName).openCursor(),a=1;o.onsuccess=function(){var n=o.result;if(n){var i=n.value;O(i)&&(i=P(i));var r=e(i,n.key,a++);void 0!==r?t(r):n.continue()}else t()},o.onerror=function(){i(o.error)}}catch(e){i(e)}}))})).catch(i)}));return u(i,t),i}function j(e,t,n){var i=this;e=d(e);var r=new c((function(n,r){var s;i.ready().then((function(){return s=i._dbInfo,"[object Blob]"===v.call(t)?A(s.db).then((function(e){return e?t:B(t)})):t})).then((function(t){k(i._dbInfo,w,(function(s,o){if(s)return r(s);try{var a=o.objectStore(i._dbInfo.storeName);null===t&&(t=void 0);var l=a.put(t,e);o.oncomplete=function(){void 0===t&&(t=null),n(t)},o.onabort=o.onerror=function(){var e=l.error?l.error:l.transaction.error;r(e)}}catch(e){r(e)}}))})).catch(r)}));return u(r,n),r}function G(e,t){var n=this;e=d(e);var i=new c((function(t,i){n.ready().then((function(){k(n._dbInfo,w,(function(r,s){if(r)return i(r);try{var o=s.objectStore(n._dbInfo.storeName).delete(e);s.oncomplete=function(){t()},s.onerror=function(){i(o.error)},s.onabort=function(){var e=o.error?o.error:o.transaction.error;i(e)}}catch(e){i(e)}}))})).catch(i)}));return u(i,t),i}function H(e){var t=this,n=new c((function(e,n){t.ready().then((function(){k(t._dbInfo,w,(function(i,r){if(i)return n(i);try{var s=r.objectStore(t._dbInfo.storeName).clear();r.oncomplete=function(){e()},r.onabort=r.onerror=function(){var e=s.error?s.error:s.transaction.error;n(e)}}catch(e){n(e)}}))})).catch(n)}));return u(n,e),n}function V(e){var t=this,n=new c((function(e,n){t.ready().then((function(){k(t._dbInfo,y,(function(i,r){if(i)return n(i);try{var s=r.objectStore(t._dbInfo.storeName).count();s.onsuccess=function(){e(s.result)},s.onerror=function(){n(s.error)}}catch(e){n(e)}}))})).catch(n)}));return u(n,e),n}function Q(e,t){var n=this,i=new c((function(t,i){e<0?t(null):n.ready().then((function(){k(n._dbInfo,y,(function(r,s){if(r)return i(r);try{var o=s.objectStore(n._dbInfo.storeName),a=!1,l=o.openKeyCursor();l.onsuccess=function(){var n=l.result;n?0===e||a?t(n.key):(a=!0,n.advance(e)):t(null)},l.onerror=function(){i(l.error)}}catch(e){i(e)}}))})).catch(i)}));return u(i,t),i}function _(e){var t=this,n=new c((function(e,n){t.ready().then((function(){k(t._dbInfo,y,(function(i,r){if(i)return n(i);try{var s=r.objectStore(t._dbInfo.storeName).openKeyCursor(),o=[];s.onsuccess=function(){var t=s.result;t?(o.push(t.key),t.continue()):e(o)},s.onerror=function(){n(s.error)}}catch(e){n(e)}}))})).catch(n)}));return u(n,e),n}function Y(e,t){t=p.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var i,r=this;if(e.name){var s=e.name===n.name&&r._dbInfo.db?c.resolve(r._dbInfo.db):C(e).then((function(t){var n=g[e.name],i=n.forages;n.db=t;for(var r=0;r<i.length;r++)i[r]._dbInfo.db=t;return t}));i=e.storeName?s.then((function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1;S(e);var i=g[e.name],r=i.forages;t.close();for(var s=0;s<r.length;s++){var a=r[s];a._dbInfo.db=null,a._dbInfo.version=n}var l=new c((function(t,i){var r=o.open(e.name,n);r.onerror=function(e){r.result.close(),i(e)},r.onupgradeneeded=function(){r.result.deleteObjectStore(e.storeName)},r.onsuccess=function(){var e=r.result;e.close(),t(e)}}));return l.then((function(e){i.db=e;for(var t=0;t<r.length;t++){var n=r[t];n._dbInfo.db=e,E(n._dbInfo)}})).catch((function(t){throw(T(e,t)||c.resolve()).catch((function(){})),t}))}})):s.then((function(t){S(e);var n=g[e.name],i=n.forages;t.close();for(var r=0;r<i.length;r++)i[r]._dbInfo.db=null;var s=new c((function(t,n){var i=o.deleteDatabase(e.name);i.onerror=i.onblocked=function(e){var t=i.result;t&&t.close(),n(e)},i.onsuccess=function(){var e=i.result;e&&e.close(),t(e)}}));return s.then((function(e){n.db=e;for(var t=0;t<i.length;t++)E(i[t]._dbInfo)})).catch((function(t){throw(T(e,t)||c.resolve()).catch((function(){})),t}))}))}else i=c.reject("Invalid arguments");return u(i,t),i}var W={_driver:"asyncStorage",_initStorage:F,_support:a(),iterate:U,getItem:z,setItem:j,removeItem:G,clear:H,length:V,key:Q,keys:_,dropInstance:Y};function X(){return"function"==typeof openDatabase}var Z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",K="~~local_forage_type~",q=/^~~local_forage_type~([^~]+)~/,J="__lfsc__:",$=J.length,ee="arbf",te="blob",ne="si08",ie="ui08",re="uic8",se="si16",oe="si32",ae="ur16",le="ui32",ce="fl32",ue="fl64",he=$+ee.length,de=Object.prototype.toString;function pe(e){var t,n,i,r,s,o=.75*e.length,a=e.length,l=0;"="===e[e.length-1]&&(o--,"="===e[e.length-2]&&o--);var c=new ArrayBuffer(o),u=new Uint8Array(c);for(t=0;t<a;t+=4)n=Z.indexOf(e[t]),i=Z.indexOf(e[t+1]),r=Z.indexOf(e[t+2]),s=Z.indexOf(e[t+3]),u[l++]=n<<2|i>>4,u[l++]=(15&i)<<4|r>>2,u[l++]=(3&r)<<6|63&s;return c}function fe(e){var t,n=new Uint8Array(e),i="";for(t=0;t<n.length;t+=3)i+=Z[n[t]>>2],i+=Z[(3&n[t])<<4|n[t+1]>>4],i+=Z[(15&n[t+1])<<2|n[t+2]>>6],i+=Z[63&n[t+2]];return n.length%3==2?i=i.substring(0,i.length-1)+"=":n.length%3==1&&(i=i.substring(0,i.length-2)+"=="),i}function me(e,t){var n="";if(e&&(n=de.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===de.call(e.buffer))){var i,r=J;e instanceof ArrayBuffer?(i=e,r+=ee):(i=e.buffer,"[object Int8Array]"===n?r+=ne:"[object Uint8Array]"===n?r+=ie:"[object Uint8ClampedArray]"===n?r+=re:"[object Int16Array]"===n?r+=se:"[object Uint16Array]"===n?r+=ae:"[object Int32Array]"===n?r+=oe:"[object Uint32Array]"===n?r+=le:"[object Float32Array]"===n?r+=ce:"[object Float64Array]"===n?r+=ue:t(new Error("Failed to get type for BinaryArray"))),t(r+fe(i))}else if("[object Blob]"===n){var s=new FileReader;s.onload=function(){var n=K+e.type+"~"+fe(this.result);t(J+te+n)},s.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}}function ge(e){if(e.substring(0,$)!==J)return JSON.parse(e);var t,n=e.substring(he),i=e.substring($,he);if(i===te&&q.test(n)){var r=n.match(q);t=r[1],n=n.substring(r[0].length)}var s=pe(n);switch(i){case ee:return s;case te:return l([s],{type:t});case ne:return new Int8Array(s);case ie:return new Uint8Array(s);case re:return new Uint8ClampedArray(s);case se:return new Int16Array(s);case ae:return new Uint16Array(s);case oe:return new Int32Array(s);case le:return new Uint32Array(s);case ce:return new Float32Array(s);case ue:return new Float64Array(s);default:throw new Error("Unkown type: "+i)}}var ve={serialize:me,deserialize:ge,stringToBuffer:pe,bufferToString:fe};function ye(e,t,n,i){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,i)}function we(e){var t=this,n={db:null};if(e)for(var i in e)n[i]="string"!=typeof e[i]?e[i].toString():e[i];var r=new c((function(e,i){try{n.db=openDatabase(n.name,String(n.version),n.description,n.size)}catch(e){return i(e)}n.db.transaction((function(r){ye(r,n,(function(){t._dbInfo=n,e()}),(function(e,t){i(t)}))}),i)}));return n.serializer=ve,r}function be(e,t,n,i,r,s){e.executeSql(n,i,r,(function(e,o){o.code===o.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,a){a.rows.length?s(e,o):ye(e,t,(function(){e.executeSql(n,i,r,s)}),s)}),s):s(e,o)}),s)}function xe(e,t){var n=this;e=d(e);var i=new c((function(t,i){n.ready().then((function(){var r=n._dbInfo;r.db.transaction((function(n){be(n,r,"SELECT * FROM "+r.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,n){var i=n.rows.length?n.rows.item(0).value:null;i&&(i=r.serializer.deserialize(i)),t(i)}),(function(e,t){i(t)}))}))})).catch(i)}));return u(i,t),i}function Ae(e,t){var n=this,i=new c((function(t,i){n.ready().then((function(){var r=n._dbInfo;r.db.transaction((function(n){be(n,r,"SELECT * FROM "+r.storeName,[],(function(n,i){for(var s=i.rows,o=s.length,a=0;a<o;a++){var l=s.item(a),c=l.value;if(c&&(c=r.serializer.deserialize(c)),void 0!==(c=e(c,l.key,a+1)))return void t(c)}t()}),(function(e,t){i(t)}))}))})).catch(i)}));return u(i,t),i}function Se(e,t,n,i){var r=this;e=d(e);var s=new c((function(s,o){r.ready().then((function(){void 0===t&&(t=null);var a=t,l=r._dbInfo;l.serializer.serialize(t,(function(t,c){c?o(c):l.db.transaction((function(n){be(n,l,"INSERT OR REPLACE INTO "+l.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){s(a)}),(function(e,t){o(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(i>0)return void s(Se.apply(r,[e,a,n,i-1]));o(t)}}))}))})).catch(o)}));return u(s,n),s}function Ee(e,t,n){return Se.apply(this,[e,t,n,1])}function Te(e,t){var n=this;e=d(e);var i=new c((function(t,i){n.ready().then((function(){var r=n._dbInfo;r.db.transaction((function(n){be(n,r,"DELETE FROM "+r.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){i(t)}))}))})).catch(i)}));return u(i,t),i}function De(e){var t=this,n=new c((function(e,n){t.ready().then((function(){var i=t._dbInfo;i.db.transaction((function(t){be(t,i,"DELETE FROM "+i.storeName,[],(function(){e()}),(function(e,t){n(t)}))}))})).catch(n)}));return u(n,e),n}function Ce(e){var t=this,n=new c((function(e,n){t.ready().then((function(){var i=t._dbInfo;i.db.transaction((function(t){be(t,i,"SELECT COUNT(key) as c FROM "+i.storeName,[],(function(t,n){var i=n.rows.item(0).c;e(i)}),(function(e,t){n(t)}))}))})).catch(n)}));return u(n,e),n}function Ie(e,t){var n=this,i=new c((function(t,i){n.ready().then((function(){var r=n._dbInfo;r.db.transaction((function(n){be(n,r,"SELECT key FROM "+r.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,n){var i=n.rows.length?n.rows.item(0).key:null;t(i)}),(function(e,t){i(t)}))}))})).catch(i)}));return u(i,t),i}function Me(e){var t=this,n=new c((function(e,n){t.ready().then((function(){var i=t._dbInfo;i.db.transaction((function(t){be(t,i,"SELECT key FROM "+i.storeName,[],(function(t,n){for(var i=[],r=0;r<n.rows.length;r++)i.push(n.rows.item(r).key);e(i)}),(function(e,t){n(t)}))}))})).catch(n)}));return u(n,e),n}function Be(e){return new c((function(t,n){e.transaction((function(i){i.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(n,i){for(var r=[],s=0;s<i.rows.length;s++)r.push(i.rows.item(s).name);t({db:e,storeNames:r})}),(function(e,t){n(t)}))}),(function(e){n(e)}))}))}function Pe(e,t){t=p.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var i,r=this;return i=e.name?new c((function(t){var i;i=e.name===n.name?r._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:i,storeNames:[e.storeName]}):t(Be(i))})).then((function(e){return new c((function(t,n){e.db.transaction((function(i){function r(e){return new c((function(t,n){i.executeSql("DROP TABLE IF EXISTS "+e,[],(function(){t()}),(function(e,t){n(t)}))}))}for(var s=[],o=0,a=e.storeNames.length;o<a;o++)s.push(r(e.storeNames[o]));c.all(s).then((function(){t()})).catch((function(e){n(e)}))}),(function(e){n(e)}))}))})):c.reject("Invalid arguments"),u(i,t),i}var Oe={_driver:"webSQLStorage",_initStorage:we,_support:X(),iterate:Ae,getItem:xe,setItem:Ee,removeItem:Te,clear:De,length:Ce,key:Ie,keys:Me,dropInstance:Pe};function Re(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}function Le(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}function ke(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}function Ne(){return!ke()||localStorage.length>0}function Fe(e){var t=this,n={};if(e)for(var i in e)n[i]=e[i];return n.keyPrefix=Le(e,t._defaultConfig),Ne()?(t._dbInfo=n,n.serializer=ve,c.resolve()):c.reject()}function ze(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var i=localStorage.key(n);0===i.indexOf(e)&&localStorage.removeItem(i)}}));return u(n,e),n}function Ue(e,t){var n=this;e=d(e);var i=n.ready().then((function(){var t=n._dbInfo,i=localStorage.getItem(t.keyPrefix+e);return i&&(i=t.serializer.deserialize(i)),i}));return u(i,t),i}function je(e,t){var n=this,i=n.ready().then((function(){for(var t=n._dbInfo,i=t.keyPrefix,r=i.length,s=localStorage.length,o=1,a=0;a<s;a++){var l=localStorage.key(a);if(0===l.indexOf(i)){var c=localStorage.getItem(l);if(c&&(c=t.serializer.deserialize(c)),void 0!==(c=e(c,l.substring(r),o++)))return c}}}));return u(i,t),i}function Ge(e,t){var n=this,i=n.ready().then((function(){var t,i=n._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(i.keyPrefix.length)),t}));return u(i,t),i}function He(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo,n=localStorage.length,i=[],r=0;r<n;r++){var s=localStorage.key(r);0===s.indexOf(e.keyPrefix)&&i.push(s.substring(e.keyPrefix.length))}return i}));return u(n,e),n}function Ve(e){var t=this.keys().then((function(e){return e.length}));return u(t,e),t}function Qe(e,t){var n=this;e=d(e);var i=n.ready().then((function(){var t=n._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return u(i,t),i}function _e(e,t,n){var i=this;e=d(e);var r=i.ready().then((function(){void 0===t&&(t=null);var n=t;return new c((function(r,s){var o=i._dbInfo;o.serializer.serialize(t,(function(t,i){if(i)s(i);else try{localStorage.setItem(o.keyPrefix+e,t),r(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||s(e),s(e)}}))}))}));return u(r,n),r}function Ye(e,t){if(t=p.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}var i,r=this;return i=e.name?new c((function(t){e.storeName?t(Le(e,r._defaultConfig)):t(e.name+"/")})).then((function(e){for(var t=localStorage.length-1;t>=0;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}})):c.reject("Invalid arguments"),u(i,t),i}var We={_driver:"localStorageWrapper",_initStorage:Fe,_support:Re(),iterate:je,getItem:Ue,setItem:_e,removeItem:Qe,clear:ze,length:Ve,key:Ge,keys:He,dropInstance:Ye},Xe=function(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)},Ze=function(e,t){for(var n=e.length,i=0;i<n;){if(Xe(e[i],t))return!0;i++}return!1},Ke=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},qe={},Je={},$e={INDEXEDDB:W,WEBSQL:Oe,LOCALSTORAGE:We},et=[$e.INDEXEDDB._driver,$e.WEBSQL._driver,$e.LOCALSTORAGE._driver],tt=["dropInstance"],nt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(tt),it={description:"",driver:et.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function rt(e,t){e[t]=function(){var n=arguments;return e.ready().then((function(){return e[t].apply(e,n)}))}}function st(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var n in t)t.hasOwnProperty(n)&&(Ke(t[n])?arguments[0][n]=t[n].slice():arguments[0][n]=t[n])}return arguments[0]}var ot=function(){function e(t){for(var n in r(this,e),$e)if($e.hasOwnProperty(n)){var i=$e[n],s=i._driver;this[n]=s,qe[s]||this.defineDriver(i)}this._defaultConfig=st({},it),this._config=st({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}))}return e.prototype.config=function(e){if("object"===(void 0===e?"undefined":i(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,n){var i=new c((function(t,n){try{var i=e._driver,r=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void n(r);for(var s=nt.concat("_initStorage"),o=0,a=s.length;o<a;o++){var l=s[o];if((!Ze(tt,l)||e[l])&&"function"!=typeof e[l])return void n(r)}var h=function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),n=c.reject(t);return u(n,arguments[arguments.length-1]),n}},n=0,i=tt.length;n<i;n++){var r=tt[n];e[r]||(e[r]=t(r))}};h();var d=function(n){qe[i]&&console.info("Redefining LocalForage driver: "+i),qe[i]=e,Je[i]=n,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(d,n):d(!!e._support):d(!0)}catch(e){n(e)}}));return h(i,t,n),i},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,n){var i=qe[e]?c.resolve(qe[e]):c.reject(new Error("Driver not found."));return h(i,t,n),i},e.prototype.getSerializer=function(e){var t=c.resolve(ve);return h(t,e),t},e.prototype.ready=function(e){var t=this,n=t._driverSet.then((function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}));return h(n,e,e),n},e.prototype.setDriver=function(e,t,n){var i=this;Ke(e)||(e=[e]);var r=this._getSupportedDrivers(e);function s(){i._config.driver=i.driver()}function o(e){return i._extend(e),s(),i._ready=i._initStorage(i._config),i._ready}function a(e){return function(){var t=0;function n(){for(;t<e.length;){var r=e[t];return t++,i._dbInfo=null,i._ready=null,i.getDriver(r).then(o).catch(n)}s();var a=new Error("No available storage method found.");return i._driverSet=c.reject(a),i._driverSet}return n()}}var l=null!==this._driverSet?this._driverSet.catch((function(){return c.resolve()})):c.resolve();return this._driverSet=l.then((function(){var e=r[0];return i._dbInfo=null,i._ready=null,i.getDriver(e).then((function(e){i._driver=e._driver,s(),i._wrapLibraryMethodsWithReady(),i._initDriver=a(r)}))})).catch((function(){s();var e=new Error("No available storage method found.");return i._driverSet=c.reject(e),i._driverSet})),h(this._driverSet,t,n),this._driverSet},e.prototype.supports=function(e){return!!Je[e]},e.prototype._extend=function(e){st(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n];this.supports(r)&&t.push(r)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=nt.length;e<t;e++)rt(this,nt[e])},e.prototype.createInstance=function(t){return new e(t)},e}(),at=new ot;t.exports=at},{3:3}]},{},[4])(4);const Mo=new r;Mo.name="Scene";class Bo{constructor(e,t){this.signals=e,this.viewportState=t,this.strokeStore=Io.createInstance({name:"soonspace",storeName:"modelStrokeCache"}),this.scene=Mo.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 Yn("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=>{var n;if(e.geometry&&e.material){const n=e;n.geometry.dispose(),pi(n.material,t)}e instanceof ou&&(null===(n=e.element)||void 0===n||n.remove());const{meshOfModelList:i,poiIconList:r,otherObjList:s}=this.intersectsList,o=i.findIndex((t=>t.uuid===e.uuid)),a=r.findIndex((t=>t.uuid===e.uuid)),l=s.findIndex((t=>t.uuid===e.uuid));o>-1&&this.intersectsList.meshOfModelList.splice(o,1),a>-1&&this.intersectsList.poiIconList.splice(a,1),l>-1&&this.intersectsList.otherObjList.splice(l,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 F(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 Pi(e)?e.forEach((e=>i(e))):Oi(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 Pi(e)?Promise.all(e.map((e=>t(e)))):Oi(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,modelCache:a=!0,firstChild:l=!1}=t,c=async e=>{var c;if(-1!==this.selectedObjects.stroke.findIndex((t=>t.uuid===e.uuid)))return Promise.resolve();if(e.userData.strokeGroup)return Promise.resolve();const u=new ru({id:`${null!==(c=e.sid)&&void 0!==c?c:e.id}_stroke`,name:`${e.name}_stroke`}),h=new U,d=new y({color:s,transparent:!0,opacity:o});h.material=d,u.add(h);let p=null;const f=()=>{const t=[];if((l?e.children[0]:e).traverse((n=>{if("Mesh"===n.type&&n instanceof z){const i=new j(n.geometry,89);n.updateWorldMatrix(!0,!1);const r=n.matrixWorld.clone().premultiply(e.matrixWorld.clone().invert());i.applyMatrix4(r),t.push(i)}})),0!==t.length)return Nt(t)};if(a&&e instanceof au&&e.url){const{url:t}=e;await this.strokeStore.ready();const n=await this.strokeStore.getItem(t);if(n)p=new g,p.setAttribute("position",new v(n,3));else{const e=f();if(e){p=e;const n=e.getAttribute("position");n.array instanceof Float32Array&&this.strokeStore.setItem(t,n.array.buffer)}}}else{const e=f();e&&(p=e)}return null!==p?(h.geometry=p,e.userData.strokeGroup=u,e.userData.strokeOptions=t,this.addObject(u,e),this.selectedObjects.stroke.push(e),n&&this.opacityShow(l?e.children[0]:e,{color:i,opacity:r}),Promise.resolve()):void 0};return Pi(e)?Promise.all(e.map((e=>c(e)))):Oi(e)?c(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));if(-1===t)return Promise.resolve();this.selectedObjects.stroke.splice(t,1),this.signals.geometryChanged.dispatch();const{firstChild:n}=e.userData.strokeOptions;return this.unOpacityShow(n?e.children[0]:e),Reflect.deleteProperty(e.userData,"strokeOptions"),Promise.resolve()};return Pi(e)?Promise.all(e.map((e=>t(e)))):Oi(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=fi(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 z){if(e.userData.material)return;e.userData.material=e.material,e.material=pi(e.material,r)}})),this.signals.materialChanged.dispatch(),this.selectedObjects.opacity.push(e)),Promise.resolve());return Pi(e)?Promise.all(e.map((e=>s(e)))):Oi(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 z){if(!e.userData.material)return;mi(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),t()}));return Pi(e)?Promise.all(e.map((e=>t(e)))):Oi(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 G&&(e.color=new u(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 z){if(e.userData.material)return;e.userData.material=e.material,e.material=fi(e.material),pi(e.material,r)}})),this.signals.materialChanged.dispatch(),this.selectedObjects.highlight.push(e)),Promise.resolve());return Pi(e)?Promise.all(e.map((e=>s(e)))):Oi(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 z){if(!e.userData.material)return;mi(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),t()}));return Pi(e)?Promise.all(e.map((e=>t(e)))):Oi(e)?t(e):Promise.resolve()}emissiveShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{color:n="red",maxOpacity:i=1,minOpacity:r=0,duration:s=1e3}=t;function o(e){e instanceof G&&(e.emissive.set(n),e.emissiveIntensity=i,0!==s&&ji({emissiveIntensity:i},{emissiveIntensity:r},{duration:s,repeat:!0},(t=>e.emissiveIntensity=t.emissiveIntensity),(t=>e.userData.animation=t)))}const a=e=>(-1!==this.selectedObjects.emissive.findIndex((t=>t.uuid===e.uuid))||(e.traverse((e=>{if(e instanceof z){if(e.userData.material)return;e.userData.material=e.material,e.material=fi(e.material),pi(e.material,o)}})),this.selectedObjects.emissive.push(e),this.signals.materialChanged.dispatch()),Promise.resolve());return Pi(e)?Promise.all(e.map((e=>a(e)))):Oi(e)?a(e):Promise.resolve()}unEmissiveShow(e){function t(e){e.userData.animation&&jn.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 z){if(!e.userData.material)return;pi(e.material,t),mi(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),n()}));return Pi(e)?Promise.all(e.map((e=>n(e)))):Oi(e)?n(e):Promise.resolve()}_triggerObjectAdded(e){if(e instanceof nu)if("Model"===e.stype)e.traverse((e=>{if(e instanceof z){-1===this.intersectsList.meshOfModelList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.meshOfModelList.push(e)}}));else if("Poi"===e.stype&&e instanceof lu){const t=this.intersectsList.poiIconList.findIndex((t=>{var n;return t.uuid===(null===(n=e.icon)||void 0===n?void 0:n.uuid)}));-1===t&&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 z){-1===this.intersectsList.otherObjList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.otherObjList.push(e)}}));else e.isObject3D&&e.traverse((e=>{if(e instanceof z){-1===this.intersectsList.otherObjList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.otherObjList.push(e)}}))}}class Po extends O{constructor(e){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof Po&&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 Oo=new t,Ro=new f,Lo=new f,ko=new t,No=new t;class Fo{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(),Ro.copy(t.matrixWorldInverse),Lo.multiplyMatrices(t.projectionMatrix,Ro),o(e,e,t),function(e){const t=function(e){const t=[];return e.traverse((function(e){e instanceof Po&&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 Po){const t=e.parent;if(t.occlude){const t=!xi(e,this.viewport.camera)&&Ai(e,this.viewport.camera,this.viewport.raycaster,this.viewport.scener.intersectsList.getAll());e.visible=t}Oo.setFromMatrixPosition(e.matrixWorld),Oo.applyMatrix4(Lo);const o=ni(e)&&Oo.z>=-1&&Oo.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("+(Oo.x*i+i)+"px,"+(-Oo.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 ko.setFromMatrixPosition(e.matrixWorld),No.setFromMatrixPosition(t.matrixWorld),ko.distanceToSquared(No)}}}const zo=new t,Uo=new s,jo=new t;class Go extends O{constructor(e){super(),this.isCSS3DObject=!0,this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof Go&&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 Ho extends Go{constructor(e){super(e),this.isCSS3DSprite=!0,this.rotation2D=0}copy(e,t){return super.copy(e,t),this.rotation2D=e.rotation2D,this}}const Vo=new f,Qo=new f;class _o{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 H?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 p=0,f=0;u instanceof V&&(p=-(u.right+u.left)/2,f=(u.top+u.bottom)/2);const m=u.view&&u.view.enabled?u.view.height/u.view.fullHeight:1,g=(u instanceof V?`scale( ${m} )scale(`+d+")translate("+l(p)+"px,"+l(f)+"px)"+c(u.matrixWorldInverse):`scale( ${m} )translateZ(`+d+"px)"+c(u.matrixWorldInverse))+"translate("+i+"px,"+r+"px)";s.camera.style!==g&&(a.style.transform=g,s.camera.style=g),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 Go){const t=e.parent;if(t.occlude){const t=!xi(e,this.viewport.camera)&&Ai(e,this.viewport.camera,this.viewport.raycaster,this.viewport.scener.intersectsList.getAll());e.visible=t}const i=ni(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 Ho?(Vo.copy(n.matrixWorldInverse),Vo.transpose(),0!==e.rotation2D&&Vo.multiply(Qo.makeRotationZ(e.rotation2D)),e.matrixWorld.decompose(zo,Uo,jo),Vo.setPosition(zo),Vo.scale(jo),Vo.elements[3]=0,Vo.elements[7]=0,Vo.elements[11]=0,Vo.elements[15]=1,t=u(Vo)):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 Yo{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 p(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 Q({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=_,s.useLegacyLights=!1,this.container.appendChild(s.domElement),s}_initRenderCSS2D(){const e=new Fo(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 _o(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 Wo=new f,Xo=(e,t)=>{const i=Wo.clone(),r=Wo.clone(),s=Wo.clone();i.makeRotationY(e),r.makeRotationX(t);const o=new n;return s.multiplyMatrices(i,r),o.setFromRotationMatrix(s),o},Zo=Xo(-Math.PI/2,-Math.PI/4),Ko=Xo(Math.PI/2,-Math.PI/4),qo=Xo(-Math.PI/4,-Math.PI/4),Jo=Xo(Math.PI/4,-Math.PI/4),$o=Xo(1.25*Math.PI,-Math.PI/4),ea=Xo(.75*Math.PI,-Math.PI/4),ta={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(Zo.x,Zo.y,Zo.z),RIGHTTOP:new n(Ko.x,Ko.y,Ko.z),LEFTFRONTTOP:new n(qo.x,qo.y,qo.z),RIGHTFRONTTOP:new n(Jo.x,Jo.y,Jo.z),LEFTBACKTOP:new n($o.x,$o.y,$o.z),RIGHTBACKTOP:new n(ea.x,ea.y,ea.z)},na=e=>Bi(e)?e:e.includes("%")?.01*Number(e.split("%")[0]):isNaN(+e)?0:Number(e),ia=new t,ra=new n,sa=new H(50,1,.01,5e4);sa.position.set(500,1e3,500),sa.lookAt(ia.set(0,0,0)),sa.name="Camera";class oa{constructor(e){this.viewport=e,this.mainCamera=sa.clone(),this.mainCamera.name="freeCamera",this.currentCamera=this.mainCamera,this.cameras={}}createCamera(e){const t=sa.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&&Oi(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(Oi(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 ji(this.currentCamera.position,e,t,(e=>this.viewport.signals.cameraChange.dispatch(e)))}rotateTo(e,t){const n=this.currentCamera.quaternion.clone(),i=(new s).setFromEuler(e);return ji({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(Ii(t)){const e=t.toLocaleUpperCase();"CURRENT"===e?ra.copy(this.currentCamera.rotation):ta[e]&&ra.copy(ta[e])}else t instanceof n?ra.copy(t):Oi(t)&&ra.set(t.x,t.y,t.z);ra.copy(Jn(this.currentCamera.rotation,ra.clone())),await Promise.all([this.moveTo(e,i),this.rotateTo(ra,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 Yn("target box is empty");const r=this.viewport.controls.options.type,s=new t;if(Ii(n)){if("CURRENT"===n.toLocaleUpperCase())s.copy(this.getMovePosByBBox(e));else{const t=ta[n.toLocaleUpperCase()],i=this.getObjectLabelPos(e,t);s.copy(i)}}else{"orbit"===r&&Yn("orbit 控制器不支持 Rotation 类型 的 rotation 参数");const t=Zn(n),i=this.getObjectLabelPos(e,t);s.copy(i)}if("orbit"===r){const t=e.getCenter(ia),i=this.viewport.controls.currentControls;i.target.copy(t);const r=new f;r.lookAt(s,t,i.object.up),n=ra.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 lu||e instanceof ou){const{padding:t=50}=i,r=na(t);return this.flyToBoundingBox(e.getBoundingBox(r),n,i)}{const{padding:r="30%"}=i,s=Kn(e),o=s.getSize(ia);let a=0;if(Ii(r)){const e=Math.max(o.x,o.y,o.z);a=na(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(ia.set(l/2,c/2,l/2)),s.min.sub(ia.set(l/2,c/2,l/2))),s.isEmpty()&&(ia.setFromMatrixPosition(e.matrixWorld),s.setFromCenterAndSize(ia,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=Xn(e),o=s.clone().setY(this.currentCamera.position.y).distanceTo(this.currentCamera.position),a=Math.abs(i);return ji({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(ia);return this.surroundOnTarget(n,t)}getMovePosByBBox(e){const n=this.currentCamera.position,i=e.getCenter(ia);(new t).subVectors(i,n).normalize();let r=new Y;r=e.getBoundingSphere(r);let s=0;if(this.currentCamera instanceof H){const e=this.currentCamera.fov/2*Math.PI/180,t=Math.sin(e);s=r.radius/t}else s=r.radius;const o=new t;this.currentCamera.getWorldDirection(o);const a=o.clone();return a.multiplyScalar(-s),i.clone().add(a)}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 nu&&(e=(new i).setFromObject(e)),e.isEmpty())return Yn("target box is empty"),new t;const{extendScale:s=1.6,mode:o="scene"}=r;if("scene"===o){const t=e.getCenter(ia),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=Ii(n)?ta[n.toLocaleUpperCase()]:Zn(n),a(ia.set(0,0,1).applyEuler(l)),o}return"screen"===o?e.getCenter(ia).clone():new t}}
|
|
1
|
+
import*as e from"three";import{Vector3 as t,Euler as n,Box3 as i,Scene as r,Quaternion as s,CubeTextureLoader as o,HalfFloatType as a,EquirectangularReflectionMapping as l,TextureLoader as c,Color as u,Texture as h,FileLoader as d,Vector2 as p,Matrix4 as f,BufferAttribute as m,BufferGeometry as g,Float32BufferAttribute as v,LineBasicMaterial as y,Line as w,Line3 as b,MathUtils as x,CurvePath as A,LineCurve as S,LineCurve3 as E,Bone as T,Uint16BufferAttribute as D,SkinnedMesh as C,Skeleton as I,AnimationClip as M,VectorKeyframeTrack as B,QuaternionKeyframeTrack as P,Object3D as O,InterpolateLinear as R,InterpolateDiscrete as L,EventDispatcher as k,LoopPingPong as N,Fog as F,Mesh as z,LineSegments as U,EdgesGeometry as j,MeshStandardMaterial as G,PerspectiveCamera as H,OrthographicCamera as V,WebGLRenderer as Q,PCFSoftShadowMap as _,Sphere as Y,REVISION as W,Camera as X,BasicDepthPacking as Z,UnsignedByteType as K,DepthTexture as q,DepthStencilFormat as J,UnsignedInt248Type as $,UnsignedIntType as ee,WebGLRenderTarget as te,Uniform as ne,RepeatWrapping as ie,LoadingManager as re,NearestFilter as se,LinearFilter as oe,ShaderMaterial as ae,NoBlending as le,RGBADepthPacking as ce,BackSide as ue,DoubleSide as he,FrontSide as de,MeshDepthMaterial as pe,LinearEncoding as fe,sRGBEncoding as me,Vector4 as ge,Material as ve,DataTexture as ye,NoColorSpace as we,WebGLMultipleRenderTargets as be,RedFormat as xe,FloatType as Ae,RGBAFormat as Se,ShaderChunk as Ee,WebGLCubeRenderTarget as Te,CubeCamera as De,PMREMGenerator as Ce,FramebufferTexture as Ie,Matrix3 as Me,TangentSpaceNormalMap as Be,GLSL3 as Pe,VideoTexture as Oe,GLBufferAttribute as Re,InterleavedBufferAttribute as Le,Frustum as ke,MOUSE as Ne,TOUCH as Fe,Spherical as ze,Raycaster as Ue,Clock as je,AnimationMixer as Ge,SRGBColorSpace as He,LinearSRGBColorSpace as Ve,UVMapping as Qe,ACESFilmicToneMapping as _e,CubeTexture as Ye,NoToneMapping as We,LinearToneMapping as Xe,ReinhardToneMapping as Ze,CineonToneMapping as Ke,Sprite 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,ClampToEdgeWrapping as ut,Group as ht,PropertyBinding as dt,NumberKeyframeTrack as pt,LinearMipMapLinearFilter as ft,ImageLoader as mt,InstancedMesh as gt,SpriteMaterial as vt,GridHelper as yt,AxesHelper as wt,Box3Helper as bt,PlaneGeometry as xt,MeshBasicMaterial as At,DirectionalLightHelper as St,HemisphereLightHelper as Et,SpotLightHelper as Tt,PointLightHelper as Dt,Box2 as Ct,Plane as It,CanvasTexture as Mt,MeshPhongMaterial as Bt}from"three";export*from"three";import{RGBELoader as Pt}from"three/examples/jsm/loaders/RGBELoader.js";import{GLTFExporter as Ot}from"three/examples/jsm/exporters/GLTFExporter.js";import{RoomEnvironment as Rt}from"three/examples/jsm/environments/RoomEnvironment.js";import Lt from"three/examples/jsm/libs/stats.module.js";import{Sky as kt}from"three/examples/jsm/objects/Sky.js";import{mergeGeometries as Nt,deinterleaveGeometry as Ft}from"three/examples/jsm/utils/BufferGeometryUtils.js";import"three/examples/jsm/postprocessing/Pass.js";import{WorkerPool as zt}from"three/examples/jsm/utils/WorkerPool.js";import{MeshBVH as Ut,computeBoundsTree as jt,disposeBoundsTree as Gt,acceleratedRaycast as Ht}from"three-mesh-bvh";import{RectAreaLightUniformsLib as Vt}from"three/examples/jsm/lights/RectAreaLightUniformsLib.js";import{TGALoader as Qt}from"three/examples/jsm/loaders/TGALoader.js";import{GLTFLoader as _t}from"three/examples/jsm/loaders/GLTFLoader.js";import{DRACOLoader as Yt}from"three/examples/jsm/loaders/DRACOLoader.js";import*as Wt from"three/examples/jsm/utils/SkeletonUtils.js";import*as Xt from"three/examples/jsm/libs/fflate.module.js";import{NURBSCurve as Zt}from"three/examples/jsm/curves/NURBSCurve.js";import{RectAreaLightHelper as Kt}from"three/examples/jsm/helpers/RectAreaLightHelper.js";var qt="soonspacejs",Jt="2.8.15",$t="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function en(){throw new Error("setTimeout has not been defined")}function tn(){throw new Error("clearTimeout has not been defined")}var nn=en,rn=tn;function sn(e){if(nn===setTimeout)return setTimeout(e,0);if((nn===en||!nn)&&setTimeout)return nn=setTimeout,setTimeout(e,0);try{return nn(e,0)}catch(t){try{return nn.call(null,e,0)}catch(t){return nn.call(this,e,0)}}}"function"==typeof $t.setTimeout&&(nn=setTimeout),"function"==typeof $t.clearTimeout&&(rn=clearTimeout);var on,an=[],ln=!1,cn=-1;function un(){ln&&on&&(ln=!1,on.length?an=on.concat(an):cn=-1,an.length&&hn())}function hn(){if(!ln){var e=sn(un);ln=!0;for(var t=an.length;t;){for(on=an,an=[];++cn<t;)on&&on[cn].run();cn=-1,t=an.length}on=null,ln=!1,function(e){if(rn===clearTimeout)return clearTimeout(e);if((rn===tn||!rn)&&clearTimeout)return rn=clearTimeout,clearTimeout(e);try{return rn(e)}catch(t){try{return rn.call(null,e)}catch(t){return rn.call(this,e)}}}(e)}}function dn(e,t){this.fun=e,this.array=t}dn.prototype.run=function(){this.fun.apply(null,this.array)};function pn(){}var fn=pn,mn=pn,gn=pn,vn=pn,yn=pn,wn=pn,bn=pn;var xn=$t.performance||{},An=xn.now||xn.mozNow||xn.msNow||xn.oNow||xn.webkitNow||function(){return(new Date).getTime()};var Sn=new Date;var En,Tn={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];an.push(new dn(e,t)),1!==an.length||ln||sn(hn)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:fn,addListener:mn,once:gn,off:vn,removeListener:yn,removeAllListeners:wn,emit:bn,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*An.call(xn),n=Math.floor(t),i=Math.floor(t%1*1e9);return e&&(n-=e[0],(i-=e[1])<0&&(n--,i+=1e9)),[n,i]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-Sn)/1e3}},Dn={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-Dn.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*Dn.Bounce.In(2*e):.5*Dn.Bounce.Out(2*e-1)+.5}}},Cn="undefined"==typeof self&&void 0!==Tn&&Tn.hrtime?function(){var e=Tn.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()},In=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=Cn()),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}(),Mn={Linear:function(e,t){var n=e.length-1,i=n*t,r=Math.floor(i),s=Mn.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=Mn.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=Mn.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=Mn.Utils.Factorial;return n(e)/n(t)/n(e-t)},Factorial:(En=[1],function(e){var t=1;if(En[e])return En[e];for(var n=e;n>1;n--)t*=n;return En[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}}},Bn=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Pn=new In,On=function(){function e(e,t){void 0===t&&(t=Pn),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=Dn.Linear.None,this._interpolationFunction=Mn.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=Bn.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?Cn()+parseFloat(e):e:Cn(),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=Cn()),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=Cn()),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=Cn()),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=Bn.nextId,Ln=Pn,kn=Ln.getAll.bind(Ln),Nn=Ln.removeAll.bind(Ln),Fn=Ln.add.bind(Ln),zn=Ln.remove.bind(Ln),Un=Ln.update.bind(Ln),jn={Easing:Dn,Group:In,Interpolation:Mn,now:Cn,Sequence:Bn,nextId:Rn,Tween:On,VERSION:"18.6.4",getAll:kn,removeAll:Nn,add:Fn,remove:zn,update:Un};const Gn="[soonspacejs]: ";var Hn,Vn;!function(e){e.Group="Group",e.Light="Light",e.Model="Model",e.Poi="Poi",e.PoiNode="PoiNode",e.Canvas3D="Canvas3D",e.Topology="Topology",e.Helper="Helper",e.PluginObject="PluginObject"}(Hn||(Hn={})),function(e){e.sbm="SBM",e.sbmx="SBMX",e.dat="DAT",e.glb="GLB",e.gltf="GLTF",e.fbx="FBX"}(Vn||(Vn={}));const Qn="In soonspacejs: ",_n=(e,t)=>{let n="";for(const e in t)n+=`${e}: ${t[e]};`;console.log(`%c${e}`,n)},Yn=e=>{console.warn(Qn+e)},Wn=e=>{console.error(Qn+e)};function Xn(e){return e instanceof t?e:new t(e.x,e.y,e.z)}function Zn(e){return e instanceof n?e:new n(e.x,e.y,e.z)}function Kn(e){const t=new i;return e instanceof r?e.children.filter((e=>!("isTransformControls"in e))).reduce(((e,t)=>e.union((new i).setFromObject(t))),t):t.setFromObject(e),t.isEmpty()&&(e.getWorldPosition(t.min),t.max.copy(t.min)),t}function qn(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 Jn(e,t){const i=qn("x",e,t),r=qn("y",e,t),s=qn("z",e,t);return new n(i.x,r.y,s.z,t.order)}function $n(e){return Math.PI/180*e}function ei(e){return!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?{position:e.getWorldPosition(new t),rotation:(new n).setFromQuaternion(e.getWorldQuaternion(new s)),scale:e.getWorldScale(new t)}:{position:e.position.clone(),rotation:e.rotation.clone(),scale:e.scale.clone()}}function ti(e,t){const n=ei(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 ni(e){return!!e.visible&&(!e.parent||ni(e.parent))}const ii=new t,ri=new t,si=new t,oi=function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;const r=ii.set(e.x/n.width*2-1,-e.y/n.height*2+1,i);return r.unproject(t),r},ai=(e,t,n,i)=>{const r=((e,t,n)=>{const i=n.width/2,r=n.height/2;t.updateMatrixWorld();const s=e.project(t);return s.x=s.x*i+i,s.y=-s.y*r+r,s})(si.copy(e),n,i);let s=0;for(let o=0;o<2;++o){const a=ri.copy(r).setComponent(o,r.getComponent(o)+t),l=oi(a,n,i,a.z);s=Math.max(s,e.distanceTo(l))}return s};class li{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 ci(e){let{path:t="",file:n}=e;if(Array.isArray(n))return(new o).setPath(t).loadAsync(n);{const e=Fi(n);if("hdr"===e||"pic"===e){const e=await(new Pt).setPath(t).setDataType(a).loadAsync(n);return e.mapping=l,e}{const e=await(new c).setPath(t).loadAsync(n);return e.mapping=l,e}}}function ui(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 u,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 c=new h(r);return c.needsUpdate=!0,c}const hi=e=>{const t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)};function di(e){return Pi(e)?function(e){return e.map((e=>di(e)))}(e):Oi(e)?function(e){if(Oi(e)){const t={};for(const n in e)t[n]=di(e[n]);return t}return e}(e):e}const pi=(e,t)=>Pi(e)?e.map(t):t(e),fi=e=>pi(e,(e=>e.clone())),mi=e=>pi(e,(e=>e.dispose())),gi=new d,vi=async(e,t)=>(gi.setResponseType(t),gi.loadAsync(e)),yi=new t,wi=new t,bi=new t;function xi(e,t){const n=yi.setFromMatrixPosition(e.matrixWorld),i=wi.setFromMatrixPosition(t.matrixWorld),r=n.sub(i),s=t.getWorldDirection(bi);return r.angleTo(s)>Math.PI/2}function Ai(e,t,n,i){const r=yi.setFromMatrixPosition(e.matrixWorld),s=r.clone();s.project(t),n.setFromCamera(new p(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 Si=e=>{"function"==typeof requestIdleCallback?requestIdleCallback(e):setTimeout(e)};var Ei=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 Ti(e){return vi(e,"text").then((e=>Promise.resolve(function(e){return(new Ei).toJson(e,{transformTextOnly:!0,removeComments:!0,removeLineBreaks:!0})}(e))))}class Di{name="EXT_mesh_gpu_instancing";constructor(e){this.writer=e}writeNode(e,n){if(!0!==e.isInstancedMesh)return;const i=e.count,r=new f,o=new Float32Array(3*i),a=new Float32Array(4*i),l=new Float32Array(3*i),c=new t,u=new s,h=new t;for(let t=0;t<i;t++)e.getMatrixAt(t,r),r.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 d=this.writer,p={};p.attributes={TRANSLATION:d.processAccessor(new m(o,3)),ROTATION:d.processAccessor(new m(a,4)),SCALE:d.processAccessor(new m(l,3))},n.extensions=n.extensions||{},n.extensions[this.name]=p,d.extensionsUsed[this.name]=!0}}const Ci=Object.prototype.hasOwnProperty,Ii=e=>"String"===Li(e),Mi=e=>"Boolean"===Li(e),Bi=e=>"Number"===Li(e),Pi=Array.isArray,Oi=e=>"Object"===Li(e),Ri=e=>"Function"===Li(e),Li=e=>Object.prototype.toString.call(e).slice(8,-1),ki=(e,t,n)=>String.fromCodePoint(...new Uint8Array(e,t,n)),Ni=()=>Gn+Math.random().toString(36).substring(7).split("").join("_"),Fi=e=>{var t;const{href:n}=new URL(e,location.origin);if(n.includes(".")){const e=n.split(".").pop();if(!e)return;return e.includes("?")?null===(t=e.split("?").shift())||void 0===t?void 0:t.toLowerCase():e}};var zi=Object.freeze({__proto__:null,IVector3ToEuler:Zn,IVector3ToVector3:Xn,MinHeap:li,calculateScaleFactor:ai,cloneDeep:di,cloneMaterials:fi,consoleSspTitle:Qn,deg2Euler:$n,disposeMaterials:mi,error:Wn,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 Ot;r.register((e=>new Di(e))),r.parse(e,(e=>n(e)),(e=>i(e)),t)}))},fetchFile:vi,getAsciiString:ki,getBoundingBox:Kn,getExtension:Fi,getSpaceAttributeFromObject:ei,getTexture:ci,getValueType:Li,gradientTexture:ui,hasOwn:(e,t)=>Ci.call(e,t),idleTask:Si,isArray:Pi,isBoolean:Mi,isDate:e=>"Date"===Li(e),isFunction:Ri,isNull:e=>"Null"===Li(e),isNumber:Bi,isObject:Oi,isObjectBehindCamera:xi,isObjectOccludeVisible:Ai,isObjectVisible:ni,isPromise:e=>"Promise"===Li(e),isString:Ii,isSymbol:e=>"Symbol"===Li(e),isUndefined:e=>"Undefined"===Li(e),log:_n,materialHandle:pi,parseFilePath:hi,randomString:Ni,rotationAFix:Jn,rotationAxisFix:qn,sleep:e=>new Promise((t=>setTimeout((()=>t()),e))),syncSpaceAttributeToObject:ti,warn:Yn,xmlToJson:Ti});const Ui={"Linear.None":Dn.Linear.None,"Quadratic.In":Dn.Quadratic.In,"Quadratic.Out":Dn.Quadratic.Out,"Quadratic.InOut":Dn.Quadratic.InOut,"Cubic.In":Dn.Cubic.In,"Cubic.Out":Dn.Cubic.Out,"Cubic.InOut":Dn.Cubic.InOut,"Quartic.In":Dn.Quartic.In,"Quartic.Out":Dn.Quartic.Out,"Quartic.InOut":Dn.Quartic.InOut,"Quintic.In":Dn.Quintic.In,"Quintic.Out":Dn.Quintic.Out,"Quintic.InOut":Dn.Quintic.InOut,"Sinusoidal.In":Dn.Sinusoidal.In,"Sinusoidal.Out":Dn.Sinusoidal.Out,"Sinusoidal.InOut":Dn.Sinusoidal.InOut,"Exponential.In":Dn.Exponential.In,"Exponential.Out":Dn.Exponential.Out,"Exponential.InOut":Dn.Exponential.InOut,"Circular.In":Dn.Circular.In,"Circular.Out":Dn.Circular.Out,"Circular.InOut":Dn.Circular.InOut,"Elastic.In":Dn.Elastic.In,"Elastic.Out":Dn.Elastic.Out,"Elastic.InOut":Dn.Elastic.InOut,"Back.In":Dn.Back.In,"Back.Out":Dn.Back.Out,"Back.InOut":Dn.Back.InOut,"Bounce.In":Dn.Bounce.In,"Bounce.Out":Dn.Bounce.Out,"Bounce.InOut":Dn.Bounce.InOut};function ji(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,p=Ui[h],f=new On(e).to(t,l).easing(p).delay(c).onUpdate((i=>{e instanceof n&&t instanceof n&&i instanceof n&&(i.order=t.order),null==r||r(i,f)})).onComplete((()=>{o()})).onStop((()=>{a("animation stop")})).onStart((()=>{null==s||s(f)}));Bi(u)?f.repeat(u):Mi(u)&&u&&f.repeat(1/0),f.yoyo(d),f.start()}))}class Gi{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=Xn(o)),o=o.clone();let a=e[s];if(!a)return!0;a.isVector3||(a=Xn(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 ji(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 Hi=Object.defineProperty,Vi=(e,t,n)=>(((e,t,n)=>{t in e?Hi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);function Qi(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 _i(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 Yi(e,t){let n=e.sampleLength;if(!n){const t=e.sampleNum;if(t)return t;n=1}return Math.ceil(t/n)}function Wi(e){const{curve:t}=e;let n=t.getLength();const i=Yi(e,n);return t.arcLengthDivisions<i&&(t.arcLengthDivisions=i,t.updateArcLengths(),n=t.getLength()),{length:n,division:i}}function Xi(e,t){const n=Yi(t??{},e.getLength()),i=e.getPoints(n),r=e.getLengths(n);return Zi(i,{...t,lengths:r})}function Zi(e,t){const{startColor:n,endColor:i,color:r,lengths:s}=t??{},o=r?new u(r):null,a=n?new u(n):o??new u(0,1,0),l=i?new u(i):o??new u(0,0,1),c=[],h=[];e[0].toArray(c,0);const d=c.length,p=s??qi(e).lengths,f=p[p.length-1],m=new u;e.forEach(((e,t)=>{e.toArray(c,t*d);const n=p[t]/f;m.lerpColors(a,l,n),m.toArray(h,3*t)}));const y=new g;return y.setAttribute("position",new v(c,d)),y.setAttribute("color",new v(h,3)),y}function Ki(e,t){t=t??{};let{material:n,linewidth:i}=t;i=i??1,n=n??new y({vertexColors:!0,linewidth:i});const r=Array.isArray(e)?Zi(e,t):Xi(e,t);return new w(r,n)}function qi(e){const t=Ji(e),n=[0],i=t.reduce(((e,t)=>(e+=t.distance(),n.push(e),e)),0);return{lines:t,lengths:n,length:i}}function Ji(e){const t=[];return e.reduce(((e,n)=>{const i=new b(e,n);return t.push(i),n})),t}function $i(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 er(e,t){const{distSortIndexs:n,clampDists:i,clampPoints:r,ts:s,clampTs:o}=tr(e,t),a=n[0];return{line:t[a],index:a,clampDist:i[a],clampPoint:r[a],t:s[a],clampT:o[a]}}function tr(e,n){const i={clampDists:[],clampPoints:[],distSortIndexs:[],ts:[],clampTs:[]};return n.forEach(((n,r)=>{const s=n.closestPointToPointParameter(e),o=x.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 nr(e){const t=new A,n=null==e[0].z?S:E;return e.reduce(((e,i)=>{const r=new n(e,i);return t.add(r),i})),t}var ir=(e=>(e.back="back",e.front="front",e))(ir||{});function rr(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,p=0,f=!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),p=d.distanceTo(a),u=Math.abs(n-p)>s;const r=n/p;if(e&&u&&r>1){f=!1;break}l*=r}while(u);return{succeed:f,u:h,point:d,distance:p}}function sr(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,p=a;do{d=u+i;let e=!1;d>1?(d=1,e=!0):d<0&&(d=0,e=!0),p=t.getPointAt(d);const o=p.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:p}}const or=new t,ar=new t(1,1,1);new s;const lr=new f;function cr(e){const{joints:t,axials:n}=e;if(t)var i=hr(t);else i=n?ur(e):dr(e);return i}function ur(e){const{axials:t,start:n}=e,i=new T;n&&(i.position.copy(n),i.updateMatrix());const r=[i];return t.reduce(((e,t)=>{const n=new T;return n.position.copy(t),e.add(n),r.push(n),n.updateMatrix(),n}),i),i.updateWorldMatrix(!0,!0),r}function hr(e){const t=[];return e.reduce(((e,n)=>{const i=n.clone().sub(e);return t.push(i),n})),ur({axials:t,start:e[0]})}function dr(e){const{start:t,axial:n}=e;let i=e.number;const r=new Array(i-1);return r.fill(n),ur({axials:r,start:t})}function pr(e){const{geometry:n,flexible:i=1,axial:r,number:o}=e,a=e.start??new t,l=r.clone().normalize(),c=r.length(),u=o-1,h=(new s).setFromUnitVectors(new t(1,0,0),l),d=(new f).compose(a,h,new t(1,1,1)).invert(),p=n.getAttribute("position").clone(),m=p.count;p.applyMatrix4(d);const g=[],y=[];for(let e=0;e<m;e++){const t=p.getX(e);if(t<0){g.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;g.push(n,n+1,0,0),y.push(1-e,e,0,0)}else g.push(u,0,0,0),y.push(1,0,0,0)}return n.setAttribute("skinIndex",new D(g,4)),n.setAttribute("skinWeight",new v(y,4)),n}function fr(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),pr({...e,start:o,axial:a,number:n.bones.length})}function mr(e){const{skeleton:n,geometry:i,flexible:r=1,geometryFrame:s}=e,o=(null==s?void 0:s.clone().invert())??lr.clone(),a=n.boneInverses.map((e=>{const n=e.clone().invert().premultiply(o);return(new t).setFromMatrixPosition(n)})),l=Ji(a),c=i.getAttribute("position"),u=c.count,h=[],d=[],p=new t;for(let e=0;e<u;e++){p.fromBufferAttribute(c,e);const{index:t,clampT:n}=er(p,l),i=n*r;h.push(t,t+1,0,0),d.push(1-i,i,0,0)}return i.setAttribute("skinIndex",new D(h,4)),i.setAttribute("skinWeight",new v(d,4)),i}function gr(e){const{geometry:t}=e,n=e.material??void 0,i=new C(t,n),r=cr(e);i.add(r[0]);const s=new I(r);return i.bind(s),mr({...e,skeleton:s}),i}function vr(e){const{skeleton:t}=e,n=yr(e);return n.updateMatrix(),n.updateMatrixWorld(),n.bind(t),n}function yr(e){const{target:t,skeleton:n}=e,i=t.geometry,r=new C;return t.copy.call(r,t,!1),mr({...e,geometry:i,skeleton:n,geometryFrame:t.matrixWorld}),r}function wr(e){const{target:t}=e;let{skeleton:n}=e;if(n)var i=n.bones[0];else{const t=cr(e);n=new I(t),i=t[0]}t.add(i),t.updateWorldMatrix(!1,!0),n.calculateInverses(),i.removeFromParent();const r=br({...e,target:t,skeleton:n});return r.add(i),{model:r,skeleton:n,rootBone:i}}function br(e){const{target:t,skeleton:n,parent:i,posOnBone:r}=e,s=t.isMesh,o=s?yr({...e,skeleton:n}):t.clone(!1);i&&i.add(o),o.updateMatrixWorld(!0),s&&(o.bind(n,t.matrixWorld),r&&(o.frustumCulled=!1));const a=t.children;for(const t of a)br({...e,target:t,parent:o});return o}function xr(e){return e.filter((e=>{var t;return!(null!=(t=e.parent)&&t.isBone)}))}function Ar(e){return e.find((e=>{var t;return!(null!=(t=e.parent)&&t.isBone)}))}function Sr(e){return Ar(e)??e[0]}function Er(e){return e.curve?Tr(e):Pr(e)}function Tr(e){const{keyframeTracks:t,duration:n,...i}=Dr(e);return{...i,clip:new M(e.name,n,t)}}function Dr(e){const{curve:t,lookDistance:n}=e,i=e.targetPath??"",r=Wi(e).division,s=Cr(e,t.getLength()),o=R,a=[],l=Mr(r),c={...e,duration:s,division:r,ts:l,lookPoint:{distance:n}},u=Br(c),{points:h,rotates:d,...p}=Ir(c);if(h.length){const e=[];h.forEach(((t,n)=>{t.toArray(e,3*n)}));const t=new B(`${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 P(`${i}.quaternion`,u,e,o);a.push(t)}return{...p,keyframeTracks:a,duration:s}}function Cr(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 Ir(e){var n,i;const{curve:r,target:o,lookPoint:a,enableUp:l,fixUp:c}=e,u=e.position??!0,h=e.rotate??!0,d=[],p=[],m=[];if(!u&&!h)return{rotates:d,points:p,curveLength:void 0,lengths:void 0};const g=(e.anchor??or).clone(),v=e.ts??e.us,y=!e.ts;if(!v)throw"缺少参数:至少传递 ts 和 us 任意之一";let w=lr.clone(),b=lr.clone(),x=ar.clone(),A=O.DEFAULT_UP;o&&(o.updateWorldMatrix(!0,!1),w=o.matrix,b=o.matrixWorld,x=o.scale,A=o.up);const S=w.clone().invert(),E=b.clone().multiply(S).clone().invert(),T=r.getTangent(0);T.transformDirection(E);const D=(null==(n=e.front)?void 0:n.clone().normalize())??T,C=(null==(i=e.up)?void 0:i.clone().normalize())??A.clone().transformDirection(E);let I=w.clone().setPosition(0,0,0),M=e=>r.getPoint(e),B=e=>r.getTangent(e);y&&(M=e=>r.getPointAt(e),B=e=>r.getTangentAt(e));const P=v.length,R=P-1;let{distance:L,curveLength:k,lengths:N}=a??{};L=L??0;let F=B;0!==L&&(N||(N=_i(r,v,y).lengths),null==k&&(k=N[R]),F=(e,t)=>{const n=M(e);let i=(N[t]+L)/k;return i>1&&(i=1),r.getPointAt(i).sub(n).normalize()});let z=e=>{const t=v[e],n=F(t,e);n.transformDirection(E),m.push(n);const i=e-1,r=i<0,o=r?D:m[i],a=(new s).setFromUnitVectors(o,n);if(!r){const e=d[i];a.multiply(e)}return a.normalize()};if(l){const e=new t(0,1,0);z=c?function(t){const n=v[t],i=F(n,t);i.transformDirection(E),m.push(i);const r=t-1;let o;if(r<0)o=(new s).setFromUnitVectors(D,i);else{const e=d[r],t=D.clone().applyQuaternion(e).normalize();o=(new s).setFromUnitVectors(t,i),o.multiply(e)}const a=C.clone().applyQuaternion(o).normalize(),l=(new s).setFromUnitVectors(a,e);return o.premultiply(l),o.normalize()}:function(t){const n=v[t],i=F(n,t);i.transformDirection(E),m.push(i);const r=t-1,o=r<0,a=o?D:m[r],l=(new s).setFromUnitVectors(a,i);if(o){const t=C.clone().applyQuaternion(l);t.projectOnPlane(i).normalize();const n=e.clone().projectOnPlane(i).normalize(),r=(new s).setFromUnitVectors(t,n);l.premultiply(r)}else{const e=d[r];l.multiply(e)}return l.normalize()}}for(let e=0;e<P;e++){const t=v[e];if(h){const t=z(e);d.push(t),I=(new f).compose(or,t,x)}if(u){const e=M(t);e.applyMatrix4(E);const n=g.clone().applyMatrix4(I);e.sub(n),p.push(e)}}return{rotates:d,points:p,curveLength:k??void 0,lengths:N??void 0}}function Mr(e){const t=[];for(let n=0;n<=e;n++)t.push(n/e);return t}function Br(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 Pr(e){const{smooth:t,points:n}=e;if(!1===t)var{keyframeTracks:i,duration:r,...s}=Or(e);else{const t=nr(n);var{keyframeTracks:i,duration:r,...s}=Dr({...e,curve:t})}return{...s,clip:new M(e.name,r,i)}}function Or(e){const t=e.targetPath??"",n=e.points,{lines:i,length:r,lengths:s}=qi(n),o=Cr(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 B(`${t}.position`,u,e,R);a.push(n)}if(h.length){const e=[];h.forEach(((t,n)=>{t.toArray(e,4*n)}));const n=new P(`${t}.quaternion`,d,e,L);a.push(n)}return{keyframeTracks:a,duration:o,lengths:s,curveLength:r}}function Rr(e,n){var i,r;const{points:o,target:a,times:l,enableUp:c,fixUp:u}=e,h=e.position??!0,d=e.rotate??!0,p=o.length,m=p-1;n=n??Ji(o);const g=[],v=[],y=[],w=[],b={rotates:g,points:v,rotateTimes:l,pointTimes:y};if(!h&&!d)return b;const x=(e.anchor??or).clone();let A=lr.clone(),S=lr.clone(),E=ar.clone(),T=O.DEFAULT_UP;a&&(a.updateWorldMatrix(!0,!1),A=a.matrix,S=a.matrixWorld,E=a.scale,T=a.up);const D=A.clone().invert(),C=S.clone().multiply(D).clone().invert(),I=n[0].delta(new t);I.transformDirection(C);const M=(null==(i=e.front)?void 0:i.clone().normalize())??I,B=(null==(r=e.up)?void 0:r.clone().normalize())??T.clone().transformDirection(C);let P=A.clone().setPosition(0,0,0),R=P,L=e=>{const i=n[e].delta(new t).normalize();i.transformDirection(C),w.push(i);const r=e-1,o=r<0,a=o?M:w[r],l=(new s).setFromUnitVectors(a,i);if(!o){const e=g[r];l.multiply(e)}return l.normalize()};if(c){const e=new t(0,1,0);L=u?function(i){const r=n[i].delta(new t).normalize();r.transformDirection(C),w.push(r);const o=i-1;let a;if(o<0)a=(new s).setFromUnitVectors(M,r);else{const e=g[o],t=M.clone().applyQuaternion(e).normalize();a=(new s).setFromUnitVectors(t,r),a.multiply(e)}const l=B.clone().applyQuaternion(a).normalize(),c=(new s).setFromUnitVectors(l,e);return a.premultiply(c),a.normalize()}:function(i){const r=n[i].delta(new t).normalize();r.transformDirection(C),w.push(r);const o=i-1,a=o<0,l=a?M:w[o],c=(new s).setFromUnitVectors(l,r);if(a){const t=B.clone().applyQuaternion(c);t.projectOnPlane(r).normalize();const n=e.clone().projectOnPlane(r).normalize(),i=(new s).setFromUnitVectors(t,n);c.premultiply(i)}else{const e=g[o];c.multiply(e)}return c.normalize()}}for(let e=0;e<p;e++){if(d)if(e<m){const t=L(e);g.push(t),P=(new f).compose(or,t,E)}else g.push(g[e-1].clone());if(h){const t=l[e],n=o[e].clone();if(n.applyMatrix4(C),e>0){const e=x.clone().applyMatrix4(R),i=n.clone().sub(e);v.push(i),y.push(t)}const i=x.clone().applyMatrix4(P);n.sub(i),v.push(n),y.push(t)}R=P}return b}function Lr(e){const t=e.mixer,n=wr(e),{model:i,skeleton:r}=n,s={...e,target:i,skeleton:r},{clip:o,...a}=e.posOnBone?kr(s):zr(s);i.animations.push(o);const l=null==t?void 0:t.clipAction(o,i);return{...a,...n,clip:o,action:l}}function kr(e){const{boneTracks:t,duration:n,...i}=Nr(e),r=t.flat();return{...i,clip:new M(e.name,n,r)}}function Nr(e){const{skeleton:t,targetPath:n}=e,i=t.bones,{times:r,boneSampleDatas:s,duration:o,...a}=Fr(e),l=r.length,c=R,u=s.map(((e,t)=>{const{points:s,rotates:o}=e,a=i[t],u=n?`${n}.skeleton.bones[${t}]`:`${a.name||a.uuid}`,h=[],d=[];for(let e=0;e<l;e++)s&&s[e].toArray(h,3*e),o[e].toArray(d,4*e);const p=[];if(s){const e=new B(`${u}.position`,r,h,c);p.push(e)}const f=new P(`${u}.quaternion`,r,d,c);return p.push(f),p}));return{...a,boneTracks:u,duration:o}}function Fr(e){var n;const{curve:i,skeleton:r,stretch:o}=e,{bones:a,boneInverses:l}=r,c=a[0],u=e.target??c.parent;if(!u)throw"target 或 根骨骼的 parent 不存在";const h=e.tolerance??.1;c.updateWorldMatrix(!0,!0);const{division:d,length:p}=Wi(e),{matrixWorld:m}=u,g=m.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}),g);const w=y[0],b=new t,x=new s,A=new t;w.decompose(b,x,A);const S=Cr(e,p),E=Mr(d),T=Br({curve:i,division:d,duration:S}),D=E.length,C=[],I=(new t).setFromMatrixPosition(y[1]).negate(),M=l[0],B=null==(n=e.up)?void 0:n.clone().applyMatrix4(m).transformDirection(M),{points:P,rotates:O,...R}=Ir({...e,curve:i,ts:E,target:c,rotate:!0,front:I,up:B,anchor:null});for(let e=0;e<D;e++)C.push(m.clone());const L=P.map(((e,t)=>{const n=O[t];n.premultiply(x).normalize();const i=(new f).compose(e,n,A);return i.premultiply(m),i})),k=i.getLengths(d).map((e=>e/p)),N=[{points:P,rotates:O,us:k,matrixs:L}],F=o?function(e,t,n){const r=N[e].us[t]-n/p;return{u:r,point:r<0?null:i.getPointAt(r)}}:function(e,t,n){const r=N[e].us[t],{u:s,point:o,succeed:a}=rr({curve:i,distance:n,fromU:r,length:p,side:ir.front,tolerance:h*n});return{u:s,point:a?o:null}},z=l.length,U=z-1;for(let e=1;e<z;e++){const n=[],r=[],o=[],a=[];N.push({points:n,rotates:r,us:o,matrixs:a});const l=y[e],c=v[e],u=e-1,h=N[u],d=y[u],p=v[u],{matrixs:m,points:g,rotates:w}=h,b=(new t).setFromMatrixScale(d),x=u-1,A=x<0?C:N[x].matrixs,S=new t,E=new s,T=new t;l.decompose(S,E,T);const I=(new t).setFromMatrixPosition(c).sub((new t).setFromMatrixPosition(p)).length(),M=S.length();for(let t=0;t<D;t++){const{point:c,u:h}=F(u,t,I);o.push(h),r.push(E.clone());const d=m[t];if(h<0||!c){n.push(S);const e=d.clone().multiply(l);a.push(e);continue}const p=A[t];let v=p.clone().invert();const y=c.clone().applyMatrix4(v),x=g[t];y.sub(x).normalize();const D=w[t],C=(new f).compose(x,D,b),B=S.clone().transformDirection(C),P=(new s).setFromUnitVectors(B,y);D.premultiply(P).normalize(),d.compose(x,D,b),d.premultiply(p);const O=d.clone().invert();c.applyMatrix4(O);const R=c.length();c.copy(S).multiplyScalar(R/M),n.push(c);const L=(new f).compose(c,E,T);if(e===U){const e=i.getTangentAt(h);e.negate().transformDirection(O);const n=(new s).setFromUnitVectors(c.clone().normalize(),e);n.premultiply(E).normalize(),r[t]=n,L.compose(c,n,T)}L.premultiply(d),a.push(L)}}return{...R,times:T,boneSampleDatas:N,duration:S}}function zr(e){const{boneTracks:t,targetTracks:n,duration:i,...r}=Ur(e),s=n.concat(t.flat());return{...r,clip:new M(e.name,i,s)}}function Ur(e){const{skeleton:t,targetPath:n}=e,{times:i,boneSampleDatas:r,duration:s,targetSampleDatas:o,...a}=jr(e),l=i.length,c=t.bones,u=R,h=[],d=[],{points:p,rotates:f}=o;for(let e=0;e<l;e++)p[e].toArray(h,3*e),f[e].toArray(d,4*e);const m=n??"",g=[new B(`${m}.position`,i,h,u),new P(`${m}.quaternion`,i,d,u)],v=r.map(((e,t)=>{const{points:r,rotates:s}=e,o=c[t],a=n?`${n}.skeleton.bones[${t}]`:`${o.name||o.uuid}`,h=[],d=[];for(let e=0;e<l;e++)r&&r[e].toArray(h,3*e),s[e].toArray(d,4*e);const p=[];if(r){const e=new B(`${a}.position`,i,h,u);p.push(e)}const f=new P(`${a}.quaternion`,i,d,u);return p.push(f),p}));return{...a,boneTracks:v,targetTracks:g,duration:s}}function jr(e){const{curve:n,skeleton:i,stretch:r}=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:d}=Wi(e),{matrix:p,matrixWorld:m,scale:g}=c,v=m.clone().multiply(p.clone().invert()),y=m.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 x=b[0],A=new t,S=new s,E=new t;x.decompose(A,S,E);const T=Cr(e,d),D=Mr(h),C=w[0],I=(new t).setFromMatrixPosition(b[1]).negate().transformDirection(C).transformDirection(y),{rotates:M,points:B,...P}=Ir({...e,curve:n,target:c,position:!0,rotate:!0,anchor:A,front:I,ts:D}),O=Br({curve:n,division:h,duration:T}),R=B.map(((e,t)=>{const n=M[t],i=(new f).compose(e,n,g);return i.premultiply(v),i})),L={points:B,rotates:M,matrixs:R},k=[],N=R.map((e=>(k.push(S.clone()),e.clone().multiply(x)))),F=D.length,z=n.getLengths(h).map((e=>e/d)),U=[{rotates:k,us:z,matrixs:N}],j=r?function(e,t,i){const r=U[e].us[t]-i/d;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}=rr({curve:n,distance:i,fromU:r,length:d,side:ir.front,tolerance:u*i});return{u:s,point:a?o:null}},G=a.length,H=G-1;for(let e=1;e<G;e++){const i=[],r=[],o=[],a=[];U.push({points:i,rotates:r,us:o,matrixs:a});const l=b[e],c=w[e],u=e-1,h=U[u],d=b[u],p=w[u],{matrixs:m,points:g,rotates:v}=h,y=new t,x=new s,A=new t;d.decompose(y,x,A);const S=u-1,E=S<0?R:U[S].matrixs,T=new t,D=new s,C=new t;l.decompose(T,D,C);const I=(new t).setFromMatrixPosition(c).sub((new t).setFromMatrixPosition(p)).length(),M=T.length();for(let t=0;t<F;t++){const{point:c,u:h}=j(u,t,I);o.push(h),r.push(D.clone());const d=m[t];if(h<0||!c){i.push(T);const e=d.clone().multiply(l);a.push(e);continue}const p=E[t];let w=p.clone().invert();const b=c.clone().applyMatrix4(w),S=(null==g?void 0:g[t])??y;b.sub(S).normalize();const B=v[t],P=(new f).compose(S,B,A),O=T.clone().transformDirection(P);B.setFromUnitVectors(O,b),B.premultiply(x).normalize(),d.compose(S,B,A),d.premultiply(p);const R=d.clone().invert();c.applyMatrix4(R);const L=c.length();c.copy(T).multiplyScalar(L/M),i.push(c);const k=(new f).compose(c,D,C);if(e===H){const e=n.getTangentAt(h);e.negate().transformDirection(R);const i=(new s).setFromUnitVectors(c.clone().normalize(),e);i.premultiply(D).normalize(),r[t]=i,k.compose(c,i,C)}k.premultiply(d),a.push(k)}}return{...P,times:O,boneSampleDatas:U,targetSampleDatas:L,duration:T}}class Gr{constructor(e){Vi(this,"isAnimationClipKeyframe",!0),Vi(this,"_tracksTimes",null),Vi(this,"lastGetTime",0),Vi(this,"lastGetKeyframeIndexs",[]),this.clip=e}get tracksTimes(){return this._tracksTimes??(this._tracksTimes=this.clip.tracks.map((e=>e.times)))}getTracksKeyframeIndexs(e){const{lastGetTime:t,tracksTimes:n}=this;e<t&&(this.lastGetKeyframeIndexs=[]),this.lastGetTime=e;const i=this.lastGetKeyframeIndexs;return this.lastGetKeyframeIndexs=n.map(((t,n)=>{const r=i[n]??0,s=t.length;for(let n=r;n<s;n++)if(e<t[n])return n-1;return s-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}}))}}var Hr=(e=>(e.keyframe="keyframe",e.position=".position",e.quaternion=".quaternion",e.rotation=".rotation",e.scale=".scale",e.loop="loop",e.finished="finished",e.point="point",e))(Hr||{});const Vr=["loop","finished"];class Qr extends Gr{constructor(e){super(e.getClip()),Vi(this,"isAnimationActionKeyframe",!0),Vi(this,"_trackNames"),Vi(this,"_positionTrackName"),Vi(this,"_quaternionTrackName"),Vi(this,"_rotationTrackName"),Vi(this,"_scaleTrackName"),Vi(this,"event",new k),Vi(this,"_frameEventNames",null),Vi(this,"mixerListener",(e=>{(e.action.isAnimationActionKeyframe?e.action.action:e.action)===this.action&&this.event.dispatchEvent(e)})),Vi(this,"_points",[]),Vi(this,"_polyline"),Vi(this,"_polylineLengths",[]),Vi(this,"_pointsProgress",[]),Vi(this,"lastGetProgress",0),Vi(this,"lastGetPointIndex",0),Vi(this,"_enablePointEvent",!0),Vi(this,"_enableKeyframeEvent",!0),Vi(this,"lastKeyframes",null),Vi(this,"lastPolylineKeyframe",null),Vi(this,"frameFun",(()=>{var e;if(this.enableKeyframeEvent){const{keyframes:e,lastKeyframes:t}=this;let n=!1;for(const[i,r]of Object.entries(e)){const e=null==t?void 0:t[i];r.index!==(null==e?void 0:e.index)&&(n=!0,this.event.dispatchEvent({type:i,preFrame:e,frame:r}))}n&&(this.event.dispatchEvent({type:"keyframe",preFrame:t,frame:e}),this.lastKeyframes=e)}if(this.pointEventEnabled){const{pointIndex:t,lastPolylineKeyframe:n}=this;if(t!==(null==n?void 0:n.index)){const i={index:t,value:this.points[t]??(null==(e=this.polyline)?void 0:e.getPoint(this.progress)),length:this.polylineLengths[t]};this.event.dispatchEvent({type:"point",preFrame:n,frame:i}),this.lastPolylineKeyframe=i}}})),Vi(this,"_stopListenFun"),this.action=e}get time(){return this.action.time}get duration(){return this.clip.duration}get progressTime(){const{isReverseLoop:e,duration:t,time:n}=this;return e?t-n:n}set progressTime(e){const{action:t,isReverseLoop:n,duration:i}=this;n&&(e=i-e),t.time=e}get progress(){return this.progressTime/this.duration}set progress(e){this.progressTime=e*this.duration}get loopCount(){const e=this.action._loopCount;return-1===e?0:e}get isReverseLoop(){return this.action.loop===N&&this.loopCount%2==1}get loopDirFactor(){return this.isReverseLoop?-1:1}get isReverse(){const e=this.action.timeScale<0;return this.isReverseLoop?!e:e}get dirFactor(){return this.isReverse?-1:1}get trackNames(){return this._trackNames??(this._trackNames=this.clip.tracks.map((e=>e.name)))}get keyframeIndexs(){const e=this.getTracksKeyframeIndexs(this.progressTime);return this.trackNames.reduce(((t,n,i)=>(t[n]=e[i],t)),{})}get keyframes(){const e=this.getTracksKeyframes(this.progressTime);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 s(...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}get frameEventNames(){return this._frameEventNames??(this._frameEventNames=[...this.trackNames,"keyframe","point"])}get mixer(){return this.action._mixer}addEventListener(e,t){const n=this.mixerListener;return Vr.includes(e)&&!this.mixer.hasEventListener(e,n)?(this.mixer.addEventListener(e,n),this.event.addEventListener(e,t),!0):!!this.frameEventNames.includes(e)&&(this.event.addEventListener(e,t),!this._stopListenFun&&this.enableFrameEvent&&(this._stopListenFun=_r(this.frameFun)),!0)}removeEventListener(e,t){if(Vr.includes(e)&&1===this.getListeners(e).length){const t=this.mixerListener;this.mixer.removeEventListener(e,t)}this.event.removeEventListener(e,t),this.stopListenFun&&!this.hasListeners&&(this.stopListenFun=null)}get points(){return this._points}set points(e){e.length>1?(this._points=e,this.polyline=nr(e)):(this._points=[],this.polyline=null)}get polyline(){return this._polyline}set polyline(e){this._polyline=e;const t=(null==e?void 0:e.getCurveLengths())??[];this.polylineLengths=[0,...t]}get polylineLengths(){return this._polylineLengths}set polylineLengths(e){this._polylineLengths=e;const t=1/e[e.length-1];this.pointsProgress=e.map((e=>e*t))}get polylineLength(){return this.polylineLengths[this.polylineLengths.length-1]}get polylineProgressLength(){return this.polylineLength*this.progress}get pointsProgress(){return this._pointsProgress}set pointsProgress(e){this._pointsProgress=e}get pointIndex(){return this.getPointIndex(this.progress)}getPointIndex(e){const{lastGetProgress:t,pointsProgress:n}=this;e<t&&(this.lastGetPointIndex=0),this.lastGetProgress=e;const i=Math.max(this.lastGetPointIndex,0),r=n.length;for(let t=i;t<r;t++)if(e<n[t])return this.lastGetPointIndex=t-1;return this.lastGetPointIndex=r-1}get enablePointEvent(){return this._enablePointEvent}set enablePointEvent(e){this._enablePointEvent=e,e&&this.autoStartListen()}get pointEventEnabled(){return this.enablePointEvent&&this.pointsProgress.length>0&&this.getListeners("point").length>0}get enableKeyframeEvent(){return this._enableKeyframeEvent}set enableKeyframeEvent(e){this._enableKeyframeEvent=e,e&&this.autoStartListen()}get enableFrameEvent(){return this.enableKeyframeEvent||this.enablePointEvent}get stopListenFun(){return this._stopListenFun}set stopListenFun(e){const t=this._stopListenFun;t&&t(),this._stopListenFun=e}startListen(){this.stopListenFun||(this.stopListenFun=_r(this.frameFun))}stopListen(){this.stopListenFun=null}autoStartListen(){!this.stopListenFun&&this.enableFrameEvent&&this.hasListeners&&(this.stopListenFun=_r(this.frameFun))}get listeners(){return this.event._listeners}get hasListeners(){const e=this.listeners;return!!e&&Object.values(e).some((e=>e&&e.length>0))}getListeners(e){var t;return(null==(t=this.listeners)?void 0:t[e])??[]}destroy(e){const{action:t,mixer:n,mixerListener:i}=this;this.stopListen(),n.removeEventListener("loop",i),n.removeEventListener("finished",i),this.event._listeners=null,!e&&(t.stop(),t.reset(),n._deactivateAction(t),n._removeInactiveAction(t))}}function _r(e){let t;const n=i=>{e(i),t=requestAnimationFrame(n)};return t=requestAnimationFrame(n),()=>{cancelAnimationFrame(t)}}class Yr extends Qr{constructor(){super(...arguments),Vi(this,"isAnimationActionOperate",!0)}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 Wr(e){const t=new Yr(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 Xr{constructor(e){Vi(this,"_action"),this.setAction(e)}get action(){return this._action}set action(e){this.setAction(e)}setAction(e){this._action=e&&Wr(e)}get play(){const e=this.action;return!(!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 Zr(e){var t;null==(t=e.reset)||t.call(e,!0)}class Kr extends Xr{constructor(e,t=[]){super(e),Vi(this,"_updateGUI",null),this.guis=t}get updateGUI(){return this._updateGUI??this.constructor.updateGUI??Zr}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 qr(e){const t=new Kr(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 Jr(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 $r(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=Jr(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}Vi(Kr,"updateGUI",Zr);var es="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ts(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 ns={},is={},rs=function(e,t){return rs=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])},rs(e,t)};function ss(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}rs(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var os=function(){return os=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},os.apply(this,arguments)};function as(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}function ls(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}function cs(e,t){return function(n,i){t(n,i,e)}}function us(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function hs(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())}))}function ds(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])}}}var ps=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 fs(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||ps(t,e,n)}function ms(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 gs(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 vs(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(gs(arguments[t]));return e}function ys(){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}function ws(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))}function bs(e){return this instanceof bs?(this.v=e,this):new bs(e)}function xs(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 bs?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])}}function As(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:bs(e[i](t)),done:!1}:r?r(t):t}:r}}function Ss(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=ms(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)}))}}}function Es(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var Ts=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function Ds(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)&&ps(t,e,n);return Ts(t,e),t}function Cs(e){return e&&e.__esModule?e:{default:e}}function Is(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 Ms(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}function Bs(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)}function Ps(e,t,n){if(null!=t){if("object"!=typeof t)throw new TypeError("Object expected.");var i;if(n){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=t[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=t[Symbol.dispose]}if("function"!=typeof i)throw new TypeError("Object not disposable.");e.stack.push({value:t,dispose:i,async:n})}else n&&e.stack.push({async:!0});return t}var Os="function"==typeof SuppressedError?SuppressedError:function(e,t,n){var i=new Error(n);return i.name="SuppressedError",i.error=e,i.suppressed=t,i};function Rs(e){function t(t){e.error=e.hasError?new Os(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function n(){for(;e.stack.length;){var i=e.stack.pop();try{var r=i.dispose&&i.dispose.call(i.value);if(i.async)return Promise.resolve(r).then(n,(function(e){return t(e),n()}))}catch(e){t(e)}}if(e.hasError)throw e.error}()}var Ls={__extends:ss,__assign:os,__rest:as,__decorate:ls,__param:cs,__metadata:us,__awaiter:hs,__generator:ds,__createBinding:ps,__exportStar:fs,__values:ms,__read:gs,__spread:vs,__spreadArrays:ys,__spreadArray:ws,__await:bs,__asyncGenerator:xs,__asyncDelegator:As,__asyncValues:Ss,__makeTemplateObject:Es,__importStar:Ds,__importDefault:Cs,__classPrivateFieldGet:Is,__classPrivateFieldSet:Ms,__classPrivateFieldIn:Bs,__addDisposableResource:Ps,__disposeResources:Rs},ks=Object.freeze({__proto__:null,__addDisposableResource:Ps,get __assign(){return os},__asyncDelegator:As,__asyncGenerator:xs,__asyncValues:Ss,__await:bs,__awaiter:hs,__classPrivateFieldGet:Is,__classPrivateFieldIn:Bs,__classPrivateFieldSet:Ms,__createBinding:ps,__decorate:ls,__disposeResources:Rs,__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,p=n.length-1;p>=0;p--){var f={};for(var m in i)f[m]="access"===m?{}:i[m];for(var m in i.access)f.access[m]=i.access[m];f.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var g=(0,n[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===g)continue;if(null===g||"object"!=typeof g)throw new TypeError("Object expected");(a=o(g.get))&&(h.get=a),(a=o(g.set))&&(h.set=a),(a=o(g.init))&&r.unshift(a)}else(a=o(g))&&("field"===l?r.unshift(a):h[c]=a)}u&&Object.defineProperty(u,i.name,h),d=!0},__exportStar:fs,__extends:ss,__generator:ds,__importDefault:Cs,__importStar:Ds,__makeTemplateObject:Es,__metadata:us,__param:cs,__propKey:function(e){return"symbol"==typeof e?e:"".concat(e)},__read:gs,__rest:as,__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:vs,__spreadArray:ws,__spreadArrays:ys,__values:ms,default:Ls}),Ns=ts(ks),Fs={},zs={},Us={},js={};Object.defineProperty(js,"__esModule",{value:!0});var Gs=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}();js.SlotList=Gs;var Hs={};Object.defineProperty(Hs,"__esModule",{value:!0});var Vs=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}();Hs.Slot=Vs,Object.defineProperty(Us,"__esModule",{value:!0});var Qs=js,_s=Hs,Ys=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.slots=Qs.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=Qs.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 _s.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}();Us.OnceSignal=Ys,Object.defineProperty(zs,"__esModule",{value:!0});var Ws=Ns,Xs=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ws.__extends(t,e),t.prototype.add=function(e){return this.registerListener(e)},t}(Us.OnceSignal);zs.Signal=Xs,Object.defineProperty(Fs,"__esModule",{value:!0});var Zs=Ns,Ks=Hs,qs=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Zs.__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 Ks.Slot(e,this,t,n);return this.slots=this.slots.insertWithPriority(i),i}return this.slots.find(e)},t}(zs.Signal);Fs.PrioritySignal=qs,Object.defineProperty(is,"__esModule",{value:!0});var Js=Ns,$s=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 Js.__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}(Fs.PrioritySignal);is.DeluxeSignal=$s;var eo={};Object.defineProperty(eo,"__esModule",{value:!0});var to=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}();eo.GenericEvent=to;var no={};Object.defineProperty(no,"__esModule",{value:!0}),no.IOnceSignal=Symbol("IOnceSignal");var io={};Object.defineProperty(io,"__esModule",{value:!0}),io.IPrioritySignal=Symbol("IPrioritySignal");var ro={};Object.defineProperty(ro,"__esModule",{value:!0}),ro.ISignal=Symbol("ISignal");var so={};Object.defineProperty(so,"__esModule",{value:!0}),so.ISlot=Symbol("ISlot");var oo={};Object.defineProperty(oo,"__esModule",{value:!0});var ao=Hs,lo=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 ao.Slot(e,this,t)},e}();oo.MonoSignal=lo;var co={};Object.defineProperty(co,"__esModule",{value:!0});var uo=Ns,ho=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return uo.__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}(Us.OnceSignal);co.Promise=ho,Object.defineProperty(ns,"__esModule",{value:!0});var po=is;ns.DeluxeSignal=po.DeluxeSignal;var fo=eo;ns.GenericEvent=fo.GenericEvent;var mo=no;ns.IOnceSignal=mo.IOnceSignal;var go=io;ns.IPrioritySignal=go.IPrioritySignal;var vo=ro;ns.ISignal=vo.ISignal;var yo=so;ns.ISlot=yo.ISlot;var wo=oo;ns.MonoSignal=wo.MonoSignal;var bo=Us;ns.OnceSignal=bo.OnceSignal;var xo=Fs;ns.PrioritySignal=xo.PrioritySignal;var Ao=co;ns.Promise=Ao.Promise;var So=zs,Eo=ns.Signal=So.Signal,To=Hs;ns.Slot=To.Slot;var Do=js;ns.SlotList=Do.SlotList;function Co(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Io={};({get exports(){return Io},set exports(e){Io=e}}).exports=function e(t,n,i){function r(o,a){if(!n[o]){if(!t[o]){if(!a&&Co)return Co(o);if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[o]={exports:{}};t[o][0].call(c.exports,(function(e){var n=t[o][1][e];return r(n||e)}),c,c.exports,e,t,n,i)}return n[o].exports}for(var s=Co,o=0;o<i.length;o++)r(i[o]);return r}({1:[function(e,t,n){(function(e){var n,i,r=e.MutationObserver||e.WebKitMutationObserver;if(r){var s=0,o=new r(u),a=e.document.createTextNode("");o.observe(a,{characterData:!0}),n=function(){a.data=s=++s%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){u(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(u,0)};else{var l=new e.MessageChannel;l.port1.onmessage=u,n=function(){l.port2.postMessage(0)}}var c=[];function u(){var e,t;i=!0;for(var n=c.length;n;){for(t=c,c=[],e=-1;++e<n;)t[e]();n=c.length}i=!1}function h(e){1!==c.push(e)||i||n()}t.exports=h}).call(this,void 0!==es?es:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){var i=e(1);function r(){}var s={},o=["REJECTED"],a=["FULFILLED"],l=["PENDING"];function c(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,e!==r&&p(this,e)}function u(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function h(e,t,n){i((function(){var i;try{i=t(n)}catch(t){return s.reject(e,t)}i===e?s.reject(e,new TypeError("Cannot resolve promise with itself")):s.resolve(e,i)}))}function d(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function p(e,t){var n=!1;function i(t){n||(n=!0,s.reject(e,t))}function r(t){n||(n=!0,s.resolve(e,t))}function o(){t(r,i)}var a=f(o);"error"===a.status&&i(a.value)}function f(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}function m(e){return e instanceof this?e:s.resolve(new this(r),e)}function g(e){var t=new this(r);return s.reject(t,e)}function v(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);for(var o=new Array(n),a=0,l=-1,c=new this(r);++l<n;)u(e[l],l);return c;function u(e,r){function l(e){o[r]=e,++a!==n||i||(i=!0,s.resolve(c,o))}t.resolve(e).then(l,(function(e){i||(i=!0,s.reject(c,e))}))}}function y(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,i=!1;if(!n)return this.resolve([]);for(var o=-1,a=new this(r);++o<n;)l(e[o]);return a;function l(e){t.resolve(e).then((function(e){i||(i=!0,s.resolve(a,e))}),(function(e){i||(i=!0,s.reject(a,e))}))}}t.exports=c,c.prototype.catch=function(e){return this.then(null,e)},c.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===o)return this;var n=new this.constructor(r);return this.state!==l?h(n,this.state===a?e:t,this.outcome):this.queue.push(new u(n,e,t)),n},u.prototype.callFulfilled=function(e){s.resolve(this.promise,e)},u.prototype.otherCallFulfilled=function(e){h(this.promise,this.onFulfilled,e)},u.prototype.callRejected=function(e){s.reject(this.promise,e)},u.prototype.otherCallRejected=function(e){h(this.promise,this.onRejected,e)},s.resolve=function(e,t){var n=f(d,t);if("error"===n.status)return s.reject(e,n.value);var i=n.value;if(i)p(e,i);else{e.state=a,e.outcome=t;for(var r=-1,o=e.queue.length;++r<o;)e.queue[r].callFulfilled(t)}return e},s.reject=function(e,t){e.state=o,e.outcome=t;for(var n=-1,i=e.queue.length;++n<i;)e.queue[n].callRejected(t);return e},c.resolve=m,c.reject=g,c.all=v,c.race=y},{1:1}],3:[function(e,t,n){(function(t){"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==es?es:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,n){var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}var o=s();function a(){try{if(!o||!o.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}function l(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(r){if("TypeError"!==r.name)throw r;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),i=0;i<e.length;i+=1)n.append(e[i]);return n.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var c=Promise;function u(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function h(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function d(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function p(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var f="local-forage-detect-blob-support",m=void 0,g={},v=Object.prototype.toString,y="readonly",w="readwrite";function b(e){for(var t=e.length,n=new ArrayBuffer(t),i=new Uint8Array(n),r=0;r<t;r++)i[r]=e.charCodeAt(r);return n}function x(e){return new c((function(t){var n=e.transaction(f,w),i=l([""]);n.objectStore(f).put(i,"key"),n.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},n.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);t(n||!e||parseInt(e[1],10)>=43)}})).catch((function(){return!1}))}function A(e){return"boolean"==typeof m?c.resolve(m):x(e).then((function(e){return m=e}))}function S(e){var t=g[e.name],n={};n.promise=new c((function(e,t){n.resolve=e,n.reject=t})),t.deferredOperations.push(n),t.dbReady?t.dbReady=t.dbReady.then((function(){return n.promise})):t.dbReady=n.promise}function E(e){var t=g[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function T(e,t){var n=g[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function D(e,t){return new c((function(n,i){if(g[e.name]=g[e.name]||N(),e.db){if(!t)return n(e.db);S(e),e.db.close()}var r=[e.name];t&&r.push(e.version);var s=o.open.apply(o,r);t&&(s.onupgradeneeded=function(t){var n=s.result;try{n.createObjectStore(e.storeName),t.oldVersion<=1&&n.createObjectStore(f)}catch(n){if("ConstraintError"!==n.name)throw n;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),s.onerror=function(e){e.preventDefault(),i(s.error)},s.onsuccess=function(){n(s.result),E(e)}}))}function C(e){return D(e,!1)}function I(e){return D(e,!0)}function M(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),i=e.version<e.db.version,r=e.version>e.db.version;if(i&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),r||n){if(n){var s=e.db.version+1;s>e.version&&(e.version=s)}return!0}return!1}function B(e){return new c((function(t,n){var i=new FileReader;i.onerror=n,i.onloadend=function(n){var i=btoa(n.target.result||"");t({__local_forage_encoded_blob:!0,data:i,type:e.type})},i.readAsBinaryString(e)}))}function P(e){return l([b(atob(e.data))],{type:e.type})}function O(e){return e&&e.__local_forage_encoded_blob}function R(e){var t=this,n=t._initReady().then((function(){var e=g[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return h(n,e,e),n}function L(e){S(e);for(var t=g[e.name],n=t.forages,i=0;i<n.length;i++){var r=n[i];r._dbInfo.db&&(r._dbInfo.db.close(),r._dbInfo.db=null)}return e.db=null,C(e).then((function(t){return e.db=t,M(e)?I(e):t})).then((function(i){e.db=t.db=i;for(var r=0;r<n.length;r++)n[r]._dbInfo.db=i})).catch((function(t){throw T(e,t),t}))}function k(e,t,n,i){void 0===i&&(i=1);try{var r=e.db.transaction(e.storeName,t);n(null,r)}catch(r){if(i>0&&(!e.db||"InvalidStateError"===r.name||"NotFoundError"===r.name))return c.resolve().then((function(){if(!e.db||"NotFoundError"===r.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),I(e)})).then((function(){return L(e).then((function(){k(e,t,n,i-1)}))})).catch(n);n(r)}}function N(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function F(e){var t=this,n={db:null};if(e)for(var i in e)n[i]=e[i];var r=g[n.name];r||(r=N(),g[n.name]=r),r.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=R);var s=[];function o(){return c.resolve()}for(var a=0;a<r.forages.length;a++){var l=r.forages[a];l!==t&&s.push(l._initReady().catch(o))}var u=r.forages.slice(0);return c.all(s).then((function(){return n.db=r.db,C(n)})).then((function(e){return n.db=e,M(n,t._defaultConfig.version)?I(n):e})).then((function(e){n.db=r.db=e,t._dbInfo=n;for(var i=0;i<u.length;i++){var s=u[i];s!==t&&(s._dbInfo.db=n.db,s._dbInfo.version=n.version)}}))}function z(e,t){var n=this;e=d(e);var i=new c((function(t,i){n.ready().then((function(){k(n._dbInfo,y,(function(r,s){if(r)return i(r);try{var o=s.objectStore(n._dbInfo.storeName).get(e);o.onsuccess=function(){var e=o.result;void 0===e&&(e=null),O(e)&&(e=P(e)),t(e)},o.onerror=function(){i(o.error)}}catch(e){i(e)}}))})).catch(i)}));return u(i,t),i}function U(e,t){var n=this,i=new c((function(t,i){n.ready().then((function(){k(n._dbInfo,y,(function(r,s){if(r)return i(r);try{var o=s.objectStore(n._dbInfo.storeName).openCursor(),a=1;o.onsuccess=function(){var n=o.result;if(n){var i=n.value;O(i)&&(i=P(i));var r=e(i,n.key,a++);void 0!==r?t(r):n.continue()}else t()},o.onerror=function(){i(o.error)}}catch(e){i(e)}}))})).catch(i)}));return u(i,t),i}function j(e,t,n){var i=this;e=d(e);var r=new c((function(n,r){var s;i.ready().then((function(){return s=i._dbInfo,"[object Blob]"===v.call(t)?A(s.db).then((function(e){return e?t:B(t)})):t})).then((function(t){k(i._dbInfo,w,(function(s,o){if(s)return r(s);try{var a=o.objectStore(i._dbInfo.storeName);null===t&&(t=void 0);var l=a.put(t,e);o.oncomplete=function(){void 0===t&&(t=null),n(t)},o.onabort=o.onerror=function(){var e=l.error?l.error:l.transaction.error;r(e)}}catch(e){r(e)}}))})).catch(r)}));return u(r,n),r}function G(e,t){var n=this;e=d(e);var i=new c((function(t,i){n.ready().then((function(){k(n._dbInfo,w,(function(r,s){if(r)return i(r);try{var o=s.objectStore(n._dbInfo.storeName).delete(e);s.oncomplete=function(){t()},s.onerror=function(){i(o.error)},s.onabort=function(){var e=o.error?o.error:o.transaction.error;i(e)}}catch(e){i(e)}}))})).catch(i)}));return u(i,t),i}function H(e){var t=this,n=new c((function(e,n){t.ready().then((function(){k(t._dbInfo,w,(function(i,r){if(i)return n(i);try{var s=r.objectStore(t._dbInfo.storeName).clear();r.oncomplete=function(){e()},r.onabort=r.onerror=function(){var e=s.error?s.error:s.transaction.error;n(e)}}catch(e){n(e)}}))})).catch(n)}));return u(n,e),n}function V(e){var t=this,n=new c((function(e,n){t.ready().then((function(){k(t._dbInfo,y,(function(i,r){if(i)return n(i);try{var s=r.objectStore(t._dbInfo.storeName).count();s.onsuccess=function(){e(s.result)},s.onerror=function(){n(s.error)}}catch(e){n(e)}}))})).catch(n)}));return u(n,e),n}function Q(e,t){var n=this,i=new c((function(t,i){e<0?t(null):n.ready().then((function(){k(n._dbInfo,y,(function(r,s){if(r)return i(r);try{var o=s.objectStore(n._dbInfo.storeName),a=!1,l=o.openKeyCursor();l.onsuccess=function(){var n=l.result;n?0===e||a?t(n.key):(a=!0,n.advance(e)):t(null)},l.onerror=function(){i(l.error)}}catch(e){i(e)}}))})).catch(i)}));return u(i,t),i}function _(e){var t=this,n=new c((function(e,n){t.ready().then((function(){k(t._dbInfo,y,(function(i,r){if(i)return n(i);try{var s=r.objectStore(t._dbInfo.storeName).openKeyCursor(),o=[];s.onsuccess=function(){var t=s.result;t?(o.push(t.key),t.continue()):e(o)},s.onerror=function(){n(s.error)}}catch(e){n(e)}}))})).catch(n)}));return u(n,e),n}function Y(e,t){t=p.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var i,r=this;if(e.name){var s=e.name===n.name&&r._dbInfo.db?c.resolve(r._dbInfo.db):C(e).then((function(t){var n=g[e.name],i=n.forages;n.db=t;for(var r=0;r<i.length;r++)i[r]._dbInfo.db=t;return t}));i=e.storeName?s.then((function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1;S(e);var i=g[e.name],r=i.forages;t.close();for(var s=0;s<r.length;s++){var a=r[s];a._dbInfo.db=null,a._dbInfo.version=n}var l=new c((function(t,i){var r=o.open(e.name,n);r.onerror=function(e){r.result.close(),i(e)},r.onupgradeneeded=function(){r.result.deleteObjectStore(e.storeName)},r.onsuccess=function(){var e=r.result;e.close(),t(e)}}));return l.then((function(e){i.db=e;for(var t=0;t<r.length;t++){var n=r[t];n._dbInfo.db=e,E(n._dbInfo)}})).catch((function(t){throw(T(e,t)||c.resolve()).catch((function(){})),t}))}})):s.then((function(t){S(e);var n=g[e.name],i=n.forages;t.close();for(var r=0;r<i.length;r++)i[r]._dbInfo.db=null;var s=new c((function(t,n){var i=o.deleteDatabase(e.name);i.onerror=i.onblocked=function(e){var t=i.result;t&&t.close(),n(e)},i.onsuccess=function(){var e=i.result;e&&e.close(),t(e)}}));return s.then((function(e){n.db=e;for(var t=0;t<i.length;t++)E(i[t]._dbInfo)})).catch((function(t){throw(T(e,t)||c.resolve()).catch((function(){})),t}))}))}else i=c.reject("Invalid arguments");return u(i,t),i}var W={_driver:"asyncStorage",_initStorage:F,_support:a(),iterate:U,getItem:z,setItem:j,removeItem:G,clear:H,length:V,key:Q,keys:_,dropInstance:Y};function X(){return"function"==typeof openDatabase}var Z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",K="~~local_forage_type~",q=/^~~local_forage_type~([^~]+)~/,J="__lfsc__:",$=J.length,ee="arbf",te="blob",ne="si08",ie="ui08",re="uic8",se="si16",oe="si32",ae="ur16",le="ui32",ce="fl32",ue="fl64",he=$+ee.length,de=Object.prototype.toString;function pe(e){var t,n,i,r,s,o=.75*e.length,a=e.length,l=0;"="===e[e.length-1]&&(o--,"="===e[e.length-2]&&o--);var c=new ArrayBuffer(o),u=new Uint8Array(c);for(t=0;t<a;t+=4)n=Z.indexOf(e[t]),i=Z.indexOf(e[t+1]),r=Z.indexOf(e[t+2]),s=Z.indexOf(e[t+3]),u[l++]=n<<2|i>>4,u[l++]=(15&i)<<4|r>>2,u[l++]=(3&r)<<6|63&s;return c}function fe(e){var t,n=new Uint8Array(e),i="";for(t=0;t<n.length;t+=3)i+=Z[n[t]>>2],i+=Z[(3&n[t])<<4|n[t+1]>>4],i+=Z[(15&n[t+1])<<2|n[t+2]>>6],i+=Z[63&n[t+2]];return n.length%3==2?i=i.substring(0,i.length-1)+"=":n.length%3==1&&(i=i.substring(0,i.length-2)+"=="),i}function me(e,t){var n="";if(e&&(n=de.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===de.call(e.buffer))){var i,r=J;e instanceof ArrayBuffer?(i=e,r+=ee):(i=e.buffer,"[object Int8Array]"===n?r+=ne:"[object Uint8Array]"===n?r+=ie:"[object Uint8ClampedArray]"===n?r+=re:"[object Int16Array]"===n?r+=se:"[object Uint16Array]"===n?r+=ae:"[object Int32Array]"===n?r+=oe:"[object Uint32Array]"===n?r+=le:"[object Float32Array]"===n?r+=ce:"[object Float64Array]"===n?r+=ue:t(new Error("Failed to get type for BinaryArray"))),t(r+fe(i))}else if("[object Blob]"===n){var s=new FileReader;s.onload=function(){var n=K+e.type+"~"+fe(this.result);t(J+te+n)},s.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}}function ge(e){if(e.substring(0,$)!==J)return JSON.parse(e);var t,n=e.substring(he),i=e.substring($,he);if(i===te&&q.test(n)){var r=n.match(q);t=r[1],n=n.substring(r[0].length)}var s=pe(n);switch(i){case ee:return s;case te:return l([s],{type:t});case ne:return new Int8Array(s);case ie:return new Uint8Array(s);case re:return new Uint8ClampedArray(s);case se:return new Int16Array(s);case ae:return new Uint16Array(s);case oe:return new Int32Array(s);case le:return new Uint32Array(s);case ce:return new Float32Array(s);case ue:return new Float64Array(s);default:throw new Error("Unkown type: "+i)}}var ve={serialize:me,deserialize:ge,stringToBuffer:pe,bufferToString:fe};function ye(e,t,n,i){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,i)}function we(e){var t=this,n={db:null};if(e)for(var i in e)n[i]="string"!=typeof e[i]?e[i].toString():e[i];var r=new c((function(e,i){try{n.db=openDatabase(n.name,String(n.version),n.description,n.size)}catch(e){return i(e)}n.db.transaction((function(r){ye(r,n,(function(){t._dbInfo=n,e()}),(function(e,t){i(t)}))}),i)}));return n.serializer=ve,r}function be(e,t,n,i,r,s){e.executeSql(n,i,r,(function(e,o){o.code===o.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,a){a.rows.length?s(e,o):ye(e,t,(function(){e.executeSql(n,i,r,s)}),s)}),s):s(e,o)}),s)}function xe(e,t){var n=this;e=d(e);var i=new c((function(t,i){n.ready().then((function(){var r=n._dbInfo;r.db.transaction((function(n){be(n,r,"SELECT * FROM "+r.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,n){var i=n.rows.length?n.rows.item(0).value:null;i&&(i=r.serializer.deserialize(i)),t(i)}),(function(e,t){i(t)}))}))})).catch(i)}));return u(i,t),i}function Ae(e,t){var n=this,i=new c((function(t,i){n.ready().then((function(){var r=n._dbInfo;r.db.transaction((function(n){be(n,r,"SELECT * FROM "+r.storeName,[],(function(n,i){for(var s=i.rows,o=s.length,a=0;a<o;a++){var l=s.item(a),c=l.value;if(c&&(c=r.serializer.deserialize(c)),void 0!==(c=e(c,l.key,a+1)))return void t(c)}t()}),(function(e,t){i(t)}))}))})).catch(i)}));return u(i,t),i}function Se(e,t,n,i){var r=this;e=d(e);var s=new c((function(s,o){r.ready().then((function(){void 0===t&&(t=null);var a=t,l=r._dbInfo;l.serializer.serialize(t,(function(t,c){c?o(c):l.db.transaction((function(n){be(n,l,"INSERT OR REPLACE INTO "+l.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){s(a)}),(function(e,t){o(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(i>0)return void s(Se.apply(r,[e,a,n,i-1]));o(t)}}))}))})).catch(o)}));return u(s,n),s}function Ee(e,t,n){return Se.apply(this,[e,t,n,1])}function Te(e,t){var n=this;e=d(e);var i=new c((function(t,i){n.ready().then((function(){var r=n._dbInfo;r.db.transaction((function(n){be(n,r,"DELETE FROM "+r.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){i(t)}))}))})).catch(i)}));return u(i,t),i}function De(e){var t=this,n=new c((function(e,n){t.ready().then((function(){var i=t._dbInfo;i.db.transaction((function(t){be(t,i,"DELETE FROM "+i.storeName,[],(function(){e()}),(function(e,t){n(t)}))}))})).catch(n)}));return u(n,e),n}function Ce(e){var t=this,n=new c((function(e,n){t.ready().then((function(){var i=t._dbInfo;i.db.transaction((function(t){be(t,i,"SELECT COUNT(key) as c FROM "+i.storeName,[],(function(t,n){var i=n.rows.item(0).c;e(i)}),(function(e,t){n(t)}))}))})).catch(n)}));return u(n,e),n}function Ie(e,t){var n=this,i=new c((function(t,i){n.ready().then((function(){var r=n._dbInfo;r.db.transaction((function(n){be(n,r,"SELECT key FROM "+r.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,n){var i=n.rows.length?n.rows.item(0).key:null;t(i)}),(function(e,t){i(t)}))}))})).catch(i)}));return u(i,t),i}function Me(e){var t=this,n=new c((function(e,n){t.ready().then((function(){var i=t._dbInfo;i.db.transaction((function(t){be(t,i,"SELECT key FROM "+i.storeName,[],(function(t,n){for(var i=[],r=0;r<n.rows.length;r++)i.push(n.rows.item(r).key);e(i)}),(function(e,t){n(t)}))}))})).catch(n)}));return u(n,e),n}function Be(e){return new c((function(t,n){e.transaction((function(i){i.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(n,i){for(var r=[],s=0;s<i.rows.length;s++)r.push(i.rows.item(s).name);t({db:e,storeNames:r})}),(function(e,t){n(t)}))}),(function(e){n(e)}))}))}function Pe(e,t){t=p.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var i,r=this;return i=e.name?new c((function(t){var i;i=e.name===n.name?r._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:i,storeNames:[e.storeName]}):t(Be(i))})).then((function(e){return new c((function(t,n){e.db.transaction((function(i){function r(e){return new c((function(t,n){i.executeSql("DROP TABLE IF EXISTS "+e,[],(function(){t()}),(function(e,t){n(t)}))}))}for(var s=[],o=0,a=e.storeNames.length;o<a;o++)s.push(r(e.storeNames[o]));c.all(s).then((function(){t()})).catch((function(e){n(e)}))}),(function(e){n(e)}))}))})):c.reject("Invalid arguments"),u(i,t),i}var Oe={_driver:"webSQLStorage",_initStorage:we,_support:X(),iterate:Ae,getItem:xe,setItem:Ee,removeItem:Te,clear:De,length:Ce,key:Ie,keys:Me,dropInstance:Pe};function Re(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}function Le(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}function ke(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}function Ne(){return!ke()||localStorage.length>0}function Fe(e){var t=this,n={};if(e)for(var i in e)n[i]=e[i];return n.keyPrefix=Le(e,t._defaultConfig),Ne()?(t._dbInfo=n,n.serializer=ve,c.resolve()):c.reject()}function ze(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var i=localStorage.key(n);0===i.indexOf(e)&&localStorage.removeItem(i)}}));return u(n,e),n}function Ue(e,t){var n=this;e=d(e);var i=n.ready().then((function(){var t=n._dbInfo,i=localStorage.getItem(t.keyPrefix+e);return i&&(i=t.serializer.deserialize(i)),i}));return u(i,t),i}function je(e,t){var n=this,i=n.ready().then((function(){for(var t=n._dbInfo,i=t.keyPrefix,r=i.length,s=localStorage.length,o=1,a=0;a<s;a++){var l=localStorage.key(a);if(0===l.indexOf(i)){var c=localStorage.getItem(l);if(c&&(c=t.serializer.deserialize(c)),void 0!==(c=e(c,l.substring(r),o++)))return c}}}));return u(i,t),i}function Ge(e,t){var n=this,i=n.ready().then((function(){var t,i=n._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(i.keyPrefix.length)),t}));return u(i,t),i}function He(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo,n=localStorage.length,i=[],r=0;r<n;r++){var s=localStorage.key(r);0===s.indexOf(e.keyPrefix)&&i.push(s.substring(e.keyPrefix.length))}return i}));return u(n,e),n}function Ve(e){var t=this.keys().then((function(e){return e.length}));return u(t,e),t}function Qe(e,t){var n=this;e=d(e);var i=n.ready().then((function(){var t=n._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return u(i,t),i}function _e(e,t,n){var i=this;e=d(e);var r=i.ready().then((function(){void 0===t&&(t=null);var n=t;return new c((function(r,s){var o=i._dbInfo;o.serializer.serialize(t,(function(t,i){if(i)s(i);else try{localStorage.setItem(o.keyPrefix+e,t),r(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||s(e),s(e)}}))}))}));return u(r,n),r}function Ye(e,t){if(t=p.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}var i,r=this;return i=e.name?new c((function(t){e.storeName?t(Le(e,r._defaultConfig)):t(e.name+"/")})).then((function(e){for(var t=localStorage.length-1;t>=0;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}})):c.reject("Invalid arguments"),u(i,t),i}var We={_driver:"localStorageWrapper",_initStorage:Fe,_support:Re(),iterate:je,getItem:Ue,setItem:_e,removeItem:Qe,clear:ze,length:Ve,key:Ge,keys:He,dropInstance:Ye},Xe=function(e,t){return e===t||"number"==typeof e&&"number"==typeof t&&isNaN(e)&&isNaN(t)},Ze=function(e,t){for(var n=e.length,i=0;i<n;){if(Xe(e[i],t))return!0;i++}return!1},Ke=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},qe={},Je={},$e={INDEXEDDB:W,WEBSQL:Oe,LOCALSTORAGE:We},et=[$e.INDEXEDDB._driver,$e.WEBSQL._driver,$e.LOCALSTORAGE._driver],tt=["dropInstance"],nt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(tt),it={description:"",driver:et.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function rt(e,t){e[t]=function(){var n=arguments;return e.ready().then((function(){return e[t].apply(e,n)}))}}function st(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var n in t)t.hasOwnProperty(n)&&(Ke(t[n])?arguments[0][n]=t[n].slice():arguments[0][n]=t[n])}return arguments[0]}var ot=function(){function e(t){for(var n in r(this,e),$e)if($e.hasOwnProperty(n)){var i=$e[n],s=i._driver;this[n]=s,qe[s]||this.defineDriver(i)}this._defaultConfig=st({},it),this._config=st({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}))}return e.prototype.config=function(e){if("object"===(void 0===e?"undefined":i(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e)||!e.driver||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,n){var i=new c((function(t,n){try{var i=e._driver,r=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void n(r);for(var s=nt.concat("_initStorage"),o=0,a=s.length;o<a;o++){var l=s[o];if((!Ze(tt,l)||e[l])&&"function"!=typeof e[l])return void n(r)}var h=function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),n=c.reject(t);return u(n,arguments[arguments.length-1]),n}},n=0,i=tt.length;n<i;n++){var r=tt[n];e[r]||(e[r]=t(r))}};h();var d=function(n){qe[i]&&console.info("Redefining LocalForage driver: "+i),qe[i]=e,Je[i]=n,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(d,n):d(!!e._support):d(!0)}catch(e){n(e)}}));return h(i,t,n),i},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,n){var i=qe[e]?c.resolve(qe[e]):c.reject(new Error("Driver not found."));return h(i,t,n),i},e.prototype.getSerializer=function(e){var t=c.resolve(ve);return h(t,e),t},e.prototype.ready=function(e){var t=this,n=t._driverSet.then((function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}));return h(n,e,e),n},e.prototype.setDriver=function(e,t,n){var i=this;Ke(e)||(e=[e]);var r=this._getSupportedDrivers(e);function s(){i._config.driver=i.driver()}function o(e){return i._extend(e),s(),i._ready=i._initStorage(i._config),i._ready}function a(e){return function(){var t=0;function n(){for(;t<e.length;){var r=e[t];return t++,i._dbInfo=null,i._ready=null,i.getDriver(r).then(o).catch(n)}s();var a=new Error("No available storage method found.");return i._driverSet=c.reject(a),i._driverSet}return n()}}var l=null!==this._driverSet?this._driverSet.catch((function(){return c.resolve()})):c.resolve();return this._driverSet=l.then((function(){var e=r[0];return i._dbInfo=null,i._ready=null,i.getDriver(e).then((function(e){i._driver=e._driver,s(),i._wrapLibraryMethodsWithReady(),i._initDriver=a(r)}))})).catch((function(){s();var e=new Error("No available storage method found.");return i._driverSet=c.reject(e),i._driverSet})),h(this._driverSet,t,n),this._driverSet},e.prototype.supports=function(e){return!!Je[e]},e.prototype._extend=function(e){st(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n];this.supports(r)&&t.push(r)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=nt.length;e<t;e++)rt(this,nt[e])},e.prototype.createInstance=function(t){return new e(t)},e}(),at=new ot;t.exports=at},{3:3}]},{},[4])(4);const Mo=new r;Mo.name="Scene";class Bo{constructor(e,t){this.signals=e,this.viewportState=t,this.strokeStore=Io.createInstance({name:"soonspace",storeName:"modelStrokeCache"}),this.scene=Mo.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 Yn("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=>{var n;if(e.geometry&&e.material){const n=e;n.geometry.dispose(),pi(n.material,t)}e instanceof ou&&(null===(n=e.element)||void 0===n||n.remove());const{meshOfModelList:i,poiIconList:r,otherObjList:s}=this.intersectsList,o=i.findIndex((t=>t.uuid===e.uuid)),a=r.findIndex((t=>t.uuid===e.uuid)),l=s.findIndex((t=>t.uuid===e.uuid));o>-1&&this.intersectsList.meshOfModelList.splice(o,1),a>-1&&this.intersectsList.poiIconList.splice(a,1),l>-1&&this.intersectsList.otherObjList.splice(l,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 F(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 Pi(e)?e.forEach((e=>i(e))):Oi(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 Pi(e)?Promise.all(e.map((e=>t(e)))):Oi(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,modelCache:a=!0,firstChild:l=!1}=t,c=async e=>{var c;if(-1!==this.selectedObjects.stroke.findIndex((t=>t.uuid===e.uuid)))return Promise.resolve();if(e.userData.strokeGroup)return Promise.resolve();const u=new ru({id:`${null!==(c=e.sid)&&void 0!==c?c:e.id}_stroke`,name:`${e.name}_stroke`}),h=new U,d=new y({color:s,transparent:!0,opacity:o});h.material=d,u.add(h);let p=null;const f=()=>{const t=[];if((l?e.children[0]:e).traverse((n=>{if("Mesh"===n.type&&n instanceof z){const i=new j(n.geometry,89);n.updateWorldMatrix(!0,!1);const r=n.matrixWorld.clone().premultiply(e.matrixWorld.clone().invert());i.applyMatrix4(r),t.push(i)}})),0!==t.length)return Nt(t)};if(a&&e instanceof au&&e.url){const{url:t}=e;await this.strokeStore.ready();const n=await this.strokeStore.getItem(t);if(n)p=new g,p.setAttribute("position",new v(n,3));else{const e=f();if(e){p=e;const n=e.getAttribute("position");n.array instanceof Float32Array&&this.strokeStore.setItem(t,n.array.buffer)}}}else{const e=f();e&&(p=e)}return null!==p?(h.geometry=p,e.userData.strokeGroup=u,e.userData.strokeOptions=t,this.addObject(u,e),this.selectedObjects.stroke.push(e),n&&this.opacityShow(l?e.children[0]:e,{color:i,opacity:r}),Promise.resolve()):void 0};return Pi(e)?Promise.all(e.map((e=>c(e)))):Oi(e)?c(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));if(-1===t)return Promise.resolve();this.selectedObjects.stroke.splice(t,1),this.signals.geometryChanged.dispatch();const{firstChild:n}=e.userData.strokeOptions;return this.unOpacityShow(n?e.children[0]:e),Reflect.deleteProperty(e.userData,"strokeOptions"),Promise.resolve()};return Pi(e)?Promise.all(e.map((e=>t(e)))):Oi(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=fi(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 z){if(e.userData.material)return;e.userData.material=e.material,e.material=pi(e.material,r)}})),this.signals.materialChanged.dispatch(),this.selectedObjects.opacity.push(e)),Promise.resolve());return Pi(e)?Promise.all(e.map((e=>s(e)))):Oi(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 z){if(!e.userData.material)return;mi(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),t()}));return Pi(e)?Promise.all(e.map((e=>t(e)))):Oi(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 G&&(e.color=new u(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 z){if(e.userData.material)return;e.userData.material=e.material,e.material=fi(e.material),pi(e.material,r)}})),this.signals.materialChanged.dispatch(),this.selectedObjects.highlight.push(e)),Promise.resolve());return Pi(e)?Promise.all(e.map((e=>s(e)))):Oi(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 z){if(!e.userData.material)return;mi(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),t()}));return Pi(e)?Promise.all(e.map((e=>t(e)))):Oi(e)?t(e):Promise.resolve()}emissiveShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{color:n="red",maxOpacity:i=1,minOpacity:r=0,duration:s=1e3}=t;function o(e){e instanceof G&&(e.emissive.set(n),e.emissiveIntensity=i,0!==s&&ji({emissiveIntensity:i},{emissiveIntensity:r},{duration:s,repeat:!0},(t=>e.emissiveIntensity=t.emissiveIntensity),(t=>e.userData.animation=t)))}const a=e=>(-1!==this.selectedObjects.emissive.findIndex((t=>t.uuid===e.uuid))||(e.traverse((e=>{if(e instanceof z){if(e.userData.material)return;e.userData.material=e.material,e.material=fi(e.material),pi(e.material,o)}})),this.selectedObjects.emissive.push(e),this.signals.materialChanged.dispatch()),Promise.resolve());return Pi(e)?Promise.all(e.map((e=>a(e)))):Oi(e)?a(e):Promise.resolve()}unEmissiveShow(e){function t(e){e.userData.animation&&jn.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 z){if(!e.userData.material)return;pi(e.material,t),mi(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),n()}));return Pi(e)?Promise.all(e.map((e=>n(e)))):Oi(e)?n(e):Promise.resolve()}_triggerObjectAdded(e){if(e instanceof nu)if("Model"===e.stype)e.traverse((e=>{if(e instanceof z){-1===this.intersectsList.meshOfModelList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.meshOfModelList.push(e)}}));else if("Poi"===e.stype&&e instanceof lu){const t=this.intersectsList.poiIconList.findIndex((t=>{var n;return t.uuid===(null===(n=e.icon)||void 0===n?void 0:n.uuid)}));-1===t&&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 z){-1===this.intersectsList.otherObjList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.otherObjList.push(e)}}));else e.isObject3D&&e.traverse((e=>{if(e instanceof z){-1===this.intersectsList.otherObjList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.otherObjList.push(e)}}))}}class Po extends O{constructor(e){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof Po&&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 Oo=new t,Ro=new f,Lo=new f,ko=new t,No=new t;class Fo{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(),Ro.copy(t.matrixWorldInverse),Lo.multiplyMatrices(t.projectionMatrix,Ro),o(e,e,t),function(e){const t=function(e){const t=[];return e.traverse((function(e){e instanceof Po&&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 Po){const t=e.parent;if(t.occlude){const t=!xi(e,this.viewport.camera)&&Ai(e,this.viewport.camera,this.viewport.raycaster,this.viewport.scener.intersectsList.getAll());e.visible=t}Oo.setFromMatrixPosition(e.matrixWorld),Oo.applyMatrix4(Lo);const o=ni(e)&&Oo.z>=-1&&Oo.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("+(Oo.x*i+i)+"px,"+(-Oo.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 ko.setFromMatrixPosition(e.matrixWorld),No.setFromMatrixPosition(t.matrixWorld),ko.distanceToSquared(No)}}}const zo=new t,Uo=new s,jo=new t;class Go extends O{constructor(e){super(),this.isCSS3DObject=!0,this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof Go&&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 Ho extends Go{constructor(e){super(e),this.isCSS3DSprite=!0,this.rotation2D=0}copy(e,t){return super.copy(e,t),this.rotation2D=e.rotation2D,this}}const Vo=new f,Qo=new f;class _o{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 H?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 p=0,f=0;u instanceof V&&(p=-(u.right+u.left)/2,f=(u.top+u.bottom)/2);const m=u.view&&u.view.enabled?u.view.height/u.view.fullHeight:1,g=(u instanceof V?`scale( ${m} )scale(`+d+")translate("+l(p)+"px,"+l(f)+"px)"+c(u.matrixWorldInverse):`scale( ${m} )translateZ(`+d+"px)"+c(u.matrixWorldInverse))+"translate("+i+"px,"+r+"px)";s.camera.style!==g&&(a.style.transform=g,s.camera.style=g),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 Go){const t=e.parent;if(t.occlude){const t=!xi(e,this.viewport.camera)&&Ai(e,this.viewport.camera,this.viewport.raycaster,this.viewport.scener.intersectsList.getAll());e.visible=t}const i=ni(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 Ho?(Vo.copy(n.matrixWorldInverse),Vo.transpose(),0!==e.rotation2D&&Vo.multiply(Qo.makeRotationZ(e.rotation2D)),e.matrixWorld.decompose(zo,Uo,jo),Vo.setPosition(zo),Vo.scale(jo),Vo.elements[3]=0,Vo.elements[7]=0,Vo.elements[11]=0,Vo.elements[15]=1,t=u(Vo)):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 Yo{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 p(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 Q({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=_,s.useLegacyLights=!1,this.container.appendChild(s.domElement),s}_initRenderCSS2D(){const e=new Fo(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 _o(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 Wo=new f,Xo=(e,t)=>{const i=Wo.clone(),r=Wo.clone(),s=Wo.clone();i.makeRotationY(e),r.makeRotationX(t);const o=new n;return s.multiplyMatrices(i,r),o.setFromRotationMatrix(s),o},Zo=Xo(-Math.PI/2,-Math.PI/4),Ko=Xo(Math.PI/2,-Math.PI/4),qo=Xo(-Math.PI/4,-Math.PI/4),Jo=Xo(Math.PI/4,-Math.PI/4),$o=Xo(1.25*Math.PI,-Math.PI/4),ea=Xo(.75*Math.PI,-Math.PI/4),ta={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(Zo.x,Zo.y,Zo.z),RIGHTTOP:new n(Ko.x,Ko.y,Ko.z),LEFTFRONTTOP:new n(qo.x,qo.y,qo.z),RIGHTFRONTTOP:new n(Jo.x,Jo.y,Jo.z),LEFTBACKTOP:new n($o.x,$o.y,$o.z),RIGHTBACKTOP:new n(ea.x,ea.y,ea.z)},na=e=>Bi(e)?e:e.includes("%")?.01*Number(e.split("%")[0]):isNaN(+e)?0:Number(e),ia=new t,ra=new n,sa=new H(50,1,.01,5e4);sa.position.set(500,1e3,500),sa.lookAt(ia.set(0,0,0)),sa.name="Camera";class oa{constructor(e){this.viewport=e,this.mainCamera=sa.clone(),this.mainCamera.name="freeCamera",this.currentCamera=this.mainCamera,this.cameras={}}createCamera(e){const t=sa.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&&Oi(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(Oi(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 ji(this.currentCamera.position,e,t,(e=>this.viewport.signals.cameraChange.dispatch(e)))}rotateTo(e,t){const n=this.currentCamera.quaternion.clone(),i=(new s).setFromEuler(e);return ji({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(Ii(t)){const e=t.toLocaleUpperCase();"CURRENT"===e?ra.copy(this.currentCamera.rotation):ta[e]&&ra.copy(ta[e])}else t instanceof n?ra.copy(t):Oi(t)&&ra.set(t.x,t.y,t.z);ra.copy(Jn(this.currentCamera.rotation,ra.clone())),await Promise.all([this.moveTo(e,i),this.rotateTo(ra,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 Yn("target box is empty");const r=this.viewport.controls.options.type,s=new t;if(Ii(n)){if("CURRENT"===n.toLocaleUpperCase())s.copy(this.getMovePosByBBox(e));else{const t=ta[n.toLocaleUpperCase()],i=this.getObjectLabelPos(e,t);s.copy(i)}}else{"orbit"===r&&Yn("orbit 控制器不支持 Rotation 类型 的 rotation 参数");const t=Zn(n),i=this.getObjectLabelPos(e,t);s.copy(i)}if("orbit"===r){const t=e.getCenter(ia),i=this.viewport.controls.currentControls;i.target.copy(t);const r=new f;r.lookAt(s,t,i.object.up),n=ra.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 lu||e instanceof ou){const{padding:t=50}=i,r=na(t);return this.flyToBoundingBox(e.getBoundingBox(r),n,i)}{const{padding:r="30%"}=i,s=Kn(e),o=s.getSize(ia);let a=0;if(Ii(r)){const e=Math.max(o.x,o.y,o.z);a=na(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(ia.set(l/2,c/2,l/2)),s.min.sub(ia.set(l/2,c/2,l/2))),s.isEmpty()&&(ia.setFromMatrixPosition(e.matrixWorld),s.setFromCenterAndSize(ia,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=Xn(e),o=s.clone().setY(this.currentCamera.position.y).distanceTo(this.currentCamera.position),a=Math.abs(i);return ji({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(ia);return this.surroundOnTarget(n,t)}getMovePosByBBox(e){const n=this.currentCamera.position,i=e.getCenter(ia);(new t).subVectors(i,n).normalize();let r=new Y;r=e.getBoundingSphere(r);let s=0;if(this.currentCamera instanceof H){const e=this.currentCamera.fov/2*Math.PI/180,t=Math.sin(e);s=r.radius/t}else s=r.radius;const o=new t;this.currentCamera.getWorldDirection(o);const a=o.clone();return a.multiplyScalar(-s),i.clone().add(a)}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 nu&&(e=(new i).setFromObject(e)),e.isEmpty())return Yn("target box is empty"),new t;const{extendScale:s=1.6,mode:o="scene"}=r;if("scene"===o){const t=e.getCenter(ia),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=Ii(n)?ta[n.toLocaleUpperCase()]:Zn(n),a(ia.set(0,0,1).applyEuler(l)),o}return"screen"===o?e.getCenter(ia).clone():new t}}
|
|
2
2
|
/**
|
|
3
3
|
* postprocessing v6.32.2 build Sat Jul 01 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.8.
|
|
3
|
+
"version": "2.8.15",
|
|
4
4
|
"homepage": "http://www.xwbuilders.com:8800/",
|
|
5
5
|
"description": "soonspacejs 2.x",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"three": ">=0.152.2"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "459190746fe7c09573ff54982b8548143ca000d4"
|
|
32
32
|
}
|