@shopware-ag/dive 1.18.5-beta.2 → 1.18.5-beta.3
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/build/AR-BzVanQ-t.js +722 -0
- package/build/AR-BzVanQ-t.js.map +1 -0
- package/build/AR-ySzrfSW3.cjs +2 -0
- package/build/AR-ySzrfSW3.cjs.map +1 -0
- package/build/IO-BTWL9Zfp.cjs +19 -0
- package/build/IO-BTWL9Zfp.cjs.map +1 -0
- package/build/{IO-BgiJzKrU.js → IO-CYzpSt1J.js} +257 -225
- package/build/IO-CYzpSt1J.js.map +1 -0
- package/build/{MediaCreator-4zmvmUWH.js → MediaCreator-BFa3Xfwk.js} +2 -2
- package/build/{MediaCreator-4zmvmUWH.js.map → MediaCreator-BFa3Xfwk.js.map} +1 -1
- package/build/{MediaCreator-BNxZVYyZ.cjs → MediaCreator-BqLcaXbl.cjs} +2 -2
- package/build/{MediaCreator-BNxZVYyZ.cjs.map → MediaCreator-BqLcaXbl.cjs.map} +1 -1
- package/build/{dive-_-yiZbhn.cjs → dive-BTQZqHRt.cjs} +3 -3
- package/build/{dive-_-yiZbhn.cjs.map → dive-BTQZqHRt.cjs.map} +1 -1
- package/build/{dive-Mi8g8Khn.js → dive-Dk0rFfvA.js} +35 -35
- package/build/{dive-Mi8g8Khn.js.map → dive-Dk0rFfvA.js.map} +1 -1
- package/build/dive.cjs +1 -1
- package/build/dive.js +1 -1
- package/build/src/ar/arquicklook/ARQuickLook.d.ts +2 -3
- package/package.json +1 -1
- package/src/ar/arquicklook/ARQuickLook.ts +75 -48
- package/src/ar/arquicklook/__test__/ARQuickLook.test.ts +45 -80
- package/src/ar/sceneviewer/__test__/SceneViewer.test.ts +0 -12
- package/build/AR-B-g0updz.js +0 -1450
- package/build/AR-B-g0updz.js.map +0 -1
- package/build/AR-BWQebw6-.cjs +0 -153
- package/build/AR-BWQebw6-.cjs.map +0 -1
- package/build/IO-BgiJzKrU.js.map +0 -1
- package/build/IO-CuYml7Y5.cjs +0 -2
- package/build/IO-CuYml7Y5.cjs.map +0 -1
- package/build/TextureUtils-CxpuVgwF.js +0 -38
- package/build/TextureUtils-CxpuVgwF.js.map +0 -1
- package/build/TextureUtils-DNG-yR77.cjs +0 -19
- package/build/TextureUtils-DNG-yR77.cjs.map +0 -1
|
@@ -3820,11 +3820,11 @@ __p += '`),yt&&(he+=`' +
|
|
|
3820
3820
|
function print() { __p += __j.call(arguments, '') }
|
|
3821
3821
|
`:`;
|
|
3822
3822
|
`)+he+`return __p
|
|
3823
|
-
}`;var st=Jd(function(){return At(R,Ie+"return "+he).apply(t,N)});if(st.source=he,$l(st))throw st;return st}function gM(r){return wt(r).toLowerCase()}function _M(r){return wt(r).toUpperCase()}function vM(r,a,u){if(r=wt(r),r&&(u||a===t))return af(r);if(!r||!(a=zn(a)))return r;var g=ai(r),S=ai(a),R=cf(g,S),N=lf(g,S)+1;return gr(g,R,N).join("")}function xM(r,a,u){if(r=wt(r),r&&(u||a===t))return r.slice(0,hf(r)+1);if(!r||!(a=zn(a)))return r;var g=ai(r),S=lf(g,ai(a))+1;return gr(g,0,S).join("")}function yM(r,a,u){if(r=wt(r),r&&(u||a===t))return r.replace(Mi,"");if(!r||!(a=zn(a)))return r;var g=ai(r),S=cf(g,ai(a));return gr(g,S).join("")}function SM(r,a){var u=w,g=X;if(Gt(a)){var S="separator"in a?a.separator:S;u="length"in a?it(a.length):u,g="omission"in a?zn(a.omission):g}r=wt(r);var R=r.length;if(us(r)){var N=ai(r);R=N.length}if(u>=R)return r;var B=u-hs(g);if(B<1)return g;var G=N?gr(N,0,B).join(""):r.slice(0,B);if(S===t)return G+g;if(N&&(B+=G.length-B),Jl(S)){if(r.slice(B).search(S)){var oe,ae=G;for(S.global||(S=pl(S.source,wt(L.exec(S))+"g")),S.lastIndex=0;oe=S.exec(ae);)var he=oe.index;G=G.slice(0,he===t?B:he)}}else if(r.indexOf(zn(S),B)!=B){var ye=G.lastIndexOf(S);ye>-1&&(G=G.slice(0,ye))}return G+g}function MM(r){return r=wt(r),r&&pt.test(r)?r.replace(ve,$_):r}var EM=vs(function(r,a,u){return r+(u?" ":"")+a.toUpperCase()}),tu=Qf("toUpperCase");function $d(r,a,u){return r=wt(r),a=u?t:a,a===t?q_(r)?e0(r):F_(r):r.match(a)||[]}var Jd=ht(function(r,a){try{return Bn(r,t,a)}catch(u){return $l(u)?u:new $e(u)}}),TM=Hi(function(r,a){return jn(a,function(u){u=Ai(u),ki(r,u,Kl(r[u],r))}),r});function bM(r){var a=r==null?0:r.length,u=He();return r=a?zt(r,function(g){if(typeof g[1]!="function")throw new Kn(c);return[u(g[0]),g[1]]}):[],ht(function(g){for(var S=-1;++S<a;){var R=r[S];if(Bn(R[0],this,g))return Bn(R[1],this,g)}})}function AM(r){return $0($n(r,p))}function nu(r){return function(){return r}}function wM(r,a){return r==null||r!==r?a:r}var RM=td(),CM=td(!0);function Nn(r){return r}function iu(r){return Pf(typeof r=="function"?r:$n(r,p))}function LM(r){return Df($n(r,p))}function PM(r,a){return Uf(r,$n(a,p))}var IM=ht(function(r,a){return function(u){return wo(u,r,a)}}),DM=ht(function(r,a){return function(u){return wo(r,u,a)}});function ru(r,a,u){var g=cn(a),S=Pa(a,g);u==null&&!(Gt(a)&&(S.length||!g.length))&&(u=a,a=r,r=this,S=Pa(a,cn(a)));var R=!(Gt(u)&&"chain"in u)||!!u.chain,N=Vi(r);return jn(S,function(B){var G=a[B];r[B]=G,N&&(r.prototype[B]=function(){var oe=this.__chain__;if(R||oe){var ae=r(this.__wrapped__),he=ae.__actions__=In(this.__actions__);return he.push({func:G,args:arguments,thisArg:r}),ae.__chain__=oe,ae}return G.apply(r,ur([this.value()],arguments))})}),r}function UM(){return fn._===this&&(fn._=o0),this}function su(){}function NM(r){return r=it(r),ht(function(a){return Nf(a,r)})}var OM=Ol(zt),FM=Ol(tf),BM=Ol(al);function Qd(r){return Vl(r)?cl(Ai(r)):pv(r)}function kM(r){return function(a){return r==null?t:Br(r,a)}}var zM=id(),HM=id(!0);function ou(){return[]}function au(){return!1}function GM(){return{}}function VM(){return""}function WM(){return!0}function XM(r,a){if(r=it(r),r<1||r>Q)return[];var u=Ae,g=_n(r,Ae);a=He(a),r-=Ae;for(var S=hl(g,a);++u<r;)a(u);return S}function qM(r){return tt(r)?zt(r,Ai):Hn(r)?[r]:In(xd(wt(r)))}function YM(r){var a=++r0;return wt(r)+a}var jM=Fa(function(r,a){return r+a},0),KM=Fl("ceil"),ZM=Fa(function(r,a){return r/a},1),$M=Fl("floor");function JM(r){return r&&r.length?La(r,Nn,Ml):t}function QM(r,a){return r&&r.length?La(r,He(a,2),Ml):t}function eE(r){return sf(r,Nn)}function tE(r,a){return sf(r,He(a,2))}function nE(r){return r&&r.length?La(r,Nn,Al):t}function iE(r,a){return r&&r.length?La(r,He(a,2),Al):t}var rE=Fa(function(r,a){return r*a},1),sE=Fl("round"),oE=Fa(function(r,a){return r-a},0);function aE(r){return r&&r.length?ul(r,Nn):0}function cE(r,a){return r&&r.length?ul(r,He(a,2)):0}return A.after=Ly,A.ary=Ld,A.assign=_S,A.assignIn=Wd,A.assignInWith=Za,A.assignWith=vS,A.at=xS,A.before=Pd,A.bind=Kl,A.bindAll=TM,A.bindKey=Id,A.castArray=Gy,A.chain=wd,A.chunk=$v,A.compact=Jv,A.concat=Qv,A.cond=bM,A.conforms=AM,A.constant=nu,A.countBy=ay,A.create=yS,A.curry=Dd,A.curryRight=Ud,A.debounce=Nd,A.defaults=SS,A.defaultsDeep=MS,A.defer=Py,A.delay=Iy,A.difference=ex,A.differenceBy=tx,A.differenceWith=nx,A.drop=ix,A.dropRight=rx,A.dropRightWhile=sx,A.dropWhile=ox,A.fill=ax,A.filter=ly,A.flatMap=fy,A.flatMapDeep=dy,A.flatMapDepth=py,A.flatten=Ed,A.flattenDeep=cx,A.flattenDepth=lx,A.flip=Dy,A.flow=RM,A.flowRight=CM,A.fromPairs=ux,A.functions=CS,A.functionsIn=LS,A.groupBy=my,A.initial=fx,A.intersection=dx,A.intersectionBy=px,A.intersectionWith=mx,A.invert=IS,A.invertBy=DS,A.invokeMap=_y,A.iteratee=iu,A.keyBy=vy,A.keys=cn,A.keysIn=Un,A.map=Wa,A.mapKeys=NS,A.mapValues=OS,A.matches=LM,A.matchesProperty=PM,A.memoize=qa,A.merge=FS,A.mergeWith=Xd,A.method=IM,A.methodOf=DM,A.mixin=ru,A.negate=Ya,A.nthArg=NM,A.omit=BS,A.omitBy=kS,A.once=Uy,A.orderBy=xy,A.over=OM,A.overArgs=Ny,A.overEvery=FM,A.overSome=BM,A.partial=Zl,A.partialRight=Od,A.partition=yy,A.pick=zS,A.pickBy=qd,A.property=Qd,A.propertyOf=kM,A.pull=xx,A.pullAll=bd,A.pullAllBy=yx,A.pullAllWith=Sx,A.pullAt=Mx,A.range=zM,A.rangeRight=HM,A.rearg=Oy,A.reject=Ey,A.remove=Ex,A.rest=Fy,A.reverse=Yl,A.sampleSize=by,A.set=GS,A.setWith=VS,A.shuffle=Ay,A.slice=Tx,A.sortBy=Cy,A.sortedUniq=Px,A.sortedUniqBy=Ix,A.split=fM,A.spread=By,A.tail=Dx,A.take=Ux,A.takeRight=Nx,A.takeRightWhile=Ox,A.takeWhile=Fx,A.tap=Jx,A.throttle=ky,A.thru=Va,A.toArray=Hd,A.toPairs=Yd,A.toPairsIn=jd,A.toPath=qM,A.toPlainObject=Vd,A.transform=WS,A.unary=zy,A.union=Bx,A.unionBy=kx,A.unionWith=zx,A.uniq=Hx,A.uniqBy=Gx,A.uniqWith=Vx,A.unset=XS,A.unzip=jl,A.unzipWith=Ad,A.update=qS,A.updateWith=YS,A.values=Ss,A.valuesIn=jS,A.without=Wx,A.words=$d,A.wrap=Hy,A.xor=Xx,A.xorBy=qx,A.xorWith=Yx,A.zip=jx,A.zipObject=Kx,A.zipObjectDeep=Zx,A.zipWith=$x,A.entries=Yd,A.entriesIn=jd,A.extend=Wd,A.extendWith=Za,ru(A,A),A.add=jM,A.attempt=Jd,A.camelCase=JS,A.capitalize=Kd,A.ceil=KM,A.clamp=KS,A.clone=Vy,A.cloneDeep=Xy,A.cloneDeepWith=qy,A.cloneWith=Wy,A.conformsTo=Yy,A.deburr=Zd,A.defaultTo=wM,A.divide=ZM,A.endsWith=QS,A.eq=li,A.escape=eM,A.escapeRegExp=tM,A.every=cy,A.find=uy,A.findIndex=Sd,A.findKey=ES,A.findLast=hy,A.findLastIndex=Md,A.findLastKey=TS,A.floor=$M,A.forEach=Rd,A.forEachRight=Cd,A.forIn=bS,A.forInRight=AS,A.forOwn=wS,A.forOwnRight=RS,A.get=Ql,A.gt=jy,A.gte=Ky,A.has=PS,A.hasIn=eu,A.head=Td,A.identity=Nn,A.includes=gy,A.indexOf=hx,A.inRange=ZS,A.invoke=US,A.isArguments=Hr,A.isArray=tt,A.isArrayBuffer=Zy,A.isArrayLike=Dn,A.isArrayLikeObject=jt,A.isBoolean=$y,A.isBuffer=_r,A.isDate=Jy,A.isElement=Qy,A.isEmpty=eS,A.isEqual=tS,A.isEqualWith=nS,A.isError=$l,A.isFinite=iS,A.isFunction=Vi,A.isInteger=Fd,A.isLength=ja,A.isMap=Bd,A.isMatch=rS,A.isMatchWith=sS,A.isNaN=oS,A.isNative=aS,A.isNil=lS,A.isNull=cS,A.isNumber=kd,A.isObject=Gt,A.isObjectLike=Xt,A.isPlainObject=Do,A.isRegExp=Jl,A.isSafeInteger=uS,A.isSet=zd,A.isString=Ka,A.isSymbol=Hn,A.isTypedArray=ys,A.isUndefined=hS,A.isWeakMap=fS,A.isWeakSet=dS,A.join=gx,A.kebabCase=nM,A.last=Qn,A.lastIndexOf=_x,A.lowerCase=iM,A.lowerFirst=rM,A.lt=pS,A.lte=mS,A.max=JM,A.maxBy=QM,A.mean=eE,A.meanBy=tE,A.min=nE,A.minBy=iE,A.stubArray=ou,A.stubFalse=au,A.stubObject=GM,A.stubString=VM,A.stubTrue=WM,A.multiply=rE,A.nth=vx,A.noConflict=UM,A.noop=su,A.now=Xa,A.pad=sM,A.padEnd=oM,A.padStart=aM,A.parseInt=cM,A.random=$S,A.reduce=Sy,A.reduceRight=My,A.repeat=lM,A.replace=uM,A.result=HS,A.round=sE,A.runInContext=H,A.sample=Ty,A.size=wy,A.snakeCase=hM,A.some=Ry,A.sortedIndex=bx,A.sortedIndexBy=Ax,A.sortedIndexOf=wx,A.sortedLastIndex=Rx,A.sortedLastIndexBy=Cx,A.sortedLastIndexOf=Lx,A.startCase=dM,A.startsWith=pM,A.subtract=oE,A.sum=aE,A.sumBy=cE,A.template=mM,A.times=XM,A.toFinite=Wi,A.toInteger=it,A.toLength=Gd,A.toLower=gM,A.toNumber=ei,A.toSafeInteger=gS,A.toString=wt,A.toUpper=_M,A.trim=vM,A.trimEnd=xM,A.trimStart=yM,A.truncate=SM,A.unescape=MM,A.uniqueId=YM,A.upperCase=EM,A.upperFirst=tu,A.each=Rd,A.eachRight=Cd,A.first=Td,ru(A,function(){var r={};return Ti(A,function(a,u){Lt.call(A.prototype,u)||(r[u]=a)}),r}(),{chain:!1}),A.VERSION=n,jn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(r){A[r].placeholder=A}),jn(["drop","take"],function(r,a){gt.prototype[r]=function(u){u=u===t?1:tn(it(u),0);var g=this.__filtered__&&!a?new gt(this):this.clone();return g.__filtered__?g.__takeCount__=_n(u,g.__takeCount__):g.__views__.push({size:_n(u,Ae),type:r+(g.__dir__<0?"Right":"")}),g},gt.prototype[r+"Right"]=function(u){return this.reverse()[r](u).reverse()}}),jn(["filter","map","takeWhile"],function(r,a){var u=a+1,g=u==te||u==ue;gt.prototype[r]=function(S){var R=this.clone();return R.__iteratees__.push({iteratee:He(S,3),type:u}),R.__filtered__=R.__filtered__||g,R}}),jn(["head","last"],function(r,a){var u="take"+(a?"Right":"");gt.prototype[r]=function(){return this[u](1).value()[0]}}),jn(["initial","tail"],function(r,a){var u="drop"+(a?"":"Right");gt.prototype[r]=function(){return this.__filtered__?new gt(this):this[u](1)}}),gt.prototype.compact=function(){return this.filter(Nn)},gt.prototype.find=function(r){return this.filter(r).head()},gt.prototype.findLast=function(r){return this.reverse().find(r)},gt.prototype.invokeMap=ht(function(r,a){return typeof r=="function"?new gt(this):this.map(function(u){return wo(u,r,a)})}),gt.prototype.reject=function(r){return this.filter(Ya(He(r)))},gt.prototype.slice=function(r,a){r=it(r);var u=this;return u.__filtered__&&(r>0||a<0)?new gt(u):(r<0?u=u.takeRight(-r):r&&(u=u.drop(r)),a!==t&&(a=it(a),u=a<0?u.dropRight(-a):u.take(a-r)),u)},gt.prototype.takeRightWhile=function(r){return this.reverse().takeWhile(r).reverse()},gt.prototype.toArray=function(){return this.take(Ae)},Ti(gt.prototype,function(r,a){var u=/^(?:filter|find|map|reject)|While$/.test(a),g=/^(?:head|last)$/.test(a),S=A[g?"take"+(a=="last"?"Right":""):a],R=g||/^find/.test(a);S&&(A.prototype[a]=function(){var N=this.__wrapped__,B=g?[1]:arguments,G=N instanceof gt,oe=B[0],ae=G||tt(N),he=function(mt){var yt=S.apply(A,ur([mt],B));return g&&ye?yt[0]:yt};ae&&u&&typeof oe=="function"&&oe.length!=1&&(G=ae=!1);var ye=this.__chain__,Ie=!!this.__actions__.length,Ve=R&&!ye,st=G&&!Ie;if(!R&&ae){N=st?N:new gt(this);var We=r.apply(N,B);return We.__actions__.push({func:Va,args:[he],thisArg:t}),new Zn(We,ye)}return Ve&&st?r.apply(this,B):(We=this.thru(he),Ve?g?We.value()[0]:We.value():We)})}),jn(["pop","push","shift","sort","splice","unshift"],function(r){var a=ma[r],u=/^(?:push|sort|unshift)$/.test(r)?"tap":"thru",g=/^(?:pop|shift)$/.test(r);A.prototype[r]=function(){var S=arguments;if(g&&!this.__chain__){var R=this.value();return a.apply(tt(R)?R:[],S)}return this[u](function(N){return a.apply(tt(N)?N:[],S)})}}),Ti(gt.prototype,function(r,a){var u=A[a];if(u){var g=u.name+"";Lt.call(ms,g)||(ms[g]=[]),ms[g].push({name:a,func:u})}}),ms[Oa(t,_).name]=[{name:"wrapper",func:t}],gt.prototype.clone=M0,gt.prototype.reverse=E0,gt.prototype.value=T0,A.prototype.at=Qx,A.prototype.chain=ey,A.prototype.commit=ty,A.prototype.next=ny,A.prototype.plant=ry,A.prototype.reverse=sy,A.prototype.toJSON=A.prototype.valueOf=A.prototype.value=oy,A.prototype.first=A.prototype.head,yo&&(A.prototype[yo]=iy),A},fs=t0();Dr?((Dr.exports=fs)._=fs,il._=fs):fn._=fs}).call(UC)}(Yo,Yo.exports)),Yo.exports}var OC=NC();const Ks=class Ks{constructor(e,t,n,i){this.registered=new Map,this.listeners=new Map,this._id=LC(),this.renderer=e,this.scene=t,this.controller=n,this.toolbox=i,this._mediaGenerator=null,this._io=null,this._ar=null,Ks.__instances.push(this)}static get(e){const t=this.__instances.find(n=>n.id===e);return t||this.__instances.find(n=>Array.from(n.registered.values()).find(i=>i.id===e))}get id(){return this._id}get mediaGenerator(){return this._mediaGenerator?Promise.resolve(this._mediaGenerator):new Promise((e,t)=>{Promise.resolve().then(()=>require("./MediaCreator-BNxZVYyZ.cjs")).then(n=>{const i=n.DIVEMediaCreator;this._mediaGenerator=new i(this.renderer,this.scene,this.controller),e(this._mediaGenerator)}).catch(n=>{console.error("DIVE: Error while lazy-loading IO module:",n),t(n)})})}get io(){return this._io?Promise.resolve(this._io):new Promise((e,t)=>{Promise.resolve().then(()=>require("./IO-CuYml7Y5.cjs")).then(n=>{const i=n.DIVEIO;this._io=new i(this.scene),e(this._io)}).catch(n=>{console.error("DIVE: Error while lazy-loading IO module:",n),t(n)})})}get ar(){return this._ar?Promise.resolve(this._ar):new Promise((e,t)=>{Promise.resolve().then(()=>require("./AR-BWQebw6-.cjs")).then(n=>{const i=n.DIVEAR;this._ar=new i(this.renderer,this.scene,this.controller),e(this._ar)}).catch(n=>{console.error("DIVE: Error while lazy-loading AR module:",n),t(n)})})}DestroyInstance(){const e=Ks.__instances.findIndex(t=>t.id===this.id);return e===-1?!1:(Ks.__instances.splice(e,1),!0)}PerformAction(e,t){let n=!1;switch(e){case"GET_ALL_SCENE_DATA":{n=this.getAllSceneData(t);break}case"GET_ALL_OBJECTS":{n=this.getAllObjects(t);break}case"GET_OBJECTS":{n=this.getObjects(t);break}case"ADD_OBJECT":{n=this.addObject(t);break}case"UPDATE_OBJECT":{n=this.updateObject(t);break}case"DELETE_OBJECT":{n=this.deleteObject(t);break}case"SELECT_OBJECT":{n=this.selectObject(t);break}case"DESELECT_OBJECT":{n=this.deselectObject(t);break}case"SET_BACKGROUND":{n=this.setBackground(t);break}case"DROP_IT":{n=this.dropIt(t);break}case"PLACE_ON_FLOOR":{n=this.placeOnFloor(t);break}case"SET_CAMERA_TRANSFORM":{n=this.setCameraTransform(t);break}case"GET_CAMERA_TRANSFORM":{n=this.getCameraTransform(t);break}case"MOVE_CAMERA":{n=this.moveCamera(t);break}case"RESET_CAMERA":{n=this.resetCamera(t);break}case"COMPUTE_ENCOMPASSING_VIEW":{n=this.computeEncompassingView(t);break}case"SET_CAMERA_LAYER":{n=this.setCameraLayer(t);break}case"ZOOM_CAMERA":{n=this.zoomCamera(t);break}case"SET_GIZMO_MODE":{n=this.setGizmoMode(t);break}case"SET_GIZMO_VISIBILITY":{n=this.setGizmoVisibility(t);break}case"SET_GIZMO_SCALE_LINKED":{n=this.setGizmoScaleLinked(t);break}case"USE_TOOL":{n=this.useTool(t);break}case"MODEL_LOADED":{n=this.modelLoaded(t);break}case"UPDATE_SCENE":{n=this.updateScene(t);break}case"GENERATE_MEDIA":{n=this.generateMedia(t);break}case"SET_PARENT":{n=this.setParent(t);break}case"EXPORT_SCENE":{n=this.exportScene(t);break}case"LAUNCH_AR":{n=new Promise((i,o)=>{this.ar.then(c=>{i(c.Launch(t))}).catch(o)});break}default:console.warn(`DIVECommunication.PerformAction: has been executed with unknown Action type ${e}`)}return this.dispatch(e,t),n}Subscribe(e,t){return this.listeners.get(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t),()=>{const n=this.listeners.get(e);if(!n)return!1;const i=n.findIndex(o=>o===t);return i===-1?!1:(n.splice(i,1),!0)}}dispatch(e,t){const n=this.listeners.get(e);n&&n.forEach(i=>i(t))}getAllSceneData(e){const t={name:this.scene.name,mediaItem:null,backgroundColor:"#"+this.scene.background.getHexString(),floorEnabled:this.scene.Floor.visible,floorColor:"#"+this.scene.Floor.material.color.getHexString(),userCamera:{position:this.controller.object.position.clone(),target:this.controller.target.clone()},spotmarks:[],lights:Array.from(this.registered.values()).filter(n=>n.entityType==="light"),objects:Array.from(this.registered.values()).filter(n=>n.entityType==="model"),cameras:Array.from(this.registered.values()).filter(n=>n.entityType==="pov"),primitives:Array.from(this.registered.values()).filter(n=>n.entityType==="primitive"),groups:Array.from(this.registered.values()).filter(n=>n.entityType==="group")};return Object.assign(e,t),t}getAllObjects(e){return Object.assign(e,this.registered),this.registered}getObjects(e){if(e.ids.length===0)return[];const t=[];return this.registered.forEach(n=>{e.ids.includes(n.id)&&t.push(n)}),t}addObject(e){return this.registered.get(e.id)?!1:(e.parentId===void 0&&(e.parentId=null),this.registered.set(e.id,e),this.scene.AddSceneObject(e),!0)}updateObject(e){const t=this.registered.get(e.id);if(!t)return!1;this.registered.set(e.id,OC.merge(t,e));const n=this.registered.get(e.id);return this.scene.UpdateSceneObject({...e,id:n.id,entityType:n.entityType}),Object.assign(e,n),!0}deleteObject(e){const t=this.registered.get(e.id);return t?(t.parentId&&this.setParent({object:{id:t.id},parent:null}),t.entityType==="group"&&this.registered.forEach(n=>{n.parentId===t.id&&this.updateObject({id:n.id,parentId:null})}),Object.assign(e,t),this.registered.delete(e.id),Array.from(this.registered.values()).forEach(n=>{n.parentId&&n.parentId===e.id&&(n.parentId=null)}),this.scene.DeleteSceneObject(t),!0):!1}selectObject(e){const t=this.registered.get(e.id);if(!t)return!1;const n=this.scene.GetSceneObject(t);if(!n||!("isSelectable"in n))return!1;const i=this.toolbox.GetActiveTool();return i&&Km(i)&&i.AttachGizmo(n),Object.assign(e,t),!0}deselectObject(e){const t=this.registered.get(e.id);if(!t)return!1;const n=this.scene.GetSceneObject(t);if(!n||!("isSelectable"in n))return!1;const i=this.toolbox.GetActiveTool();return i&&Km(i)&&i.DetachGizmo(),Object.assign(e,t),!0}setBackground(e){return this.scene.SetBackground(e.color),!0}dropIt(e){const t=this.registered.get(e.id);return t?(this.scene.GetSceneObject(t).DropIt(),!0):!1}placeOnFloor(e){const t=this.registered.get(e.id);return t?(this.scene.PlaceOnFloor(t),!0):!1}setCameraTransform(e){return this.controller.object.position.copy(e.position),this.controller.target.copy(e.target),this.controller.update(),!0}getCameraTransform(e){const t={position:this.controller.object.position.clone(),target:this.controller.target.clone()};return Object.assign(e,t),t}moveCamera(e){let t={x:0,y:0,z:0},n={x:0,y:0,z:0};return"id"in e?(t=this.registered.get(e.id).position,n=this.registered.get(e.id).target):(t=e.position,n=e.target),this.controller.MoveTo(t,n,e.duration,e.locked),!0}setCameraLayer(e){return this.controller.object.SetCameraLayer(e.layer),!0}resetCamera(e){return this.controller.RevertLast(e.duration),!0}computeEncompassingView(e){const t=this.scene.ComputeSceneBB(),n=this.controller.ComputeEncompassingView(t);return Object.assign(e,n),n}zoomCamera(e){return e.direction==="IN"&&this.controller.ZoomIn(e.by),e.direction==="OUT"&&this.controller.ZoomOut(e.by),!0}setGizmoMode(e){return this.toolbox.SetGizmoMode(e.mode),!0}setGizmoVisibility(e){return this.toolbox.SetGizmoVisibility(e),e}setGizmoScaleLinked(e){return this.toolbox.SetGizmoScaleLinked(e),e}useTool(e){return this.toolbox.UseTool(e.tool),!0}modelLoaded(e){return this.registered.get(e.id).loaded=!0,!0}updateScene(e){return e.name!==void 0&&(this.scene.name=e.name),e.backgroundColor!==void 0&&this.scene.SetBackground(e.backgroundColor),e.gridEnabled!==void 0&&this.scene.Grid.SetVisibility(e.gridEnabled),e.floorEnabled!==void 0&&this.scene.Floor.SetVisibility(e.floorEnabled),e.floorColor!==void 0&&this.scene.Floor.SetColor(e.floorColor),e.name=this.scene.name,e.backgroundColor="#"+this.scene.background.getHexString(),e.gridEnabled=this.scene.Grid.visible,e.floorEnabled=this.scene.Floor.visible,e.floorColor="#"+this.scene.Floor.material.color.getHexString(),!0}generateMedia(e){let t={x:0,y:0,z:0},n={x:0,y:0,z:0};return"id"in e?(t=this.registered.get(e.id).position,n=this.registered.get(e.id).target):(t=e.position,n=e.target),this.mediaGenerator.then(i=>i.GenerateMedia(t,n,e.width,e.height))}setParent(e){const t=this.registered.get(e.object.id);if(!t)return!1;const n=this.scene.GetSceneObject(t);if(!n)return!1;if(e.parent===null)return this.scene.Root.attach(n),this.updateObject({id:t.id,parentId:null}),!0;if(e.object.id===e.parent.id)return!1;const i=this.registered.get(e.parent.id);if(!i)return this.scene.Root.attach(n),this.updateObject({id:t.id,parentId:null}),!0;const o=this.scene.GetSceneObject(i);return o?(o.attach(n),this.updateObject({id:t.id,parentId:i.id}),!0):(this.scene.Root.attach(n),this.updateObject({id:t.id,parentId:null}),!0)}exportScene(e){return new Promise((t,n)=>{this.io.then(i=>{t(i.Export(e.type))}).catch(n)})}};Ks.__instances=[];let On=Ks;class FC extends St{constructor(){super(),this.isDIVELight=!0,this.isDIVEPointLight=!0,this.isMovable=!0,this.isSelectable=!0,this.gizmo=null,this.name="DIVEPointLight",this.light=new Zg(16777215,1),this.light.layers.mask=si,this.light.castShadow=!0,this.light.shadow.mapSize.width=512,this.light.shadow.mapSize.height=512,this.add(this.light);const e=.1,t=new Kc(e,e*320,e*320),n=new nr({color:this.light.color,transparent:!0,opacity:.8,side:Li});this.mesh=new un(t,n),this.mesh.layers.mask=$g,this.add(this.mesh)}SetColor(e){this.light.color=e,this.mesh.material.color=e}SetIntensity(e){this.light.intensity=e,this.mesh.material.opacity=e>.8?.8:e*.8}SetEnabled(e){this.light.visible=e}onMove(){var e;(e=On.get(this.userData.id))==null||e.PerformAction("UPDATE_OBJECT",{id:this.userData.id,position:this.position})}onSelect(){var e;(e=On.get(this.userData.id))==null||e.PerformAction("SELECT_OBJECT",{id:this.userData.id})}onDeselect(){var e;(e=On.get(this.userData.id))==null||e.PerformAction("DESELECT_OBJECT",{id:this.userData.id})}}class BC extends St{constructor(){super(),this.isDIVELight=!0,this.isDIVESceneLight=!0,this.name="DIVESceneLight",this._hemiLight=new cC(16777215,16777215,2),this._hemiLight.layers.mask=si,this._hemiLight.position.set(0,50,0),this.add(this._hemiLight),this._dirLight=new Ch(16777215,3),this._dirLight.layers.mask=si,this._dirLight.position.set(1,1.75,1),this._dirLight.position.multiplyScalar(30),this._dirLight.castShadow=!0,this._dirLight.shadow.mapSize.width=2048,this._dirLight.shadow.mapSize.height=2048;const e=5;this._dirLight.shadow.camera.left=-5,this._dirLight.shadow.camera.right=e,this._dirLight.shadow.camera.top=e,this._dirLight.shadow.camera.bottom=-5,this._dirLight.shadow.camera.far=3500,this.add(this._dirLight)}SetColor(e){this._hemiLight.color=e,this._dirLight.color=e}SetIntensity(e){this._hemiLight.intensity=e*2,this._dirLight.intensity=e*3}SetEnabled(e){this._hemiLight.visible=e,this._dirLight.visible=e}}const Uh=s=>s.parent?Uh(s.parent):s;class Nh extends St{constructor(){super(),this.isDIVENode=!0,this.isSelectable=!0,this.isMovable=!0,this.gizmo=null,this.layers.mask=si,this._positionWorldBuffer=new F,this._boundingBox=new yi}SetPosition(e){if(!this.parent){this.position.set(e.x,e.y,e.z);return}const t=new F(e.x,e.y,e.z);this.position.copy(this.parent.worldToLocal(t)),"isDIVEGroup"in this.parent&&this.parent.UpdateLineTo(this)}SetRotation(e){this.rotation.set(e.x,e.y,e.z)}SetScale(e){this.scale.set(e.x,e.y,e.z)}SetVisibility(e){this.visible=e}SetToWorldOrigin(){var e;this.position.set(0,0,0),(e=On.get(this.userData.id))==null||e.PerformAction("UPDATE_OBJECT",{id:this.userData.id,position:this.getWorldPosition(this._positionWorldBuffer),rotation:this.rotation,scale:this.scale})}onMove(){var e;(e=On.get(this.userData.id))==null||e.PerformAction("UPDATE_OBJECT",{id:this.userData.id,position:this.getWorldPosition(this._positionWorldBuffer),rotation:this.rotation,scale:this.scale})}onSelect(){var e;(e=On.get(this.userData.id))==null||e.PerformAction("SELECT_OBJECT",{id:this.userData.id})}onDeselect(){var e;(e=On.get(this.userData.id))==null||e.PerformAction("DESELECT_OBJECT",{id:this.userData.id})}}class kC extends Nh{constructor(){super(...arguments),this.isDIVEModel=!0,this._mesh=null,this._material=null}SetModel(e){this.clear(),this._boundingBox.makeEmpty(),e.scene.traverse(t=>{t.castShadow=!0,t.receiveShadow=!0,t.layers.mask=this.layers.mask,this._boundingBox.expandByObject(t),!this._mesh&&"isMesh"in t&&(this._mesh=t,this._material?this._mesh.material=this._material:this._material=t.material)}),this.add(e.scene)}SetMaterial(e){this._material||(this._material=new uo),e.vertexColors!==void 0&&(this._material.vertexColors=e.vertexColors),e.color!==void 0&&this._material.color.set(e.color),e.map!==void 0&&(this._material.map=e.map),e.normalMap!==void 0&&(this._material.normalMap=e.normalMap),e.roughness!==void 0&&(this._material.roughness=e.roughness),e.roughnessMap!==void 0&&(this._material.roughnessMap=e.roughnessMap,this._material.roughnessMap&&(this._material.roughness=1)),e.metalness!==void 0&&(this._material.metalness=e.metalness),e.metalnessMap!==void 0&&(this._material.metalnessMap=e.metalnessMap,this._material.metalnessMap&&(this._material.metalness=1)),this._mesh&&(this._mesh.material=this._material)}PlaceOnFloor(){var i,o,c,l,h;const e=this.getWorldPosition(this._positionWorldBuffer),t=e.clone();(o=(i=this._mesh)==null?void 0:i.geometry)==null||o.computeBoundingBox();const n=(l=(c=this._mesh)==null?void 0:c.geometry)==null?void 0:l.boundingBox;!n||!this._mesh||(e.y=e.y-this._mesh.localToWorld(n.min.clone()).y,e.y!==t.y&&((h=On.get(this.userData.id))==null||h.PerformAction("UPDATE_OBJECT",{id:this.userData.id,position:e,rotation:this.rotation,scale:this.scale})))}DropIt(){if(!this.parent){console.warn("DIVEModel: DropIt() called on a model that is not in the scene.",this);return}const e=this._boundingBox.min.y*this.scale.y,t=this.localToWorld(this._boundingBox.getCenter(new F).multiply(this.scale));t.y=e+this.position.y;const n=new Dh(t,new F(0,-1,0));n.layers.mask=si;const i=n.intersectObjects(Uh(this).Root.children,!0);if(i.length>0){const o=i[0].object;o.geometry.computeBoundingBox();const c=o.geometry.boundingBox,l=o.localToWorld(c.max.clone()),h=this.position.clone(),f=this.position.clone().setY(l.y).sub(new F(0,e,0));if(this.position.copy(f),this.position.y===h.y)return;this.onMove()}}}const Xu=new WeakMap;class zC extends os{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,n,i){const o=new Bc(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,c=>{this.parse(c,t,i)},n,i)}parse(e,t,n=()=>{}){this.decodeDracoFile(e,t,null,null,nn).catch(n)}decodeDracoFile(e,t,n,i,o=hn,c=()=>{}){const l={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:o};return this.decodeGeometry(e,l).then(t).catch(c)}decodeGeometry(e,t){const n=JSON.stringify(t);if(Xu.has(e)){const h=Xu.get(e);if(h.key===n)return h.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const o=this.workerNextTaskID++,c=e.byteLength,l=this._getWorker(o,c).then(h=>(i=h,new Promise((f,d)=>{i._callbacks[o]={resolve:f,reject:d},i.postMessage({type:"decode",id:o,taskConfig:t,buffer:e},[e])}))).then(h=>this._createGeometry(h.geometry));return l.catch(()=>!0).then(()=>{i&&o&&this._releaseTask(i,o)}),Xu.set(e,{key:n,promise:l}),l}_createGeometry(e){const t=new on;e.index&&t.setIndex(new Qt(e.index.array,1));for(let n=0;n<e.attributes.length;n++){const i=e.attributes[n],o=i.name,c=i.array,l=i.itemSize,h=new Qt(c,l);o==="color"&&(this._assignVertexColorSpace(h,i.vertexColorSpace),h.normalized=!(c instanceof Float32Array)),t.setAttribute(o,h)}return t}_assignVertexColorSpace(e,t){if(t!==nn)return;const n=new De;for(let i=0,o=e.count;i<o;i++)n.fromBufferAttribute(e,i).convertSRGBToLinear(),e.setXYZ(i,n.r,n.g,n.b)}_loadLibrary(e,t){const n=new Bc(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((i,o)=>{n.load(e,i,void 0,o)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(n=>{const i=n[0];e||(this.decoderConfig.wasmBinary=n[1]);const o=HC.toString(),c=["/* draco decoder */",i,"","/* worker */",o.substring(o.indexOf("{")+1,o.lastIndexOf("}"))].join(`
|
|
3823
|
+
}`;var st=Jd(function(){return At(R,Ie+"return "+he).apply(t,N)});if(st.source=he,$l(st))throw st;return st}function gM(r){return wt(r).toLowerCase()}function _M(r){return wt(r).toUpperCase()}function vM(r,a,u){if(r=wt(r),r&&(u||a===t))return af(r);if(!r||!(a=zn(a)))return r;var g=ai(r),S=ai(a),R=cf(g,S),N=lf(g,S)+1;return gr(g,R,N).join("")}function xM(r,a,u){if(r=wt(r),r&&(u||a===t))return r.slice(0,hf(r)+1);if(!r||!(a=zn(a)))return r;var g=ai(r),S=lf(g,ai(a))+1;return gr(g,0,S).join("")}function yM(r,a,u){if(r=wt(r),r&&(u||a===t))return r.replace(Mi,"");if(!r||!(a=zn(a)))return r;var g=ai(r),S=cf(g,ai(a));return gr(g,S).join("")}function SM(r,a){var u=w,g=X;if(Gt(a)){var S="separator"in a?a.separator:S;u="length"in a?it(a.length):u,g="omission"in a?zn(a.omission):g}r=wt(r);var R=r.length;if(us(r)){var N=ai(r);R=N.length}if(u>=R)return r;var B=u-hs(g);if(B<1)return g;var G=N?gr(N,0,B).join(""):r.slice(0,B);if(S===t)return G+g;if(N&&(B+=G.length-B),Jl(S)){if(r.slice(B).search(S)){var oe,ae=G;for(S.global||(S=pl(S.source,wt(L.exec(S))+"g")),S.lastIndex=0;oe=S.exec(ae);)var he=oe.index;G=G.slice(0,he===t?B:he)}}else if(r.indexOf(zn(S),B)!=B){var ye=G.lastIndexOf(S);ye>-1&&(G=G.slice(0,ye))}return G+g}function MM(r){return r=wt(r),r&&pt.test(r)?r.replace(ve,$_):r}var EM=vs(function(r,a,u){return r+(u?" ":"")+a.toUpperCase()}),tu=Qf("toUpperCase");function $d(r,a,u){return r=wt(r),a=u?t:a,a===t?q_(r)?e0(r):F_(r):r.match(a)||[]}var Jd=ht(function(r,a){try{return Bn(r,t,a)}catch(u){return $l(u)?u:new $e(u)}}),TM=Hi(function(r,a){return jn(a,function(u){u=Ai(u),ki(r,u,Kl(r[u],r))}),r});function bM(r){var a=r==null?0:r.length,u=He();return r=a?zt(r,function(g){if(typeof g[1]!="function")throw new Kn(c);return[u(g[0]),g[1]]}):[],ht(function(g){for(var S=-1;++S<a;){var R=r[S];if(Bn(R[0],this,g))return Bn(R[1],this,g)}})}function AM(r){return $0($n(r,p))}function nu(r){return function(){return r}}function wM(r,a){return r==null||r!==r?a:r}var RM=td(),CM=td(!0);function Nn(r){return r}function iu(r){return Pf(typeof r=="function"?r:$n(r,p))}function LM(r){return Df($n(r,p))}function PM(r,a){return Uf(r,$n(a,p))}var IM=ht(function(r,a){return function(u){return wo(u,r,a)}}),DM=ht(function(r,a){return function(u){return wo(r,u,a)}});function ru(r,a,u){var g=cn(a),S=Pa(a,g);u==null&&!(Gt(a)&&(S.length||!g.length))&&(u=a,a=r,r=this,S=Pa(a,cn(a)));var R=!(Gt(u)&&"chain"in u)||!!u.chain,N=Vi(r);return jn(S,function(B){var G=a[B];r[B]=G,N&&(r.prototype[B]=function(){var oe=this.__chain__;if(R||oe){var ae=r(this.__wrapped__),he=ae.__actions__=In(this.__actions__);return he.push({func:G,args:arguments,thisArg:r}),ae.__chain__=oe,ae}return G.apply(r,ur([this.value()],arguments))})}),r}function UM(){return fn._===this&&(fn._=o0),this}function su(){}function NM(r){return r=it(r),ht(function(a){return Nf(a,r)})}var OM=Ol(zt),FM=Ol(tf),BM=Ol(al);function Qd(r){return Vl(r)?cl(Ai(r)):pv(r)}function kM(r){return function(a){return r==null?t:Br(r,a)}}var zM=id(),HM=id(!0);function ou(){return[]}function au(){return!1}function GM(){return{}}function VM(){return""}function WM(){return!0}function XM(r,a){if(r=it(r),r<1||r>Q)return[];var u=Ae,g=_n(r,Ae);a=He(a),r-=Ae;for(var S=hl(g,a);++u<r;)a(u);return S}function qM(r){return tt(r)?zt(r,Ai):Hn(r)?[r]:In(xd(wt(r)))}function YM(r){var a=++r0;return wt(r)+a}var jM=Fa(function(r,a){return r+a},0),KM=Fl("ceil"),ZM=Fa(function(r,a){return r/a},1),$M=Fl("floor");function JM(r){return r&&r.length?La(r,Nn,Ml):t}function QM(r,a){return r&&r.length?La(r,He(a,2),Ml):t}function eE(r){return sf(r,Nn)}function tE(r,a){return sf(r,He(a,2))}function nE(r){return r&&r.length?La(r,Nn,Al):t}function iE(r,a){return r&&r.length?La(r,He(a,2),Al):t}var rE=Fa(function(r,a){return r*a},1),sE=Fl("round"),oE=Fa(function(r,a){return r-a},0);function aE(r){return r&&r.length?ul(r,Nn):0}function cE(r,a){return r&&r.length?ul(r,He(a,2)):0}return A.after=Ly,A.ary=Ld,A.assign=_S,A.assignIn=Wd,A.assignInWith=Za,A.assignWith=vS,A.at=xS,A.before=Pd,A.bind=Kl,A.bindAll=TM,A.bindKey=Id,A.castArray=Gy,A.chain=wd,A.chunk=$v,A.compact=Jv,A.concat=Qv,A.cond=bM,A.conforms=AM,A.constant=nu,A.countBy=ay,A.create=yS,A.curry=Dd,A.curryRight=Ud,A.debounce=Nd,A.defaults=SS,A.defaultsDeep=MS,A.defer=Py,A.delay=Iy,A.difference=ex,A.differenceBy=tx,A.differenceWith=nx,A.drop=ix,A.dropRight=rx,A.dropRightWhile=sx,A.dropWhile=ox,A.fill=ax,A.filter=ly,A.flatMap=fy,A.flatMapDeep=dy,A.flatMapDepth=py,A.flatten=Ed,A.flattenDeep=cx,A.flattenDepth=lx,A.flip=Dy,A.flow=RM,A.flowRight=CM,A.fromPairs=ux,A.functions=CS,A.functionsIn=LS,A.groupBy=my,A.initial=fx,A.intersection=dx,A.intersectionBy=px,A.intersectionWith=mx,A.invert=IS,A.invertBy=DS,A.invokeMap=_y,A.iteratee=iu,A.keyBy=vy,A.keys=cn,A.keysIn=Un,A.map=Wa,A.mapKeys=NS,A.mapValues=OS,A.matches=LM,A.matchesProperty=PM,A.memoize=qa,A.merge=FS,A.mergeWith=Xd,A.method=IM,A.methodOf=DM,A.mixin=ru,A.negate=Ya,A.nthArg=NM,A.omit=BS,A.omitBy=kS,A.once=Uy,A.orderBy=xy,A.over=OM,A.overArgs=Ny,A.overEvery=FM,A.overSome=BM,A.partial=Zl,A.partialRight=Od,A.partition=yy,A.pick=zS,A.pickBy=qd,A.property=Qd,A.propertyOf=kM,A.pull=xx,A.pullAll=bd,A.pullAllBy=yx,A.pullAllWith=Sx,A.pullAt=Mx,A.range=zM,A.rangeRight=HM,A.rearg=Oy,A.reject=Ey,A.remove=Ex,A.rest=Fy,A.reverse=Yl,A.sampleSize=by,A.set=GS,A.setWith=VS,A.shuffle=Ay,A.slice=Tx,A.sortBy=Cy,A.sortedUniq=Px,A.sortedUniqBy=Ix,A.split=fM,A.spread=By,A.tail=Dx,A.take=Ux,A.takeRight=Nx,A.takeRightWhile=Ox,A.takeWhile=Fx,A.tap=Jx,A.throttle=ky,A.thru=Va,A.toArray=Hd,A.toPairs=Yd,A.toPairsIn=jd,A.toPath=qM,A.toPlainObject=Vd,A.transform=WS,A.unary=zy,A.union=Bx,A.unionBy=kx,A.unionWith=zx,A.uniq=Hx,A.uniqBy=Gx,A.uniqWith=Vx,A.unset=XS,A.unzip=jl,A.unzipWith=Ad,A.update=qS,A.updateWith=YS,A.values=Ss,A.valuesIn=jS,A.without=Wx,A.words=$d,A.wrap=Hy,A.xor=Xx,A.xorBy=qx,A.xorWith=Yx,A.zip=jx,A.zipObject=Kx,A.zipObjectDeep=Zx,A.zipWith=$x,A.entries=Yd,A.entriesIn=jd,A.extend=Wd,A.extendWith=Za,ru(A,A),A.add=jM,A.attempt=Jd,A.camelCase=JS,A.capitalize=Kd,A.ceil=KM,A.clamp=KS,A.clone=Vy,A.cloneDeep=Xy,A.cloneDeepWith=qy,A.cloneWith=Wy,A.conformsTo=Yy,A.deburr=Zd,A.defaultTo=wM,A.divide=ZM,A.endsWith=QS,A.eq=li,A.escape=eM,A.escapeRegExp=tM,A.every=cy,A.find=uy,A.findIndex=Sd,A.findKey=ES,A.findLast=hy,A.findLastIndex=Md,A.findLastKey=TS,A.floor=$M,A.forEach=Rd,A.forEachRight=Cd,A.forIn=bS,A.forInRight=AS,A.forOwn=wS,A.forOwnRight=RS,A.get=Ql,A.gt=jy,A.gte=Ky,A.has=PS,A.hasIn=eu,A.head=Td,A.identity=Nn,A.includes=gy,A.indexOf=hx,A.inRange=ZS,A.invoke=US,A.isArguments=Hr,A.isArray=tt,A.isArrayBuffer=Zy,A.isArrayLike=Dn,A.isArrayLikeObject=jt,A.isBoolean=$y,A.isBuffer=_r,A.isDate=Jy,A.isElement=Qy,A.isEmpty=eS,A.isEqual=tS,A.isEqualWith=nS,A.isError=$l,A.isFinite=iS,A.isFunction=Vi,A.isInteger=Fd,A.isLength=ja,A.isMap=Bd,A.isMatch=rS,A.isMatchWith=sS,A.isNaN=oS,A.isNative=aS,A.isNil=lS,A.isNull=cS,A.isNumber=kd,A.isObject=Gt,A.isObjectLike=Xt,A.isPlainObject=Do,A.isRegExp=Jl,A.isSafeInteger=uS,A.isSet=zd,A.isString=Ka,A.isSymbol=Hn,A.isTypedArray=ys,A.isUndefined=hS,A.isWeakMap=fS,A.isWeakSet=dS,A.join=gx,A.kebabCase=nM,A.last=Qn,A.lastIndexOf=_x,A.lowerCase=iM,A.lowerFirst=rM,A.lt=pS,A.lte=mS,A.max=JM,A.maxBy=QM,A.mean=eE,A.meanBy=tE,A.min=nE,A.minBy=iE,A.stubArray=ou,A.stubFalse=au,A.stubObject=GM,A.stubString=VM,A.stubTrue=WM,A.multiply=rE,A.nth=vx,A.noConflict=UM,A.noop=su,A.now=Xa,A.pad=sM,A.padEnd=oM,A.padStart=aM,A.parseInt=cM,A.random=$S,A.reduce=Sy,A.reduceRight=My,A.repeat=lM,A.replace=uM,A.result=HS,A.round=sE,A.runInContext=H,A.sample=Ty,A.size=wy,A.snakeCase=hM,A.some=Ry,A.sortedIndex=bx,A.sortedIndexBy=Ax,A.sortedIndexOf=wx,A.sortedLastIndex=Rx,A.sortedLastIndexBy=Cx,A.sortedLastIndexOf=Lx,A.startCase=dM,A.startsWith=pM,A.subtract=oE,A.sum=aE,A.sumBy=cE,A.template=mM,A.times=XM,A.toFinite=Wi,A.toInteger=it,A.toLength=Gd,A.toLower=gM,A.toNumber=ei,A.toSafeInteger=gS,A.toString=wt,A.toUpper=_M,A.trim=vM,A.trimEnd=xM,A.trimStart=yM,A.truncate=SM,A.unescape=MM,A.uniqueId=YM,A.upperCase=EM,A.upperFirst=tu,A.each=Rd,A.eachRight=Cd,A.first=Td,ru(A,function(){var r={};return Ti(A,function(a,u){Lt.call(A.prototype,u)||(r[u]=a)}),r}(),{chain:!1}),A.VERSION=n,jn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(r){A[r].placeholder=A}),jn(["drop","take"],function(r,a){gt.prototype[r]=function(u){u=u===t?1:tn(it(u),0);var g=this.__filtered__&&!a?new gt(this):this.clone();return g.__filtered__?g.__takeCount__=_n(u,g.__takeCount__):g.__views__.push({size:_n(u,Ae),type:r+(g.__dir__<0?"Right":"")}),g},gt.prototype[r+"Right"]=function(u){return this.reverse()[r](u).reverse()}}),jn(["filter","map","takeWhile"],function(r,a){var u=a+1,g=u==te||u==ue;gt.prototype[r]=function(S){var R=this.clone();return R.__iteratees__.push({iteratee:He(S,3),type:u}),R.__filtered__=R.__filtered__||g,R}}),jn(["head","last"],function(r,a){var u="take"+(a?"Right":"");gt.prototype[r]=function(){return this[u](1).value()[0]}}),jn(["initial","tail"],function(r,a){var u="drop"+(a?"":"Right");gt.prototype[r]=function(){return this.__filtered__?new gt(this):this[u](1)}}),gt.prototype.compact=function(){return this.filter(Nn)},gt.prototype.find=function(r){return this.filter(r).head()},gt.prototype.findLast=function(r){return this.reverse().find(r)},gt.prototype.invokeMap=ht(function(r,a){return typeof r=="function"?new gt(this):this.map(function(u){return wo(u,r,a)})}),gt.prototype.reject=function(r){return this.filter(Ya(He(r)))},gt.prototype.slice=function(r,a){r=it(r);var u=this;return u.__filtered__&&(r>0||a<0)?new gt(u):(r<0?u=u.takeRight(-r):r&&(u=u.drop(r)),a!==t&&(a=it(a),u=a<0?u.dropRight(-a):u.take(a-r)),u)},gt.prototype.takeRightWhile=function(r){return this.reverse().takeWhile(r).reverse()},gt.prototype.toArray=function(){return this.take(Ae)},Ti(gt.prototype,function(r,a){var u=/^(?:filter|find|map|reject)|While$/.test(a),g=/^(?:head|last)$/.test(a),S=A[g?"take"+(a=="last"?"Right":""):a],R=g||/^find/.test(a);S&&(A.prototype[a]=function(){var N=this.__wrapped__,B=g?[1]:arguments,G=N instanceof gt,oe=B[0],ae=G||tt(N),he=function(mt){var yt=S.apply(A,ur([mt],B));return g&&ye?yt[0]:yt};ae&&u&&typeof oe=="function"&&oe.length!=1&&(G=ae=!1);var ye=this.__chain__,Ie=!!this.__actions__.length,Ve=R&&!ye,st=G&&!Ie;if(!R&&ae){N=st?N:new gt(this);var We=r.apply(N,B);return We.__actions__.push({func:Va,args:[he],thisArg:t}),new Zn(We,ye)}return Ve&&st?r.apply(this,B):(We=this.thru(he),Ve?g?We.value()[0]:We.value():We)})}),jn(["pop","push","shift","sort","splice","unshift"],function(r){var a=ma[r],u=/^(?:push|sort|unshift)$/.test(r)?"tap":"thru",g=/^(?:pop|shift)$/.test(r);A.prototype[r]=function(){var S=arguments;if(g&&!this.__chain__){var R=this.value();return a.apply(tt(R)?R:[],S)}return this[u](function(N){return a.apply(tt(N)?N:[],S)})}}),Ti(gt.prototype,function(r,a){var u=A[a];if(u){var g=u.name+"";Lt.call(ms,g)||(ms[g]=[]),ms[g].push({name:a,func:u})}}),ms[Oa(t,_).name]=[{name:"wrapper",func:t}],gt.prototype.clone=M0,gt.prototype.reverse=E0,gt.prototype.value=T0,A.prototype.at=Qx,A.prototype.chain=ey,A.prototype.commit=ty,A.prototype.next=ny,A.prototype.plant=ry,A.prototype.reverse=sy,A.prototype.toJSON=A.prototype.valueOf=A.prototype.value=oy,A.prototype.first=A.prototype.head,yo&&(A.prototype[yo]=iy),A},fs=t0();Dr?((Dr.exports=fs)._=fs,il._=fs):fn._=fs}).call(UC)}(Yo,Yo.exports)),Yo.exports}var OC=NC();const Ks=class Ks{constructor(e,t,n,i){this.registered=new Map,this.listeners=new Map,this._id=LC(),this.renderer=e,this.scene=t,this.controller=n,this.toolbox=i,this._mediaGenerator=null,this._io=null,this._ar=null,Ks.__instances.push(this)}static get(e){const t=this.__instances.find(n=>n.id===e);return t||this.__instances.find(n=>Array.from(n.registered.values()).find(i=>i.id===e))}get id(){return this._id}get mediaGenerator(){return this._mediaGenerator?Promise.resolve(this._mediaGenerator):new Promise((e,t)=>{Promise.resolve().then(()=>require("./MediaCreator-BqLcaXbl.cjs")).then(n=>{const i=n.DIVEMediaCreator;this._mediaGenerator=new i(this.renderer,this.scene,this.controller),e(this._mediaGenerator)}).catch(n=>{console.error("DIVE: Error while lazy-loading IO module:",n),t(n)})})}get io(){return this._io?Promise.resolve(this._io):new Promise((e,t)=>{Promise.resolve().then(()=>require("./IO-BTWL9Zfp.cjs")).then(n=>{const i=n.DIVEIO;this._io=new i(this.scene),e(this._io)}).catch(n=>{console.error("DIVE: Error while lazy-loading IO module:",n),t(n)})})}get ar(){return this._ar?Promise.resolve(this._ar):new Promise((e,t)=>{Promise.resolve().then(()=>require("./AR-ySzrfSW3.cjs")).then(n=>{const i=n.DIVEAR;this._ar=new i(this.renderer,this.scene,this.controller),e(this._ar)}).catch(n=>{console.error("DIVE: Error while lazy-loading AR module:",n),t(n)})})}DestroyInstance(){const e=Ks.__instances.findIndex(t=>t.id===this.id);return e===-1?!1:(Ks.__instances.splice(e,1),!0)}PerformAction(e,t){let n=!1;switch(e){case"GET_ALL_SCENE_DATA":{n=this.getAllSceneData(t);break}case"GET_ALL_OBJECTS":{n=this.getAllObjects(t);break}case"GET_OBJECTS":{n=this.getObjects(t);break}case"ADD_OBJECT":{n=this.addObject(t);break}case"UPDATE_OBJECT":{n=this.updateObject(t);break}case"DELETE_OBJECT":{n=this.deleteObject(t);break}case"SELECT_OBJECT":{n=this.selectObject(t);break}case"DESELECT_OBJECT":{n=this.deselectObject(t);break}case"SET_BACKGROUND":{n=this.setBackground(t);break}case"DROP_IT":{n=this.dropIt(t);break}case"PLACE_ON_FLOOR":{n=this.placeOnFloor(t);break}case"SET_CAMERA_TRANSFORM":{n=this.setCameraTransform(t);break}case"GET_CAMERA_TRANSFORM":{n=this.getCameraTransform(t);break}case"MOVE_CAMERA":{n=this.moveCamera(t);break}case"RESET_CAMERA":{n=this.resetCamera(t);break}case"COMPUTE_ENCOMPASSING_VIEW":{n=this.computeEncompassingView(t);break}case"SET_CAMERA_LAYER":{n=this.setCameraLayer(t);break}case"ZOOM_CAMERA":{n=this.zoomCamera(t);break}case"SET_GIZMO_MODE":{n=this.setGizmoMode(t);break}case"SET_GIZMO_VISIBILITY":{n=this.setGizmoVisibility(t);break}case"SET_GIZMO_SCALE_LINKED":{n=this.setGizmoScaleLinked(t);break}case"USE_TOOL":{n=this.useTool(t);break}case"MODEL_LOADED":{n=this.modelLoaded(t);break}case"UPDATE_SCENE":{n=this.updateScene(t);break}case"GENERATE_MEDIA":{n=this.generateMedia(t);break}case"SET_PARENT":{n=this.setParent(t);break}case"EXPORT_SCENE":{n=this.exportScene(t);break}case"LAUNCH_AR":{n=new Promise((i,o)=>{this.ar.then(c=>{i(c.Launch(t))}).catch(o)});break}default:console.warn(`DIVECommunication.PerformAction: has been executed with unknown Action type ${e}`)}return this.dispatch(e,t),n}Subscribe(e,t){return this.listeners.get(e)||this.listeners.set(e,[]),this.listeners.get(e).push(t),()=>{const n=this.listeners.get(e);if(!n)return!1;const i=n.findIndex(o=>o===t);return i===-1?!1:(n.splice(i,1),!0)}}dispatch(e,t){const n=this.listeners.get(e);n&&n.forEach(i=>i(t))}getAllSceneData(e){const t={name:this.scene.name,mediaItem:null,backgroundColor:"#"+this.scene.background.getHexString(),floorEnabled:this.scene.Floor.visible,floorColor:"#"+this.scene.Floor.material.color.getHexString(),userCamera:{position:this.controller.object.position.clone(),target:this.controller.target.clone()},spotmarks:[],lights:Array.from(this.registered.values()).filter(n=>n.entityType==="light"),objects:Array.from(this.registered.values()).filter(n=>n.entityType==="model"),cameras:Array.from(this.registered.values()).filter(n=>n.entityType==="pov"),primitives:Array.from(this.registered.values()).filter(n=>n.entityType==="primitive"),groups:Array.from(this.registered.values()).filter(n=>n.entityType==="group")};return Object.assign(e,t),t}getAllObjects(e){return Object.assign(e,this.registered),this.registered}getObjects(e){if(e.ids.length===0)return[];const t=[];return this.registered.forEach(n=>{e.ids.includes(n.id)&&t.push(n)}),t}addObject(e){return this.registered.get(e.id)?!1:(e.parentId===void 0&&(e.parentId=null),this.registered.set(e.id,e),this.scene.AddSceneObject(e),!0)}updateObject(e){const t=this.registered.get(e.id);if(!t)return!1;this.registered.set(e.id,OC.merge(t,e));const n=this.registered.get(e.id);return this.scene.UpdateSceneObject({...e,id:n.id,entityType:n.entityType}),Object.assign(e,n),!0}deleteObject(e){const t=this.registered.get(e.id);return t?(t.parentId&&this.setParent({object:{id:t.id},parent:null}),t.entityType==="group"&&this.registered.forEach(n=>{n.parentId===t.id&&this.updateObject({id:n.id,parentId:null})}),Object.assign(e,t),this.registered.delete(e.id),Array.from(this.registered.values()).forEach(n=>{n.parentId&&n.parentId===e.id&&(n.parentId=null)}),this.scene.DeleteSceneObject(t),!0):!1}selectObject(e){const t=this.registered.get(e.id);if(!t)return!1;const n=this.scene.GetSceneObject(t);if(!n||!("isSelectable"in n))return!1;const i=this.toolbox.GetActiveTool();return i&&Km(i)&&i.AttachGizmo(n),Object.assign(e,t),!0}deselectObject(e){const t=this.registered.get(e.id);if(!t)return!1;const n=this.scene.GetSceneObject(t);if(!n||!("isSelectable"in n))return!1;const i=this.toolbox.GetActiveTool();return i&&Km(i)&&i.DetachGizmo(),Object.assign(e,t),!0}setBackground(e){return this.scene.SetBackground(e.color),!0}dropIt(e){const t=this.registered.get(e.id);return t?(this.scene.GetSceneObject(t).DropIt(),!0):!1}placeOnFloor(e){const t=this.registered.get(e.id);return t?(this.scene.PlaceOnFloor(t),!0):!1}setCameraTransform(e){return this.controller.object.position.copy(e.position),this.controller.target.copy(e.target),this.controller.update(),!0}getCameraTransform(e){const t={position:this.controller.object.position.clone(),target:this.controller.target.clone()};return Object.assign(e,t),t}moveCamera(e){let t={x:0,y:0,z:0},n={x:0,y:0,z:0};return"id"in e?(t=this.registered.get(e.id).position,n=this.registered.get(e.id).target):(t=e.position,n=e.target),this.controller.MoveTo(t,n,e.duration,e.locked),!0}setCameraLayer(e){return this.controller.object.SetCameraLayer(e.layer),!0}resetCamera(e){return this.controller.RevertLast(e.duration),!0}computeEncompassingView(e){const t=this.scene.ComputeSceneBB(),n=this.controller.ComputeEncompassingView(t);return Object.assign(e,n),n}zoomCamera(e){return e.direction==="IN"&&this.controller.ZoomIn(e.by),e.direction==="OUT"&&this.controller.ZoomOut(e.by),!0}setGizmoMode(e){return this.toolbox.SetGizmoMode(e.mode),!0}setGizmoVisibility(e){return this.toolbox.SetGizmoVisibility(e),e}setGizmoScaleLinked(e){return this.toolbox.SetGizmoScaleLinked(e),e}useTool(e){return this.toolbox.UseTool(e.tool),!0}modelLoaded(e){return this.registered.get(e.id).loaded=!0,!0}updateScene(e){return e.name!==void 0&&(this.scene.name=e.name),e.backgroundColor!==void 0&&this.scene.SetBackground(e.backgroundColor),e.gridEnabled!==void 0&&this.scene.Grid.SetVisibility(e.gridEnabled),e.floorEnabled!==void 0&&this.scene.Floor.SetVisibility(e.floorEnabled),e.floorColor!==void 0&&this.scene.Floor.SetColor(e.floorColor),e.name=this.scene.name,e.backgroundColor="#"+this.scene.background.getHexString(),e.gridEnabled=this.scene.Grid.visible,e.floorEnabled=this.scene.Floor.visible,e.floorColor="#"+this.scene.Floor.material.color.getHexString(),!0}generateMedia(e){let t={x:0,y:0,z:0},n={x:0,y:0,z:0};return"id"in e?(t=this.registered.get(e.id).position,n=this.registered.get(e.id).target):(t=e.position,n=e.target),this.mediaGenerator.then(i=>i.GenerateMedia(t,n,e.width,e.height))}setParent(e){const t=this.registered.get(e.object.id);if(!t)return!1;const n=this.scene.GetSceneObject(t);if(!n)return!1;if(e.parent===null)return this.scene.Root.attach(n),this.updateObject({id:t.id,parentId:null}),!0;if(e.object.id===e.parent.id)return!1;const i=this.registered.get(e.parent.id);if(!i)return this.scene.Root.attach(n),this.updateObject({id:t.id,parentId:null}),!0;const o=this.scene.GetSceneObject(i);return o?(o.attach(n),this.updateObject({id:t.id,parentId:i.id}),!0):(this.scene.Root.attach(n),this.updateObject({id:t.id,parentId:null}),!0)}exportScene(e){return new Promise((t,n)=>{this.io.then(i=>{t(i.Export(e.type))}).catch(n)})}};Ks.__instances=[];let On=Ks;class FC extends St{constructor(){super(),this.isDIVELight=!0,this.isDIVEPointLight=!0,this.isMovable=!0,this.isSelectable=!0,this.gizmo=null,this.name="DIVEPointLight",this.light=new Zg(16777215,1),this.light.layers.mask=si,this.light.castShadow=!0,this.light.shadow.mapSize.width=512,this.light.shadow.mapSize.height=512,this.add(this.light);const e=.1,t=new Kc(e,e*320,e*320),n=new nr({color:this.light.color,transparent:!0,opacity:.8,side:Li});this.mesh=new un(t,n),this.mesh.layers.mask=$g,this.add(this.mesh)}SetColor(e){this.light.color=e,this.mesh.material.color=e}SetIntensity(e){this.light.intensity=e,this.mesh.material.opacity=e>.8?.8:e*.8}SetEnabled(e){this.light.visible=e}onMove(){var e;(e=On.get(this.userData.id))==null||e.PerformAction("UPDATE_OBJECT",{id:this.userData.id,position:this.position})}onSelect(){var e;(e=On.get(this.userData.id))==null||e.PerformAction("SELECT_OBJECT",{id:this.userData.id})}onDeselect(){var e;(e=On.get(this.userData.id))==null||e.PerformAction("DESELECT_OBJECT",{id:this.userData.id})}}class BC extends St{constructor(){super(),this.isDIVELight=!0,this.isDIVESceneLight=!0,this.name="DIVESceneLight",this._hemiLight=new cC(16777215,16777215,2),this._hemiLight.layers.mask=si,this._hemiLight.position.set(0,50,0),this.add(this._hemiLight),this._dirLight=new Ch(16777215,3),this._dirLight.layers.mask=si,this._dirLight.position.set(1,1.75,1),this._dirLight.position.multiplyScalar(30),this._dirLight.castShadow=!0,this._dirLight.shadow.mapSize.width=2048,this._dirLight.shadow.mapSize.height=2048;const e=5;this._dirLight.shadow.camera.left=-5,this._dirLight.shadow.camera.right=e,this._dirLight.shadow.camera.top=e,this._dirLight.shadow.camera.bottom=-5,this._dirLight.shadow.camera.far=3500,this.add(this._dirLight)}SetColor(e){this._hemiLight.color=e,this._dirLight.color=e}SetIntensity(e){this._hemiLight.intensity=e*2,this._dirLight.intensity=e*3}SetEnabled(e){this._hemiLight.visible=e,this._dirLight.visible=e}}const Uh=s=>s.parent?Uh(s.parent):s;class Nh extends St{constructor(){super(),this.isDIVENode=!0,this.isSelectable=!0,this.isMovable=!0,this.gizmo=null,this.layers.mask=si,this._positionWorldBuffer=new F,this._boundingBox=new yi}SetPosition(e){if(!this.parent){this.position.set(e.x,e.y,e.z);return}const t=new F(e.x,e.y,e.z);this.position.copy(this.parent.worldToLocal(t)),"isDIVEGroup"in this.parent&&this.parent.UpdateLineTo(this)}SetRotation(e){this.rotation.set(e.x,e.y,e.z)}SetScale(e){this.scale.set(e.x,e.y,e.z)}SetVisibility(e){this.visible=e}SetToWorldOrigin(){var e;this.position.set(0,0,0),(e=On.get(this.userData.id))==null||e.PerformAction("UPDATE_OBJECT",{id:this.userData.id,position:this.getWorldPosition(this._positionWorldBuffer),rotation:this.rotation,scale:this.scale})}onMove(){var e;(e=On.get(this.userData.id))==null||e.PerformAction("UPDATE_OBJECT",{id:this.userData.id,position:this.getWorldPosition(this._positionWorldBuffer),rotation:this.rotation,scale:this.scale})}onSelect(){var e;(e=On.get(this.userData.id))==null||e.PerformAction("SELECT_OBJECT",{id:this.userData.id})}onDeselect(){var e;(e=On.get(this.userData.id))==null||e.PerformAction("DESELECT_OBJECT",{id:this.userData.id})}}class kC extends Nh{constructor(){super(...arguments),this.isDIVEModel=!0,this._mesh=null,this._material=null}SetModel(e){this.clear(),this._boundingBox.makeEmpty(),e.scene.traverse(t=>{t.castShadow=!0,t.receiveShadow=!0,t.layers.mask=this.layers.mask,this._boundingBox.expandByObject(t),!this._mesh&&"isMesh"in t&&(this._mesh=t,this._material?this._mesh.material=this._material:this._material=t.material)}),this.add(e.scene)}SetMaterial(e){this._material||(this._material=new uo),e.vertexColors!==void 0&&(this._material.vertexColors=e.vertexColors),e.color!==void 0&&this._material.color.set(e.color),e.map!==void 0&&(this._material.map=e.map),e.normalMap!==void 0&&(this._material.normalMap=e.normalMap),e.roughness!==void 0&&(this._material.roughness=e.roughness),e.roughnessMap!==void 0&&(this._material.roughnessMap=e.roughnessMap,this._material.roughnessMap&&(this._material.roughness=1)),e.metalness!==void 0&&(this._material.metalness=e.metalness),e.metalnessMap!==void 0&&(this._material.metalnessMap=e.metalnessMap,this._material.metalnessMap&&(this._material.metalness=1)),this._mesh&&(this._mesh.material=this._material)}PlaceOnFloor(){var i,o,c,l,h;const e=this.getWorldPosition(this._positionWorldBuffer),t=e.clone();(o=(i=this._mesh)==null?void 0:i.geometry)==null||o.computeBoundingBox();const n=(l=(c=this._mesh)==null?void 0:c.geometry)==null?void 0:l.boundingBox;!n||!this._mesh||(e.y=e.y-this._mesh.localToWorld(n.min.clone()).y,e.y!==t.y&&((h=On.get(this.userData.id))==null||h.PerformAction("UPDATE_OBJECT",{id:this.userData.id,position:e,rotation:this.rotation,scale:this.scale})))}DropIt(){if(!this.parent){console.warn("DIVEModel: DropIt() called on a model that is not in the scene.",this);return}const e=this._boundingBox.min.y*this.scale.y,t=this.localToWorld(this._boundingBox.getCenter(new F).multiply(this.scale));t.y=e+this.position.y;const n=new Dh(t,new F(0,-1,0));n.layers.mask=si;const i=n.intersectObjects(Uh(this).Root.children,!0);if(i.length>0){const o=i[0].object;o.geometry.computeBoundingBox();const c=o.geometry.boundingBox,l=o.localToWorld(c.max.clone()),h=this.position.clone(),f=this.position.clone().setY(l.y).sub(new F(0,e,0));if(this.position.copy(f),this.position.y===h.y)return;this.onMove()}}}const Xu=new WeakMap;class zC extends os{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,n,i){const o=new Bc(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,c=>{this.parse(c,t,i)},n,i)}parse(e,t,n=()=>{}){this.decodeDracoFile(e,t,null,null,nn).catch(n)}decodeDracoFile(e,t,n,i,o=hn,c=()=>{}){const l={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:o};return this.decodeGeometry(e,l).then(t).catch(c)}decodeGeometry(e,t){const n=JSON.stringify(t);if(Xu.has(e)){const h=Xu.get(e);if(h.key===n)return h.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const o=this.workerNextTaskID++,c=e.byteLength,l=this._getWorker(o,c).then(h=>(i=h,new Promise((f,d)=>{i._callbacks[o]={resolve:f,reject:d},i.postMessage({type:"decode",id:o,taskConfig:t,buffer:e},[e])}))).then(h=>this._createGeometry(h.geometry));return l.catch(()=>!0).then(()=>{i&&o&&this._releaseTask(i,o)}),Xu.set(e,{key:n,promise:l}),l}_createGeometry(e){const t=new on;e.index&&t.setIndex(new Qt(e.index.array,1));for(let n=0;n<e.attributes.length;n++){const i=e.attributes[n],o=i.name,c=i.array,l=i.itemSize,h=new Qt(c,l);o==="color"&&(this._assignVertexColorSpace(h,i.vertexColorSpace),h.normalized=!(c instanceof Float32Array)),t.setAttribute(o,h)}return t}_assignVertexColorSpace(e,t){if(t!==nn)return;const n=new De;for(let i=0,o=e.count;i<o;i++)n.fromBufferAttribute(e,i).convertSRGBToLinear(),e.setXYZ(i,n.r,n.g,n.b)}_loadLibrary(e,t){const n=new Bc(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((i,o)=>{n.load(e,i,void 0,o)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(n=>{const i=n[0];e||(this.decoderConfig.wasmBinary=n[1]);const o=HC.toString(),c=["/* draco decoder */",i,"","/* worker */",o.substring(o.indexOf("{")+1,o.lastIndexOf("}"))].join(`
|
|
3824
3824
|
`);this.workerSourceURL=URL.createObjectURL(new Blob([c]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const i=new Worker(this.workerSourceURL);i._callbacks={},i._taskCosts={},i._taskLoad=0,i.postMessage({type:"init",decoderConfig:this.decoderConfig}),i.onmessage=function(o){const c=o.data;switch(c.type){case"decode":i._callbacks[c.id].resolve(c);break;case"error":i._callbacks[c.id].reject(c);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+c.type+'"')}},this.workerPool.push(i)}else this.workerPool.sort(function(i,o){return i._taskLoad>o._taskLoad?-1:1});const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}function HC(){let s,e;onmessage=function(c){const l=c.data;switch(l.type){case"init":s=l.decoderConfig,e=new Promise(function(d){s.onModuleLoaded=function(p){d({draco:p})},DracoDecoderModule(s)});break;case"decode":const h=l.buffer,f=l.taskConfig;e.then(d=>{const p=d.draco,m=new p.Decoder;try{const v=t(p,m,new Int8Array(h),f),M=v.attributes.map(E=>E.array.buffer);v.index&&M.push(v.index.array.buffer),self.postMessage({type:"decode",id:l.id,geometry:v},M)}catch(v){console.error(v),self.postMessage({type:"error",id:l.id,error:v.message})}finally{p.destroy(m)}});break}};function t(c,l,h,f){const d=f.attributeIDs,p=f.attributeTypes;let m,v;const M=l.GetEncodedGeometryType(h);if(M===c.TRIANGULAR_MESH)m=new c.Mesh,v=l.DecodeArrayToMesh(h,h.byteLength,m);else if(M===c.POINT_CLOUD)m=new c.PointCloud,v=l.DecodeArrayToPointCloud(h,h.byteLength,m);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!v.ok()||m.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+v.error_msg());const E={index:null,attributes:[]};for(const x in d){const _=self[p[x]];let P,T;if(f.useUniqueIDs)T=d[x],P=l.GetAttributeByUniqueId(m,T);else{if(T=l.GetAttributeId(m,c[d[x]]),T===-1)continue;P=l.GetAttribute(m,T)}const I=i(c,l,m,x,_,P);x==="color"&&(I.vertexColorSpace=f.vertexColorSpace),E.attributes.push(I)}return M===c.TRIANGULAR_MESH&&(E.index=n(c,l,m)),c.destroy(m),E}function n(c,l,h){const d=h.num_faces()*3,p=d*4,m=c._malloc(p);l.GetTrianglesUInt32Array(h,p,m);const v=new Uint32Array(c.HEAPF32.buffer,m,d).slice();return c._free(m),{array:v,itemSize:1}}function i(c,l,h,f,d,p){const m=p.num_components(),M=h.num_points()*m,E=M*d.BYTES_PER_ELEMENT,x=o(c,d),_=c._malloc(E);l.GetAttributeDataArrayForAllPoints(h,p,x,E,_);const P=new d(c.HEAPF32.buffer,_,M).slice();return c._free(_),{name:f,array:P,itemSize:m}}function o(c,l){switch(l){case Float32Array:return c.DT_FLOAT32;case Int8Array:return c.DT_INT8;case Int16Array:return c.DT_INT16;case Int32Array:return c.DT_INT32;case Uint8Array:return c.DT_UINT8;case Uint16Array:return c.DT_UINT16;case Uint32Array:return c.DT_UINT32}}}function $m(s,e){if(e===nT)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),s;if(e===th||e===yg){let t=s.getIndex();if(t===null){const c=[],l=s.getAttribute("position");if(l!==void 0){for(let h=0;h<l.count;h++)c.push(h);s.setIndex(c),t=s.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),s}const n=t.count-2,i=[];if(e===th)for(let c=1;c<=n;c++)i.push(t.getX(0)),i.push(t.getX(c)),i.push(t.getX(c+1));else for(let c=0;c<n;c++)c%2===0?(i.push(t.getX(c)),i.push(t.getX(c+1)),i.push(t.getX(c+2))):(i.push(t.getX(c+2)),i.push(t.getX(c+1)),i.push(t.getX(c)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const o=s.clone();return o.setIndex(i),o.clearGroups(),o}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),s}class n_ extends os{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new qC(t)}),this.register(function(t){return new tL(t)}),this.register(function(t){return new nL(t)}),this.register(function(t){return new iL(t)}),this.register(function(t){return new jC(t)}),this.register(function(t){return new KC(t)}),this.register(function(t){return new ZC(t)}),this.register(function(t){return new $C(t)}),this.register(function(t){return new XC(t)}),this.register(function(t){return new JC(t)}),this.register(function(t){return new YC(t)}),this.register(function(t){return new eL(t)}),this.register(function(t){return new QC(t)}),this.register(function(t){return new VC(t)}),this.register(function(t){return new rL(t)}),this.register(function(t){return new sL(t)})}load(e,t,n,i){const o=this;let c;if(this.resourcePath!=="")c=this.resourcePath;else if(this.path!==""){const f=Qo.extractUrlBase(e);c=Qo.resolveURL(f,this.path)}else c=Qo.extractUrlBase(e);this.manager.itemStart(e);const l=function(f){i?i(f):console.error(f),o.manager.itemError(e),o.manager.itemEnd(e)},h=new Bc(this.manager);h.setPath(this.path),h.setResponseType("arraybuffer"),h.setRequestHeader(this.requestHeader),h.setWithCredentials(this.withCredentials),h.load(e,function(f){try{o.parse(f,c,function(d){t(d),o.manager.itemEnd(e)},l)}catch(d){l(d)}},n,l)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,i){let o;const c={},l={},h=new TextDecoder;if(typeof e=="string")o=JSON.parse(e);else if(e instanceof ArrayBuffer)if(h.decode(new Uint8Array(e,0,4))===i_){try{c[_t.KHR_BINARY_GLTF]=new oL(e)}catch(p){i&&i(p);return}o=JSON.parse(c[_t.KHR_BINARY_GLTF].content)}else o=JSON.parse(h.decode(e));else o=e;if(o.asset===void 0||o.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const f=new xL(o,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});f.fileLoader.setRequestHeader(this.requestHeader);for(let d=0;d<this.pluginCallbacks.length;d++){const p=this.pluginCallbacks[d](f);p.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),l[p.name]=p,c[p.name]=!0}if(o.extensionsUsed)for(let d=0;d<o.extensionsUsed.length;++d){const p=o.extensionsUsed[d],m=o.extensionsRequired||[];switch(p){case _t.KHR_MATERIALS_UNLIT:c[p]=new WC;break;case _t.KHR_DRACO_MESH_COMPRESSION:c[p]=new aL(o,this.dracoLoader);break;case _t.KHR_TEXTURE_TRANSFORM:c[p]=new cL;break;case _t.KHR_MESH_QUANTIZATION:c[p]=new lL;break;default:m.indexOf(p)>=0&&l[p]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+p+'".')}}f.setExtensions(c),f.setPlugins(l),f.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,o){n.parse(e,t,i,o)})}}function GC(){let s={};return{get:function(e){return s[e]},add:function(e,t){s[e]=t},remove:function(e){delete s[e]},removeAll:function(){s={}}}}const _t={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class VC{constructor(e){this.parser=e,this.name=_t.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){const o=t[n];o.extensions&&o.extensions[this.name]&&o.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,o.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let i=t.cache.get(n);if(i)return i;const o=t.json,h=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e];let f;const d=new De(16777215);h.color!==void 0&&d.setRGB(h.color[0],h.color[1],h.color[2],hn);const p=h.range!==void 0?h.range:0;switch(h.type){case"directional":f=new Ch(d),f.target.position.set(0,0,-1),f.add(f.target);break;case"point":f=new Zg(d),f.distance=p;break;case"spot":f=new uC(d),f.distance=p,h.spot=h.spot||{},h.spot.innerConeAngle=h.spot.innerConeAngle!==void 0?h.spot.innerConeAngle:0,h.spot.outerConeAngle=h.spot.outerConeAngle!==void 0?h.spot.outerConeAngle:Math.PI/4,f.angle=h.spot.outerConeAngle,f.penumbra=1-h.spot.innerConeAngle/h.spot.outerConeAngle,f.target.position.set(0,0,-1),f.add(f.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+h.type)}return f.position.set(0,0,0),f.decay=2,Ar(f,h),h.intensity!==void 0&&(f.intensity=h.intensity),f.name=t.createUniqueName(h.name||"light_"+e),i=Promise.resolve(f),t.cache.add(n,i),i}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,o=n.json.nodes[e],l=(o.extensions&&o.extensions[this.name]||{}).light;return l===void 0?null:this._loadLight(l).then(function(h){return n._getNodeRef(t.cache,l,h)})}}class WC{constructor(){this.name=_t.KHR_MATERIALS_UNLIT}getMaterialType(){return nr}extendParams(e,t,n){const i=[];e.color=new De(1,1,1),e.opacity=1;const o=t.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){const c=o.baseColorFactor;e.color.setRGB(c[0],c[1],c[2],hn),e.opacity=c[3]}o.baseColorTexture!==void 0&&i.push(n.assignTexture(e,"map",o.baseColorTexture,nn))}return Promise.all(i)}}class XC{constructor(e){this.parser=e,this.name=_t.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=i.extensions[this.name].emissiveStrength;return o!==void 0&&(t.emissiveIntensity=o),Promise.resolve()}}class qC{constructor(e){this.parser=e,this.name=_t.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:or}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],c=i.extensions[this.name];if(c.clearcoatFactor!==void 0&&(t.clearcoat=c.clearcoatFactor),c.clearcoatTexture!==void 0&&o.push(n.assignTexture(t,"clearcoatMap",c.clearcoatTexture)),c.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=c.clearcoatRoughnessFactor),c.clearcoatRoughnessTexture!==void 0&&o.push(n.assignTexture(t,"clearcoatRoughnessMap",c.clearcoatRoughnessTexture)),c.clearcoatNormalTexture!==void 0&&(o.push(n.assignTexture(t,"clearcoatNormalMap",c.clearcoatNormalTexture)),c.clearcoatNormalTexture.scale!==void 0)){const l=c.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new Ne(l,l)}return Promise.all(o)}}class YC{constructor(e){this.parser=e,this.name=_t.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:or}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],c=i.extensions[this.name];return c.iridescenceFactor!==void 0&&(t.iridescence=c.iridescenceFactor),c.iridescenceTexture!==void 0&&o.push(n.assignTexture(t,"iridescenceMap",c.iridescenceTexture)),c.iridescenceIor!==void 0&&(t.iridescenceIOR=c.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),c.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=c.iridescenceThicknessMinimum),c.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=c.iridescenceThicknessMaximum),c.iridescenceThicknessTexture!==void 0&&o.push(n.assignTexture(t,"iridescenceThicknessMap",c.iridescenceThicknessTexture)),Promise.all(o)}}class jC{constructor(e){this.parser=e,this.name=_t.KHR_MATERIALS_SHEEN}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:or}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[];t.sheenColor=new De(0,0,0),t.sheenRoughness=0,t.sheen=1;const c=i.extensions[this.name];if(c.sheenColorFactor!==void 0){const l=c.sheenColorFactor;t.sheenColor.setRGB(l[0],l[1],l[2],hn)}return c.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=c.sheenRoughnessFactor),c.sheenColorTexture!==void 0&&o.push(n.assignTexture(t,"sheenColorMap",c.sheenColorTexture,nn)),c.sheenRoughnessTexture!==void 0&&o.push(n.assignTexture(t,"sheenRoughnessMap",c.sheenRoughnessTexture)),Promise.all(o)}}class KC{constructor(e){this.parser=e,this.name=_t.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:or}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],c=i.extensions[this.name];return c.transmissionFactor!==void 0&&(t.transmission=c.transmissionFactor),c.transmissionTexture!==void 0&&o.push(n.assignTexture(t,"transmissionMap",c.transmissionTexture)),Promise.all(o)}}class ZC{constructor(e){this.parser=e,this.name=_t.KHR_MATERIALS_VOLUME}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:or}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],c=i.extensions[this.name];t.thickness=c.thicknessFactor!==void 0?c.thicknessFactor:0,c.thicknessTexture!==void 0&&o.push(n.assignTexture(t,"thicknessMap",c.thicknessTexture)),t.attenuationDistance=c.attenuationDistance||1/0;const l=c.attenuationColor||[1,1,1];return t.attenuationColor=new De().setRGB(l[0],l[1],l[2],hn),Promise.all(o)}}class $C{constructor(e){this.parser=e,this.name=_t.KHR_MATERIALS_IOR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:or}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=i.extensions[this.name];return t.ior=o.ior!==void 0?o.ior:1.5,Promise.resolve()}}class JC{constructor(e){this.parser=e,this.name=_t.KHR_MATERIALS_SPECULAR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:or}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],c=i.extensions[this.name];t.specularIntensity=c.specularFactor!==void 0?c.specularFactor:1,c.specularTexture!==void 0&&o.push(n.assignTexture(t,"specularIntensityMap",c.specularTexture));const l=c.specularColorFactor||[1,1,1];return t.specularColor=new De().setRGB(l[0],l[1],l[2],hn),c.specularColorTexture!==void 0&&o.push(n.assignTexture(t,"specularColorMap",c.specularColorTexture,nn)),Promise.all(o)}}class QC{constructor(e){this.parser=e,this.name=_t.EXT_MATERIALS_BUMP}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:or}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],c=i.extensions[this.name];return t.bumpScale=c.bumpFactor!==void 0?c.bumpFactor:1,c.bumpTexture!==void 0&&o.push(n.assignTexture(t,"bumpMap",c.bumpTexture)),Promise.all(o)}}class eL{constructor(e){this.parser=e,this.name=_t.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:or}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const o=[],c=i.extensions[this.name];return c.anisotropyStrength!==void 0&&(t.anisotropy=c.anisotropyStrength),c.anisotropyRotation!==void 0&&(t.anisotropyRotation=c.anisotropyRotation),c.anisotropyTexture!==void 0&&o.push(n.assignTexture(t,"anisotropyMap",c.anisotropyTexture)),Promise.all(o)}}class tL{constructor(e){this.parser=e,this.name=_t.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const o=i.extensions[this.name],c=t.options.ktx2Loader;if(!c){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,o.source,c)}}class nL{constructor(e){this.parser=e,this.name=_t.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,o=i.textures[e];if(!o.extensions||!o.extensions[t])return null;const c=o.extensions[t],l=i.images[c.source];let h=n.textureLoader;if(l.uri){const f=n.options.manager.getHandler(l.uri);f!==null&&(h=f)}return this.detectSupport().then(function(f){if(f)return n.loadTextureImage(e,c.source,h);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class iL{constructor(e){this.parser=e,this.name=_t.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,o=i.textures[e];if(!o.extensions||!o.extensions[t])return null;const c=o.extensions[t],l=i.images[c.source];let h=n.textureLoader;if(l.uri){const f=n.options.manager.getHandler(l.uri);f!==null&&(h=f)}return this.detectSupport().then(function(f){if(f)return n.loadTextureImage(e,c.source,h);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class rL{constructor(e){this.name=_t.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const i=n.extensions[this.name],o=this.parser.getDependency("buffer",i.buffer),c=this.parser.options.meshoptDecoder;if(!c||!c.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return o.then(function(l){const h=i.byteOffset||0,f=i.byteLength||0,d=i.count,p=i.byteStride,m=new Uint8Array(l,h,f);return c.decodeGltfBufferAsync?c.decodeGltfBufferAsync(d,p,m,i.mode,i.filter).then(function(v){return v.buffer}):c.ready.then(function(){const v=new ArrayBuffer(d*p);return c.decodeGltfBuffer(new Uint8Array(v),d,p,m,i.mode,i.filter),v})})}else return null}}class sL{constructor(e){this.name=_t.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const i=t.meshes[n.mesh];for(const f of i.primitives)if(f.mode!==ni.TRIANGLES&&f.mode!==ni.TRIANGLE_STRIP&&f.mode!==ni.TRIANGLE_FAN&&f.mode!==void 0)return null;const c=n.extensions[this.name].attributes,l=[],h={};for(const f in c)l.push(this.parser.getDependency("accessor",c[f]).then(d=>(h[f]=d,h[f])));return l.length<1?null:(l.push(this.parser.createNodeMesh(e)),Promise.all(l).then(f=>{const d=f.pop(),p=d.isGroup?d.children:[d],m=f[0].count,v=[];for(const M of p){const E=new Je,x=new F,_=new xi,P=new F(1,1,1),T=new H1(M.geometry,M.material,m);for(let I=0;I<m;I++)h.TRANSLATION&&x.fromBufferAttribute(h.TRANSLATION,I),h.ROTATION&&_.fromBufferAttribute(h.ROTATION,I),h.SCALE&&P.fromBufferAttribute(h.SCALE,I),T.setMatrixAt(I,E.compose(x,_,P));for(const I in h)if(I==="_COLOR_0"){const k=h[I];T.instanceColor=new rh(k.array,k.itemSize,k.normalized)}else I!=="TRANSLATION"&&I!=="ROTATION"&&I!=="SCALE"&&M.geometry.setAttribute(I,h[I]);St.prototype.copy.call(T,M),this.parser.assignFinalMaterial(T),v.push(T)}return d.isGroup?(d.clear(),d.add(...v),d):v[0]}))}}const i_="glTF",Xo=12,Jm={JSON:1313821514,BIN:5130562};class oL{constructor(e){this.name=_t.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,Xo),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==i_)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-Xo,o=new DataView(e,Xo);let c=0;for(;c<i;){const l=o.getUint32(c,!0);c+=4;const h=o.getUint32(c,!0);if(c+=4,h===Jm.JSON){const f=new Uint8Array(e,Xo+c,l);this.content=n.decode(f)}else if(h===Jm.BIN){const f=Xo+c;this.body=e.slice(f,f+l)}c+=l}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class aL{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=_t.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,i=this.dracoLoader,o=e.extensions[this.name].bufferView,c=e.extensions[this.name].attributes,l={},h={},f={};for(const d in c){const p=ah[d]||d.toLowerCase();l[p]=c[d]}for(const d in e.attributes){const p=ah[d]||d.toLowerCase();if(c[d]!==void 0){const m=n.accessors[e.attributes[d]],v=Qs[m.componentType];f[p]=v.name,h[p]=m.normalized===!0}}return t.getDependency("bufferView",o).then(function(d){return new Promise(function(p,m){i.decodeDracoFile(d,function(v){for(const M in v.attributes){const E=v.attributes[M],x=h[M];x!==void 0&&(E.normalized=x)}p(v)},l,f,hn,m)})})}}class cL{constructor(){this.name=_t.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class lL{constructor(){this.name=_t.KHR_MESH_QUANTIZATION}}class r_ extends aa{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,o=e*i*3+i;for(let c=0;c!==i;c++)t[c]=n[o+c];return t}interpolate_(e,t,n,i){const o=this.resultBuffer,c=this.sampleValues,l=this.valueSize,h=l*2,f=l*3,d=i-t,p=(n-t)/d,m=p*p,v=m*p,M=e*f,E=M-f,x=-2*v+3*m,_=v-m,P=1-x,T=_-m+p;for(let I=0;I!==l;I++){const k=c[E+I+l],O=c[E+I+h]*d,D=c[M+I+l],V=c[M+I]*d;o[I]=P*k+T*O+x*D+_*V}return o}}const uL=new xi;class hL extends r_{interpolate_(e,t,n,i){const o=super.interpolate_(e,t,n,i);return uL.fromArray(o).normalize().toArray(o),o}}const ni={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},Qs={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Qm={9728:En,9729:Pn,9984:_h,9985:Zo,9986:Ys,9987:Ri},eg={33071:er,33648:ta,10497:es},qu={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ah={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Tr={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},fL={CUBICSPLINE:void 0,LINEAR:ts,STEP:io},Yu={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function dL(s){return s.DefaultMaterial===void 0&&(s.DefaultMaterial=new uo({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Li})),s.DefaultMaterial}function jr(s,e,t){for(const n in t.extensions)s[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function Ar(s,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(s.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function pL(s,e,t){let n=!1,i=!1,o=!1;for(let f=0,d=e.length;f<d;f++){const p=e[f];if(p.POSITION!==void 0&&(n=!0),p.NORMAL!==void 0&&(i=!0),p.COLOR_0!==void 0&&(o=!0),n&&i&&o)break}if(!n&&!i&&!o)return Promise.resolve(s);const c=[],l=[],h=[];for(let f=0,d=e.length;f<d;f++){const p=e[f];if(n){const m=p.POSITION!==void 0?t.getDependency("accessor",p.POSITION):s.attributes.position;c.push(m)}if(i){const m=p.NORMAL!==void 0?t.getDependency("accessor",p.NORMAL):s.attributes.normal;l.push(m)}if(o){const m=p.COLOR_0!==void 0?t.getDependency("accessor",p.COLOR_0):s.attributes.color;h.push(m)}}return Promise.all([Promise.all(c),Promise.all(l),Promise.all(h)]).then(function(f){const d=f[0],p=f[1],m=f[2];return n&&(s.morphAttributes.position=d),i&&(s.morphAttributes.normal=p),o&&(s.morphAttributes.color=m),s.morphTargetsRelative=!0,s})}function mL(s,e){if(s.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)s.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(s.morphTargetInfluences.length===t.length){s.morphTargetDictionary={};for(let n=0,i=t.length;n<i;n++)s.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function gL(s){let e;const t=s.extensions&&s.extensions[_t.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+ju(t.attributes):e=s.indices+":"+ju(s.attributes)+":"+s.mode,s.targets!==void 0)for(let n=0,i=s.targets.length;n<i;n++)e+=":"+ju(s.targets[n]);return e}function ju(s){let e="";const t=Object.keys(s).sort();for(let n=0,i=t.length;n<i;n++)e+=t[n]+":"+s[t[n]]+";";return e}function ch(s){switch(s){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function _L(s){return s.search(/\.jpe?g($|\?)/i)>0||s.search(/^data\:image\/jpeg/)===0?"image/jpeg":s.search(/\.webp($|\?)/i)>0||s.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const vL=new Je;class xL{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new GC,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=!1,o=-1;typeof navigator<"u"&&(n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,i=navigator.userAgent.indexOf("Firefox")>-1,o=i?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||n||i&&o<98?this.textureLoader=new aC(this.options.manager):this.textureLoader=new gC(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Bc(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,o=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(c){return c._markDefs&&c._markDefs()}),Promise.all(this._invokeAll(function(c){return c.beforeRoot&&c.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(c){const l={scene:c[0][i.scene||0],scenes:c[0],animations:c[1],cameras:c[2],asset:i.asset,parser:n,userData:{}};return jr(o,l,i),Ar(l,i),Promise.all(n._invokeAll(function(h){return h.afterRoot&&h.afterRoot(l)})).then(function(){for(const h of l.scenes)h.updateMatrixWorld();e(l)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,o=t.length;i<o;i++){const c=t[i].joints;for(let l=0,h=c.length;l<h;l++)e[c[l]].isBone=!0}for(let i=0,o=e.length;i<o;i++){const c=e[i];c.mesh!==void 0&&(this._addNodeRef(this.meshCache,c.mesh),c.skin!==void 0&&(n[c.mesh].isSkinnedMesh=!0)),c.camera!==void 0&&this._addNodeRef(this.cameraCache,c.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const i=n.clone(),o=(c,l)=>{const h=this.associations.get(c);h!=null&&this.associations.set(l,h);for(const[f,d]of c.children.entries())o(d,l.children[f])};return o(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const i=e(t[n]);if(i)return i}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let i=0;i<t.length;i++){const o=e(t[i]);o&&n.push(o)}return n}getDependency(e,t){const n=e+":"+t;let i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(o){return o.loadNode&&o.loadNode(t)});break;case"mesh":i=this._invokeOne(function(o){return o.loadMesh&&o.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(o){return o.loadBufferView&&o.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(o){return o.loadMaterial&&o.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(o){return o.loadTexture&&o.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(o){return o.loadAnimation&&o.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(o){return o!=this&&o.getDependency&&o.getDependency(e,t)}),!i)throw new Error("Unknown type: "+e);break}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(i.map(function(o,c){return n.getDependency(e,c)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[_t.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(o,c){n.load(Qo.resolveURL(t.uri,i.path),o,void 0,function(){c(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(n){const i=t.byteLength||0,o=t.byteOffset||0;return n.slice(o,o+i)})}loadAccessor(e){const t=this,n=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){const c=qu[i.type],l=Qs[i.componentType],h=i.normalized===!0,f=new l(i.count*c);return Promise.resolve(new Qt(f,c,h))}const o=[];return i.bufferView!==void 0?o.push(this.getDependency("bufferView",i.bufferView)):o.push(null),i.sparse!==void 0&&(o.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),o.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(o).then(function(c){const l=c[0],h=qu[i.type],f=Qs[i.componentType],d=f.BYTES_PER_ELEMENT,p=d*h,m=i.byteOffset||0,v=i.bufferView!==void 0?n.bufferViews[i.bufferView].byteStride:void 0,M=i.normalized===!0;let E,x;if(v&&v!==p){const _=Math.floor(m/v),P="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+_+":"+i.count;let T=t.cache.get(P);T||(E=new f(l,_*v,i.count*v/d),T=new Gg(E,v/d),t.cache.add(P,T)),x=new ra(T,h,m%v/d,M)}else l===null?E=new f(i.count*h):E=new f(l,m,i.count*h),x=new Qt(E,h,M);if(i.sparse!==void 0){const _=qu.SCALAR,P=Qs[i.sparse.indices.componentType],T=i.sparse.indices.byteOffset||0,I=i.sparse.values.byteOffset||0,k=new P(c[1],T,i.sparse.count*_),O=new f(c[2],I,i.sparse.count*h);l!==null&&(x=new Qt(x.array.slice(),x.itemSize,x.normalized));for(let D=0,V=k.length;D<V;D++){const C=k[D];if(x.setX(C,O[D*h]),h>=2&&x.setY(C,O[D*h+1]),h>=3&&x.setZ(C,O[D*h+2]),h>=4&&x.setW(C,O[D*h+3]),h>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return x})}loadTexture(e){const t=this.json,n=this.options,o=t.textures[e].source,c=t.images[o];let l=this.textureLoader;if(c.uri){const h=n.manager.getHandler(c.uri);h!==null&&(l=h)}return this.loadTextureImage(e,o,l)}loadTextureImage(e,t,n){const i=this,o=this.json,c=o.textures[e],l=o.images[t],h=(l.uri||l.bufferView)+":"+c.sampler;if(this.textureCache[h])return this.textureCache[h];const f=this.loadImageSource(t,n).then(function(d){d.flipY=!1,d.name=c.name||l.name||"",d.name===""&&typeof l.uri=="string"&&l.uri.startsWith("data:image/")===!1&&(d.name=l.uri);const m=(o.samplers||{})[c.sampler]||{};return d.magFilter=Qm[m.magFilter]||Pn,d.minFilter=Qm[m.minFilter]||Ri,d.wrapS=eg[m.wrapS]||es,d.wrapT=eg[m.wrapT]||es,i.associations.set(d,{textures:e}),d}).catch(function(){return null});return this.textureCache[h]=f,f}loadImageSource(e,t){const n=this,i=this.json,o=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(p=>p.clone());const c=i.images[e],l=self.URL||self.webkitURL;let h=c.uri||"",f=!1;if(c.bufferView!==void 0)h=n.getDependency("bufferView",c.bufferView).then(function(p){f=!0;const m=new Blob([p],{type:c.mimeType});return h=l.createObjectURL(m),h});else if(c.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const d=Promise.resolve(h).then(function(p){return new Promise(function(m,v){let M=m;t.isImageBitmapLoader===!0&&(M=function(E){const x=new Zt(E);x.needsUpdate=!0,m(x)}),t.load(Qo.resolveURL(p,o.path),M,void 0,v)})}).then(function(p){return f===!0&&l.revokeObjectURL(h),p.userData.mimeType=c.mimeType||_L(c.uri),p}).catch(function(p){throw console.error("THREE.GLTFLoader: Couldn't load texture",h),p});return this.sourceCache[e]=d,d}assignTexture(e,t,n,i){const o=this;return this.getDependency("texture",n.index).then(function(c){if(!c)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(c=c.clone(),c.channel=n.texCoord),o.extensions[_t.KHR_TEXTURE_TRANSFORM]){const l=n.extensions!==void 0?n.extensions[_t.KHR_TEXTURE_TRANSFORM]:void 0;if(l){const h=o.associations.get(c);c=o.extensions[_t.KHR_TEXTURE_TRANSFORM].extendTexture(c,l),o.associations.set(c,h)}}return i!==void 0&&(c.colorSpace=i),e[t]=c,c})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=t.attributes.tangent===void 0,o=t.attributes.color!==void 0,c=t.attributes.normal===void 0;if(e.isPoints){const l="PointsMaterial:"+n.uuid;let h=this.cache.get(l);h||(h=new Yg,ri.prototype.copy.call(h,n),h.color.copy(n.color),h.map=n.map,h.sizeAttenuation=!1,this.cache.add(l,h)),n=h}else if(e.isLine){const l="LineBasicMaterial:"+n.uuid;let h=this.cache.get(l);h||(h=new oa,ri.prototype.copy.call(h,n),h.color.copy(n.color),h.map=n.map,this.cache.add(l,h)),n=h}if(i||o||c){let l="ClonedMaterial:"+n.uuid+":";i&&(l+="derivative-tangents:"),o&&(l+="vertex-colors:"),c&&(l+="flat-shading:");let h=this.cache.get(l);h||(h=n.clone(),o&&(h.vertexColors=!0),c&&(h.flatShading=!0),i&&(h.normalScale&&(h.normalScale.y*=-1),h.clearcoatNormalScale&&(h.clearcoatNormalScale.y*=-1)),this.cache.add(l,h),this.associations.set(h,this.associations.get(n))),n=h}e.material=n}getMaterialType(){return uo}loadMaterial(e){const t=this,n=this.json,i=this.extensions,o=n.materials[e];let c;const l={},h=o.extensions||{},f=[];if(h[_t.KHR_MATERIALS_UNLIT]){const p=i[_t.KHR_MATERIALS_UNLIT];c=p.getMaterialType(),f.push(p.extendParams(l,o,t))}else{const p=o.pbrMetallicRoughness||{};if(l.color=new De(1,1,1),l.opacity=1,Array.isArray(p.baseColorFactor)){const m=p.baseColorFactor;l.color.setRGB(m[0],m[1],m[2],hn),l.opacity=m[3]}p.baseColorTexture!==void 0&&f.push(t.assignTexture(l,"map",p.baseColorTexture,nn)),l.metalness=p.metallicFactor!==void 0?p.metallicFactor:1,l.roughness=p.roughnessFactor!==void 0?p.roughnessFactor:1,p.metallicRoughnessTexture!==void 0&&(f.push(t.assignTexture(l,"metalnessMap",p.metallicRoughnessTexture)),f.push(t.assignTexture(l,"roughnessMap",p.metallicRoughnessTexture))),c=this._invokeOne(function(m){return m.getMaterialType&&m.getMaterialType(e)}),f.push(Promise.all(this._invokeAll(function(m){return m.extendMaterialParams&&m.extendMaterialParams(e,l)})))}o.doubleSided===!0&&(l.side=pi);const d=o.alphaMode||Yu.OPAQUE;if(d===Yu.BLEND?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,d===Yu.MASK&&(l.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&c!==nr&&(f.push(t.assignTexture(l,"normalMap",o.normalTexture)),l.normalScale=new Ne(1,1),o.normalTexture.scale!==void 0)){const p=o.normalTexture.scale;l.normalScale.set(p,p)}if(o.occlusionTexture!==void 0&&c!==nr&&(f.push(t.assignTexture(l,"aoMap",o.occlusionTexture)),o.occlusionTexture.strength!==void 0&&(l.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&c!==nr){const p=o.emissiveFactor;l.emissive=new De().setRGB(p[0],p[1],p[2],hn)}return o.emissiveTexture!==void 0&&c!==nr&&f.push(t.assignTexture(l,"emissiveMap",o.emissiveTexture,nn)),Promise.all(f).then(function(){const p=new c(l);return o.name&&(p.name=o.name),Ar(p,o),t.associations.set(p,{materials:e}),o.extensions&&jr(i,p,o),p})}createUniqueName(e){const t=Rt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function o(l){return n[_t.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(l,t).then(function(h){return tg(h,l,t)})}const c=[];for(let l=0,h=e.length;l<h;l++){const f=e[l],d=gL(f),p=i[d];if(p)c.push(p.promise);else{let m;f.extensions&&f.extensions[_t.KHR_DRACO_MESH_COMPRESSION]?m=o(f):m=tg(new on,f,t),i[d]={primitive:f,promise:m},c.push(m)}}return Promise.all(c)}loadMesh(e){const t=this,n=this.json,i=this.extensions,o=n.meshes[e],c=o.primitives,l=[];for(let h=0,f=c.length;h<f;h++){const d=c[h].material===void 0?dL(this.cache):this.getDependency("material",c[h].material);l.push(d)}return l.push(t.loadGeometries(c)),Promise.all(l).then(function(h){const f=h.slice(0,h.length-1),d=h[h.length-1],p=[];for(let v=0,M=d.length;v<M;v++){const E=d[v],x=c[v];let _;const P=f[v];if(x.mode===ni.TRIANGLES||x.mode===ni.TRIANGLE_STRIP||x.mode===ni.TRIANGLE_FAN||x.mode===void 0)_=o.isSkinnedMesh===!0?new B1(E,P):new un(E,P),_.isSkinnedMesh===!0&&_.normalizeSkinWeights(),x.mode===ni.TRIANGLE_STRIP?_.geometry=$m(_.geometry,yg):x.mode===ni.TRIANGLE_FAN&&(_.geometry=$m(_.geometry,th));else if(x.mode===ni.LINES)_=new bh(E,P);else if(x.mode===ni.LINE_STRIP)_=new Yc(E,P);else if(x.mode===ni.LINE_LOOP)_=new G1(E,P);else if(x.mode===ni.POINTS)_=new V1(E,P);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+x.mode);Object.keys(_.geometry.morphAttributes).length>0&&mL(_,o),_.name=t.createUniqueName(o.name||"mesh_"+e),Ar(_,o),x.extensions&&jr(i,_,x),t.assignFinalMaterial(_),p.push(_)}for(let v=0,M=p.length;v<M;v++)t.associations.set(p[v],{meshes:e,primitives:v});if(p.length===1)return o.extensions&&jr(i,p[0],o),p[0];const m=new wr;o.extensions&&jr(i,m,o),t.associations.set(m,{meshes:e});for(let v=0,M=p.length;v<M;v++)m.add(p[v]);return m})}loadCamera(e){let t;const n=this.json.cameras[e],i=n[n.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new Mn(vi.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type==="orthographic"&&(t=new Xc(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),Ar(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let i=0,o=t.joints.length;i<o;i++)n.push(this._loadNodeShallow(t.joints[i]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(i){const o=i.pop(),c=i,l=[],h=[];for(let f=0,d=c.length;f<d;f++){const p=c[f];if(p){l.push(p);const m=new Je;o!==null&&m.fromArray(o.array,f*16),h.push(m)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[f])}return new Th(l,h)})}loadAnimation(e){const t=this.json,n=this,i=t.animations[e],o=i.name?i.name:"animation_"+e,c=[],l=[],h=[],f=[],d=[];for(let p=0,m=i.channels.length;p<m;p++){const v=i.channels[p],M=i.samplers[v.sampler],E=v.target,x=E.node,_=i.parameters!==void 0?i.parameters[M.input]:M.input,P=i.parameters!==void 0?i.parameters[M.output]:M.output;E.node!==void 0&&(c.push(this.getDependency("node",x)),l.push(this.getDependency("accessor",_)),h.push(this.getDependency("accessor",P)),f.push(M),d.push(E))}return Promise.all([Promise.all(c),Promise.all(l),Promise.all(h),Promise.all(f),Promise.all(d)]).then(function(p){const m=p[0],v=p[1],M=p[2],E=p[3],x=p[4],_=[];for(let P=0,T=m.length;P<T;P++){const I=m[P],k=v[P],O=M[P],D=E[P],V=x[P];if(I===void 0)continue;I.updateMatrix&&I.updateMatrix();const C=n._createAnimationTracks(I,k,O,D,V);if(C)for(let w=0;w<C.length;w++)_.push(C[w])}return new eC(o,void 0,_)})}createNodeMesh(e){const t=this.json,n=this,i=t.nodes[e];return i.mesh===void 0?null:n.getDependency("mesh",i.mesh).then(function(o){const c=n._getNodeRef(n.meshCache,i.mesh,o);return i.weights!==void 0&&c.traverse(function(l){if(l.isMesh)for(let h=0,f=i.weights.length;h<f;h++)l.morphTargetInfluences[h]=i.weights[h]}),c})}loadNode(e){const t=this.json,n=this,i=t.nodes[e],o=n._loadNodeShallow(e),c=[],l=i.children||[];for(let f=0,d=l.length;f<d;f++)c.push(n.getDependency("node",l[f]));const h=i.skin===void 0?Promise.resolve(null):n.getDependency("skin",i.skin);return Promise.all([o,Promise.all(c),h]).then(function(f){const d=f[0],p=f[1],m=f[2];m!==null&&d.traverse(function(v){v.isSkinnedMesh&&v.bind(m,vL)});for(let v=0,M=p.length;v<M;v++)d.add(p[v]);return d})}_loadNodeShallow(e){const t=this.json,n=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const o=t.nodes[e],c=o.name?i.createUniqueName(o.name):"",l=[],h=i._invokeOne(function(f){return f.createNodeMesh&&f.createNodeMesh(e)});return h&&l.push(h),o.camera!==void 0&&l.push(i.getDependency("camera",o.camera).then(function(f){return i._getNodeRef(i.cameraCache,o.camera,f)})),i._invokeAll(function(f){return f.createNodeAttachment&&f.createNodeAttachment(e)}).forEach(function(f){l.push(f)}),this.nodeCache[e]=Promise.all(l).then(function(f){let d;if(o.isBone===!0?d=new Xg:f.length>1?d=new wr:f.length===1?d=f[0]:d=new St,d!==f[0])for(let p=0,m=f.length;p<m;p++)d.add(f[p]);if(o.name&&(d.userData.name=o.name,d.name=c),Ar(d,o),o.extensions&&jr(n,d,o),o.matrix!==void 0){const p=new Je;p.fromArray(o.matrix),d.applyMatrix4(p)}else o.translation!==void 0&&d.position.fromArray(o.translation),o.rotation!==void 0&&d.quaternion.fromArray(o.rotation),o.scale!==void 0&&d.scale.fromArray(o.scale);return i.associations.has(d)||i.associations.set(d,{}),i.associations.get(d).nodes=e,d}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],i=this,o=new wr;n.name&&(o.name=i.createUniqueName(n.name)),Ar(o,n),n.extensions&&jr(t,o,n);const c=n.nodes||[],l=[];for(let h=0,f=c.length;h<f;h++)l.push(i.getDependency("node",c[h]));return Promise.all(l).then(function(h){for(let d=0,p=h.length;d<p;d++)o.add(h[d]);const f=d=>{const p=new Map;for(const[m,v]of i.associations)(m instanceof ri||m instanceof Zt)&&p.set(m,v);return d.traverse(m=>{const v=i.associations.get(m);v!=null&&p.set(m,v)}),p};return i.associations=f(o),o})}_createAnimationTracks(e,t,n,i,o){const c=[],l=e.name?e.name:e.uuid,h=[];Tr[o.path]===Tr.weights?e.traverse(function(m){m.morphTargetInfluences&&h.push(m.name?m.name:m.uuid)}):h.push(l);let f;switch(Tr[o.path]){case Tr.weights:f=oo;break;case Tr.rotation:f=is;break;case Tr.position:case Tr.scale:f=ao;break;default:switch(n.itemSize){case 1:f=oo;break;case 2:case 3:default:f=ao;break}break}const d=i.interpolation!==void 0?fL[i.interpolation]:ts,p=this._getArrayFromAccessor(n);for(let m=0,v=h.length;m<v;m++){const M=new f(h[m]+"."+Tr[o.path],t.array,p,d);i.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(M),c.push(M)}return c}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const n=ch(t.constructor),i=new Float32Array(t.length);for(let o=0,c=t.length;o<c;o++)i[o]=t[o]*n;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){const i=this instanceof is?hL:r_;return new i(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function yL(s,e,t){const n=e.attributes,i=new yi;if(n.POSITION!==void 0){const l=t.json.accessors[n.POSITION],h=l.min,f=l.max;if(h!==void 0&&f!==void 0){if(i.set(new F(h[0],h[1],h[2]),new F(f[0],f[1],f[2])),l.normalized){const d=ch(Qs[l.componentType]);i.min.multiplyScalar(d),i.max.multiplyScalar(d)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const o=e.targets;if(o!==void 0){const l=new F,h=new F;for(let f=0,d=o.length;f<d;f++){const p=o[f];if(p.POSITION!==void 0){const m=t.json.accessors[p.POSITION],v=m.min,M=m.max;if(v!==void 0&&M!==void 0){if(h.setX(Math.max(Math.abs(v[0]),Math.abs(M[0]))),h.setY(Math.max(Math.abs(v[1]),Math.abs(M[1]))),h.setZ(Math.max(Math.abs(v[2]),Math.abs(M[2]))),m.normalized){const E=ch(Qs[m.componentType]);h.multiplyScalar(E)}l.max(h)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(l)}s.boundingBox=i;const c=new Ui;i.getCenter(c.center),c.radius=i.min.distanceTo(i.max)/2,s.boundingSphere=c}function tg(s,e,t){const n=e.attributes,i=[];function o(c,l){return t.getDependency("accessor",c).then(function(h){s.setAttribute(l,h)})}for(const c in n){const l=ah[c]||c.toLowerCase();l in s.attributes||i.push(o(n[c],l))}if(e.indices!==void 0&&!s.index){const c=t.getDependency("accessor",e.indices).then(function(l){s.setIndex(l)});i.push(c)}return Ct.workingColorSpace!==hn&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Ct.workingColorSpace}" not supported.`),Ar(s,e),yL(s,e,t),Promise.all(i).then(function(){return e.targets!==void 0?pL(s,e.targets,t):s})}class SL{constructor(){this.progress=new Map,this.gltfloader=new n_,this.dracoloader=new zC,this.dracoloader.setDecoderPath("https://www.gstatic.com/draco/v1/decoders/"),this.gltfloader.setDRACOLoader(this.dracoloader)}async LoadGLTF(e){const t=n=>{this.progress.set(e,n.loaded/n.total)};return this.progress.set(e,0),new Promise((n,i)=>{this.gltfloader.loadAsync(e,t).then(n).catch(i)})}PollProgress(){let e=0;return this.progress.forEach(t=>{e+=t}),this.progress.size===0?1:e/this.progress.size}}class ML extends Nh{constructor(){super(),this.isDIVEPrimitive=!0,this._mesh=new un,this._mesh.layers.mask=si,this._mesh.castShadow=!0,this._mesh.receiveShadow=!0,this._mesh.material=new uo,this.add(this._mesh)}SetGeometry(e){const t=this.assembleGeometry(e);t&&(this._mesh.geometry=t,this._boundingBox.setFromObject(this._mesh))}SetMaterial(e){const t=this._mesh.material;e.vertexColors!==void 0&&(t.vertexColors=e.vertexColors),e.color!==void 0&&(t.color=new De(e.color)),e.map!==void 0&&(t.map=e.map),e.normalMap!==void 0&&(t.normalMap=e.normalMap),e.roughness!==void 0&&(t.roughness=e.roughness),e.roughnessMap!==void 0&&(t.roughnessMap=e.roughnessMap,t.roughnessMap&&(t.roughness=1)),e.metalness!==void 0&&(t.metalness=e.metalness),e.metalnessMap!==void 0&&(t.metalnessMap=e.metalnessMap,t.metalnessMap&&(t.metalness=0)),this._mesh&&(this._mesh.material=t)}PlaceOnFloor(){var i,o,c,l,h;const e=this.getWorldPosition(this._positionWorldBuffer),t=e.clone();(o=(i=this._mesh)==null?void 0:i.geometry)==null||o.computeBoundingBox();const n=(l=(c=this._mesh)==null?void 0:c.geometry)==null?void 0:l.boundingBox;!n||!this._mesh||(e.y=e.y-this._mesh.localToWorld(n.min.clone()).y,e.y!==t.y&&((h=On.get(this.userData.id))==null||h.PerformAction("UPDATE_OBJECT",{id:this.userData.id,position:e,rotation:this.rotation,scale:this.scale})))}DropIt(){if(!this.parent){console.warn("DIVEPrimitive: DropIt() called on a model that is not in the scene.",this);return}const e=this._boundingBox.min.y*this.scale.y,t=this.localToWorld(this._boundingBox.getCenter(new F).multiply(this.scale));t.y=e+this.position.y;const n=new Dh(t,new F(0,-1,0));n.layers.mask=si;const i=n.intersectObjects(Uh(this).Root.children,!0);if(i.length>0){const o=i[0].object;o.geometry.computeBoundingBox();const c=o.geometry.boundingBox,l=o.localToWorld(c.max.clone()),h=this.position.clone(),f=this.position.clone().setY(l.y).sub(new F(0,e,0));if(this.position.copy(f),this.position.y===h.y)return;this.onMove()}}assembleGeometry(e){switch(this._mesh.material.flatShading=!1,e.name.toLowerCase()){case"cylinder":return this.createCylinderGeometry(e);case"sphere":return this.createSphereGeometry(e);case"pyramid":return this._mesh.material.flatShading=!0,this.createPyramidGeometry(e);case"cube":case"box":return this.createBoxGeometry(e);case"cone":return this.createConeGeometry(e);case"wall":return this.createWallGeometry(e);case"plane":return this.createPlaneGeometry(e);default:return console.warn("DIVEPrimitive.assembleGeometry: Invalid geometry type:",e.name.toLowerCase()),null}}createCylinderGeometry(e){const t=new jc(e.width/2,e.width/2,e.height,64);return t.translate(0,e.height/2,0),t}createSphereGeometry(e){return new Kc(e.width/2,256,256)}createPyramidGeometry(e){const t=new Float32Array([-e.width/2,0,-e.depth/2,e.width/2,0,-e.depth/2,e.width/2,0,e.depth/2,-e.width/2,0,e.depth/2,0,e.height,0]),n=new Uint16Array([0,1,2,0,2,3,0,4,1,1,4,2,2,4,3,3,4,0]),i=new on;return i.setAttribute("position",new Qt(t,3)),i.setIndex(new Qt(n,1)),i.computeVertexNormals(),i.computeBoundingBox(),i.computeBoundingSphere(),i}createBoxGeometry(e){const t=new Pr(e.width,e.height,e.depth);return t.translate(0,e.height/2,0),t}createConeGeometry(e){const t=new Ah(e.width/2,e.height,256);return t.translate(0,e.height/2,0),t}createWallGeometry(e){const t=new Pr(e.width,e.height,e.depth||.05,16);return t.translate(0,e.height/2,0),t}createPlaneGeometry(e){const t=new Pr(e.width,e.height,e.depth);return t.translate(0,e.height/2,0),t}}class EL extends Nh{constructor(){super(),this.isDIVEGroup=!0,this.name="DIVEGroup",this._members=[],this._lines=[]}get members(){return this._members}SetPosition(e){super.SetPosition(e),this._members.forEach(t=>{"isDIVENode"in t&&t.onMove()})}SetLinesVisibility(e,t){if(!t){this._lines.forEach(i=>{i.visible=e});return}const n=this._members.indexOf(t);n!==-1&&(this._lines[n].visible=e)}attach(e){if(this._members.includes(e))return this;const t=this.createLine();return this.add(t),this._lines.push(t),super.attach(e),this._members.push(e),this.updateLineTo(t,e),this.SetLinesVisibility(!0,e),this}remove(e){const t=this._members.indexOf(e);if(t===-1)return this;const n=this._lines[t];return super.remove(n),this._lines.splice(t,1),super.remove(e),this._members.splice(t,1),this}UpdateLineTo(e){const t=this._members.indexOf(e);t!==-1&&this.updateLineTo(this._lines[t],e)}createLine(){const e=new on,t=new Y1({color:6710886,dashSize:.05,gapSize:.025}),n=new Yc(e,t);return n.visible=!1,n}updateLineTo(e,t){e.geometry.setFromPoints([new F(0,0,0),t.position.clone()]),e.computeLineDistances()}}class Oh extends St{constructor(){super(),this.isDIVERoot=!0,this.name="Root",this.loadingManager=new SL}ComputeSceneBB(){const e=new yi;return this.traverse(t=>{"isObject3D"in t&&e.expandByObject(t)}),e}GetSceneObject(e){let t;return this.traverse(n=>{t||n.userData.id===e.id&&(t=n)}),t}AddSceneObject(e){switch(e.entityType){case"pov":break;case"light":{this.updateLight(e);break}case"model":{this.updateModel(e);break}case"primitive":{this.updatePrimitive(e);break}case"group":{this.updateGroup(e);break}default:console.warn(`DIVERoot.AddSceneObject: Unknown entity type: ${e.entityType}`)}}UpdateSceneObject(e){switch(e.entityType){case"pov":break;case"light":{this.updateLight(e);break}case"model":{this.updateModel(e);break}case"primitive":{this.updatePrimitive(e);break}case"group":{this.updateGroup(e);break}default:console.warn(`DIVERoot.UpdateSceneObject: Unknown entity type: ${e.entityType}`)}}DeleteSceneObject(e){switch(e.entityType){case"pov":break;case"light":{this.deleteLight(e);break}case"model":{this.deleteModel(e);break}case"primitive":{this.deletePrimitive(e);break}case"group":{this.deleteGroup(e);break}default:console.warn(`DIVERoot.DeleteSceneObject: Unknown entity type: ${e.entityType}`)}}PlaceOnFloor(e){switch(e.entityType){case"pov":case"light":break;case"model":case"primitive":{this.placeOnFloor(e);break}default:console.warn(`DIVERoot.PlaceOnFloor: Unknown entity type: ${e.entityType}`)}}updateLight(e){let t=this.GetSceneObject(e);if(!t){switch(e.type){case"scene":{t=new BC;break}case"ambient":{t=new CC;break}case"point":{t=new FC;break}default:{console.warn(`DIVERoot.updateLight: Unknown light type: ${e.type}`);return}}t.userData.id=e.id,this.add(t)}e.name!==void 0&&e.name!==null&&(t.name=e.name),e.position!==void 0&&e.position!==null&&t.position.set(e.position.x,e.position.y,e.position.z),e.intensity!==void 0&&e.intensity!==null&&t.SetIntensity(e.intensity),e.enabled!==void 0&&e.enabled!==null&&t.SetEnabled(e.enabled),e.color!==void 0&&e.color!==null&&t.SetColor(new De(e.color)),e.visible!==void 0&&e.visible!==null&&(t.visible=e.visible),e.parentId!==void 0&&this.setParent({...e,parentId:e.parentId})}updateModel(e){let t=this.GetSceneObject(e);t||(t=new kC,t.userData.id=e.id,t.userData.uri=e.uri,this.add(t)),e.uri!==void 0&&this.loadingManager.LoadGLTF(e.uri).then(n=>{var i;t.SetModel(n),(i=On.get(e.id))==null||i.PerformAction("MODEL_LOADED",{id:e.id})}),e.name!==void 0&&(t.name=e.name),e.position!==void 0&&t.SetPosition(e.position),e.rotation!==void 0&&t.SetRotation(e.rotation),e.scale!==void 0&&t.SetScale(e.scale),e.visible!==void 0&&t.SetVisibility(e.visible),e.material!==void 0&&t.SetMaterial(e.material),e.parentId!==void 0&&this.setParent({...e,parentId:e.parentId})}updatePrimitive(e){let t=this.GetSceneObject(e);t||(t=new ML,t.userData.id=e.id,this.add(t)),e.name!==void 0&&(t.name=e.name),e.geometry!==void 0&&t.SetGeometry(e.geometry),e.position!==void 0&&t.SetPosition(e.position),e.rotation!==void 0&&t.SetRotation(e.rotation),e.scale!==void 0&&t.SetScale(e.scale),e.visible!==void 0&&t.SetVisibility(e.visible),e.material!==void 0&&t.SetMaterial(e.material),e.parentId!==void 0&&this.setParent({...e,parentId:e.parentId})}updateGroup(e){let t=this.GetSceneObject(e);t||(t=new EL,t.userData.id=e.id,this.add(t)),e.name!==void 0&&(t.name=e.name),e.position!==void 0&&t.SetPosition(e.position),e.rotation!==void 0&&t.SetRotation(e.rotation),e.scale!==void 0&&t.SetScale(e.scale),e.visible!==void 0&&t.SetVisibility(e.visible),e.bbVisible!==void 0&&t.SetLinesVisibility(e.bbVisible),e.parentId!==void 0&&this.setParent({...e,parentId:e.parentId})}deleteLight(e){const t=this.GetSceneObject(e);if(!t){console.warn(`DIVERoot.deleteLight: Light with id ${e.id} not found`);return}this.detachTransformControls(t),t.parent.remove(t)}deleteModel(e){const t=this.GetSceneObject(e);if(!t){console.warn(`DIVERoot.deleteModel: Model with id ${e.id} not found`);return}this.detachTransformControls(t),t.parent.remove(t)}deletePrimitive(e){const t=this.GetSceneObject(e);if(!t){console.warn(`DIVERoot.deletePrimitive: Primitive with id ${e.id} not found`);return}this.detachTransformControls(t),t.parent.remove(t)}deleteGroup(e){const t=this.GetSceneObject(e);if(!t){console.warn(`DIVERoot.deleteGroup: Group with id ${e.id} not found`);return}this.detachTransformControls(t);for(let n=t.members.length-1;n>=0;n--)this.attach(t.members[n]);t.parent.remove(t)}placeOnFloor(e){const t=this.GetSceneObject(e);t&&t.PlaceOnFloor()}setParent(e){const t=this.GetSceneObject(e);if(t)if(e.parentId!==null){const n=this.GetSceneObject({id:e.parentId});if(!n)return;n.attach(t)}else this.attach(t)}detachTransformControls(e){this.findScene(e).children.find(t=>{"isTransformControls"in t&&t.detach()})}findScene(e){return e.parent!==null?this.findScene(e.parent):e}}const TL="#888888",bL="#dddddd";class AL extends St{constructor(){super(),this.name="Grid";const e=new AC(100,100,TL,bL);e.material.depthTest=!1,e.layers.mask=Jg,this.add(e)}SetVisibility(e){this.visible=e}}class wL extends un{constructor(){super(new ss(1e4,1e4),new uo({color:new De(150/255,150/255,150/255)})),this.isFloor=!0,this.name="Floor",this.layers.mask=si,this.receiveShadow=!0,this.rotateX(-Math.PI/2)}SetVisibility(e){this.visible=e}SetColor(e){this.material.color=new De(e)}}class RL{constructor(e,t,n,i,o){this.xrLight=e,this.renderer=t,this.lightProbe=n,this.xrWebGLBinding=null,this.estimationStartCallback=o,this.frameCallback=this.onXRFrame.bind(this);const c=t.xr.getSession();if(i&&"XRWebGLBinding"in window){const l=new Ig(16);e.environment=l.texture;const h=t.getContext();switch(c.preferredReflectionFormat){case"srgba8":h.getExtension("EXT_sRGB");break;case"rgba16f":h.getExtension("OES_texture_half_float");break}this.xrWebGLBinding=new XRWebGLBinding(c,h),this.lightProbe.addEventListener("reflectionchange",()=>{this.updateReflection()})}c.requestAnimationFrame(this.frameCallback)}updateReflection(){const e=this.renderer.properties.get(this.xrLight.environment);if(e){const t=this.xrWebGLBinding.getReflectionCubeMap(this.lightProbe);t&&(e.__webglTexture=t,this.xrLight.environment.needsPMREMUpdate=!0)}}onXRFrame(e,t){if(!this.xrLight)return;t.session.requestAnimationFrame(this.frameCallback);const i=t.getLightEstimate(this.lightProbe);if(i){this.xrLight.lightProbe.sh.fromArray(i.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;const o=Math.max(1,Math.max(i.primaryLightIntensity.x,Math.max(i.primaryLightIntensity.y,i.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(i.primaryLightIntensity.x/o,i.primaryLightIntensity.y/o,i.primaryLightIntensity.z/o),this.xrLight.directionalLight.intensity=o,this.xrLight.directionalLight.position.copy(i.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}}class CL extends wr{constructor(e,t=!0){super(),this.lightProbe=new mC,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new Ch,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let n=null,i=!1;e.xr.addEventListener("sessionstart",()=>{const o=e.xr.getSession();"requestLightProbe"in o&&o.requestLightProbe({reflectionFormat:o.preferredReflectionFormat}).then(c=>{n=new RL(this,e,c,t,()=>{i=!0,this.dispatchEvent({type:"estimationstart"})})})}),e.xr.addEventListener("sessionend",()=>{n&&(n.dispose(),n=null),i&&this.dispatchEvent({type:"estimationend"})}),this.dispose=()=>{n&&(n.dispose(),n=null),this.remove(this.lightProbe),this.lightProbe=null,this.remove(this.directionalLight),this.directionalLight=null,this.environment=null}}}class LL extends St{constructor(e){super(),this.name="XRLightRoot",this._scene=e,this._xrLight=null,this._lightRoot=new Oh,this._lightRoot.UpdateSceneObject({id:"XRSceneLight",entityType:"light",name:"XRSceneLight",type:"scene",color:16777215,intensity:1,enabled:!0,visible:!0}),this.add(this._lightRoot)}InitLightEstimation(e){this._xrLight||(this._xrLight=new CL(e,!0),this._xrLight.layers.mask=si,this.add(this._xrLight)),this._xrLight.addEventListener("estimationstart",()=>{this.onEstimationStart()}),this._xrLight.addEventListener("estimationend",()=>{this.onEstimationEnd()})}DisposeLightEstimation(){this._xrLight&&(this._xrLight.removeEventListener("estimationstart",()=>{this.onEstimationStart()}),this._xrLight.removeEventListener("estimationend",()=>{this.onEstimationEnd()}))}onEstimationStart(){this._lightRoot.visible=!1,this._xrLight&&this._xrLight.environment&&(this._scene.environment=this._xrLight.environment)}onEstimationEnd(){this._lightRoot.visible=!0,this._scene.environment=null,this._xrLight}}class PL extends St{get XRModelRoot(){return this._xrModelRoot}get XRLightRoot(){return this._xrLightRoot}get XRHandNode(){return this._xrHandNode}constructor(e){super(),this.name="XRRoot",this._xrModelRoot=new Oh,this._xrModelRoot.name="XRModelRoot",this.add(this._xrModelRoot),this._xrShadowPlane=new un(new ss(100,100),new q1({opacity:1,transparent:!0})),this._xrModelRoot.add(this._xrShadowPlane),this._xrLightRoot=new LL(e),this._xrLightRoot.name="XRLightRoot",this.add(this._xrLightRoot),this._xrHandNode=new St,this._xrHandNode.name="XRHandNode",this.add(this._xrHandNode)}InitLightEstimation(e){this._xrLightRoot.InitLightEstimation(e)}DisposeLightEstimation(){this._xrLightRoot.DisposeLightEstimation()}}class IL extends Hg{get Root(){return this._root}get XRRoot(){return this._xrRoot}get Floor(){return this._floor}get Grid(){return this._grid}constructor(){super(),this.background=new De(16777215),this._root=new Oh,this.add(this._root),this._floor=new wL,this.add(this._floor),this._grid=new AL,this.add(this._grid),this._xrRoot=new PL(this),this._xrRoot.visible=!1,this.add(this._xrRoot)}InitXR(e){this._root.visible=!1,this._xrRoot.visible=!0,this._xrRoot.InitLightEstimation(e)}DisposeXR(){this._root.visible=!0,this._xrRoot.visible=!1,this._xrRoot.DisposeLightEstimation()}SetBackground(e){this.background=new De(e)}ComputeSceneBB(){return this.Root.ComputeSceneBB()}GetSceneObject(e){return this.Root.GetSceneObject(e)}AddSceneObject(e){this.Root.AddSceneObject(e)}UpdateSceneObject(e){this.Root.UpdateSceneObject(e)}DeleteSceneObject(e){this.Root.DeleteSceneObject(e)}PlaceOnFloor(e){this.Root.PlaceOnFloor(e)}}const jo={fov:70,near:.1,far:1e3},Qr=class Qr extends Mn{constructor(e=jo){super(e.fov||jo.fov,1,e.near||jo.near,e.far||jo.far),this.onSetCameraLayer=()=>{},this.layers.mask=Qr.EDITOR_VIEW_LAYER_MASK}OnResize(e,t){this.aspect=e/t,this.updateProjectionMatrix()}SetCameraLayer(e){this.layers.mask=e==="LIVE"?Qr.LIVE_VIEW_LAYER_MASK:Qr.EDITOR_VIEW_LAYER_MASK,this.onSetCameraLayer(this.layers.mask)}};Qr.EDITOR_VIEW_LAYER_MASK=RC|$g|Jg|si,Qr.LIVE_VIEW_LAYER_MASK=si;let kc=Qr;const ng={type:"change"},Ku={type:"start"},ig={type:"end"},Rc=new co,rg=new br,DL=Math.cos(70*vi.DEG2RAD);class UL extends rs{constructor(e,t){super(),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new F,this.cursor=new F,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Ms.ROTATE,MIDDLE:Ms.DOLLY,RIGHT:Ms.PAN},this.touches={ONE:Es.ROTATE,TWO:Es.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return l.phi},this.getAzimuthalAngle=function(){return l.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(y){y.addEventListener("keydown",Me),this._domElementKeyEvents=y},this.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",Me),this._domElementKeyEvents=null},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(ng),n.update(),o=i.NONE},this.update=function(){const y=new F,Y=new xi().setFromUnitVectors(e.up,new F(0,1,0)),re=Y.clone().invert(),ve=new F,be=new xi,pt=new F,ut=2*Math.PI;return function($t=null){const bt=n.object.position;y.copy(bt).sub(n.target),y.applyQuaternion(Y),l.setFromVector3(y),n.autoRotate&&o===i.NONE&&J(w($t)),n.enableDamping?(l.theta+=h.theta*n.dampingFactor,l.phi+=h.phi*n.dampingFactor):(l.theta+=h.theta,l.phi+=h.phi);let Vt=n.minAzimuthAngle,Wt=n.maxAzimuthAngle;isFinite(Vt)&&isFinite(Wt)&&(Vt<-Math.PI?Vt+=ut:Vt>Math.PI&&(Vt-=ut),Wt<-Math.PI?Wt+=ut:Wt>Math.PI&&(Wt-=ut),Vt<=Wt?l.theta=Math.max(Vt,Math.min(Wt,l.theta)):l.theta=l.theta>(Vt+Wt)/2?Math.max(Vt,l.theta):Math.min(Wt,l.theta)),l.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,l.phi)),l.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(d,n.dampingFactor):n.target.add(d),n.target.sub(n.cursor),n.target.clampLength(n.minTargetRadius,n.maxTargetRadius),n.target.add(n.cursor);let Tn=!1;if(n.zoomToCursor&&O||n.object.isOrthographicCamera)l.radius=de(l.radius);else{const mn=l.radius;l.radius=de(l.radius*f),Tn=mn!=l.radius}if(y.setFromSpherical(l),y.applyQuaternion(re),bt.copy(n.target).add(y),n.object.lookAt(n.target),n.enableDamping===!0?(h.theta*=1-n.dampingFactor,h.phi*=1-n.dampingFactor,d.multiplyScalar(1-n.dampingFactor)):(h.set(0,0,0),d.set(0,0,0)),n.zoomToCursor&&O){let mn=null;if(n.object.isPerspectiveCamera){const Si=y.length();mn=de(Si*f);const Mi=Si-mn;n.object.position.addScaledVector(I,Mi),n.object.updateMatrixWorld(),Tn=!!Mi}else if(n.object.isOrthographicCamera){const Si=new F(k.x,k.y,0);Si.unproject(n.object);const Mi=n.object.zoom;n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/f)),n.object.updateProjectionMatrix(),Tn=Mi!==n.object.zoom;const Oi=new F(k.x,k.y,0);Oi.unproject(n.object),n.object.position.sub(Oi).add(Si),n.object.updateMatrixWorld(),mn=y.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;mn!==null&&(this.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(mn).add(n.object.position):(Rc.origin.copy(n.object.position),Rc.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(Rc.direction))<DL?e.lookAt(n.target):(rg.setFromNormalAndCoplanarPoint(n.object.up,n.target),Rc.intersectPlane(rg,n.target))))}else if(n.object.isOrthographicCamera){const mn=n.object.zoom;n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/f)),mn!==n.object.zoom&&(n.object.updateProjectionMatrix(),Tn=!0)}return f=1,O=!1,Tn||ve.distanceToSquared(n.object.position)>c||8*(1-be.dot(n.object.quaternion))>c||pt.distanceToSquared(n.target)>c?(n.dispatchEvent(ng),ve.copy(n.object.position),be.copy(n.object.quaternion),pt.copy(n.target),!0):!1}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",Le),n.domElement.removeEventListener("pointerdown",ee),n.domElement.removeEventListener("pointercancel",le),n.domElement.removeEventListener("wheel",pe),n.domElement.removeEventListener("pointermove",se),n.domElement.removeEventListener("pointerup",le),n.domElement.getRootNode().removeEventListener("keydown",ze,{capture:!0}),n._domElementKeyEvents!==null&&(n._domElementKeyEvents.removeEventListener("keydown",Me),n._domElementKeyEvents=null)};const n=this,i={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let o=i.NONE;const c=1e-6,l=new Ym,h=new Ym;let f=1;const d=new F,p=new Ne,m=new Ne,v=new Ne,M=new Ne,E=new Ne,x=new Ne,_=new Ne,P=new Ne,T=new Ne,I=new F,k=new Ne;let O=!1;const D=[],V={};let C=!1;function w(y){return y!==null?2*Math.PI/60*n.autoRotateSpeed*y:2*Math.PI/60/60*n.autoRotateSpeed}function X(y){const Y=Math.abs(y*.01);return Math.pow(.95,n.zoomSpeed*Y)}function J(y){h.theta-=y}function z(y){h.phi-=y}const te=function(){const y=new F;return function(re,ve){y.setFromMatrixColumn(ve,0),y.multiplyScalar(-re),d.add(y)}}(),ce=function(){const y=new F;return function(re,ve){n.screenSpacePanning===!0?y.setFromMatrixColumn(ve,1):(y.setFromMatrixColumn(ve,0),y.crossVectors(n.object.up,y)),y.multiplyScalar(re),d.add(y)}}(),ue=function(){const y=new F;return function(re,ve){const be=n.domElement;if(n.object.isPerspectiveCamera){const pt=n.object.position;y.copy(pt).sub(n.target);let ut=y.length();ut*=Math.tan(n.object.fov/2*Math.PI/180),te(2*re*ut/be.clientHeight,n.object.matrix),ce(2*ve*ut/be.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(te(re*(n.object.right-n.object.left)/n.object.zoom/be.clientWidth,n.object.matrix),ce(ve*(n.object.top-n.object.bottom)/n.object.zoom/be.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function xe(y){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?f/=y:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Q(y){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?f*=y:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function ge(y,Y){if(!n.zoomToCursor)return;O=!0;const re=n.domElement.getBoundingClientRect(),ve=y-re.left,be=Y-re.top,pt=re.width,ut=re.height;k.x=ve/pt*2-1,k.y=-(be/ut)*2+1,I.set(k.x,k.y,1).unproject(n.object).sub(n.object.position).normalize()}function de(y){return Math.max(n.minDistance,Math.min(n.maxDistance,y))}function Ae(y){p.set(y.clientX,y.clientY)}function ct(y){ge(y.clientX,y.clientX),_.set(y.clientX,y.clientY)}function Tt(y){M.set(y.clientX,y.clientY)}function ie(y){m.set(y.clientX,y.clientY),v.subVectors(m,p).multiplyScalar(n.rotateSpeed);const Y=n.domElement;J(2*Math.PI*v.x/Y.clientHeight),z(2*Math.PI*v.y/Y.clientHeight),p.copy(m),n.update()}function me(y){P.set(y.clientX,y.clientY),T.subVectors(P,_),T.y>0?xe(X(T.y)):T.y<0&&Q(X(T.y)),_.copy(P),n.update()}function Re(y){E.set(y.clientX,y.clientY),x.subVectors(E,M).multiplyScalar(n.panSpeed),ue(x.x,x.y),M.copy(E),n.update()}function Te(y){ge(y.clientX,y.clientY),y.deltaY<0?Q(X(y.deltaY)):y.deltaY>0&&xe(X(y.deltaY)),n.update()}function qe(y){let Y=!1;switch(y.code){case n.keys.UP:y.ctrlKey||y.metaKey||y.shiftKey?z(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):ue(0,n.keyPanSpeed),Y=!0;break;case n.keys.BOTTOM:y.ctrlKey||y.metaKey||y.shiftKey?z(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):ue(0,-n.keyPanSpeed),Y=!0;break;case n.keys.LEFT:y.ctrlKey||y.metaKey||y.shiftKey?J(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):ue(n.keyPanSpeed,0),Y=!0;break;case n.keys.RIGHT:y.ctrlKey||y.metaKey||y.shiftKey?J(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):ue(-n.keyPanSpeed,0),Y=!0;break}Y&&(y.preventDefault(),n.update())}function Ye(y){if(D.length===1)p.set(y.pageX,y.pageY);else{const Y=xt(y),re=.5*(y.pageX+Y.x),ve=.5*(y.pageY+Y.y);p.set(re,ve)}}function ft(y){if(D.length===1)M.set(y.pageX,y.pageY);else{const Y=xt(y),re=.5*(y.pageX+Y.x),ve=.5*(y.pageY+Y.y);M.set(re,ve)}}function q(y){const Y=xt(y),re=y.pageX-Y.x,ve=y.pageY-Y.y,be=Math.sqrt(re*re+ve*ve);_.set(0,be)}function Qe(y){n.enableZoom&&q(y),n.enablePan&&ft(y)}function Ge(y){n.enableZoom&&q(y),n.enableRotate&&Ye(y)}function Mt(y){if(D.length==1)m.set(y.pageX,y.pageY);else{const re=xt(y),ve=.5*(y.pageX+re.x),be=.5*(y.pageY+re.y);m.set(ve,be)}v.subVectors(m,p).multiplyScalar(n.rotateSpeed);const Y=n.domElement;J(2*Math.PI*v.x/Y.clientHeight),z(2*Math.PI*v.y/Y.clientHeight),p.copy(m)}function ke(y){if(D.length===1)E.set(y.pageX,y.pageY);else{const Y=xt(y),re=.5*(y.pageX+Y.x),ve=.5*(y.pageY+Y.y);E.set(re,ve)}x.subVectors(E,M).multiplyScalar(n.panSpeed),ue(x.x,x.y),M.copy(E)}function Et(y){const Y=xt(y),re=y.pageX-Y.x,ve=y.pageY-Y.y,be=Math.sqrt(re*re+ve*ve);P.set(0,be),T.set(0,Math.pow(P.y/_.y,n.zoomSpeed)),xe(T.y),_.copy(P);const pt=(y.pageX+Y.x)*.5,ut=(y.pageY+Y.y)*.5;ge(pt,ut)}function U(y){n.enableZoom&&Et(y),n.enablePan&&ke(y)}function b(y){n.enableZoom&&Et(y),n.enableRotate&&Mt(y)}function ee(y){n.enabled!==!1&&(D.length===0&&(n.domElement.setPointerCapture(y.pointerId),n.domElement.addEventListener("pointermove",se),n.domElement.addEventListener("pointerup",le)),!vt(y)&&(rt(y),y.pointerType==="touch"?Xe(y):fe(y)))}function se(y){n.enabled!==!1&&(y.pointerType==="touch"?Ce(y):Fe(y))}function le(y){switch(lt(y),D.length){case 0:n.domElement.releasePointerCapture(y.pointerId),n.domElement.removeEventListener("pointermove",se),n.domElement.removeEventListener("pointerup",le),n.dispatchEvent(ig),o=i.NONE;break;case 1:const Y=D[0],re=V[Y];Xe({pointerId:Y,pageX:re.x,pageY:re.y});break}}function fe(y){let Y;switch(y.button){case 0:Y=n.mouseButtons.LEFT;break;case 1:Y=n.mouseButtons.MIDDLE;break;case 2:Y=n.mouseButtons.RIGHT;break;default:Y=-1}switch(Y){case Ms.DOLLY:if(n.enableZoom===!1)return;ct(y),o=i.DOLLY;break;case Ms.ROTATE:if(y.ctrlKey||y.metaKey||y.shiftKey){if(n.enablePan===!1)return;Tt(y),o=i.PAN}else{if(n.enableRotate===!1)return;Ae(y),o=i.ROTATE}break;case Ms.PAN:if(y.ctrlKey||y.metaKey||y.shiftKey){if(n.enableRotate===!1)return;Ae(y),o=i.ROTATE}else{if(n.enablePan===!1)return;Tt(y),o=i.PAN}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent(Ku)}function Fe(y){switch(o){case i.ROTATE:if(n.enableRotate===!1)return;ie(y);break;case i.DOLLY:if(n.enableZoom===!1)return;me(y);break;case i.PAN:if(n.enablePan===!1)return;Re(y);break}}function pe(y){n.enabled===!1||n.enableZoom===!1||o!==i.NONE||(y.preventDefault(),n.dispatchEvent(Ku),Te(Pe(y)),n.dispatchEvent(ig))}function Pe(y){const Y=y.deltaMode,re={clientX:y.clientX,clientY:y.clientY,deltaY:y.deltaY};switch(Y){case 1:re.deltaY*=16;break;case 2:re.deltaY*=100;break}return y.ctrlKey&&!C&&(re.deltaY*=10),re}function ze(y){y.key==="Control"&&(C=!0,n.domElement.getRootNode().addEventListener("keyup",_e,{passive:!0,capture:!0}))}function _e(y){y.key==="Control"&&(C=!1,n.domElement.getRootNode().removeEventListener("keyup",_e,{passive:!0,capture:!0}))}function Me(y){n.enabled===!1||n.enablePan===!1||qe(y)}function Xe(y){switch(dt(y),D.length){case 1:switch(n.touches.ONE){case Es.ROTATE:if(n.enableRotate===!1)return;Ye(y),o=i.TOUCH_ROTATE;break;case Es.PAN:if(n.enablePan===!1)return;ft(y),o=i.TOUCH_PAN;break;default:o=i.NONE}break;case 2:switch(n.touches.TWO){case Es.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Qe(y),o=i.TOUCH_DOLLY_PAN;break;case Es.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;Ge(y),o=i.TOUCH_DOLLY_ROTATE;break;default:o=i.NONE}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent(Ku)}function Ce(y){switch(dt(y),o){case i.TOUCH_ROTATE:if(n.enableRotate===!1)return;Mt(y),n.update();break;case i.TOUCH_PAN:if(n.enablePan===!1)return;ke(y),n.update();break;case i.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;U(y),n.update();break;case i.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;b(y),n.update();break;default:o=i.NONE}}function Le(y){n.enabled!==!1&&y.preventDefault()}function rt(y){D.push(y.pointerId)}function lt(y){delete V[y.pointerId];for(let Y=0;Y<D.length;Y++)if(D[Y]==y.pointerId){D.splice(Y,1);return}}function vt(y){for(let Y=0;Y<D.length;Y++)if(D[Y]==y.pointerId)return!0;return!1}function dt(y){let Y=V[y.pointerId];Y===void 0&&(Y=new Ne,V[y.pointerId]=Y),Y.set(y.pageX,y.pageY)}function xt(y){const Y=y.pointerId===D[0]?D[1]:D[0];return V[Y]}n.domElement.addEventListener("contextmenu",Le),n.domElement.addEventListener("pointerdown",ee),n.domElement.addEventListener("pointercancel",le),n.domElement.addEventListener("wheel",pe,{passive:!1}),n.domElement.getRootNode().addEventListener("keydown",ze,{passive:!0,capture:!0}),this.update()}}var ir=Object.freeze({Linear:Object.freeze({None:function(s){return s},In:function(s){return s},Out:function(s){return s},InOut:function(s){return s}}),Quadratic:Object.freeze({In:function(s){return s*s},Out:function(s){return s*(2-s)},InOut:function(s){return(s*=2)<1?.5*s*s:-.5*(--s*(s-2)-1)}}),Cubic:Object.freeze({In:function(s){return s*s*s},Out:function(s){return--s*s*s+1},InOut:function(s){return(s*=2)<1?.5*s*s*s:.5*((s-=2)*s*s+2)}}),Quartic:Object.freeze({In:function(s){return s*s*s*s},Out:function(s){return 1- --s*s*s*s},InOut:function(s){return(s*=2)<1?.5*s*s*s*s:-.5*((s-=2)*s*s*s-2)}}),Quintic:Object.freeze({In:function(s){return s*s*s*s*s},Out:function(s){return--s*s*s*s*s+1},InOut:function(s){return(s*=2)<1?.5*s*s*s*s*s:.5*((s-=2)*s*s*s*s+2)}}),Sinusoidal:Object.freeze({In:function(s){return 1-Math.sin((1-s)*Math.PI/2)},Out:function(s){return Math.sin(s*Math.PI/2)},InOut:function(s){return .5*(1-Math.sin(Math.PI*(.5-s)))}}),Exponential:Object.freeze({In:function(s){return s===0?0:Math.pow(1024,s-1)},Out:function(s){return s===1?1:1-Math.pow(2,-10*s)},InOut:function(s){return s===0?0:s===1?1:(s*=2)<1?.5*Math.pow(1024,s-1):.5*(-Math.pow(2,-10*(s-1))+2)}}),Circular:Object.freeze({In:function(s){return 1-Math.sqrt(1-s*s)},Out:function(s){return Math.sqrt(1- --s*s)},InOut:function(s){return(s*=2)<1?-.5*(Math.sqrt(1-s*s)-1):.5*(Math.sqrt(1-(s-=2)*s)+1)}}),Elastic:Object.freeze({In:function(s){return s===0?0:s===1?1:-Math.pow(2,10*(s-1))*Math.sin((s-1.1)*5*Math.PI)},Out:function(s){return s===0?0:s===1?1:Math.pow(2,-10*s)*Math.sin((s-.1)*5*Math.PI)+1},InOut:function(s){return s===0?0:s===1?1:(s*=2,s<1?-.5*Math.pow(2,10*(s-1))*Math.sin((s-1.1)*5*Math.PI):.5*Math.pow(2,-10*(s-1))*Math.sin((s-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(s){var e=1.70158;return s===1?1:s*s*((e+1)*s-e)},Out:function(s){var e=1.70158;return s===0?0:--s*s*((e+1)*s+e)+1},InOut:function(s){var e=2.5949095;return(s*=2)<1?.5*(s*s*((e+1)*s-e)):.5*((s-=2)*s*((e+1)*s+e)+2)}}),Bounce:Object.freeze({In:function(s){return 1-ir.Bounce.Out(1-s)},Out:function(s){return s<1/2.75?7.5625*s*s:s<2/2.75?7.5625*(s-=1.5/2.75)*s+.75:s<2.5/2.75?7.5625*(s-=2.25/2.75)*s+.9375:7.5625*(s-=2.625/2.75)*s+.984375},InOut:function(s){return s<.5?ir.Bounce.In(s*2)*.5:ir.Bounce.Out(s*2-1)*.5+.5}}),generatePow:function(s){return s===void 0&&(s=4),s=s<Number.EPSILON?Number.EPSILON:s,s=s>1e4?1e4:s,{In:function(e){return Math.pow(e,s)},Out:function(e){return 1-Math.pow(1-e,s)},InOut:function(e){return e<.5?Math.pow(e*2,s)/2:(1-Math.pow(2-e*2,s))/2+.5}}}}),Ko=function(){return performance.now()},NL=function(){function s(){this._tweens={},this._tweensAddedDuringUpdate={}}return s.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(t){return e._tweens[t]})},s.prototype.removeAll=function(){this._tweens={}},s.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},s.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},s.prototype.update=function(e,t){e===void 0&&(e=Ko()),t===void 0&&(t=!1);var n=Object.keys(this._tweens);if(n.length===0)return!1;for(;n.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<n.length;i++){var o=this._tweens[n[i]],c=!t;o&&o.update(e,c)===!1&&!t&&delete this._tweens[n[i]]}n=Object.keys(this._tweensAddedDuringUpdate)}return!0},s}(),lh={Linear:function(s,e){var t=s.length-1,n=t*e,i=Math.floor(n),o=lh.Utils.Linear;return e<0?o(s[0],s[1],n):e>1?o(s[t],s[t-1],t-n):o(s[i],s[i+1>t?t:i+1],n-i)},Utils:{Linear:function(s,e,t){return(e-s)*t+s}}},s_=function(){function s(){}return s.nextId=function(){return s._nextId++},s._nextId=0,s}(),uh=new NL,OL=function(){function s(e,t){t===void 0&&(t=uh),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=ir.Linear.None,this._interpolationFunction=lh.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=s_.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1}return s.prototype.getId=function(){return this._id},s.prototype.isPlaying=function(){return this._isPlaying},s.prototype.isPaused=function(){return this._isPaused},s.prototype.getDuration=function(){return this._duration},s.prototype.to=function(e,t){if(t===void 0&&(t=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=t<0?0:t,this},s.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},s.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},s.prototype.start=function(e,t){if(e===void 0&&(e=Ko()),t===void 0&&(t=!1),this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var n in this._valuesStartRepeat)this._swapEndStartRepeatValues(n),this._valuesStart[n]=this._valuesStartRepeat[n]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||t){if(this._propertiesAreSetUp=!0,!this._isDynamic){var i={};for(var o in this._valuesEnd)i[o]=this._valuesEnd[o];this._valuesEnd=i}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,t)}return this},s.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},s.prototype._setupProperties=function(e,t,n,i,o){for(var c in n){var l=e[c],h=Array.isArray(l),f=h?"array":typeof l,d=!h&&Array.isArray(n[c]);if(!(f==="undefined"||f==="function")){if(d){var p=n[c];if(p.length===0)continue;for(var m=[l],v=0,M=p.length;v<M;v+=1){var E=this._handleRelativeValue(l,p[v]);if(isNaN(E)){d=!1,console.warn("Found invalid interpolation list. Skipping.");break}m.push(E)}d&&(n[c]=m)}if((f==="object"||h)&&l&&!d){t[c]=h?[]:{};var x=l;for(var _ in x)t[c][_]=x[_];i[c]=h?[]:{};var p=n[c];if(!this._isDynamic){var P={};for(var _ in p)P[_]=p[_];n[c]=p=P}this._setupProperties(x,t[c],p,i[c],o)}else(typeof t[c]>"u"||o)&&(t[c]=l),h||(t[c]*=1),d?i[c]=n[c].slice().reverse():i[c]=t[c]||0}}},s.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},s.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},s.prototype.pause=function(e){return e===void 0&&(e=Ko()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this),this)},s.prototype.resume=function(e){return e===void 0&&(e=Ko()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},s.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;e<t;e++)this._chainedTweens[e].stop();return this},s.prototype.group=function(e){return e===void 0&&(e=uh),this._group=e,this},s.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},s.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},s.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},s.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},s.prototype.easing=function(e){return e===void 0&&(e=ir.Linear.None),this._easingFunction=e,this},s.prototype.interpolation=function(e){return e===void 0&&(e=lh.Linear),this._interpolationFunction=e,this},s.prototype.chain=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._chainedTweens=e,this},s.prototype.onStart=function(e){return this._onStartCallback=e,this},s.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},s.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},s.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},s.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},s.prototype.onStop=function(e){return this._onStopCallback=e,this},s.prototype.update=function(e,t){var n;if(e===void 0&&(e=Ko()),t===void 0&&(t=!0),this._isPaused)return!0;var i=this._startTime+this._duration;if(!this._goToEnd&&!this._isPlaying){if(e>i)return!1;t&&this.start(e,!0)}if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var o=e-this._startTime,c=this._duration+((n=this._repeatDelayTime)!==null&&n!==void 0?n:this._delayTime),l=this._duration+this._repeat*c,h=this._calculateElapsedPortion(o,c,l),f=this._easingFunction(h),d=this._calculateCompletionStatus(o,c);if(d==="repeat"&&this._processRepetition(o,c),this._updateProperties(this._object,this._valuesStart,this._valuesEnd,f),d==="about-to-repeat"&&this._processRepetition(o,c),this._onUpdateCallback&&this._onUpdateCallback(this._object,h),d==="repeat"||d==="about-to-repeat")this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1;else if(d==="completed"){this._isPlaying=!1,this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var p=0,m=this._chainedTweens.length;p<m;p++)this._chainedTweens[p].start(this._startTime+this._duration,!1)}return d!=="completed"},s.prototype._calculateElapsedPortion=function(e,t,n){if(this._duration===0||e>n)return 1;var i=e%t,o=Math.min(i/this._duration,1);return o===0&&e!==0&&e%this._duration===0?1:o},s.prototype._calculateCompletionStatus=function(e,t){return this._duration!==0&&e<this._duration?"playing":this._repeat<=0?"completed":e===this._duration?"about-to-repeat":"repeat"},s.prototype._processRepetition=function(e,t){var n=Math.min(Math.trunc((e-this._duration)/t)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=n);for(var i in this._valuesStartRepeat){var o=this._valuesEnd[i];!this._yoyo&&typeof o=="string"&&(this._valuesStartRepeat[i]=this._valuesStartRepeat[i]+parseFloat(o)),this._yoyo&&this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}this._yoyo&&(this._reversed=!this._reversed),this._startTime+=t*n},s.prototype._updateProperties=function(e,t,n,i){for(var o in n)if(t[o]!==void 0){var c=t[o]||0,l=n[o],h=Array.isArray(e[o]),f=Array.isArray(l),d=!h&&f;d?e[o]=this._interpolationFunction(l,i):typeof l=="object"&&l?this._updateProperties(e[o],c,l,i):(l=this._handleRelativeValue(c,l),typeof l=="number"&&(e[o]=c+(l-c)*i))}},s.prototype._handleRelativeValue=function(e,t){return typeof t!="string"?t:t.charAt(0)==="+"||t.charAt(0)==="-"?e+parseFloat(t):parseFloat(t)},s.prototype._swapEndStartRepeatValues=function(e){var t=this._valuesStartRepeat[e],n=this._valuesEnd[e];typeof n=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(n):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=t},s}();s_.nextId;var Ii=uh;Ii.getAll.bind(Ii);Ii.removeAll.bind(Ii);Ii.add.bind(Ii);Ii.remove.bind(Ii);var FL=Ii.update.bind(Ii);const Pc={enableDamping:!0,dampingFactor:.04},ea=class ea extends UL{constructor(e,t,n,i=Pc){super(e,t.domElement),this.last=null,this.animating=!1,this.locked=!1,this.stopMoveTo=()=>{},this.stopRevertLast=()=>{},this._removePreRenderCallback=()=>{},this.preRenderCallback=()=>{this.locked||this.update()},this._animationSystem=n,this.domElement=t.domElement,this.object=e;const o=t.AddPreRenderCallback(()=>{this.preRenderCallback()});this._removePreRenderCallback=()=>{t.RemovePreRenderCallback(o)},this.enableDamping=i.enableDamping||Pc.enableDamping,this.dampingFactor=i.dampingFactor||Pc.dampingFactor,this.object.position.set(0,2,2),this.target.copy({x:0,y:.5,z:0}),this.update()}Dispose(){this._removePreRenderCallback(),this.dispose()}ComputeEncompassingView(e){const t=e.getCenter(new F),n=e.getSize(new F),i=Math.max(n.x,n.y,n.z)*1.25;return{position:this.object.position.clone().normalize().multiplyScalar(i),target:t}}ZoomIn(e){const t=e||ea.DEFAULT_ZOOM_FACTOR,{minDistance:n,maxDistance:i}=this;this.minDistance=this.maxDistance=vi.clamp(this.getDistance()-t,n+t,i-t),this.update(),this.minDistance=n,this.maxDistance=i}ZoomOut(e){const t=e||ea.DEFAULT_ZOOM_FACTOR,{minDistance:n,maxDistance:i}=this;this.minDistance=this.maxDistance=vi.clamp(this.getDistance()+t,n+t,i-t),this.update(),this.minDistance=n,this.maxDistance=i}MoveTo(e,t,n,i){if(this.animating)return;const o=e||this.object.position.clone(),c=t||this.target.clone();this.stopRevertLast(),this.locked||(this.last={pos:this.object.position.clone(),target:this.target.clone()}),this.animating=n>0,this.locked=i,this.enabled=!1;const l=this._animationSystem.Animate(this.object.position).to(o,n).easing(ir.Quadratic.Out).start(),h=this._animationSystem.Animate(this.target).to(c,n).easing(ir.Quadratic.Out).onUpdate(()=>{this.object.lookAt(this.target)}).onComplete(()=>{this.animating=!1,this.enabled=!i}).start();this.stopMoveTo=()=>{l.stop(),h.stop()}}RevertLast(e){if(this.animating||!this.locked)return;this.stopMoveTo(),this.animating=e>0,this.enabled=!1;const{pos:t,target:n}=this.last,i=this._animationSystem.Animate(this.object.position).to(t,e).easing(ir.Quadratic.Out).start(),o=this._animationSystem.Animate(this.target).to(n,e).easing(ir.Quadratic.Out).onUpdate(()=>{this.object.lookAt(this.target)}).onComplete(()=>{this.animating=!1,this.locked=!1,this.enabled=!0}).start();this.stopRevertLast=()=>{i.stop(),o.stop()}}};ea.DEFAULT_ZOOM_FACTOR=1;let hh=ea;const Bh=class Bh{get selectTool(){if(!this._selectTool){const e=require("./select/SelectTool.ts").DIVESelectTool;this._selectTool=new e(this._scene,this._controller)}return this._selectTool}constructor(e,t){this._scene=e,this._controller=t,this._selectTool=null,this._activeTool=null}Dispose(){this.removeEventListeners()}GetActiveTool(){return this._activeTool}UseTool(e){var t;switch((t=this._activeTool)==null||t.Deactivate(),e){case"select":{this.addEventListeners(),this.selectTool.Activate(),this._activeTool=this.selectTool;break}case"none":{this.removeEventListeners(),this._activeTool=null;break}default:console.warn(`DIVEToolBox.UseTool: Unknown tool: ${e}`)}}SetGizmoMode(e){this.selectTool.SetGizmoMode(e)}SetGizmoVisibility(e){this.selectTool.SetGizmoVisibility(e)}SetGizmoScaleLinked(e){this.selectTool.SetGizmoScaleLinked(e)}onPointerMove(e){var t;(t=this._activeTool)==null||t.onPointerMove(e)}onPointerDown(e){var t;(t=this._activeTool)==null||t.onPointerDown(e)}onPointerUp(e){var t;(t=this._activeTool)==null||t.onPointerUp(e)}onWheel(e){var t;(t=this._activeTool)==null||t.onWheel(e)}addEventListeners(){this._controller.domElement.addEventListener("pointermove",e=>this.onPointerMove(e)),this._controller.domElement.addEventListener("pointerdown",e=>this.onPointerDown(e)),this._controller.domElement.addEventListener("pointerup",e=>this.onPointerUp(e)),this._controller.domElement.addEventListener("wheel",e=>this.onWheel(e))}removeEventListeners(){this._controller.domElement.removeEventListener("pointermove",e=>this.onPointerMove(e)),this._controller.domElement.removeEventListener("pointerdown",e=>this.onPointerDown(e)),this._controller.domElement.removeEventListener("pointerup",e=>this.onPointerUp(e)),this._controller.domElement.removeEventListener("wheel",e=>this.onWheel(e))}};Bh.DefaultTool="select";let fh=Bh;class BL{constructor(e){this._renderer=e,this._rendererCallbackId=this._renderer.AddPreRenderCallback(()=>{this.Update()})}Dispose(){this._renderer.RemovePreRenderCallback(this._rendererCallbackId)}Update(){FL()}Animate(e){return new OL(e)}}function kL(s,e,t){return e=zc(e),jL(s,o_()?Reflect.construct(e,t||[],zc(s).constructor):e.apply(s,t))}function o_(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(o_=function(){return!!s})()}function zL(s,e){var t=s==null?null:typeof Symbol<"u"&&s[Symbol.iterator]||s["@@iterator"];if(t!=null){var n,i,o,c,l=[],h=!0,f=!1;try{if(o=(t=t.call(s)).next,e===0){if(Object(t)!==t)return;h=!1}else for(;!(h=(n=o.call(t)).done)&&(l.push(n.value),l.length!==e);h=!0);}catch(d){f=!0,i=d}finally{try{if(!h&&t.return!=null&&(c=t.return(),Object(c)!==c))return}finally{if(f)throw i}}return l}}function HL(s,e){if(typeof s!="object"||!s)return s;var t=s[Symbol.toPrimitive];if(t!==void 0){var n=t.call(s,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(s)}function GL(s){var e=HL(s,"string");return typeof e=="symbol"?e:String(e)}function VL(s,e){if(!(s instanceof e))throw new TypeError("Cannot call a class as a function")}function WL(s,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(s,GL(n.key),n)}}function XL(s,e,t){return e&&WL(s.prototype,e),Object.defineProperty(s,"prototype",{writable:!1}),s}function qL(s,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");s.prototype=Object.create(e&&e.prototype,{constructor:{value:s,writable:!0,configurable:!0}}),Object.defineProperty(s,"prototype",{writable:!1}),e&&dh(s,e)}function zc(s){return zc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},zc(s)}function dh(s,e){return dh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},dh(s,e)}function YL(s){if(s===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s}function jL(s,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return YL(s)}function sg(s,e){return ZL(s)||zL(s,e)||a_(s,e)||QL()}function Cc(s){return KL(s)||$L(s)||a_(s)||JL()}function KL(s){if(Array.isArray(s))return ph(s)}function ZL(s){if(Array.isArray(s))return s}function $L(s){if(typeof Symbol<"u"&&s[Symbol.iterator]!=null||s["@@iterator"]!=null)return Array.from(s)}function a_(s,e){if(s){if(typeof s=="string")return ph(s,e);var t=Object.prototype.toString.call(s).slice(8,-1);if(t==="Object"&&s.constructor&&(t=s.constructor.name),t==="Map"||t==="Set")return Array.from(s);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return ph(s,e)}}function ph(s,e){(e==null||e>s.length)&&(e=s.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=s[t];return n}function JL(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
3825
3825
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function QL(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3826
3826
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var qs=typeof window<"u"&&window.THREE?window.THREE:{LinearFilter:Pn,Sprite:O1,SpriteMaterial:Vg,SRGBColorSpace:nn,Texture:Zt},Zu=function(s){qL(e,s);function e(){var t,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:10,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"rgba(255, 255, 255, 1)";return VL(this,e),t=kL(this,e,[new qs.SpriteMaterial]),t._text="".concat(n),t._textHeight=i,t._color=o,t._backgroundColor=!1,t._padding=0,t._borderWidth=0,t._borderRadius=0,t._borderColor="white",t._strokeWidth=0,t._strokeColor="white",t._fontFace="system-ui",t._fontSize=90,t._fontWeight="normal",t._canvas=document.createElement("canvas"),t._genCanvas(),t}return XL(e,[{key:"text",get:function(){return this._text},set:function(n){this._text=n,this._genCanvas()}},{key:"textHeight",get:function(){return this._textHeight},set:function(n){this._textHeight=n,this._genCanvas()}},{key:"color",get:function(){return this._color},set:function(n){this._color=n,this._genCanvas()}},{key:"backgroundColor",get:function(){return this._backgroundColor},set:function(n){this._backgroundColor=n,this._genCanvas()}},{key:"padding",get:function(){return this._padding},set:function(n){this._padding=n,this._genCanvas()}},{key:"borderWidth",get:function(){return this._borderWidth},set:function(n){this._borderWidth=n,this._genCanvas()}},{key:"borderRadius",get:function(){return this._borderRadius},set:function(n){this._borderRadius=n,this._genCanvas()}},{key:"borderColor",get:function(){return this._borderColor},set:function(n){this._borderColor=n,this._genCanvas()}},{key:"fontFace",get:function(){return this._fontFace},set:function(n){this._fontFace=n,this._genCanvas()}},{key:"fontSize",get:function(){return this._fontSize},set:function(n){this._fontSize=n,this._genCanvas()}},{key:"fontWeight",get:function(){return this._fontWeight},set:function(n){this._fontWeight=n,this._genCanvas()}},{key:"strokeWidth",get:function(){return this._strokeWidth},set:function(n){this._strokeWidth=n,this._genCanvas()}},{key:"strokeColor",get:function(){return this._strokeColor},set:function(n){this._strokeColor=n,this._genCanvas()}},{key:"_genCanvas",value:function(){var n=this,i=this._canvas,o=i.getContext("2d"),c=Array.isArray(this.borderWidth)?this.borderWidth:[this.borderWidth,this.borderWidth],l=c.map(function(D){return D*n.fontSize*.1}),h=Array.isArray(this.borderRadius)?this.borderRadius:[this.borderRadius,this.borderRadius,this.borderRadius,this.borderRadius],f=h.map(function(D){return D*n.fontSize*.1}),d=Array.isArray(this.padding)?this.padding:[this.padding,this.padding],p=d.map(function(D){return D*n.fontSize*.1}),m=this.text.split(`
|
|
3827
|
-
`),v="".concat(this.fontWeight," ").concat(this.fontSize,"px ").concat(this.fontFace);o.font=v;var M=Math.max.apply(Math,Cc(m.map(function(D){return o.measureText(D).width}))),E=this.fontSize*m.length;if(i.width=M+l[0]*2+p[0]*2,i.height=E+l[1]*2+p[1]*2,this.borderWidth){if(o.strokeStyle=this.borderColor,l[0]){var x=l[0]/2;o.lineWidth=l[0],o.beginPath(),o.moveTo(x,f[0]),o.lineTo(x,i.height-f[3]),o.moveTo(i.width-x,f[1]),o.lineTo(i.width-x,i.height-f[2]),o.stroke()}if(l[1]){var _=l[1]/2;o.lineWidth=l[1],o.beginPath(),o.moveTo(Math.max(l[0],f[0]),_),o.lineTo(i.width-Math.max(l[0],f[1]),_),o.moveTo(Math.max(l[0],f[3]),i.height-_),o.lineTo(i.width-Math.max(l[0],f[2]),i.height-_),o.stroke()}if(this.borderRadius){var P=Math.max.apply(Math,Cc(l)),T=P/2;o.lineWidth=P,o.beginPath(),[!!f[0]&&[f[0],T,T,f[0]],!!f[1]&&[i.width-f[1],i.width-T,T,f[1]],!!f[2]&&[i.width-f[2],i.width-T,i.height-T,i.height-f[2]],!!f[3]&&[f[3],T,i.height-T,i.height-f[3]]].filter(function(D){return D}).forEach(function(D){var V=sg(D,4),C=V[0],w=V[1],X=V[2],J=V[3];o.moveTo(C,X),o.quadraticCurveTo(w,X,w,J)}),o.stroke()}}this.backgroundColor&&(o.fillStyle=this.backgroundColor,this.borderRadius?(o.beginPath(),o.moveTo(l[0],f[0]),[[l[0],f[0],i.width-f[1],l[1],l[1],l[1]],[i.width-l[0],i.width-l[0],i.width-l[0],l[1],f[1],i.height-f[2]],[i.width-l[0],i.width-f[2],f[3],i.height-l[1],i.height-l[1],i.height-l[1]],[l[0],l[0],l[0],i.height-l[1],i.height-f[3],f[0]]].forEach(function(D){var V=sg(D,6),C=V[0],w=V[1],X=V[2],J=V[3],z=V[4],te=V[5];o.quadraticCurveTo(C,J,w,z),o.lineTo(X,te)}),o.closePath(),o.fill()):o.fillRect(l[0],l[1],i.width-l[0]*2,i.height-l[1]*2)),o.translate.apply(o,Cc(l)),o.translate.apply(o,Cc(p)),o.font=v,o.fillStyle=this.color,o.textBaseline="bottom";var I=this.strokeWidth>0;I&&(o.lineWidth=this.strokeWidth*this.fontSize/10,o.strokeStyle=this.strokeColor),m.forEach(function(D,V){var C=(M-o.measureText(D).width)/2,w=(V+1)*n.fontSize;I&&o.strokeText(D,C,w),o.fillText(D,C,w)}),this.material.map&&this.material.map.dispose();var k=this.material.map=new qs.Texture(i);k.minFilter=qs.LinearFilter,k.colorSpace=qs.SRGBColorSpace,k.needsUpdate=!0;var O=this.textHeight*m.length+c[1]*2+d[1]*2;this.scale.set(O*i.width/i.height,O,0)}},{key:"clone",value:function(){return new this.constructor(this.text,this.textHeight,this.color).copy(this)}},{key:"copy",value:function(n){return qs.Sprite.prototype.copy.call(this,n),this.color=n.color,this.backgroundColor=n.backgroundColor,this.padding=n.padding,this.borderWidth=n.borderWidth,this.borderColor=n.borderColor,this.fontFace=n.fontFace,this.fontSize=n.fontSize,this.fontWeight=n.fontWeight,this.strokeWidth=n.strokeWidth,this.strokeColor=n.strokeColor,this}}]),e}(qs.Sprite);class og extends Xc{constructor(e,t,n){super(-1,1,1,-1,.1,100),this.layers.mask=Wo,this.axesHelper=new wC(.5),this.axesHelper.layers.mask=Wo,this.axesHelper.material.depthTest=!1,this.axesHelper.position.set(0,0,-1),this.axesHelper.setColors(new De(PC),new De(IC),new De(DC));const i=new Zu("X",.2,Qg),o=new Zu("Y",.2,e_),c=new Zu("Z",.2,t_);i.layers.mask=Wo,o.layers.mask=Wo,c.layers.mask=Wo,i.position.set(.7,0,0),o.position.set(0,.7,0),c.position.set(0,0,.7),this.axesHelper.add(i),this.axesHelper.add(o),this.axesHelper.add(c),this.add(this.axesHelper),this._renderer=e,this._scene=t,this._scene.add(this);const l=new It;this._renderCallbackId=e.AddPostRenderCallback(()=>{const h=t.background;t.background=null,e.getViewport(l),e.setViewport(0,0,150,150),e.autoClear=!1,this.SetFromCameraMatrix(n.object.matrix),e.render(t,this),e.setViewport(l),e.autoClear=!0,t.background=h})}Dispose(){this._renderer.RemovePostRenderCallback(this._renderCallbackId),this._scene.remove(this)}SetFromCameraMatrix(e){this.axesHelper.rotation.setFromRotationMatrix(new Je().extractRotation(e).invert())}}const mh=(s,e)=>{if(Object.keys(s).length===0&&Object.keys(e).length===0)return{};if(typeof s!="object"||typeof e!="object")return e;let t={};return Object.keys(e).forEach(n=>{if(!Object.keys(s).includes(n)){t={...t,[n]:e[n]};return}if(Array.isArray(e[n])){if(!Array.isArray(s[n])){t={...t,[n]:e[n]};return}const i=s[n],o=e[n];if(i.length===0&&o.length===0){t={...t};return}if(i.length!==o.length){t={...t,[n]:e[n]};return}const c=[];if(o.forEach((l,h)=>{const f=mh(i[h],o[h]);Object.keys(f).length&&c.push(o[h])}),Object.keys(c).length){t={...t,[n]:c};return}return}if(typeof e[n]=="object"){if(typeof s[n]!="object"){t={...t,[n]:e[n]};return}const i=mh(s[n],e[n]);if(Object.keys(i).length){t={...t,[n]:i};return}}s[n]!==e[n]&&(t={...t,[n]:e[n]})}),t};var c_=(s=>(s[s.UNKNWON_ERROR=0]="UNKNWON_ERROR",s[s.NO_HTTPS=1]="NO_HTTPS",s[s.IMMERSIVE_AR_NOT_SUPPORTED_BY_DEVICE=2]="IMMERSIVE_AR_NOT_SUPPORTED_BY_DEVICE",s[s.AR_SESSION_NOT_ALLOWED=3]="AR_SESSION_NOT_ALLOWED",s))(c_||{});const Gc=class Gc{static GetSystem(){const e=navigator.platform;return/Android/.test(navigator.userAgent)?"Android":/iPhone|iPad|iPod/.test(navigator.userAgent)?"iOS":e.startsWith("Win")?"Windows":e.startsWith("Mac")?"MacOS":e.startsWith("Linux")?"Linux":"Unknown"}static async GetSupportsWebXR(){if(this._supportsWebXR!==null)return this._supportsWebXR;if(!navigator.xr)return this._supportsWebXR=!1,window.isSecureContext===!1?this._webXRUnsupportedReason=1:this._webXRUnsupportedReason=0,this._supportsWebXR;try{const e=await navigator.xr.isSessionSupported("immersive-ar");e||(this._webXRUnsupportedReason=2),this._supportsWebXR=e}catch{this._supportsWebXR=!1,this._webXRUnsupportedReason=3}return this._supportsWebXR}static GetWebXRUnsupportedReason(){return this._supportsWebXR===null?(console.log("WebXR support has not been checked yet."),null):this._webXRUnsupportedReason}static GetSupportsARQuickLook(){if(document.createElement("a").relList.supports("ar"))return!0;const t=navigator.userAgent;if(!(/iPad|iPhone|iPod/.test(t)&&!window.MSStream))return!1;const i=t.match(/OS (\d+)_/);return!i||i.length<2||parseInt(i[1],10)<12?!1:!!/^((?!chrome|android).)*safari|CriOS|FxiOS/i.test(t)}static get isMobile(){return this.GetSystem()==="Android"||this.GetSystem()==="iOS"}static get isDesktop(){return!this.isMobile}static async GetIsARCapable(){return this.GetSupportsARQuickLook()?!0:await this.GetSupportsWebXR()}};Gc._supportsWebXR=null,Gc._webXRUnsupportedReason=null;let Hc=Gc;const eP="1.18.5-beta.
|
|
3827
|
+
`),v="".concat(this.fontWeight," ").concat(this.fontSize,"px ").concat(this.fontFace);o.font=v;var M=Math.max.apply(Math,Cc(m.map(function(D){return o.measureText(D).width}))),E=this.fontSize*m.length;if(i.width=M+l[0]*2+p[0]*2,i.height=E+l[1]*2+p[1]*2,this.borderWidth){if(o.strokeStyle=this.borderColor,l[0]){var x=l[0]/2;o.lineWidth=l[0],o.beginPath(),o.moveTo(x,f[0]),o.lineTo(x,i.height-f[3]),o.moveTo(i.width-x,f[1]),o.lineTo(i.width-x,i.height-f[2]),o.stroke()}if(l[1]){var _=l[1]/2;o.lineWidth=l[1],o.beginPath(),o.moveTo(Math.max(l[0],f[0]),_),o.lineTo(i.width-Math.max(l[0],f[1]),_),o.moveTo(Math.max(l[0],f[3]),i.height-_),o.lineTo(i.width-Math.max(l[0],f[2]),i.height-_),o.stroke()}if(this.borderRadius){var P=Math.max.apply(Math,Cc(l)),T=P/2;o.lineWidth=P,o.beginPath(),[!!f[0]&&[f[0],T,T,f[0]],!!f[1]&&[i.width-f[1],i.width-T,T,f[1]],!!f[2]&&[i.width-f[2],i.width-T,i.height-T,i.height-f[2]],!!f[3]&&[f[3],T,i.height-T,i.height-f[3]]].filter(function(D){return D}).forEach(function(D){var V=sg(D,4),C=V[0],w=V[1],X=V[2],J=V[3];o.moveTo(C,X),o.quadraticCurveTo(w,X,w,J)}),o.stroke()}}this.backgroundColor&&(o.fillStyle=this.backgroundColor,this.borderRadius?(o.beginPath(),o.moveTo(l[0],f[0]),[[l[0],f[0],i.width-f[1],l[1],l[1],l[1]],[i.width-l[0],i.width-l[0],i.width-l[0],l[1],f[1],i.height-f[2]],[i.width-l[0],i.width-f[2],f[3],i.height-l[1],i.height-l[1],i.height-l[1]],[l[0],l[0],l[0],i.height-l[1],i.height-f[3],f[0]]].forEach(function(D){var V=sg(D,6),C=V[0],w=V[1],X=V[2],J=V[3],z=V[4],te=V[5];o.quadraticCurveTo(C,J,w,z),o.lineTo(X,te)}),o.closePath(),o.fill()):o.fillRect(l[0],l[1],i.width-l[0]*2,i.height-l[1]*2)),o.translate.apply(o,Cc(l)),o.translate.apply(o,Cc(p)),o.font=v,o.fillStyle=this.color,o.textBaseline="bottom";var I=this.strokeWidth>0;I&&(o.lineWidth=this.strokeWidth*this.fontSize/10,o.strokeStyle=this.strokeColor),m.forEach(function(D,V){var C=(M-o.measureText(D).width)/2,w=(V+1)*n.fontSize;I&&o.strokeText(D,C,w),o.fillText(D,C,w)}),this.material.map&&this.material.map.dispose();var k=this.material.map=new qs.Texture(i);k.minFilter=qs.LinearFilter,k.colorSpace=qs.SRGBColorSpace,k.needsUpdate=!0;var O=this.textHeight*m.length+c[1]*2+d[1]*2;this.scale.set(O*i.width/i.height,O,0)}},{key:"clone",value:function(){return new this.constructor(this.text,this.textHeight,this.color).copy(this)}},{key:"copy",value:function(n){return qs.Sprite.prototype.copy.call(this,n),this.color=n.color,this.backgroundColor=n.backgroundColor,this.padding=n.padding,this.borderWidth=n.borderWidth,this.borderColor=n.borderColor,this.fontFace=n.fontFace,this.fontSize=n.fontSize,this.fontWeight=n.fontWeight,this.strokeWidth=n.strokeWidth,this.strokeColor=n.strokeColor,this}}]),e}(qs.Sprite);class og extends Xc{constructor(e,t,n){super(-1,1,1,-1,.1,100),this.layers.mask=Wo,this.axesHelper=new wC(.5),this.axesHelper.layers.mask=Wo,this.axesHelper.material.depthTest=!1,this.axesHelper.position.set(0,0,-1),this.axesHelper.setColors(new De(PC),new De(IC),new De(DC));const i=new Zu("X",.2,Qg),o=new Zu("Y",.2,e_),c=new Zu("Z",.2,t_);i.layers.mask=Wo,o.layers.mask=Wo,c.layers.mask=Wo,i.position.set(.7,0,0),o.position.set(0,.7,0),c.position.set(0,0,.7),this.axesHelper.add(i),this.axesHelper.add(o),this.axesHelper.add(c),this.add(this.axesHelper),this._renderer=e,this._scene=t,this._scene.add(this);const l=new It;this._renderCallbackId=e.AddPostRenderCallback(()=>{const h=t.background;t.background=null,e.getViewport(l),e.setViewport(0,0,150,150),e.autoClear=!1,this.SetFromCameraMatrix(n.object.matrix),e.render(t,this),e.setViewport(l),e.autoClear=!0,t.background=h})}Dispose(){this._renderer.RemovePostRenderCallback(this._renderCallbackId),this._scene.remove(this)}SetFromCameraMatrix(e){this.axesHelper.rotation.setFromRotationMatrix(new Je().extractRotation(e).invert())}}const mh=(s,e)=>{if(Object.keys(s).length===0&&Object.keys(e).length===0)return{};if(typeof s!="object"||typeof e!="object")return e;let t={};return Object.keys(e).forEach(n=>{if(!Object.keys(s).includes(n)){t={...t,[n]:e[n]};return}if(Array.isArray(e[n])){if(!Array.isArray(s[n])){t={...t,[n]:e[n]};return}const i=s[n],o=e[n];if(i.length===0&&o.length===0){t={...t};return}if(i.length!==o.length){t={...t,[n]:e[n]};return}const c=[];if(o.forEach((l,h)=>{const f=mh(i[h],o[h]);Object.keys(f).length&&c.push(o[h])}),Object.keys(c).length){t={...t,[n]:c};return}return}if(typeof e[n]=="object"){if(typeof s[n]!="object"){t={...t,[n]:e[n]};return}const i=mh(s[n],e[n]);if(Object.keys(i).length){t={...t,[n]:i};return}}s[n]!==e[n]&&(t={...t,[n]:e[n]})}),t};var c_=(s=>(s[s.UNKNWON_ERROR=0]="UNKNWON_ERROR",s[s.NO_HTTPS=1]="NO_HTTPS",s[s.IMMERSIVE_AR_NOT_SUPPORTED_BY_DEVICE=2]="IMMERSIVE_AR_NOT_SUPPORTED_BY_DEVICE",s[s.AR_SESSION_NOT_ALLOWED=3]="AR_SESSION_NOT_ALLOWED",s))(c_||{});const Gc=class Gc{static GetSystem(){const e=navigator.platform;return/Android/.test(navigator.userAgent)?"Android":/iPhone|iPad|iPod/.test(navigator.userAgent)?"iOS":e.startsWith("Win")?"Windows":e.startsWith("Mac")?"MacOS":e.startsWith("Linux")?"Linux":"Unknown"}static async GetSupportsWebXR(){if(this._supportsWebXR!==null)return this._supportsWebXR;if(!navigator.xr)return this._supportsWebXR=!1,window.isSecureContext===!1?this._webXRUnsupportedReason=1:this._webXRUnsupportedReason=0,this._supportsWebXR;try{const e=await navigator.xr.isSessionSupported("immersive-ar");e||(this._webXRUnsupportedReason=2),this._supportsWebXR=e}catch{this._supportsWebXR=!1,this._webXRUnsupportedReason=3}return this._supportsWebXR}static GetWebXRUnsupportedReason(){return this._supportsWebXR===null?(console.log("WebXR support has not been checked yet."),null):this._webXRUnsupportedReason}static GetSupportsARQuickLook(){if(document.createElement("a").relList.supports("ar"))return!0;const t=navigator.userAgent;if(!(/iPad|iPhone|iPod/.test(t)&&!window.MSStream))return!1;const i=t.match(/OS (\d+)_/);return!i||i.length<2||parseInt(i[1],10)<12?!1:!!/^((?!chrome|android).)*safari|CriOS|FxiOS/i.test(t)}static get isMobile(){return this.GetSystem()==="Android"||this.GetSystem()==="iOS"}static get isDesktop(){return!this.isMobile}static async GetIsARCapable(){return this.GetSupportsARQuickLook()?!0:await this.GetSupportsWebXR()}};Gc._supportsWebXR=null,Gc._webXRUnsupportedReason=null;let Hc=Gc;const eP="1.18.5-beta.3",tP={version:eP};function Di(s,e){const t=(s+"e").split("e");return+(t[0]+"e"+(+t[1]+(e||0)))}function nP(s,e=0){const t=Di(s,+e);return Di(Math.ceil(t),-e)}function iP(s,e=0){const t=Di(s,+e);return Di(Math.floor(t),-e)}function l_(s,e=0){if(s<0)return-l_(-s,e);const t=Di(s,+e);return Di(Math.round(t),-e)}function rP(s,e,t){return Math.atan2(s.clone().cross(e).dot(t),e.clone().dot(s))}function sP(s,e=0){const t=Di(s,+e);return Di(Math.round(t),-e).toFixed(e)}function oP(s,e=0){const t=Di(s,+e);return Di(Math.trunc(t),-e)}function aP(s){return(vi.radToDeg(s)+360)%360}function cP(s){return vi.degToRad(s)}const lP={ceilExp:nP,floorExp:iP,roundExp:l_,toFixedExp:sP,truncateExp:oP,signedAngleTo:rP,radToDeg:aP,degToRad:cP},u_={autoResize:!0,displayAxes:!1,renderer:Zr,perspectiveCamera:jo,orbitControls:Pc};class Fh{static QuickView(e,t){const n=new Fh(t);n.Communication.PerformAction("SET_CAMERA_TRANSFORM",{position:{x:0,y:2,z:2},target:{x:0,y:.5,z:0}});const i=vi.generateUUID();n.Communication.PerformAction("ADD_OBJECT",{entityType:"light",type:"scene",name:"light",id:i,enabled:!0,visible:!0,intensity:1,color:16777215});const o=vi.generateUUID();return n.Communication.Subscribe("MODEL_LOADED",c=>{if(c.id!==o)return;const l=n.Communication.PerformAction("COMPUTE_ENCOMPASSING_VIEW",{});n.Communication.PerformAction("SET_CAMERA_TRANSFORM",{position:l.position,target:l.target})}),n.Communication.PerformAction("ADD_OBJECT",{entityType:"model",name:"object",id:o,position:{x:0,y:0,z:0},rotation:{x:0,y:0,z:0},scale:{x:1,y:1,z:1},uri:e,visible:!0,loaded:!1}),n.Communication.PerformAction("UPDATE_SCENE",{backgroundColor:16777215,gridEnabled:!1,floorColor:16777215}),n}get Communication(){return this.communication}get Canvas(){return this.renderer.domElement}get Info(){return Hc}set Settings(e){var n;const t=mh(this._settings,e);t.renderer&&(this.renderer=new jm(this._settings.renderer)),t.perspectiveCamera&&(t.perspectiveCamera.fov!==void 0&&(this.perspectiveCamera.fov=t.perspectiveCamera.fov),t.perspectiveCamera.near!==void 0&&(this.perspectiveCamera.near=t.perspectiveCamera.near),t.perspectiveCamera.far!==void 0&&(this.perspectiveCamera.far=t.perspectiveCamera.far),this.perspectiveCamera.OnResize(this.renderer.domElement.width,this.renderer.domElement.height)),t.orbitControls&&(t.orbitControls.enableDamping!==void 0&&(this.orbitControls.enableDamping=t.orbitControls.enableDamping),t.orbitControls.dampingFactor!==void 0&&(this.orbitControls.dampingFactor=t.orbitControls.dampingFactor)),t.autoResize!==this._settings.autoResize&&(t.autoResize?this.addResizeObserver():this.removeResizeObserver()),t.displayAxes?this.axisCamera=new og(this.renderer,this.scene,this.orbitControls):((n=this.axisCamera)==null||n.Dispose(),this.axisCamera=null),Object.assign(this._settings,e)}constructor(e){this._settings={...u_,...e!==void 0?e:{}},this._resizeObserverId="",this._width=0,this._height=0,this.renderer=new jm(this._settings.renderer),this.scene=new IL,this.perspectiveCamera=new kc(this._settings.perspectiveCamera),this.animationSystem=new BL(this.renderer),this.orbitControls=new hh(this.perspectiveCamera,this.renderer,this.animationSystem,this._settings.orbitControls),this.toolbox=new fh(this.scene,this.orbitControls),this.communication=new On(this.renderer,this.scene,this.orbitControls,this.toolbox),this._settings.displayAxes?this.axisCamera=new og(this.renderer,this.scene,this.orbitControls):this.axisCamera=null,this._settings.autoResize&&this.addResizeObserver(),this.renderer.StartRenderer(this.scene,this.perspectiveCamera),window.DIVE={PrintScene:()=>{console.log(this.scene)}},console.log(`DIVE ${tP.version} initialized successfully!`),console.log(`
|
|
3828
3828
|
@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@@@@@@@
|
|
3829
3829
|
@@@@+-:::::::---------------------==------------------------------=#@@@@
|
|
3830
3830
|
@@%=::::.......::---------------------------------------------------------+@@
|
|
@@ -3854,4 +3854,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
3854
3854
|
@@@@@@@ @@@@@@
|
|
3855
3855
|
|
|
3856
3856
|
`)}Dispose(){var e;this.removeResizeObserver(),this.renderer.Dispose(),this.orbitControls.Dispose(),(e=this.axisCamera)==null||e.Dispose(),this.animationSystem.Dispose(),this.toolbox.Dispose(),this.communication.DestroyInstance()}OnResize(e,t){this.renderer.OnResize(e,t),this.perspectiveCamera.OnResize(e,t)}addResizeObserver(){this._resizeObserverId=this.renderer.AddPreRenderCallback(()=>{const e=this.renderer.domElement.parentElement;if(!e)return;const{clientWidth:t,clientHeight:n}=e;t===this._width&&n===this._height||(this.OnResize(t,n),this._width=t,this._height=n)})}removeResizeObserver(){this.renderer.RemovePreRenderCallback(this._resizeObserverId)}}exports.BufferAttribute=Qt;exports.CanvasTexture=X1;exports.ClampToEdgeWrapping=er;exports.Color=De;exports.CompressedTexture=W1;exports.DIVE=Fh;exports.DIVECommunication=On;exports.DIVEDefaultSettings=u_;exports.DIVEInfo=Hc;exports.DIVEMath=lP;exports.DIVEPerspectiveCamera=kc;exports.DoubleSide=pi;exports.GLTFLoader=n_;exports.InterpolateDiscrete=io;exports.InterpolateLinear=ts;exports.LinearFilter=Pn;exports.LinearMipmapLinearFilter=Ri;exports.LinearMipmapNearestFilter=Zo;exports.MathUtils=vi;exports.Matrix4=Je;exports.Mesh=un;exports.MeshBasicMaterial=nr;exports.MirroredRepeatWrapping=ta;exports.NearestFilter=En;exports.NearestMipmapLinearFilter=Ys;exports.NearestMipmapNearestFilter=_h;exports.NoColorSpace=Qi;exports.Object3D=St;exports.PerspectiveCamera=Mn;exports.PlaneGeometry=ss;exports.PropertyBinding=Rt;exports.Quaternion=xi;exports.RGBAFormat=ii;exports.Raycaster=Dh;exports.RepeatWrapping=es;exports.RingGeometry=wh;exports.SRGBColorSpace=nn;exports.Scene=Hg;exports.ShaderMaterial=sr;exports.Source=yh;exports.Uniform=Ih;exports.Vector2=Ne;exports.Vector3=F;exports.WebGLRenderer=zg;exports.WebXRUnsupportedReason=c_;
|
|
3857
|
-
//# sourceMappingURL=dive-
|
|
3857
|
+
//# sourceMappingURL=dive-BTQZqHRt.cjs.map
|