soonspacejs 2.6.29 → 2.6.30
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,Quaternion as r,CubeTextureLoader as s,HalfFloatType as o,EquirectangularReflectionMapping as a,TextureLoader as l,Color as c,Texture as u,Vector2 as h,Matrix4 as d,BufferAttribute as f,BufferGeometry as p,Float32BufferAttribute as g,LineBasicMaterial as m,Line as v,Line3 as y,MathUtils as w,CurvePath as b,LineCurve as x,LineCurve3 as A,Bone as S,Uint16BufferAttribute as T,SkinnedMesh as E,Skeleton as D,AnimationClip as C,VectorKeyframeTrack as I,QuaternionKeyframeTrack as B,Object3D as M,InterpolateLinear as P,InterpolateDiscrete as O,Scene as R,Fog as L,Mesh as k,LineSegments as N,EdgesGeometry as U,MeshStandardMaterial as z,PerspectiveCamera as F,OrthographicCamera as j,WebGLRenderer as H,PCFSoftShadowMap as G,Sphere as V,REVISION as Q,Camera as Y,BasicDepthPacking as W,UnsignedByteType as X,MeshNormalMaterial as K,WebGLRenderTarget as Z,NearestFilter as _,DepthTexture as q,DepthStencilFormat as J,UnsignedInt248Type as $,UnsignedIntType as ee,Uniform as te,RepeatWrapping as ne,LoadingManager as ie,LinearFilter as re,ShaderMaterial as se,NoBlending as oe,RGBADepthPacking as ae,EventDispatcher as le,BackSide as ce,DoubleSide as ue,FrontSide as he,MeshDepthMaterial as de,LinearEncoding as fe,sRGBEncoding as pe,Vector4 as ge,Material as me,DataTexture as ve,NoColorSpace as ye,ShaderChunk as we,WebGLCubeRenderTarget as be,CubeCamera as xe,PMREMGenerator as Ae,WebGLMultipleRenderTargets as Se,FramebufferTexture as Te,RGBAFormat as Ee,Matrix3 as De,TangentSpaceNormalMap as Ce,GLSL3 as Ie,VideoTexture as Be,FloatType as Me,GLBufferAttribute as Pe,InterleavedBufferAttribute as Oe,Frustum as Re,MOUSE as Le,TOUCH as ke,Spherical as Ne,MeshBasicMaterial as Ue,PlaneGeometry as ze,Clock as Fe,Raycaster as je,AnimationMixer as He,UVMapping as Ge,ACESFilmicToneMapping as Ve,NoToneMapping as Qe,LinearToneMapping as Ye,ReinhardToneMapping as We,CineonToneMapping as Xe,Sprite as Ke,SpriteMaterial as Ze,SphereGeometry as _e,CircleGeometry as qe,ShapeGeometry as Je,Shape as $e,AmbientLight as et,DirectionalLight as tt,HemisphereLight as nt,SpotLight as it,PointLight as rt,RectAreaLight as st,Loader as ot,LoaderUtils as at,FileLoader as lt,ClampToEdgeWrapping as ct,Group as ut,PropertyBinding as ht,NumberKeyframeTrack as dt,LinearMipMapLinearFilter as ft,ImageLoader as pt,InstancedMesh as gt,GridHelper as mt,AxesHelper as vt,Box3Helper as yt,DirectionalLightHelper as wt,HemisphereLightHelper as bt,SpotLightHelper as xt,PointLightHelper as At,Box2 as St,Plane as Tt,CanvasTexture as Et,MeshPhongMaterial as Dt}from"three";export*from"three";import{RGBELoader as Ct}from"three/examples/jsm/loaders/RGBELoader.js";import{GLTFExporter as It}from"three/examples/jsm/exporters/GLTFExporter.js";import{RoomEnvironment as Bt}from"three/examples/jsm/environments/RoomEnvironment.js";import Mt from"three/examples/jsm/libs/stats.module.js";import{Sky as Pt}from"three/examples/jsm/objects/Sky.js";import{mergeGeometries as Ot,deinterleaveGeometry as Rt}from"three/examples/jsm/utils/BufferGeometryUtils.js";import{FullScreenQuad as Lt}from"three/examples/jsm/postprocessing/Pass.js";import{WorkerPool as kt}from"three/examples/jsm/utils/WorkerPool.js";import{MeshBVH as Nt,computeBoundsTree as Ut,disposeBoundsTree as zt,acceleratedRaycast as Ft}from"three-mesh-bvh";import{RectAreaLightUniformsLib as jt}from"three/examples/jsm/lights/RectAreaLightUniformsLib.js";import{TGALoader as Ht}from"three/examples/jsm/loaders/TGALoader.js";import{GLTFLoader as Gt}from"three/examples/jsm/loaders/GLTFLoader.js";import{DRACOLoader as Vt}from"three/examples/jsm/loaders/DRACOLoader.js";import*as Qt from"three/examples/jsm/libs/fflate.module.js";import{NURBSCurve as Yt}from"three/examples/jsm/curves/NURBSCurve.js";import{RectAreaLightHelper as Wt}from"three/examples/jsm/helpers/RectAreaLightHelper.js";var Xt="soonspacejs",Kt="2.6.29",Zt="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function _t(){throw new Error("setTimeout has not been defined")}function qt(){throw new Error("clearTimeout has not been defined")}var Jt=_t,$t=qt;function en(e){if(Jt===setTimeout)return setTimeout(e,0);if((Jt===_t||!Jt)&&setTimeout)return Jt=setTimeout,setTimeout(e,0);try{return Jt(e,0)}catch(t){try{return Jt.call(null,e,0)}catch(t){return Jt.call(this,e,0)}}}"function"==typeof Zt.setTimeout&&(Jt=setTimeout),"function"==typeof Zt.clearTimeout&&($t=clearTimeout);var tn,nn=[],rn=!1,sn=-1;function on(){rn&&tn&&(rn=!1,tn.length?nn=tn.concat(nn):sn=-1,nn.length&&an())}function an(){if(!rn){var e=en(on);rn=!0;for(var t=nn.length;t;){for(tn=nn,nn=[];++sn<t;)tn&&tn[sn].run();sn=-1,t=nn.length}tn=null,rn=!1,function(e){if($t===clearTimeout)return clearTimeout(e);if(($t===qt||!$t)&&clearTimeout)return $t=clearTimeout,clearTimeout(e);try{$t(e)}catch(t){try{return $t.call(null,e)}catch(t){return $t.call(this,e)}}}(e)}}function ln(e,t){this.fun=e,this.array=t}ln.prototype.run=function(){this.fun.apply(null,this.array)};function cn(){}var un=cn,hn=cn,dn=cn,fn=cn,pn=cn,gn=cn,mn=cn;var vn=Zt.performance||{},yn=vn.now||vn.mozNow||vn.msNow||vn.oNow||vn.webkitNow||function(){return(new Date).getTime()};var wn=new Date;var bn,xn={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];nn.push(new ln(e,t)),1!==nn.length||rn||en(an)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:un,addListener:hn,once:dn,off:fn,removeListener:pn,removeAllListeners:gn,emit:mn,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*yn.call(vn),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-wn)/1e3}},An={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-An.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*An.Bounce.In(2*e):.5*An.Bounce.Out(2*e-1)+.5}}},Sn="undefined"==typeof self&&void 0!==xn&&xn.hrtime?function(){var e=xn.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()},Tn=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=Sn()),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}(),En={Linear:function(e,t){var n=e.length-1,i=n*t,r=Math.floor(i),s=En.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=En.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=En.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=En.Utils.Factorial;return n(e)/n(t)/n(e-t)},Factorial:(bn=[1],function(e){var t=1;if(bn[e])return bn[e];for(var n=e;n>1;n--)t*=n;return bn[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}}},Dn=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Cn=new Tn,In=function(){function e(e,t){void 0===t&&(t=Cn),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=An.Linear.None,this._interpolationFunction=En.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=Dn.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?Sn()+parseFloat(e):e:Sn(),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=Sn()),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=Sn()),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=Sn()),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}(),Bn=Dn.nextId,Mn=Cn,Pn=Mn.getAll.bind(Mn),On=Mn.removeAll.bind(Mn),Rn=Mn.add.bind(Mn),Ln=Mn.remove.bind(Mn),kn=Mn.update.bind(Mn),Nn={Easing:An,Group:Tn,Interpolation:En,now:Sn,Sequence:Dn,nextId:Bn,Tween:In,VERSION:"18.6.4",getAll:Pn,removeAll:On,add:Rn,remove:Ln,update:kn};const Un="[soonspacejs]: ",zn="Group",Fn="Light",jn="Model",Hn="Poi",Gn="PoiNode",Vn="Canvas3D",Qn="Topology",Yn="Helper",Wn="PluginObject",Xn="In soonspacejs: ",Kn=(e,t)=>{let n="";for(const e in t)n+=`${e}: ${t[e]};`;console.log(`%c${e}`,n)},Zn=e=>{console.warn(Xn+e)},_n=e=>{console.error(Xn+e)};function qn(e){return e instanceof t?e:new t(e.x,e.y,e.z)}function Jn(e){return e instanceof n?e:new n(e.x,e.y,e.z)}function $n(e){const n=new i(new t,new t).setFromObject(e);return n.isEmpty()&&(e.getWorldPosition(n.min),n.max.copy(n.min)),n}function ei(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 ti(e,t){const i=ei("x",e,t),r=ei("y",e,t),s=ei("z",e,t);return new n(i.x,r.y,s.z,t.order)}function ni(e){return Math.PI/180*e}function ii(e){return!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?{position:e.getWorldPosition(new t),rotation:(new n).setFromQuaternion(e.getWorldQuaternion(new r)),scale:e.getWorldScale(new t)}:{position:e.position.clone(),rotation:e.rotation.clone(),scale:e.scale.clone()}}function ri(e,t){const n=ii(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 si(e){return!!e.visible&&(!e.parent||si(e.parent))}class oi{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 ai(e){let{path:t="",file:n}=e;if(Array.isArray(n))return(new s).setPath(t).loadAsync(n);{const e=Li(n);if("hdr"===e||"pic"===e){const e=await(new Ct).setPath(t).setDataType(o).loadAsync(n);return e.mapping=a,e}{const e=await(new l).setPath(t).loadAsync(n);return e.mapping=a,e}}}function li(e){if(!e)return null;const{colors:t,stops:n,size:i=1024}=e,r=document.createElement("canvas"),s=r.getContext("2d");if(!s)return null;r.width=16,r.height=i;const o=s.createLinearGradient(0,0,0,i),a=new c,l=t.map((e=>a.set(e).getStyle()));for(let e=0,t=l.length-1;e<=t;e++)o.addColorStop(n?n[e]:e/t,l[e]);s.fillStyle=o,s.fillRect(0,0,16,i);const h=new u(r);return h.needsUpdate=!0,h}const ci=e=>{const t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)};function ui(e){return Ii(e)?function(e){return e.map((e=>ui(e)))}(e):Bi(e)?function(e){if(Bi(e)){const t={};for(const n in e)t[n]=ui(e[n]);return t}return e}(e):e}const hi=(e,t)=>Ii(e)?e.map(t):t(e),di=e=>hi(e,(e=>e.clone())),fi=e=>hi(e,(e=>e.dispose())),pi=async e=>{const t=await fetch(e);if(200===t.status)return t;throw new Error(`Failed to fetch file: ${e}`)},gi=new t,mi=new t,vi=new t;function yi(e,t){const n=gi.setFromMatrixPosition(e.matrixWorld),i=mi.setFromMatrixPosition(t.matrixWorld),r=n.sub(i),s=t.getWorldDirection(vi);return r.angleTo(s)>Math.PI/2}function wi(e,t,n,i){const r=gi.setFromMatrixPosition(e.matrixWorld),s=r.clone();s.project(t),n.setFromCamera(new h(s.x,s.y),t);const o=n.intersectObjects(i,!0);if(o.length){const e=o[0].distance;return r.distanceTo(n.ray.origin)<e}return!0}const bi=e=>{"function"==typeof requestIdleCallback?requestIdleCallback(e):setTimeout(e)};var xi=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 Ai(e){return pi(e).then((e=>e.text())).then((e=>Promise.resolve(function(e){return(new xi).toJson(e,{transformTextOnly:!0,removeComments:!0,removeLineBreaks:!0})}(e))))}class Si{name="EXT_mesh_gpu_instancing";constructor(e){this.writer=e}writeNode(e,n){if(!0!==e.isInstancedMesh)return;const i=e.count,s=new d,o=new Float32Array(3*i),a=new Float32Array(4*i),l=new Float32Array(3*i),c=new t,u=new r,h=new t;for(let t=0;t<i;t++)e.getMatrixAt(t,s),s.decompose(c,u,h),o[3*t]=c.x,o[3*t+1]=c.y,o[3*t+2]=c.z,a[4*t]=u.x,a[4*t+1]=u.y,a[4*t+2]=u.z,a[4*t+3]=u.w,l[3*t]=h.x,l[3*t+1]=h.y,l[3*t+2]=h.z;const p=this.writer,g={};g.attributes={TRANSLATION:p.processAccessor(new f(o,3)),ROTATION:p.processAccessor(new f(a,4)),SCALE:p.processAccessor(new f(l,3))},n.extensions=n.extensions||{},n.extensions[this.name]=g,p.extensionsUsed[this.name]=!0}}const Ti=Object.prototype.hasOwnProperty,Ei=e=>"String"===Pi(e),Di=e=>"Boolean"===Pi(e),Ci=e=>"Number"===Pi(e),Ii=Array.isArray,Bi=e=>"Object"===Pi(e),Mi=e=>"Function"===Pi(e),Pi=e=>Object.prototype.toString.call(e).slice(8,-1),Oi=(e,t,n)=>String.fromCodePoint(...new Uint8Array(e,t,n)),Ri=()=>Un+Math.random().toString(36).substring(7).split("").join("_"),Li=e=>{var t;const{href:n}=new URL(e,location.origin);return null===(t=n.split(".").pop())||void 0===t?void 0:t.toLowerCase()};var ki=Object.freeze({__proto__:null,IVector3ToEuler:Jn,IVector3ToVector3:qn,MinHeap:oi,cloneDeep:ui,cloneMaterials:di,deg2Euler:ni,disposeMaterials:fi,error:_n,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 It;r.register((e=>new Si(e))),r.parse(e,(e=>n(e)),(e=>i(e)),t)}))},fetchFile:pi,getAsciiString:Oi,getBoundingBox:$n,getExtension:Li,getSpaceAttributeFromObject:ii,getTexture:ai,getValueType:Pi,gradientTexture:li,hasOwn:(e,t)=>Ti.call(e,t),idleTask:bi,isArray:Ii,isBoolean:Di,isDate:e=>"Date"===Pi(e),isFunction:Mi,isNull:e=>"Null"===Pi(e),isNumber:Ci,isObject:Bi,isObjectBehindCamera:yi,isObjectOccludeVisible:wi,isObjectVisible:si,isPromise:e=>"Promise"===Pi(e),isString:Ei,isSymbol:e=>"Symbol"===Pi(e),isUndefined:e=>"Undefined"===Pi(e),log:Kn,materialHandle:hi,parseFilePath:ci,randomString:Ri,rotationAFix:ti,rotationAxisFix:ei,sleep:e=>new Promise((t=>setTimeout((()=>t()),e))),syncSpaceAttributeToObject:ri,warn:Zn,xmlToJson:Ai});const Ni={"Linear.None":An.Linear.None,"Quadratic.In":An.Quadratic.In,"Quadratic.Out":An.Quadratic.Out,"Quadratic.InOut":An.Quadratic.InOut,"Cubic.In":An.Cubic.In,"Cubic.Out":An.Cubic.Out,"Cubic.InOut":An.Cubic.InOut,"Quartic.In":An.Quartic.In,"Quartic.Out":An.Quartic.Out,"Quartic.InOut":An.Quartic.InOut,"Quintic.In":An.Quintic.In,"Quintic.Out":An.Quintic.Out,"Quintic.InOut":An.Quintic.InOut,"Sinusoidal.In":An.Sinusoidal.In,"Sinusoidal.Out":An.Sinusoidal.Out,"Sinusoidal.InOut":An.Sinusoidal.InOut,"Exponential.In":An.Exponential.In,"Exponential.Out":An.Exponential.Out,"Exponential.InOut":An.Exponential.InOut,"Circular.In":An.Circular.In,"Circular.Out":An.Circular.Out,"Circular.InOut":An.Circular.InOut,"Elastic.In":An.Elastic.In,"Elastic.Out":An.Elastic.Out,"Elastic.InOut":An.Elastic.InOut,"Back.In":An.Back.In,"Back.Out":An.Back.Out,"Back.InOut":An.Back.InOut,"Bounce.In":An.Bounce.In,"Bounce.Out":An.Bounce.Out,"Bounce.InOut":An.Bounce.InOut};function Ui(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;return new Promise(((o,a)=>{const{duration:l=1e3,delay:c=0,repeat:u=!1,mode:h="Linear.None",yoyo:d=!1}=i,f=Ni[h],p=new In(e).to(t,l).easing(f).delay(c).onUpdate((i=>{e instanceof n&&t instanceof n&&i instanceof n&&(i.order=t.order),null==r||r(i,p)})).onComplete((()=>{o()})).onStop((()=>{a("animation stop")})).onStart((()=>{null==s||s(p)}));Ci(u)?p.repeat(u):Di(u)&&u&&p.repeat(1/0),p.yoyo(d),p.start()}))}class zi{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=qn(o)),o=o.clone();let a=e[s];if(!a)return!0;a.isVector3||(a=qn(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 Ui(o,a,{duration:l},((e,t)=>{var n;if(i.parent){const t=i.parent.worldToLocal(e.clone());i.position.copy(t)}null===(n=this.onUpdate)||void 0===n||n.call(this,e,t)}),(e=>{var t,n;1===s&&(null===(t=this.onStart)||void 0===t||t.call(this,e)),null===(n=this.onEveryStart)||void 0===n||n.call(this,e),this._tween=e})),null===(n=this.onPoint)||void 0===n||n.call(this,s,a),this.index++,await this._play(e)}pause(){var e;null===(e=this._tween)||void 0===e||e.pause()}resume(){var e;null===(e=this._tween)||void 0===e||e.resume()}stop(){var e;null===(e=this._tween)||void 0===e||e.stop(),this._tween=null}}var Fi=Object.defineProperty,ji=(e,t,n)=>(((e,t,n)=>{t in e?Fi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);function Hi(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 Gi(e,t,n){const i=n?t=>e.getPointAt(t):t=>e.getPoint(t);let r=i(0),s=0;const o=[],a=t.length;for(let e=0;e<a;e++){const n=i(t[e]);s+=n.distanceTo(r),o.push(s),r=n}return{lengths:o,length:o[a-1]}}function Vi(e,t){let n=e.sampleLength;if(!n){const t=e.sampleNum;if(t)return t;n=1}return Math.ceil(t/n)}function Qi(e){const{curve:t}=e;let n=t.getLength();const i=Vi(e,n);return t.arcLengthDivisions<i&&(t.arcLengthDivisions=i,t.updateArcLengths(),n=t.getLength()),{length:n,division:i}}function Yi(e,t){const n=Vi(t??{},e.getLength()),i=e.getPoints(n),r=e.getLengths(n);return Wi(i,{...t,lengths:r})}function Wi(e,t){const{startColor:n,endColor:i,color:r,lengths:s}=t??{},o=r?new c(r):null,a=n?new c(n):o??new c(0,1,0),l=i?new c(i):o??new c(0,0,1),u=[],h=[];e[0].toArray(u,0);const d=u.length,f=s??Ki(e).lengths,m=f[f.length-1],v=new c;e.forEach(((e,t)=>{e.toArray(u,t*d);const n=f[t]/m;v.lerpColors(a,l,n),v.toArray(h,3*t)}));const y=new p;return y.setAttribute("position",new g(u,d)),y.setAttribute("color",new g(h,3)),y}function Xi(e,t){t=t??{};let{material:n,linewidth:i}=t;i=i??1,n=n??new m({vertexColors:!0,linewidth:i});const r=Array.isArray(e)?Wi(e,t):Yi(e,t);return new v(r,n)}function Ki(e){const t=Zi(e),n=[0],i=t.reduce(((e,t)=>(e+=t.distance(),n.push(e),e)),0);return{lines:t,lengths:n,length:i}}function Zi(e){const t=[];return e.reduce(((e,n)=>{const i=new y(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 qi(e,t){const{distSortIndexs:n,clampDists:i,clampPoints:r,ts:s,clampTs:o}=Ji(e,t),a=n[0];return{line:t[a],index:a,clampDist:i[a],clampPoint:r[a],t:s[a],clampT:o[a]}}function Ji(e,n){const i={clampDists:[],clampPoints:[],distSortIndexs:[],ts:[],clampTs:[]};return n.forEach(((n,r)=>{const s=n.closestPointToPointParameter(e),o=w.clamp(s,0,1),a=n.at(o,new t),l=e.distanceTo(a);i.clampDists.push(l),i.clampPoints.push(a),i.distSortIndexs.push(r),i.ts.push(s),i.clampTs.push(o)})),i.distSortIndexs.sort(((e,t)=>i.clampDists[e]-i.clampDists[t])),i}function $i(e){const t=new b,n=null==e[0].z?x:A;return e.reduce(((e,i)=>{const r=new n(e,i);return t.add(r),i})),t}var er=(e=>(e.back="back",e.front="front",e))(er||{});function tr(e){const{curve:t,distance:n,fromU:i=0,side:r,tolerance:s=.1*n}=e,o=e.length??t.getLength(),a=t.getPointAt(i);let l=n/o;const c="front"===r?-1:1;let u=!0,h=i,d=a,f=0,p=!0;do{h=c*l+i;let e=!1;h>1?(h=1,e=!0):h<0&&(h=0,e=!0),d=t.getPointAt(h),f=d.distanceTo(a),u=Math.abs(n-f)>s;const r=n/f;if(e&&u&&r>1){p=!1;break}l*=r}while(u);return{succeed:p,u:h,point:d,distance:f}}function nr(e){const{curve:t,distance:n,fromU:i=0,tolerance:r=.1*n,origin:s}=e,o=e.length??t.getLength(),a=t.getPointAt(i),l=a.distanceTo(s),c=n-l;let u=c/o,h=!0,d=i,f=a;do{d=u+i;let e=!1;d>1?(d=1,e=!0):d<0&&(d=0,e=!0),f=t.getPointAt(d);const o=f.distanceTo(s);h=Math.abs(n-o)>r;const a=c/(o-l);if(e&&h&&a>1)return null;u*=a}while(h);return{u:d,point:f}}const ir=new t,rr=new t(1,1,1);new r;const sr=new d;function or(e){const{joints:t,axials:n}=e;if(t)var i=lr(t);else i=n?ar(e):cr(e);return i}function ar(e){const{axials:t,start:n}=e,i=new S;n&&(i.position.copy(n),i.updateMatrix());const r=[i];return t.reduce(((e,t)=>{const n=new S;return n.position.copy(t),e.add(n),r.push(n),n.updateMatrix(),n}),i),i.updateWorldMatrix(!0,!0),r}function lr(e){const t=[];return e.reduce(((e,n)=>{const i=n.clone().sub(e);return t.push(i),n})),ar({axials:t,start:e[0]})}function cr(e){const{start:t,axial:n}=e;let i=e.number;const r=new Array(i-1);return r.fill(n),ar({axials:r,start:t})}function ur(e){const{geometry:n,flexible:i=1,axial:s,number:o}=e,a=e.start??new t,l=s.clone().normalize(),c=s.length(),u=o-1,h=(new r).setFromUnitVectors(new t(1,0,0),l),f=(new d).compose(a,h,new t(1,1,1)).invert(),p=n.getAttribute("position").clone(),m=p.count;p.applyMatrix4(f);const v=[],y=[];for(let e=0;e<m;e++){const t=p.getX(e);if(t<0){v.push(0,0,0,0),y.push(1,0,0,0);continue}const n=Math.trunc(t/c);if(n<u){const e=t%c/c*i;v.push(n,n+1,0,0),y.push(1-e,e,0,0)}else v.push(u,0,0,0),y.push(1,0,0,0)}return n.setAttribute("skinIndex",new T(v,4)),n.setAttribute("skinWeight",new g(y,4)),n}function hr(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),ur({...e,start:o,axial:a,number:n.bones.length})}function dr(e){const{skeleton:n,geometry:i,flexible:r=1,geometryFrame:s}=e,o=(null==s?void 0:s.clone().invert())??sr.clone(),a=n.boneInverses.map((e=>{const n=e.clone().invert().premultiply(o);return(new t).setFromMatrixPosition(n)})),l=Zi(a),c=i.getAttribute("position"),u=c.count,h=[],d=[],f=new t;for(let e=0;e<u;e++){f.fromBufferAttribute(c,e);const{index:t,clampT:n}=qi(f,l),i=n*r;h.push(t,t+1,0,0),d.push(1-i,i,0,0)}return i.setAttribute("skinIndex",new T(h,4)),i.setAttribute("skinWeight",new g(d,4)),i}function fr(e){const{geometry:t}=e,n=e.material??void 0,i=new E(t,n),r=or(e);i.add(r[0]);const s=new D(r);return i.bind(s),dr({...e,skeleton:s}),i}function pr(e){const{skeleton:t}=e,n=gr(e);return n.updateMatrix(),n.updateMatrixWorld(),n.bind(t),n}function gr(e){const{target:t,skeleton:n}=e,i=t.geometry,r=new E;return t.copy.call(r,t,!1),dr({...e,geometry:i,skeleton:n,geometryFrame:t.matrixWorld}),r}function mr(e){const{target:t}=e;let{skeleton:n}=e;if(n)var i=n.bones[0];else{const t=or(e);n=new D(t),i=t[0]}t.add(i),t.updateWorldMatrix(!1,!0),n.calculateInverses(),i.removeFromParent();const r=vr({...e,target:t,skeleton:n});return r.add(i),{model:r,skeleton:n,rootBone:i}}function vr(e){const{target:t,skeleton:n,parent:i}=e,r=t.isMesh,s=r?gr({...e,skeleton:n}):t.clone(!1);i&&i.add(s),s.updateMatrixWorld(!0),r&&s.bind(n,t.matrixWorld);const o=t.children;for(const t of o)vr({...e,target:t,parent:s});return s}function yr(e){return e.filter((e=>{var t;return!(null!=(t=e.parent)&&t.isBone)}))}function wr(e){return e.find((e=>{var t;return!(null!=(t=e.parent)&&t.isBone)}))}function br(e){return wr(e)??e[0]}function xr(e){return e.curve?Ar(e):Ir(e)}function Ar(e){const{keyframeTracks:t,duration:n}=Sr(e);return new C(e.name,n,t)}function Sr(e){const{curve:t,lookDistance:n}=e,i=e.targetPath??"",r=Qi(e).division,s=Tr(e,t.getLength()),o=P,a=[],l=Dr(r),c={...e,duration:s,division:r,ts:l,lookPoint:{distance:n}},u=Cr(c),{points:h,rotates:d}=Er(c);if(h.length){const e=[];h.forEach(((t,n)=>{t.toArray(e,3*n)}));const t=new I(`${i}.position`,u,e,o);a.push(t)}if(d.length){const e=[];d.forEach(((t,n)=>{t.toArray(e,4*n)}));const t=new B(`${i}.quaternion`,u,e,o);a.push(t)}return{keyframeTracks:a,duration:s}}function Tr(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 Er(e){var n,i;const{curve:s,target:o,lookPoint:a,enableUp:l,fixUp:c}=e,u=e.position??!0,h=e.rotate??!0,f=[],p=[],g=[],m={rotates:f,points:p};if(!u&&!h)return m;const v=(e.anchor??ir).clone(),y=e.ts??e.us,w=!e.ts;if(!y)throw"缺少参数:至少传递 ts 和 us 任意之一";let b=sr.clone(),x=sr.clone(),A=rr.clone(),S=M.DEFAULT_UP;o&&(o.updateWorldMatrix(!0,!1),b=o.matrix,x=o.matrixWorld,A=o.scale,S=o.up);const T=b.clone().invert(),E=x.clone().multiply(T).clone().invert(),D=s.getTangent(0);D.transformDirection(E);const C=(null==(n=e.front)?void 0:n.clone().normalize())??D,I=(null==(i=e.up)?void 0:i.clone().normalize())??S.clone().transformDirection(E);let B=b.clone().setPosition(0,0,0),P=e=>s.getPoint(e),O=e=>s.getTangent(e);w&&(P=e=>s.getPointAt(e),O=e=>s.getTangentAt(e));const R=y.length,L=R-1;let{distance:k,curveLength:N,lengths:U}=a??{};k=k??0;let z=O;0!==k&&(U||(U=Gi(s,y,w).lengths),null==N&&(N=U[L]),z=(e,t)=>{const n=P(e);let i=(U[t]+k)/N;return i>1&&(i=1),s.getPointAt(i).sub(n).normalize()});let F=e=>{const t=y[e],n=z(t,e);n.transformDirection(E),g.push(n);const i=e-1,s=i<0,o=s?C:g[i],a=(new r).setFromUnitVectors(o,n);if(!s){const e=f[i];a.multiply(e)}return a.normalize()};if(l){const e=new t(0,1,0);F=c?function(t){const n=y[t],i=z(n,t);i.transformDirection(E),g.push(i);const s=t-1;let o;if(s<0)o=(new r).setFromUnitVectors(C,i);else{const e=f[s],t=C.clone().applyQuaternion(e).normalize();o=(new r).setFromUnitVectors(t,i),o.multiply(e)}const a=I.clone().applyQuaternion(o).normalize(),l=(new r).setFromUnitVectors(a,e);return o.premultiply(l),o.normalize()}:function(t){const n=y[t],i=z(n,t);i.transformDirection(E),g.push(i);const s=t-1,o=s<0,a=o?C:g[s],l=(new r).setFromUnitVectors(a,i);if(o){const t=I.clone().applyQuaternion(l);t.projectOnPlane(i).normalize();const n=e.clone().projectOnPlane(i).normalize(),s=(new r).setFromUnitVectors(t,n);l.premultiply(s)}else{const e=f[s];l.multiply(e)}return l.normalize()}}for(let e=0;e<R;e++){const t=y[e];if(h){const t=F(e);f.push(t),B=(new d).compose(ir,t,A)}if(u){const e=P(t);e.applyMatrix4(E);const n=v.clone().applyMatrix4(B);e.sub(n),p.push(e)}}return m}function Dr(e){const t=[];for(let n=0;n<=e;n++)t.push(n/e);return t}function Cr(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 Ir(e){const{smooth:t,points:n}=e;if(!1===t)var{keyframeTracks:i,duration:r}=Br(e);else{const t=$i(n);var{keyframeTracks:i,duration:r}=Sr({...e,curve:t})}return new C(e.name,r,i)}function Br(e){const t=e.targetPath??"",n=e.points,{lines:i,length:r,lengths:s}=Ki(n),o=Tr(e,r),a=[],l=s.map((e=>e/r*o)),{points:c,pointTimes:u,rotates:h,rotateTimes:d}=Mr({...e,times:l},i);if(c.length){const e=[];c.forEach(((t,n)=>{t.toArray(e,3*n)}));const n=new I(`${t}.position`,u,e,P);a.push(n)}if(h.length){const e=[];h.forEach(((t,n)=>{t.toArray(e,4*n)}));const n=new B(`${t}.quaternion`,d,e,O);a.push(n)}return{keyframeTracks:a,duration:o}}function Mr(e,n){var i,s;const{points:o,target:a,times:l,enableUp:c,fixUp:u}=e,h=e.position??!0,f=e.rotate??!0,p=o.length,g=p-1;n=n??Zi(o);const m=[],v=[],y=[],w=[],b={rotates:m,points:v,rotateTimes:l,pointTimes:y};if(!h&&!f)return b;const x=(e.anchor??ir).clone();let A=sr.clone(),S=sr.clone(),T=rr.clone(),E=M.DEFAULT_UP;a&&(a.updateWorldMatrix(!0,!1),A=a.matrix,S=a.matrixWorld,T=a.scale,E=a.up);const D=A.clone().invert(),C=S.clone().multiply(D).clone().invert(),I=n[0].delta(new t);I.transformDirection(C);const B=(null==(i=e.front)?void 0:i.clone().normalize())??I,P=(null==(s=e.up)?void 0:s.clone().normalize())??E.clone().transformDirection(C);let O=A.clone().setPosition(0,0,0),R=O,L=e=>{const i=n[e].delta(new t).normalize();i.transformDirection(C),w.push(i);const s=e-1,o=s<0,a=o?B:w[s],l=(new r).setFromUnitVectors(a,i);if(!o){const e=m[s];l.multiply(e)}return l.normalize()};if(c){const e=new t(0,1,0);L=u?function(i){const s=n[i].delta(new t).normalize();s.transformDirection(C),w.push(s);const o=i-1;let a;if(o<0)a=(new r).setFromUnitVectors(B,s);else{const e=m[o],t=B.clone().applyQuaternion(e).normalize();a=(new r).setFromUnitVectors(t,s),a.multiply(e)}const l=P.clone().applyQuaternion(a).normalize(),c=(new r).setFromUnitVectors(l,e);return a.premultiply(c),a.normalize()}:function(i){const s=n[i].delta(new t).normalize();s.transformDirection(C),w.push(s);const o=i-1,a=o<0,l=a?B:w[o],c=(new r).setFromUnitVectors(l,s);if(a){const t=P.clone().applyQuaternion(c);t.projectOnPlane(s).normalize();const n=e.clone().projectOnPlane(s).normalize(),i=(new r).setFromUnitVectors(t,n);c.premultiply(i)}else{const e=m[o];c.multiply(e)}return c.normalize()}}for(let e=0;e<p;e++){if(f)if(e<g){const t=L(e);m.push(t),O=(new d).compose(ir,t,T)}else m.push(m[e-1].clone());if(h){const t=l[e],n=o[e].clone();if(n.applyMatrix4(C),e>0){const e=x.clone().applyMatrix4(R),i=n.clone().sub(e);v.push(i),y.push(t)}const i=x.clone().applyMatrix4(O);n.sub(i),v.push(n),y.push(t)}R=O}return b}function Pr(e){const t=e.mixer,n=mr(e),{model:i,skeleton:r}=n,s=Or({...e,target:i,skeleton:r});i.animations.push(s);const o=null==t?void 0:t.clipAction(s,i);return{...n,clip:s,action:o}}function Or(e){const{boneTracks:t,duration:n}=Rr(e),i=t.flat();return new C(e.name,n,i)}function Rr(e){const{skeleton:t,targetPath:n}=e,i=t.bones,{times:r,boneSampleDatas:s,duration:o}=Lr(e),a=r.length,l=P;return{boneTracks:s.map(((e,t)=>{const{points:s,rotates:o}=e,c=i[t],u=n?`${n}.skeleton.bones[${t}]`:`${c.name||c.uuid}`,h=[],d=[];for(let e=0;e<a;e++)s&&s[e].toArray(h,3*e),o[e].toArray(d,4*e);const f=[];if(s){const e=new I(`${u}.position`,r,h,l);f.push(e)}const p=new B(`${u}.quaternion`,r,d,l);return f.push(p),f})),duration:o}}function Lr(e){var n;const{curve:i,skeleton:s,stretch:o}=e,{bones:a,boneInverses:l}=s,c=a[0],u=e.target??c.parent;if(!u)throw"target 或 根骨骼的 parent 不存在";const h=e.tolerance??.1;c.updateWorldMatrix(!0,!0);const{division:f,length:p}=Qi(e),{matrixWorld:g}=u,m=g.clone().invert(),v=[],y=[];l.reduce(((e,t)=>{const n=t.clone().invert();v.push(n);const i=e.clone().multiply(n);return y.push(i),t}),m);const w=y[0],b=new t,x=new r,A=new t;w.decompose(b,x,A);const S=Tr(e,p),T=Dr(f),E=Cr({curve:i,division:f,duration:S}),D=T.length,C=[],I=(new t).setFromMatrixPosition(y[1]).negate(),B=l[0],M=null==(n=e.up)?void 0:n.clone().applyMatrix4(g).transformDirection(B),{points:P,rotates:O}=Er({...e,curve:i,ts:T,target:c,rotate:!0,front:I,up:M,anchor:null});for(let e=0;e<D;e++)C.push(g.clone());const R=P.map(((e,t)=>{const n=O[t];n.premultiply(x).normalize();const i=(new d).compose(e,n,A);return i.premultiply(g),i})),L=i.getLengths(f).map((e=>e/p)),k=[{points:P,rotates:O,us:L,matrixs:R}],N=o?function(e,t,n){const r=k[e].us[t]-n/p;return{u:r,point:r<0?null:i.getPointAt(r)}}:function(e,t,n){const r=k[e].us[t],{u:s,point:o,succeed:a}=tr({curve:i,distance:n,fromU:r,length:p,side:er.front,tolerance:h*n});return{u:s,point:a?o:null}},U=l.length,z=U-1;for(let e=1;e<U;e++){const n=[],s=[],o=[],a=[];k.push({points:n,rotates:s,us:o,matrixs:a});const l=y[e],c=v[e],u=e-1,h=k[u],f=y[u],p=v[u],{matrixs:g,points:m,rotates:w}=h,b=(new t).setFromMatrixScale(f),x=u-1,A=x<0?C:k[x].matrixs,S=new t,T=new r,E=new t;l.decompose(S,T,E);const I=(new t).setFromMatrixPosition(c).sub((new t).setFromMatrixPosition(p)).length(),B=S.length();for(let t=0;t<D;t++){const{point:c,u:h}=N(u,t,I);o.push(h),s.push(T.clone());const f=g[t];if(h<0||!c){n.push(S);const e=f.clone().multiply(l);a.push(e);continue}const p=A[t];let v=p.clone().invert();const y=c.clone().applyMatrix4(v),x=m[t];y.sub(x).normalize();const D=w[t],C=(new d).compose(x,D,b),M=S.clone().transformDirection(C),P=(new r).setFromUnitVectors(M,y);D.premultiply(P).normalize(),f.compose(x,D,b),f.premultiply(p);const O=f.clone().invert();c.applyMatrix4(O);const R=c.length();c.copy(S).multiplyScalar(R/B),n.push(c);const L=(new d).compose(c,T,E);if(e===z){const e=i.getTangentAt(h);e.negate().transformDirection(O);const n=(new r).setFromUnitVectors(c.clone().normalize(),e);n.premultiply(T).normalize(),s[t]=n,L.compose(c,n,E)}L.premultiply(f),a.push(L)}}return{times:E,boneSampleDatas:k,duration:S}}function kr(e){const{boneTracks:t,targetTracks:n,duration:i}=Nr(e),r=n.concat(t.flat());return new C(e.name,i,r)}function Nr(e){const{skeleton:t,targetPath:n}=e,{times:i,boneSampleDatas:r,duration:s,targetSampleDatas:o}=Ur(e),a=i.length,l=t.bones,c=P,u=[],h=[],{points:d,rotates:f}=o;for(let e=0;e<a;e++)d[e].toArray(u,3*e),f[e].toArray(h,4*e);const p=n??"",g=[new I(`${p}.position`,i,u,c),new B(`${p}.quaternion`,i,h,c)];return{boneTracks:r.map(((e,t)=>{const{points:r,rotates:s}=e,o=l[t],u=n?`${n}.skeleton.bones[${t}]`:`${o.name||o.uuid}`,h=[],d=[];for(let e=0;e<a;e++)r&&r[e].toArray(h,3*e),s[e].toArray(d,4*e);const f=[];if(r){const e=new I(`${u}.position`,i,h,c);f.push(e)}const p=new B(`${u}.quaternion`,i,d,c);return f.push(p),f})),targetTracks:g,duration:s}}function Ur(e){const{curve:n,skeleton:i,stretch:s}=e,{bones:o,boneInverses:a}=i,l=o[0],c=e.target??l.parent;if(!c)throw"target 或 根骨骼的 parent 不存在";const u=e.tolerance??.1;l.updateWorldMatrix(!0,!0);const{division:h,length:f}=Qi(e),{matrix:p,matrixWorld:g,scale:m}=c,v=g.clone().multiply(p.clone().invert()),y=g.clone().invert(),w=[],b=[];a.reduce(((e,t)=>{const n=t.clone().invert();w.push(n);const i=e.clone().multiply(n);return b.push(i),t}),y);const x=b[0],A=new t,S=new r,T=new t;x.decompose(A,S,T);const E=Tr(e,f),D=Dr(h),C=w[0],I=(new t).setFromMatrixPosition(b[1]).negate().transformDirection(C).transformDirection(y),{rotates:B,points:M}=Er({...e,curve:n,target:c,position:!0,rotate:!0,anchor:A,front:I,ts:D}),P=Cr({curve:n,division:h,duration:E}),O=M.map(((e,t)=>{const n=B[t],i=(new d).compose(e,n,m);return i.premultiply(v),i})),R={points:M,rotates:B,matrixs:O},L=[],k=O.map((e=>(L.push(S.clone()),e.clone().multiply(x)))),N=D.length,U=n.getLengths(h).map((e=>e/f)),z=[{rotates:L,us:U,matrixs:k}],F=s?function(e,t,i){const r=z[e].us[t]-i/f;return{u:r,point:r<0?null:n.getPointAt(r)}}:function(e,t,i){const r=z[e].us[t],{u:s,point:o,succeed:a}=tr({curve:n,distance:i,fromU:r,length:f,side:er.front,tolerance:u*i});return{u:s,point:a?o:null}},j=a.length,H=j-1;for(let e=1;e<j;e++){const i=[],s=[],o=[],a=[];z.push({points:i,rotates:s,us:o,matrixs:a});const l=b[e],c=w[e],u=e-1,h=z[u],f=b[u],p=w[u],{matrixs:g,points:m,rotates:v}=h,y=new t,x=new r,A=new t;f.decompose(y,x,A);const S=u-1,T=S<0?O:z[S].matrixs,E=new t,D=new r,C=new t;l.decompose(E,D,C);const I=(new t).setFromMatrixPosition(c).sub((new t).setFromMatrixPosition(p)).length(),B=E.length();for(let t=0;t<N;t++){const{point:c,u:h}=F(u,t,I);o.push(h),s.push(D.clone());const f=g[t];if(h<0||!c){i.push(E);const e=f.clone().multiply(l);a.push(e);continue}const p=T[t];let w=p.clone().invert();const b=c.clone().applyMatrix4(w),S=(null==m?void 0:m[t])??y;b.sub(S).normalize();const M=v[t],P=(new d).compose(S,M,A),O=E.clone().transformDirection(P);M.setFromUnitVectors(O,b),M.premultiply(x).normalize(),f.compose(S,M,A),f.premultiply(p);const R=f.clone().invert();c.applyMatrix4(R);const L=c.length();c.copy(E).multiplyScalar(L/B),i.push(c);const k=(new d).compose(c,D,C);if(e===H){const e=n.getTangentAt(h);e.negate().transformDirection(R);const i=(new r).setFromUnitVectors(c.clone().normalize(),e);i.premultiply(D).normalize(),s[t]=i,k.compose(c,i,C)}k.premultiply(f),a.push(k)}}return{times:P,boneSampleDatas:z,targetSampleDatas:R,duration:E}}function zr(e){const{duration:t,tracks:n}=e;return n.map((e=>Array.from(e.times.map((e=>e/t)))))}class Fr{constructor(e){ji(this,"_tracksTimeRatios",null),ji(this,"_lastGetTime",0),ji(this,"_lastGetKeyframeIndexs",null),this.clip=e}get tracksTimeRatios(){return this._tracksTimeRatios??(this._tracksTimeRatios=zr(this.clip))}getTracksKeyframeIndexs(e){const{clip:t,_lastGetTime:n}=this,i=e/t.duration,r=this.tracksTimeRatios;this._lastGetTime=e,e<n&&(this._lastGetKeyframeIndexs=null),this._lastGetTime=e;const s=this._lastGetKeyframeIndexs;return this._lastGetKeyframeIndexs=r.map(((e,t)=>{const n=(null==s?void 0:s[t])??0,r=e.length;for(let t=n;t<r;t++)if(i<e[t])return t-1;return r-1}))}getTracksKeyframes(e){const t=this.getTracksKeyframeIndexs(e),n=this.clip.tracks;return t.map(((e,t)=>{let i=null;if(-1!==e){const r=n[t],s=r.getValueSize(),o=e*s,a=o+s;i=Array.from(r.values.slice(o,a))}return{index:e,value:i}}))}}class jr extends Fr{constructor(e){super(e.getClip()),ji(this,"_trackNames"),ji(this,"_positionTrackName"),ji(this,"_quaternionTrackName"),ji(this,"_rotationTrackName"),ji(this,"_scaleTrackName"),this.action=e}get time(){return this.action.time}get duration(){return this.clip.duration}get progress(){return this.time/this.duration}set progress(e){this.action.time=e*this.duration}get trackNames(){return this._trackNames??(this._trackNames=this.clip.tracks.map((e=>e.name)))}get keyframeIndexs(){const e=this.getTracksKeyframeIndexs(this.time);return this.trackNames.reduce(((t,n,i)=>(t[n]=e[i],t)),{})}get keyframes(){const e=this.getTracksKeyframes(this.time);return this.trackNames.reduce(((t,n,i)=>(t[n]=e[i],t)),{})}get positionTrackName(){return void 0===this._positionTrackName&&(this._positionTrackName=this.trackNames.find((e=>e.endsWith(".position")))??null),this._positionTrackName}get positionkeyframeIndex(){const e=this.positionTrackName;return e?this.keyframeIndexs[e]:null}get positionKeyframe(){const e=this.positionTrackName;if(e){const{index:n,value:i}=this.keyframes[e];return{index:n,value:i?new t(...i):null}}return null}get quaternionTrackName(){return void 0===this._quaternionTrackName&&(this._quaternionTrackName=this.trackNames.find((e=>e.endsWith(".quaternion")))??null),this._quaternionTrackName}get quaternionKeyframeIndex(){const e=this.quaternionTrackName;return e?this.keyframeIndexs[e]:null}get quaternionKeyframe(){const e=this.quaternionTrackName;if(e){const{index:t,value:n}=this.keyframes[e];return{index:t,value:n?new r(...n):null}}return null}get rotationTrackName(){return void 0===this._rotationTrackName&&(this._rotationTrackName=this.trackNames.find((e=>e.endsWith(".rotation")))??null),this._rotationTrackName}get rotationkeyframeIndex(){const e=this.rotationTrackName;return e?this.keyframeIndexs[e]:null}get rotationKeyframe(){const e=this.rotationTrackName;if(e){const{index:t,value:i}=this.keyframes[e];return{index:t,value:i?new n(...i):null}}return null}get scaleTrackName(){return void 0===this._scaleTrackName&&(this._scaleTrackName=this.trackNames.find((e=>e.endsWith(".scale")))??null),this._scaleTrackName}get scaleKeyframeIndex(){const e=this.scaleTrackName;return e?this.keyframeIndexs[e]:null}get scaleKeyframe(){const e=this.scaleTrackName;if(e){const{index:n,value:i}=this.keyframes[e];return{index:n,value:i?new t(...i):null}}return null}}class Hr extends jr{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 Gr(e){const t=new Hr(e);return new Proxy(t,{get:function(e,t,n){return t in e.action?e.action[t]:e[t]},set:function(e,t,n,i){return t in e.action?e.action[t]=n:e[t]=n,!0},deleteProperty:function(e,t){return t in e.action?Reflect.deleteProperty(e.action,t):Reflect.deleteProperty(e,t)},has:function(e,t){return t in e.action||t in e},ownKeys:function(e){return Reflect.ownKeys(e.action).concat(Reflect.ownKeys(e))}})}class Vr{constructor(e){ji(this,"_action"),this.setAction(e)}get action(){return this._action}set action(e){this.setAction(e)}setAction(e){this._action=e&&Gr(e)}get play(){const e=this.action;return Boolean(e&&e._mixer._isActiveAction(e)&&!e.paused)}set play(e){const t=this.action;t&&(t.paused=!e,e&&0===t.time&&t.play())}stop(){var e;null==(e=this.action)||e.stop()}}function Qr(e){var t;null==(t=e.reset)||t.call(e,!0)}class Yr extends Vr{constructor(e,t=[]){super(e),ji(this,"_updateGUI",null),this.guis=t}get updateGUI(){return this._updateGUI??this.constructor.updateGUI??Qr}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 Wr(e){const t=new Yr(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 Xr(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 Kr(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=Xr(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}ji(Yr,"updateGUI",Qr);var Zr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function _r(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 qr={},Jr={},$r=function(e,t){return $r=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])},$r(e,t)};var es=function(){return es=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},es.apply(this,arguments)};function ts(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}var ns=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 is(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 rs(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 ss(e){return this instanceof ss?(this.v=e,this):new ss(e)}var os=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function as(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 ls(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}var cs=Object.freeze({__proto__:null,get __assign(){return es},__asyncDelegator:function(e){var t,n;return t={},i("next"),i("throw",(function(e){throw e})),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,r){t[i]=e[i]?function(t){return(n=!n)?{value:ss(e[i](t)),done:!1}:r?r(t):t}:r}},__asyncGenerator:function(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=n.apply(e,t||[]),s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(e){r[e]&&(i[e]=function(t){return new Promise((function(n,i){s.push([e,t,n,i])>1||a(e,t)}))})}function a(e,t){try{(n=r[e](t)).value instanceof ss?Promise.resolve(n.value.v).then(l,c):u(s[0][2],n)}catch(e){u(s[0][3],e)}var n}function l(e){a("next",e)}function c(e){a("throw",e)}function u(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}},__asyncValues:function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=is(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(n){t[n]=e[n]&&function(t){return new Promise((function(i,r){(function(e,t,n,i){Promise.resolve(i).then((function(t){e({value:t,done:n})}),t)})(i,r,(t=e[n](t)).done,t.value)}))}}},__await:ss,__awaiter:function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))},__classPrivateFieldGet:as,__classPrivateFieldIn:function(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)},__classPrivateFieldSet:ls,__createBinding:ns,__decorate:function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},__esDecorate:function(e,t,n,i,r,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,l=i.kind,c="getter"===l?"get":"setter"===l?"set":"value",u=!t&&e?i.static?e:e.prototype:null,h=t||(u?Object.getOwnPropertyDescriptor(u,i.name):{}),d=!1,f=n.length-1;f>=0;f--){var p={};for(var g in i)p[g]="access"===g?{}:i[g];for(var g in i.access)p.access[g]=i.access[g];p.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var m=(0,n[f])("accessor"===l?{get:h.get,set:h.set}:h[c],p);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(a=o(m.get))&&(h.get=a),(a=o(m.set))&&(h.set=a),(a=o(m.init))&&r.push(a)}else(a=o(m))&&("field"===l?r.push(a):h[c]=a)}u&&Object.defineProperty(u,i.name,h),d=!0},__exportStar:function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||ns(t,e,n)},__extends:function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}$r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},__generator:function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},__importDefault:function(e){return e&&e.__esModule?e:{default:e}},__importStar:function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&ns(t,e,n);return os(t,e),t},__makeTemplateObject:function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},__metadata:function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},__param:function(e,t){return function(n,i){t(n,i,e)}},__propKey:function(e){return"symbol"==typeof e?e:"".concat(e)},__read:rs,__rest:ts,__runInitializers:function(e,t,n){for(var i=arguments.length>2,r=0;r<t.length;r++)n=i?t[r].call(e,n):t[r].call(e);return i?n:void 0},__setFunctionName:function(e,t,n){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})},__spread:function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(rs(arguments[t]));return e},__spreadArray:function(e,t,n){if(n||2===arguments.length)for(var i,r=0,s=t.length;r<s;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))},__spreadArrays:function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var i=Array(e),r=0;for(t=0;t<n;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,r++)i[r]=s[o];return i},__values:is}),us=_r(cs),hs={},ds={},fs={},ps={};Object.defineProperty(ps,"__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}();ps.SlotList=gs;var ms={};Object.defineProperty(ms,"__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}();ms.Slot=vs,Object.defineProperty(fs,"__esModule",{value:!0});var ys=ps,ws=ms,bs=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.slots=ys.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=ys.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 ws.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}();fs.OnceSignal=bs,Object.defineProperty(ds,"__esModule",{value:!0});var xs=us,As=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return xs.__extends(t,e),t.prototype.add=function(e){return this.registerListener(e)},t}(fs.OnceSignal);ds.Signal=As,Object.defineProperty(hs,"__esModule",{value:!0});var Ss=us,Ts=ms,Es=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ss.__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 Ts.Slot(e,this,t,n);return this.slots=this.slots.insertWithPriority(i),i}return this.slots.find(e)},t}(ds.Signal);hs.PrioritySignal=Es,Object.defineProperty(Jr,"__esModule",{value:!0});var Ds=us,Cs=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 Ds.__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}(hs.PrioritySignal);Jr.DeluxeSignal=Cs;var Is={};Object.defineProperty(Is,"__esModule",{value:!0});var Bs=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}();Is.GenericEvent=Bs;var Ms={};Object.defineProperty(Ms,"__esModule",{value:!0}),Ms.IOnceSignal=Symbol("IOnceSignal");var Ps={};Object.defineProperty(Ps,"__esModule",{value:!0}),Ps.IPrioritySignal=Symbol("IPrioritySignal");var Os={};Object.defineProperty(Os,"__esModule",{value:!0}),Os.ISignal=Symbol("ISignal");var Rs={};Object.defineProperty(Rs,"__esModule",{value:!0}),Rs.ISlot=Symbol("ISlot");var Ls={};Object.defineProperty(Ls,"__esModule",{value:!0});var ks=ms,Ns=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 ks.Slot(e,this,t)},e}();Ls.MonoSignal=Ns;var Us={};Object.defineProperty(Us,"__esModule",{value:!0});var zs=us,Fs=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return zs.__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}(fs.OnceSignal);Us.Promise=Fs,Object.defineProperty(qr,"__esModule",{value:!0});var js=Jr;qr.DeluxeSignal=js.DeluxeSignal;var Hs=Is;qr.GenericEvent=Hs.GenericEvent;var Gs=Ms;qr.IOnceSignal=Gs.IOnceSignal;var Vs=Ps;qr.IPrioritySignal=Vs.IPrioritySignal;var Qs=Os;qr.ISignal=Qs.ISignal;var Ys=Rs;qr.ISlot=Ys.ISlot;var Ws=Ls;qr.MonoSignal=Ws.MonoSignal;var Xs=fs;qr.OnceSignal=Xs.OnceSignal;var Ks=hs;qr.PrioritySignal=Ks.PrioritySignal;var Zs=Us;qr.Promise=Zs.Promise;var _s=ds,qs=qr.Signal=_s.Signal,Js=ms;qr.Slot=Js.Slot;var $s=ps;qr.SlotList=$s.SlotList;function eo(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 to={};({get exports(){return to},set exports(e){to=e}}).exports=function e(t,n,i){function r(o,a){if(!n[o]){if(!t[o]){if(!a&&eo)return eo(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=eo,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!==Zr?Zr:"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&&f(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 f(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=p(o);"error"===a.status&&i(a.value)}function p(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}function g(e){return e instanceof this?e:s.resolve(new this(r),e)}function m(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=p(d,t);if("error"===n.status)return s.reject(e,n.value);var i=n.value;if(i)f(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=g,c.reject=m,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!==Zr?Zr:"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 f(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var p="local-forage-detect-blob-support",g=void 0,m={},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(p,w),i=l([""]);n.objectStore(p).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 g?c.resolve(g):x(e).then((function(e){return g=e}))}function S(e){var t=m[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 T(e){var t=m[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function E(e,t){var n=m[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function D(e,t){return new c((function(n,i){if(m[e.name]=m[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(p)}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),T(e)}}))}function C(e){return D(e,!1)}function I(e){return D(e,!0)}function B(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 M(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=m[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return h(n,e,e),n}function L(e){S(e);for(var t=m[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,B(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 E(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 U(e){var t=this,n={db:null};if(e)for(var i in e)n[i]=e[i];var r=m[n.name];r||(r=N(),m[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,B(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 F(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:M(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 H(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 G(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 Y(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 W(e,t){t=f.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=m[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=m[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,T(n._dbInfo)}})).catch((function(t){throw(E(e,t)||c.resolve()).catch((function(){})),t}))}})):s.then((function(t){S(e);var n=m[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++)T(i[t]._dbInfo)})).catch((function(t){throw(E(e,t)||c.resolve()).catch((function(){})),t}))}))}else i=c.reject("Invalid arguments");return u(i,t),i}var X={_driver:"asyncStorage",_initStorage:U,_support:a(),iterate:F,getItem:z,setItem:j,removeItem:H,clear:G,length:V,key:Q,keys:Y,dropInstance:W};function K(){return"function"==typeof openDatabase}var Z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_="~~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 fe(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 pe(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 ge(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+pe(i))}else if("[object Blob]"===n){var s=new FileReader;s.onload=function(){var n=_+e.type+"~"+pe(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 me(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=fe(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:ge,deserialize:me,stringToBuffer:fe,bufferToString:pe};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 Te(e,t,n){return Se.apply(this,[e,t,n,1])}function Ee(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 Be(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 Me(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=f.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(Me(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:K(),iterate:Ae,getItem:xe,setItem:Te,removeItem:Ee,clear:De,length:Ce,key:Ie,keys:Be,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 Ue(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 Fe(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 He(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 Ge(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 Ye(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 We(e,t){if(t=f.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 Xe={_driver:"localStorageWrapper",_initStorage:Ue,_support:Re(),iterate:je,getItem:Fe,setItem:Ye,removeItem:Qe,clear:ze,length:Ve,key:He,keys:Ge,dropInstance:We},Ke=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(Ke(e[i],t))return!0;i++}return!1},_e=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},qe={},Je={},$e={INDEXEDDB:X,WEBSQL:Oe,LOCALSTORAGE:Xe},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)&&(_e(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;_e(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 no=new R;no.name="Scene";class io{constructor(e,t){this.signals=e,this.viewportState=t,this.strokeStore=to.createInstance({name:"soonspace",storeName:"modelStrokeCache"}),this.scene=no.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 Zn("Scene is disposed");t?t.add(e):this.scene.add(e),this._triggerObjectAdded(e),this.signals.objectAdded.dispatch(e)}removeObject(e){function t(e){var t;e.map&&((t=e.map)&&t.isTexture&&t.dispose()),e.dispose()}e.traverse((e=>{if(e.geometry&&e.material){const n=e;n.geometry.dispose(),hi(n.material,t)}e instanceof oh&&e.element.remove();const{meshOfModelList:n,poiIconList:i,otherObjList:r}=this.intersectsList,s=n.findIndex((t=>t.uuid===e.uuid)),o=i.findIndex((t=>t.uuid===e.uuid)),a=r.findIndex((t=>t.uuid===e.uuid));s>-1&&this.intersectsList.meshOfModelList.splice(s,1),o>-1&&this.intersectsList.poiIconList.splice(o,1),a>-1&&this.intersectsList.otherObjList.splice(a,1)})),e.removeFromParent(),this.signals.objectRemoved.dispatch(e)}openSceneFog(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{color:t=13426943,near:n=500,far:i=5e4}=e;this.scene.fog=new L(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 Ii(e)?e.forEach((e=>i(e))):Bi(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 Ii(e)?Promise.all(e.map((e=>t(e)))):Bi(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 rh({id:`${null!==(c=e.sid)&&void 0!==c?c:e.id}_stroke`,name:`${e.name}_stroke`}),h=new N,d=new m({color:s,transparent:!0,opacity:o});h.material=d,u.add(h);let f=null;const v=()=>{const t=[];if((l?e.children[0]:e).traverse((n=>{if("Mesh"===n.type&&n instanceof k){const i=new U(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 Ot(t)};if(a&&e instanceof lh){const{url:t}=e;await this.strokeStore.ready();const n=await this.strokeStore.getItem(t);if(n)f=new p,f.setAttribute("position",new g(n,3));else{const e=v();if(e){f=e;const n=e.getAttribute("position");n.array instanceof Float32Array&&this.strokeStore.setItem(t,n.array.buffer)}}}else{const e=v();e&&(f=e)}return null!==f?(h.geometry=f,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 Ii(e)?Promise.all(e.map((e=>c(e)))):Bi(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 Ii(e)?Promise.all(e.map((e=>t(e)))):Bi(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=di(e);return t.map=null,t.transparent=i<1,t.depthWrite=!t.transparent,t.color.set(n),t.opacity=i,t}const s=e=>(-1!==this.selectedObjects.opacity.findIndex((t=>t.uuid===e.uuid))||(e.traverse((e=>{if(e instanceof k){if(e.userData.material)return;e.userData.material=e.material,e.material=hi(e.material,r)}})),this.signals.materialChanged.dispatch(),this.selectedObjects.opacity.push(e)),Promise.resolve());return Ii(e)?Promise.all(e.map((e=>s(e)))):Bi(e)?s(e):Promise.resolve()}unOpacityShow(e){e||(e=[...this.selectedObjects.opacity]);const t=e=>new Promise((t=>{const n=this.selectedObjects.opacity.findIndex((t=>t.uuid===e.uuid));-1===n&&t(),this.selectedObjects.opacity.splice(n,1),e.traverse((e=>{if(e instanceof k){if(!e.userData.material)return;fi(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),t()}));return Ii(e)?Promise.all(e.map((e=>t(e)))):Bi(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 z&&(e.color=new c(n),e.opacity=i,e.transparent=i<1,e.depthWrite=!e.transparent)}const s=e=>(-1!==this.selectedObjects.highlight.findIndex((t=>t.uuid===e.uuid))||(e.traverse((e=>{if(e instanceof k){if(e.userData.material)return;e.userData.material=e.material,e.material=di(e.material),hi(e.material,r)}})),this.signals.materialChanged.dispatch(),this.selectedObjects.highlight.push(e)),Promise.resolve());return Ii(e)?Promise.all(e.map((e=>s(e)))):Bi(e)?s(e):Promise.resolve()}unHighlightShow(e){e||(e=[...this.selectedObjects.highlight]);const t=e=>new Promise((t=>{const n=this.selectedObjects.highlight.findIndex((t=>t.uuid===e.uuid));-1===n&&t(),this.selectedObjects.highlight.splice(n,1),e.traverse((e=>{if(e instanceof k){if(!e.userData.material)return;fi(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),t()}));return Ii(e)?Promise.all(e.map((e=>t(e)))):Bi(e)?t(e):Promise.resolve()}emissiveShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{color:n="red",opacity:i=.3,maxOpacity:r=1,minOpacity:s=0,duration:o=1e3}=t;function a(e){e instanceof z&&(e.emissive.set(n),e.emissiveIntensity=i,0!==o&&Ui({emissiveIntensity:r},{emissiveIntensity:s},{duration:o,repeat:!0},(t=>e.emissiveIntensity=t.emissiveIntensity),(t=>e.userData.animation=t)))}const l=e=>(-1!==this.selectedObjects.emissive.findIndex((t=>t.uuid===e.uuid))||(e.traverse((e=>{if(e instanceof k){if(e.userData.material)return;e.userData.material=e.material,e.material=di(e.material),hi(e.material,a)}})),this.selectedObjects.emissive.push(e),this.signals.materialChanged.dispatch()),Promise.resolve());return Ii(e)?Promise.all(e.map((e=>l(e)))):Bi(e)?l(e):Promise.resolve()}unEmissiveShow(e){function t(e){e.userData.animation&&Nn.remove(e.userData.animation)}e||(e=[...this.selectedObjects.emissive]);const n=e=>new Promise((n=>{const i=this.selectedObjects.emissive.findIndex((t=>t.uuid===e.uuid));-1===i&&n(),this.selectedObjects.emissive.splice(i,1),e.traverse((e=>{if(e instanceof k){if(!e.userData.material)return;hi(e.material,t),fi(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),n()}));return Ii(e)?Promise.all(e.map((e=>n(e)))):Bi(e)?n(e):Promise.resolve()}_triggerObjectAdded(e){if(e instanceof ih)if("Model"===e.stype)e.traverse((e=>{if(e instanceof k){-1===this.intersectsList.meshOfModelList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.meshOfModelList.push(e)}}));else if("Poi"===e.stype){-1===this.intersectsList.poiIconList.findIndex((t=>t.uuid===e.icon.uuid))&&this.intersectsList.poiIconList.push(e.icon)}else"Group"===e.stype?e.children.forEach((e=>this._triggerObjectAdded(e))):e.isObject3D&&e.traverse((e=>{if(e instanceof k){-1===this.intersectsList.otherObjList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.otherObjList.push(e)}}));else e.isObject3D&&e.traverse((e=>{if(e instanceof k){-1===this.intersectsList.otherObjList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.otherObjList.push(e)}}))}}class ro extends M{constructor(e){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof ro&&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 so=new t,oo=new d,ao=new d,lo=new t,co=new t;class uo{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(),oo.copy(t.matrixWorldInverse),ao.multiplyMatrices(t.projectionMatrix,oo),o(e,e,t),function(e){const t=function(e){const t=[];return e.traverse((function(e){e instanceof ro&&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 ro){const t=e.parent;if(t.occlude){const t=!yi(e,this.viewport.camera)&&wi(e,this.viewport.camera,this.viewport.raycaster,this.viewport.scener.intersectsList.getAll());e.visible=t}so.setFromMatrixPosition(e.matrixWorld),so.applyMatrix4(ao);const o=si(e)&&so.z>=-1&&so.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("+(so.x*i+i)+"px,"+(-so.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 lo.setFromMatrixPosition(e.matrixWorld),co.setFromMatrixPosition(t.matrixWorld),lo.distanceToSquared(co)}}}const ho=new t,fo=new r,po=new t;class go extends M{constructor(e){super(),this.isCSS3DObject=!0,this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof 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 mo 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 d,yo=new d;class wo{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 F?d+"px":"",s.camera.fov=d),u.view&&u.view.enabled?(o.style.transform=`translate( ${-u.view.offsetX*(t/u.view.width)}px, ${-u.view.offsetY*(n/u.view.height)}px )`,o.style.transform+=`scale( ${u.view.fullWidth/u.view.width}, ${u.view.fullHeight/u.view.height} )`):o.style.transform="",!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===u.parent&&!0===u.matrixWorldAutoUpdate&&u.updateMatrixWorld();let f=0,p=0;u instanceof j&&(f=-(u.right+u.left)/2,p=(u.top+u.bottom)/2);const g=u.view&&u.view.enabled?u.view.height/u.view.fullHeight:1,m=(u instanceof j?`scale( ${g} )scale(`+d+")translate("+l(f)+"px,"+l(p)+"px)"+c(u.matrixWorldInverse):`scale( ${g} )translateZ(`+d+"px)"+c(u.matrixWorldInverse))+"translate("+i+"px,"+r+"px)";s.camera.style!==m&&(a.style.transform=m,s.camera.style=m),h(e,e,u)},this.setSize=(e,s)=>{t=e,n=s,i=t/2,r=n/2,this.domElement.style.width=e+"px",this.domElement.style.height=s+"px",o.style.width=e+"px",o.style.height=s+"px",a.style.width=e+"px",a.style.height=s+"px"};const h=(e,t,n,i)=>{var r;if(e instanceof go){const t=e.parent;if(t.occlude){const t=!yi(e,this.viewport.camera)&&wi(e,this.viewport.camera,this.viewport.raycaster,this.viewport.scener.intersectsList.getAll());e.visible=t}const i=si(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 mo?(vo.copy(n.matrixWorldInverse),vo.transpose(),0!==e.rotation2D&&vo.multiply(yo.makeRotationZ(e.rotation2D)),e.matrixWorld.decompose(ho,fo,po),vo.setPosition(ho),vo.scale(po),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 bo{constructor(e){this.viewport=e,this.internalOptions={enableRenderCss2D:!1,enableRenderCss3D:!1},this.container=this._initContainer(),this.renderer=this._initRenderer(),this.rendererCSS2D=this._initRenderCSS2D(),this.rendererCSS3D=this._initRenderCSS3D(),this.interactiveContainer=this._initInteractiveContainer()}setInternalState(e,t){this.internalOptions[e]=t}getWidth(){return this.renderer.domElement.width}getHeight(){return this.renderer.domElement.height}getMouseRelativeConRatio(e){const t=this.container.getBoundingClientRect();return[(e.offsetX-t.left)/t.width,(e.offsetY-t.top)/t.height]}getMousePoint(e){const t=new h(0,0);return t.fromArray(this.getMouseRelativeConRatio(e)),t}_initContainer(){const e=document.createElement("div");return e.style.position="relative",e.style.width="100%",e.style.height="100%",e}_initRenderer(){const{background:e={},logarithmicDepthBuffer:t}=this.viewport.options,{alpha:n}=e,{offsetWidth:i,offsetHeight:r}=this.container,s=new H({powerPreference:"high-performance",premultipliedAlpha:!0,stencil:!1,antialias:!1,alpha:!1,preserveDrawingBuffer:!0,logarithmicDepthBuffer:t});return s.autoClear=!1,s.setSize(i,r),s.setPixelRatio(self.devicePixelRatio),s.setClearAlpha(n?0:1),s.localClippingEnabled=!0,s.sortObjects=!0,s.shadowMap.enabled=!0,s.shadowMap.type=G,this.container.appendChild(s.domElement),s}_initRenderCSS2D(){const e=new uo(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 wo(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 xo=new d,Ao=(e,t)=>{const i=xo.clone(),r=xo.clone(),s=xo.clone();i.makeRotationY(e),r.makeRotationX(t);const o=new n;return s.multiplyMatrices(i,r),o.setFromRotationMatrix(s),o},So=Ao(-Math.PI/2,-Math.PI/4),To=Ao(Math.PI/2,-Math.PI/4),Eo=Ao(-Math.PI/4,-Math.PI/4),Do=Ao(Math.PI/4,-Math.PI/4),Co=Ao(1.25*Math.PI,-Math.PI/4),Io=Ao(.75*Math.PI,-Math.PI/4),Bo={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(So.x,So.y,So.z),RIGHTTOP:new n(To.x,To.y,To.z),LEFTFRONTTOP:new n(Eo.x,Eo.y,Eo.z),RIGHTFRONTTOP:new n(Do.x,Do.y,Do.z),LEFTBACKTOP:new n(Co.x,Co.y,Co.z),RIGHTBACKTOP:new n(Io.x,Io.y,Io.z)},Mo=e=>Ci(e)?e:e.includes("%")?.01*Number(e.split("%")[0]):isNaN(+e)?0:Number(e),Po=new t,Oo=new n,Ro=new F(50,1,.1,5e5);Ro.position.set(500,1e3,500),Ro.lookAt(Po.set(0,0,0)),Ro.name="Camera";class Lo{constructor(e){this.viewport=e,this.mainCamera=Ro.clone(),this.mainCamera.name="freeCamera",this.currentCamera=this.mainCamera,this.cameras={}}createCamera(e){const t=Ro.clone();return t.name=e,this.cameras[e]=t,t}removeCamera(e){return"fullFreeCamera"!==e&&(delete this.cameras[e],!0)}setCurrentCamera(e){this.currentCamera=this.viewport.camera=e,this.viewport.signals.cameraObjectChange.dispatch()}getMainCamera(){return this.mainCamera}getCameraViewpoint(){if("free"===this.viewport.controls.options.type)return{position:this.currentCamera.position.clone(),rotation:{x:this.currentCamera.rotation.x,y:this.currentCamera.rotation.y,z:this.currentCamera.rotation.z}};{const e=this.viewport.controls.currentControls;return{position:this.currentCamera.position.clone(),target:e.target.clone()}}}setCameraViewpoint(e){if("free"===this.viewport.controls.options.type&&Bi(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(Bi(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 Ui(this.currentCamera.position,e,t,(e=>this.viewport.signals.cameraChange.dispatch(e)))}rotateTo(e,t){const n=this.currentCamera.quaternion.clone(),i=(new r).setFromEuler(e);return Ui({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(Ei(t)){const e=t.toLocaleUpperCase();"CURRENT"===e?Oo.copy(this.currentCamera.rotation):Bo[e]&&Oo.copy(Bo[e])}else t instanceof n?Oo.copy(t):Bi(t)&&Oo.set(t.x,t.y,t.z);Oo.copy(ti(this.currentCamera.rotation,Oo.clone())),await Promise.all([this.moveTo(e,i),this.rotateTo(Oo,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 Zn("target box is empty");const r=this.viewport.controls.options.type,s=new t;if(Ei(n)){if("CURRENT"===n.toLocaleUpperCase())s.copy(this.getMovePosByBBox(e));else{const t=Bo[n.toLocaleUpperCase()],i=this.getObjectLabelPos(e,t);s.copy(i)}}else{"orbit"===r&&Zn("orbit 控制器不支持 Rotation 类型 的 rotation 参数");const t=Jn(n),i=this.getObjectLabelPos(e,t);s.copy(i)}if("orbit"===r){const t=e.getCenter(Po),i=this.viewport.controls.currentControls;i.target.copy(t);const r=new d;r.lookAt(s,t,i.object.up),n=Oo.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 hh||e instanceof oh){const{padding:t=50}=i,r=Mo(t);return this.flyToBoundingBox(e.getBoundingBox(r),n,i)}{const{padding:r="30%"}=i,s=$n(e),o=s.getSize(Po);let a=0;if(Ei(r)){const e=Math.max(o.x,o.y,o.z);a=Mo(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(Po.set(l/2,c/2,l/2)),s.min.sub(Po.set(l/2,c/2,l/2))),s.isEmpty()&&(Po.setFromMatrixPosition(e.matrixWorld),s.setFromCenterAndSize(Po,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=qn(e),o=s.clone().setY(this.currentCamera.position.y).distanceTo(this.currentCamera.position),a=Math.abs(i);return Ui({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(Po);return this.surroundOnTarget(n,t)}getMovePosByBBox(e){const n=this.currentCamera.position,i=e.getCenter(Po);(new t).subVectors(i,n).normalize();let r=new V;r=e.getBoundingSphere(r);const s=this.currentCamera.fov/2*Math.PI/180,o=Math.sin(s),a=r.radius/o,l=new t;this.currentCamera.getWorldDirection(l);const c=l.clone();return c.multiplyScalar(-a),i.clone().add(c)}getObjectLabelPos(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e instanceof ih&&(e=(new i).setFromObject(e)),e.isEmpty())return Zn("target box is empty"),new t;const{extendScale:s=1.6,mode:o="scene"}=r;if("scene"===o){const t=e.getCenter(Po),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=Ei(n)?Bo[n.toLocaleUpperCase()]:Jn(n),a(Po.set(0,0,1).applyEuler(l)),o}return"screen"===o?e.getCenter(Po).clone():new t}}
|
|
1
|
+
import*as e from"three";import{Vector3 as t,Euler as n,Box3 as i,Quaternion as r,CubeTextureLoader as s,HalfFloatType as o,EquirectangularReflectionMapping as a,TextureLoader as l,Color as c,Texture as u,Vector2 as h,Matrix4 as d,BufferAttribute as f,BufferGeometry as p,Float32BufferAttribute as g,LineBasicMaterial as m,Line as v,Line3 as y,MathUtils as w,CurvePath as b,LineCurve as x,LineCurve3 as A,Bone as S,Uint16BufferAttribute as T,SkinnedMesh as E,Skeleton as D,AnimationClip as C,VectorKeyframeTrack as I,QuaternionKeyframeTrack as B,Object3D as M,InterpolateLinear as P,InterpolateDiscrete as O,Scene as R,Fog as L,Mesh as k,LineSegments as N,EdgesGeometry as U,MeshStandardMaterial as z,PerspectiveCamera as F,OrthographicCamera as j,WebGLRenderer as H,PCFSoftShadowMap as G,Sphere as V,REVISION as Q,Camera as Y,BasicDepthPacking as W,UnsignedByteType as X,MeshNormalMaterial as K,WebGLRenderTarget as Z,NearestFilter as _,DepthTexture as q,DepthStencilFormat as J,UnsignedInt248Type as $,UnsignedIntType as ee,Uniform as te,RepeatWrapping as ne,LoadingManager as ie,LinearFilter as re,ShaderMaterial as se,NoBlending as oe,RGBADepthPacking as ae,EventDispatcher as le,BackSide as ce,DoubleSide as ue,FrontSide as he,MeshDepthMaterial as de,LinearEncoding as fe,sRGBEncoding as pe,Vector4 as ge,Material as me,DataTexture as ve,NoColorSpace as ye,ShaderChunk as we,WebGLCubeRenderTarget as be,CubeCamera as xe,PMREMGenerator as Ae,WebGLMultipleRenderTargets as Se,FramebufferTexture as Te,RGBAFormat as Ee,Matrix3 as De,TangentSpaceNormalMap as Ce,GLSL3 as Ie,VideoTexture as Be,FloatType as Me,GLBufferAttribute as Pe,InterleavedBufferAttribute as Oe,Frustum as Re,MOUSE as Le,TOUCH as ke,Spherical as Ne,MeshBasicMaterial as Ue,PlaneGeometry as ze,Clock as Fe,Raycaster as je,AnimationMixer as He,UVMapping as Ge,ACESFilmicToneMapping as Ve,NoToneMapping as Qe,LinearToneMapping as Ye,ReinhardToneMapping as We,CineonToneMapping as Xe,Sprite as Ke,SpriteMaterial as Ze,SphereGeometry as _e,CircleGeometry as qe,ShapeGeometry as Je,Shape as $e,AmbientLight as et,DirectionalLight as tt,HemisphereLight as nt,SpotLight as it,PointLight as rt,RectAreaLight as st,Loader as ot,LoaderUtils as at,FileLoader as lt,ClampToEdgeWrapping as ct,Group as ut,PropertyBinding as ht,NumberKeyframeTrack as dt,LinearMipMapLinearFilter as ft,ImageLoader as pt,InstancedMesh as gt,GridHelper as mt,AxesHelper as vt,Box3Helper as yt,DirectionalLightHelper as wt,HemisphereLightHelper as bt,SpotLightHelper as xt,PointLightHelper as At,Box2 as St,Plane as Tt,CanvasTexture as Et,MeshPhongMaterial as Dt}from"three";export*from"three";import{RGBELoader as Ct}from"three/examples/jsm/loaders/RGBELoader.js";import{GLTFExporter as It}from"three/examples/jsm/exporters/GLTFExporter.js";import{RoomEnvironment as Bt}from"three/examples/jsm/environments/RoomEnvironment.js";import Mt from"three/examples/jsm/libs/stats.module.js";import{Sky as Pt}from"three/examples/jsm/objects/Sky.js";import{mergeGeometries as Ot,deinterleaveGeometry as Rt}from"three/examples/jsm/utils/BufferGeometryUtils.js";import{FullScreenQuad as Lt}from"three/examples/jsm/postprocessing/Pass.js";import{WorkerPool as kt}from"three/examples/jsm/utils/WorkerPool.js";import{MeshBVH as Nt,computeBoundsTree as Ut,disposeBoundsTree as zt,acceleratedRaycast as Ft}from"three-mesh-bvh";import{RectAreaLightUniformsLib as jt}from"three/examples/jsm/lights/RectAreaLightUniformsLib.js";import{TGALoader as Ht}from"three/examples/jsm/loaders/TGALoader.js";import{GLTFLoader as Gt}from"three/examples/jsm/loaders/GLTFLoader.js";import{DRACOLoader as Vt}from"three/examples/jsm/loaders/DRACOLoader.js";import*as Qt from"three/examples/jsm/libs/fflate.module.js";import{NURBSCurve as Yt}from"three/examples/jsm/curves/NURBSCurve.js";import{RectAreaLightHelper as Wt}from"three/examples/jsm/helpers/RectAreaLightHelper.js";var Xt="soonspacejs",Kt="2.6.30",Zt="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function _t(){throw new Error("setTimeout has not been defined")}function qt(){throw new Error("clearTimeout has not been defined")}var Jt=_t,$t=qt;function en(e){if(Jt===setTimeout)return setTimeout(e,0);if((Jt===_t||!Jt)&&setTimeout)return Jt=setTimeout,setTimeout(e,0);try{return Jt(e,0)}catch(t){try{return Jt.call(null,e,0)}catch(t){return Jt.call(this,e,0)}}}"function"==typeof Zt.setTimeout&&(Jt=setTimeout),"function"==typeof Zt.clearTimeout&&($t=clearTimeout);var tn,nn=[],rn=!1,sn=-1;function on(){rn&&tn&&(rn=!1,tn.length?nn=tn.concat(nn):sn=-1,nn.length&&an())}function an(){if(!rn){var e=en(on);rn=!0;for(var t=nn.length;t;){for(tn=nn,nn=[];++sn<t;)tn&&tn[sn].run();sn=-1,t=nn.length}tn=null,rn=!1,function(e){if($t===clearTimeout)return clearTimeout(e);if(($t===qt||!$t)&&clearTimeout)return $t=clearTimeout,clearTimeout(e);try{$t(e)}catch(t){try{return $t.call(null,e)}catch(t){return $t.call(this,e)}}}(e)}}function ln(e,t){this.fun=e,this.array=t}ln.prototype.run=function(){this.fun.apply(null,this.array)};function cn(){}var un=cn,hn=cn,dn=cn,fn=cn,pn=cn,gn=cn,mn=cn;var vn=Zt.performance||{},yn=vn.now||vn.mozNow||vn.msNow||vn.oNow||vn.webkitNow||function(){return(new Date).getTime()};var wn=new Date;var bn,xn={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];nn.push(new ln(e,t)),1!==nn.length||rn||en(an)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:un,addListener:hn,once:dn,off:fn,removeListener:pn,removeAllListeners:gn,emit:mn,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*yn.call(vn),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-wn)/1e3}},An={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-An.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*An.Bounce.In(2*e):.5*An.Bounce.Out(2*e-1)+.5}}},Sn="undefined"==typeof self&&void 0!==xn&&xn.hrtime?function(){var e=xn.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()},Tn=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=Sn()),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}(),En={Linear:function(e,t){var n=e.length-1,i=n*t,r=Math.floor(i),s=En.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=En.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=En.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=En.Utils.Factorial;return n(e)/n(t)/n(e-t)},Factorial:(bn=[1],function(e){var t=1;if(bn[e])return bn[e];for(var n=e;n>1;n--)t*=n;return bn[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}}},Dn=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Cn=new Tn,In=function(){function e(e,t){void 0===t&&(t=Cn),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=An.Linear.None,this._interpolationFunction=En.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=Dn.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?Sn()+parseFloat(e):e:Sn(),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=Sn()),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=Sn()),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=Sn()),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}(),Bn=Dn.nextId,Mn=Cn,Pn=Mn.getAll.bind(Mn),On=Mn.removeAll.bind(Mn),Rn=Mn.add.bind(Mn),Ln=Mn.remove.bind(Mn),kn=Mn.update.bind(Mn),Nn={Easing:An,Group:Tn,Interpolation:En,now:Sn,Sequence:Dn,nextId:Bn,Tween:In,VERSION:"18.6.4",getAll:Pn,removeAll:On,add:Rn,remove:Ln,update:kn};const Un="[soonspacejs]: ",zn="Group",Fn="Light",jn="Model",Hn="Poi",Gn="PoiNode",Vn="Canvas3D",Qn="Topology",Yn="Helper",Wn="PluginObject",Xn="In soonspacejs: ",Kn=(e,t)=>{let n="";for(const e in t)n+=`${e}: ${t[e]};`;console.log(`%c${e}`,n)},Zn=e=>{console.warn(Xn+e)},_n=e=>{console.error(Xn+e)};function qn(e){return e instanceof t?e:new t(e.x,e.y,e.z)}function Jn(e){return e instanceof n?e:new n(e.x,e.y,e.z)}function $n(e){const n=new i(new t,new t).setFromObject(e);return n.isEmpty()&&(e.getWorldPosition(n.min),n.max.copy(n.min)),n}function ei(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 ti(e,t){const i=ei("x",e,t),r=ei("y",e,t),s=ei("z",e,t);return new n(i.x,r.y,s.z,t.order)}function ni(e){return Math.PI/180*e}function ii(e){return!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?{position:e.getWorldPosition(new t),rotation:(new n).setFromQuaternion(e.getWorldQuaternion(new r)),scale:e.getWorldScale(new t)}:{position:e.position.clone(),rotation:e.rotation.clone(),scale:e.scale.clone()}}function ri(e,t){const n=ii(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 si(e){return!!e.visible&&(!e.parent||si(e.parent))}class oi{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 ai(e){let{path:t="",file:n}=e;if(Array.isArray(n))return(new s).setPath(t).loadAsync(n);{const e=Li(n);if("hdr"===e||"pic"===e){const e=await(new Ct).setPath(t).setDataType(o).loadAsync(n);return e.mapping=a,e}{const e=await(new l).setPath(t).loadAsync(n);return e.mapping=a,e}}}function li(e){if(!e)return null;const{colors:t,stops:n,size:i=1024}=e,r=document.createElement("canvas"),s=r.getContext("2d");if(!s)return null;r.width=16,r.height=i;const o=s.createLinearGradient(0,0,0,i),a=new c,l=t.map((e=>a.set(e).getStyle()));for(let e=0,t=l.length-1;e<=t;e++)o.addColorStop(n?n[e]:e/t,l[e]);s.fillStyle=o,s.fillRect(0,0,16,i);const h=new u(r);return h.needsUpdate=!0,h}const ci=e=>{const t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)};function ui(e){return Ii(e)?function(e){return e.map((e=>ui(e)))}(e):Bi(e)?function(e){if(Bi(e)){const t={};for(const n in e)t[n]=ui(e[n]);return t}return e}(e):e}const hi=(e,t)=>Ii(e)?e.map(t):t(e),di=e=>hi(e,(e=>e.clone())),fi=e=>hi(e,(e=>e.dispose())),pi=async e=>{const t=await fetch(e);if(200===t.status)return t;throw new Error(`Failed to fetch file: ${e}`)},gi=new t,mi=new t,vi=new t;function yi(e,t){const n=gi.setFromMatrixPosition(e.matrixWorld),i=mi.setFromMatrixPosition(t.matrixWorld),r=n.sub(i),s=t.getWorldDirection(vi);return r.angleTo(s)>Math.PI/2}function wi(e,t,n,i){const r=gi.setFromMatrixPosition(e.matrixWorld),s=r.clone();s.project(t),n.setFromCamera(new h(s.x,s.y),t);const o=n.intersectObjects(i,!0);if(o.length){const e=o[0].distance;return r.distanceTo(n.ray.origin)<e}return!0}const bi=e=>{"function"==typeof requestIdleCallback?requestIdleCallback(e):setTimeout(e)};var xi=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 Ai(e){return pi(e).then((e=>e.text())).then((e=>Promise.resolve(function(e){return(new xi).toJson(e,{transformTextOnly:!0,removeComments:!0,removeLineBreaks:!0})}(e))))}class Si{name="EXT_mesh_gpu_instancing";constructor(e){this.writer=e}writeNode(e,n){if(!0!==e.isInstancedMesh)return;const i=e.count,s=new d,o=new Float32Array(3*i),a=new Float32Array(4*i),l=new Float32Array(3*i),c=new t,u=new r,h=new t;for(let t=0;t<i;t++)e.getMatrixAt(t,s),s.decompose(c,u,h),o[3*t]=c.x,o[3*t+1]=c.y,o[3*t+2]=c.z,a[4*t]=u.x,a[4*t+1]=u.y,a[4*t+2]=u.z,a[4*t+3]=u.w,l[3*t]=h.x,l[3*t+1]=h.y,l[3*t+2]=h.z;const p=this.writer,g={};g.attributes={TRANSLATION:p.processAccessor(new f(o,3)),ROTATION:p.processAccessor(new f(a,4)),SCALE:p.processAccessor(new f(l,3))},n.extensions=n.extensions||{},n.extensions[this.name]=g,p.extensionsUsed[this.name]=!0}}const Ti=Object.prototype.hasOwnProperty,Ei=e=>"String"===Pi(e),Di=e=>"Boolean"===Pi(e),Ci=e=>"Number"===Pi(e),Ii=Array.isArray,Bi=e=>"Object"===Pi(e),Mi=e=>"Function"===Pi(e),Pi=e=>Object.prototype.toString.call(e).slice(8,-1),Oi=(e,t,n)=>String.fromCodePoint(...new Uint8Array(e,t,n)),Ri=()=>Un+Math.random().toString(36).substring(7).split("").join("_"),Li=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 ki=Object.freeze({__proto__:null,IVector3ToEuler:Jn,IVector3ToVector3:qn,MinHeap:oi,cloneDeep:ui,cloneMaterials:di,deg2Euler:ni,disposeMaterials:fi,error:_n,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 It;r.register((e=>new Si(e))),r.parse(e,(e=>n(e)),(e=>i(e)),t)}))},fetchFile:pi,getAsciiString:Oi,getBoundingBox:$n,getExtension:Li,getSpaceAttributeFromObject:ii,getTexture:ai,getValueType:Pi,gradientTexture:li,hasOwn:(e,t)=>Ti.call(e,t),idleTask:bi,isArray:Ii,isBoolean:Di,isDate:e=>"Date"===Pi(e),isFunction:Mi,isNull:e=>"Null"===Pi(e),isNumber:Ci,isObject:Bi,isObjectBehindCamera:yi,isObjectOccludeVisible:wi,isObjectVisible:si,isPromise:e=>"Promise"===Pi(e),isString:Ei,isSymbol:e=>"Symbol"===Pi(e),isUndefined:e=>"Undefined"===Pi(e),log:Kn,materialHandle:hi,parseFilePath:ci,randomString:Ri,rotationAFix:ti,rotationAxisFix:ei,sleep:e=>new Promise((t=>setTimeout((()=>t()),e))),syncSpaceAttributeToObject:ri,warn:Zn,xmlToJson:Ai});const Ni={"Linear.None":An.Linear.None,"Quadratic.In":An.Quadratic.In,"Quadratic.Out":An.Quadratic.Out,"Quadratic.InOut":An.Quadratic.InOut,"Cubic.In":An.Cubic.In,"Cubic.Out":An.Cubic.Out,"Cubic.InOut":An.Cubic.InOut,"Quartic.In":An.Quartic.In,"Quartic.Out":An.Quartic.Out,"Quartic.InOut":An.Quartic.InOut,"Quintic.In":An.Quintic.In,"Quintic.Out":An.Quintic.Out,"Quintic.InOut":An.Quintic.InOut,"Sinusoidal.In":An.Sinusoidal.In,"Sinusoidal.Out":An.Sinusoidal.Out,"Sinusoidal.InOut":An.Sinusoidal.InOut,"Exponential.In":An.Exponential.In,"Exponential.Out":An.Exponential.Out,"Exponential.InOut":An.Exponential.InOut,"Circular.In":An.Circular.In,"Circular.Out":An.Circular.Out,"Circular.InOut":An.Circular.InOut,"Elastic.In":An.Elastic.In,"Elastic.Out":An.Elastic.Out,"Elastic.InOut":An.Elastic.InOut,"Back.In":An.Back.In,"Back.Out":An.Back.Out,"Back.InOut":An.Back.InOut,"Bounce.In":An.Bounce.In,"Bounce.Out":An.Bounce.Out,"Bounce.InOut":An.Bounce.InOut};function Ui(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;return new Promise(((o,a)=>{const{duration:l=1e3,delay:c=0,repeat:u=!1,mode:h="Linear.None",yoyo:d=!1}=i,f=Ni[h],p=new In(e).to(t,l).easing(f).delay(c).onUpdate((i=>{e instanceof n&&t instanceof n&&i instanceof n&&(i.order=t.order),null==r||r(i,p)})).onComplete((()=>{o()})).onStop((()=>{a("animation stop")})).onStart((()=>{null==s||s(p)}));Ci(u)?p.repeat(u):Di(u)&&u&&p.repeat(1/0),p.yoyo(d),p.start()}))}class zi{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=qn(o)),o=o.clone();let a=e[s];if(!a)return!0;a.isVector3||(a=qn(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 Ui(o,a,{duration:l},((e,t)=>{var n;if(i.parent){const t=i.parent.worldToLocal(e.clone());i.position.copy(t)}null===(n=this.onUpdate)||void 0===n||n.call(this,e,t)}),(e=>{var t,n;1===s&&(null===(t=this.onStart)||void 0===t||t.call(this,e)),null===(n=this.onEveryStart)||void 0===n||n.call(this,e),this._tween=e})),null===(n=this.onPoint)||void 0===n||n.call(this,s,a),this.index++,await this._play(e)}pause(){var e;null===(e=this._tween)||void 0===e||e.pause()}resume(){var e;null===(e=this._tween)||void 0===e||e.resume()}stop(){var e;null===(e=this._tween)||void 0===e||e.stop(),this._tween=null}}var Fi=Object.defineProperty,ji=(e,t,n)=>(((e,t,n)=>{t in e?Fi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,"symbol"!=typeof t?t+"":t,n),n);function Hi(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 Gi(e,t,n){const i=n?t=>e.getPointAt(t):t=>e.getPoint(t);let r=i(0),s=0;const o=[],a=t.length;for(let e=0;e<a;e++){const n=i(t[e]);s+=n.distanceTo(r),o.push(s),r=n}return{lengths:o,length:o[a-1]}}function Vi(e,t){let n=e.sampleLength;if(!n){const t=e.sampleNum;if(t)return t;n=1}return Math.ceil(t/n)}function Qi(e){const{curve:t}=e;let n=t.getLength();const i=Vi(e,n);return t.arcLengthDivisions<i&&(t.arcLengthDivisions=i,t.updateArcLengths(),n=t.getLength()),{length:n,division:i}}function Yi(e,t){const n=Vi(t??{},e.getLength()),i=e.getPoints(n),r=e.getLengths(n);return Wi(i,{...t,lengths:r})}function Wi(e,t){const{startColor:n,endColor:i,color:r,lengths:s}=t??{},o=r?new c(r):null,a=n?new c(n):o??new c(0,1,0),l=i?new c(i):o??new c(0,0,1),u=[],h=[];e[0].toArray(u,0);const d=u.length,f=s??Ki(e).lengths,m=f[f.length-1],v=new c;e.forEach(((e,t)=>{e.toArray(u,t*d);const n=f[t]/m;v.lerpColors(a,l,n),v.toArray(h,3*t)}));const y=new p;return y.setAttribute("position",new g(u,d)),y.setAttribute("color",new g(h,3)),y}function Xi(e,t){t=t??{};let{material:n,linewidth:i}=t;i=i??1,n=n??new m({vertexColors:!0,linewidth:i});const r=Array.isArray(e)?Wi(e,t):Yi(e,t);return new v(r,n)}function Ki(e){const t=Zi(e),n=[0],i=t.reduce(((e,t)=>(e+=t.distance(),n.push(e),e)),0);return{lines:t,lengths:n,length:i}}function Zi(e){const t=[];return e.reduce(((e,n)=>{const i=new y(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 qi(e,t){const{distSortIndexs:n,clampDists:i,clampPoints:r,ts:s,clampTs:o}=Ji(e,t),a=n[0];return{line:t[a],index:a,clampDist:i[a],clampPoint:r[a],t:s[a],clampT:o[a]}}function Ji(e,n){const i={clampDists:[],clampPoints:[],distSortIndexs:[],ts:[],clampTs:[]};return n.forEach(((n,r)=>{const s=n.closestPointToPointParameter(e),o=w.clamp(s,0,1),a=n.at(o,new t),l=e.distanceTo(a);i.clampDists.push(l),i.clampPoints.push(a),i.distSortIndexs.push(r),i.ts.push(s),i.clampTs.push(o)})),i.distSortIndexs.sort(((e,t)=>i.clampDists[e]-i.clampDists[t])),i}function $i(e){const t=new b,n=null==e[0].z?x:A;return e.reduce(((e,i)=>{const r=new n(e,i);return t.add(r),i})),t}var er=(e=>(e.back="back",e.front="front",e))(er||{});function tr(e){const{curve:t,distance:n,fromU:i=0,side:r,tolerance:s=.1*n}=e,o=e.length??t.getLength(),a=t.getPointAt(i);let l=n/o;const c="front"===r?-1:1;let u=!0,h=i,d=a,f=0,p=!0;do{h=c*l+i;let e=!1;h>1?(h=1,e=!0):h<0&&(h=0,e=!0),d=t.getPointAt(h),f=d.distanceTo(a),u=Math.abs(n-f)>s;const r=n/f;if(e&&u&&r>1){p=!1;break}l*=r}while(u);return{succeed:p,u:h,point:d,distance:f}}function nr(e){const{curve:t,distance:n,fromU:i=0,tolerance:r=.1*n,origin:s}=e,o=e.length??t.getLength(),a=t.getPointAt(i),l=a.distanceTo(s),c=n-l;let u=c/o,h=!0,d=i,f=a;do{d=u+i;let e=!1;d>1?(d=1,e=!0):d<0&&(d=0,e=!0),f=t.getPointAt(d);const o=f.distanceTo(s);h=Math.abs(n-o)>r;const a=c/(o-l);if(e&&h&&a>1)return null;u*=a}while(h);return{u:d,point:f}}const ir=new t,rr=new t(1,1,1);new r;const sr=new d;function or(e){const{joints:t,axials:n}=e;if(t)var i=lr(t);else i=n?ar(e):cr(e);return i}function ar(e){const{axials:t,start:n}=e,i=new S;n&&(i.position.copy(n),i.updateMatrix());const r=[i];return t.reduce(((e,t)=>{const n=new S;return n.position.copy(t),e.add(n),r.push(n),n.updateMatrix(),n}),i),i.updateWorldMatrix(!0,!0),r}function lr(e){const t=[];return e.reduce(((e,n)=>{const i=n.clone().sub(e);return t.push(i),n})),ar({axials:t,start:e[0]})}function cr(e){const{start:t,axial:n}=e;let i=e.number;const r=new Array(i-1);return r.fill(n),ar({axials:r,start:t})}function ur(e){const{geometry:n,flexible:i=1,axial:s,number:o}=e,a=e.start??new t,l=s.clone().normalize(),c=s.length(),u=o-1,h=(new r).setFromUnitVectors(new t(1,0,0),l),f=(new d).compose(a,h,new t(1,1,1)).invert(),p=n.getAttribute("position").clone(),m=p.count;p.applyMatrix4(f);const v=[],y=[];for(let e=0;e<m;e++){const t=p.getX(e);if(t<0){v.push(0,0,0,0),y.push(1,0,0,0);continue}const n=Math.trunc(t/c);if(n<u){const e=t%c/c*i;v.push(n,n+1,0,0),y.push(1-e,e,0,0)}else v.push(u,0,0,0),y.push(1,0,0,0)}return n.setAttribute("skinIndex",new T(v,4)),n.setAttribute("skinWeight",new g(y,4)),n}function hr(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),ur({...e,start:o,axial:a,number:n.bones.length})}function dr(e){const{skeleton:n,geometry:i,flexible:r=1,geometryFrame:s}=e,o=(null==s?void 0:s.clone().invert())??sr.clone(),a=n.boneInverses.map((e=>{const n=e.clone().invert().premultiply(o);return(new t).setFromMatrixPosition(n)})),l=Zi(a),c=i.getAttribute("position"),u=c.count,h=[],d=[],f=new t;for(let e=0;e<u;e++){f.fromBufferAttribute(c,e);const{index:t,clampT:n}=qi(f,l),i=n*r;h.push(t,t+1,0,0),d.push(1-i,i,0,0)}return i.setAttribute("skinIndex",new T(h,4)),i.setAttribute("skinWeight",new g(d,4)),i}function fr(e){const{geometry:t}=e,n=e.material??void 0,i=new E(t,n),r=or(e);i.add(r[0]);const s=new D(r);return i.bind(s),dr({...e,skeleton:s}),i}function pr(e){const{skeleton:t}=e,n=gr(e);return n.updateMatrix(),n.updateMatrixWorld(),n.bind(t),n}function gr(e){const{target:t,skeleton:n}=e,i=t.geometry,r=new E;return t.copy.call(r,t,!1),dr({...e,geometry:i,skeleton:n,geometryFrame:t.matrixWorld}),r}function mr(e){const{target:t}=e;let{skeleton:n}=e;if(n)var i=n.bones[0];else{const t=or(e);n=new D(t),i=t[0]}t.add(i),t.updateWorldMatrix(!1,!0),n.calculateInverses(),i.removeFromParent();const r=vr({...e,target:t,skeleton:n});return r.add(i),{model:r,skeleton:n,rootBone:i}}function vr(e){const{target:t,skeleton:n,parent:i}=e,r=t.isMesh,s=r?gr({...e,skeleton:n}):t.clone(!1);i&&i.add(s),s.updateMatrixWorld(!0),r&&s.bind(n,t.matrixWorld);const o=t.children;for(const t of o)vr({...e,target:t,parent:s});return s}function yr(e){return e.filter((e=>{var t;return!(null!=(t=e.parent)&&t.isBone)}))}function wr(e){return e.find((e=>{var t;return!(null!=(t=e.parent)&&t.isBone)}))}function br(e){return wr(e)??e[0]}function xr(e){return e.curve?Ar(e):Ir(e)}function Ar(e){const{keyframeTracks:t,duration:n}=Sr(e);return new C(e.name,n,t)}function Sr(e){const{curve:t,lookDistance:n}=e,i=e.targetPath??"",r=Qi(e).division,s=Tr(e,t.getLength()),o=P,a=[],l=Dr(r),c={...e,duration:s,division:r,ts:l,lookPoint:{distance:n}},u=Cr(c),{points:h,rotates:d}=Er(c);if(h.length){const e=[];h.forEach(((t,n)=>{t.toArray(e,3*n)}));const t=new I(`${i}.position`,u,e,o);a.push(t)}if(d.length){const e=[];d.forEach(((t,n)=>{t.toArray(e,4*n)}));const t=new B(`${i}.quaternion`,u,e,o);a.push(t)}return{keyframeTracks:a,duration:s}}function Tr(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 Er(e){var n,i;const{curve:s,target:o,lookPoint:a,enableUp:l,fixUp:c}=e,u=e.position??!0,h=e.rotate??!0,f=[],p=[],g=[],m={rotates:f,points:p};if(!u&&!h)return m;const v=(e.anchor??ir).clone(),y=e.ts??e.us,w=!e.ts;if(!y)throw"缺少参数:至少传递 ts 和 us 任意之一";let b=sr.clone(),x=sr.clone(),A=rr.clone(),S=M.DEFAULT_UP;o&&(o.updateWorldMatrix(!0,!1),b=o.matrix,x=o.matrixWorld,A=o.scale,S=o.up);const T=b.clone().invert(),E=x.clone().multiply(T).clone().invert(),D=s.getTangent(0);D.transformDirection(E);const C=(null==(n=e.front)?void 0:n.clone().normalize())??D,I=(null==(i=e.up)?void 0:i.clone().normalize())??S.clone().transformDirection(E);let B=b.clone().setPosition(0,0,0),P=e=>s.getPoint(e),O=e=>s.getTangent(e);w&&(P=e=>s.getPointAt(e),O=e=>s.getTangentAt(e));const R=y.length,L=R-1;let{distance:k,curveLength:N,lengths:U}=a??{};k=k??0;let z=O;0!==k&&(U||(U=Gi(s,y,w).lengths),null==N&&(N=U[L]),z=(e,t)=>{const n=P(e);let i=(U[t]+k)/N;return i>1&&(i=1),s.getPointAt(i).sub(n).normalize()});let F=e=>{const t=y[e],n=z(t,e);n.transformDirection(E),g.push(n);const i=e-1,s=i<0,o=s?C:g[i],a=(new r).setFromUnitVectors(o,n);if(!s){const e=f[i];a.multiply(e)}return a.normalize()};if(l){const e=new t(0,1,0);F=c?function(t){const n=y[t],i=z(n,t);i.transformDirection(E),g.push(i);const s=t-1;let o;if(s<0)o=(new r).setFromUnitVectors(C,i);else{const e=f[s],t=C.clone().applyQuaternion(e).normalize();o=(new r).setFromUnitVectors(t,i),o.multiply(e)}const a=I.clone().applyQuaternion(o).normalize(),l=(new r).setFromUnitVectors(a,e);return o.premultiply(l),o.normalize()}:function(t){const n=y[t],i=z(n,t);i.transformDirection(E),g.push(i);const s=t-1,o=s<0,a=o?C:g[s],l=(new r).setFromUnitVectors(a,i);if(o){const t=I.clone().applyQuaternion(l);t.projectOnPlane(i).normalize();const n=e.clone().projectOnPlane(i).normalize(),s=(new r).setFromUnitVectors(t,n);l.premultiply(s)}else{const e=f[s];l.multiply(e)}return l.normalize()}}for(let e=0;e<R;e++){const t=y[e];if(h){const t=F(e);f.push(t),B=(new d).compose(ir,t,A)}if(u){const e=P(t);e.applyMatrix4(E);const n=v.clone().applyMatrix4(B);e.sub(n),p.push(e)}}return m}function Dr(e){const t=[];for(let n=0;n<=e;n++)t.push(n/e);return t}function Cr(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 Ir(e){const{smooth:t,points:n}=e;if(!1===t)var{keyframeTracks:i,duration:r}=Br(e);else{const t=$i(n);var{keyframeTracks:i,duration:r}=Sr({...e,curve:t})}return new C(e.name,r,i)}function Br(e){const t=e.targetPath??"",n=e.points,{lines:i,length:r,lengths:s}=Ki(n),o=Tr(e,r),a=[],l=s.map((e=>e/r*o)),{points:c,pointTimes:u,rotates:h,rotateTimes:d}=Mr({...e,times:l},i);if(c.length){const e=[];c.forEach(((t,n)=>{t.toArray(e,3*n)}));const n=new I(`${t}.position`,u,e,P);a.push(n)}if(h.length){const e=[];h.forEach(((t,n)=>{t.toArray(e,4*n)}));const n=new B(`${t}.quaternion`,d,e,O);a.push(n)}return{keyframeTracks:a,duration:o}}function Mr(e,n){var i,s;const{points:o,target:a,times:l,enableUp:c,fixUp:u}=e,h=e.position??!0,f=e.rotate??!0,p=o.length,g=p-1;n=n??Zi(o);const m=[],v=[],y=[],w=[],b={rotates:m,points:v,rotateTimes:l,pointTimes:y};if(!h&&!f)return b;const x=(e.anchor??ir).clone();let A=sr.clone(),S=sr.clone(),T=rr.clone(),E=M.DEFAULT_UP;a&&(a.updateWorldMatrix(!0,!1),A=a.matrix,S=a.matrixWorld,T=a.scale,E=a.up);const D=A.clone().invert(),C=S.clone().multiply(D).clone().invert(),I=n[0].delta(new t);I.transformDirection(C);const B=(null==(i=e.front)?void 0:i.clone().normalize())??I,P=(null==(s=e.up)?void 0:s.clone().normalize())??E.clone().transformDirection(C);let O=A.clone().setPosition(0,0,0),R=O,L=e=>{const i=n[e].delta(new t).normalize();i.transformDirection(C),w.push(i);const s=e-1,o=s<0,a=o?B:w[s],l=(new r).setFromUnitVectors(a,i);if(!o){const e=m[s];l.multiply(e)}return l.normalize()};if(c){const e=new t(0,1,0);L=u?function(i){const s=n[i].delta(new t).normalize();s.transformDirection(C),w.push(s);const o=i-1;let a;if(o<0)a=(new r).setFromUnitVectors(B,s);else{const e=m[o],t=B.clone().applyQuaternion(e).normalize();a=(new r).setFromUnitVectors(t,s),a.multiply(e)}const l=P.clone().applyQuaternion(a).normalize(),c=(new r).setFromUnitVectors(l,e);return a.premultiply(c),a.normalize()}:function(i){const s=n[i].delta(new t).normalize();s.transformDirection(C),w.push(s);const o=i-1,a=o<0,l=a?B:w[o],c=(new r).setFromUnitVectors(l,s);if(a){const t=P.clone().applyQuaternion(c);t.projectOnPlane(s).normalize();const n=e.clone().projectOnPlane(s).normalize(),i=(new r).setFromUnitVectors(t,n);c.premultiply(i)}else{const e=m[o];c.multiply(e)}return c.normalize()}}for(let e=0;e<p;e++){if(f)if(e<g){const t=L(e);m.push(t),O=(new d).compose(ir,t,T)}else m.push(m[e-1].clone());if(h){const t=l[e],n=o[e].clone();if(n.applyMatrix4(C),e>0){const e=x.clone().applyMatrix4(R),i=n.clone().sub(e);v.push(i),y.push(t)}const i=x.clone().applyMatrix4(O);n.sub(i),v.push(n),y.push(t)}R=O}return b}function Pr(e){const t=e.mixer,n=mr(e),{model:i,skeleton:r}=n,s=Or({...e,target:i,skeleton:r});i.animations.push(s);const o=null==t?void 0:t.clipAction(s,i);return{...n,clip:s,action:o}}function Or(e){const{boneTracks:t,duration:n}=Rr(e),i=t.flat();return new C(e.name,n,i)}function Rr(e){const{skeleton:t,targetPath:n}=e,i=t.bones,{times:r,boneSampleDatas:s,duration:o}=Lr(e),a=r.length,l=P;return{boneTracks:s.map(((e,t)=>{const{points:s,rotates:o}=e,c=i[t],u=n?`${n}.skeleton.bones[${t}]`:`${c.name||c.uuid}`,h=[],d=[];for(let e=0;e<a;e++)s&&s[e].toArray(h,3*e),o[e].toArray(d,4*e);const f=[];if(s){const e=new I(`${u}.position`,r,h,l);f.push(e)}const p=new B(`${u}.quaternion`,r,d,l);return f.push(p),f})),duration:o}}function Lr(e){var n;const{curve:i,skeleton:s,stretch:o}=e,{bones:a,boneInverses:l}=s,c=a[0],u=e.target??c.parent;if(!u)throw"target 或 根骨骼的 parent 不存在";const h=e.tolerance??.1;c.updateWorldMatrix(!0,!0);const{division:f,length:p}=Qi(e),{matrixWorld:g}=u,m=g.clone().invert(),v=[],y=[];l.reduce(((e,t)=>{const n=t.clone().invert();v.push(n);const i=e.clone().multiply(n);return y.push(i),t}),m);const w=y[0],b=new t,x=new r,A=new t;w.decompose(b,x,A);const S=Tr(e,p),T=Dr(f),E=Cr({curve:i,division:f,duration:S}),D=T.length,C=[],I=(new t).setFromMatrixPosition(y[1]).negate(),B=l[0],M=null==(n=e.up)?void 0:n.clone().applyMatrix4(g).transformDirection(B),{points:P,rotates:O}=Er({...e,curve:i,ts:T,target:c,rotate:!0,front:I,up:M,anchor:null});for(let e=0;e<D;e++)C.push(g.clone());const R=P.map(((e,t)=>{const n=O[t];n.premultiply(x).normalize();const i=(new d).compose(e,n,A);return i.premultiply(g),i})),L=i.getLengths(f).map((e=>e/p)),k=[{points:P,rotates:O,us:L,matrixs:R}],N=o?function(e,t,n){const r=k[e].us[t]-n/p;return{u:r,point:r<0?null:i.getPointAt(r)}}:function(e,t,n){const r=k[e].us[t],{u:s,point:o,succeed:a}=tr({curve:i,distance:n,fromU:r,length:p,side:er.front,tolerance:h*n});return{u:s,point:a?o:null}},U=l.length,z=U-1;for(let e=1;e<U;e++){const n=[],s=[],o=[],a=[];k.push({points:n,rotates:s,us:o,matrixs:a});const l=y[e],c=v[e],u=e-1,h=k[u],f=y[u],p=v[u],{matrixs:g,points:m,rotates:w}=h,b=(new t).setFromMatrixScale(f),x=u-1,A=x<0?C:k[x].matrixs,S=new t,T=new r,E=new t;l.decompose(S,T,E);const I=(new t).setFromMatrixPosition(c).sub((new t).setFromMatrixPosition(p)).length(),B=S.length();for(let t=0;t<D;t++){const{point:c,u:h}=N(u,t,I);o.push(h),s.push(T.clone());const f=g[t];if(h<0||!c){n.push(S);const e=f.clone().multiply(l);a.push(e);continue}const p=A[t];let v=p.clone().invert();const y=c.clone().applyMatrix4(v),x=m[t];y.sub(x).normalize();const D=w[t],C=(new d).compose(x,D,b),M=S.clone().transformDirection(C),P=(new r).setFromUnitVectors(M,y);D.premultiply(P).normalize(),f.compose(x,D,b),f.premultiply(p);const O=f.clone().invert();c.applyMatrix4(O);const R=c.length();c.copy(S).multiplyScalar(R/B),n.push(c);const L=(new d).compose(c,T,E);if(e===z){const e=i.getTangentAt(h);e.negate().transformDirection(O);const n=(new r).setFromUnitVectors(c.clone().normalize(),e);n.premultiply(T).normalize(),s[t]=n,L.compose(c,n,E)}L.premultiply(f),a.push(L)}}return{times:E,boneSampleDatas:k,duration:S}}function kr(e){const{boneTracks:t,targetTracks:n,duration:i}=Nr(e),r=n.concat(t.flat());return new C(e.name,i,r)}function Nr(e){const{skeleton:t,targetPath:n}=e,{times:i,boneSampleDatas:r,duration:s,targetSampleDatas:o}=Ur(e),a=i.length,l=t.bones,c=P,u=[],h=[],{points:d,rotates:f}=o;for(let e=0;e<a;e++)d[e].toArray(u,3*e),f[e].toArray(h,4*e);const p=n??"",g=[new I(`${p}.position`,i,u,c),new B(`${p}.quaternion`,i,h,c)];return{boneTracks:r.map(((e,t)=>{const{points:r,rotates:s}=e,o=l[t],u=n?`${n}.skeleton.bones[${t}]`:`${o.name||o.uuid}`,h=[],d=[];for(let e=0;e<a;e++)r&&r[e].toArray(h,3*e),s[e].toArray(d,4*e);const f=[];if(r){const e=new I(`${u}.position`,i,h,c);f.push(e)}const p=new B(`${u}.quaternion`,i,d,c);return f.push(p),f})),targetTracks:g,duration:s}}function Ur(e){const{curve:n,skeleton:i,stretch:s}=e,{bones:o,boneInverses:a}=i,l=o[0],c=e.target??l.parent;if(!c)throw"target 或 根骨骼的 parent 不存在";const u=e.tolerance??.1;l.updateWorldMatrix(!0,!0);const{division:h,length:f}=Qi(e),{matrix:p,matrixWorld:g,scale:m}=c,v=g.clone().multiply(p.clone().invert()),y=g.clone().invert(),w=[],b=[];a.reduce(((e,t)=>{const n=t.clone().invert();w.push(n);const i=e.clone().multiply(n);return b.push(i),t}),y);const x=b[0],A=new t,S=new r,T=new t;x.decompose(A,S,T);const E=Tr(e,f),D=Dr(h),C=w[0],I=(new t).setFromMatrixPosition(b[1]).negate().transformDirection(C).transformDirection(y),{rotates:B,points:M}=Er({...e,curve:n,target:c,position:!0,rotate:!0,anchor:A,front:I,ts:D}),P=Cr({curve:n,division:h,duration:E}),O=M.map(((e,t)=>{const n=B[t],i=(new d).compose(e,n,m);return i.premultiply(v),i})),R={points:M,rotates:B,matrixs:O},L=[],k=O.map((e=>(L.push(S.clone()),e.clone().multiply(x)))),N=D.length,U=n.getLengths(h).map((e=>e/f)),z=[{rotates:L,us:U,matrixs:k}],F=s?function(e,t,i){const r=z[e].us[t]-i/f;return{u:r,point:r<0?null:n.getPointAt(r)}}:function(e,t,i){const r=z[e].us[t],{u:s,point:o,succeed:a}=tr({curve:n,distance:i,fromU:r,length:f,side:er.front,tolerance:u*i});return{u:s,point:a?o:null}},j=a.length,H=j-1;for(let e=1;e<j;e++){const i=[],s=[],o=[],a=[];z.push({points:i,rotates:s,us:o,matrixs:a});const l=b[e],c=w[e],u=e-1,h=z[u],f=b[u],p=w[u],{matrixs:g,points:m,rotates:v}=h,y=new t,x=new r,A=new t;f.decompose(y,x,A);const S=u-1,T=S<0?O:z[S].matrixs,E=new t,D=new r,C=new t;l.decompose(E,D,C);const I=(new t).setFromMatrixPosition(c).sub((new t).setFromMatrixPosition(p)).length(),B=E.length();for(let t=0;t<N;t++){const{point:c,u:h}=F(u,t,I);o.push(h),s.push(D.clone());const f=g[t];if(h<0||!c){i.push(E);const e=f.clone().multiply(l);a.push(e);continue}const p=T[t];let w=p.clone().invert();const b=c.clone().applyMatrix4(w),S=(null==m?void 0:m[t])??y;b.sub(S).normalize();const M=v[t],P=(new d).compose(S,M,A),O=E.clone().transformDirection(P);M.setFromUnitVectors(O,b),M.premultiply(x).normalize(),f.compose(S,M,A),f.premultiply(p);const R=f.clone().invert();c.applyMatrix4(R);const L=c.length();c.copy(E).multiplyScalar(L/B),i.push(c);const k=(new d).compose(c,D,C);if(e===H){const e=n.getTangentAt(h);e.negate().transformDirection(R);const i=(new r).setFromUnitVectors(c.clone().normalize(),e);i.premultiply(D).normalize(),s[t]=i,k.compose(c,i,C)}k.premultiply(f),a.push(k)}}return{times:P,boneSampleDatas:z,targetSampleDatas:R,duration:E}}function zr(e){const{duration:t,tracks:n}=e;return n.map((e=>Array.from(e.times.map((e=>e/t)))))}class Fr{constructor(e){ji(this,"_tracksTimeRatios",null),ji(this,"_lastGetTime",0),ji(this,"_lastGetKeyframeIndexs",null),this.clip=e}get tracksTimeRatios(){return this._tracksTimeRatios??(this._tracksTimeRatios=zr(this.clip))}getTracksKeyframeIndexs(e){const{clip:t,_lastGetTime:n}=this,i=e/t.duration,r=this.tracksTimeRatios;this._lastGetTime=e,e<n&&(this._lastGetKeyframeIndexs=null),this._lastGetTime=e;const s=this._lastGetKeyframeIndexs;return this._lastGetKeyframeIndexs=r.map(((e,t)=>{const n=(null==s?void 0:s[t])??0,r=e.length;for(let t=n;t<r;t++)if(i<e[t])return t-1;return r-1}))}getTracksKeyframes(e){const t=this.getTracksKeyframeIndexs(e),n=this.clip.tracks;return t.map(((e,t)=>{let i=null;if(-1!==e){const r=n[t],s=r.getValueSize(),o=e*s,a=o+s;i=Array.from(r.values.slice(o,a))}return{index:e,value:i}}))}}class jr extends Fr{constructor(e){super(e.getClip()),ji(this,"_trackNames"),ji(this,"_positionTrackName"),ji(this,"_quaternionTrackName"),ji(this,"_rotationTrackName"),ji(this,"_scaleTrackName"),this.action=e}get time(){return this.action.time}get duration(){return this.clip.duration}get progress(){return this.time/this.duration}set progress(e){this.action.time=e*this.duration}get trackNames(){return this._trackNames??(this._trackNames=this.clip.tracks.map((e=>e.name)))}get keyframeIndexs(){const e=this.getTracksKeyframeIndexs(this.time);return this.trackNames.reduce(((t,n,i)=>(t[n]=e[i],t)),{})}get keyframes(){const e=this.getTracksKeyframes(this.time);return this.trackNames.reduce(((t,n,i)=>(t[n]=e[i],t)),{})}get positionTrackName(){return void 0===this._positionTrackName&&(this._positionTrackName=this.trackNames.find((e=>e.endsWith(".position")))??null),this._positionTrackName}get positionkeyframeIndex(){const e=this.positionTrackName;return e?this.keyframeIndexs[e]:null}get positionKeyframe(){const e=this.positionTrackName;if(e){const{index:n,value:i}=this.keyframes[e];return{index:n,value:i?new t(...i):null}}return null}get quaternionTrackName(){return void 0===this._quaternionTrackName&&(this._quaternionTrackName=this.trackNames.find((e=>e.endsWith(".quaternion")))??null),this._quaternionTrackName}get quaternionKeyframeIndex(){const e=this.quaternionTrackName;return e?this.keyframeIndexs[e]:null}get quaternionKeyframe(){const e=this.quaternionTrackName;if(e){const{index:t,value:n}=this.keyframes[e];return{index:t,value:n?new r(...n):null}}return null}get rotationTrackName(){return void 0===this._rotationTrackName&&(this._rotationTrackName=this.trackNames.find((e=>e.endsWith(".rotation")))??null),this._rotationTrackName}get rotationkeyframeIndex(){const e=this.rotationTrackName;return e?this.keyframeIndexs[e]:null}get rotationKeyframe(){const e=this.rotationTrackName;if(e){const{index:t,value:i}=this.keyframes[e];return{index:t,value:i?new n(...i):null}}return null}get scaleTrackName(){return void 0===this._scaleTrackName&&(this._scaleTrackName=this.trackNames.find((e=>e.endsWith(".scale")))??null),this._scaleTrackName}get scaleKeyframeIndex(){const e=this.scaleTrackName;return e?this.keyframeIndexs[e]:null}get scaleKeyframe(){const e=this.scaleTrackName;if(e){const{index:n,value:i}=this.keyframes[e];return{index:n,value:i?new t(...i):null}}return null}}class Hr extends jr{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 Gr(e){const t=new Hr(e);return new Proxy(t,{get:function(e,t,n){return t in e.action?e.action[t]:e[t]},set:function(e,t,n,i){return t in e.action?e.action[t]=n:e[t]=n,!0},deleteProperty:function(e,t){return t in e.action?Reflect.deleteProperty(e.action,t):Reflect.deleteProperty(e,t)},has:function(e,t){return t in e.action||t in e},ownKeys:function(e){return Reflect.ownKeys(e.action).concat(Reflect.ownKeys(e))}})}class Vr{constructor(e){ji(this,"_action"),this.setAction(e)}get action(){return this._action}set action(e){this.setAction(e)}setAction(e){this._action=e&&Gr(e)}get play(){const e=this.action;return Boolean(e&&e._mixer._isActiveAction(e)&&!e.paused)}set play(e){const t=this.action;t&&(t.paused=!e,e&&0===t.time&&t.play())}stop(){var e;null==(e=this.action)||e.stop()}}function Qr(e){var t;null==(t=e.reset)||t.call(e,!0)}class Yr extends Vr{constructor(e,t=[]){super(e),ji(this,"_updateGUI",null),this.guis=t}get updateGUI(){return this._updateGUI??this.constructor.updateGUI??Qr}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 Wr(e){const t=new Yr(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 Xr(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 Kr(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=Xr(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}ji(Yr,"updateGUI",Qr);var Zr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function _r(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 qr={},Jr={},$r=function(e,t){return $r=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])},$r(e,t)};var es=function(){return es=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},es.apply(this,arguments)};function ts(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}var ns=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 is(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 rs(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 ss(e){return this instanceof ss?(this.v=e,this):new ss(e)}var os=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function as(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 ls(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}var cs=Object.freeze({__proto__:null,get __assign(){return es},__asyncDelegator:function(e){var t,n;return t={},i("next"),i("throw",(function(e){throw e})),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,r){t[i]=e[i]?function(t){return(n=!n)?{value:ss(e[i](t)),done:!1}:r?r(t):t}:r}},__asyncGenerator:function(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,r=n.apply(e,t||[]),s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(e){r[e]&&(i[e]=function(t){return new Promise((function(n,i){s.push([e,t,n,i])>1||a(e,t)}))})}function a(e,t){try{(n=r[e](t)).value instanceof ss?Promise.resolve(n.value.v).then(l,c):u(s[0][2],n)}catch(e){u(s[0][3],e)}var n}function l(e){a("next",e)}function c(e){a("throw",e)}function u(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}},__asyncValues:function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=is(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(n){t[n]=e[n]&&function(t){return new Promise((function(i,r){(function(e,t,n,i){Promise.resolve(i).then((function(t){e({value:t,done:n})}),t)})(i,r,(t=e[n](t)).done,t.value)}))}}},__await:ss,__awaiter:function(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{l(i.next(e))}catch(e){s(e)}}function a(e){try{l(i.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}l((i=i.apply(e,t||[])).next())}))},__classPrivateFieldGet:as,__classPrivateFieldIn:function(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)},__classPrivateFieldSet:ls,__createBinding:ns,__decorate:function(e,t,n,i){var r,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(o=(s<3?r(o):s>3?r(t,n,o):r(t,n))||o);return s>3&&o&&Object.defineProperty(t,n,o),o},__esDecorate:function(e,t,n,i,r,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,l=i.kind,c="getter"===l?"get":"setter"===l?"set":"value",u=!t&&e?i.static?e:e.prototype:null,h=t||(u?Object.getOwnPropertyDescriptor(u,i.name):{}),d=!1,f=n.length-1;f>=0;f--){var p={};for(var g in i)p[g]="access"===g?{}:i[g];for(var g in i.access)p.access[g]=i.access[g];p.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var m=(0,n[f])("accessor"===l?{get:h.get,set:h.set}:h[c],p);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw new TypeError("Object expected");(a=o(m.get))&&(h.get=a),(a=o(m.set))&&(h.set=a),(a=o(m.init))&&r.push(a)}else(a=o(m))&&("field"===l?r.push(a):h[c]=a)}u&&Object.defineProperty(u,i.name,h),d=!0},__exportStar:function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||ns(t,e,n)},__extends:function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}$r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},__generator:function(e,t){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},__importDefault:function(e){return e&&e.__esModule?e:{default:e}},__importStar:function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&ns(t,e,n);return os(t,e),t},__makeTemplateObject:function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},__metadata:function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},__param:function(e,t){return function(n,i){t(n,i,e)}},__propKey:function(e){return"symbol"==typeof e?e:"".concat(e)},__read:rs,__rest:ts,__runInitializers:function(e,t,n){for(var i=arguments.length>2,r=0;r<t.length;r++)n=i?t[r].call(e,n):t[r].call(e);return i?n:void 0},__setFunctionName:function(e,t,n){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:n?"".concat(n," ",t):t})},__spread:function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(rs(arguments[t]));return e},__spreadArray:function(e,t,n){if(n||2===arguments.length)for(var i,r=0,s=t.length;r<s;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))},__spreadArrays:function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var i=Array(e),r=0;for(t=0;t<n;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,r++)i[r]=s[o];return i},__values:is}),us=_r(cs),hs={},ds={},fs={},ps={};Object.defineProperty(ps,"__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}();ps.SlotList=gs;var ms={};Object.defineProperty(ms,"__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}();ms.Slot=vs,Object.defineProperty(fs,"__esModule",{value:!0});var ys=ps,ws=ms,bs=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.slots=ys.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=ys.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 ws.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}();fs.OnceSignal=bs,Object.defineProperty(ds,"__esModule",{value:!0});var xs=us,As=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return xs.__extends(t,e),t.prototype.add=function(e){return this.registerListener(e)},t}(fs.OnceSignal);ds.Signal=As,Object.defineProperty(hs,"__esModule",{value:!0});var Ss=us,Ts=ms,Es=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Ss.__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 Ts.Slot(e,this,t,n);return this.slots=this.slots.insertWithPriority(i),i}return this.slots.find(e)},t}(ds.Signal);hs.PrioritySignal=Es,Object.defineProperty(Jr,"__esModule",{value:!0});var Ds=us,Cs=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 Ds.__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}(hs.PrioritySignal);Jr.DeluxeSignal=Cs;var Is={};Object.defineProperty(Is,"__esModule",{value:!0});var Bs=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}();Is.GenericEvent=Bs;var Ms={};Object.defineProperty(Ms,"__esModule",{value:!0}),Ms.IOnceSignal=Symbol("IOnceSignal");var Ps={};Object.defineProperty(Ps,"__esModule",{value:!0}),Ps.IPrioritySignal=Symbol("IPrioritySignal");var Os={};Object.defineProperty(Os,"__esModule",{value:!0}),Os.ISignal=Symbol("ISignal");var Rs={};Object.defineProperty(Rs,"__esModule",{value:!0}),Rs.ISlot=Symbol("ISlot");var Ls={};Object.defineProperty(Ls,"__esModule",{value:!0});var ks=ms,Ns=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 ks.Slot(e,this,t)},e}();Ls.MonoSignal=Ns;var Us={};Object.defineProperty(Us,"__esModule",{value:!0});var zs=us,Fs=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return zs.__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}(fs.OnceSignal);Us.Promise=Fs,Object.defineProperty(qr,"__esModule",{value:!0});var js=Jr;qr.DeluxeSignal=js.DeluxeSignal;var Hs=Is;qr.GenericEvent=Hs.GenericEvent;var Gs=Ms;qr.IOnceSignal=Gs.IOnceSignal;var Vs=Ps;qr.IPrioritySignal=Vs.IPrioritySignal;var Qs=Os;qr.ISignal=Qs.ISignal;var Ys=Rs;qr.ISlot=Ys.ISlot;var Ws=Ls;qr.MonoSignal=Ws.MonoSignal;var Xs=fs;qr.OnceSignal=Xs.OnceSignal;var Ks=hs;qr.PrioritySignal=Ks.PrioritySignal;var Zs=Us;qr.Promise=Zs.Promise;var _s=ds,qs=qr.Signal=_s.Signal,Js=ms;qr.Slot=Js.Slot;var $s=ps;qr.SlotList=$s.SlotList;function eo(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 to={};({get exports(){return to},set exports(e){to=e}}).exports=function e(t,n,i){function r(o,a){if(!n[o]){if(!t[o]){if(!a&&eo)return eo(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=eo,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!==Zr?Zr:"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&&f(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 f(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=p(o);"error"===a.status&&i(a.value)}function p(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}function g(e){return e instanceof this?e:s.resolve(new this(r),e)}function m(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=p(d,t);if("error"===n.status)return s.reject(e,n.value);var i=n.value;if(i)f(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=g,c.reject=m,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!==Zr?Zr:"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 f(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var p="local-forage-detect-blob-support",g=void 0,m={},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(p,w),i=l([""]);n.objectStore(p).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 g?c.resolve(g):x(e).then((function(e){return g=e}))}function S(e){var t=m[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 T(e){var t=m[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function E(e,t){var n=m[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function D(e,t){return new c((function(n,i){if(m[e.name]=m[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(p)}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),T(e)}}))}function C(e){return D(e,!1)}function I(e){return D(e,!0)}function B(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 M(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=m[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return h(n,e,e),n}function L(e){S(e);for(var t=m[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,B(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 E(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 U(e){var t=this,n={db:null};if(e)for(var i in e)n[i]=e[i];var r=m[n.name];r||(r=N(),m[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,B(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 F(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:M(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 H(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 G(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 Y(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 W(e,t){t=f.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=m[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=m[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,T(n._dbInfo)}})).catch((function(t){throw(E(e,t)||c.resolve()).catch((function(){})),t}))}})):s.then((function(t){S(e);var n=m[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++)T(i[t]._dbInfo)})).catch((function(t){throw(E(e,t)||c.resolve()).catch((function(){})),t}))}))}else i=c.reject("Invalid arguments");return u(i,t),i}var X={_driver:"asyncStorage",_initStorage:U,_support:a(),iterate:F,getItem:z,setItem:j,removeItem:H,clear:G,length:V,key:Q,keys:Y,dropInstance:W};function K(){return"function"==typeof openDatabase}var Z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_="~~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 fe(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 pe(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 ge(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+pe(i))}else if("[object Blob]"===n){var s=new FileReader;s.onload=function(){var n=_+e.type+"~"+pe(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 me(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=fe(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:ge,deserialize:me,stringToBuffer:fe,bufferToString:pe};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 Te(e,t,n){return Se.apply(this,[e,t,n,1])}function Ee(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 Be(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 Me(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=f.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(Me(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:K(),iterate:Ae,getItem:xe,setItem:Te,removeItem:Ee,clear:De,length:Ce,key:Ie,keys:Be,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 Ue(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 Fe(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 He(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 Ge(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 Ye(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 We(e,t){if(t=f.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 Xe={_driver:"localStorageWrapper",_initStorage:Ue,_support:Re(),iterate:je,getItem:Fe,setItem:Ye,removeItem:Qe,clear:ze,length:Ve,key:He,keys:Ge,dropInstance:We},Ke=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(Ke(e[i],t))return!0;i++}return!1},_e=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},qe={},Je={},$e={INDEXEDDB:X,WEBSQL:Oe,LOCALSTORAGE:Xe},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)&&(_e(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;_e(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 no=new R;no.name="Scene";class io{constructor(e,t){this.signals=e,this.viewportState=t,this.strokeStore=to.createInstance({name:"soonspace",storeName:"modelStrokeCache"}),this.scene=no.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 Zn("Scene is disposed");t?t.add(e):this.scene.add(e),this._triggerObjectAdded(e),this.signals.objectAdded.dispatch(e)}removeObject(e){function t(e){var t;e.map&&((t=e.map)&&t.isTexture&&t.dispose()),e.dispose()}e.traverse((e=>{if(e.geometry&&e.material){const n=e;n.geometry.dispose(),hi(n.material,t)}e instanceof oh&&e.element.remove();const{meshOfModelList:n,poiIconList:i,otherObjList:r}=this.intersectsList,s=n.findIndex((t=>t.uuid===e.uuid)),o=i.findIndex((t=>t.uuid===e.uuid)),a=r.findIndex((t=>t.uuid===e.uuid));s>-1&&this.intersectsList.meshOfModelList.splice(s,1),o>-1&&this.intersectsList.poiIconList.splice(o,1),a>-1&&this.intersectsList.otherObjList.splice(a,1)})),e.removeFromParent(),this.signals.objectRemoved.dispatch(e)}openSceneFog(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{color:t=13426943,near:n=500,far:i=5e4}=e;this.scene.fog=new L(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 Ii(e)?e.forEach((e=>i(e))):Bi(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 Ii(e)?Promise.all(e.map((e=>t(e)))):Bi(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 rh({id:`${null!==(c=e.sid)&&void 0!==c?c:e.id}_stroke`,name:`${e.name}_stroke`}),h=new N,d=new m({color:s,transparent:!0,opacity:o});h.material=d,u.add(h);let f=null;const v=()=>{const t=[];if((l?e.children[0]:e).traverse((n=>{if("Mesh"===n.type&&n instanceof k){const i=new U(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 Ot(t)};if(a&&e instanceof lh){const{url:t}=e;await this.strokeStore.ready();const n=await this.strokeStore.getItem(t);if(n)f=new p,f.setAttribute("position",new g(n,3));else{const e=v();if(e){f=e;const n=e.getAttribute("position");n.array instanceof Float32Array&&this.strokeStore.setItem(t,n.array.buffer)}}}else{const e=v();e&&(f=e)}return null!==f?(h.geometry=f,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 Ii(e)?Promise.all(e.map((e=>c(e)))):Bi(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 Ii(e)?Promise.all(e.map((e=>t(e)))):Bi(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=di(e);return t.map=null,t.transparent=i<1,t.depthWrite=!t.transparent,t.color.set(n),t.opacity=i,t}const s=e=>(-1!==this.selectedObjects.opacity.findIndex((t=>t.uuid===e.uuid))||(e.traverse((e=>{if(e instanceof k){if(e.userData.material)return;e.userData.material=e.material,e.material=hi(e.material,r)}})),this.signals.materialChanged.dispatch(),this.selectedObjects.opacity.push(e)),Promise.resolve());return Ii(e)?Promise.all(e.map((e=>s(e)))):Bi(e)?s(e):Promise.resolve()}unOpacityShow(e){e||(e=[...this.selectedObjects.opacity]);const t=e=>new Promise((t=>{const n=this.selectedObjects.opacity.findIndex((t=>t.uuid===e.uuid));-1===n&&t(),this.selectedObjects.opacity.splice(n,1),e.traverse((e=>{if(e instanceof k){if(!e.userData.material)return;fi(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),t()}));return Ii(e)?Promise.all(e.map((e=>t(e)))):Bi(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 z&&(e.color=new c(n),e.opacity=i,e.transparent=i<1,e.depthWrite=!e.transparent)}const s=e=>(-1!==this.selectedObjects.highlight.findIndex((t=>t.uuid===e.uuid))||(e.traverse((e=>{if(e instanceof k){if(e.userData.material)return;e.userData.material=e.material,e.material=di(e.material),hi(e.material,r)}})),this.signals.materialChanged.dispatch(),this.selectedObjects.highlight.push(e)),Promise.resolve());return Ii(e)?Promise.all(e.map((e=>s(e)))):Bi(e)?s(e):Promise.resolve()}unHighlightShow(e){e||(e=[...this.selectedObjects.highlight]);const t=e=>new Promise((t=>{const n=this.selectedObjects.highlight.findIndex((t=>t.uuid===e.uuid));-1===n&&t(),this.selectedObjects.highlight.splice(n,1),e.traverse((e=>{if(e instanceof k){if(!e.userData.material)return;fi(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),t()}));return Ii(e)?Promise.all(e.map((e=>t(e)))):Bi(e)?t(e):Promise.resolve()}emissiveShow(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{color:n="red",opacity:i=.3,maxOpacity:r=1,minOpacity:s=0,duration:o=1e3}=t;function a(e){e instanceof z&&(e.emissive.set(n),e.emissiveIntensity=i,0!==o&&Ui({emissiveIntensity:r},{emissiveIntensity:s},{duration:o,repeat:!0},(t=>e.emissiveIntensity=t.emissiveIntensity),(t=>e.userData.animation=t)))}const l=e=>(-1!==this.selectedObjects.emissive.findIndex((t=>t.uuid===e.uuid))||(e.traverse((e=>{if(e instanceof k){if(e.userData.material)return;e.userData.material=e.material,e.material=di(e.material),hi(e.material,a)}})),this.selectedObjects.emissive.push(e),this.signals.materialChanged.dispatch()),Promise.resolve());return Ii(e)?Promise.all(e.map((e=>l(e)))):Bi(e)?l(e):Promise.resolve()}unEmissiveShow(e){function t(e){e.userData.animation&&Nn.remove(e.userData.animation)}e||(e=[...this.selectedObjects.emissive]);const n=e=>new Promise((n=>{const i=this.selectedObjects.emissive.findIndex((t=>t.uuid===e.uuid));-1===i&&n(),this.selectedObjects.emissive.splice(i,1),e.traverse((e=>{if(e instanceof k){if(!e.userData.material)return;hi(e.material,t),fi(e.material),e.material=e.userData.material,Reflect.deleteProperty(e.userData,"material")}})),this.signals.materialChanged.dispatch(),n()}));return Ii(e)?Promise.all(e.map((e=>n(e)))):Bi(e)?n(e):Promise.resolve()}_triggerObjectAdded(e){if(e instanceof ih)if("Model"===e.stype)e.traverse((e=>{if(e instanceof k){-1===this.intersectsList.meshOfModelList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.meshOfModelList.push(e)}}));else if("Poi"===e.stype){-1===this.intersectsList.poiIconList.findIndex((t=>t.uuid===e.icon.uuid))&&this.intersectsList.poiIconList.push(e.icon)}else"Group"===e.stype?e.children.forEach((e=>this._triggerObjectAdded(e))):e.isObject3D&&e.traverse((e=>{if(e instanceof k){-1===this.intersectsList.otherObjList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.otherObjList.push(e)}}));else e.isObject3D&&e.traverse((e=>{if(e instanceof k){-1===this.intersectsList.otherObjList.findIndex((t=>t.uuid===e.uuid))&&this.intersectsList.otherObjList.push(e)}}))}}class ro extends M{constructor(e){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof ro&&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 so=new t,oo=new d,ao=new d,lo=new t,co=new t;class uo{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(),oo.copy(t.matrixWorldInverse),ao.multiplyMatrices(t.projectionMatrix,oo),o(e,e,t),function(e){const t=function(e){const t=[];return e.traverse((function(e){e instanceof ro&&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 ro){const t=e.parent;if(t.occlude){const t=!yi(e,this.viewport.camera)&&wi(e,this.viewport.camera,this.viewport.raycaster,this.viewport.scener.intersectsList.getAll());e.visible=t}so.setFromMatrixPosition(e.matrixWorld),so.applyMatrix4(ao);const o=si(e)&&so.z>=-1&&so.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("+(so.x*i+i)+"px,"+(-so.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 lo.setFromMatrixPosition(e.matrixWorld),co.setFromMatrixPosition(t.matrixWorld),lo.distanceToSquared(co)}}}const ho=new t,fo=new r,po=new t;class go extends M{constructor(e){super(),this.isCSS3DObject=!0,this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(()=>{this.traverse((function(e){e instanceof 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 mo 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 d,yo=new d;class wo{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 F?d+"px":"",s.camera.fov=d),u.view&&u.view.enabled?(o.style.transform=`translate( ${-u.view.offsetX*(t/u.view.width)}px, ${-u.view.offsetY*(n/u.view.height)}px )`,o.style.transform+=`scale( ${u.view.fullWidth/u.view.width}, ${u.view.fullHeight/u.view.height} )`):o.style.transform="",!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===u.parent&&!0===u.matrixWorldAutoUpdate&&u.updateMatrixWorld();let f=0,p=0;u instanceof j&&(f=-(u.right+u.left)/2,p=(u.top+u.bottom)/2);const g=u.view&&u.view.enabled?u.view.height/u.view.fullHeight:1,m=(u instanceof j?`scale( ${g} )scale(`+d+")translate("+l(f)+"px,"+l(p)+"px)"+c(u.matrixWorldInverse):`scale( ${g} )translateZ(`+d+"px)"+c(u.matrixWorldInverse))+"translate("+i+"px,"+r+"px)";s.camera.style!==m&&(a.style.transform=m,s.camera.style=m),h(e,e,u)},this.setSize=(e,s)=>{t=e,n=s,i=t/2,r=n/2,this.domElement.style.width=e+"px",this.domElement.style.height=s+"px",o.style.width=e+"px",o.style.height=s+"px",a.style.width=e+"px",a.style.height=s+"px"};const h=(e,t,n,i)=>{var r;if(e instanceof go){const t=e.parent;if(t.occlude){const t=!yi(e,this.viewport.camera)&&wi(e,this.viewport.camera,this.viewport.raycaster,this.viewport.scener.intersectsList.getAll());e.visible=t}const i=si(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 mo?(vo.copy(n.matrixWorldInverse),vo.transpose(),0!==e.rotation2D&&vo.multiply(yo.makeRotationZ(e.rotation2D)),e.matrixWorld.decompose(ho,fo,po),vo.setPosition(ho),vo.scale(po),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 bo{constructor(e){this.viewport=e,this.internalOptions={enableRenderCss2D:!1,enableRenderCss3D:!1},this.container=this._initContainer(),this.renderer=this._initRenderer(),this.rendererCSS2D=this._initRenderCSS2D(),this.rendererCSS3D=this._initRenderCSS3D(),this.interactiveContainer=this._initInteractiveContainer()}setInternalState(e,t){this.internalOptions[e]=t}getWidth(){return this.renderer.domElement.width}getHeight(){return this.renderer.domElement.height}getMouseRelativeConRatio(e){const t=this.container.getBoundingClientRect();return[(e.offsetX-t.left)/t.width,(e.offsetY-t.top)/t.height]}getMousePoint(e){const t=new h(0,0);return t.fromArray(this.getMouseRelativeConRatio(e)),t}_initContainer(){const e=document.createElement("div");return e.style.position="relative",e.style.width="100%",e.style.height="100%",e}_initRenderer(){const{background:e={},logarithmicDepthBuffer:t}=this.viewport.options,{alpha:n}=e,{offsetWidth:i,offsetHeight:r}=this.container,s=new H({powerPreference:"high-performance",premultipliedAlpha:!0,stencil:!1,antialias:!1,alpha:!1,preserveDrawingBuffer:!0,logarithmicDepthBuffer:t});return s.autoClear=!1,s.setSize(i,r),s.setPixelRatio(self.devicePixelRatio),s.setClearAlpha(n?0:1),s.localClippingEnabled=!0,s.sortObjects=!0,s.shadowMap.enabled=!0,s.shadowMap.type=G,this.container.appendChild(s.domElement),s}_initRenderCSS2D(){const e=new uo(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 wo(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 xo=new d,Ao=(e,t)=>{const i=xo.clone(),r=xo.clone(),s=xo.clone();i.makeRotationY(e),r.makeRotationX(t);const o=new n;return s.multiplyMatrices(i,r),o.setFromRotationMatrix(s),o},So=Ao(-Math.PI/2,-Math.PI/4),To=Ao(Math.PI/2,-Math.PI/4),Eo=Ao(-Math.PI/4,-Math.PI/4),Do=Ao(Math.PI/4,-Math.PI/4),Co=Ao(1.25*Math.PI,-Math.PI/4),Io=Ao(.75*Math.PI,-Math.PI/4),Bo={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(So.x,So.y,So.z),RIGHTTOP:new n(To.x,To.y,To.z),LEFTFRONTTOP:new n(Eo.x,Eo.y,Eo.z),RIGHTFRONTTOP:new n(Do.x,Do.y,Do.z),LEFTBACKTOP:new n(Co.x,Co.y,Co.z),RIGHTBACKTOP:new n(Io.x,Io.y,Io.z)},Mo=e=>Ci(e)?e:e.includes("%")?.01*Number(e.split("%")[0]):isNaN(+e)?0:Number(e),Po=new t,Oo=new n,Ro=new F(50,1,.1,5e5);Ro.position.set(500,1e3,500),Ro.lookAt(Po.set(0,0,0)),Ro.name="Camera";class Lo{constructor(e){this.viewport=e,this.mainCamera=Ro.clone(),this.mainCamera.name="freeCamera",this.currentCamera=this.mainCamera,this.cameras={}}createCamera(e){const t=Ro.clone();return t.name=e,this.cameras[e]=t,t}removeCamera(e){return"fullFreeCamera"!==e&&(delete this.cameras[e],!0)}setCurrentCamera(e){this.currentCamera=this.viewport.camera=e,this.viewport.signals.cameraObjectChange.dispatch()}getMainCamera(){return this.mainCamera}getCameraViewpoint(){if("free"===this.viewport.controls.options.type)return{position:this.currentCamera.position.clone(),rotation:{x:this.currentCamera.rotation.x,y:this.currentCamera.rotation.y,z:this.currentCamera.rotation.z}};{const e=this.viewport.controls.currentControls;return{position:this.currentCamera.position.clone(),target:e.target.clone()}}}setCameraViewpoint(e){if("free"===this.viewport.controls.options.type&&Bi(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(Bi(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 Ui(this.currentCamera.position,e,t,(e=>this.viewport.signals.cameraChange.dispatch(e)))}rotateTo(e,t){const n=this.currentCamera.quaternion.clone(),i=(new r).setFromEuler(e);return Ui({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(Ei(t)){const e=t.toLocaleUpperCase();"CURRENT"===e?Oo.copy(this.currentCamera.rotation):Bo[e]&&Oo.copy(Bo[e])}else t instanceof n?Oo.copy(t):Bi(t)&&Oo.set(t.x,t.y,t.z);Oo.copy(ti(this.currentCamera.rotation,Oo.clone())),await Promise.all([this.moveTo(e,i),this.rotateTo(Oo,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 Zn("target box is empty");const r=this.viewport.controls.options.type,s=new t;if(Ei(n)){if("CURRENT"===n.toLocaleUpperCase())s.copy(this.getMovePosByBBox(e));else{const t=Bo[n.toLocaleUpperCase()],i=this.getObjectLabelPos(e,t);s.copy(i)}}else{"orbit"===r&&Zn("orbit 控制器不支持 Rotation 类型 的 rotation 参数");const t=Jn(n),i=this.getObjectLabelPos(e,t);s.copy(i)}if("orbit"===r){const t=e.getCenter(Po),i=this.viewport.controls.currentControls;i.target.copy(t);const r=new d;r.lookAt(s,t,i.object.up),n=Oo.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 hh||e instanceof oh){const{padding:t=50}=i,r=Mo(t);return this.flyToBoundingBox(e.getBoundingBox(r),n,i)}{const{padding:r="30%"}=i,s=$n(e),o=s.getSize(Po);let a=0;if(Ei(r)){const e=Math.max(o.x,o.y,o.z);a=Mo(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(Po.set(l/2,c/2,l/2)),s.min.sub(Po.set(l/2,c/2,l/2))),s.isEmpty()&&(Po.setFromMatrixPosition(e.matrixWorld),s.setFromCenterAndSize(Po,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=qn(e),o=s.clone().setY(this.currentCamera.position.y).distanceTo(this.currentCamera.position),a=Math.abs(i);return Ui({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(Po);return this.surroundOnTarget(n,t)}getMovePosByBBox(e){const n=this.currentCamera.position,i=e.getCenter(Po);(new t).subVectors(i,n).normalize();let r=new V;r=e.getBoundingSphere(r);const s=this.currentCamera.fov/2*Math.PI/180,o=Math.sin(s),a=r.radius/o,l=new t;this.currentCamera.getWorldDirection(l);const c=l.clone();return c.multiplyScalar(-a),i.clone().add(c)}getObjectLabelPos(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"frontTop",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e instanceof ih&&(e=(new i).setFromObject(e)),e.isEmpty())return Zn("target box is empty"),new t;const{extendScale:s=1.6,mode:o="scene"}=r;if("scene"===o){const t=e.getCenter(Po),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=Ei(n)?Bo[n.toLocaleUpperCase()]:Jn(n),a(Po.set(0,0,1).applyEuler(l)),o}return"screen"===o?e.getCenter(Po).clone():new t}}
|
|
2
2
|
/**
|
|
3
3
|
* postprocessing v6.31.0 build Sun May 07 2023
|
|
4
4
|
* https://github.com/pmndrs/postprocessing
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "soonspacejs",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.30",
|
|
4
4
|
"homepage": "http://www.xwbuilders.com:8800/",
|
|
5
5
|
"description": "soonspacejs 2.x",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"three": ">=0.151.3"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "c28f7cf4e6ae6851178979eab93b421fd2d6d178"
|
|
34
34
|
}
|