run-scene-v2 0.0.61 → 0.0.62

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.
Files changed (2) hide show
  1. package/index.js +1 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("three"),require("axios"),require("uuid1"),require("js-funcs"),require("js-funcs-three"),require("@allex/md5")):"function"==typeof define&&define.amd?define(["three","axios","uuid1","js-funcs","js-funcs-three","@allex/md5"],t):"object"==typeof exports?exports.RunScene=t(require("three"),require("axios"),require("uuid1"),require("js-funcs"),require("js-funcs-three"),require("@allex/md5")):e.RunScene=t(e.three,e.axios,e.uuid1,e["js-funcs"],e["js-funcs-three"],e["@allex/md5"])}(self,((__WEBPACK_EXTERNAL_MODULE__8881__,__WEBPACK_EXTERNAL_MODULE__3300__,__WEBPACK_EXTERNAL_MODULE__7937__,__WEBPACK_EXTERNAL_MODULE__6001__,__WEBPACK_EXTERNAL_MODULE__4356__,__WEBPACK_EXTERNAL_MODULE__1129__)=>(()=>{var __webpack_modules__={7695:(e,t,r)=>{"use strict";function n(){return(n="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=l(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&o(e,t)}function o(e,t){return(o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===f(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return s(n)}}function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(e,t,r){return t&&u(e.prototype,t),r&&u(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?p(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function f(e){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e){return void 0===e}function g(){return"undefined"!=typeof window}function v(e){return ze(e)||Ne(e)}function y(e){return(nt=E(e,rt))&&Ar}function b(e,t){return!t&&console.warn(e)}function x(e,t){return e&&(rt[e]=t)&&nt&&(nt[e]=t)||rt}function w(){return 0}function A(e,t,r){return(r=e[t])&&ze(r)?e[t]():m(r)&&e.getAttribute&&e.getAttribute(t)||r}function S(e,t){(e=e.split(",")).forEach(t)}function B(e,t,r,n){at.length&&gt(),e.render(t,r,n),at.length&&gt()}function M(e){var t=parseFloat(e);return(t||0===t)&&(e+"").match(et).length<2?t:Ne(e)?e.trim():e}function C(e){return e}function E(e,t){for(var r in t)e[r]=t[r];return e}function _(e,t){for(var r in t)"__proto__"!==r&&"constructor"!==r&&"prototype"!==r&&(e[r]=Je(t[r])?_(e[r]||(e[r]={}),t[r]):t[r]);return e}function T(e){var t,r=e.parent||le,n=e.keyframes?(t=Xe(e.keyframes),function(e,r){for(var n in r)n in e||"duration"===n&&t||"ease"===n||(e[n]=r[n])}):vt;if(Ke(e.inherit))for(;r;)n(e,r.vars.defaults),r=r.parent||r._dp;return e}function D(e){return!e||e._ts&&D(e.parent)}function R(e){return e._repeat?O(e._tTime,e=e.duration()+e._rDelay)*e:0}function O(e,t){return t=Math.floor(e/=t),e&&t===e?t-1:t}function P(e,t){return(e-t._start)*t._ts+(0<=t._ts?0:t._dirty?t.totalDuration():t._tDur)}function I(e,t){var r;if((t._time||t._initted&&!t._dur)&&(r=P(e.rawTime(),t),(!t._dur||V(0,t.totalDuration(),r)-t._tTime>ke)&&t.render(r,!0)),wt(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur<e.duration())for(r=e;r._dp;)0<=r.rawTime()&&r.totalTime(r._tTime),r=r._dp;e._zTime=-ke}}function k(e,t,r,n){return t.parent&&xt(t),t._start=mt((Ve(r)?r:r||e!==le?N(e,r,t):e._time)+t._delay),t._end=mt(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),function(e,t){var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"_first",i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"_last",o=4<arguments.length?arguments[4]:void 0,a=e[i];if(o)for(r=t[o];a&&a[o]>r;)a=a._prev;a?(t._next=a._next,a._next=t):(t._next=e[n],e[n]=t),t._next?t._next._prev=t:e[i]=t,t._prev=a,t.parent=t._dp=e}(e,t,"_first","_last",e._sort?"_start":0),G(t)||(e._recent=t),n||I(e,t),e}function L(e,t){(rt.ScrollTrigger||it("scrollTrigger",t))&&rt.ScrollTrigger.create(t,e)}function F(e,t,r,n){return Wt(e,t),e._initted?!r&&e._pt&&(e._dur&&!1!==e.vars.lazy||!e._dur&&e.vars.lazy)&&pe!==Ut.frame?(at.push(e),e._lazy=[t,n]):void 0:1}function U(e){return(e=e.parent)&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||U(e))}function G(e){return"isFromStart"===(e=e.data)||"isStart"===e}function j(e,t,r,n){var i=e._repeat,o=mt(t)||0;return(t=e._tTime/e._tDur)&&!n&&(e._time*=o/e._dur),e._dur=o,e._tDur=i?i<0?1e10:mt(o*(i+1)+e._rDelay*i):o,0<t&&!n?St(e,e._tTime=e._tDur*t):e.parent&&At(e),r||wt(e.parent,e),e}function H(e){return e instanceof or?wt(e):j(e,e._dur)}function N(e,t,r){var n,i,o,a=e.labels,s=e._recent||Bt,l=e.duration()>=Ie?s.endTime(!1):e._dur;return Ne(t)&&(isNaN(t)||t in a)?(i=t.charAt(0),o="%"===t.substr(-1),n=t.indexOf("="),"<"===i||">"===i?(0<=n&&(t=t.replace(/=/,"")),("<"===i?s._start:s.endTime(0<=s._repeat))+(parseFloat(t.substr(1))||0)*(o?(n<0?s:r).totalDuration()/100:1)):n<0?(t in a||(a[t]=l),a[t]):(i=parseFloat(t.charAt(n-1)+t.substr(n+1)),o&&r&&(i=i/100*(Xe(r)?r[0]:r).totalDuration()),1<n?N(e,t.substr(0,n-1),r)+i:l+i)):null==t?l:+t}function z(e,t,r){var n,i,o=Ve(t[1]),a=(o?2:1)+(e<2?0:1),s=t[a];if(o&&(s.duration=t[1]),s.parent=r,e){for(n=s,i=r;i&&!("immediateRender"in n);)n=i.vars.defaults||{},i=Ke(i.vars.inherit)&&i.parent;s.immediateRender=Ke(n.immediateRender),e<2?s.runBackwards=1:s.startAt=t[a-1]}return new hr(t[0],s,t[1+a])}function V(e,t,r){return r<e?e:t<r?t:r}function J(e){if(ze(e))return e;var t=Je(e)?e:{each:e},r=Vt(t.ease),n=t.from||0,i=parseFloat(t.base)||0,o={},a=(e=0<n&&n<1,isNaN(n)||e),s=t.axis,l=n,u=n;return Ne(n)?l=u={center:.5,edges:.5,end:1}[n]||0:!e&&a&&(l=n[0],u=n[1]),function(e,c,h){var d,p,f,m,g,v,y,b,x=(h||t).length,w=o[x];if(!w){if(!(b="auto"===t.grid?0:(t.grid||[1,Ie])[1])){for(v=-Ie;v<(v=h[b++].getBoundingClientRect().left)&&b<x;);b--}for(w=o[x]=[],d=a?Math.min(b,x)*l-.5:n%b,p=b===Ie?0:a?x*u/b-.5:n/b|0,y=Ie,g=v=0;g<x;g++)m=g%b-d,f=p-(g/b|0),w[g]=m=s?Math.abs("y"===s?f:m):Ge(m*m+f*f),v<m&&(v=m),m<y&&(y=m);"random"===n&&Dt(w),w.max=v-y,w.min=y,w.v=x=(parseFloat(t.amount)||parseFloat(t.each)*(x<b?x-1:s?"y"===s?x/b:b:Math.max(b,x/b))||0)*("edges"===n?-1:1),w.b=x<0?i-x:i,w.u=Ct(t.amount||t.each)||0,r=r&&x<0?zt(r):r}return x=(w[e]-w.min)/w.max||0,mt(w.b+(r?r(x):x)*w.v)+w.u}}function K(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(r){var n=Math.round(parseFloat(r)/e)*e*t;return(n-n%1)/t+(Ve(r)?0:Ct(r))}}function W(e,t){var r,n,i=Xe(e);return!i&&Je(e)&&(r=i=e.radius||Ie,e.values?(e=Tt(e.values),(n=!Ve(e[0]))&&(r*=r)):e=K(e.increment)),Mt(t,i?ze(e)?function(t){return n=e(t),Math.abs(n-t)<=r?n:t}:function(t){for(var i,o,a=parseFloat(n?t.x:t),s=parseFloat(n?t.y:0),l=Ie,u=0,c=e.length;c--;)(i=n?(i=e[c].x-a)*i+(o=e[c].y-s)*o:Math.abs(e[c]-a))<l&&(l=i,u=c);return u=!r||l<=r?e[u]:t,n||u===t||Ve(t)?u:u+Ct(t)}:K(e))}function X(e,t,r,n){return Mt(Xe(e)?!t:!0===r?!!(r=0):!n,(function(){return Xe(e)?e[~~(Math.random()*e.length)]:(r=r||1e-5)&&(n=r<1?Math.pow(10,(r+"").length-2):1)&&Math.floor(Math.round((e-r/2+Math.random()*(t-e+.99*r))/r)*r*n)/n}))}function Q(e,t,r){return Mt(r,(function(r){return e[~~t(r)]}))}function Z(e,t,r,n,i){var o=t-e,a=n-r;return Mt(i,(function(t){return r+((t-e)/o*a||0)}))}function Y(e,t,r){var n,i,o,a=e.labels,s=Ie;for(n in a)(i=a[n]-t)<0==!!r&&i&&s>(i=Math.abs(i))&&(o=n,s=i);return o}function q(e,t,r){var n=e.vars,i=n[t];i&&(t=n[t+"Params"],n=n.callbackScope||e,r&&at.length&&gt(),t?i.apply(n,t):i.call(n))}function $(e){return xt(e),e.scrollTrigger&&e.scrollTrigger.kill(!1),e.progress()<1&&q(e,"onInterrupt"),e}function ee(e,t,r){return(6*(e+=e<0?1:1<e?-1:0)<1?t+(r-t)*e*6:e<.5?r:3*e<2?t+(r-t)*(2/3-e)*6:t)*Ot+.5|0}function te(e,t,r){var n,i,o,a,s="",l=(e+s).match(Lt),u=t?"hsla(":"rgba(",c=0;if(!l)return e;if(l=l.map((function(e){return(e=It(e,t,1))&&u+(t?e[0]+","+e[1]+"%,"+e[2]+"%,"+e[3]:e.join(","))+")"})),r&&(o=kt(e),(n=r.c).join(s)!==o.c.join(s)))for(a=(i=e.replace(Lt,"1").split(Ye)).length-1;c<a;c++)s+=i[c]+(~n.indexOf(c)?l.shift()||u+"0,0,0,0)":(o.length?o:l.length?l:r).shift());if(!i)for(a=(i=e.split(Lt)).length-1;c<a;c++)s+=i[c]+l[c];return s+i[a]}function re(e,t){for(var r,n=e._first;n;)n instanceof or?re(n,t):!n.vars.yoyoEase||n._yoyo&&n._repeat||n._yoyo===t||(n.timeline?re(n.timeline,t):(r=n._ease,n._ease=n._yEase,n._yEase=r,n._yoyo=t)),n=n._next}function ne(e,t){var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:function(e){return 1-t(1-e)},i={easeIn:t,easeOut:n,easeInOut:3<arguments.length&&void 0!==arguments[3]?arguments[3]:function(e){return e<.5?t(2*e)/2:1-t(2*(1-e))/2}};S(e,(function(e){for(var t in jt[e]=rt[e]=i,jt[r=e.toLowerCase()]=n,i)jt[r+("easeIn"===t?".in":"easeOut"===t?".out":".inOut")]=jt[e+"."+t]=i[t]}))}function ie(e){return function(t){return t<.5?(1-e(1-2*t))/2:.5+e(2*(t-.5))/2}}function oe(e,t,r){function n(e){return 1===e?1:i*Math.pow(2,-10*e)*He((e-o)*a)+1}var i=1<=t?t:1,o=(a=(r||(e?.3:.45))/(t<1?t:1))/Le*(Math.asin(1/i)||0),a=(r="out"===e?n:"in"===e?function(e){return 1-n(1-e)}:ie(n),Le/a);return r.config=function(t,r){return oe(e,t,r)},r}function ae(e){function t(e){return e?--e*e*((r+1)*e+r)+1:0}var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1.70158,n="out"===e?t:"in"===e?function(e){return 1-t(1-e)}:ie(t);return n.config=function(t){return ae(e,t)},n}r.d(t,{Q3:()=>hr});var se,le,ue,ce,he,de,pe,fe,me,ge,ve,ye,be,xe,we,Ae,Se,Be,Me,Ce,Ee,_e,Te,De,Re,Oe={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Pe={duration:.5,overwrite:!1,delay:0},Ie=1e8,ke=1/Ie,Le=2*Math.PI,Fe=Le/4,Ue=0,Ge=Math.sqrt,je=Math.cos,He=Math.sin,Ne=function(e){return"string"==typeof e},ze=function(e){return"function"==typeof e},Ve=function(e){return"number"==typeof e},Je=function(e){return"object"==f(e)},Ke=function(e){return!1!==e},We="function"==typeof ArrayBuffer&&ArrayBuffer.isView||function(){},Xe=Array.isArray,Qe=/(?:-?\.?\d|\.)+/gi,Ze=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Ye=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,qe=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,$e=/[+-]=-?[.\d]+/,et=/[^,'"\[\]\s]+/gi,tt=/[\d.+\-=]+(?:e[-+]\d*)*/i,rt={},nt={},it=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},ot={},at=[],st={},lt={},ut={},ct=30,ht=[],dt="",pt=function(e){var t,r,n=e[0];if(Je(n)||ze(n)||(e=[e]),!(t=(n._gsap||{}).harness)){for(r=ht.length;r--&&!ht[r].targetTest(n););t=ht[r]}for(r=e.length;r--;)e[r]&&(e[r]._gsap||(e[r]._gsap=new nr(e[r],t)))||e.splice(r,1);return e},ft=function(e){return e._gsap||pt(Tt(e))[0]._gsap},mt=function(e){return Math.round(1e7*e)/1e7||0},gt=function(){var e,t,r=at.length,n=at.slice(0);for(st={},e=at.length=0;e<r;e++)(t=n[e])&&t._lazy&&(t.render(t._lazy[0],t._lazy[1],!0)._lazy=0)},vt=function(e,t){for(var r in t)r in e||(e[r]=t[r]);return e},yt=function(e,t){var r,n={};for(r in e)r in t||(n[r]=e[r]);return n},bt=function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"_first",n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"_last",i=t._prev,o=t._next;i?i._next=o:e[r]===t&&(e[r]=o),o?o._prev=i:e[n]===t&&(e[n]=i),t._next=t._prev=t.parent=null},xt=function(e,t){!e.parent||t&&!e.parent.autoRemoveChildren||e.parent.remove(e),e._act=0},wt=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var r=e;r;)r._dirty=1,r=r.parent;return e},At=function(e){return e._end=mt(e._start+(e._tDur/Math.abs(e._ts||e._rts||ke)||0))},St=function(e,t){var r=e._dp;return r&&r.smoothChildTiming&&e._ts&&(e._start=mt(r._time-(0<e._ts?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),At(e),r._dirty||wt(r,e)),e},Bt={_start:0,endTime:w,totalDuration:w},Mt=function(e,t){return e||0===e?t(e):t},Ct=function(e,t){return Ne(e)&&(t=tt.exec(e))?e.substr(t.index+t[0].length):""},Et=[].slice,_t=function(e,t){return e&&Je(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&Je(e[0]))&&!e.nodeType&&e!==ue},Tt=function(e,t,r){return!Ne(e)||r||!ce&&Gt()?Xe(e)?function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[];return e.forEach((function(e){return Ne(e)&&!t||_t(e,1)?r.push.apply(r,d(Tt(e))):r.push(e)}))||r}(e,r):_t(e)?Et.call(e,0):e?[e]:[]:Et.call((t||he).querySelectorAll(e),0)},Dt=function(e){return e.sort((function(){return.5-Math.random()}))},Rt=function(e){for(var t,r,n,i,o=0,a="";~(t=e.indexOf("random(",o));)n=e.indexOf(")",t),i="["===e.charAt(t+7),r=e.substr(t+7,n-t-7).match(i?et:Qe),a+=e.substr(o,t-o)+X(i?r:+r[0],i?0:+r[1],+r[2]||1e-5),o=n+1;return a+e.substr(o,e.length-o)},Ot=255,Pt={aqua:[0,Ot,Ot],lime:[0,Ot,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Ot],navy:[0,0,128],white:[Ot,Ot,Ot],olive:[128,128,0],yellow:[Ot,Ot,0],orange:[Ot,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Ot,0,0],pink:[Ot,192,203],cyan:[0,Ot,Ot],transparent:[Ot,Ot,Ot,0]},It=function(e,t,r){var n,i,o,a,s,l,u,c=e?Ve(e)?[e>>16,e>>8&Ot,e&Ot]:0:Pt.black;if(!c){if(","===e.substr(-1)&&(e=e.substr(0,e.length-1)),Pt[e])c=Pt[e];else if("#"===e.charAt(0)){if(9===(e=e.length<6?"#"+(n=e.charAt(1))+n+(i=e.charAt(2))+i+(o=e.charAt(3))+o+(5===e.length?e.charAt(4)+e.charAt(4):""):e).length)return[(c=parseInt(e.substr(1,6),16))>>16,c>>8&Ot,c&Ot,parseInt(e.substr(7),16)/255];c=[(e=parseInt(e.substr(1),16))>>16,e>>8&Ot,e&Ot]}else if("hsl"===e.substr(0,3))if(c=u=e.match(Qe),t){if(~e.indexOf("="))return c=e.match(Ze),r&&c.length<4&&(c[3]=1),c}else a=+c[0]%360/360,s=+c[1]/100,n=2*(l=+c[2]/100)-(i=l<=.5?l*(s+1):l+s-l*s),3<c.length&&(c[3]*=1),c[0]=ee(a+1/3,n,i),c[1]=ee(a,n,i),c[2]=ee(a-1/3,n,i);else c=e.match(Qe)||Pt.transparent;c=c.map(Number)}return t&&!u&&(n=c[0]/Ot,i=c[1]/Ot,o=c[2]/Ot,l=((e=Math.max(n,i,o))+(t=Math.min(n,i,o)))/2,e===t?a=s=0:(u=e-t,s=.5<l?u/(2-e-t):u/(e+t),a=e===n?(i-o)/u+(i<o?6:0):e===i?(o-n)/u+2:(n-i)/u+4,a*=60),c[0]=~~(a+.5),c[1]=~~(100*s+.5),c[2]=~~(100*l+.5)),r&&c.length<4&&(c[3]=1),c},kt=function(e){var t=[],r=[],n=-1;return e.split(Lt).forEach((function(e){e=e.match(Ye)||[],t.push.apply(t,d(e)),r.push(n+=e.length+1)})),t.c=r,t},Lt=function(){var e,t="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b";for(e in Pt)t+="|"+e+"\\b";return new RegExp(t+")","gi")}(),Ft=/hsl[a]?\(/,Ut=(we=Date.now,Ae=500,Se=33,Be=we(),Me=Be,Ee=Ce=1e3/240,Te={time:0,frame:0,tick:function(){Jt(!0)},deltaRatio:function(e){return be/(1e3/(e||60))},wake:function(){de&&(!ce&&g()&&(ue=ce=window,he=ue.document||{},rt.gsap=Ar,(ue.gsapVersions||(ue.gsapVersions=[])).push(Ar.version),y(nt||ue.GreenSockGlobals||!ue.gsap&&ue||{}),ye=ue.requestAnimationFrame),ge&&Te.sleep(),ve=ye||function(e){return setTimeout(e,Ee-1e3*Te.time+1|0)},me=1,Jt(2))},sleep:function(){(ye?ue.cancelAnimationFrame:clearTimeout)(ge),me=0,ve=w},lagSmoothing:function(e,t){Ae=e||1/ke,Se=Math.min(t,Ae,0)},fps:function(e){Ce=1e3/(e||240),Ee=1e3*Te.time+Ce},add:function(e){_e.indexOf(e)<0&&_e.push(e),Gt()},remove:function(e,t){~(t=_e.indexOf(e))&&_e.splice(t,1)&&t<=xe&&xe--},_listeners:_e=[]}),Gt=function(){return!me&&Ut.wake()},jt={},Ht=/^[\d.\-M][\d.\-,\s]/,Nt=/["']/g,zt=function(e){return function(t){return 1-e(1-t)}},Vt=function(e,t){return e&&(ze(e)?e:jt[e]||function(e){var t,r,n,i=(e+"").split("("),o=jt[i[0]];return o&&1<i.length&&o.config?o.config.apply(null,~e.indexOf("{")?[function(e){for(var t,r,n,i={},o=e.substr(1,e.length-3).split(":"),a=o[0],s=1,l=o.length;s<l;s++)r=o[s],t=s!==l-1?r.lastIndexOf(","):r.length,n=r.substr(0,t),i[a]=isNaN(n)?n.replace(Nt,"").trim():+n,a=r.substr(t+1).trim();return i}(i[1])]:(t=(i=e).indexOf("(")+1,r=i.indexOf(")"),n=i.indexOf("(",t),i.substring(t,~n&&n<r?i.indexOf(")",r+1):r).split(",").map(M))):jt._CE&&Ht.test(e)?jt._CE("",e):o}(e))||t};function Jt(e){var t,r,n,i=we()-Me,o=!0===e;if(Ae<i&&(Be+=i-Se),(0<(i=(r=(Me+=i)-Be)-Ee)||o)&&(n=++Te.frame,be=r-1e3*Te.time,Te.time=r/=1e3,Ee+=i+(Ce<=i?4:Ce-i),t=1),o||(ge=ve(Jt)),t)for(xe=0;xe<_e.length;xe++)_e[xe](r,be,n,e)}function Kt(e){return e<Re?De*e*e:e<.7272727272727273?De*Math.pow(e-1.5/2.75,2)+.75:e<.9090909090909092?De*(e-=2.25/2.75)*e+.9375:De*Math.pow(e-2.625/2.75,2)+.984375}function Wt(e,t){var r,n,i,o,a,s,l,u,c,h,d,p,f,m=e.vars,g=m.ease,v=m.startAt,y=m.immediateRender,b=m.lazy,x=m.onUpdate,w=m.onUpdateParams,A=m.callbackScope,S=m.runBackwards,B=m.yoyoEase,M=m.keyframes,C=m.autoRevert,E=e._dur,_=e._startAt,T=e._targets,D=e.parent,R=D&&"nested"===D.data?D.parent._targets:T,O="auto"===e._overwrite&&!se,P=e.timeline;if(e._ease=Vt(g=!P||M&&g?g:"none",Pe.ease),e._yEase=B?zt(Vt(!0===B?g:B,Pe.ease)):0,B&&e._yoyo&&!e._repeat&&(B=e._yEase,e._yEase=e._ease,e._ease=B),e._from=!P&&!!m.runBackwards,!P||M&&!m.stagger){if(p=(u=T[0]?ft(T[0]).harness:0)&&m[u.prop],r=yt(m,ot),_&&xt(_.render(-1,!0)),v)if(xt(e._startAt=hr.set(T,vt({data:"isStart",overwrite:!1,parent:D,immediateRender:!0,lazy:Ke(b),startAt:null,delay:0,onUpdate:x,onUpdateParams:w,callbackScope:A,stagger:0},v))),t<0&&!y&&!C&&e._startAt.render(-1,!0),y){if(0<t&&!C&&(e._startAt=0),E&&t<=0)return void(t&&(e._zTime=t))}else!1===C&&(e._startAt=0);else if(S&&E)if(_)C||(e._startAt=0);else if(i=vt({overwrite:!1,data:"isFromStart",lazy:(y=!t&&y)&&Ke(b),immediateRender:y,stagger:0,parent:D},r),p&&(i[u.prop]=p),xt(e._startAt=hr.set(T,i)),t<0&&e._startAt.render(-1,!0),e._zTime=t,y){if(!t)return}else Wt(e._startAt,ke);for(e._pt=0,b=E&&Ke(b)||b&&!E,n=0;n<T.length;n++){if(l=(a=T[n])._gsap||pt(T)[n]._gsap,e._ptLookup[n]=h={},st[l.id]&&at.length&&gt(),d=R===T?n:R.indexOf(a),u&&!1!==(c=new u).init(a,p||r,e,d,R)&&(e._pt=o=new br(e._pt,a,c.name,0,1,c.render,c,0,c.priority),c._props.forEach((function(e){h[e]=o})),c.priority&&(s=1)),!u||p)for(i in r)lt[i]&&(c=lr(i,r,e,d,a,R))?c.priority&&(s=1):h[i]=o=sr.call(e,a,i,"get",r[i],d,R,0,m.stringFilter);e._op&&e._op[n]&&e.kill(a,e._op[n]),O&&e._pt&&(rr=e,le.killTweensOf(a,h,e.globalTime(t)),f=!e.parent,rr=0),e._pt&&b&&(st[l.id]=1)}s&&yr(e),e._onInit&&e._onInit(e)}e._onUpdate=x,e._initted=(!e._op||e._pt)&&!f,M&&t<=0&&P.render(Ie,!0,!0)}function Xt(e,t,r,n,i){return ze(e)?e.call(t,r,n,i):Ne(e)&&~e.indexOf("random(")?Rt(e):e}function Qt(e,t,r){return e.setAttribute(t,r)}function Zt(e,t){var r=t._pt,n="";if(!e&&t.b)n=t.b;else if(1===e&&t.e)n=t.e;else{for(;r;)n=r.p+(r.m?r.m(r.s+r.c*e):Math.round(1e4*(r.s+r.c*e))/1e4)+n,r=r._next;n+=t.c}t.set(t.t,t.p,n,t)}function Yt(e,t){for(var r=t._pt;r;)r.r(e,r.d),r=r._next}function qt(e,t,r,n){for(var i,o=this._pt;o;)i=o._next,o.p===n&&o.modifier(e,t,r),o=i}function $t(e){for(var t,r,n=this._pt;n;)r=n._next,n.p===e&&!n.op||n.op===e?bt(this,n,"_pt"):n.dep||(t=1),n=r;return!t}function er(e,t,r,n){n.mSet(e,t,n.m.call(n.tween,r,n.mt),n)}function tr(e,t){return{name:e,rawVars:1,init:function(e,r,n){n._onInit=function(e){var n,i;if(Ne(r)&&(n={},S(r,(function(e){return n[e]=1})),r=n),t){for(i in n={},r)n[i]=t(r[i]);r=n}var o,a,s,l=e,u=r,c=l._targets;for(o in u)for(a=c.length;a--;)(s=(s=l._ptLookup[a][o])&&s.d)&&(s=s._pt?wr(s,o):s)&&s.modifier&&s.modifier(u[o],l,c[a],o)}}}}S("Linear,Quad,Cubic,Quart,Quint,Strong",(function(e,t){var r=t<5?t+1:t;ne(e+",Power"+(r-1),t?function(e){return Math.pow(e,r)}:function(e){return e},(function(e){return 1-Math.pow(1-e,r)}),(function(e){return e<.5?Math.pow(2*e,r)/2:1-Math.pow(2*(1-e),r)/2}))})),jt.Linear.easeNone=jt.none=jt.Linear.easeIn,ne("Elastic",oe("in"),oe("out"),oe()),De=7.5625,Re=1/2.75,ne("Bounce",(function(e){return 1-Kt(1-e)}),Kt),ne("Expo",(function(e){return e?Math.pow(2,10*(e-1)):0})),ne("Circ",(function(e){return-(Ge(1-e*e)-1)})),ne("Sine",(function(e){return 1===e?1:1-je(e*Fe)})),ne("Back",ae("in"),ae("out"),ae()),jt.SteppedEase=jt.steps=rt.SteppedEase={config:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length?arguments[1]:void 0,r=1/e,n=e+(t?0:1),i=t?1:0,o=1-ke;return function(e){return((n*V(0,o,e)|0)+i)*r}}},Pe.ease=jt["quad.out"],S("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",(function(e){return dt+=e+","+e+"Params,"}));var rr,nr=c((function e(t,r){h(this,e),this.id=Ue++,(t._gsap=this).target=t,this.harness=r,this.get=r?r.get:A,this.set=r?r.getSetter:mr})),ir=function(){function e(t){h(this,e),this.vars=t,this._delay=+t.delay||0,(this._repeat=t.repeat===1/0?-2:t.repeat||0)&&(this._rDelay=t.repeatDelay||0,this._yoyo=!!t.yoyo||!!t.yoyoEase),this._ts=1,j(this,+t.duration,1,1),this.data=t.data,me||Ut.wake()}return c(e,[{key:"delay",value:function(e){return e||0===e?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+e-this._delay),this._delay=e,this):this._delay}},{key:"duration",value:function(e){return arguments.length?this.totalDuration(0<this._repeat?e+(e+this._rDelay)*this._repeat:e):this.totalDuration()&&this._dur}},{key:"totalDuration",value:function(e){return arguments.length?(this._dirty=0,j(this,this._repeat<0?e:(e-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur}},{key:"totalTime",value:function(e,t){if(Gt(),!arguments.length)return this._tTime;var r=this._dp;if(r&&r.smoothChildTiming&&this._ts){for(St(this,e),r._dp&&!r.parent&&I(r,this);r&&r.parent;)r.parent._time!==r._start+(0<=r._ts?r._tTime/r._ts:(r.totalDuration()-r._tTime)/-r._ts)&&r.totalTime(r._tTime,!0),r=r.parent;!this.parent&&this._dp.autoRemoveChildren&&(0<this._ts&&e<this._tDur||this._ts<0&&0<e||!this._tDur&&!e)&&k(this._dp,this,this._start-this._delay)}return(this._tTime!==e||!this._dur&&!t||this._initted&&Math.abs(this._zTime)===ke||!e&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=e),B(this,e,t)),this}},{key:"time",value:function(e,t){return arguments.length?this.totalTime(Math.min(this.totalDuration(),e+R(this))%(this._dur+this._rDelay)||(e?this._dur:0),t):this._time}},{key:"totalProgress",value:function(e,t){return arguments.length?this.totalTime(this.totalDuration()*e,t):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.ratio}},{key:"progress",value:function(e,t){return arguments.length?this.totalTime(this.duration()*(!this._yoyo||1&this.iteration()?e:1-e)+R(this),t):this.duration()?Math.min(1,this._time/this._dur):this.ratio}},{key:"iteration",value:function(e,t){var r=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(e-1)*r,t):this._repeat?O(this._tTime,r)+1:1}},{key:"timeScale",value:function(e){if(!arguments.length)return this._rts===-ke?0:this._rts;if(this._rts===e)return this;for(var t=this.parent&&this._ts?P(this.parent._time,this):this._tTime,r=(this._rts=+e||0,this._ts=this._ps||e===-ke?0:this._rts,e=this.totalTime(V(-this._delay,this._tDur,t),!0)).parent;r&&r.parent;)r._dirty=1,r.totalDuration(),r=r.parent;return At(this),this}},{key:"paused",value:function(e){return arguments.length?(this._ps!==e&&((this._ps=e)?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(Gt(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,1===this.progress()&&Math.abs(this._zTime)!==ke&&(this._tTime-=ke)))),this):this._ps}},{key:"startTime",value:function(e){var t;return arguments.length?(this._start=e,!(t=this.parent||this._dp)||!t._sort&&this.parent||k(t,this,e-this._delay),this):this._start}},{key:"endTime",value:function(e){return this._start+(Ke(e)?this.totalDuration():this.duration())/Math.abs(this._ts||1)}},{key:"rawTime",value:function(e){var t=this.parent||this._dp;return t?e&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?P(t.rawTime(e),this):this._tTime:this._tTime}},{key:"globalTime",value:function(e){for(var t=this,r=arguments.length?e:t.rawTime();t;)r=t._start+r/(t._ts||1),t=t._dp;return r}},{key:"repeat",value:function(e){return arguments.length?(this._repeat=e===1/0?-2:e,H(this)):-2===this._repeat?1/0:this._repeat}},{key:"repeatDelay",value:function(e){var t;return arguments.length?(t=this._time,this._rDelay=e,H(this),t?this.time(t):this):this._rDelay}},{key:"yoyo",value:function(e){return arguments.length?(this._yoyo=e,this):this._yoyo}},{key:"seek",value:function(e,t){return this.totalTime(N(this,e),Ke(t))}},{key:"restart",value:function(e,t){return this.play().totalTime(e?-this._delay:0,Ke(t))}},{key:"play",value:function(e,t){return null!=e&&this.seek(e,t),this.reversed(!1).paused(!1)}},{key:"reverse",value:function(e,t){return null!=e&&this.seek(e||this.totalDuration(),t),this.reversed(!0).paused(!1)}},{key:"pause",value:function(e,t){return null!=e&&this.seek(e,t),this.paused(!0)}},{key:"resume",value:function(){return this.paused(!1)}},{key:"reversed",value:function(e){return arguments.length?(!!e!==this.reversed()&&this.timeScale(-this._rts||(e?-ke:0)),this):this._rts<0}},{key:"invalidate",value:function(){return this._initted=this._act=0,this._zTime=-ke,this}},{key:"isActive",value:function(){var e=this.parent||this._dp,t=this._start;return!(e&&!(this._ts&&this._initted&&e.isActive()&&(e=e.rawTime(!0))>=t&&e<this.endTime(!0)-ke))}},{key:"eventCallback",value:function(e,t,r){var n=this.vars;return 1<arguments.length?(t?(n[e]=t,r&&(n[e+"Params"]=r),"onUpdate"===e&&(this._onUpdate=t)):delete n[e],this):n[e]}},{key:"then",value:function(e){var t=this;return new Promise((function(r){function n(){var e=t.then;t.then=null,ze(i)&&(i=i(t))&&(i.then||i===t)&&(t.then=e),r(i),t.then=e}var i=ze(e)?e:C;t._initted&&1===t.totalProgress()&&0<=t._ts||!t._tTime&&t._ts<0?n():t._prom=n}))}},{key:"kill",value:function(){$(this)}}]),e}(),or=(vt(ir.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-ke,_prom:0,_ps:!1,_rts:1}),function(){i(t,ir);var e=a(t);function t(){var r,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},i=1<arguments.length?arguments[1]:void 0;return h(this,t),(r=e.call(this,n)).labels={},r.smoothChildTiming=!!n.smoothChildTiming,r.autoRemoveChildren=!!n.autoRemoveChildren,r._sort=Ke(n.sortChildren),le&&k(n.parent||le,s(r),i),n.reversed&&r.reverse(),n.paused&&r.paused(!0),n.scrollTrigger&&L(s(r),n.scrollTrigger),r}return c(t,[{key:"to",value:function(e,t,r){return z(0,arguments,this),this}},{key:"from",value:function(e,t,r){return z(1,arguments,this),this}},{key:"fromTo",value:function(e,t,r,n){return z(2,arguments,this),this}},{key:"set",value:function(e,t,r){return t.duration=0,t.parent=this,T(t).repeatDelay||(t.repeat=0),t.immediateRender=!!t.immediateRender,new hr(e,t,N(this,r),1),this}},{key:"call",value:function(e,t,r){return k(this,hr.delayedCall(0,e,t),r)}},{key:"staggerTo",value:function(e,t,r,n,i,o,a){return r.duration=t,r.stagger=r.stagger||n,r.onComplete=o,r.onCompleteParams=a,r.parent=this,new hr(e,r,N(this,i)),this}},{key:"staggerFrom",value:function(e,t,r,n,i,o,a){return r.runBackwards=1,T(r).immediateRender=Ke(r.immediateRender),this.staggerTo(e,t,r,n,i,o,a)}},{key:"staggerFromTo",value:function(e,t,r,n,i,o,a,s){return n.startAt=r,T(n).immediateRender=Ke(n.immediateRender),this.staggerTo(e,t,n,i,o,a,s)}},{key:"render",value:function(e,t,r){var n,i,o,a,s,l,u,c,h,d,p=this._time,f=this._dirty?this.totalDuration():this._tDur,m=this._dur,g=e<=0?0:mt(e),v=this._zTime<0!=e<0&&(this._initted||!m);if((g=this!==le&&f<g&&0<=e?f:g)!==this._tTime||r||v){if(p!==this._time&&m&&(g+=this._time-p,e+=this._time-p),n=g,c=this._start,s=!(u=this._ts),v&&(m||(p=this._zTime),!e&&t||(this._zTime=e)),this._repeat){if(v=this._yoyo,a=m+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*a+e,t,r);if(n=mt(g%a),g===f?(o=this._repeat,n=m):((o=~~(g/a))&&o===g/a&&(n=m,o--),m<n&&(n=m)),h=O(this._tTime,a),v&&1&o&&(n=m-n,d=1),o!==(h=!p&&this._tTime&&h!==o?o:h)&&!this._lock){var y=v&&1&h;if(v=y===(v&&1&o),p=(y=o<h?!y:y)?0:m,this._lock=1,this.render(p||(d?0:mt(o*a)),t,!m)._lock=0,this._tTime=g,!t&&this.parent&&q(this,"onRepeat"),this.vars.repeatRefresh&&!d&&(this.invalidate()._lock=1),p&&p!==this._time||s!=!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(m=this._dur,f=this._tDur,v&&(this._lock=2,this.render(p=y?m:-1e-4,!0),this.vars.repeatRefresh&&!d&&this.invalidate()),this._lock=0,!this._ts&&!s)return this;re(this,d)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(l=function(e,t,r){var n;if(t<r)for(n=e._first;n&&n._start<=r;){if("isPause"===n.data&&n._start>t)return n;n=n._next}else for(n=e._last;n&&n._start>=r;){if("isPause"===n.data&&n._start<t)return n;n=n._prev}}(this,mt(p),mt(n)))&&(g-=n-(n=l._start)),this._tTime=g,this._time=n,this._act=!u,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=e,p=0),!p&&n&&!t&&(q(this,"onStart"),this._tTime!==g))return this;if(p<=n&&0<=e)for(b=this._first;b;){if(i=b._next,(b._act||n>=b._start)&&b._ts&&l!==b){if(b.parent!==this)return this.render(e,t,r);if(b.render(0<b._ts?(n-b._start)*b._ts:(b._dirty?b.totalDuration():b._tDur)+(n-b._start)*b._ts,t,r),n!==this._time||!this._ts&&!s){l=0,i&&(g+=this._zTime=-ke);break}}b=i}else for(var b=this._last,x=e<0?e:n;b;){if(i=b._prev,(b._act||x<=b._end)&&b._ts&&l!==b){if(b.parent!==this)return this.render(e,t,r);if(b.render(0<b._ts?(x-b._start)*b._ts:(b._dirty?b.totalDuration():b._tDur)+(x-b._start)*b._ts,t,r),n!==this._time||!this._ts&&!s){l=0,i&&(g+=this._zTime=x?-ke:ke);break}}b=i}if(l&&!t&&(this.pause(),l.render(p<=n?0:-ke)._zTime=p<=n?1:-1,this._ts))return this._start=c,At(this),this.render(e,t,r);this._onUpdate&&!t&&q(this,"onUpdate",!0),!(g===f&&f>=this.totalDuration()||!g&&p)||c!==this._start&&Math.abs(u)===Math.abs(this._ts)||this._lock||(!e&&m||!(g===f&&0<this._ts||!g&&this._ts<0)||xt(this,1),t||e<0&&!p||!g&&!p&&f||(q(this,g===f&&0<=e?"onComplete":"onReverseComplete",!0),!this._prom||g<f&&0<this.timeScale()||this._prom()))}return this}},{key:"add",value:function(e,t){var r=this;if(Ve(t)||(t=N(this,t,e)),!(e instanceof ir)){if(Xe(e))return e.forEach((function(e){return r.add(e,t)})),this;if(Ne(e))return this.addLabel(e,t);if(!ze(e))return this;e=hr.delayedCall(0,e)}return this!==e?k(this,e,t):this}},{key:"getChildren",value:function(){for(var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],r=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:-Ie,i=[],o=this._first;o;)o._start>=n&&(o instanceof hr?t&&i.push(o):(r&&i.push(o),e&&i.push.apply(i,d(o.getChildren(!0,t,r))))),o=o._next;return i}},{key:"getById",value:function(e){for(var t=this.getChildren(1,1,1),r=t.length;r--;)if(t[r].vars.id===e)return t[r]}},{key:"remove",value:function(e){return Ne(e)?this.removeLabel(e):ze(e)?this.killTweensOf(e):(bt(this,e),e===this._recent&&(this._recent=this._last),wt(this))}},{key:"totalTime",value:function(e,r){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=mt(Ut.time-(0<this._ts?e/this._ts:(this.totalDuration()-e)/-this._ts))),n(l(t.prototype),"totalTime",this).call(this,e,r),this._forcing=0,this):this._tTime}},{key:"addLabel",value:function(e,t){return this.labels[e]=N(this,t),this}},{key:"removeLabel",value:function(e){return delete this.labels[e],this}},{key:"addPause",value:function(e,t,r){return(t=hr.delayedCall(0,t||w,r)).data="isPause",this._hasPause=1,k(this,t,N(this,e))}},{key:"removePause",value:function(e){var t=this._first;for(e=N(this,e);t;)t._start===e&&"isPause"===t.data&&xt(t),t=t._next}},{key:"killTweensOf",value:function(e,t,r){for(var n=this.getTweensOf(e,r),i=n.length;i--;)rr!==n[i]&&n[i].kill(e,t);return this}},{key:"getTweensOf",value:function(e,t){for(var r,n=[],i=Tt(e),o=this._first,a=Ve(t);o;)o instanceof hr?function(e,t){for(var r=t.length,n=0;e.indexOf(t[n])<0&&++n<r;);return n<r}(o._targets,i)&&(a?(!rr||o._initted&&o._ts)&&o.globalTime(0)<=t&&o.globalTime(o.totalDuration())>t:!t||o.isActive())&&n.push(o):(r=o.getTweensOf(i,t)).length&&n.push.apply(n,d(r)),o=o._next;return n}},{key:"tweenTo",value:function(e,t){t=t||{};var r,n=this,i=N(n,e),o=(e=t).startAt,a=e.onStart,s=e.onStartParams,l=(e=e.immediateRender,hr.to(n,vt({ease:t.ease||"none",lazy:!1,immediateRender:!1,time:i,overwrite:"auto",duration:t.duration||Math.abs((i-(o&&"time"in o?o.time:n._time))/n.timeScale())||ke,onStart:function(){var e;n.pause(),r||(e=t.duration||Math.abs((i-(o&&"time"in o?o.time:n._time))/n.timeScale()),l._dur!==e&&j(l,e,0,1).render(l._time,!0,!0),r=1),a&&a.apply(l,s||[])}},t)));return e?l.render(0):l}},{key:"tweenFromTo",value:function(e,t,r){return this.tweenTo(t,vt({startAt:{time:N(this,e)}},r))}},{key:"recent",value:function(){return this._recent}},{key:"nextLabel",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._time;return Y(this,N(this,e))}},{key:"previousLabel",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._time;return Y(this,N(this,e),1)}},{key:"currentLabel",value:function(e){return arguments.length?this.seek(e,!0):this.previousLabel(this._time+ke)}},{key:"shiftChildren",value:function(e,t){for(var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=this._first,o=this.labels;i;)i._start>=n&&(i._start+=e,i._end+=e),i=i._next;if(t)for(r in o)o[r]>=n&&(o[r]+=e);return wt(this)}},{key:"invalidate",value:function(){var e=this._first;for(this._lock=0;e;)e.invalidate(),e=e._next;return n(l(t.prototype),"invalidate",this).call(this)}},{key:"clear",value:function(){for(var e,t=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],r=this._first;r;)e=r._next,this.remove(r),r=e;return this._dp&&(this._time=this._tTime=this._pTime=0),t&&(this.labels={}),wt(this)}},{key:"totalDuration",value:function(e){var t,r,n,i=0,o=this,a=o._last,s=Ie;if(arguments.length)return o.timeScale((o._repeat<0?o.duration():o.totalDuration())/(o.reversed()?-e:e));if(o._dirty){for(n=o.parent;a;)t=a._prev,a._dirty&&a.totalDuration(),(r=a._start)>s&&o._sort&&a._ts&&!o._lock?(o._lock=1,k(o,a,r-a._delay,1)._lock=0):s=r,r<0&&a._ts&&(i-=r,(!n&&!o._dp||n&&n.smoothChildTiming)&&(o._start+=r/o._ts,o._time-=r,o._tTime-=r),o.shiftChildren(-r,!1,-1/0),s=0),a._end>i&&a._ts&&(i=a._end),a=t;j(o,o===le&&o._time>i?o._time:i,1,1),o._dirty=0}return o._tDur}}],[{key:"updateRoot",value:function(e){if(le._ts&&(B(le,P(e,le)),pe=Ut.frame),Ut.frame>=ct){ct+=Oe.autoSleep||120;var t=le._first;if((!t||!t._ts)&&Oe.autoSleep&&Ut._listeners.length<2){for(;t&&!t._ts;)t=t._next;t||Ut.sleep()}}}}]),t}()),ar=(vt(or.prototype,{_lock:0,_hasPause:0,_forcing:0}),function(e,t,r,n,i,o,a){var s,l,u,c,h,d=new br(this._pt,e,t,0,1,Zt,null,i),p=0,f=0;for(d.b=r,d.e=n,r+="",(i=~(n+="").indexOf("random("))&&(n=Rt(n)),o&&(o(o=[r,n],e,t),r=o[0],n=o[1]),s=r.match(qe)||[];c=qe.exec(n);)u=c[0],c=n.substring(p,c.index),l?l=(l+1)%5:"rgba("===c.substr(-5)&&(l=1),u!==s[f++]&&(h=parseFloat(s[f-1])||0,d._pt={_next:d._pt,p:c||1===f?c:",",s:h,c:"="===u.charAt(1)?parseFloat(u.substr(2))*("-"===u.charAt(0)?-1:1):parseFloat(u)-h,m:l&&l<4?Math.round:0},p=qe.lastIndex);return d.c=p<n.length?n.substring(p,n.length):"",d.fp=a,($e.test(n)||i)&&(d.e=0),this._pt=d}),sr=function(e,t,r,n,i,o,a,s,l){var u;if(ze(n)&&(n=n(i||0,e,o)),i=e[t],o="get"!==r?r:ze(i)?l?e[t.indexOf("set")||!ze(e["get"+t.substr(3)])?t:"get"+t.substr(3)](l):e[t]():i,r=ze(i)?l?fr:pr:dr,Ne(n)&&"="===(n=~n.indexOf("random(")?Rt(n):n).charAt(1)&&(!(u=parseFloat(o)+parseFloat(n.substr(2))*("-"===n.charAt(0)?-1:1)+(Ct(o)||0))&&0!==u||(n=u)),o!==n)return isNaN(o*n)||""===n?(i||t in e||it(t,n),ar.call(this,e,t,o,n,r,s||Oe.stringFilter,l)):(u=new br(this._pt,e,t,+o||0,n-(o||0),"boolean"==typeof i?vr:gr,0,r),l&&(u.fp=l),a&&u.modifier(a,this,e),this._pt=u)},lr=function(e,t,r,n,i,o){var a,s,l,u;if(lt[e]&&!1!==(a=new lt[e]).init(i,a.rawVars?t[e]:function(e,t,r,n,i){if(ze(e)&&(e=Xt(e,i,t,r,n)),!Je(e)||e.style&&e.nodeType||Xe(e)||We(e))return Ne(e)?Xt(e,i,t,r,n):e;var o,a={};for(o in e)a[o]=Xt(e[o],i,t,r,n);return a}(t[e],n,i,o,r),r,n,o)&&(r._pt=s=new br(r._pt,i,e,0,1,a.render,a,0,a.priority),r!==fe))for(l=r._ptLookup[r._targets.indexOf(i)],u=a._props.length;u--;)l[a._props[u]]=s;return a},ur=dt+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase",cr={},hr=(S(ur+",id,stagger,delay,duration,paused,scrollTrigger",(function(e){return cr[e]=1})),function(){i(t,ir);var e=a(t);function t(r,n,i,o){h(this,t),"number"==typeof n&&(i.duration=n,n=i,i=null);var a,l,u,c,d,p,f,m,g,y=(o=(a=e.call(this,o?n:T(n))).vars).duration,x=o.delay,w=o.immediateRender,A=o.stagger,S=o.overwrite,B=o.keyframes,M=o.defaults,C=o.scrollTrigger,_=o.yoyoEase,R=(o=n.parent||le,(Xe(r)||We(r)?Ve(r[0]):"length"in n)?[r]:Tt(r));if(a._targets=R.length?pt(R):b("GSAP target "+r+" not found. https://greensock.com",!Oe.nullTargetWarn)||[],a._ptLookup=[],a._overwrite=S,B||A||v(y)||v(x)){if(n=a.vars,(l=a.timeline=new or({data:"nested",defaults:M||{}})).kill(),l.parent=l._dp=s(a),l._start=0,A||v(y)||v(x)){if(d=R.length,m=A&&J(A),Je(A))for(p in A)~ur.indexOf(p)&&((g=g||{})[p]=A[p]);for(u=0;u<d;u++)(c=yt(n,cr)).stagger=0,_&&(c.yoyoEase=_),g&&E(c,g),f=R[u],c.duration=+Xt(y,s(a),u,f,R),c.delay=(+Xt(x,s(a),u,f,R)||0)-a._delay,!A&&1===d&&c.delay&&(a._delay=x=c.delay,a._start+=x,c.delay=0),l.to(f,c,m?m(u,f,R):0),l._ease=jt.none;l.duration()?y=x=0:a.timeline=0}else if(B){T(vt(l.vars.defaults,{ease:"none"})),l._ease=Vt(B.ease||n.ease||"none");var O,P,I,F=0;if(Xe(B))B.forEach((function(e){return l.to(R,e,">")}));else{for(p in c={},B)"ease"!==p&&"easeEach"!==p&&function(e,t,r,n){var i,o,a=t.ease||n||"power1.inOut";if(Xe(t))o=r[e]||(r[e]=[]),t.forEach((function(e,r){return o.push({t:r/(t.length-1)*100,v:e,e:a})}));else for(i in t)o=r[i]||(r[i]=[]),"ease"!==i&&o.push({t:parseFloat(e),v:t[i],e:a})}(p,B[p],c,B.easeEach);for(p in c)for(O=c[p].sort((function(e,t){return e.t-t.t})),u=F=0;u<O.length;u++)(I={ease:(P=O[u]).e,duration:(P.t-(u?O[u-1].t:0))/100*y})[p]=P.v,l.to(R,I,F),F+=I.duration;l.duration()<y&&l.to({},{duration:y-l.duration()})}}y||a.duration(y=l.duration())}else a.timeline=0;return!0!==S||se||(rr=s(a),le.killTweensOf(R),rr=0),k(o,s(a),i),n.reversed&&a.reverse(),n.paused&&a.paused(!0),(w||!y&&!B&&a._start===mt(o._time)&&Ke(w)&&D(s(a))&&"nested"!==o.data)&&(a._tTime=-ke,a.render(Math.max(0,-x))),C&&L(s(a),C),a}return c(t,[{key:"render",value:function(e,t,r){var n,i,o=this._time,a=this._tDur,s=this._dur,l=a-ke<e&&0<=e?a:e<ke?0:e;if(s){if(l!==this._tTime||!e||r||!this._initted&&this._tTime||this._startAt&&this._zTime<0!=e<0){if(m=l,f=this.timeline,this._repeat){if(h=s+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*h+e,t,r);if(m=mt(l%h),l===a?(v=this._repeat,m=s):((v=~~(l/h))&&v===l/h&&(m=s,v--),s<m&&(m=s)),(p=this._yoyo&&1&v)&&(d=this._yEase,m=s-m),y=O(this._tTime,h),m===o&&!r&&this._initted)return this;v!==y&&(f&&this._yEase&&re(f,p),!this.vars.repeatRefresh||p||this._lock||(this._lock=r=1,this.render(mt(h*v),!0).invalidate()._lock=0))}if(!this._initted){if(F(this,e<0?e:m,r,t))return this._tTime=0,this;if(s!==this._dur)return this.render(e,t,r)}if(this._tTime=l,this._time=m,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=i=(d||this._ease)(m/s),this._from&&(this.ratio=i=1-i),m&&!o&&!t&&(q(this,"onStart"),this._tTime!==l))return this;for(n=this._pt;n;)n.r(i,n.d),n=n._next;f&&f.render(e<0?e:!m&&p?-ke:f._dur*f._ease(m/this._dur),t,r)||this._startAt&&(this._zTime=e),this._onUpdate&&!t&&(e<0&&this._startAt&&this._startAt.render(e,!0,r),q(this,"onUpdate")),this._repeat&&v!==y&&this.vars.onRepeat&&!t&&this.parent&&q(this,"onRepeat"),l!==this._tDur&&l||this._tTime!==l||(e<0&&this._startAt&&!this._onUpdate&&this._startAt.render(e,!0,!0),!e&&s||!(l===this._tDur&&0<this._ts||!l&&this._ts<0)||xt(this,1),t||e<0&&!o||!l&&!o||(q(this,l===a?"onComplete":"onReverseComplete",!0),!this._prom||l<a&&0<this.timeScale()||this._prom()))}}else{var u,c,h=this,d=e,p=t,f=r,m=h.ratio,g=d<0||!d&&(!h._start&&U(h)&&(h._initted||!G(h))||(h._ts<0||h._dp._ts<0)&&!G(h))?0:1,v=h._rDelay,y=0;if(v&&h._repeat&&(c=O(y=V(0,h._tDur,d),v),h._yoyo&&1&c&&(g=1-g),c!==O(h._tTime,v)&&(m=1-g,h.vars.repeatRefresh&&h._initted&&h.invalidate())),g!==m||f||h._zTime===ke||!d&&h._zTime){if(h._initted||!F(h,d,f,p)){for(c=h._zTime,h._zTime=d||(p?ke:0),p=p||d&&!c,h.ratio=g,h._from&&(g=1-g),h._time=0,h._tTime=y,u=h._pt;u;)u.r(g,u.d),u=u._next;h._startAt&&d<0&&h._startAt.render(d,!0,!0),h._onUpdate&&!p&&q(h,"onUpdate"),y&&h._repeat&&!p&&h.parent&&q(h,"onRepeat"),(d>=h._tDur||d<0)&&h.ratio===g&&(g&&xt(h,1),p||(q(h,g?"onComplete":"onReverseComplete",!0),h._prom&&h._prom()))}}else h._zTime||(h._zTime=d)}return this}},{key:"targets",value:function(){return this._targets}},{key:"invalidate",value:function(){return this._pt=this._op=this._startAt=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(),n(l(t.prototype),"invalidate",this).call(this)}},{key:"kill",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"all";if(!(e||t&&"all"!==t))return this._lazy=this._pt=0,this.parent?$(this):this;if(this.timeline)return d=this.timeline.totalDuration(),this.timeline.killTweensOf(e,t,rr&&!0!==rr.vars.overwrite)._first||$(this),this.parent&&d!==this.timeline.totalDuration()&&j(this,this._dur*this.timeline._tDur/d,0,1),this;var r,n,i,o,a,s,l,u=this._targets,c=e?Tt(e):u,h=this._ptLookup,d=this._pt;if((!t||"all"===t)&&function(e,t){for(var r=e.length,n=r===t.length;n&&r--&&e[r]===t[r];);return r<0}(u,c))return"all"===t&&(this._pt=0),$(this);for(r=this._op=this._op||[],"all"!==t&&(Ne(t)&&(a={},S(t,(function(e){return a[e]=1})),t=a),t=function(e,t){var r,n,i,o,a=(e=e[0]?ft(e[0]).harness:0)&&e.aliases;if(!a)return t;for(n in r=E({},t),a)if(n in r)for(i=(o=a[n].split(",")).length;i--;)r[o[i]]=r[n];return r}(u,t)),l=u.length;l--;)if(~c.indexOf(u[l]))for(a in n=h[l],"all"===t?(r[l]=t,o=n,i={}):(i=r[l]=r[l]||{},o=t),o)(s=n&&n[a])&&("kill"in s.d&&!0!==s.d.kill(a)||bt(this,s,"_pt"),delete n[a]),"all"!==i&&(i[a]=1);return this._initted&&!this._pt&&d&&$(this),this}}],[{key:"to",value:function(e,r){return new t(e,r,arguments[2])}},{key:"from",value:function(e,t){return z(1,arguments)}},{key:"delayedCall",value:function(e,r,n,i){return new t(r,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:e,onComplete:r,onReverseComplete:r,onCompleteParams:n,onReverseCompleteParams:n,callbackScope:i})}},{key:"fromTo",value:function(e,t,r){return z(2,arguments)}},{key:"set",value:function(e,r){return r.duration=0,r.repeatDelay||(r.repeat=0),new t(e,r)}},{key:"killTweensOf",value:function(e,t,r){return le.killTweensOf(e,t,r)}}]),t}()),dr=(vt(hr.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),S("staggerTo,staggerFrom,staggerFromTo",(function(e){hr[e]=function(){var t=new or,r=Et.call(arguments,0);return r.splice("staggerFromTo"===e?5:4,0,0),t[e].apply(t,r)}})),function(e,t,r){return e[t]=r}),pr=function(e,t,r){return e[t](r)},fr=function(e,t,r,n){return e[t](n.fp,r)},mr=function(e,t){return ze(e[t])?pr:m(e[t])&&e.setAttribute?Qt:dr},gr=function(e,t){return t.set(t.t,t.p,Math.round(1e6*(t.s+t.c*e))/1e6,t)},vr=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},yr=function(e){for(var t,r,n,i,o=e._pt;o;){for(t=o._next,r=n;r&&r.pr>o.pr;)r=r._next;(o._prev=r?r._prev:i)?o._prev._next=o:n=o,(o._next=r)?r._prev=o:i=o,o=t}e._pt=n},br=function(){function e(t,r,n,i,o,a,s,l,u){h(this,e),this.t=r,this.s=i,this.c=o,this.p=n,this.r=a||gr,this.d=s||this,this.set=l||dr,this.pr=u||0,(this._next=t)&&(t._prev=this)}return c(e,[{key:"modifier",value:function(e,t,r){this.mSet=this.mSet||this.set,this.set=er,this.m=e,this.mt=r,this.tween=t}}]),e}(),xr=(S(dt+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",(function(e){return ot[e]=1})),rt.TweenMax=rt.TweenLite=hr,rt.TimelineLite=rt.TimelineMax=or,le=new or({sortChildren:!1,defaults:Pe,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Oe.stringFilter=function(e){var t=e.join(" ");if(Lt.lastIndex=0,Lt.test(t))return t=Ft.test(t),e[1]=te(e[1],t),e[0]=te(e[0],t,kt(e[1])),!0},{registerPlugin:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.forEach((function(e){var t=(e=!e.name&&e.default||e).name,r=ze(e),n=(r=t&&!r&&e.init?function(){this._props=[]}:e,{init:w,render:Yt,add:sr,kill:$t,modifier:qt,rawVars:0}),i={targetTest:0,get:0,getSetter:mr,aliases:{},register:0};if(Gt(),e!==r){if(lt[t])return;vt(r,vt(yt(e,n),i)),E(r.prototype,E(n,yt(e,i))),lt[r.prop=t]=r,e.targetTest&&(ht.push(r),ot[t]=1),t=("css"===t?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}x(t,r),e.register&&e.register(Ar,r,br)}))},timeline:function(e){return new or(e)},getTweensOf:function(e,t){return le.getTweensOf(e,t)},getProperty:function(e,t,r,n){Ne(e)&&(e=Tt(e)[0]);var i=ft(e||{}).get,o=r?C:M;return"native"===r&&(r=""),e&&(t?o((lt[t]&&lt[t].get||i)(e,t,r,n)):function(t,r,n){return o((lt[t]&&lt[t].get||i)(e,t,r,n))})},quickSetter:function(e,t,r){var n,i;if(1<(e=Tt(e)).length)return n=e.map((function(e){return Ar.quickSetter(e,t,r)})),i=n.length,function(e){for(var t=i;t--;)n[t](e)};e=e[0]||{};var o=lt[t],a=ft(e),s=a.harness&&(a.harness.aliases||{})[t]||t,l=o?function(t){var n=new o;fe._pt=0,n.init(e,r?t+r:t,fe,0,[e]),n.render(1,n),fe._pt&&Yt(1,fe)}:a.set(e,s);return o?l:function(t){return l(e,s,r?t+r:t,a,1)}},isTweening:function(e){return 0<le.getTweensOf(e,!0).length},defaults:function(e){return e&&e.ease&&(e.ease=Vt(e.ease,Pe.ease)),_(Pe,e||{})},config:function(e){return _(Oe,e||{})},registerEffect:function(e){var t=e.name,r=e.effect,n=e.plugins,i=e.defaults;e=e.extendTimeline,(n||"").split(",").forEach((function(e){return e&&!lt[e]&&!rt[e]&&b(t+" effect requires "+e+" plugin.")})),ut[t]=function(e,t,n){return r(Tt(e),vt(t||{},i),n)},e&&(or.prototype[t]=function(e,r,n){return this.add(ut[t](e,Je(r)?r:(n=r)&&{},this),n)})},registerEase:function(e,t){jt[e]=Vt(t)},parseEase:function(e,t){return arguments.length?Vt(e,t):jt},getById:function(e){return le.getById(e)},exportRoot:function(){var e,t,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length?arguments[1]:void 0,i=new or(r);for(i.smoothChildTiming=Ke(r.smoothChildTiming),le.remove(i),i._dp=0,i._time=i._tTime=le._time,e=le._first;e;)t=e._next,!n&&!e._dur&&e instanceof hr&&e.vars.onComplete===e._targets[0]||k(i,e,e._start-e._delay),e=t;return k(le,i,0),i},utils:{wrap:function e(t,r,n){var i=r-t;return Xe(t)?Q(t,e(0,t.length),r):Mt(n,(function(e){return(i+(e-t)%i)%i+t}))},wrapYoyo:function e(t,r,n){var i=r-t,o=2*i;return Xe(t)?Q(t,e(0,t.length-1),r):Mt(n,(function(e){return t+(i<(e=(o+(e-t)%o)%o||0)?o-e:e)}))},distribute:J,random:X,snap:W,normalize:function(e,t,r){return Z(e,t,0,1,r)},getUnit:Ct,clamp:function(e,t,r){return Mt(r,(function(r){return V(e,t,r)}))},splitColor:It,toArray:Tt,selector:function(e){return e=Tt(e)[0]||b("Invalid scope")||{},function(t){var r=e.current||e.nativeElement||e;return Tt(t,r.querySelectorAll?r:r===e?b("Invalid scope")||he.createElement("div"):e)}},mapRange:Z,pipe:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return t.reduce((function(e,t){return t(e)}),e)}},unitize:function(e,t){return function(r){return e(parseFloat(r))+(t||Ct(r))}},interpolate:function e(t,r,n,i){var o=isNaN(t+r)?0:function(e){return(1-e)*t+e*r};if(!o){var a,s,l,u,c,h=Ne(t),d={};if(!0===n&&(i=1)&&(n=null),h)t={p:t},r={p:r};else if(Xe(t)&&!Xe(r)){for(l=[],u=t.length,c=u-2,s=1;s<u;s++)l.push(e(t[s-1],t[s]));u--,o=function(e){e*=u;var t=Math.min(c,~~e);return l[t](e-t)},n=r}else i||(t=E(Xe(t)?[]:{},t));if(!l){for(a in r)sr.call(d,t,a,"get",r[a]);o=function(e){return Yt(e,d),h?t.p:t}}}return Mt(n,o)},shuffle:Dt},install:y,effects:ut,ticker:Ut,updateRoot:or.updateRoot,plugins:lt,globalTimeline:le,core:{PropTween:br,globals:x,Tween:hr,Timeline:or,Animation:ir,getCache:ft,_removeLinkedListItem:bt,suppressOverwrites:function(e){return se=e}}}),wr=(S("to,from,fromTo,delayedCall,set,killTweensOf",(function(e){return xr[e]=hr[e]})),Ut.add(or.updateRoot),fe=xr.to({},{duration:0}),function(e,t){for(var r=e._pt;r&&r.p!==t&&r.op!==t&&r.fp!==t;)r=r._next;return r}),Ar=xr.registerPlugin({name:"attr",init:function(e,t,r,n,i){var o,a;for(o in t)(a=this.add(e,"setAttribute",(e.getAttribute(o)||0)+"",t[o],n,i,0,0,o))&&(a.op=o),this._props.push(o)}},{name:"endArray",init:function(e,t){for(var r=t.length;r--;)this.add(e,r,e[r]||0,t[r])}},tr("roundProps",K),tr("modifiers"),tr("snap",W))||xr;hr.version=or.version=Ar.version="3.9.1",de=1,g()&&Gt(),jt.Power0,jt.Power1,jt.Power2,jt.Power3,jt.Power4,jt.Linear,jt.Quad,jt.Cubic,jt.Quart,jt.Quint,jt.Strong,jt.Elastic,jt.Back,jt.SteppedEase,jt.Bounce,jt.Sine,jt.Expo,jt.Circ},4547:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},i=(Object.defineProperty(t,"__esModule",{value:!0}),t.downloadFile=t.getFileName=t.urlToBase64=t.toResult=t.getPrefixWord=t.getBackWord=t.bToMB=t.arrayBufferToStr=t.strToArrayBuffer=t.toUrl=t.blobToDataUrl=t.bufferToArrayBuffer=t.base64ToFile=void 0,n(r(3300)));t.base64ToFile=function(e,t){for(var r=(e=e.split(","))[0].match(/:(.*?);/)[1],n=atob(e[1]),i=n.length,o=new Uint8Array(i);i--;)o[i]=n.charCodeAt(i);return new File([o],t,{type:r})},t.bufferToArrayBuffer=function(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n<e.length;++n)r[n]=e[n];return t},t.blobToDataUrl=function(e){return i.default.get(e,{baseURL:"",responseType:"blob",timeout:5e3}).then((function(e){return(0,t.toResult)(e.data)})).catch((function(e){return!1}))},t.toUrl=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"any.json";return e=e instanceof File?e:(e=JSON.stringify(e),new File([e],t)),window.URL.createObjectURL(e)},t.strToArrayBuffer=function(e){for(var t="",r=0;r<e.length;r++)""===t?t=e.charCodeAt(r).toString(16):t+=","+e.charCodeAt(r).toString(16);return new Uint8Array(t.match(/[\da-f]{2}/gi).map((function(e){return parseInt(e,16)}))).buffer},t.arrayBufferToStr=function(e){return new Promise((function(t){var r=new Blob([e]),n=new FileReader;n.readAsText(r,"utf-8"),n.onload=function(){t(n.result)}}))},t.bToMB=function(e){return e=e/1024/1024,1<arguments.length&&void 0!==arguments[1]&&arguments[1]?e:e.toFixed(2)+"MB"},t.getBackWord=function(e){return e.substr(e.lastIndexOf(".")+1).toLowerCase()},t.getPrefixWord=function(e){return e.substr(0,e.lastIndexOf("."))},t.toResult=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"text",r=new FileReader;return"text"===t?r.readAsText(e):"arrayBuffer"===t?r.readAsArrayBuffer(e):"base64"===t&&r.readAsDataURL(e),new Promise((function(e){r.onload=function(t){return e(t.target.result)}}))},t.urlToBase64=function(e){return i.default.get(e,{responseType:"arraybuffer"}).then((function(e){var t=e.headers["content-type"];return e=new Buffer(e.data,"binary").toString("base64"),"data:".concat(t,";base64,")+e}))},t.getFileName=function(e){return e.substring(e.lastIndexOf("-")+1)},t.downloadFile=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"any.text",r=document.createElement("a");e instanceof File||e instanceof Blob?r.setAttribute("href",window.URL.createObjectURL(e)):r.setAttribute("href",e),r.setAttribute("download",t),document.body.insertAdjacentElement("beforeend",r),r.click(),r.remove()}},9716:function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(){i=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,o=(m="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",a=m.asyncIterator||"@@asyncIterator",s=m.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(t){l=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var i,o,a,s;return t=t&&t.prototype instanceof d?t:d,t=Object.create(t.prototype),n=new A(n||[]),t._invoke=(i=e,o=r,a=n,s="suspendedStart",function(e,t){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===e)throw t;return{value:void 0,done:!0}}for(a.method=e,a.arg=t;;){var r=a.delegate;if(r&&(r=function e(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,e(t,r),"throw"===r.method))return h;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}return"throw"===(n=c(n,t.iterator,r.arg)).type?(r.method="throw",r.arg=n.arg,r.delegate=null,h):(n=n.arg)?n.done?(r[t.resultName]=n.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,h):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,h)}(r,a),r)){if(r===h)continue;return r}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);if(s="executing","normal"===(r=c(i,o,a)).type){if(s=a.done?"completed":"suspendedYield",r.arg===h)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(s="completed",a.method="throw",a.arg=r.arg)}}),t}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var h={};function d(){}function p(){}function f(){}var m,g,v=(l(m={},o,(function(){return this})),(g=(g=Object.getPrototypeOf)&&g(g(S([]))))&&g!==t&&r.call(g,o)&&(m=g),f.prototype=d.prototype=Object.create(m));function y(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){var i;this._invoke=function(o,a){function s(){return new t((function(i,s){!function i(o,a,s,l){var u;if("throw"!==(o=c(e[o],e,a)).type)return(a=(u=o.arg).value)&&"object"==n(a)&&r.call(a,"__await")?t.resolve(a.__await).then((function(e){i("next",e,s,l)}),(function(e){i("throw",e,s,l)})):t.resolve(a).then((function(e){u.value=e,s(u)}),(function(e){return i("throw",e,s,l)}));l(o.arg)}(o,a,i,s)}))}return i=i?i.then(s,s):s()}}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function S(e){if(e){var t,n=e[o];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(n=function n(){for(;++t<e.length;)if(r.call(e,t))return n.value=e[t],n.done=!1,n;return n.value=void 0,n.done=!0,n}).next=n}return{next:B}}function B(){return{value:void 0,done:!0}}return l(v,"constructor",p.prototype=f),l(f,"constructor",p),p.displayName=l(f,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){return!!(e="function"==typeof e&&e.constructor)&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,l(e,s,"GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},y(b.prototype),l(b.prototype,a,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new b(u(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},y(v),l(v,s,"Generator"),l(v,o,(function(){return this})),l(v,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,r=[];for(t in e)r.push(t);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=S,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(w),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;0<=i;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),l=r.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}var a=(o=o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc?null:o)?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),w(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,i=this.tryEntries[t];if(i.tryLoc===e)return"throw"===(r=i.completion).type&&(n=r.arg,w(i)),n}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:S(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},e}function o(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var s=this&&this.__awaiter||function(e,t,r,n){return new(r=r||Promise)((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},l=(Object.defineProperty(t,"__esModule",{value:!0}),t.deepArrByMaps=t.map=t.multiArrToArr=t.eachTriggerArray=t.eachTriggerArrGetControls=t.emptyArray=t.delArrEle=t.lastArrayEle=void 0,r(6569));function u(e,t,r,n){return s(void 0,void 0,void 0,i().mark((function o(){var a,s,l;return i().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(a=e[t++]){i.next=3;break}return i.abrupt("return",r());case 3:if((s=a())instanceof Promise)return i.next=7,s;i.next=11;break;case 7:l=i.sent,null!=n&&n.eachCb(l,t),i.next=18;break;case 11:if(s.promise&&s.promise instanceof Promise)return null!=n&&n.eachCb(s,t),i.next=15,s.promise;i.next=17;break;case 15:i.next=18;break;case 17:null!=n&&n.eachCb(s,t);case 18:u(e,t,r,n);case 19:case"end":return i.stop()}}),o)})))}function c(e,t){e.map((function(e){if("array"===(0,l.getType)(e))return c(e,t);t.push(e)}))}t.lastArrayEle=function(e){return e.slice(-1)[0]},t.delArrEle=function(e,t){var r=e.slice(0,t);return e=e.slice(t+1),[].concat(o(r),o(e))},t.emptyArray=function(e){return 0===e.length},t.eachTriggerArrGetControls=function(e){var r=new Proxy({run:!0,clean:!1,target:e,index:0,runningAnima:null,eachCb:function(e,t){e.anima&&(r.runningAnima=e.anima),r.index=t}},{set:function(e,t,n){return"clean"===t&&!0===n&&!1===e[t]&&(r.run=!1,r.target.splice(0)),"run"===t&&!1===n&&!0===e[t]&&(console.log(r,"controls"),r.runningAnima&&r.runningAnima.pause()),"run"===t&&!0===n&&!1===e[t]&&r.runningAnima&&r.runningAnima.resume(),e[t]=n,!0}});return e=(0,t.eachTriggerArray)(e,r),{controls:r,promise:e}},t.eachTriggerArray=function(e,t){return new Promise((function(r){return u(e,0,r,t)}))},t.multiArrToArr=function(e){var t=[];return c(e,t),t},t.map=function(e,t){return e.map((function(r,n){return t(r,n,e)})).filter((function(e){return e}))},t.deepArrByMaps=function(e){var r=e.arr,n=e.typeList,i=e.findType;if(e=e.mapType,!r||!n||!i)return r;var a=o(n),s=r.find((function(e){return e[i]===n[0]}));return s?1!==n.length&&s[e]instanceof Array?(a.shift(),(0,t.deepArrByMaps)({arr:s[e],typeList:a,findType:i,mapType:e})):s:r}},2081:(e,t,r)=>{"use strict";t.qR=t.js=t.CV=void 0,r(6569),t.CV=function(e){return 0===Object.values(e).length},t.js=function(e,t){return Object.keys(e).map((function(r,n){var i=e[r];return t(r,i,n)}))},t.qR=function(e,t){var r=-1;return function e(n){return r++,t.length===r+1?n:e(n[t[r]])}(e)}},9728:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},i=(Object.defineProperty(t,"__esModule",{value:!0}),t.getId=t.getMacro=t.getUuid=void 0,n(r(7937))),o=n(r(2801));t.getUuid=function(){return i.default.UUID1()},t.getMacro=function(e){var t=setTimeout((function(){return clearTimeout(t),t=null,e()}),1<arguments.length&&void 0!==arguments[1]?arguments[1]:0)},t.getId=function(){return(0,o.default)()}},6569:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isTrue=t.getType=void 0,t.getType=function(e){if(void 0!==e){if(null===e)return null;var t;switch(e.constructor){case Array:t="Array";break;case Object:t="Object";break;case String:t="String";break;case Number:t="Number";break;case Boolean:t="Boolean";break;case Function:t="Function"}return t&&t.toLowerCase()||"Object"}},t.isTrue=function(e){return!(null==e||!1===e)}},4403:e=>{e.exports=function(e,t,r){for(var n=(2<<Math.log(t.length-1)/Math.LN2)-1,i=-~(1.6*n*r/t.length),o="";;)for(var a=e(i),s=i;s--;)if((o+=t[a[s]&n]||"").length===+r)return o}},2801:(e,t,r)=>{"use strict";e.exports=r(6104)},6330:(e,t,r)=>{"use strict";var n,i,o,a=r(3445),s="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";function l(){o=!1}function u(e){if(e){if(e!==n){if(e.length!==s.length)throw new Error("Custom alphabet for shortid must be "+s.length+" unique characters. You submitted "+e.length+" characters: "+e);var t=e.split("").filter((function(e,t,r){return t!==r.lastIndexOf(e)}));if(t.length)throw new Error("Custom alphabet for shortid must be "+s.length+" unique characters. These characters were not unique: "+t.join(", "));n=e,l()}}else n!==s&&(n=s,l())}function c(){return o=o||function(){n||u(s);var e,t=n.split(""),r=[];for(a.nextValue();0<t.length;)e=a.nextValue(),e=Math.floor(e*t.length),r.push(t.splice(e,1)[0]);return r.join("")}()}e.exports={get:function(){return n||s},characters:function(e){return u(e),n},seed:function(e){a.seed(e),i!==e&&(l(),i=e)},lookup:function(e){return c()[e]},shuffled:c}},9133:(e,t,r)=>{"use strict";var n,i,o=r(5239);r(6330),e.exports=function(e){var t="",r=Math.floor(.001*(Date.now()-1567752802062));return r===i?n++:(n=0,i=r),t=(t+=o(7))+o(e),0<n&&(t+=o(n)),t+o(r)}},5239:(e,t,r)=>{"use strict";var n=r(6330),i=r(6339),o=r(4403);e.exports=function(e){for(var t,r=0,a="";!t;)a+=o(i,n.get(),1),t=e<Math.pow(16,r+1),r++;return a}},6104:(e,t,r)=>{"use strict";var n=r(6330),i=r(9133),o=r(6932),a=r(517)||0;function s(){return i(a)}e.exports=s,e.exports.generate=s,e.exports.seed=function(t){return n.seed(t),e.exports},e.exports.worker=function(t){return a=t,e.exports},e.exports.characters=function(e){return void 0!==e&&n.characters(e),n.shuffled()},e.exports.isValid=o},6932:(e,t,r)=>{"use strict";var n=r(6330);e.exports=function(e){return!(!e||"string"!=typeof e||e.length<6||new RegExp("[^"+n.get().replace(/[|\\{}()[\]^$+*?.-]/g,"\\$&")+"]").test(e))}},6339:e=>{"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r="object"===("undefined"==typeof window?"undefined":t(window))&&(window.crypto||window.msCrypto),n=r&&r.getRandomValues?function(e){return r.getRandomValues(new Uint8Array(e))}:function(e){for(var t=[],r=0;r<e;r++)t.push(Math.floor(256*Math.random()));return t};e.exports=n},3445:e=>{"use strict";var t=1;e.exports={nextValue:function(){return(t=(9301*t+49297)%233280)/233280},seed:function(e){t=e}}},517:e=>{"use strict";e.exports=0},1643:(e,t,r)=>{"use strict";r.d(t,{sG:()=>n,zX:()=>i});const n=["map","normalMap","aoMap"],i=["map","metalnessMap","roughnessMap","normalMap","aoMap","emissiveMap","alphaMap","lightMap","envMap","displacementMap"]},5259:(e,t,r)=>{"use strict";r.d(t,{Z:()=>i});var n=r(2081);class i extends Map{constructor(e){e?super((0,n.js)(e,((e,t)=>[e,t]))):super()}map(e){return[...this.entries()].map((t=>{var[t,r]=t;return e(t,r)}))}toJSON(){const e={};return this.forEach(((t,r)=>{e[t]=r})),e}filter(e,t){let r=[];for(var[n,i]of this.entries())e(n,i)&&r.push("key"===t?n:i);return r}find(e){for(var[t,r]of this.entries())if(e(t,r))return r}static formJSON(e){return new i(e)}}},2016:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});class n extends Set{constructor(e){super(),this.isSet=!0,this.add(e||[])}add(e){return Array.isArray(e)?e.map((e=>this.add(e))):super.add(e),this}remove(e){if(Array.isArray(e))e.map((e=>this.remove(e)));else{if(!super.has(e))return;super.delete(e)}return this}toArray(){return[...this]}map(e,t=!1){const r=[];return this.forEach((n=>{if(n=e(n),!t)return r.push(n);n&&r.push(n)})),r}find(e){for(const t of this)if(e(t))return t}filter(e){const t=[];for(const r of this)e(r)&&t.push(r);return t}}},6999:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});const n=t=r(8881)},9197:(e,t,r)=>{"use strict";r.r(t),r.d(t,{createDefMaterial:()=>O,defAllMaterialMap:()=>D,defBaseMaterialMap:()=>T,default:()=>R,disposeMaterial:()=>I,getBaseTextures:()=>F,getTextures:()=>L,getTexturesByMaterial:()=>k,initMaterial:()=>G,isBaseMaterial:()=>V,isColor:()=>j,isMaterial:()=>N,mergeMaterial:()=>P,setDefMaterialForSameGeo:()=>z,setMaterialTexture:()=>U,updateMaterial:()=>H});var n=r(2081),i=r(9728),o=r(8881),a=r(1643);class s{static create(){return new o.MeshStandardMaterial}static isDefval(e){for(const t in this.defVal){const r=this.defVal[t],n=e[t];if(r instanceof o.Color){if(r.getHexString()!==n.getHexString())return!1}else if("object"==typeof r){if(n.x!==r.x)return!1}else if(n!==r)return!1}for(const t of a.zX)if(e[t])return!1;return!0}}s.defVal={color:new o.Color(16777215),emissive:new o.Color(0),roughness:1,metalness:0,lightMapIntensity:1,aoMapIntensity:1,emissiveIntensity:1,bumpScale:1,normalScale:new o.Vector2(1,1),displacementScale:1,envMapIntensity:1,wireframe:!1,transparent:!1,depthTest:!0,depthWrite:!0,opacity:1};var l=r(2266),u=r(9593);class c{constructor(e){this.tools={type:"FakeInterior",getTextures(e){const t=[];return e.uniforms.ceilingTex.value&&t.push({type:"ceilingTex",texture:e.uniforms.ceilingTex.value}),e.uniforms.floorTex.value&&t.push({type:"floorTex",texture:e.uniforms.floorTex.value}),e.uniforms.sideWallTex.value&&t.push({type:"sideWallTex",texture:e.uniforms.sideWallTex.value}),e.uniforms.backWallTex.value&&t.push({type:"backWallTex",texture:e.uniforms.backWallTex.value}),t},parseData:e=>{const{textures:t,normal:r}=e,n=new o.ShaderMaterial({uniforms:(0,l.d9)(h.uniforms),vertexShader:h.vertexShader,fragmentShader:h.fragmentShader});return t.forEach((e=>{"ceilingTex"===e.type?n.uniforms.ceilingTex.value=e.texture||null:"floorTex"===e.type?n.uniforms.floorTex.value=e.texture||null:"sideWallTex"===e.type?n.uniforms.sideWallTex.value=e.texture||null:"backWallTex"===e.type&&(n.uniforms.backWallTex.value=e.texture||null)})),Object.keys(r.uniforms).filter((e=>!c.TextureNames.includes(e))).map((e=>{var t=r.uniforms[e];n.uniforms[e].value="roomsXYZPropsW"===e||"positionOffsetRoomsXYZPropsW"===e||"roomColorTint"===e?new o.Vector4(t.x,t.y,t.z,t.w):t})),n.userData.tools=this.tools,n},toNormal:e=>{const t=O(),r=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:this.tools.type,uniforms:{}},textures:this.tools.getTextures(e)}),{}),n=e.uniforms,i=h.uniforms;return Object.keys(n).filter((e=>!c.TextureNames.includes(e))).map((e=>{var t,a,s,l,u,c,h=n[e].value,d=i[e].value;h instanceof o.Vector4?(({x:t,y:a,z:s}=h),({x:l,y:u,z:c}=d),t===l&&a===u&&s===c||(r[e]=h)):h!==d&&(r[e]=h)})),t.userData.normal.uniforms=r,t},clone:function(e,t){return e}},this.runScene=e}create(){const e=new o.ShaderMaterial({uniforms:(0,l.d9)(h.uniforms),vertexShader:h.vertexShader,fragmentShader:h.fragmentShader});return e.userData.tools=this.tools,e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new u.Z({target:e,typeList:["uniforms",...t],newVal:r}).execute())}}c.TextureNames=["sideWallTex","backWallTex","floorTex","ceilingTex"];const h={uniforms:{roomIntensity:{value:1},roomColorTint:{value:new o.Vector4(1,1,1,1)},sideWallTex:{value:null},backWallTex:{value:null},floorTex:{value:null},ceilingTex:{value:null},sideWallTexTiling:{value:.097},backWallTexTiling:{value:.097},floorTexTiling:{value:.15},ceilingTexTiling:{value:.15},roomTile:{value:.3},roomsXYZPropsW:{value:new o.Vector4(.35,.65,.1,1)},positionOffsetRoomsXYZPropsW:{value:new o.Vector4(4.7,2,-11,-3)},depthTest:{value:!0},depthWrite:{value:!0}},vertexShader:"\n varying vec2 vUv;\n varying vec3 vPos;\n varying mat4 vModelMatrix;\n \n void main() {\n vUv = uv;\n vPos = position;\n vModelMatrix = modelMatrix;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform float roomIntensity;\n uniform vec4 roomColorTint;\n \n uniform sampler2D sideWallTex;\n uniform sampler2D backWallTex;\n uniform sampler2D floorTex;\n uniform sampler2D ceilingTex;\n \n uniform float sideWallTexTiling;\n uniform float backWallTexTiling;\n uniform float floorTexTiling;\n uniform float ceilingTexTiling;\n \n uniform float roomTile;\n uniform vec4 roomsXYZPropsW;\n uniform vec4 positionOffsetRoomsXYZPropsW;\n \n varying vec2 vUv;\n varying vec3 vPos;\n varying mat4 vModelMatrix;\n \n void main() {\n vec4 interpVertexPos = vec4(vPos.xyz, vPos.z);\n // 将相机世界空间坐标转换为对象空间坐标\n vec4 cameraObjectPos = inverse(vModelMatrix) * vec4(cameraPosition, 1.0);\n vec4 transCameraPos = vec4(cameraObjectPos.xyz, cameraObjectPos.z);\n \n vec4 temp1 = (interpVertexPos - positionOffsetRoomsXYZPropsW);\n vec4 temp2 = ((roomsXYZPropsW + vec4(-1E-05, -1E-05, -1E-05, -1E-05)) * roomTile);\n vec4 V2 = transCameraPos - positionOffsetRoomsXYZPropsW;\n vec4 V1 = temp1 - V2;\n vec4 middleman = ((floor(temp2 * temp1) + step(vec4(0, 0, 0, 0), V1)) / temp2 - V2) / V1;\n \n // Side Walls\n vec2 sideWallUv = (middleman.x * V1 + V2).zy * sideWallTexTiling;\n vec4 sideWallColor = texture2D(sideWallTex, sideWallUv);\n \n // Back Wall\n vec2 backWallUv = (middleman.z * V1 + V2).xy * backWallTexTiling;\n vec4 backWallColor = texture2D(backWallTex, backWallUv);\n \n // Floor Ceiling\n vec2 floorUv = ((middleman.y * V1) + V2).xz * floorTexTiling;\n vec2 ceilingUv = ((middleman.y * V1) + V2).xz * ceilingTexTiling;\n vec4 floorColor = texture2D(floorTex, floorUv);\n vec4 ceilingColor = texture2D(ceilingTex, ceilingUv);\n vec4 cfColor = mix(floorColor, ceilingColor, step(0.0, V1.y));\n \n // Mix\n float compareXZ = 0.0;\n float stepXZ = step(middleman.z, middleman.x);\n if(stepXZ <= 0.0)\n compareXZ = middleman.x;\n else\n compareXZ = middleman.z;\n \n vec4 wallColor = vec4(0);\n if(stepXZ <= 0.0)\n wallColor = sideWallColor;\n else\n wallColor = backWallColor;\n \n vec4 finalColor = vec4(0);\n if(middleman.y <= compareXZ)\n finalColor = cfColor;\n else\n finalColor = wallColor;\n \n // Tint Room\n vec4 tintColor = roomColorTint * finalColor * roomIntensity;\n \n gl_FragColor = tintColor;\n }\n "};class d{constructor(e){this.tools={type:"Fresnel",getTextures(e){const t=[];return e.envMap&&t.push({type:"envMap",texture:e.envMap}),e.displacementMap&&t.push({type:"displacementMap",texture:e.displacementMap}),t},parseData:e=>{const{textures:t,normal:r,material:n}=e,i=P(n,new p(void 0,void 0,this.runScene));return i.name=n.name,t.forEach((e=>{i[e.type]=e.texture})),Object.keys(r.uniforms).filter((e=>!d.TextureNames.includes(e))).map((e=>{i[e]=r.uniforms[e]})),i.insertFresnelShader(),i.userData.tools=this.tools,i},toNormal:e=>{const t=P(e,O()),r=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:this.tools.type,uniforms:{}},textures:this.tools.getTextures(e)}),t.name=e.name,{}),n=f.uniforms;return Object.keys(n).filter((e=>!d.TextureNames.includes(e))).map((t=>{var i=e[t],o=n[t].value;"fresnelBias"===t||"fresnelScale"===t||"fresnelPower"===t||"isSurge"===t?i.value!==o&&(r[t]=i):i!==o&&(r[t]=i)})),t.userData.normal.uniforms=r,t},clone:(e,t)=>this.create(t)},this.runScene=e}create(e){const t=new p(void 0,void 0,this.runScene);return t.insertFresnelShader(),t.userData.tools=this.tools,(e=e||this.runScene.modelEx.select)&&(t.name=e.name),t}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new u.Z({target:e,typeList:[...t],newVal:r}).execute())}}d.TextureNames=["envMap","displacementMap"];class p extends o.MeshPhysicalMaterial{constructor(e,t,r){if(e?super(e):(super(),this.emissive=new o.Color(65535),this.envMap=null,this.displacementMap=null,this.metalness=0,this.roughness=0,this.ior=1.5,this.transmission=1,this.opacity=1,this.transparent=!0,this.thickness=0),this.runScene=r,t?(this.fresnelBias=new o.Uniform(t.fresnelBias),this.fresnelScale=new o.Uniform(t.fresnelScale),this.fresnelPower=new o.Uniform(t.fresnelPower)):(this.fresnelBias=new o.Uniform(f.uniforms.fresnelBias.value),this.fresnelScale=new o.Uniform(f.uniforms.fresnelScale.value),this.fresnelPower=new o.Uniform(f.uniforms.fresnelPower.value)),this.clock=new o.Clock,this.isSurge=new o.Uniform(!1),this.deltaTime=new o.Uniform(0),!this.cubeCamera){const e=new o.WebGLCubeRenderTarget(2048);e.texture.mapping=o.CubeRefractionMapping,this.cubeCamera=new o.CubeCamera(.1,1e5,e),this.runScene.assetsEx.scene.add(this.cubeCamera),this.runScene.cb.render.add("Fresnel",(()=>{this.update()}))}}insertFresnelShader(){this.onBeforeCompile=e=>{e.uniforms.isSurge=this.isSurge,e.uniforms.deltaTime=this.deltaTime,e.uniforms.fresnelBias=this.fresnelBias,e.uniforms.fresnelScale=this.fresnelScale,e.uniforms.fresnelPower=this.fresnelPower,e.vertexShader=e.vertexShader.replace(/varying vec3 vWorldPosition;/g,f.vertexParas),e.vertexShader=e.vertexShader.replace(/#include <begin_vertex>/g,f.vertexShader1),e.vertexShader=e.vertexShader.replace(/vWorldPosition = worldPosition.xyz;/g,f.vertexShader2),e.fragmentShader=e.fragmentShader.replace(/#include <transmission_pars_fragment>/g,f.fragmentParas),e.fragmentShader=e.fragmentShader.replace(/vec3 totalEmissiveRadiance = emissive;/g,f.fragmentShaderEmissive)}}update(){this.clock&&(this.deltaTime.value+=3*this.clock.getDelta()),this.cubeCamera&&(this.cubeCamera.position.copy(this.runScene.assetsEx.camera.position),this.cubeCamera.update(this.runScene.assetsEx.renderer,this.runScene.assetsEx.scene))}}const f={uniforms:{depthTest:new o.Uniform(!0),depthWrite:new o.Uniform(!0),isSurge:new o.Uniform(!1),deltaTime:new o.Uniform(0),fresnelBias:new o.Uniform(0),fresnelScale:new o.Uniform(1),fresnelPower:new o.Uniform(3)},vertexParas:"\n uniform bool isSurge;\n uniform float deltaTime;\n varying vec3 vWorldPosition;\n varying vec3 vWorldNormal;\n ",vertexShader1:"\n vec3 transformed = vec3(position);\n if(isSurge) {\n // 0.15作为系数控制气泡表面波纹的稀疏程度,数值越大越密\n float wobbleValue = 0.15 * transformed.y + deltaTime;\n // 三角函数的系数控制气泡表面波纹的波动幅度,数值越大波幅越大\n vec3 wobblePos = vec3(0.75 * cos(wobbleValue) + 0.25 * sin(wobbleValue));\n transformed += wobblePos;\n }\n ",vertexShader2:"\n vWorldPosition = worldPosition.xyz;\n vWorldNormal = normalize(vec3(modelMatrix * vec4(normal, 0.0)));\n ",fragmentParas:"\n #include <transmission_pars_fragment>\n varying vec3 vWorldNormal;\n uniform float fresnelBias;\n uniform float fresnelScale;\n uniform float fresnelPower;\n ",fragmentShaderEmissive:"\n vec3 viewDir = normalize(cameraPosition - vWorldPosition);\n float fresnelNdot = dot(viewDir, vWorldNormal);\n float fresnelValue = fresnelBias + fresnelScale * pow(1.0 - fresnelNdot, fresnelPower);\n // fresnelValue = [0, 1], 0=center,1=edge\n \n vec3 totalEmissiveRadiance = emissive * fresnelValue;\n "};var m=r(5105);class g{constructor(e){this.tools={type:"Physical",getTextures(e){const t=[];return g.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},parseData:e=>{const{normal:t,textures:r,material:n}=e,i=P(n,new o.MeshPhysicalMaterial);return i.name=n.name,r.forEach((e=>{i[e.type]=e.texture})),Object.keys(t.uniforms).filter((e=>!g.IgnoredAttributes.includes(e))).map((e=>{var r=t.uniforms[e];i[e]="attenuationColor"===e||"sheenColor"===e||"specularColor"===e?new o.Color(r):"clearcoatNormalScale"===e?new o.Vector2(r.x,r.y):r})),i.userData.tools=this.tools,i},toNormal:e=>{const t=P(e,O()),r=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:this.tools.type,uniforms:{}},textures:this.tools.getTextures(e)}),t.name=e.name,{}),n=new o.MeshPhysicalMaterial;return Object.keys(e).filter((e=>!g.TextureNames.includes(e))).filter((e=>!g.IgnoredAttributes.includes(e))).filter((e=>void 0===t[e])).map((t=>{const i=e[t],o=n[t];"attenuationColor"===t||"sheenColor"===t||"specularColor"===t?i.getHexString()!==o.getHexString()&&(r[t]=i.getHexString()):"clearcoatNormalScale"===t?i.x===o.x&&i.y===o.y||(r[t]=i):i!==o&&(r[t]=i)})),t.userData.normal.uniforms=r,t},clone:(e,t)=>this.create(t)},this.runScene=e}create(e){const t=new o.MeshPhysicalMaterial;return t.userData.tools=this.tools,(e=e||this.runScene.modelEx.select)&&(t.name="MeshPhysicalMaterial-"+e.name),t}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new u.Z({target:e,typeList:[...t],newVal:r}).execute())}}g.IgnoredAttributes=["_listeners","version","userData"],g.TextureNames=["alphaMap","aoMap","bumpMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap","clearcoatMap","clearcoatNormalMap","clearcoatRoughnessMap","sheenRoughnessMap","sheenColorMap","specularIntensityMap","specularColorMap","thicknessMap","transmissionMap"];class v{constructor(e){this.tools={type:"Matcap",getTextures(e){const t=[];return v.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},toNormal:e=>{var t=this.tools.getTextures(e);const r=P(e,O()),n=(r.userData=Object.assign(Object.assign({},r.userData),{normal:{type:this.tools.type,uniforms:{}},textures:t}),r.name=e.name,{}),i=new o.MeshMatcapMaterial;return Object.keys(e).filter((e=>!v.TextureNames.includes(e))).filter((e=>!v.IgnoredAttributes.includes(e))).map((t=>{var r=e[t],o=i[t];"bumpScale"===t||"displacementScale"===t||"displacementBias"===t||"depthTest"===t||"depthWrite"===t||"transparent"===t||"opacity"===t?r!==o&&(n[t]=r):"normalScale"!==t||r.x===o.x&&r.y===o.y||(n[t]=r)})),r.userData.normal.uniforms=n,r},parseData:e=>{const{normal:t,textures:r,material:n}=e,i=P(n,new o.MeshMatcapMaterial);return delete i.emissive,i.name=n.name,r.forEach((e=>{i[e.type]=e.texture})),Object.keys(t.uniforms).filter((e=>!v.IgnoredAttributes.includes(e))).map((e=>{i[e]="normalScale"===e?new o.Vector2(t.uniforms[e].x,t.uniforms[e].y):t.uniforms[e]})),i.userData.tools=this.tools,i},clone:(e,t)=>{const r=this.create(t);return Object.keys(r).filter((e=>!v.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r}},this.runScene=e}create(e){const t=new o.MeshMatcapMaterial;return t.userData.tools=this.tools,(e=e||this.runScene.modelEx.select)&&(t.name="Matcap-"+e.name),t}undo(e){const{material:t,list:r,val:n}=e;this.runScene.undoEx.addUndo(new u.Z({target:t,typeList:[...r],newVal:n,cb:()=>{t.needsUpdate=!0}}).execute())}}v.IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],v.TextureNames=["alphaMap","bumpMap","displacementMap","map","normalMap","matcap"];var y=r(8493);const b={uniforms:{tDiffuse:new o.Uniform(null),h:new o.Uniform(1/512)},vertexShader:"\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}",fragmentShader:"\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float h;\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvec4 sum = vec4( 0.0 );\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\t\n\t\t\tgl_FragColor = sum;\n\t\t}"},x={uniforms:{tDiffuse:new o.Uniform(null),v:new o.Uniform(1/512)},vertexShader:"\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}",fragmentShader:"\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float v;\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvec4 sum = vec4( 0.0 );\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\t\t\t\n\t\t\tgl_FragColor = sum;\n\t\t}"};new o.Uniform(null),new o.Uniform(null),new o.Uniform(0),new o.Uniform(0),new o.Uniform(0),new o.Uniform(new o.Vector2),new o.Uniform(.1),new o.Uniform(1e3);class w{constructor(e){this.materials={},this.render=()=>{(0,n.js)(this.materials,((e,t)=>{const{model:r,material:n}=t;n.update(r)}))},this.tools={type:"Reflector",getTextures:e=>k(e),parseData:e=>{const{textures:t,normal:r,models:n,material:i}=e,a=P(i,new A(void 0,void 0,this.runScene));return a.name=i.name,t.forEach((e=>{a[e.type]=e.texture})),Object.keys(r.uniforms).filter((e=>!w.TextureNames.includes(e))).map((e=>{a[e]="normalScale"===e?new o.Vector2(r.uniforms[e].x,r.uniforms[e].y):r.uniforms[e]})),a.setRTSize(a.resolution),a.setBlurPass(a.blurSize),a.insertReflectorShader(),a.userData.tools=this.tools,this.bindData({model:n[0],material:a}),a},toNormal:e=>{const t=P(e,O()),r=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:this.tools.type,uniforms:{}},textures:this.tools.getTextures(e)}),t.name=e.name,{}),n=S.uniforms;return Object.keys(n).filter((e=>!w.TextureNames.includes(e))).map((t=>{var i=e[t],o=n[t].value;"mirror"===t||"mixBlur"===t||"mixStrength"===t||"mixContrast"===t?i.value!==o&&(r[t]=i):i!==o&&(r[t]=i)})),t.normalScale&&(r.normalScale=t.normalScale),t.userData.normal.uniforms=r,t},clone:(e,t)=>this.create(t)},this.runScene=e,this.init()}init(){this.runScene.cb.render.add("Reflector-render",this.render),this.runScene.cb.model.add.add("",(({model:e})=>{var t;e.material&&"Reflector"===(null==(t=null==(t=e.material.userData)?void 0:t.tools)?void 0:t.type)&&(t=e.material,this.materials[t.userData.id]||(this.materials[t.userData.id]={model:e,material:t}))})),this.runScene.cb.model.remove.add("",(({model:e})=>{var t;e.material&&"Reflector"===(null==(t=null==(t=e.material.userData)?void 0:t.tools)?void 0:t.type)&&(t=e.material,delete this.materials[t.userData.id])}))}bindData(e){const t=e.material;var r=(0,i.getId)();t.userData.id=r,this.materials[r]=e}create(e){const t=new A(void 0,void 0,this.runScene);return t.insertReflectorShader(),t.userData.tools=this.tools,(e=e||this.runScene.modelEx.select)&&(t.name=e.name),this.bindData({model:e,material:t}),t}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new u.Z({target:e,typeList:[...t],newVal:r}).execute())}dispose(){this.materials={}}}w.TextureNames=["map","normalMap","roughnessMap","metalnessMap","tDiffuse","tDiffuseBlur"];class A extends o.MeshStandardMaterial{constructor(e,t,r){e?super(e):(super(),this.opacity=S.uniforms.opacity.value,this.transparent=S.uniforms.transparent.value,this.roughness=S.uniforms.roughness.value,this.metalness=S.uniforms.metalness.value),this.runScene=r,t?(this.resolution=t.resolution,this.blurSize=t.blurSize,this.mirror=new o.Uniform(t.mirror),this.mixBlur=new o.Uniform(t.mixBlur),this.mixStrength=new o.Uniform(t.mixStrength),this.mixContrast=new o.Uniform(t.mixContrast)):(this.resolution=S.uniforms.resolution.value,this.blurSize=S.uniforms.blurSize.value,this.mirror=new o.Uniform(S.uniforms.mirror.value),this.mixBlur=new o.Uniform(S.uniforms.mixBlur.value),this.mixStrength=new o.Uniform(S.uniforms.mixStrength.value),this.mixContrast=new o.Uniform(S.uniforms.mixContrast.value)),this.textureMatrix=new o.Uniform(new o.Matrix4),this.reflectorWorldPosition=new o.Vector3,this.cameraWorldPosition=new o.Vector3,this.rotationMatrix=new o.Matrix4,this.normal=new o.Vector3,this.view=new o.Vector3,this.lookAtPosition=new o.Vector3,this.target=new o.Vector3,this.tempQuaternion=new o.Vector4,this.virtualCamera=new o.PerspectiveCamera,this.reflectorPlane=new o.Plane,this.clipPlane=new o.Vector4,e={minFilter:o.LinearFilter,magFilter:o.LinearFilter,type:o.HalfFloatType,encoding:this.runScene.assetsEx.get().renderer.outputEncoding},this.glRT1=new o.WebGLRenderTarget(this.resolution,this.resolution,e),this.glRT2=new o.WebGLRenderTarget(this.resolution,this.resolution,e),this.tDiffuse=new o.Uniform(this.glRT1.texture),this.tDiffuseBlur=new o.Uniform(this.glRT2.texture),this.hBlurPass=new y.T(b),this.hBlurPass.uniforms.h.value=1/this.blurSize,this.hBlurPass.clear=!1,this.hBlurPass.renderToScreen=!1,this.hBlurPass.enabled=0<this.blurSize,this.hBlurPass.material.depthWrite=!1,this.vBlurPass=new y.T(x),this.vBlurPass.uniforms.v.value=1/this.blurSize,this.vBlurPass.clear=!1,this.vBlurPass.renderToScreen=!1,this.vBlurPass.enabled=0<this.blurSize,this.vBlurPass.material.depthWrite=!1}insertReflectorShader(){this.onBeforeCompile=e=>{var t;null!=(t=e.defines)&&t.USE_UV||(e.defines.USE_UV=""),null!=(t=e.defines)&&t.USE_BLUR||(e.defines.USE_BLUR=""),e.uniforms.tDiffuse=this.tDiffuse,e.uniforms.tDiffuseBlur=this.tDiffuseBlur,e.uniforms.textureMatrix=this.textureMatrix,e.uniforms.mirror=this.mirror,e.uniforms.mixBlur=this.mixBlur,e.uniforms.mixStrength=this.mixStrength,e.uniforms.mixContrast=this.mixContrast,e.vertexShader=S.vertexParas+""+e.vertexShader,e.vertexShader=e.vertexShader.replace("#include <project_vertex>",S.vertexShader),e.fragmentShader=S.fragmentParas+""+e.fragmentShader,e.fragmentShader=e.fragmentShader.replace("#include <emissivemap_fragment>",S.fragmentShader)}}setRTSize(e){this.glRT1.setSize(e,e),this.glRT2.setSize(e,e),this.hBlurPass.setSize(e,e),this.vBlurPass.setSize(e,e)}setBlurPass(e){this.hBlurPass.enabled=0<e,this.hBlurPass.enabled&&(this.hBlurPass.uniforms.h.value=1/e),this.vBlurPass.enabled=0<e,this.vBlurPass.enabled&&(this.vBlurPass.uniforms.v.value=1/e)}copy(e){return super.copy(e),this.resolution=e.resolution,this.blurSize=e.blurSize,this.mirror.value=e.mirror.value,this.mixBlur.value=e.mixBlur.value,this.mixStrength.value=e.mixStrength.value,this.mixContrast.value=e.mixContrast.value,this}swapBuffers(){var e=this.glRT1;this.glRT1=this.glRT2,this.glRT2=e}beforeRender(e){if(this.reflectorWorldPosition.setFromMatrixPosition(e.matrixWorld),this.cameraWorldPosition.setFromMatrixPosition(this.runScene.assetsEx.get().camera.matrixWorld),this.rotationMatrix.extractRotation(e.matrixWorld),this.normal.set(0,0,1),this.normal.applyMatrix4(this.rotationMatrix),this.reflectorWorldPosition.addScaledVector(this.normal,0),this.view.subVectors(this.reflectorWorldPosition,this.cameraWorldPosition),!(0<this.view.dot(this.normal))){this.view.reflect(this.normal).negate(),this.view.add(this.reflectorWorldPosition),this.rotationMatrix.extractRotation(this.runScene.assetsEx.get().camera.matrixWorld),this.lookAtPosition.set(0,0,-1),this.lookAtPosition.applyMatrix4(this.rotationMatrix),this.lookAtPosition.add(this.cameraWorldPosition),this.target.subVectors(this.reflectorWorldPosition,this.lookAtPosition),this.target.reflect(this.normal).negate(),this.target.add(this.reflectorWorldPosition),this.virtualCamera.position.copy(this.view),this.virtualCamera.up.set(0,1,0),this.virtualCamera.up.applyMatrix4(this.rotationMatrix),this.virtualCamera.up.reflect(this.normal),this.virtualCamera.lookAt(this.target),this.virtualCamera.far=this.runScene.assetsEx.get().camera.far,this.virtualCamera.updateMatrixWorld(),this.virtualCamera.projectionMatrix.copy(this.runScene.assetsEx.get().camera.projectionMatrix),this.textureMatrix.value.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),this.textureMatrix.value.multiply(this.virtualCamera.projectionMatrix),this.textureMatrix.value.multiply(this.virtualCamera.matrixWorldInverse),this.textureMatrix.value.multiply(e.matrixWorld),this.reflectorPlane.setFromNormalAndCoplanarPoint(this.normal,this.reflectorWorldPosition),this.reflectorPlane.applyMatrix4(this.virtualCamera.matrixWorldInverse),this.clipPlane.set(this.reflectorPlane.normal.x,this.reflectorPlane.normal.y,this.reflectorPlane.normal.z,this.reflectorPlane.constant);const t=this.virtualCamera.projectionMatrix;this.tempQuaternion.x=(Math.sign(this.clipPlane.x)+t.elements[8])/t.elements[0],this.tempQuaternion.y=(Math.sign(this.clipPlane.y)+t.elements[9])/t.elements[5],this.tempQuaternion.z=-1,this.tempQuaternion.w=(1+t.elements[10])/t.elements[14],this.clipPlane.multiplyScalar(2/this.clipPlane.dot(this.tempQuaternion)),t.elements[2]=this.clipPlane.x,t.elements[6]=this.clipPlane.y,t.elements[10]=this.clipPlane.z+1,t.elements[14]=this.clipPlane.w}}update(e){e&&e.visible&&(this.beforeRender(e),e.visible=!1,this.runScene.assetsEx.get().renderer.setRenderTarget(this.glRT1),this.runScene.assetsEx.get().renderer.clear(),this.runScene.assetsEx.get().renderer.render(this.runScene.assetsEx.get().scene,this.virtualCamera),this.hBlurPass&&this.hBlurPass.enabled&&(this.hBlurPass.render(this.runScene.assetsEx.get().renderer,this.glRT2,this.glRT1,0,!1),this.swapBuffers()),this.vBlurPass&&this.vBlurPass.enabled&&(this.vBlurPass.render(this.runScene.assetsEx.get().renderer,this.glRT2,this.glRT1,0,!1),this.swapBuffers()),e.visible=!0,this.runScene.assetsEx.get().renderer.setRenderTarget(null))}}const S={uniforms:{opacity:new o.Uniform(1),transparent:new o.Uniform(!1),roughness:new o.Uniform(1),metalness:new o.Uniform(.6),resolution:new o.Uniform(1024),blurSize:new o.Uniform(1024),mirror:new o.Uniform(0),mixBlur:new o.Uniform(10),mixStrength:new o.Uniform(2),mixContrast:new o.Uniform(1),depthTest:new o.Uniform(!0),depthWrite:new o.Uniform(!0)},vertexParas:"\n uniform mat4 textureMatrix;\n varying vec4 my_vUv;\n ",vertexShader:"\n #include <project_vertex>\n my_vUv = textureMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n ",fragmentParas:"\n uniform sampler2D tDiffuse;\n uniform sampler2D tDiffuseBlur;\n uniform sampler2D tDepth;\n uniform sampler2D distortionMap;\n uniform float distortion;\n uniform float mirror;\n uniform float mixBlur;\n uniform float mixStrength;\n uniform float mixContrast;\n uniform float minDepthThreshold;\n uniform float maxDepthThreshold;\n uniform float depthScale;\n uniform float depthToBlurRatioBias;\n varying vec4 my_vUv;\n ",fragmentShader:"\n #include <emissivemap_fragment>\n float distortionFactor = 0.0;\n #ifdef USE_DISTORTION\n distortionFactor = texture2D(distortionMap, vUv).r * distortion;\n #endif\n \n vec4 new_vUv = my_vUv;\n new_vUv.x += distortionFactor;\n new_vUv.y += distortionFactor;\n \n vec4 base = texture2DProj(tDiffuse, new_vUv);\n vec4 blur = texture2DProj(tDiffuseBlur, new_vUv);\n \n vec4 merge = base;\n \n #ifdef USE_NORMALMAP\n vec2 normal_uv = vec2(0.0);\n vec4 normalColor = texture2D(normalMap, vUv * normalScale);\n vec3 my_normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) );\n vec3 coord = new_vUv.xyz / new_vUv.w;\n normal_uv = coord.xy + coord.z * my_normal.xz * 0.05;\n vec4 base_normal = texture2D(tDiffuse, normal_uv);\n vec4 blur_normal = texture2D(tDiffuseBlur, normal_uv);\n merge = base_normal;\n blur = blur_normal;\n #endif\n \n float blurFactor = 0.0;\n float depthFactor = 0.0001;\n \n #ifdef USE_DEPTH\n vec4 depth = texture2DProj(tDepth, new_vUv);\n depthFactor = smoothstep(minDepthThreshold, maxDepthThreshold, 1.0-(depth.r * depth.a));\n depthFactor *= depthScale;\n depthFactor = max(0.0001, min(1.0, depthFactor));\n #ifdef USE_BLUR\n blur = blur * min(1.0, depthFactor + depthToBlurRatioBias);\n merge = merge * min(1.0, depthFactor + 0.5);\n #else\n merge = merge * depthFactor;\n #endif\n #endif\n \n float reflectorRoughnessFactor = roughness;\n #ifdef USE_ROUGHNESSMAP\n vec4 reflectorTexelRoughness = texture2D( roughnessMap, vUv );\n reflectorRoughnessFactor *= reflectorTexelRoughness.g;\n #endif\n \n #ifdef USE_BLUR\n blurFactor = min(1.0, mixBlur * reflectorRoughnessFactor);\n merge = mix(merge, blur, blurFactor);\n #endif\n \n vec4 newMerge = vec4(0.0, 0.0, 0.0, 1.0);\n newMerge.r = (merge.r - 0.5) * mixContrast + 0.5;\n newMerge.g = (merge.g - 0.5) * mixContrast + 0.5;\n newMerge.b = (merge.b - 0.5) * mixContrast + 0.5;\n \n diffuseColor.rgb = diffuseColor.rgb * ((1.0 - min(1.0, mirror)) + newMerge.rgb * mixStrength);\n "};var B=r(1736),M=r(6214),C=r(5860),E=r(5410),_=function(e,t,r,n){return new(r=r||Promise)((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};const T={depthTest:!0,depthWrite:!0,alphaTest:0,side:0,displacementScale:1,visible:!0,normalScale:{x:1,y:1},aoMapIntensity:1,lightMapIntensity:1,envMapIntensity:1},D=["color","emissive","roughness","metalness","normalScale","aoMapIntensity","displacementScale","transparent","lightMapIntensity","envMapIntensity","opacity","alphaTest"];class R{constructor(e){this.defMaterialMap={BaseMaterial:s,SpriteMaterial:m.Z,FakeInterior:c,Reflector:w,Fresnel:d,Physical:g,Matcap:v},this.defMaterial=O(),this.addCb=e=>{this.runScene.cb.material.add.cb(e)},this.setParses=[],this.runScene=e,this.runScene.cb.unique.material.add.add("engine-material-add",(e=>{this.addCb(e)})),this.defMaterialMap={BaseMaterial:s,SpriteMaterial:m.Z,FakeInterior:new c(e),Reflector:new w(e),Fresnel:new d(e),Physical:new g(e),Matcap:new v(e)},this.addSetParses((e=>{const{material:t,type:r,newVal:n}=e;"opacity"===r&&n<1&&(t.transparent=!0)}))}add(e,t,r){this.runScene.uniqueEx.material.add(e,t,r)}create(){var e=new o.MeshStandardMaterial;return this.add(e),e}clone(e){const t=e.clone();return t.userData.id=(0,i.getId)(),t}addSetParses(e){this.setParses.push(e)}set(e){const{material:t,type:r,val:n}=e,i=t[r];return t[r]=n,t.needsUpdate=!0,this.setParses.map((e=>e({material:t,type:r,newVal:n,oldVal:i})))}setNormals(e,t=!0){console.log(e,"map");const{info:r,newVal:n,materials:i,oldval:o,cb:a}=e;let s=n;return s.isVector2&&(s=s.clone()),e=i.map((e=>new M.Z({info:r,target:e,newVal:s,oldVal:o||e[r],runScene:this.runScene,cb:a}).execute())),t&&this.runScene.undoEx.addUndo(e),e}setNormal(e,t=!0){return e=new M.Z(Object.assign(Object.assign({},e),{runScene:this.runScene})).execute(),t&&this.runScene.undoEx.addUndo(e),e}setTextures(e,t=!0){return _(this,void 0,void 0,(function*(){const{info:r,newVal:n,materials:i,oldVal:o}=e;n instanceof File&&(e.newVal=yield this.runScene.textureEx.parse(n)),"envMap"===r&&(0,B.setTextureMapping)(e.newVal);var a=i.map((t=>new M.Z({info:r,target:t,newVal:e.newVal,oldVal:o||t[r],runScene:this.runScene}).execute()));return t&&this.runScene.undoEx.addUndo(a),i[0][r]}))}setTexture(e,t=!0){return _(this,void 0,void 0,(function*(){var{info:r,newVal:n,target:i}=e,n=(n instanceof File&&(e.newVal=yield this.runScene.textureEx.parse(n)),"envMap"===r&&(0,B.setTextureMapping)(e.newVal),new M.Z(Object.assign(Object.assign({},e),{oldVal:i[r],runScene:this.runScene})).execute());return t&&this.runScene.undoEx.addUndo(n),e.newVal}))}resetMaterial(e,t,r){const{addUndo:n,includeChild:i}=r=(0,E.Gm)({addUndo:!0,includeChild:!1},r);if(e&&t){const r=new Set;((0,E.lG)(e,"array")?e:[e]).map((e=>{i?e.traverse((e=>{V(e.material)&&r.add(e)})):e.material&&r.add(e)}));const o=[];r.forEach((e=>{o.push(new C.Z({target:e,runScene:this.runScene,info:"material",newVal:t,oldVal:e.material}).execute())})),this.runScene.modelEx.select===e&&this.runScene.cb.setSelectMaterial.cb(t),n&&this.runScene.undoEx.addUndo(o)}}getBase(e){const t=this.defMaterialMap[e];if(("SpriteMaterial"!==e||"Sprite"===(null==(e=this.runScene.modelEx.select)?void 0:e.type))&&t)return t.create()}toNromal(e){var t,r;const n=(null==(r=null==(t=e.userData.tools)?void 0:t.toNormal)?void 0:r.call(t,e))||e.clone();return n.userData=Object.assign(Object.assign({},n.userData),e.userData),n}setSelect(e){this.select=e,this.runScene.cb.setSelectMaterial.cb(e)}getDataByType(e,t){return this.defMaterialMap[e].tools.parseData(t)}dispose(){this.defMaterialMap.Reflector.dispose(),this.runScene.cb.material.dispose.cb("")}remove(e){}getDefNromals(e){var t;if(null!=(t=null==(t=e.userData)?void 0:t.tools)&&t.type)return{};const r={};return(0,n.js)(T,((t,n)=>{const i=e[t];if("object"==typeof i)for(const e in i)if(i[e]!==n[e])return void(r[t]=i.clone());i!==n&&(r[t]=i)})),r}parseNromals(e,t){(0,n.js)(e,((e,r)=>{var n,i,o,a,s;void 0!==T[e]&&("object"==typeof r?(({x:o,y:a,z:s}=r),null!=(i=null==(n=t[e])?void 0:n.set)&&i.call(n,o,a,s)):t[e]=r)}))}isBaseMaterial(e){return"MeshStandardMaterial"===e.type&&!e.userData.isTimeLineUsed&&s.isDefval(e)}}const O=e=>{const t=new o.MeshStandardMaterial(e);return t.userData.id=(0,i.getId)(),t},P=(e,t)=>(D.map((r=>{const n=e[r];"object"==typeof n&&(t[r]=n.clone()),t[r]=n})),t),I=e=>{e.dispose();const t=k(e);0!==t.length&&t.map((e=>{e=e.texture,(0,B.disposeTexture)(e)}))},k=e=>{var t=e.userData.textures||F(e);return delete e.userData.textures,t},L=e=>{var t;return(null==(t=null==(t=e.userData)?void 0:t.tools)?void 0:t.getTextures(e))||F(e)},F=e=>a.zX.map((t=>({type:t,texture:e[t]}))).filter((e=>e.texture)),U=e=>{const{material:t,type:r,texture:n}=e;"envMap"===r&&(0,B.setTextureMapping)(n),t[r]=n,t.needsUpdate=!0},G=e=>{e.vertexColors=!1,e.depthWrite=!0,e.needsUpdate=!1},j=e=>null==e?void 0:e.isColor,H=e=>{e.needsUpdate=!0},N=e=>null==e?void 0:e.isMaterial,z=e=>{},V=e=>null==e?void 0:e.isMeshStandardMaterial},5105:(e,t,r)=>{"use strict";r.d(t,{Z:()=>s});var n=r(8881),i=r(9197),o=r(811),a=r(1994);class s{static create(){const e=new n.SpriteMaterial;return e.userData.tools=this.tools,e}}s.modelTools={merge(e,t){t.position.copy(e.position),t.rotation.copy(e.rotation),t.scale.copy(e.scale),t.renderOrder=e.renderOrder,t.castShadow=e.castShadow,t.receiveShadow=e.receiveShadow,t.name=e.name,(0,a.M)(e,"name",e.name),(0,o.setLayers)(t,1===e.layers.mask?0:1)},toNormal:(e,t)=>{const r=(0,o.createDefModel)("Box");return r.userData.normal={type:"MySpriteMaterial"},r.material=e.material,s.modelTools.merge(e,r),r},parseData:(e,t)=>{const r=(0,o.createDefModel)("Sprite");var n=e.userData.layers;return(0,o.setLayers)(r,n),s.modelTools.merge(e,r),r.material=e.material,r}},s.tools={type:"SpriteMaterial",getTextures:function(e){return["map","alphaMap"].map((t=>{var r=e[t];if(r)return{type:t,texture:r}})).filter((e=>e))},parseData:e=>{const{textures:t,material:r}=e,n=(0,i.mergeMaterial)(r,s.create());var{depthWrite:e,depthTest:o,name:a}=r.userData.normal;return void 0!==e&&(n.depthWrite=e),void 0!==o&&(n.depthTest=o),a&&(n.name=a),t.map((e=>{var{type:e,texture:t}=e;n[e]=t})),n},toNormal:e=>{const t=(0,i.mergeMaterial)(e,(0,i.createDefMaterial)()),r=Object.assign(Object.assign({},t.userData),{normal:{type:s.tools.type,name:e.name},textures:s.tools.getTextures(e)});return e.depthWrite!==i.defBaseMaterialMap.depthWrite&&(r.normal.depthWrite=e.depthWrite),e.depthTest!==i.defBaseMaterialMap.depthTest&&(r.normal.depthTest=e.depthTest),t.userData=r,t},clone:function(e,t){return e}}},7263:(e,t,r)=>{"use strict";r.d(t,{Ju:()=>o,t9:()=>i,zf:()=>a});var n=r(1994);const i={isDynamic:()=>{}},o={isDeleted(e,t=!1){var r;return!!e&&(!(null==(r=null==e?void 0:e.userData)||!r.isDeleted)||!!t&&o.isDeleted(e.parent,t))},setDeleted(e,t){e.userData&&(t?(0,n.M)(e,"isDeleted",!0):null!=(t=null==e?void 0:e.userData)&&delete t.isDeleted)}},a={setLock(e){(0,n.M)(e,"lock",!0)},reLock(e){delete e.userData.lock},isLock(e,t=!1){if(!e||"Scene"===e.type)return!1;var r=e.userData.lock;return t?!!r||a.isLock(e.parent,t):void 0!==r&&r}}},811:(e,t,r)=>{"use strict";r.r(t),r.d(t,{createDefModel:()=>C,default:()=>M,delClonedModel:()=>G,deletedModel:()=>B.Ju,disposeModel:()=>E,dynamicModel:()=>B.t9,getClonedIdModel:()=>F,getDeepModels:()=>P,getModelSize:()=>z,hasSkeleton:()=>I,instanceModel:()=>_,isDynamicModel:()=>L,isGLowModel:()=>j,isGroup:()=>N,isSprite:()=>H,lockModel:()=>B.zf,mergeModel:()=>T,setClonedModel:()=>U,setDynamicModel:()=>k,setHelper:()=>R,setLayers:()=>O,withAnima:()=>D}),t=r(4356);var n=r.n(t),i=r(9716),o=r(2081),a=r(8881),s=r(8409);const l=["Group","Box","Circle","Cylinder","Dodecahedron","Icosahedron","Lathe","Octahedron","Plane","Ring","Sphere","Sprite","Tetrahedron","Torus","TorusKnot","Tube","Reflector"];var u=r(5259),c=r(2016),h=r(6999),d=r(5105),p=r(9197),f=r(1994),m=r(6875),g=r(9593),v=r(5860);class y extends r(1981).Z{constructor(e){super(),this.type="修改父元素",this.isUndoParent=!0,this.runScene=e.runScene,this.oldParent=e.oldParent,this.newParent=e.newParent,this.target=e.target}execute(){return this.redo(),this}_execute(e,t){e.attach(this.target),this.runScene.cb.model.setParent.cb({model:this.target,parent:e}),(null==(e=this.runScene.modelEx.select)?void 0:e.userData.id)===t.userData.id&&this.runScene.modelEx.selectNull()}undo(){this._execute(this.oldParent,this.newParent)}redo(){this._execute(this.newParent,this.oldParent)}}const b=y;var x=r(986),w=r(1682),A=r(317),S=r(4632);var B=r(7263);class M{constructor(e){this._selectModel=void 0,this.geometryMap=new u.Z,this.clonedMap=new u.Z,this.defNodeMap={castShadow:!1,receiveShadow:!1,renderOrder:0,visible:!0},this.add=(()=>{const e=(e,t)=>{t?(this.runScene.uniqueEx.model.add(e,{hasReset:!0}),this.runScene.cb.model.clone.cb(e)):this.runScene.uniqueEx.model.add(e)};return(t,r,n)=>{var{addUndo:i,isClone:o,select:a}=(0,S.mergeObject)({addUndo:!0,isClone:!1,select:!1},n);if(t instanceof Array)return t.map((e=>this.add(e,r,n)));e(t,o),this.setGeometryMap(t),this.setCloneMap(t);var s=new m.Z({model:t,parent:r||this.runScene.sceneEx.get(),isClone:o,runScene:this.runScene}).execute();return!0===i&&this.runScene.undoEx.addUndo(s),a&&this.setSelectByModel(t,{isDomTreeActive:!1,isClone:o}),s}})(),this.deepIsVisible=e=>"Scene"===e.type||!!e.visible&&!!e.parent&&this.deepIsVisible(e.parent),this.runScene=e,this.clone=(e=>(t,r=!0)=>{if(e.lightEx.isLight(t))return e.lightEx.clone(t);var n,i,a=I(t),s=(e=>{const t={};return(0,S.getModelMap)(e,"id",(e=>{0<e.animations.length&&(t[(0,A.K)(e)]=e.animations)})),t})(t),l=(a=a?function(e){var t=new Map,r=new Map,n=e.clone();return function e(t,r,n){n(t,r);for(var i=0;i<t.children.length;i++)e(t.children[i],r.children[i],n)}(e,n,(function(e,n){t.set(n,e),r.set(e,n)})),n.traverse((function(e){var n,i;e.isSkinnedMesh&&(i=(n=t.get(e)).skeleton.bones,e.skeleton=n.skeleton.clone(),e.bindMatrix.copy(n.bindMatrix),e.skeleton.bones=i.map((function(e){return r.get(e)})),e.bind(e.skeleton,e.bindMatrix))})),n}(t):t.clone(),l=t,(0,f.M)(a,"cloneId",F(l)||l.userData.id),(0,f.is)(t,"isDynamic")&&k(a,!0),(0,S.getModelMap)(a,"id"));u=a,null!=(n=null==(i=null==t?void 0:t.material)?void 0:i.userData)&&n.tools&&(n=null==(n=i.userData.tools)?void 0:n.clone(i,u))&&n.uuid!==i.uuid&&(e.materialEx.resetMaterial(u,n,{addUndo:!0}),e.materialEx.add(n,t,i));{var u={newModel:a,newModelMap:l,animaMap:s};const{animaMap:e,newModelMap:t}=u;(0,o.js)(e,((e,r)=>{const n=t[e];n&&(n.animations=[...r.map((e=>e.clone()))])}))}return r&&e.uniqueEx.model.add(a,{reset:!0,hasReset:!0}),a})(e)}get select(){return this._selectModel}set select(e){this.setSelectByModel(e)}setGeometryMap(e){if((0,S.validType)(e,"array"))return e.map((e=>this.setGeometryMap(e)));var t;e.geometry&&(t=e.geometry.uuid,this.geometryMap.get(t)||this.geometryMap.set(t,new Set),this.geometryMap.get(t).add((0,A.K)(e))),this.setGeometryMap(e.children)}isSameGeo(e,t){var{normal:e,position:r,uv:n}=e.attributes,{normal:t,position:i,uv:o}=t.attributes;return e.array.length===t.array.length&&r.array.length===i.array.length&&n.array.length===o.array.length&&(e=(0,S.sameArr)([...e.array],[...t.array],20),t=(0,S.sameArr)([...r.array],[...i.array],20),r=(0,S.sameArr)([...n.array],[...o.array],20),e&&t&&r)}getClonedIdFromModel(e){if(e.geometry){for(const e of this.clonedMap){const[r,n]=e;if(0!==n.size){var t=n.values()[0];if(!t)return;const e=this.runScene.uniqueEx.model.get(t);if(!e||!e.geometry)return;if(this.isSameGeo(e.geometry,e.geometry))return r}}this.clonedMap.map(((e,t)=>{t.size}))}}setCloneMap(e){if((0,S.validType)(e,"array"))return e.map((e=>this.setGeometryMap(e)));var t=F(e);(t||this.getClonedIdFromModel(e))&&(this.clonedMap.get(t)||this.clonedMap.set(t,new c.Z),this.clonedMap.get(t).add((0,A.K)(e)),this.setCloneMap(e.children))}removeCloneMap(e){this.clonedMap.get((0,A.K)(e))}replaceClonedGroup(e,t){t=F(t)||(0,A.K)(t);const r=this.clonedMap.get(t);r&&0!==r.size&&(e.userData.id=t,r.map((t=>{if(t=this.runScene.modelEx.getById(t)){var{position:r,rotation:n,scale:i,name:o,parent:a}=t;this.remove(t,!1);const s=this.runScene.modelEx.clone(e);s.userData.id=(0,A.K)(t),s.position.copy(r),s.rotation.copy(n),s.scale.copy(i),s.name=o,this.add(s,a,{addUndo:!1,isClone:!0,select:!1})}})))}replaceGeometry(e,t){t=t.uuid;const r=this.geometryMap.get(t);r&&0!==r.size&&(r.forEach((t=>{const r=this.runScene.uniqueEx.model.get(t);r&&(r.geometry=e,r.updateMatrix())})),this.geometryMap.delete(t),this.geometryMap.set(e.uuid,r))}setSelectByModel(e,t){this.runScene.optionsEx.log([e,"选中的模型",(0,A.K)(e)],"detail");var r,{isDomTreeActive:t,isClone:n}=t||{};if(this.runScene.events.key.shift&&this._selectModel)return!!(r=this.getBeTweenChildByTwoModel(this._selectModel,e))&&(this.runScene.multipSelector.add([...r,e],!0),!0);if(this.runScene.events.key.ctrl&&!n)this.runScene.multipSelector.add(e);else{if(this.runScene.multipSelector.isEmpty()||this.runScene.multipSelector.setEmpty(),this._selectModel){if(this._selectModel===e)return void(this.runScene.helperEx.focusModelId||this.runScene.helperEx.focus(e));this.runScene.lightEx.setNull(this._selectModel),this.runScene.cb.model.unFocus.cb(this._selectModel)}e&&(e.isCamera||(this.runScene.helperEx.focus(e),this.runScene.lightEx.setSelect(e)),this.runScene.cb.model.focus.cb({model:e,status:!0,domActive:!t}),this.runScene.materialEx.setSelect(e.material),this.runScene.cb.model.setSelect.cb(e),this._selectModel=e)}}setSelectById(e){(e=this.runScene.uniqueEx.model.get(e))&&this.setSelectByModel(e)}remove(e,t=!0){if(e instanceof Array)return e.map((e=>this.remove(e)));e=new x.Z({runScene:this.runScene,model:e,parent:e.parent||this.runScene.sceneEx.get()}).execute(),t&&this.runScene.undoEx.addUndo(e)}isNavieV3(e,t=0){var{x:e,y:r,z:n}=e;return e+r+n===t}isNavieV2(e,t=0){var{x:e,y:r}=e;return e===t&&r===t}isUnless(e){return!e.material&&this.isNavieV3(e.position)&&this.isNavieV3(e.rotation)&&this.isNavieV3(e.scale,3)&&0===e.children.length}isUnlessLevel(e){return this.isNavieV3(e.position)&&this.isNavieV3(e.rotation)&&this.isNavieV3(e.scale,3)&&1===e.children.length&&!D(e)}create(){return n().model.getModelByType("Box")}getById(e){return this.runScene.uniqueEx.model.get(e)}getLevel(e,t=0){return e.parent&&"Scene"!==e.parent.type?this.getLevel(e.parent,++t):t}selectNull(){var e=this._selectModel;e&&(this.runScene.cb.model.unFocus.cb(e),this.runScene.materialEx.setSelect(null),this.runScene.lightEx.setNull(e)),this._selectModel=void 0,this.runScene.cb.model.setSelect.cb(null),this.runScene.helperEx.unfocus()}cloneV3(e){return e.clone()}setParent(e,t,r=!0){if(t=new b({oldParent:e.parent,newParent:t,target:e,runScene:this.runScene}).execute(),!r)return t;this.runScene.undoEx.addUndo(t)}_setV3(e){const{model:t,info:r,newV3:n}=e;if(Array.isArray(t))return t.map((e=>{e[r].set(n.x,n.y,n.z),e.updateMatrix()}));t[r].set(n.x,n.y,n.z),t.updateMatrix()}update(e){if(Array.isArray(e))return e.map((e=>e.updateMatrix()));e.updateMatrix()}setV3(e,t=!0,r=!0){let{model:n,info:i,newV3:o,oldV3:s}=e;var l,u;if(o.isVector3||o.isEuler||(({x:c,y:l,z:u}=o),o=new a.Vector3(c,l,u)),(0,S.isRunning)(this.runScene))return this._setV3(e);var c=n instanceof Array?n.map((e=>new w.Z({target:e,info:i,runScene:this.runScene,oldV3:s||e[i].clone(),newV3:o}).execute(r))):new w.Z({target:n,info:i,oldV3:s||n[i].clone(),newV3:o,runScene:this.runScene}).execute(r);t&&this.runScene.undoEx.addUndo(c)}setNormal(e,t=!0){const{model:r,oldVal:n,info:i,val:o,executeCb:a}=e;return e=r instanceof Array?r.map((e=>new v.Z({target:e,info:i,runScene:this.runScene,oldVal:n||r[i],newVal:o,executeCb:a}).execute())):new v.Z({target:r,info:i,runScene:this.runScene,oldVal:n||r[i],newVal:o,executeCb:a}).execute(),t&&this.runScene.undoEx.addUndo(e),e}setMaterial(e,t,r=!0){var n=new v.Z({target:e,info:"material",runScene:this.runScene,oldVal:e.material,newVal:t}).execute();this.select===e&&this.runScene.cb.setSelectMaterial.cb(t),e.material.needsUpdate=!0,r&&this.runScene.undoEx.addUndo(n)}addDef(e){this.add(C(e),void 0,{select:!0})}isModel(e){return!(e.isLight||e.isCamera)}getSphere(){var e=new a.MeshBasicMaterial,t=new a.SphereGeometry(.7,150,150);return new a.Mesh(t,e)}getIndexByModel(e){var t;return e.parent?null==(t=e.parent)?void 0:t.children.findIndex((t=>t===e)):-1}getBeTweenChildByTwoModel(e,t){if(e.parent.uuid===t.parent.uuid){var r=this.getIndexByModel(e);if(t=this.getIndexByModel(t),-1!==r&&-1!==t){const n=Math.max(r,t),i=r===n?t:r;return e.parent.children.map(((e,t)=>t>i&&t<n&&e)).filter((e=>e))}}}setMultip(e){var{model:e,typeList:t,newVal:r}=e;this.runScene.undoEx.addUndo(new g.Z({target:e,typeList:t,newVal:r}).execute())}createGroup(e,t,r){const n=t||new a.Group,i=[];i.push(new m.Z({model:n,runScene:this.runScene,parent:r||this.runScene.assetsEx.get().scene}).execute()),e instanceof Array?i.push(...e.map((e=>new b({target:e,oldParent:e.parent,newParent:n,runScene:this.runScene}).execute()))):i.push(new b({target:e,oldParent:e.parent,newParent:n,runScene:this.runScene}).execute()),r&&this.runScene.cb.model.setOpen.cb({isOpen:!0,model:r}),this.runScene.cb.model.setOpen.cb({isOpen:!0,model:n}),this.runScene.cb.model.setMainStatue.cb({status:!0,model:n}),this.runScene.undoEx.addUndo(i),this.setSelectByModel(n)}cleanGroup(e,t=!0){if(e instanceof Array){const t=(0,i.multiArrToArr)(e.map((e=>(this.runScene.cb.model.unFocus.cb(e),this.cleanGroup(e,!1)))).filter((e=>e)));return this.runScene.undoEx.addUndo(t),t}if(this.runScene.cb.model.unFocus.cb(e),0!==e.children.length){const r=[],n=e.children.map((e=>{if(e.parent.parent)return new b({target:e,oldParent:e.parent,newParent:e.parent.parent,runScene:this.runScene})})).filter((e=>e));return r.push(...n.map((e=>e.execute()))),r.push(new x.Z({runScene:this.runScene,model:e,parent:e.parent}).execute()),t&&this.runScene.undoEx.addUndo(r),r}}hideOther(e){const t=e.uuid,r=0<e.children.length,i=this.runScene.sceneEx.getClearModels(),o=[];i.map((i=>{i.traverse((i=>{r?!1===n().model.deepFindParentByUuid(i,t)&&i.uuid!==e.uuid&&o.push(i):i.uuid!==e.uuid&&o.push(i)}))}));var a=o.map((e=>new v.Z({target:e,info:"visible",newVal:!1,runScene:this.runScene,oldVal:e.visible}).execute()));this.runScene.undoEx.addUndo(a),n().model.setParentVisible(e,!0)}showAll(){const e=this.runScene.sceneEx.getClearModels(),t=[];e.map((e=>{e.traverse((e=>{"materialHelper"!==e.name&&!1===e.visible&&t.push(e)}))}));var r=t.map((e=>new v.Z({target:e,info:"visible",runScene:this.runScene,newVal:!0,oldVal:e.visible}).execute()));this.runScene.undoEx.addUndo(r)}removeHide(){const e=this.runScene.sceneEx.getClearModels(),t=new Set,r=[];e.map((e=>{e.traverse((e=>{e.visible||t.add(e)}))})),t.forEach((e=>{r.push(new x.Z({runScene:this.runScene,model:e,parent:e.parent}).execute())})),this.runScene.undoEx.addUndo(r)}_getModel(e){var t=this.runScene.uniqueEx.model.nameMap[e];if(t)return this.runScene.uniqueEx.model.get(t)||this.runScene.assetsEx.scene.getObjectByName(e)}getModel(e,t="array"){if(!(e instanceof Array))return this._getModel(e);if("array"===t)return e.map((e=>this._getModel(e)));if("map"===t){const t={};return e.map((e=>{t[e]=this.getModel(e)})),t}}getWorldLocal(e){this.runScene.assetsEx.scene.updateMatrixWorld(!0);var t=new a.Vector3;return e.getWorldPosition(t),t}getClickObj(e,t,r=!1){let i=new a.Raycaster,o=new a.Vector2,s=(o.x=e.offsetX/this.runScene.assetsEx.engineDom.clientWidth*2-1,o.y=-e.offsetY/this.runScene.assetsEx.engineDom.clientHeight*2+1,i.setFromCamera(o,this.runScene.assetsEx.camera),i.intersectObjects(t,!0)),l={intersects:null,obj:null};if(0!==s.length)if(r){if(0===(e=s.filter((e=>n().model.isVisible(e.object)))).length)return l;l={intersects:e,obj:e[0].object}}else l={intersects:s,obj:s[0].object};return l}getCamLocal(){var{x:e,y:t,z:r}=this.runScene.assetsEx.camera.position,{x:n,y:i,z:o}=this.runScene.assetsEx.controls.target;return{cx:e,cy:t,cz:r,tx:n,ty:i,tz:o}}camAnima(e,t,r=1,n,i){return(0,S.anima)(e,t,r,(e=>{i&&i(e),this.runScene.assetsEx.camera.position.set(e.cx,e.cy,e.cz),this.runScene.assetsEx.controls.target.set(e.tx,e.ty,e.tz),this.runScene.assetsEx.camera.lookAt(this.runScene.assetsEx.controls.target)}),(e=>{n&&n()}))}setGlow(e,t=!0){t=t?1:0,0==(e.userData.layers=t)?e.layers.set(0):e.layers.enable(1),this.runScene.cb.model.setLayers.cb({model:e,val:t})}beforeLoad(e){return e instanceof Array?e.map((e=>this.beforeLoad(e))):e}focus(e){const{scene:t,camera:r,renderer:n,controls:i}=this.runScene.assetsEx.get(),o=new a.Vector3,s=new a.Vector3;if("Mesh"===e.type||"Group"===e.type||"Object3D"===e.type){const e=this.runScene.helperEx.boxHelper;if(e.update(),!e||!e.object)return;var l=n.domElement.getBoundingClientRect();let t=l.width/l.height;const i=new a.Vector3;l=e.geometry.attributes.position.array,i.set(Math.abs(l[0]-l[3]),Math.abs(l[1]-l[7]),Math.abs(l[2]-l[14])),s.x=.5*(l[0]+l[3]),s.y=.5*(l[1]+l[7]),s.z=.5*(l[2]+l[14]);let u=new a.Vector3;u.subVectors(r.position,s),u.projectOnPlane(new a.Vector3(0,1,0)),u.normalize(),1<t&&(t=1/t),l=2*Math.tan(.5*r.fov*Math.PI/180),l=i.length()/t/l,o.addVectors(s,u.multiplyScalar(l))}else{t.updateMatrixWorld(!0),l=new a.Vector3,e.getWorldPosition(l),s.set(l.x,l.y,l.z);let n=new a.Vector3;n.subVectors(r.position,s),n.projectOnPlane(new a.Vector3(0,1,0)),n.normalize(),o.addVectors(s,n.multiplyScalar(3))}(0,S.anima)({positionX:r.position.x,positionY:r.position.y,positionZ:r.position.z,targetX:i.target.x,targetY:i.target.y,targetZ:i.target.z},{positionX:o.x,positionY:o.y,positionZ:o.z,targetX:s.x,targetY:s.y,targetZ:s.z},.5,(e=>{r.position.set(e.positionX,e.positionY,e.positionZ),r.lookAt(e.targetX,e.targetY,e.targetZ),i.target.set(e.targetX,e.targetY,e.targetZ),i.update()}))}instance(e){this.runScene.assetsEx.scene.updateMatrixWorld();const t={},r=Array.isArray(e)?e:[e],n=[];r.map((e=>{e.traverse((e=>{var r;e.geometry&&!L(e)&&(r=F(e))&&(n.push(e),t[r]||(t[r]=new Set),t[r].add(e))}))})),(0,o.js)(t,((e,t)=>{e=this.runScene.uniqueEx.model.get(e),t.size<2||!e||(t=_(e,[...t]),this.runScene.modelEx.add(t,void 0,{isClone:!1,select:!1,addUndo:!1}),j(e)&&this.setGlow(t,!0),this.runScene.modelEx.remove(e,!1))})),n.map((e=>{this.runScene.modelEx.remove(e,!1)}))}reset(){this.runScene.modelEx.selectNull(),this.geometryMap.clear()}getHoverFromModels(e,t,r){const{getOriginData:n,ignoreMove:i}=(0,S.mergeObject)({ignoreMove:!1,getOriginData:!1},r);this.runScene.cb.events.pointer.move.add("get-hover-from-models",(r=>{if(i||!this.runScene.events.mouse.isMove){const i=new a.Raycaster,l=new a.Vector2;var{engineDom:o,camera:s}=this.runScene.assetsEx.get();l.x=r.offsetX/o.clientWidth*2-1,l.y=-r.offsetY/o.clientHeight*2+1,i.setFromCamera(l,s);const u=i.intersectObjects(e||[],!0);null!=t&&t(0===u.length?null:n?u:u.map((e=>e.object)))}}))}}const C=e=>{if(l.includes(e)){const t=n().model.getModelByType(e);return"Sprite"===t.type&&(t.material.userData.tools=d.Z.tools),t}throw TypeError("")},E=(e,t)=>{t=(t||{}).remove;const{geometry:r,material:n}=e;r&&(null!=r&&r.dispose(),delete e.geometry),n&&((0,p.disposeMaterial)(e.material),e.material.dispose(),delete e.material),!1!==t&&e.parent&&e.parent.remove(e)},_=(e,t)=>{var{material:r,geometry:n}=e;const i=new h.Z.InstancedMesh(n,r,t.length+1);return[e,...t].map(((e,t)=>{e.updateMatrix(),i.setMatrixAt(t,e.matrixWorld)})),i.name=e.name,i},T=(e,t)=>{const r=[];if(t.map((e=>{e=e.geometry,r.push(e)})),t=s.qf(r))return new h.Z.Mesh(t,e)},D=e=>0!==e.animations.length,R=e=>{e&&e.userData&&(e.userData.isHelper=!0)},O=(e,t)=>{null!=t&&(0===t?e.layers.set(0):e.layers.enable(1),(0,f.M)(e,"layers",t))},P=e=>{const t=[];e.traverse((e=>{t.push(e)}))},I=e=>{let t=!1;return e.traverse((e=>{e.isSkinnedMesh&&(t=!0)})),t},k=(e,t)=>{t?(0,f.M)(e,"isDynamic",!0):delete e.userData.isDynamic},L=(e,t)=>e&&t?!!e.userData.isDynamic||!!e.parent&&L(e.parent,t):null==(t=null==e?void 0:e.userData)?void 0:t.isDynamic,F=e=>e.userData.cloneId,U=(e,t)=>{(0,f.M)(e,"cloneId",t)},G=e=>{delete e.userData.cloneId},j=e=>1===e.userData.layers,H=e=>e.isSprite,N=e=>{},z=e=>{var t=new a.Vector3;return(new a.Box3).setFromObject(e).getSize(t),t}},8266:(e,t,r)=>{"use strict";r.d(t,{Z:()=>i,s:()=>o});var n=r(8881);class i{constructor(e){this.setSize=(e,t)=>{var{width:r,height:n}=this.getDomSize();this.runScene.setSize(e||r,t||n)},this.runScene=e,this.runScene.cb.resize.add("render-ex-resize",(({width:e,height:t})=>{this.setSize(e,t)}))}setBackground(e){this.runScene.assetsEx.engineDom.style.background=e}create(e){let t=new n.WebGLRenderer({antialias:!0,alpha:!0,powerPreference:"high-performance"});return t.domElement.style.position="absolute",t.setPixelRatio(window.devicePixelRatio),t.shadowMap.enabled=!0,t.shadowMap.type=n.PCFSoftShadowMap,t.physicallyCorrectLights=!0,t.localClippingEnabled=!0,e.appendChild(t.domElement),t}getDomSize(){var{clientWidth:e,clientHeight:t}=this.runScene.assetsEx.get().engineDom;return{width:e,height:t}}}const o=(e,t)=>{t=(t||{}).removeDom,!(e.render=()=>{})!==t&&e.domElement.remove(),e.setAnimationLoop(null),e.dispose(),e.renderLists&&e.renderLists.dispose()}},1994:(e,t,r)=>{"use strict";r.d(t,{M:()=>m,ZP:()=>f,bv:()=>y,is:()=>v});var n=r(4547),i=r(9716),o=r(8881),a=r(9197),s=r(811),l=r(8266),u=r(1736),c=r(9593),h=r(5860),d=r(986),p=function(e,t,r,n){return new(r=r||Promise)((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};class f{constructor(e){this.oldFog=null,this.removeMap={light:{valid:e=>this.runScene.lightEx.isLight(e),remove:e=>this.runScene.lightEx.remove(e)}},this.runScene=e}each(e){return this.runScene.assetsEx.get().scene.traverseAncestors(e)}get(){return new Proxy(this.runScene.assetsEx.get().scene,{set:(e,t,r)=>(e[t]=r,!0)})}getNromal(){return this.get().children.filter((e=>!this.runScene.helperEx.isHelper(e)))}remove(e){var t;if(e){if(e instanceof Array){const t=[];return e.map((e=>{for(const r in this.removeMap){const{valid:n,remove:o}=this.removeMap[r];if(n(e))return t.push(...(0,i.multiArrToArr)(o(e)))}t.push(new d.Z({model:e,runScene:this.runScene,parent:e.parent}).execute())})),this.runScene.undoEx.addUndo(t),t}for(const t in this.removeMap){const{valid:r,remove:n}=this.removeMap[t];if(r(e))return n(e)}this.runScene.modelEx.remove(e),null!=(t=this.runScene.helperEx.boxHelper)&&t.setFromObject(this.get())}}cleanUnlessLevel(e){return this.runScene.modelEx.isUnlessLevel(e)&&!this.runScene.helperEx.isHelper(e)&&0!==e.children.length&&1===e.children.length?this.cleanUnlessLevel(e.children[0]):e}searchModel(e){return this.runScene.uniqueEx.model.findModelWithName(e)}getClearModels(){return this.get().children.filter((e=>!this.runScene.helperEx.isHelper(e)&&!this.runScene.lightEx.isLight(e)))}getClear(){const e=this.get(),t=new o.Group;return e.children.filter((e=>!this.runScene.helperEx.isHelper(e)&&!this.runScene.lightEx.isLight(e))).map((e=>{const r=e.clone();(0,s.withAnima)(e)&&(r.animations=[...e.animations]),t.add(r)})),this.runScene.helperEx.setHelper(t),this.cleanUnlessLevel(t)}cleanNormal(){this.getNromal().map((e=>this.remove(e)))}cleanSceneInfo(e){e.background=null,e.environment=null,e.fog=null,this.runScene.cb.setScene.cb({scene:e,type:"any",val:null})}setBackground(e,t=!0){return p(this,void 0,void 0,(function*(){e instanceof String&&(e=yield this.runScene.textureEx.load(e)),(0,u.isTexture)(e)&&(e.userData.isBackgroud=!0);var r=this.get(),n=new h.Z({target:r,info:"background",newVal:e,oldVal:r.background,runScene:this.runScene,cb:e=>{}}).execute();return t&&this.runScene.undoEx.addUndo(n),this.runScene.cb.setScene.cb({scene:r,type:"background",val:r.background}),e}))}isBackground(e){return e.userData.isBackgroud}clean(){this.setBackground(null),this.setEnv(null),this.runScene.tags.clear(),this.runScene.assetsEx.scene.fog=null,this.runScene.helperEx.unfocus(),this.runScene.anima.reset();const e=this.getClearModels();let t=[];e.map((e=>{e.traverse((e=>t.push(e)))})),t.map((e=>{(0,s.disposeModel)(e,{remove:!1}),this.runScene.cb.model.dispose.cb(e)})),(0,l.s)(this.runScene.assetsEx.get().renderer),this.runScene.assetsEx.get().controls.dispose(),this.runScene.assetsEx.reset(),this.runScene.modelEx.reset(),this.cleanSceneInfo(this.get()),this.runScene.cameraEx.reset(this.runScene.assetsEx.get().camera),this.cleanNormal(),this.runScene.assetsEx.get().renderer.resetState(),this.runScene.assetsEx.get().controls.update(),this.runScene.uniqueEx.dispose(),this.runScene.materialEx.dispose(),this.runScene.undoEx.reset(),this.runScene.timeLineEx.reset(),this.runScene.bloom.glow.dispose(),this.runScene.bloom.glow.init(this.runScene.assetsEx.get()),this.runScene.helperEx.reset(),this.runScene.cb.reset.cb(this.get())}dispose(){const{renderer:e,controls:t}=this.runScene.assetsEx.get();this.clean(),(0,l.s)(e),t.dispose(),this.runScene.bloom.glow.dispose(),o.Cache.clear()}render(){}create(){return new o.Scene}setEnv(e){return p(this,void 0,void 0,(function*(){var t=this.runScene.assetsEx.scene;let r;return e instanceof String&&(r=yield this.runScene.textureEx.load(e)),e instanceof File&&(r=yield this.runScene.textureEx.parse(e)),r=(r=null!=e&&e.isTexture?this.runScene.textureEx.clone(e):r)&&(0,u.setTextureMapping)(r),this.setNormal({model:t,info:"environment",val:r}),this.runScene.cb.setScene.cb({scene:t,type:"environment",val:r}),r}))}setNormal(e,t=!0){var{model:e,info:r,val:n}=e;e=new h.Z({target:e,info:r,oldVal:e[r],newVal:n,runScene:this.runScene}).execute(),t&&this.runScene.undoEx.addUndo(e)}setFogShow(e){var t=this.runScene.assetsEx.scene,{show:e,color:r}=e;e?this.setNormal({model:t,info:"fog",val:this.oldFog||new o.Fog(r||"#ffffff")}):(this.oldFog=t.fog,this.setNormal({model:t,info:"fog",val:null})),this.runScene.cb.setScene.cb({scene:t,type:"fog",val:t.fog})}setFog(e){var t=this.runScene.assetsEx.scene,{type:e,val:r}=e;t=new c.Z({target:t,typeList:["fog",e],newVal:r}).execute(),this.runScene.undoEx.addUndo(t)}sreenShotDefFile(e,t){e=e||Number(prompt("请输入截图的宽"))||1920,t=t||Number(prompt("请输入截图的高"))||1080;var{width:r,height:i}=(this.runScene.helperEx.unfocus(),this.runScene.renderEx.getDomSize());const o=this.runScene.assetsEx.get().renderer.domElement,{renderer:a,scene:s,camera:l}=(o.width=e,o.height=t,this.runScene.renderEx.setSize(e,t),this.runScene.assetsEx.get());return a.render(s,l),e=o.toDataURL("image/png",1),t=(0,n.base64ToFile)(e,"screenShot.png"),o.width=r,o.height=i,this.runScene.renderEx.setSize(),a.render(s,l),t}static toJSON(e){const t={};return e.fog&&(t.fog=g(e.fog)),(0,a.isColor)(e.background)&&(t.backgroundColor=e.background.getHexString()),t}setEnvStrength(e){this.runScene.uniqueEx.material.each((t=>{void 0!==t.envMapIntensity&&(t.envMapIntensity=e,(0,a.updateMaterial)(t))}))}}const m=(e,t,r)=>{e.userData[t]=r},g=e=>{const{color:t,far:r,near:n}=e;return{color:t.getHexString(),far:r,near:n}},v=(e,t)=>(null==(e=null==e?void 0:e.userData)?void 0:e[t])||"",y=(e,t)=>{delete e.userData[t]}},1736:(e,t,r)=>{"use strict";r.r(t),r.d(t,{bindTextureBaseData:()=>w,default:()=>g,disposeTexture:()=>x,getBlobByTexture:()=>A,getCloneIdFromTexture:()=>R,getMimeByTexture:()=>y,getSizeByTexture:()=>_,getTextureGpuMemory:()=>b,getTextureMinFilter:()=>k,getUrlByTexture:()=>C,initTexture:()=>S,isClonedTexture:()=>D,isTexture:()=>T,loadTexture:()=>M,parseImageBitMapByBlob:()=>B,setTextureCloneId:()=>O,setTextureMapping:()=>E,setTextureMinFilter:()=>I,textureNameMap:()=>v,updateTexture:()=>P});var n=r(2081),i=r(9728),o=r(8881),a=r(6999),s=r(6214),l=r(4632),u=r(317),c=r(5860);class h extends r(1981).Z{constructor(e){super(),this.info="函数修改",this.map=e}_execute(e,t){throw new Error("Method not implemented.")}execute(){return this.map.redo(),this}undo(){this.map.undo()}redo(){this.map.redo()}}const d=h;var p=r(9197),f=r(1994),m=function(e,t,r,n){return new(r=r||Promise)((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};class g{constructor(e){this.allTextures=new Set,this.setAnima=e=>{const{texture:t,type:r,val:n}=e,i=t.userData.uvScript||{};t.userData.uvScript||(t.userData.uvScript=i),0===n?delete i[r]:i[r]=n,this.runScene.cb.texture.setAnima.cb({texture:t,uvScript:i})},this.runScene=e}load(e){return m(this,void 0,void 0,(function*(){var t=yield(0,l.urlToBlob)(e);return this.parse(t)}))}parse(e){return m(this,void 0,void 0,(function*(){var t="Blob"===(0,l.getType)(e)?e:yield(0,l.fileToBlob)(e);return this.afterLoad(yield M(t),t)}))}clone(e){const t=new o.Texture(e.image);return t.userData=Object.assign(Object.assign({},e.userData),{id:(0,i.getId)(),cloneSourceId:(0,u.K)(e)}),(0,f.bv)(t,"minFilter"),w(t),this.getSameAndAddtoAll(t)}getDef(e){return e=new o.Texture(e),w(e),this.getSameAndAddtoAll(e)}getSameAndAddtoAll(e){var t=e.userData.md5;return(t=this.getSameTexture(t,e))?(x(e),t):(this.initTextureAndAddtoAll(e),e)}afterLoad(e,t){return m(this,void 0,void 0,(function*(){return this.getSameAndAddtoAll(yield w(e,t))}))}getSameTexture(e,t){if(!D(t))for(const n in this.runScene.uniqueEx.texture.map){var r=this.runScene.uniqueEx.texture.get(n);if(r.userData.md5===e&&r.mapping===t.mapping)return r}}initTextureAndAddtoAll(e){return m(this,void 0,void 0,(function*(){return S(e),w(e),this.addTextureToAll(e),e}))}addTextureToAll(e){var t=this.runScene.uniqueEx.texture.getLength();this.runScene.uniqueEx.texture.add(e),this.runScene.uniqueEx.texture.getLength()!==t&&this.runScene.cb.texture.add.cb(e)}getBlobAndBase64(e){return e.userData.blob?e.userData:(0,l.imgBitMapToBlobAndBase64)(e)}coverByImage(e,t){return m(this,void 0,void 0,(function*(){let r;r=T(t)?t:t?yield this.parse(t):null;var i=this.runScene.uniqueEx.texture.getMaterials(this.runScene.uniqueEx.getId(e));if(i){const t=[];(0,n.js)(i,((n,i)=>{const o=this.runScene.uniqueEx.material.get(n);o&&i.forEach((n=>{t.push(new s.Z({target:o,info:n,newVal:r,oldVal:e,runScene:this.runScene}).execute())}))})),this.runScene.undoEx.addUndo(t)}}))}remove(e){const t=(0,u.K)(e);var r=this.runScene.uniqueEx.texture.map[t];if(r){const i=[];r=r.materialMap,(0,n.js)(r,((e,t)=>{const r=this.runScene.uniqueEx.material.get(e);r&&(t.forEach((e=>{i.push(new c.Z({target:r,info:e,oldVal:r[e],newVal:null,runScene:this.runScene,cb(){(0,p.updateMaterial)(r)}}).execute())})),(0,p.updateMaterial)(r))}));const o=this.runScene.uniqueEx.texture.map[t];i.push(new d({undo:()=>{this.runScene.cb.texture.add.cb(e),this.runScene.uniqueEx.texture.add(e)},redo:()=>{this.runScene.cb.texture.remove.cb(e),this.runScene.uniqueEx.texture.remove(e)}}).execute(),new d({undo:()=>{this.runScene.uniqueEx.texture.map[t]=o},redo:()=>{this.runScene.uniqueEx.texture.map[t]=null}}).execute()),this.runScene.undoEx.addUndo(i)}}delete(e){this.runScene.cb.texture.remove.cb(e),this.runScene.uniqueEx.texture.remove(e),x(e)}reverseImageBitMapTexture(e){return m(this,void 0,void 0,(function*(){var{canvas:t,imageBitMap:r}=yield(0,l.reverseImageBitMap)(e.image);const i=new o.Texture(r);return i.needsUpdate=!0,r=this.runScene.uniqueEx.texture.map[e.userData.id],(0,n.js)(r.materialMap,((e,t)=>{const r=this.runScene.uniqueEx.material.get(e);t.forEach((e=>{r[e]=i,this.runScene.uniqueEx.texture.addMaterial(i,{material:r,type:e})}))})),S(i),yield w(i),this.runScene.cb.texture.add.cb(i),this.delete(e),(0,l.disposeCanvas)(t),i}))}}const v={环境遮蔽:"aoMap",法线:"normalMap",金属度:"metalnessMap",粗糙度:"roughnessMap",自发光:"emissiveMap",颜色:"map",置换:"displacementMap",光照贴图:"lightMap",环境:"envMap",透明度:"alphaMap"},y=e=>1023===e.format?"image/png":"image/jpeg",b=e=>{var{width:e,height:t}=e.image;return e*t*4*1.33},x=e=>{var t,r;e&&(t=e.image,r=e.userData.url,t instanceof ImageBitmap?(0,l.disposeImageBitMap)(t):t instanceof HTMLCanvasElement&&(0,l.disposeCanvas)(t),URL.revokeObjectURL(r),e.dispose())},w=(e,t)=>m(void 0,void 0,void 0,(function*(){var r=(0,l.isBlob)(e.userData.blob)?e.userData.blob:null;const n=t||r||(yield A(e));e.userData.blob=n;var{md5:r,url:i}=e.userData;return r||(e.userData.md5=(0,l.getMd5)(yield n.arrayBuffer())),i||(e.userData.url=URL.createObjectURL(n)),e.userData.gm=b(e),e.format=e.userData.format||-1!==n.type.indexOf("png")?1023:1022,e})),A=e=>(0,l.isBlob)(e.userData.blob)?e.userData.blob:(0,l.imgBitMapToBlob)(e.image),S=e=>(e.magFilter=1003,e.wrapS=a.Z.RepeatWrapping,e.wrapT=a.Z.RepeatWrapping,e.encoding=3e3,e.version=3,e.flipY=!1,"nearest"!==k(e)&&(e.minFilter=a.Z.LinearMipmapLinearFilter),e.needsUpdate=!0,e),B=e=>createImageBitmap(e,{imageOrientation:"flipY",resizeQuality:"pixelated"}),M=e=>m(void 0,void 0,void 0,(function*(){var t=yield B(e instanceof Blob?e:yield(0,l.urlToBlob)(e));return new o.Texture(t)})),C=e=>null==(e=e.userData)?void 0:e.url,E=(e,t="repeat")=>(e.mapping="repeat"===t?a.Z.EquirectangularReflectionMapping:300,e.needsUpdate=!0,e),_=e=>{var{width:e,height:t}=e.image;return{width:e,height:t}},T=e=>null==e?void 0:e.isTexture,D=e=>0<(null==(e=e.userData.cloneSourceId)?void 0:e.length),R=e=>e.userData.cloneSourceId,O=(e,t)=>{e.userData.cloneSourceId=t},P=e=>{e.needsUpdate=!0},I=(e,t)=>{e.minFilter=a.Z["linear"===t?"LinearMipmapLinearFilter":"NearestFilter"],(0,f.M)(e,"minFilter",t),P(e)},k=e=>(0,f.is)(e,"minFilter")},2266:(e,t,r)=>{"use strict";r.d(t,{ZP:()=>n,d9:()=>i});class n{constructor(e){this.undos=[],this.redos=[],this.dataMap={history:[],index:0},this.runScene=e}undo(){if(0!==this.undos.length){const e=this.removeUndos(-1)[0];e&&(e instanceof Array?e.reverse().map((e=>e.undo())):e.undo(),this.redos.push(e))}}addUndos(e){var t;return this.undos.push(e),t=this.dataMap.history.push(e),this.dataMap.index=this.undos.length-1,this.runScene.cb.undo.addUndos.cb({undoVal:e,undos:this.undos}),t}removeUndos(e){var t;return this.undos.splice(e),t=this.dataMap.history.splice(e),this.dataMap.index=this.undos.length-1,this.runScene.cb.undo.removeUndos.cb({index:e}),t}undoByIndex(e){e>this.dataMap.index?this.undos.slice(this.dataMap.index+1,e+1).map((e=>{e instanceof Array?e.map((e=>e.redo())):e.redo()})):e<this.dataMap.index&&this.undos.slice(e+1,this.dataMap.index+1).reverse().map((e=>{e instanceof Array?e.map((e=>e.undo())):e.undo()})),this.dataMap.index=e,this.runScene.cb.undo.undoByIndex.cb(e)}addUndo(e){this.dataMap.index!==this.undos.length&&this.removeUndos(this.dataMap.index+1),this.addUndos(e)}addRedo(e){this.redos.push(e)}redo(){if(0!==this.redos.length){const e=this.redos.splice(-1)[0];e&&(e instanceof Array?e.reverse().map((e=>e.redo())):e.redo(),this.addUndo(e))}}reset(){this.undos=[],this.redos=[],this.dataMap.history=[],this.dataMap.index=0,this.runScene.cb.undo.reset.cb("")}}var i=function(e){if("object"!=typeof e)return e;if(null===e)return null;if(e){var t,r,n=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(r=i(e[t]),n[t]=r);return n}}},6875:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});class n extends r(387).Z{constructor(e){super(e),this.type="添加模型",this.isUndoAdd=!0}_execute(e){return Promise.reject()}undo(){this.remove({model:this.model,parent:this.parent,addTree:this.addTree,isClone:this.isClone,runScene:this.runScene})}redo(){this.add({model:this.model,parent:this.parent,addTree:this.addTree,isClone:this.isClone,runScene:this.runScene})}execute(){return this.redo(),this}}},387:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});class n{constructor(e){this.addTree=!0,this.isClone=!1,this.cb=(e,t)=>{};var{model:e,parent:t,cb:r,addTree:n,isClone:i,runScene:o}=e;this.runScene=o,this.model=e,this.parent=t,!1===n&&(this.addTree=n),!0===i&&(this.isClone=i),r&&(this.cb=r)}remove(e){const{model:t,parent:r,addTree:n,runScene:i}=e;i.modelEx.select===t&&i.modelEx.selectNull(),r.remove(t),n&&i.uniqueEx.model.remove(t),n&&i.cb.model.remove.cb({model:t,parent:r}),this.cb(t,"remove"),i.uniqueEx.material.addModel(t,void 0,t.material)}add(e){const{model:t,parent:r,addTree:n,isClone:i,runScene:o}=e;r.add(t),n&&o.uniqueEx.model.add(t),n&&o.cb.model.add.cb({model:t,parent:r,isClone:i}),this.cb(t,"add"),o.uniqueEx.material.addModel(t,t.material)}}},1981:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});class n{}},6214:(e,t,r)=>{"use strict";r.d(t,{Z:()=>o});var n=r(1643);class i extends r(1981).Z{constructor(e){super(),this.isUndoMaterial=!0,this.type="修改材质";var{target:e,info:t,newVal:r,oldVal:n,runScene:i,cb:o}=e;this.runScene=i,this.target=e,this.info=t,this.newVal=r,this.oldVal=n,this.cb=o}_execute(e,t){if(this.target[this.info]=e,this.target.needsUpdate=!0,n.zX.includes(this.info)){if(!e)return;this.runScene.uniqueEx.texture.addMaterial(e,{material:this.target,type:this.info})}"depthWrite"===this.info&&!0===e&&delete this.target.userData[this.info],null!=(e=this.cb)&&e.call(this,this)}execute(){return this.redo(),this}undo(){this._execute(this.oldVal,this.newVal)}redo(){this._execute(this.newVal,this.oldVal)}}const o=i},9593:(e,t,r)=>{"use strict";r.d(t,{Z:()=>a});var n=r(9716),i=r(2081);class o extends r(1981).Z{constructor(e){super(),this.type="多层级修改",this.isUndoMultipLevel=!0,this.target=e.target,this.typeList=e.typeList,this.new=e.newVal,this.cb=e.cb,this.old=(0,i.qR)(e.target,this.typeList)[(0,n.lastArrayEle)(e.typeList)]}execute(){return this.redo(),this}_execute(e){const t=(0,i.qR)(this.target,this.typeList);t[(0,n.lastArrayEle)(this.typeList)]=e,this.cb&&this.cb(t),"shadow"!==this.typeList[0]&&this.typeList[1]}undo(){this._execute(this.old)}redo(){this._execute(this.new)}}const a=o},5860:(e,t,r)=>{"use strict";r.d(t,{Z:()=>i});class n extends r(1981).Z{constructor(e){super(),this.type="修改属性",this.isUndoNormal=!0,this.cb=e=>{};var{target:e,info:t,oldVal:r,newVal:n,runScene:i,cb:o,executeCb:a}=e;this.runScene=i,this.target=e,this.info=t,this.newVal=n,this.oldVal=r,o&&(this.cb=o),a&&(this.executeCb=a)}_execute(e){var{target:t,info:r}=this;if(this.executeCb)return this.executeCb({target:t,info:r,val:e});this.target[this.info]=e,"name"===this.info&&this.target.isObject3D?(t=this.runScene.uniqueEx.model.parseName(this.target),r=e,this.runScene.cb.model.changeName.cb({model:this.target,name:e=t||e,oldName:r})):"material"===this.info?this.runScene.uniqueEx.material.addModel(this.target,e,e===this.newVal?this.oldVal:this.newVal):"visible"===this.info&&this.runScene.cb.model.setVisible.cb({model:this.target,visible:e}),this.runScene.cb.model.change.cb({type:this.info,model:this.target,val:e}),this.cb(this.target)}execute(){return this.redo(),this}undo(){this._execute(this.oldVal)}redo(){this._execute(this.newVal)}}const i=n},986:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});class n extends r(387).Z{constructor(e){super(e),this.type="移除模型",this.isUndoRemove=!0}undo(){this.add({model:this.model,parent:this.parent,addTree:this.addTree,runScene:this.runScene})}redo(){this.remove({model:this.model,parent:this.parent,addTree:this.addTree,runScene:this.runScene})}_execute(e){return Promise.reject()}execute(){return this.redo(),this}}},1682:(e,t,r)=>{"use strict";r.d(t,{Z:()=>i});class n extends r(1981).Z{constructor(e){super(),this.isUndoV3=!0,this.type="三维矩阵修改";var{target:e,info:t,newV3:r,oldV3:n,runScene:i}=e;this.target=e,this.info=t,this.runScene=i,this.newV3=r,this.oldV3=n,this.target.uuid===(null==(e=this.runScene.modelEx.select)?void 0:e.uuid)&&(this.runScene.cb.model.setSelect.cb(null),this.runScene.cb.model.setSelect.cb(this.target))}_execute(e){this.target[this.info].copy(e),this.target.uuid===(null==(e=this.runScene.modelEx.select)?void 0:e.uuid)&&this.runScene.helperEx.focus(this.target)}execute(e=!0){return e&&this.redo(),this}undo(){this._execute(this.oldV3)}redo(){this._execute(this.newV3)}}const i=n},317:(e,t,r)=>{"use strict";r.d(t,{Z:()=>c,K:()=>h});var n=r(2543),i=r(6001),o=r(9728),a=r(7391);class s extends class{constructor(e){this.map={},this.unique=e}add(e){if(e instanceof Array)return e.map((e=>this.add(e)));let t=e.userData.id;return t||(t=(0,o.getId)(),e.userData.id=t),this.map[t]?void 0:(this.map[t]=e,t)}get(e){return this.map[e]}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));delete this.map[e.userData.id]}}{constructor(){super(...arguments),this.nameMap={},this.parseName=(()=>{const e=e=>{var t=e.lastIndexOf("_");return-1===t?-1:(e=e.slice(t+1),i.type.isNumber(e)?Number.parseInt(e):-1)},t=(r,n)=>{var i=(t=>{if(-1===e(t))return t;var r=t.lastIndexOf("_");return-1===r?t:t.slice(0,r)})(r)+"_"+n++;return this.nameMap[i]?t(r,n):i},r=e=>Object.keys(this.nameMap).find((t=>this.nameMap[t]===e)),n=["PerspectiveCamera"];return i=>{if(n.includes(i.type))return i.name=i.type;let o=i.name;if(o=o||i.type,!this.nameMap[o])return a=this.unique.getId(i),(s=r(a))&&delete this.nameMap[s],void(this.nameMap[o]=a);var a,s=this.nameMap[o];return this.unique.model.get(s)!==i?(a=e(o),a=t(o,s=-1===a?0:a),this.nameMap[a]=this.unique.getId(i),i.name=a):void 0}})()}add(e,t){var{reset:r,hasReset:n}=t||{};if(e instanceof Array)return e.map((e=>this.add(e,t)));if(e){let i=e.userData.id;if(i&&!r||(i=(0,o.getId)(),e.userData.id=i),this.map[i]){if(!(n||(0,a.An)(this.unique.runScene)&&(0,a.FW)(this.unique.runScene).coverSameId))return void(e.name!==this.map[i].name&&this.unique.runScene.optionsEx.log(`解析模型出错,${e.name} 与 ${this.map[i].name} 拥有相同的id,请选择任意一个模型导出并删除,并重新导入。`,"base","error"));i=(0,o.getId)(),e.userData.id=i}return this.map[i]=e,this.parseName(e),e.material&&this.unique.material.add(e.material,e),e.children.length?this.add(e.children,t):i}}get(e){return this.map[e]}getModelsWithIds(e){return e.map((e=>this.get(e))).filter((e=>e))}getByName(e){return this.nameMap[e]}getIdByNames(e){return e.map((e=>this.getByName(e))).filter((e=>e))}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));e.traverse((e=>{delete this.nameMap[e.name]})),delete this.map[e.userData.id]}dispose(){this.map={},this.nameMap={}}findModelWithName(e){var t=Object.keys(this.nameMap).filter((t=>{const r=t.toLowerCase();return r===(t=e.toLowerCase())||-1!==r.indexOf(t)}));return t=this.getIdByNames(t),this.getModelsWithIds(t)}}var l=r(2081);class u{constructor(e){this.map={},this.unique=e}add(e){if(e instanceof Array)return e.map((e=>this.add(e)));let t=e.userData.id;return t||(t=(0,o.getId)(),e.userData.id=t),this.map[t]?void 0:(this.map[t]={texture:e,materialMap:{}},t)}getLength(){return Object.keys(this.map).length}addMaterial(e,t,r){var n;e=e.userData.id||this.add(e),t&&(({material:t,type:n}=t),this.map[e].materialMap[t.userData.id]||(this.map[e].materialMap[t.userData.id]=new Set),this.map[e].materialMap[t.userData.id].add(n)),r&&(({material:t,type:n}=r),this.map[e].materialMap[t.userData.id]&&this.map[e].materialMap[t.userData.id].delete(n))}get(e){return null==(e=this.map[e])?void 0:e.texture}getMaterials(e){return null==(e=this.map[e])?void 0:e.materialMap}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));var t=this.map[e.userData.id];t&&((0,l.js)(t.materialMap,((e,t)=>{const r=this.unique.runScene.uniqueEx.material.get(e);r&&t.forEach((e=>{r[e]=null}))})),delete this.map[e.userData.id])}dispose(){(0,l.js)(this.map,((e,t)=>{t.texture.dispose()})),this.map={}}}class c{constructor(e){this.runScene=e,this.model=new s(this),this.material=new n.Z(this),this.texture=new u(this)}getId(e){return e.userData.id}dispose(){this.material.dispose(),this.model.dispose(),this.texture.dispose()}}const h=e=>(null==(e=null==e?void 0:e.userData)?void 0:e.id)||""},2543:(e,t,r)=>{"use strict";r.d(t,{Z:()=>o,o:()=>a});var n=r(2081),i=r(9728);class o{constructor(e){this.map={},this.removes=[],this.unique=e}add(e,t,r){if(e&&e.userData){let n=e.userData.id;n||(n=(0,i.getId)(),e.userData.id=n),this.map[n]||(this.map[n]={material:e,models:new Set},this.unique.runScene.cb.unique.material.add.cb(e),t&&this.addModel(t,e,r))}}addModel(e,t,r){t&&t.userData&&(t=t.userData.id,null!=(t=this.map[t])&&t.models.add(e)),r&&null!=(t=this.map[r.userData.id])&&t.models.delete(e)}each(e){return this.getAll("values").map((({material:t})=>e(t)))}getAll(e){return Object[e](this.map)}get(e){return null==(e=this.map[e])?void 0:e.material}remove(e){delete this.map[e]}addRemoved(e){this.map[e.uuid]&&this.removes.push(e.uuid)}dispose(){(0,n.js)(this.map,((e,t)=>{t.material.dispose()})),this.map={}}}const a=e=>null==(e=null==e?void 0:e.userData)?void 0:e.id},4632:(e,t,r)=>{"use strict";r.r(t),r.d(t,{LimitCb:()=>i.cM,addElesFromIndexToArr:()=>i.Rn,angleToNum:()=>o.Zv,anima:()=>i.gY,arrayBufferToBase64:()=>i.sM,arrayBufferToBlobUr:()=>i.oo,arrayToVector3:()=>o.F,base64ToArrayBuffer:()=>i.RG,base64ToBlob:()=>i.Jr,bitMapToCanvas:()=>n.Rd,blobToFile:()=>i.hl,bufferToArrayBuffer:()=>i.cO,canvasToBlob:()=>i._c,changeModelOpc:()=>o.Hg,changeModelOpcs:()=>o.Z7,clone:()=>i.d9,compressImgToUrl:()=>n.jH,deepMergeObject:()=>i.U,disposeCanvas:()=>n.eZ,disposeImageBitMap:()=>n.oZ,domTo2Dui:()=>o.UZ,domTo3DSprite:()=>o.YG,domTo3Dui:()=>o.ol,fileAndBlobToCanvas:()=>i.OE,fileToBlob:()=>i.a_,filterFiles:()=>i.Rz,fromCode:()=>i.Ne,getArrIndexByItem:()=>i.B1,getBetweenByV3:()=>o.A2,getCamAnimaData:()=>o.Gm,getCurve:()=>o.kG,getDistance:()=>o.Sp,getEmptyImageData:()=>n.mH,getFilesByDataTransfer:()=>i.xl,getFilesFromFileList:()=>i.kk,getImg:()=>n.Pk,getImgPixels:()=>n.BW,getImgPixels1:()=>n.Cm,getLine2:()=>o.SI,getMacro:()=>i.Ls,getMd5:()=>i.ZM,getModelMap:()=>o.yT,getNamesByNum:()=>i.nR,getOptions:()=>a.FW,getProgress:()=>i.xC,getRandomColor:()=>i.mr,getRes:()=>i.sR,getResultFromCanvas:()=>n.xK,getTime:()=>i.hK,getTruthBase64:()=>i.Mh,getType:()=>i.oL,getTypeByBase64:()=>i.Op,getTypeFromGlb:()=>a.te,getVideoTexture:()=>o.hX,getWorldLocal:()=>o.VU,hslToRgb:()=>n.ve,imgArrayBufferToBlobUrl:()=>n.lU,imgBitMapToBase64:()=>n.s4,imgBitMapToBlob:()=>n.gW,imgBitMapToBlobAndBase64:()=>n.v1,isBlob:()=>i.Lj,isEditor:()=>a.hz,isEmpty:()=>i.xb,isRunning:()=>a.An,longestCommonPrefix:()=>i.GG,mergeObject:()=>i.Gm,removeUnLess:()=>o.hs,reverseImageBitMap:()=>n.Fs,reverseImg:()=>n.rx,rgbToHsl:()=>n.lC,rmArrEle:()=>i.J9,rmPartOfString:()=>i.h3,sameArr:()=>i.F1,textureToThreeD:()=>o.vp,toCode:()=>i.Ni,toTimeString:()=>i.U9,transByte:()=>i.iM,urlToBlob:()=>i.pX,urlToCanvas:()=>i.o4,validType:()=>i.lG,vector:()=>o.xr});var n=r(7179),i=r(5410),o=r(9960),a=r(7391)},7179:(e,t,r)=>{"use strict";r.d(t,{BW:()=>f,Cm:()=>p,Fs:()=>x,Pk:()=>y,Rd:()=>m,eZ:()=>w,gW:()=>l,jH:()=>d,lC:()=>g,lU:()=>h,mH:()=>S,oZ:()=>A,rx:()=>u,s4:()=>s,v1:()=>c,ve:()=>v,xK:()=>b});var n=r(6999),i=r(1736),o=r(5410),a=function(e,t,r,n){return new(r=r||Promise)((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};const s=e=>{const t=document.createElement("canvas");return(t.width=e.width,t.height=e.height,t.getContext("2d")).drawImage(e,0,0,t.width,t.height),t.toDataURL()},l=e=>a(void 0,void 0,void 0,(function*(){const t=document.createElement("canvas");return(t.width=e.width,t.height=e.height,t.getContext("2d")).drawImage(e,0,0,t.width,t.height),new Promise((e=>{t.toBlob((t=>{e(t)}))}))})),u=e=>{const t=document.createElement("canvas"),r=(t.width=e.width,t.height=e.height,t.getContext("2d"));r.translate(0,t.height),r.scale(1,-1),r.drawImage(e,0,0,t.width,t.height)},c=e=>a(void 0,void 0,void 0,(function*(){var t=e.image;const r=document.createElement("canvas"),n=(r.width=t.width,r.height=t.height,r.getContext("2d")),o=(0,i.getMimeByTexture)(e);return n.drawImage(t,0,0,r.width,r.height),new Promise((e=>{r.toBlob((t=>{e({blob:t,base64:r.toDataURL(o)})}),o)}))})),h=(e,t)=>URL.createObjectURL(new Blob([e],t)),d=(e,t)=>{const r=document.createElement("canvas"),n=r.getContext("2d");return r.width=e.width,r.height=e.height,n.drawImage(e,0,0,e.width,e.height),new Promise((e=>{r.toBlob((t=>{t&&e(URL.createObjectURL(t))}),"image/webp",t)}))},p=e=>a(void 0,void 0,void 0,(function*(){var{bitmap:t,texture:r}=e;const{ctx:i,canvas:a}=yield(0,o.OE)(URL.createObjectURL(r.userData.blob),{width:t.width,height:t.height});for(var s=i.getImageData(0,0,t.width,t.height,{colorSpace:"srgb"}),l=0,u=s.data.length;l<u;l+=4){var c=(d=g(s.data[l],s.data[l+1],s.data[l+2]))[0]/100,h=d[1]/100,d=d[2]/100;c=v(c,h,d),s.data[l]=c[0],s.data[l+1]=c[1],s.data[l+2]=c[2]}return i.putImageData(s,0,0),new n.Z.Texture(a)})),f=e=>{for(var t=(e=e.bitmap).width,r=e.height,n=m(e).ctx.getImageData(0,0,t,r).data,i=[],o=0;o<n/4;o+=1)i.push(n.slice(4*o,4*(o+1)))},m=e=>{const t=document.createElement("canvas"),r=t.getContext("2d");return r.drawImage(e,0,0,e.width,e.height),{ctx:r,canvas:t}},g=(e,t,r)=>{e/=255,t/=255,r/=255;var n,i=Math.max(e,t,r),o=Math.min(e,t,r),a=(i+o)/2;if(i==o)n=l=0;else{var s=i-o,l=.5<a?s/(2-i-o):s/(i+o);switch(i){case e:n=(t-r)/s+(t<r?6:0);break;case t:n=(r-e)/s+2;break;case r:n=(e-t)/s+4}n/=6}return[100*n,100*l,100*a]},v=(e,t,r)=>{var n,i,o,a;return 0==t?i=o=a=r:(i=(n=function(e,t,r){return r<0&&(r+=1),1<r&&--r,r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e})(t=2*r-(r=r<.5?r*(1+t):r+t-r*t),r,e+1/3),o=n(t,r,e),a=n(t,r,e-1/3)),[255*i,255*o,255*a]},y=e=>{const t=new Image;return t.src=e,new Promise((e=>{t.onload=()=>{e(t)}}))},b=(e,t,r)=>{const n=(0,o.Gm)({base64Type:"webp"},r).base64Type;return new Promise(((r,i)=>{"blob"===t?e.toBlob((e=>{(e?r:i)(e)})):"base64"===t&&r(e.toDataURL("image/"+n))}))},x=e=>a(void 0,void 0,void 0,(function*(){var{width:t,height:r}=e;const n=document.createElement("canvas"),i=(n.width=t,n.height=r,n.getContext("2d"));if(i)return i.translate(0,r),i.scale(1,-1),i.drawImage(e,0,0,t,r),{imageBitMap:yield createImageBitmap(i.getImageData(0,0,t,r)),canvas:n}})),w=e=>{e.remove()},A=e=>{e.close()},S=e=>{var{width:e,height:t}=e;const r=document.createElement("canvas");return(r.width=e,r.height=t,r.getContext("2d")).drawImage(new Image,0,0),r}},5410:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{B1:()=>getArrIndexByItem,F1:()=>sameArr,GG:()=>longestCommonPrefix,Gm:()=>mergeObject,J9:()=>rmArrEle,Jr:()=>base64ToBlob,Lj:()=>isBlob,Ls:()=>getMacro,Mh:()=>getTruthBase64,Ne:()=>fromCode,Ni:()=>toCode,OE:()=>fileAndBlobToCanvas,Op:()=>getTypeByBase64,RG:()=>base64ToArrayBuffer,Rn:()=>addElesFromIndexToArr,Rz:()=>filterFiles,U:()=>deepMergeObject,U9:()=>toTimeString,ZM:()=>getMd5,_c:()=>canvasToBlob,a_:()=>fileToBlob,cM:()=>LimitCb,cO:()=>bufferToArrayBuffer,d9:()=>clone,gY:()=>anima,h3:()=>rmPartOfString,hK:()=>getTime,hl:()=>blobToFile,iM:()=>transByte,kk:()=>getFilesFromFileList,lG:()=>validType,mr:()=>getRandomColor,nR:()=>getNamesByNum,o4:()=>urlToCanvas,oL:()=>getType,oo:()=>arrayBufferToBlobUr,pX:()=>urlToBlob,sM:()=>arrayBufferToBase64,sR:()=>getRes,xC:()=>getProgress,xb:()=>isEmpty,xl:()=>getFilesByDataTransfer});var _allex_md5__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(1129),_allex_md5__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(_allex_md5__WEBPACK_IMPORTED_MODULE_0__),axios__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(3300),axios__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(axios__WEBPACK_IMPORTED_MODULE_1__),js_funcs_trans_trans_file__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(4547),js_funcs_trans_trans_file__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__.n(js_funcs_trans_trans_file__WEBPACK_IMPORTED_MODULE_2__),js_funcs_type_obj__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(2081),_libs_Anima__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(7695),_UtilsImage__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(7179),__awaiter=function(e,t,r,n){return new(r=r||Promise)((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};const anima=(e,t,r,n,i)=>{let o=Object.assign({},e),a=new _libs_Anima__WEBPACK_IMPORTED_MODULE_4__.Q3(o,r,t).eventCallback("onUpdate",(e=>n&&n(o))).eventCallback("onComplete",(e=>{i&&i(),_libs_Anima__WEBPACK_IMPORTED_MODULE_4__.Q3.killTweensOf(a)}));return a},base64ToArrayBuffer=e=>__awaiter(void 0,void 0,void 0,(function*(){-1!==e.indexOf(",")&&(e=getTruthBase64(e));const t=window.atob(e);var r=t.length;const n=new Uint8Array(r);for(let e=0;e<r;e++)n[e]=t.charCodeAt(e);return n.buffer})),getTruthBase64=e=>e.substring(e.indexOf(",")+1),arrayBufferToBlobUr=e=>URL.createObjectURL(new Blob([e])),arrayBufferToBase64=e=>{let t="";var r=new Uint8Array(e);for(let e=0,n=r.byteLength;e<n;e++)t+=String.fromCharCode(r[e]);return"data:image/jpg;base64,"+window.btoa(t)},urlToBlob=e=>__awaiter(void 0,void 0,void 0,(function*(){return(yield axios__WEBPACK_IMPORTED_MODULE_1___default().get(e,{responseType:"blob"})).data})),base64ToBlob=e=>{let t=e.split(","),r=t[0].match(/:(.*?);/)[1],n=atob(t[1]),i=n.length,o=new Uint8Array(i);for(;i--;)o[i]=n.charCodeAt(i);return new Blob([o],{type:r})},fileToBlob=e=>__awaiter(void 0,void 0,void 0,(function*(){return base64ToBlob(yield(0,js_funcs_trans_trans_file__WEBPACK_IMPORTED_MODULE_2__.toResult)(e,"base64"))})),blobToFile=(e,t)=>new File([e],t),getTypeByBase64=e=>e.substring(e.indexOf(":")+1,e.indexOf(";")),transByte=e=>{let t="";const r=t=e<102.4?e.toFixed(2)+"B":e<1048576?(e/1024).toFixed(2)+"KB":e<1073741824?(e/1048576).toFixed(2)+"M":(e/1073741824).toFixed(2)+"G";return e=r.indexOf("."),"00"==r.substr(e+1,2)?r.substring(0,e)+r.substr(e+3,2):t},getMd5=e=>(0,_allex_md5__WEBPACK_IMPORTED_MODULE_0__.md5)(e),fileAndBlobToCanvas=(e,t)=>{var{width:t,height:r}=t;let n=new Image,i=(n.src=e,n.width=t,n.height=r,document.createElement("canvas")),o=(i.width=t,i.height=r,i.getContext("2d"));return new Promise((e=>{n.onload=function(){o.drawImage(n,0,0,i.width,i.height),e({canvas:i,ctx:o})}}))},getFilesByDataTransfer=e=>new Array(e.files.length).fill(0).map(((t,r)=>e.files.item(r))).filter((e=>null!==e)),canvasToBlob=e=>new Promise((t=>{e.toBlob((e=>{t(e)}))})),getRes=(e,t)=>axios__WEBPACK_IMPORTED_MODULE_1___default().get(e,{responseType:t||"arraybuffer"}).then((e=>e.data)).catch((e=>{console.log(e,"加载出错")})),mergeObject=(e,t)=>Object.assign(e,t||{}),getMacro=(e,t=0)=>{let r=setTimeout((()=>(null!==r&&clearTimeout(r),r=null,e())),t)},clone=e=>{if(null===e)return null;if("object"!=typeof e)return e;var t,r,n=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(r=e[t],n[t]=r);return n},getNamesByNum=(e,t,r=1,n)=>new Array(t).fill("").map(((t,i)=>e+(i+r)+(n||""))),getType=e=>e.toString().replace(/(\[object )([a-zA-Z]+)(])/,"$2"),deepMergeObject=(e,t)=>((0,js_funcs_type_obj__WEBPACK_IMPORTED_MODULE_3__.js)(e,((r,n)=>{let i=t[r];void 0!==i&&("Object"===getType(n)&&"Object"===getType(i)&&(i=deepMergeObject(n,i)),e[r]=i)})),e),getArrIndexByItem=(e,t)=>e.find((e=>e===t)),getProgress=(e,t,r=!1)=>{let n=e/t;return r&&(n*=100),Number(n.toFixed(2))},urlToCanvas=e=>__awaiter(void 0,void 0,void 0,(function*(){if(!e)throw TypeError("该参数为空");var t=yield(0,_UtilsImage__WEBPACK_IMPORTED_MODULE_5__.Pk)(e);const r=document.createElement("canvas"),n=(r.width=t.width,r.height=t.height,r.getContext("2d"));return n.drawImage(t,0,0),{img:t,canvas:r,ctx:n}})),bufferToArrayBuffer=e=>{for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n<e.length;++n)r[n]=e[n];return t},isEmpty=e=>null==e||(Array.isArray(e)||"string"==typeof e?0===e.length:"number"==typeof e?0===e:"object"==typeof e?0===Object.keys(e).length:void 0),isBlob=e=>e&&e instanceof Blob,getTime=e=>{const t=new Date;return t.setTime(t.getTime()+864e5*e),t.getTime()},key="gltf-version-2.0",toCode=e=>{for(var t,r,n=key.length,i=key.split(""),o="",a=0;a<e.length;a++)o+=i[((r=((r=e.charCodeAt(a))-(t=r%n))/n)-(r%=n))/n%n]+i[r]+i[t];return o},fromCode=str=>{for(var st=key.length,b,b1,b2,b3,d=0,s,s=new Array(Math.floor(str.length/3)),b=s.length,i=0;i<b;i++)b1=key.indexOf(str.charAt(d)),d++,b2=key.indexOf(str.charAt(d)),d++,b3=key.indexOf(str.charAt(d)),d++,s[i]=b1*st*st+b2*st+b3;return b=eval("String.fromCharCode("+s.join(",")+")"),b},getFilesFromFileList=e=>{const t=[];for(let n=0;n<e.length;n++){var r=e.item(n);t.push(r)}return t},filterFiles=(e,t)=>"any"===t?e:e.filter((e=>-1!==e.type.indexOf(t))),toTimeString=e=>{if(e)return e.getFullYear()+"/"+(e.getMonth()+1)+"/"+e.getDate()},rmPartOfString=(e,t)=>e.replace(new RegExp(t),""),rmArrEle=(e,t)=>{var r=e.findIndex((e=>e===t));if(-1!==r)return e.splice(r,1),r},addElesFromIndexToArr=(e,t,r)=>(t=Array.isArray(t)?t:[t],e.splice(r,0,...t)),sameArr=(e,t,r)=>{if("fill"===r){for(var[n,i]of e)if(n!==t[i])return!1}else{var o=e.length;const n=Math.floor(o/r);for(const i of new Array(r).fill("").map(((e,t)=>(t+1)*n)))if(e[i]!==t[i])return!1}return!0};class LimitCb{constructor(){this.timer=0}update(e){const{cb:t,now:r,cbRate:n}=e;this.timer+=r,this.timer>n&&(t(),this.timer=0)}}const longestCommonPrefix=e=>{if(0==e.length)return"";for(var t=e[0],r="",n=1;n<e.length;n++){for(var i=0;i<=e[n].length;i++){if(t[i]!=e[n][i]){t=r;break}r+=t[i]}r=""}return t},getRandomColor=()=>{let e=[];for(let t=0;t<3;++t){let t=Math.floor(256*Math.random()).toString(16);t=1==t.length?"0"+t:t,e.push(t)}return"#"+e.join("")},validType=(e,t)=>{var r;return"number"===t?(r=Number(e),!isNaN(r)):"array"===t?Array.isArray(e):void 0}},7391:(e,t,r)=>{"use strict";r.d(t,{An:()=>o,FW:()=>a,hz:()=>i,te:()=>n});const n=e=>{},i=e=>"editor"===e.optionsEx.options.mode,o=e=>"running"===e.optionsEx.options.mode,a=e=>e.optionsEx.options},9960:(e,t,r)=>{"use strict";r.d(t,{Zv:()=>ue,F:()=>se,Hg:()=>te,Z7:()=>re,UZ:()=>$,YG:()=>ee,ol:()=>q,A2:()=>de,Gm:()=>he,kG:()=>ae,Sp:()=>Y,SI:()=>le,yT:()=>ce,hX:()=>oe,VU:()=>Q,hs:()=>ie,vp:()=>ne,xr:()=>Z});var n=r(8881);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return(o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=s(e);if(r=t?(r=s(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===i(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var l=new n.Box3,u=new n.Vector3,c=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e);var r=a(i);function i(){var e;if(!(this instanceof i))throw new TypeError("Cannot call a class as a function");return(e=r.call(this)).type="LineSegmentsGeometry",e.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),e.setAttribute("position",new n.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),e.setAttribute("uv",new n.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),e}return t=i,(e=[{key:"applyMatrix4",value:function(e){var t=this.attributes.instanceStart,r=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),r.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"setPositions",value:function(e){var t;return e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e)),e=new n.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceStart",new n.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceEnd",new n.InterleavedBufferAttribute(e,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}},{key:"setColors",value:function(e){var t;return e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e)),e=new n.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceColorStart",new n.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceColorEnd",new n.InterleavedBufferAttribute(e,3,3)),this}},{key:"fromWireframeGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromEdgesGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromMesh",value:function(e){return this.fromWireframeGeometry(new n.WireframeGeometry(e.geometry)),this}},{key:"fromLineSegments",value:function(e){if(!(e=e.geometry).isGeometry)return e.isBufferGeometry&&this.setPositions(e.attributes.position.array),this;console.error("THREE.LineSegmentsGeometry no longer supports Geometry. Use THREE.BufferGeometry instead.")}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new n.Box3);var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),l.setFromBufferAttribute(t),this.boundingBox.union(l))}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new n.Sphere),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){for(var r=this.boundingSphere.center,i=(this.boundingBox.getCenter(r),0),o=0,a=e.count;o<a;o++)u.fromBufferAttribute(e,o),i=Math.max(i,r.distanceToSquared(u)),u.fromBufferAttribute(t,o),i=Math.max(i,r.distanceToSquared(u));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}},{key:"toJSON",value:function(){}},{key:"applyMatrix",value:function(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(n.InstancedBufferGeometry);function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function d(e,t){return(d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}c.prototype.isLineSegmentsGeometry=!0,n.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new n.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},n.ShaderLib.line={uniforms:n.UniformsUtils.merge([n.UniformsLib.common,n.UniformsLib.fog,n.UniformsLib.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// get the offset direction as perpendicular to the view vector\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 offset;\n\t\t\t\tif ( position.y < 0.5 ) {\n\n\t\t\t\t\toffset = normalize( cross( start.xyz, worldDir ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toffset = normalize( cross( end.xyz, worldDir ) );\n\n\t\t\t\t}\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\tfloat forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// extend the line bounds to encompass endcaps\n\t\t\t\t\tstart.xyz += - worldDir * linewidth * 0.5;\n\t\t\t\t\tend.xyz += worldDir * linewidth * 0.5;\n\n\t\t\t\t\t// shift the position of the quad so it hugs the forward edge of the line\n\t\t\t\t\toffset.xy -= dir * forwardOffset;\n\t\t\t\t\toffset.z += 0.5;\n\n\t\t\t\t#endif\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\toffset.xy += dir * 2.0 * forwardOffset;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth * 0.5;\n\n\t\t\t\t// set the world position\n\t\t\t\tworldPos = ( position.y < 0.5 ) ? start : end;\n\t\t\t\tworldPos.xyz += offset;\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"};var m=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=f(e);if(r=t?(r=f(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===h(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return p(n)}}(i);function i(e){var t;if(this instanceof i)return t=r.call(this,{type:"LineMaterial",uniforms:n.UniformsUtils.clone(n.ShaderLib.line.uniforms),vertexShader:n.ShaderLib.line.vertexShader,fragmentShader:n.ShaderLib.line.fragmentShader,clipping:!0}),Object.defineProperties(p(t),{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(e){!0===e?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashed:{enumerable:!0,get:function(){return Boolean("USE_DASH"in this.defines)},set:function(e){Boolean(e)!==Boolean("USE_DASH"in this.defines)&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},alphaToCoverage:{enumerable:!0,get:function(){return Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)},set:function(e){Boolean(e)!==Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),!0===e?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),t.setValues(e),t;throw new TypeError("Cannot call a class as a function")}return t=i,Object.defineProperty(t,"prototype",{writable:!1}),t}(n.ShaderMaterial);function g(e){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function v(e,t){return(v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}m.prototype.isLineMaterial=!0;var b,x,w,A,S=new n.Vector3,B=new n.Vector3,M=new n.Vector4,C=new n.Vector4,E=new n.Vector4,_=new n.Vector3,T=new n.Matrix4,D=new n.Line3,R=new n.Vector3,O=new n.Box3,P=new n.Sphere,I=new n.Vector4;function k(e,t,r){return I.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),I.multiplyScalar(1/I.w),I.x=A/r.width,I.y=A/r.height,I.applyMatrix4(e.projectionMatrixInverse),I.multiplyScalar(1/I.w),Math.abs(Math.max(I.x,I.y))}var L=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&v(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=y(e);if(r=t?(r=y(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===g(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new c,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new m({color:16777215*Math.random()}),n=this,o=i;if(n instanceof o)return(n=r.call(this,e,t)).type="LineSegments2",n;throw new TypeError("Cannot call a class as a function")}return t=i,(e=[{key:"computeLineDistances",value:function(){for(var e=this.geometry,t=e.attributes.instanceStart,r=e.attributes.instanceEnd,i=new Float32Array(2*t.count),o=0,a=0,s=t.count;o<s;o++,a+=2)S.fromBufferAttribute(t,o),B.fromBufferAttribute(r,o),i[a]=0===a?0:i[a-1],i[a+1]=i[a]+S.distanceTo(B);var l=new n.InstancedInterleavedBuffer(i,2,1);return e.setAttribute("instanceDistanceStart",new n.InterleavedBufferAttribute(l,1,0)),e.setAttribute("instanceDistanceEnd",new n.InterleavedBufferAttribute(l,1,1)),this}},{key:"raycast",value:function(e,t){var r=this.material.worldUnits,i=e.camera,o=(null!==i||r||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),void 0!==e.params.Line2&&e.params.Line2.threshold||0),a=(b=e.ray,e=this.matrixWorld,this.geometry),s=this.material;if(A=s.linewidth+o,x=a.attributes.instanceStart,w=a.attributes.instanceEnd,null===a.boundingSphere&&a.computeBoundingSphere(),P.copy(a.boundingSphere).applyMatrix4(e),o=r?.5*A:k(i,Math.max(i.near,P.distanceToPoint(b.origin)),s.resolution),P.radius+=o,!1!==b.intersectsSphere(P)&&(null===a.boundingBox&&a.computeBoundingBox(),O.copy(a.boundingBox).applyMatrix4(e),o=r?.5*A:k(i,Math.max(i.near,O.distanceToPoint(b.origin)),s.resolution),O.expandByScalar(o),!1!==b.intersectsBox(O)))if(r)for(var l=t,u=0,c=x.count;u<c;u++){D.start.fromBufferAttribute(x,u),D.end.fromBufferAttribute(w,u);var h=new n.Vector3,d=new n.Vector3;b.distanceSqToSegment(D.start,D.end,d,h),d.distanceTo(h)<.5*A&&l.push({point:d,pointOnLine:h,distance:b.origin.distanceTo(d),object:this,face:null,faceIndex:u,uv:null,uv2:null})}else{var p=this,f=t,m=(a=i).projectionMatrix,g=p.material.resolution,v=p.matrixWorld,y=(e=p.geometry).attributes.instanceStart,S=e.attributes.instanceEnd,B=-a.near;b.at(1,E),E.w=1,E.applyMatrix4(a.matrixWorldInverse),E.applyMatrix4(m),E.multiplyScalar(1/E.w),E.x*=g.x/2,E.y*=g.y/2,E.z=0,_.copy(E),T.multiplyMatrices(a.matrixWorldInverse,v);for(var I,L,F,U,G=0,j=y.count;G<j;G++)M.fromBufferAttribute(y,G),C.fromBufferAttribute(S,G),M.w=1,C.w=1,M.applyMatrix4(T),C.applyMatrix4(T),M.z>B&&C.z>B||(M.z>B?(I=M.z-C.z,I=(M.z-B)/I,M.lerp(C,I)):C.z>B&&(I=C.z-M.z,L=(C.z-B)/I,C.lerp(M,L)),M.applyMatrix4(m),C.applyMatrix4(m),M.multiplyScalar(1/M.w),C.multiplyScalar(1/C.w),M.x*=g.x/2,M.y*=g.y/2,C.x*=g.x/2,C.y*=g.y/2,D.start.copy(M),D.start.z=0,D.end.copy(C),D.end.z=0,L=D.closestPointToPointParameter(_,!0),D.at(L,R),F=-1<=(F=n.MathUtils.lerp(M.z,C.z,L))&&F<=1,U=_.distanceTo(R)<.5*A,F&&U&&(D.start.fromBufferAttribute(y,G),D.end.fromBufferAttribute(S,G),D.start.applyMatrix4(v),D.end.applyMatrix4(v),F=new n.Vector3,U=new n.Vector3,b.distanceSqToSegment(D.start,D.end,U,F),f.push({point:U,pointOnLine:F,distance:b.origin.distanceTo(U),object:p,face:null,faceIndex:G,uv:null,uv2:null})))}}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(n.Mesh);function F(e){return(F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function U(){return(U="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=j(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function G(e,t){return(G=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}L.prototype.isLineSegments2=!0;var H=function(){var e=n,t=c;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&G(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=j(e);if(r=t?(r=j(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===F(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){var e;if(this instanceof n)return(e=r.call(this)).type="LineGeometry",e;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"setPositions",value:function(e){for(var t=e.length-3,r=new Float32Array(2*t),i=0;i<t;i+=3)r[2*i]=e[i],r[2*i+1]=e[i+1],r[2*i+2]=e[i+2],r[2*i+3]=e[i+3],r[2*i+4]=e[i+4],r[2*i+5]=e[i+5];return U(j(n.prototype),"setPositions",this).call(this,r),this}},{key:"setColors",value:function(e){for(var t=e.length-3,r=new Float32Array(2*t),i=0;i<t;i+=3)r[2*i]=e[i],r[2*i+1]=e[i+1],r[2*i+2]=e[i+2],r[2*i+3]=e[i+3],r[2*i+4]=e[i+4],r[2*i+5]=e[i+5];return U(j(n.prototype),"setColors",this).call(this,r),this}},{key:"fromLine",value:function(e){if(!(e=e.geometry).isGeometry)return e.isBufferGeometry&&this.setPositions(e.attributes.position.array),this;console.error("THREE.LineGeometry no longer supports Geometry. Use THREE.BufferGeometry instead.")}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();function N(e){return(N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function z(e,t){return(z=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function V(e){return(V=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}H.prototype.isLineGeometry=!0;var J=function(){var e=n,t=L;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&z(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=V(e);if(r=t?(r=V(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===N(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new H,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new m({color:16777215*Math.random()}),i=this,o=n;if(i instanceof o)return(i=r.call(this,e,t)).type="Line2",i;throw new TypeError("Cannot call a class as a function")}return e=n,Object.defineProperty(e,"prototype",{writable:!1}),e}(),K=(J.prototype.isLine2=!0,r(2430)),W=r(8235),X=r(6999);const Q=(e,t)=>(t.updateMatrixWorld(!0),t=new X.Z.Vector3,e.getWorldPosition(t),t),Z={parse(e){var{x:e,y:t,z:r}=e;return void 0===r?new n.Vector2(e,t):new n.Vector3(e,t,r)},toJSON(e){var{x:e,y:t,z:r}=e;return null==r?{x:e,y:t}:{x:e,y:t,z:r}}},Y=(e,t)=>e.distanceTo(t),q=e=>new W.cp(e),$=e=>new K.j(e),ee=e=>new W.P7(e),te=(e,t=.5,r=!1)=>{if("Group"===e.type)throw TypeError("该模型为Group类型");if(!e.material)throw TypeError("该模型没有材质");if(void 0===e.material.oldOpc&&(e.material.oldOpc=e.material.opacity,e.material.oldTransparent=e.material.transparent),r)return e.material.opacity=e.material.oldOpc,void(e.material.transparent=e.material.oldTransparent);1===t?(e.material.transparent=!1,e.material.opacity=1):(e.material.transparent=!0,e.material.opacity=t)},re=(e,t,r)=>{"Group"===e.type||"Object3D"===e.type?e.children.forEach((e=>re(e,t,r))):te(e,t,r)},ne=e=>(e.mapping=n.EquirectangularReflectionMapping,e),ie=e=>{let t=e=>"Group"!==e.type&&"Object3D"!==e.type||1!==e.children.length?e:t(e.children[0]);return t(e)},oe=(e,t)=>{let r=document.createElement("video");return r.style="position:absolute;top:0;left:0;z-index:1000000;",r.src=e,r.loop="loop",r.muted="muted",r.play(),t.appendChild(r),new n.VideoTexture(r)},ae=(e,t=!1)=>{let r=new n.CatmullRomCurve3(e),i=new n.BufferGeometry;e=r.getSpacedPoints(100),i.setFromPoints(e),e=new n.LineBasicMaterial({color:26214});let o=new n.Line(i,e);return o.visible=t,{line:o,curve:r}},se=e=>{let t=0;const r=[],i={},o={0:"x",1:"y",2:"z"};return e.map((e=>{var a,s,l;3===t&&(t=0,({x:a,y:s,z:l}=i),r.push(new n.Vector3(a,s,l))),i[o[t]]=e,t++})),r},le=e=>{var{pointArray:e,material:t,lineWidth:r,colorArray:i}=e;const o=new H,a=(o.setPositions(e),t||new m({transparent:!0,side:n.DoubleSide,linewidth:r||5,vertexColors:!0})),s=(o.setColors(i||[1,1,1]),a.resolution.set(window.innerWidth,window.innerHeight),new J(o,a));return s.name="gw",s.computeLineDistances(),s},ue=e=>3.1415926*e/180,ce=(e,t="name",r)=>{const n={};return e.traverse((e=>{"id"===t?n[e.userData.id]=e:n[e[t]]=e,null!=r&&r(e)})),n},he=(e,t,r,n,i,o)=>({cx:e,cy:t,cz:r,tx:n,ty:i,tz:o}),de=(e,t)=>{var{x:e,y:r,z:n}=e,{x:t,y:i,z:o}=t;return{x:e-t,y:r-i,z:n-o}}},1129:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__1129__},3300:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__3300__},6001:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__6001__},4356:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__4356__},8881:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__8881__},7937:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__7937__},8512:(e,t,r)=>{"use strict";r.d(t,{T:()=>c,w:()=>s});var n=r(8881);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function a(e,t,r){t&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var s=function(){function e(){i(this,e),this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}return a(e,[{key:"setSize",value:function(){}},{key:"render",value:function(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}}]),e}(),l=new n.OrthographicCamera(-1,1,1,-1,0,1),u=new n.BufferGeometry,c=(u.setAttribute("position",new n.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),u.setAttribute("uv",new n.Float32BufferAttribute([0,2,0,0,2,0],2)),function(){function e(t){i(this,e),this._mesh=new n.Mesh(u,t)}return a(e,[{key:"dispose",value:function(){this._mesh.geometry.dispose()}},{key:"render",value:function(e){e.render(this._mesh,l)}},{key:"material",get:function(){return this._mesh.material},set:function(e){this._mesh.material=e}}]),e}())},8493:(e,t,r)=>{"use strict";r.d(t,{T:()=>u});var n=r(8881),i=r(8512);function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function s(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===o(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=function(e){var t=o;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e);var r=s(o);function o(e,t){var a;if(this instanceof o)return(a=r.call(this)).textureID=void 0!==t?t:"tDiffuse",e instanceof n.ShaderMaterial?(a.uniforms=e.uniforms,a.material=e):e&&(a.uniforms=n.UniformsUtils.clone(e.uniforms),a.material=new n.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:a.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),a.fsQuad=new i.T(a.material),a;throw new TypeError("Cannot call a class as a function")}return t=o,(e=[{key:"render",value:function(e,t,r){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=r.texture),this.fsQuad.material=this.material,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)),this.fsQuad.render(e)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),o}(i.w)},2430:(e,t,r)=>{"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function a(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(){return(s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=u(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function l(e,t){return(l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}r.d(t,{M:()=>g,j:()=>c});var c=function(e){var t=o;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,i=u(e);if(r=t?(r=u(this).constructor,Reflect.construct(i,arguments,r)):i.apply(this,arguments),i=this,r&&("object"===n(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==i)return i;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(o);function o(){var e,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return i(this,o),(e=r.call(this)).element=t,e.element.style.position="absolute",e.element.style.userSelect="none",e.element.setAttribute("draggable",!1),e.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),e}return a(o,[{key:"copy",value:function(e,t){return s(u(o.prototype),"copy",this).call(this,e,t),this.element=e.element.cloneNode(!0),this}}]),o}((t=r(8881)).Object3D),h=(c.prototype.isCSS2DObject=!0,new t.Vector3),d=new t.Matrix4,p=new t.Matrix4,f=new t.Vector3,m=new t.Vector3,g=a((function e(){var t,r,n,o,a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},s=(i(this,e),this),l={objects:new WeakMap},u=void 0!==a.element?a.element:document.createElement("div");function c(e,t){return f.setFromMatrixPosition(e.matrixWorld),m.setFromMatrixPosition(t.matrixWorld),f.distanceToSquared(m)}u.style.overflow="hidden",this.domElement=u,this.getSize=function(){return{width:t,height:r}},this.render=function(e,t){!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),d.copy(t.matrixWorldInverse),p.multiplyMatrices(t.projectionMatrix,d),function e(t,r,i){var a;t.isCSS2DObject&&(h.setFromMatrixPosition(t.matrixWorld),h.applyMatrix4(p),a=!0===t.visible&&-1<=h.z&&h.z<=1&&!0===t.layers.test(i.layers),t.element.style.display=1==a?"":"none",1==a&&(t.onBeforeRender(s,r,i),a=t.element,/apple/i.test(navigator.vendor)?a.style.transform="translate(-50%,-50%) translate("+Math.round(h.x*n+n)+"px,"+Math.round(-h.y*o+o)+"px)":a.style.transform="translate(-50%,-50%) translate("+(h.x*n+n)+"px,"+(-h.y*o+o)+"px)",a.parentNode!==u&&u.appendChild(a),t.onAfterRender(s,r,i)),a={distanceToCameraSquared:c(i,t)},l.objects.set(t,a));for(var d=0,f=t.children.length;d<f;d++)e(t.children[d],r,i)}(e,e,t);for(var r=function(e){var t=[];return e.traverse((function(e){e.isCSS2DObject&&t.push(e)})),t}(e).sort((function(e,t){return e.renderOrder!==t.renderOrder?t.renderOrder-e.renderOrder:l.objects.get(e).distanceToCameraSquared-l.objects.get(t).distanceToCameraSquared})),i=r.length,a=0,f=r.length;a<f;a++)r[a].element.style.zIndex=i-a},this.setSize=function(e,i){n=(t=e)/2,o=(r=i)/2,u.style.width=e+"px",u.style.height=i+"px"}}))},8235:(e,t,r)=>{"use strict";r.d(t,{P7:()=>v,cp:()=>g,lX:()=>x});var n=r(8881);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(){return(l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}function c(e,t){return(c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=d(e);if(r=t?(r=d(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===i(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var p=new n.Vector3,f=new n.Quaternion,m=new n.Vector3,g=function(){u(t,n.Object3D);var e=h(t);function t(){var r,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return o(this,t),(r=e.call(this)).element=n,r.element.style.position="absolute",r.element.style.pointerEvents="auto",r.element.style.userSelect="none",r.element.setAttribute("draggable",!1),r.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),r}return s(t,[{key:"copy",value:function(e,r){return l(d(t.prototype),"copy",this).call(this,e,r),this.element=e.element.cloneNode(!0),this}}]),t}(),v=(g.prototype.isCSS3DObject=!0,function(){u(t,g);var e=h(t);function t(r){return o(this,t),(r=e.call(this,r)).rotation2D=0,r}return s(t,[{key:"copy",value:function(e,r){return l(d(t.prototype),"copy",this).call(this,e,r),this.rotation2D=e.rotation2D,this}}]),t}()),y=(v.prototype.isCSS3DSprite=!0,new n.Matrix4),b=new n.Matrix4,x=s((function e(){var t,r,n,i,a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},s=(o(this,e),this),l={camera:{fov:0,style:""},objects:new WeakMap},u=void 0!==a.element?a.element:document.createElement("div"),c=(u.style.overflow="hidden",this.domElement=u,document.createElement("div"));function h(e){return Math.abs(e)<1e-10?0:e}function d(e){return"matrix3d("+h((e=e.elements)[0])+","+h(-e[1])+","+h(e[2])+","+h(e[3])+","+h(e[4])+","+h(-e[5])+","+h(e[6])+","+h(e[7])+","+h(e[8])+","+h(-e[9])+","+h(e[10])+","+h(e[11])+","+h(e[12])+","+h(-e[13])+","+h(e[14])+","+h(e[15])+")"}function g(e){return"translate(-50%,-50%)matrix3d("+h((e=e.elements)[0])+","+h(e[1])+","+h(e[2])+","+h(e[3])+","+h(-e[4])+","+h(-e[5])+","+h(-e[6])+","+h(-e[7])+","+h(e[8])+","+h(e[9])+","+h(e[10])+","+h(e[11])+","+h(e[12])+","+h(e[13])+","+h(e[14])+","+h(e[15])+")"}c.style.transformStyle="preserve-3d",c.style.pointerEvents="none",u.appendChild(c),this.getSize=function(){return{width:t,height:r}},this.render=function(e,t){var r=t.projectionMatrix.elements[5]*i,o=(l.camera.fov!==r&&(u.style.perspective=t.isPerspectiveCamera?r+"px":"",l.camera.fov=r),!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),t.isOrthographicCamera&&(o=-(t.right+t.left)/2,a=(t.top+t.bottom)/2),t.isOrthographicCamera?"scale("+r+")translate("+h(o)+"px,"+h(a)+"px)"+d(t.matrixWorldInverse):"translateZ("+r+"px)"+d(t.matrixWorldInverse)),a=o+"translate("+n+"px,"+i+"px)";l.camera.style!==a&&(c.style.transform=a,l.camera.style=a),function e(t,r,n,i){var o,a,u;t.isCSS3DObject&&(o=!0===t.visible&&!0===t.layers.test(n.layers),t.element.style.display=1==o?"":"none",1==o&&(t.onBeforeRender(s,r,n),o=t.isCSS3DSprite?(y.copy(n.matrixWorldInverse),y.transpose(),0!==t.rotation2D&&y.multiply(b.makeRotationZ(t.rotation2D)),t.matrixWorld.decompose(p,f,m),y.setPosition(p),y.scale(m),y.elements[3]=0,y.elements[7]=0,y.elements[11]=0,y.elements[15]=1,g(y)):g(t.matrixWorld),a=t.element,void 0!==(u=l.objects.get(t))&&u.style===o||(u={style:a.style.transform=o},l.objects.set(t,u)),a.parentNode!==c&&c.appendChild(a),t.onAfterRender(s,r,n)));for(var h=0,d=t.children.length;h<d;h++)e(t.children[h],r,n,i)}(e,e,t,o)},this.setSize=function(e,o){n=(t=e)/2,i=(r=o)/2,u.style.width=e+"px",u.style.height=o+"px",c.style.width=e+"px",c.style.height=o+"px"}}))},8409:(e,t,r)=>{"use strict";r.d(t,{qf:()=>function(e){for(var t,r,o=1<arguments.length&&void 0!==arguments[1]&&arguments[1],a=null!==e[0].index,s=new Set(Object.keys(e[0].attributes)),l=new Set(Object.keys(e[0].morphAttributes)),u={},c={},h=e[0].morphTargetsRelative,d=new n.BufferGeometry,p=0,f=0;f<e.length;++f){var m,g,v=e[f],y=0;if(a!=(null!==v.index))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(m in v.attributes){if(!s.has(m))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+'. All geometries must have compatible attributes; make sure "'+m+'" attribute exists among all geometries, or in none of them.'),null;void 0===u[m]&&(u[m]=[]),u[m].push(v.attributes[m]),y++}if(y!==s.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". Make sure all geometries have the same number of attributes."),null;if(h!==v.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(g in v.morphAttributes){if(!l.has(g))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". .morphAttributes must be consistent throughout all geometries."),null;void 0===c[g]&&(c[g]=[]),c[g].push(v.morphAttributes[g])}if(d.userData.mergedUserData=d.userData.mergedUserData||[],d.userData.mergedUserData.push(v.userData),o){var b=void 0;if(a)b=v.index.count;else{if(void 0===v.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". The geometry must have either an index or a position attribute"),null;b=v.attributes.position.count}d.addGroup(p,b,f),p+=b}}if(a){for(var x=0,w=[],A=0;A<e.length;++A){for(var S=e[A].index,B=0;B<S.count;++B)w.push(S.getX(B)+x);x+=e[A].attributes.position.count}d.setIndex(w)}for(t in u){var M=i(u[t]);if(!M)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+t+" attribute."),null;d.setAttribute(t,M)}for(r in c){var C=c[r][0].length;if(0===C)break;d.morphAttributes=d.morphAttributes||{},d.morphAttributes[r]=[];for(var E=0;E<C;++E){for(var _=[],T=0;T<c[r].length;++T)_.push(c[r][T][E]);var D=i(_);if(!D)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+r+" morphAttribute."),null;d.morphAttributes[r].push(D)}}return d}});var n=r(8881);function i(e){for(var t,r,i,o=0,a=0;a<e.length;++a){var s=e[a];if(s.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if((t=void 0===t?s.array.constructor:t)!==s.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if((r=void 0===r?s.itemSize:r)!==s.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if((i=void 0===i?s.normalized:i)!==s.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;o+=s.array.length}for(var l=new t(o),u=0,c=0;c<e.length;++c)l.set(e[c].array,u),u+=e[c].array.length;return new n.BufferAttribute(l,r,i)}}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];return void 0!==t||(t=__webpack_module_cache__[e]={exports:{}},__webpack_modules__[e].call(t.exports,t,t.exports,__webpack_require__)),t.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};return(()=>{"use strict";__webpack_require__.d(__webpack_exports__,{default:()=>Js});var e={},t=(__webpack_require__.r(e),__webpack_require__.d(e,{AsyncCompress:()=>Lo,AsyncDecompress:()=>Yo,AsyncDeflate:()=>_o,AsyncGunzip:()=>jo,AsyncGzip:()=>Lo,AsyncInflate:()=>Oo,AsyncUnzipInflate:()=>xa,AsyncUnzlib:()=>Wo,AsyncZipDeflate:()=>ga,AsyncZlib:()=>Vo,Compress:()=>ko,DecodeUTF8:()=>na,Decompress:()=>Zo,Deflate:()=>Eo,EncodeUTF8:()=>ia,Gunzip:()=>Go,Gzip:()=>ko,Inflate:()=>Ro,Unzip:()=>wa,UnzipInflate:()=>ba,UnzipPassThrough:()=>ya,Unzlib:()=>Ko,Zip:()=>va,ZipDeflate:()=>ma,ZipPassThrough:()=>fa,Zlib:()=>zo,compress:()=>Fo,compressSync:()=>Uo,decompress:()=>function(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return(31==e[0]&&139==e[1]&&8==e[2]?Ho:8!=(15&e[0])||7<e[0]>>4||(e[0]<<8|e[1])%31?Po:Xo)(e,t,r)},decompressSync:()=>function(e,t){return(31==e[0]&&139==e[1]&&8==e[2]?No:8!=(15&e[0])||7<e[0]>>4||(e[0]<<8|e[1])%31?Io:Qo)(e,t)},deflate:()=>To,deflateSync:()=>Do,gunzip:()=>Ho,gunzipSync:()=>No,gzip:()=>Fo,gzipSync:()=>Uo,inflate:()=>Po,inflateSync:()=>Io,strFromU8:()=>aa,strToU8:()=>oa,unzip:()=>function(e,t){if("function"!=typeof t)throw"no callback";for(var r=[],n=function(){for(var e=0;e<r.length;++e)r[e]()},i={},o=e.length-22;101010256!=yo(e,o);--o)if(!o||65558<e.length-o)return void t("invalid zip file",null);var a=vo(e,o+8);a||t(null,{});var s=a,l=yo(e,o+16),u=4294967295==l;if(u){if(o=yo(e,o-12),101075792!=yo(e,o))return void t("invalid zip file",null);s=a=yo(e,o+32),l=yo(e,o+48)}for(var c=function(o){function s(e,r){e?(n(),t(e,null)):(i[p]=r,--a||t(null,i))}var c=(m=ua(e,l,u))[0],h=m[1],d=m[2],p=m[3],f=m[4],m=m[5];if(m=la(e,m),l=f,c)if(8==c)if(f=e.subarray(m,m+h),h<32e4)try{s(null,Io(f,new pi(d)))}catch(o){s(o,null)}else r.push(Po(f,{size:d},s));else s("unknown compression type "+c,null);else s(null,ji(e,m,m+h))},h=0;h<s;++h)c();return n},unzipSync:()=>function(e){for(var t={},r=e.length-22;101010256!=yo(e,r);--r)if(!r||65558<e.length-r)throw"invalid zip file";var n=vo(e,r+8);if(!n)return{};var i=yo(e,r+16),o=4294967295==i;if(o){if(r=yo(e,r-12),101075792!=yo(e,r))throw"invalid zip file";n=yo(e,r+32),i=yo(e,r+48)}for(var a=0;a<n;++a){var s=(d=ua(e,i,o))[0],l=d[1],u=d[2],c=d[3],h=d[4],d=d[5];if(d=la(e,d),i=h,s){if(8!=s)throw"unknown compression type "+s;t[c]=Io(e.subarray(d,d+l),new pi(u))}else t[c]=ji(e,d,d+l)}return t},unzlib:()=>Xo,unzlibSync:()=>Qo,zip:()=>function(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";function n(){for(var e=0;e<d.length;++e)d[e]()}function i(){for(var e=new pi(u+22),t=l,n=u-l,i=u=0;i<c;++i){var o=h[i];try{var a=o.c.length,s=(da(e,u,o,o.f,o.u,a),30+o.f.length+ha(o.extra)),d=u+s;e.set(o.c,d),da(e,l,o,o.f,o.u,a,u,o.m),l+=16+s+(o.m?o.m.length:0),u=d+a}catch(e){return r(e,null)}}pa(e,l,h.length,n,t),r(null,e)}var o={},a=(qo(e,"",o,t),Object.keys(o)),s=a.length,l=0,u=0,c=s,h=new Array(s),d=[];s||i();for(var p=function(e){function t(t,o){t?(n(),r(t,null)):(t=o.length,h[e]=no(m,{size:v,crc:g.d(),c:o,f:y,m:w,u:b!=c.length||w&&x.length!=A,compression:B}),l+=30+b+S+t,u+=76+2*(b+S)+(A||0)+t,--s||i())}var c=a[e],p=o[c],f=p[0],m=p[1],g=eo(),v=f.length,y=(g.p(f),oa(c)),b=y.length,x=m.comment,w=x&&oa(x),A=w&&w.length,S=ha(m.extra),B=0==m.level?0:8;if(65535<b&&t("filename too long",null),B)if(v<16e4)try{t(null,Do(f,m))}catch(p){t(p,null)}else d.push(To(f,m,t));else t(null,f)},f=0;f<c;++f)p(f);return n},zipSync:()=>function(e,t){var r,n={},i=[],o=(qo(e,"",n,t=t||{}),0),a=0;for(r in n){var s,l=(s=n[r])[0],u=0==(s=s[1]).level?0:8,c=(x=oa(r)).length,h=s.comment,d=h&&oa(h),p=d&&d.length,f=ha(s.extra);if(65535<c)throw"filename too long";var m=u?Do(l,s):l,g=m.length,v=eo();v.p(l),i.push(no(s,{size:l.length,crc:v.d(),c:m,f:x,m:d,u:c!=r.length||d&&h.length!=p,o,compression:u})),o+=30+c+f+g,a+=76+2*(c+f)+(p||0)+g}for(var y=new pi(a+22),b=(e=o,t=a-o,0);b<i.length;++b){var x=i[b],w=(da(y,x.o,x,x.f,x.u,x.c.length),30+x.f.length+ha(x.extra));y.set(x.c,x.o+w),da(y,o,x,x.f,x.u,x.c.length,x.o,x.m),o+=16+w+(x.m?x.m.length:0)}return pa(y,o,i.length,t,e),y},zlib:()=>function(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return go(e,t,[lo,ho,function(){return[Jo]}],(function(e){return fo(Jo(e.data[0],e.data[1]))}),4,r)},zlibSync:()=>Jo}),{}),r=(__webpack_require__.r(t),__webpack_require__.d(t,{FBXLoader:()=>Ga}),__webpack_require__(8881));function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function a(e,t,r){t&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function s(){return(s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}function u(e,t){return(u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,i=d(e);if(r=t?(r=d(this).constructor,Reflect.construct(i,arguments,r)):i.apply(this,arguments),i=this,r&&("object"===n(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return h(i)}}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var p=new r.Raycaster,f=new r.Vector3,m=new r.Vector3,g=new r.Quaternion,v={X:new r.Vector3(1,0,0),Y:new r.Vector3(0,1,0),Z:new r.Vector3(0,0,1)},y={type:"change"},b={type:"mouseDown"},x={type:"mouseUp",mode:null},w={type:"objectChange"},A=function(){l(t,r.Object3D);var e=c(t);function t(n,o){i(this,t),a=e.call(this),void 0===o&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),o=document),a.visible=!1,a.domElement=o,a.domElement.style.touchAction="none";var a,s=new U,l=(a._gizmo=s,a.add(s),new G),u=(a._plane=l,a.add(l),h(a));function c(e,t){var r=t;Object.defineProperty(u,e,{get:function(){return void 0!==r?r:t},set:function(t){r!==t&&(r=t,l[e]=t,s[e]=t,u.dispatchEvent({type:e+"-changed",value:t}),u.dispatchEvent(y))}}),u[e]=t,l[e]=t,s[e]=t}c("camera",n),c("object",void 0),c("enabled",!0),c("axis",null),c("mode","translate"),c("translationSnap",null),c("rotationSnap",null),c("scaleSnap",null),c("space","world"),c("size",1),c("dragging",!1),c("showX",!0),c("showY",!0),c("showZ",!0),o=new r.Vector3,n=new r.Vector3;var d=new r.Quaternion,p=new r.Quaternion,f=new r.Vector3,m=new r.Quaternion,g=new r.Vector3,v=new r.Vector3,b=new r.Vector3,x=new r.Vector3;return c("worldPosition",o),c("worldPositionStart",n),c("worldQuaternion",d),c("worldQuaternionStart",p),c("cameraPosition",f),c("cameraQuaternion",m),c("pointStart",g),c("pointEnd",v),c("rotationAxis",b),c("rotationAngle",0),c("eye",x),a._offset=new r.Vector3,a._startNorm=new r.Vector3,a._endNorm=new r.Vector3,a._cameraScale=new r.Vector3,a._parentPosition=new r.Vector3,a._parentQuaternion=new r.Quaternion,a._parentQuaternionInv=new r.Quaternion,a._parentScale=new r.Vector3,a._worldScaleStart=new r.Vector3,a._worldQuaternionInv=new r.Quaternion,a._worldScale=new r.Vector3,a._positionStart=new r.Vector3,a._quaternionStart=new r.Quaternion,a._scaleStart=new r.Vector3,a._getPointer=function(e){var t;return this.domElement.ownerDocument.pointerLockElement?{x:0,y:0,button:e.button}:(t=this.domElement.getBoundingClientRect(),{x:(e.clientX-t.left)/t.width*2-1,y:-(e.clientY-t.top)/t.height*2+1,button:e.button})}.bind(h(a)),a._onPointerDown=function(e){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(e.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(e)),this.pointerDown(this._getPointer(e)))}.bind(h(a)),a._onPointerHover=function(e){if(this.enabled)switch(e.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(e))}}.bind(h(a)),a._onPointerMove=function(e){this.enabled&&this.pointerMove(this._getPointer(e))}.bind(h(a)),a._onPointerUp=function(e){this.enabled&&(this.domElement.releasePointerCapture(e.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(e)))}.bind(h(a)),a.domElement.addEventListener("pointerdown",a._onPointerDown),a.domElement.addEventListener("pointermove",a._onPointerHover),a.domElement.addEventListener("pointerup",a._onPointerUp),a}return a(t,[{key:"updateMatrixWorld",value:function(){void 0!==this.object&&(this.object.updateMatrixWorld(),null===this.object.parent?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),s(d(t.prototype),"updateMatrixWorld",this).call(this,this)}},{key:"pointerHover",value:function(e){void 0!==this.object&&!0!==this.dragging&&(p.setFromCamera(e,this.camera),e=S(this._gizmo.picker[this.mode],p),this.axis=e?e.object.name:null)}},{key:"pointerDown",value:function(e){void 0!==this.object&&!0!==this.dragging&&0===e.button&&null!==this.axis&&(p.setFromCamera(e,this.camera),(e=S(this._plane,p,!0))&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(e.point).sub(this.worldPositionStart)),this.dragging=!0,b.mode=this.mode,this.dispatchEvent(b))}},{key:"pointerMove",value:function(e){var t=this.axis,r=this.mode,n=this.object,i=this.space;"scale"===r?i="local":"E"!==t&&"XYZE"!==t&&"XYZ"!==t||(i="world"),void 0!==n&&null!==t&&!1!==this.dragging&&-1===e.button&&(p.setFromCamera(e,this.camera),(e=S(this._plane,p,!0))&&(this.pointEnd.copy(e.point).sub(this.worldPositionStart),"translate"===r?(this._offset.copy(this.pointEnd).sub(this.pointStart),"local"===i&&"XYZ"!==t&&this._offset.applyQuaternion(this._worldQuaternionInv),-1===t.indexOf("X")&&(this._offset.x=0),-1===t.indexOf("Y")&&(this._offset.y=0),-1===t.indexOf("Z")&&(this._offset.z=0),("local"===i&&"XYZ"!==t?this._offset.applyQuaternion(this._quaternionStart):this._offset.applyQuaternion(this._parentQuaternionInv)).divide(this._parentScale),n.position.copy(this._offset).add(this._positionStart),this.translationSnap&&("local"===i&&(n.position.applyQuaternion(g.copy(this._quaternionStart).invert()),-1!==t.search("X")&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.position.applyQuaternion(this._quaternionStart)),"world"===i&&(n.parent&&n.position.add(f.setFromMatrixPosition(n.parent.matrixWorld)),-1!==t.search("X")&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.parent&&n.position.sub(f.setFromMatrixPosition(n.parent.matrixWorld))))):"scale"===r?(-1!==t.search("XYZ")?(e=this.pointEnd.length()/this.pointStart.length(),this.pointEnd.dot(this.pointStart)<0&&(e*=-1),m.set(e,e,e)):(f.copy(this.pointStart),m.copy(this.pointEnd),f.applyQuaternion(this._worldQuaternionInv),m.applyQuaternion(this._worldQuaternionInv),m.divide(f),-1===t.search("X")&&(m.x=1),-1===t.search("Y")&&(m.y=1),-1===t.search("Z")&&(m.z=1)),n.scale.copy(this._scaleStart).multiply(m),this.scaleSnap&&(-1!==t.search("X")&&(n.scale.x=Math.round(n.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Y")&&(n.scale.y=Math.round(n.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Z")&&(n.scale.z=Math.round(n.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))):"rotate"===r&&(this._offset.copy(this.pointEnd).sub(this.pointStart),e=20/this.worldPosition.distanceTo(f.setFromMatrixPosition(this.camera.matrixWorld)),"E"===t?(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1):"XYZE"===t?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(f.copy(this.rotationAxis).cross(this.eye))*e):"X"!==t&&"Y"!==t&&"Z"!==t||(this.rotationAxis.copy(v[t]),f.copy(v[t]),"local"===i&&f.applyQuaternion(this.worldQuaternion),this.rotationAngle=this._offset.dot(f.cross(this.eye).normalize())*e),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),"local"===i&&"E"!==t&&"XYZE"!==t?(n.quaternion.copy(this._quaternionStart),n.quaternion.multiply(g.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),n.quaternion.copy(g.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),n.quaternion.multiply(this._quaternionStart).normalize())),this.dispatchEvent(y),this.dispatchEvent(w)))}},{key:"pointerUp",value:function(e){0===e.button&&(this.dragging&&null!==this.axis&&(x.mode=this.mode,this.dispatchEvent(x)),this.dragging=!1,this.axis=null)}},{key:"dispose",value:function(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse((function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()}))}},{key:"attach",value:function(e){return this.object=e,this.visible=!0,this}},{key:"detach",value:function(){return this.object=void 0,this.visible=!1,this.axis=null,this}},{key:"reset",value:function(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(y),this.dispatchEvent(w),this.pointStart.copy(this.pointEnd))}},{key:"getRaycaster",value:function(){return p}},{key:"getMode",value:function(){return this.mode}},{key:"setMode",value:function(e){this.mode=e}},{key:"setTranslationSnap",value:function(e){this.translationSnap=e}},{key:"setRotationSnap",value:function(e){this.rotationSnap=e}},{key:"setScaleSnap",value:function(e){this.scaleSnap=e}},{key:"setSize",value:function(e){this.size=e}},{key:"setSpace",value:function(e){this.space=e}},{key:"update",value:function(){console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.")}}]),t}();function S(e,t,r){for(var n=t.intersectObject(e,!0),i=0;i<n.length;i++)if(n[i].object.visible||r)return n[i];return!1}A.prototype.isTransformControls=!0;var B=new r.Euler,M=new r.Vector3(0,1,0),C=new r.Vector3(0,0,0),E=new r.Matrix4,_=new r.Quaternion,T=new r.Quaternion,D=new r.Vector3,R=new r.Matrix4,O=new r.Vector3(1,0,0),P=new r.Vector3(0,1,0),I=new r.Vector3(0,0,1),k=new r.Vector3,L=new r.Vector3,F=new r.Vector3,U=function(){l(t,r.Object3D);var e=c(t);function t(){i(this,t),(n=e.call(this)).type="TransformControlsGizmo";var n,o=new r.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),a=new r.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),s=o.clone(),l=((((s.opacity=.15,a=a.clone()).opacity=.5,w=o.clone()).color.setHex(16711680),A=o.clone()).color.setHex(65280),o.clone()),u=(l.color.setHex(255),o.clone()),c=(u.color.setHex(16711680),u.opacity=.5,o.clone()),h=(c.color.setHex(65280),c.opacity=.5,o.clone()),d=(h.color.setHex(255),h.opacity=.5,o.clone());(d.opacity=.25,b=o.clone()).color.setHex(16776960),b.opacity=.25,o.clone().color.setHex(16776960);var p=(((o=o.clone()).color.setHex(7895160),g=new r.CylinderGeometry(0,.04,.1,12)).translate(0,.05,0),new r.BoxGeometry(.08,.08,.08)),f=(p.translate(0,.04,0),new r.BufferGeometry);function m(e,t){return(e=new r.TorusGeometry(e,.0075,3,64,t*Math.PI*2)).rotateY(Math.PI/2),e.rotateX(Math.PI/2),e}(f.setAttribute("position",new r.Float32BufferAttribute([0,0,0,1,0,0],3)),S=new r.CylinderGeometry(.0075,.0075,.5,3)).translate(0,.25,0);var g={X:[[new r.Mesh(g,w),[.5,0,0],[0,0,-Math.PI/2]],[new r.Mesh(g,w),[-.5,0,0],[0,0,Math.PI/2]],[new r.Mesh(S,w),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new r.Mesh(g,A),[0,.5,0]],[new r.Mesh(g,A),[0,-.5,0],[Math.PI,0,0]],[new r.Mesh(S,A)]],Z:[[new r.Mesh(g,l),[0,0,.5],[Math.PI/2,0,0]],[new r.Mesh(g,l),[0,0,-.5],[-Math.PI/2,0,0]],[new r.Mesh(S,l),null,[Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.OctahedronGeometry(.1,0),d.clone()),[0,0,0]]],XY:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),h.clone()),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),u.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),c.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},v={X:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[.3,0,0],[0,0,-Math.PI/2]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,.3,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,-.3,0],[0,0,Math.PI]]],Z:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,0,.3],[Math.PI/2,0,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.OctahedronGeometry(.2,0),s)]],XY:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]]},y={START:[[new r.Mesh(new r.OctahedronGeometry(.01,2),a),null,null,null,"helper"]],END:[[new r.Mesh(new r.OctahedronGeometry(.01,2),a),null,null,null,"helper"]],DELTA:[[new r.Line(((y=new r.BufferGeometry).setAttribute("position",new r.Float32BufferAttribute([0,0,0,1,1,1],3)),y),a),null,null,null,"helper"]],X:[[new r.Line(f,a.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new r.Line(f,a.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new r.Line(f,a.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},b=(o={XYZE:[[new r.Mesh(m(.5,1),o),null,[0,Math.PI/2,0]]],X:[[new r.Mesh(m(.5,.5),w)]],Y:[[new r.Mesh(m(.5,.5),A),null,[0,0,-Math.PI/2]]],Z:[[new r.Mesh(m(.5,.5),l),null,[0,Math.PI/2,0]]],E:[[new r.Mesh(m(.75,1),b),null,[0,Math.PI/2,0]]]},{AXIS:[[new r.Line(f,a.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]}),x={XYZE:[[new r.Mesh(new r.SphereGeometry(.25,10,8),s)]],X:[[new r.Mesh(new r.TorusGeometry(.5,.1,4,24),s),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new r.Mesh(new r.TorusGeometry(.5,.1,4,24),s),[0,0,0],[Math.PI/2,0,0]]],Z:[[new r.Mesh(new r.TorusGeometry(.5,.1,4,24),s),[0,0,0],[0,0,-Math.PI/2]]],E:[[new r.Mesh(new r.TorusGeometry(.75,.1,2,24),s)]]},w={X:[[new r.Mesh(p,w),[.5,0,0],[0,0,-Math.PI/2]],[new r.Mesh(S,w),[0,0,0],[0,0,-Math.PI/2]],[new r.Mesh(p,w),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new r.Mesh(p,A),[0,.5,0]],[new r.Mesh(S,A)],[new r.Mesh(p,A),[0,-.5,0],[0,0,Math.PI]]],Z:[[new r.Mesh(p,l),[0,0,.5],[Math.PI/2,0,0]],[new r.Mesh(S,l),[0,0,0],[Math.PI/2,0,0]],[new r.Mesh(p,l),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),h),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),u),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),c),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.BoxGeometry(.1,.1,.1),d.clone())]]},A={X:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[.3,0,0],[0,0,-Math.PI/2]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,.3,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,-.3,0],[0,0,Math.PI]]],Z:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,0,.3],[Math.PI/2,0,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.2),s),[0,0,0]]]},S={X:[[new r.Line(f,a.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new r.Line(f,a.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new r.Line(f,a.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function B(e){var t,n=new r.Object3D;for(t in e)for(var i=e[t].length;i--;){var o=e[t][i][0].clone(),a=e[t][i][1],s=e[t][i][2],l=e[t][i][3],u=e[t][i][4];(o.name=t,o.tag=u,a&&o.position.set(a[0],a[1],a[2]),s&&o.rotation.set(s[0],s[1],s[2]),l&&o.scale.set(l[0],l[1],l[2]),o.updateMatrix(),u=o.geometry.clone()).applyMatrix4(o.matrix),o.geometry=u,o.renderOrder=1/0,o.position.set(0,0,0),o.rotation.set(0,0,0),o.scale.set(1,1,1),n.add(o)}return n}return n.gizmo={},n.picker={},n.helper={},n.add(n.gizmo.translate=B(g)),n.add(n.gizmo.rotate=B(o)),n.add(n.gizmo.scale=B(w)),n.add(n.picker.translate=B(v)),n.add(n.picker.rotate=B(x)),n.add(n.picker.scale=B(A)),n.add(n.helper.translate=B(y)),n.add(n.helper.rotate=B(b)),n.add(n.helper.scale=B(S)),n.picker.translate.visible=!1,n.picker.rotate.visible=!1,n.picker.scale.visible=!1,n}return a(t,[{key:"updateMatrixWorld",value:function(e){var r=this,n="local"===("scale"===this.mode?"local":this.space)?this.worldQuaternion:T,i=(this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode,this.helper.translate.visible="translate"===this.mode,this.helper.rotate.visible="rotate"===this.mode,this.helper.scale.visible="scale"===this.mode,[]);i=(i=(i=i.concat(this.picker[this.mode].children)).concat(this.gizmo[this.mode].children)).concat(this.helper[this.mode].children);for(var o=0;o<i.length;o++)!function(e){var t=i[e];if(t.visible=!0,t.rotation.set(0,0,0),e=void t.position.copy(r.worldPosition),e=r.camera.isOrthographicCamera?(r.camera.top-r.camera.bottom)/r.camera.zoom:r.worldPosition.distanceTo(r.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*r.camera.fov/360)/r.camera.zoom,7),t.scale.set(1,1,1).multiplyScalar(e*r.size/4),"helper"===t.tag)return t.visible=!1,"AXIS"===t.name?(t.position.copy(r.worldPositionStart),t.visible=!!r.axis,"X"===r.axis&&(g.setFromEuler(B.set(0,0,0)),t.quaternion.copy(n).multiply(g),.9<Math.abs(M.copy(O).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"Y"===r.axis&&(g.setFromEuler(B.set(0,0,Math.PI/2)),t.quaternion.copy(n).multiply(g),.9<Math.abs(M.copy(P).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"Z"===r.axis&&(g.setFromEuler(B.set(0,Math.PI/2,0)),t.quaternion.copy(n).multiply(g),.9<Math.abs(M.copy(I).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"XYZE"===r.axis&&(g.setFromEuler(B.set(0,Math.PI/2,0)),M.copy(r.rotationAxis),t.quaternion.setFromRotationMatrix(E.lookAt(C,M,P)),t.quaternion.multiply(g),t.visible=r.dragging),"E"===r.axis&&(t.visible=!1)):"START"===t.name?(t.position.copy(r.worldPositionStart),t.visible=r.dragging):"END"===t.name?(t.position.copy(r.worldPosition),t.visible=r.dragging):"DELTA"===t.name?(t.position.copy(r.worldPositionStart),t.quaternion.copy(r.worldQuaternionStart),f.set(1e-10,1e-10,1e-10).add(r.worldPositionStart).sub(r.worldPosition).multiplyScalar(-1),f.applyQuaternion(r.worldQuaternionStart.clone().invert()),t.scale.copy(f),t.visible=r.dragging):(t.quaternion.copy(n),r.dragging?t.position.copy(r.worldPositionStart):t.position.copy(r.worldPosition),r.axis&&(t.visible=-1!==r.axis.search(t.name)));t.quaternion.copy(n),"translate"===r.mode||"scale"===r.mode?("X"===t.name&&.99<Math.abs(M.copy(O).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Y"===t.name&&.99<Math.abs(M.copy(P).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Z"===t.name&&.99<Math.abs(M.copy(I).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XY"===t.name&&Math.abs(M.copy(I).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"YZ"===t.name&&Math.abs(M.copy(O).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XZ"===t.name&&Math.abs(M.copy(P).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1)):"rotate"===r.mode&&(_.copy(n),M.copy(r.eye).applyQuaternion(g.copy(n).invert()),-1!==t.name.search("E")&&t.quaternion.setFromRotationMatrix(E.lookAt(r.eye,C,P)),"X"===t.name&&(g.setFromAxisAngle(O,Math.atan2(-M.y,M.z)),g.multiplyQuaternions(_,g),t.quaternion.copy(g)),"Y"===t.name&&(g.setFromAxisAngle(P,Math.atan2(M.x,M.z)),g.multiplyQuaternions(_,g),t.quaternion.copy(g)),"Z"===t.name&&(g.setFromAxisAngle(I,Math.atan2(M.y,M.x)),g.multiplyQuaternions(_,g),t.quaternion.copy(g))),t.visible=t.visible&&(-1===t.name.indexOf("X")||r.showX),t.visible=t.visible&&(-1===t.name.indexOf("Y")||r.showY),t.visible=t.visible&&(-1===t.name.indexOf("Z")||r.showZ),t.visible=t.visible&&(-1===t.name.indexOf("E")||r.showX&&r.showY&&r.showZ),t.material._color=t.material._color||t.material.color.clone(),t.material._opacity=t.material._opacity||t.material.opacity,t.material.color.copy(t.material._color),t.material.opacity=t.material._opacity,r.enabled&&r.axis&&(t.name===r.axis||r.axis.split("").some((function(e){return t.name===e})))&&(t.material.color.setHex(16776960),t.material.opacity=1)}(o);s(d(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}(),G=(U.prototype.isTransformControlsGizmo=!0,function(){l(t,r.Mesh);var e=c(t);function t(){var n;return i(this,t),(n=e.call(this,new r.PlaneGeometry(1e5,1e5,2,2),new r.MeshBasicMaterial({visible:!1,wireframe:!0,side:r.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1}))).type="TransformControlsPlane",n}return a(t,[{key:"updateMatrixWorld",value:function(e){var r=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(r="local"),k.copy(O).applyQuaternion("local"===r?this.worldQuaternion:T),L.copy(P).applyQuaternion("local"===r?this.worldQuaternion:T),F.copy(I).applyQuaternion("local"===r?this.worldQuaternion:T),M.copy(L),this.mode){case"translate":case"scale":switch(this.axis){case"X":M.copy(this.eye).cross(k),D.copy(k).cross(M);break;case"Y":M.copy(this.eye).cross(L),D.copy(L).cross(M);break;case"Z":M.copy(this.eye).cross(F),D.copy(F).cross(M);break;case"XY":D.copy(F);break;case"YZ":D.copy(k);break;case"XZ":M.copy(F),D.copy(L);break;case"XYZ":case"E":D.set(0,0,0)}break;default:D.set(0,0,0)}0===D.length()?this.quaternion.copy(this.cameraQuaternion):(R.lookAt(f.set(0,0,0),D,M),this.quaternion.setFromRotationMatrix(R)),s(d(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}()),j=(G.prototype.isTransformControlsPlane=!0,__webpack_require__(3300)),H=__webpack_require__.n(j),N=__webpack_require__(9728),z=__webpack_require__(2081);class V{constructor(e){this.runScene=e}}function J(e){return(J="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var K=function(){var e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),t=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);if("object"!==("undefined"==typeof WebAssembly?"undefined":J(WebAssembly)))return{supported:!1};var r,n="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB";function i(e,t,n,i,o,a){var s=r.exports.sbrk,l=n+3&-4,u=s(l*i),c=s(o.length),h=new Uint8Array(r.exports.memory.buffer);if(0==(h.set(o,c),e=e(u,n,i,c,o.length))&&a&&a(u,l,i),t.set(h.subarray(u,u+n*i)),s(u-s(0)),0!=e)throw new Error("Malformed buffer data: "+e)}WebAssembly.validate(e)&&(n="B9h9z9tFBBBFiI9gBB9gLaaaaaFa9gEaaaB9gFaFaEMcBBFBFFGGGEILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBOn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBNI9z9iqlBVc+N9IcIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMk8lLbaE97F9+FaL978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAeDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAeDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBReCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBH8ZCFD9tA8ZAPD9OD9hD9RH8ZDQBTFtGmEYIPLdKeOnHpAIAQJDBIBHyCFD9tAyAPD9OD9hD9RHyAIASJDBIBH8cCFD9tA8cAPD9OD9hD9RH8cDQBTFtGmEYIPLdKeOnH8dDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAeD9uHeDyBjGBAEAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeApA8dDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNiV8ZcpMyS8cQ8df8eb8fHdAyA8cDQNiV8ZcpMyS8cQ8df8eb8fH8ZDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/dLEK97FaF97GXGXAGCI9HQBAF9FQFCBRGEXABABDBBBHECiD+rFCiD+sFD/6FHIAECND+rFCiD+sFD/6FAID/gFAECTD+rFCiD+sFD/6FHLD/gFD/kFD/lFHKCBDtD+2FHOAICUUUU94DtHND9OD9RD/kFHI9DBB/+hDYAIAID/mFAKAKD/mFALAOALAND9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHLD/mF9DBBX9LDYHOD/kFCgFDtD9OAECUUU94DtD9OD9QAIALD/mFAOD/kFCND+rFCU/+EDtD9OD9QAKALD/mFAOD/kFCTD+rFCUU/8ODtD9OD9QDMBBABCTJRBAGCIJHGAF9JQBSGMMAF9FQBCBRGEXABCTJHVAVDBBBHECBDtHOCUU98D8cFCUU98D8cEHND9OABDBBBHKAEDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAKAEDQBFGENVcMTtmYi8ZpyHECTD+sFD/6FHID/gFAECTD+rFCTD+sFD/6FHLD/gFD/kFD/lFHE9DB/+g6DYALAEAOD+2FHOALCUUUU94DtHcD9OD9RD/kFHLALD/mFAEAED/mFAIAOAIAcD9OD9RD/kFHEAED/mFD/kFD/kFD/jFD/nFHID/mF9DBBX9LDYHOD/kFCTD+rFALAID/mFAOD/kFCggEDtD9OD9QHLAEAID/mFAOD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHEDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAKAND9OALAEDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM/hEIGaF97FaL978jUUUUBCTlREGXAF9FQBCBRIEXAEABDBBBHLABCTJHKDBBBHODQILKOSQfbPden8c8d8e8fHNCTD+sFHVCID+rFDMIBAB9DBBU8/DY9D/zI818/DYAVCEDtD9QD/6FD/nFHVALAODQBFGENVcMTtmYi8ZpyHLCTD+rFCTD+sFD/6FD/mFHOAOD/mFAVALCTD+sFD/6FD/mFHcAcD/mFAVANCTD+rFCTD+sFD/6FD/mFHNAND/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHVD/mF9DBBX9LDYHLD/kFCggEDtHMD9OAcAVD/mFALD/kFCTD+rFD9QHcANAVD/mFALD/kFCTD+rFAOAVD/mFALD/kFAMD9OD9QHVDQBFTtGEmYILPdKOenHLD8dBAEDBIBDyB+t+J83EBABCNJALD8dFAEDBIBDyF+t+J83EBAKAcAVDQNVi8ZcMpySQ8c8dfb8e8fHVD8dBAEDBIBDyG+t+J83EBABCiJAVD8dFAEDBIBDyE+t+J83EBABCAJRBAICIJHIAF9JQBMMM9jFF97GXAGCGrAF9sHG9FQBCBRFEXABABDBBBHECND+rFCND+sFD/6FAECiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBABCTJRBAFCIJHFAG9JQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",console.log("Warning: meshopt_decoder is using experimental SIMD support")),e=WebAssembly.instantiate(function(e){for(var r=new Uint8Array(e.length),n=0;n<e.length;++n){var i=e.charCodeAt(n);r[n]=96<i?i-71:64<i?i-65:47<i?i+4:46<i?63:62}var o=0;for(n=0;n<e.length;++n)r[o++]=r[n]<60?t[r[n]]:64*(r[n]-60)+r[++n];return r.buffer.slice(0,o)}(n),{}).then((function(e){(r=e.instance).exports.__wasm_call_ctors()}));var o={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},a={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:e,supported:!0,decodeVertexBuffer:function(e,t,n,a,s){i(r.exports.meshopt_decodeVertexBuffer,e,t,n,a,r.exports[o[s]])},decodeIndexBuffer:function(e,t,n,o){i(r.exports.meshopt_decodeIndexBuffer,e,t,n,o)},decodeIndexSequence:function(e,t,n,o){i(r.exports.meshopt_decodeIndexSequence,e,t,n,o)},decodeGltfBuffer:function(e,t,n,s,l,u){i(r.exports[a[l]],e,t,n,s,r.exports[o[u]])}}}();function W(e){return(W="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function X(e,t){return(X=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Q(e){return(Q=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Z=new WeakMap,Y=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&X(t,e);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Q(e);if(r=t?(r=Q(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===W(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e){if(this instanceof i)return(e=n.call(this,e)).decoderPath="",e.decoderConfig={},e.decoderBinary=null,e.decoderPending=null,e.workerLimit=4,e.workerPool=[],e.workerNextTaskID=1,e.workerSourceURL="",e.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},e.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},e;throw new TypeError("Cannot call a class as a function")}return t=i,(e=[{key:"setDecoderPath",value:function(e){return this.decoderPath=e,this}},{key:"setDecoderConfig",value:function(e){return this.decoderConfig=e,this}},{key:"setWorkerLimit",value:function(e){return this.workerLimit=e,this}},{key:"load",value:function(e,t,n,i){var o=this,a=new r.FileLoader(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(e){var r={attributeIDs:o.defaultAttributeIDs,attributeTypes:o.defaultAttributeTypes,useUniqueIDs:!1};o.decodeGeometry(e,r).then(t).catch(i)}),n,i)}},{key:"decodeDracoFile",value:function(e,t,r,n){n={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!r},this.decodeGeometry(e,n).then(t)}},{key:"decodeGeometry",value:function(e,t){var r,n=this;for(r in t.attributeTypes){var i=t.attributeTypes[r];void 0!==i.BYTES_PER_ELEMENT&&(t.attributeTypes[r]=i.name)}var o,a=JSON.stringify(t);if(Z.has(e)){if((l=Z.get(e)).key===a)return l.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var s=this.workerNextTaskID++,l=e.byteLength;return l=this._getWorker(s,l).then((function(r){return o=r,new Promise((function(r,n){o._callbacks[s]={resolve:r,reject:n},o.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))})).then((function(e){return n._createGeometry(e.geometry)})),l.catch((function(){return!0})).then((function(){o&&s&&n._releaseTask(o,s)})),Z.set(e,{key:a,promise:l}),l}},{key:"_createGeometry",value:function(e){var t=new r.BufferGeometry;e.index&&t.setIndex(new r.BufferAttribute(e.index.array,1));for(var n=0;n<e.attributes.length;n++){var i=(a=e.attributes[n]).name,o=a.array,a=a.itemSize;t.setAttribute(i,new r.BufferAttribute(o,a))}return t}},{key:"_loadLibrary",value:function(e,t){var n=new r.FileLoader(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((function(t,r){n.load(e,t,void 0,r)}))}},{key:"preload",value:function(){return this._initDecoder(),this}},{key:"_initDecoder",value:function(){var e,t,r=this;return this.decoderPending||(t=[],(e="object"!==("undefined"==typeof WebAssembly?"undefined":W(WebAssembly))||"js"===this.decoderConfig.type)?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((function(t){var n=t[0];e||(r.decoderConfig.wasmBinary=t[1]),t=function(){var e,t;onmessage=function(r){var n=r.data;switch(n.type){case"init":e=n.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var i=n.buffer,o=n.taskConfig;t.then((function(e){var t=new(e=e.draco).Decoder,r=new e.DecoderBuffer;r.Init(new Int8Array(i),i.byteLength);try{var a=function(e,t,r,n){var i,o=n.attributeIDs,a=n.attributeTypes,s=t.GetEncodedGeometryType(r);if(s===e.TRIANGULAR_MESH)i=new e.Mesh,v=t.DecodeBufferToMesh(r,i);else{if(s!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");i=new e.PointCloud,v=t.DecodeBufferToPointCloud(r,i)}if(!v.ok()||0===i.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+v.error_msg());var l,u,c,h,d,p,f,m,g,v,y,b,x,w={index:null,attributes:[]};for(l in o){var A=self[a[l]],S=void 0,B=void 0;if(n.useUniqueIDs)B=o[l],S=t.GetAttributeByUniqueId(i,B);else{if(-1===(B=t.GetAttributeId(i,e[o[l]])))continue;S=t.GetAttribute(i,B)}w.attributes.push((B=e,u=t,c=i,h=l,d=S.num_components(),f=(p=c.num_points()*d)*A.BYTES_PER_ELEMENT,m=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(B,A),g=B._malloc(f),u.GetAttributeDataArrayForAllPoints(c,S,m,f,g),u=new A(B.HEAPF32.buffer,g,p).slice(),B._free(g),{name:h,array:u,itemSize:d}))}return s===e.TRIANGULAR_MESH&&(w.index=(r=e,v=t,b=4*(y=3*(s=i).num_faces()),x=r._malloc(b),v.GetTrianglesUInt32Array(s,b,x),v=new Uint32Array(r.HEAPF32.buffer,x,y).slice(),r._free(x),{array:v,itemSize:1})),e.destroy(i),w}(e,t,r,o),s=a.attributes.map((function(e){return e.array.buffer}));a.index&&s.push(a.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:a},s)}catch(e){console.error(e),self.postMessage({type:"error",id:n.id,error:e.message})}finally{e.destroy(r),e.destroy(t)}}))}}}.toString(),n=["/* draco decoder */",n,"","/* worker */",t.substring(t.indexOf("{")+1,t.lastIndexOf("}"))].join("\n"),r.workerSourceURL=URL.createObjectURL(new Blob([n]))}))),this.decoderPending}},{key:"_getWorker",value:function(e,t){var r=this;return this._initDecoder().then((function(){r.workerPool.length<r.workerLimit?((n=new Worker(r.workerSourceURL))._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:r.decoderConfig}),n.onmessage=function(e){var t=e.data;switch(t.type){case"decode":n._callbacks[t.id].resolve(t);break;case"error":n._callbacks[t.id].reject(t);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+t.type+'"')}},r.workerPool.push(n)):r.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));var n,i=r.workerPool[r.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i}))}},{key:"_releaseTask",value:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}},{key:"debug",value:function(){console.log("Task load: ",this.workerPool.map((function(e){return e._taskLoad})))}},{key:"dispose",value:function(){for(var e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.Loader),q={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};var $=new(function(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(t,r,n){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var i=this,o=!1,a=0,s=0,l=void 0,u=[];this.onStart=void 0,this.onLoad=t,this.onProgress=r,this.onError=n,this.itemStart=function(e){s++,!1===o&&void 0!==i.onStart&&i.onStart(e,a,s),o=!0},this.itemEnd=function(e){a++,void 0!==i.onProgress&&i.onProgress(e,a,s),a===s&&(o=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return l?l(e):e},this.setURLModifier=function(e){return l=e,this},this.addHandler=function(e,t){return u.push(e,t),this},this.removeHandler=function(e){return-1!==(e=u.indexOf(e))&&u.splice(e,2),this},this.getHandler=function(e){for(var t=0,r=u.length;t<r;t+=2){var n=u[t],i=u[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return i}return null}})));var ee=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.manager=void 0!==t?t:$,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}var t,r;return t=e,(r=[{key:"load",value:function(){}},{key:"loadAsync",value:function(e,t){var r=this;return new Promise((function(n,i){r.load(e,n,t,i)}))}},{key:"parse",value:function(){}},{key:"setCrossOrigin",value:function(e){return this.crossOrigin=e,this}},{key:"setWithCredentials",value:function(e){return this.withCredentials=e,this}},{key:"setPath",value:function(e){return this.path=e,this}},{key:"setResourcePath",value:function(e){return this.resourcePath=e,this}},{key:"setRequestHeader",value:function(e){return this.requestHeader=e,this}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function te(e){return(te="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function re(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ne(e,t){return(ne=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function ie(e){return(ie=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var oe=function(){var e=n,t=ee;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ne(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ie(e);if(r=t?(r=ie(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===te(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){if(this instanceof n)return e=r.call(this,e),"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),e.options={premultiplyAlpha:"none"},e;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"setOptions",value:function(e){return this.options=e,this}},{key:"load",value:function(e,t,r,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var o=this,a=q.get(e);if(void 0!==a)return o.manager.itemStart(e),setTimeout((function(){t&&t(a),o.manager.itemEnd(e)}),0),a;var s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader,fetch(e,s).then((function(e){return e.blob()})).then((function(e){return Promise.all([new Promise((function(t){var r=(n=o.options).textureQuality,n=n.reverseTexture,a=i.notCompress,s=i.size,l=0===e.size?new ImageData(1,1):e;t(s&&1!==r?(s=(t=i.size).w,t=t.h,a=a?1:r,createImageBitmap(l,Object.assign(o.options,{imageOrientation:n?"none":"flipY",resizeHeight:t*a,resizeWidth:s*a}))):createImageBitmap(l,Object.assign(o.options,{imageOrientation:n?"none":"flipY"})))})),Promise.resolve(e)])})).then((function(r){r=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(o.push(n.value),2!==o.length);a=!0);}catch(e){s=!0,i=e}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}}(e)||function(e,t){if(e){if("string"==typeof e)return re(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?re(e,2):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(r);var n=r[0];r=r[1],q.add(e,n),t&&t(n,r),o.manager.itemEnd(e)})).catch((function(t){n&&n(t),o.manager.itemError(e),o.manager.itemEnd(e)})),o.manager.itemStart(e)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}(),ae=(oe.prototype.isImageBitmapLoader=!0,__webpack_require__(4632));function se(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,i=e}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}}(e,t)||ue(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function le(e,t){var r,n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=ue(e))||t&&e&&"number"==typeof e.length)return n&&(e=n),r=0,{s:t=function(){},n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw i}}}}function ue(e,t){if(e){if("string"==typeof e)return ce(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ce(e,t):void 0}}function ce(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function he(e){return(he="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function de(){return(de="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=xe(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function pe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function me(e,t,r){return t&&fe(e.prototype,t),r&&fe(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ge(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ve(e,t)}function ve(e,t){return(ve=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function ye(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=xe(e);if(r=t?(r=xe(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===he(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return be(n)}}function be(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xe(e){return(xe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var we=function(){ge(t,r.Loader);var e=ye(t);function t(r){return pe(this,t),(r=e.call(this,r)).dracoLoader=null,r.ktx2Loader=null,r.meshoptDecoder=null,r.pluginCallbacks=[],r.register((function(e){return new Ce(e)})),r.register((function(e){return new Oe(e)})),r.register((function(e){return new Pe(e)})),r.register((function(e){return new Ee(e)})),r.register((function(e){return new _e(e)})),r.register((function(e){return new Te(e)})),r.register((function(e){return new De(e)})),r.register((function(e){return new Re(e)})),r.register((function(e){return new Be(e)})),r.register((function(e){return new Ie(e)})),r}return me(t,[{key:"load",value:function(e,t,n,i){function o(t){i?i(t):console.error(t),a.manager.itemError(e),a.manager.itemEnd(e)}var a=this,s=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:r.LoaderUtils.extractUrlBase(e),l=(this.manager.itemStart(e),new r.FileLoader(this.manager));l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,(function(r){try{a.parse(r,s,(function(r){t(r),a.manager.itemEnd(e)}),o)}catch(r){o(r)}}),n,o)}},{key:"setDRACOLoader",value:function(e){return this.dracoLoader=e,this}},{key:"setDDSLoader",value:function(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}},{key:"setKTX2Loader",value:function(e){return this.ktx2Loader=e,this}},{key:"setMeshoptDecoder",value:function(e){return this.meshoptDecoder=e,this}},{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,n,i,o){var a,s={},l={};if("string"==typeof e)a=e;else if(r.LoaderUtils.decodeText(new Uint8Array(e,0,4))===ke){try{s[Se.KHR_BINARY_GLTF]=new Le(e)}catch(e){return void(i&&i(e))}a=s[Se.KHR_BINARY_GLTF].content}else a=r.LoaderUtils.decodeText(new Uint8Array(e));var u=JSON.parse(a);if(void 0===u.asset||u.asset.version[0]<2)i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else if(o.helper.beforeLoader(u)){var c=new rt(u,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder,myOptions:o});c.fileLoader.setRequestHeader(this.requestHeader);for(var h=0;h<this.pluginCallbacks.length;h++){var d=this.pluginCallbacks[h](c);s[(l[d.name]=d).name]=!0}if(u.extensionsUsed)for(var p=0;p<u.extensionsUsed.length;++p){var f=u.extensionsUsed[p],m=u.extensionsRequired||[];switch(f){case Se.KHR_MATERIALS_UNLIT:s[f]=new Me;break;case Se.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:s[f]=new je;break;case Se.KHR_DRACO_MESH_COMPRESSION:s[f]=new Fe(u,this.dracoLoader);break;case Se.KHR_TEXTURE_TRANSFORM:s[f]=new Ue;break;case Se.KHR_MESH_QUANTIZATION:s[f]=new He;break;default:0<=m.indexOf(f)&&void 0===l[f]&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}c.setExtensions(s),c.setPlugins(l),c.parse(n,i)}}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,i){r.parse(e,t,n,i)}))}}]),t}();function Ae(){var e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}var Se={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_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",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",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"},Be=function(){function e(t){pe(this,e),this.parser=t,this.name=Se.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return me(e,[{key:"_markDefs",value:function(){for(var e=this.parser,t=this.parser.json.nodes||[],r=0,n=t.length;r<n;r++){var i=t[r];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}},{key:"_loadLight",value:function(e){var t=this.parser,n="light:"+e,i=t.cache.get(n);if(!i){var o,a=t.json,s=((a.extensions&&a.extensions[this.name]||{}).lights||[])[e],l=new r.Color(16777215),u=(void 0!==s.color&&l.fromArray(s.color),void 0!==s.range?s.range:0);switch(s.type){case"directional":(o=new r.DirectionalLight(l)).target.position.set(0,0,-1),o.add(o.target);break;case"point":(o=new r.PointLight(l)).distance=u;break;case"spot":(o=new r.SpotLight(l)).distance=u,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,o.angle=s.spot.outerConeAngle,o.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,o.target.position.set(0,0,-1),o.add(o.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}o.position.set(0,0,0),o.decay=2,void 0!==s.intensity&&(o.intensity=s.intensity),o.name=t.createUniqueName(s.name||"light_"+e),i=Promise.resolve(o),t.cache.add(n,i)}return i}},{key:"createNodeAttachment",value:function(e){var t=this,r=this.parser,n=((e=r.json.nodes[e]).extensions&&e.extensions[this.name]||{}).light;return void 0===n?null:this._loadLight(n).then((function(e){return r._getNodeRef(t.cache,n,e)}))}}]),e}(),Me=function(){function e(){pe(this,e),this.name=Se.KHR_MATERIALS_UNLIT}return me(e,[{key:"getMaterialType",value:function(){return r.MeshBasicMaterial}},{key:"extendParams",value:function(e,t,n){var i,o=[];return e.color=new r.Color(1,1,1),e.opacity=1,(t=t.pbrMetallicRoughness)&&(Array.isArray(t.baseColorFactor)&&(i=t.baseColorFactor,e.color.fromArray(i),e.opacity=i[3]),void 0!==t.baseColorTexture&&o.push(n.assignTexture(e,"map",t.baseColorTexture))),Promise.all(o)}}]),e}(),Ce=function(){function e(t){pe(this,e),this.parser=t,this.name=Se.KHR_MATERIALS_CLEARCOAT}return me(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser;if(!(e=n.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var i=[];return void 0!==(e=e.extensions[this.name]).clearcoatFactor&&(t.clearcoat=e.clearcoatFactor),void 0!==e.clearcoatTexture&&i.push(n.assignTexture(t,"clearcoatMap",e.clearcoatTexture)),void 0!==e.clearcoatRoughnessFactor&&(t.clearcoatRoughness=e.clearcoatRoughnessFactor),void 0!==e.clearcoatRoughnessTexture&&i.push(n.assignTexture(t,"clearcoatRoughnessMap",e.clearcoatRoughnessTexture)),void 0!==e.clearcoatNormalTexture&&(i.push(n.assignTexture(t,"clearcoatNormalMap",e.clearcoatNormalTexture)),void 0!==e.clearcoatNormalTexture.scale&&(n=e.clearcoatNormalTexture.scale,t.clearcoatNormalScale=new r.Vector2(n,n))),Promise.all(i)}}]),e}(),Ee=function(){function e(t){pe(this,e),this.parser=t,this.name=Se.KHR_MATERIALS_SHEEN}return me(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser;if(!(e=n.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var i=[];return void 0!==(t.sheenColor=new r.Color(0,0,0),t.sheenRoughness=0,t.sheen=1,e=e.extensions[this.name]).sheenColorFactor&&t.sheenColor.fromArray(e.sheenColorFactor),void 0!==e.sheenRoughnessFactor&&(t.sheenRoughness=e.sheenRoughnessFactor),void 0!==e.sheenColorTexture&&i.push(n.assignTexture(t,"sheenColorMap",e.sheenColorTexture)),void 0!==e.sheenRoughnessTexture&&i.push(n.assignTexture(t,"sheenRoughnessMap",e.sheenRoughnessTexture)),Promise.all(i)}}]),e}(),_e=function(){function e(t){pe(this,e),this.parser=t,this.name=Se.KHR_MATERIALS_TRANSMISSION}return me(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r=this.parser;if(!(e=r.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var n=[];return void 0!==(e=e.extensions[this.name]).transmissionFactor&&(t.transmission=e.transmissionFactor),void 0!==e.transmissionTexture&&n.push(r.assignTexture(t,"transmissionMap",e.transmissionTexture)),Promise.all(n)}}]),e}(),Te=function(){function e(t){pe(this,e),this.parser=t,this.name=Se.KHR_MATERIALS_VOLUME}return me(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){if(!(e=(i=this.parser).json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var n=[],i=(e=e.extensions[this.name],t.thickness=void 0!==e.thicknessFactor?e.thicknessFactor:0,void 0!==e.thicknessTexture&&n.push(i.assignTexture(t,"thicknessMap",e.thicknessTexture)),t.attenuationDistance=e.attenuationDistance||0,e.attenuationColor||[1,1,1]);return t.attenuationColor=new r.Color(i[0],i[1],i[2]),Promise.all(n)}}]),e}(),De=function(){function e(t){pe(this,e),this.parser=t,this.name=Se.KHR_MATERIALS_IOR}return me(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]&&(e=e.extensions[this.name],t.ior=void 0!==e.ior?e.ior:1.5),Promise.resolve()}}]),e}(),Re=function(){function e(t){pe(this,e),this.parser=t,this.name=Se.KHR_MATERIALS_SPECULAR}return me(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser;if(!(e=n.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var i=[],o=(e=e.extensions[this.name],t.specularIntensity=void 0!==e.specularFactor?e.specularFactor:1,void 0!==e.specularTexture&&i.push(n.assignTexture(t,"specularIntensityMap",e.specularTexture)),e.specularColorFactor||[1,1,1]);return t.specularColor=new r.Color(o[0],o[1],o[2]),void 0!==e.specularColorTexture&&i.push(n.assignTexture(t,"specularColorMap",e.specularColorTexture).then((function(e){e.encoding=r.sRGBEncoding}))),Promise.all(i)}}]),e}(),Oe=function(){function e(t){pe(this,e),this.parser=t,this.name=Se.KHR_TEXTURE_BASISU}return me(e,[{key:"loadTexture",value:function(e){var t=this.parser,r=t.json;if((n=r.textures[e]).extensions&&n.extensions[this.name]){var n=n.extensions[this.name],i=t.options.ktx2Loader;if(i)return t.loadTextureImage(e,n.source,i);if(r.extensionsRequired&&0<=r.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures")}return null}}]),e}(),Pe=function(){function e(t){pe(this,e),this.parser=t,this.name=Se.EXT_TEXTURE_WEBP,this.isSupported=null}return me(e,[{key:"loadTexture",value:function(e){var t=this.name,r=this.parser,n=r.json;if(!(i=n.textures[e]).extensions||!i.extensions[t])return null;var i=i.extensions[t],o=n.images[i.source],a=r.textureLoader;return o.uri&&null!==(i=r.options.manager.getHandler(o.uri))&&(a=i),this.detectSupport().then((function(i){if(i)return r.loadTextureImage(e,o,a);if(n.extensionsRequired&&0<=n.extensionsRequired.indexOf(t))throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)}))}},{key:"detectSupport",value:function(){return this.isSupported||(this.isSupported=new Promise((function(e){var t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}]),e}(),Ie=function(){function e(t){pe(this,e),this.name=Se.EXT_MESHOPT_COMPRESSION,this.parser=t}return me(e,[{key:"loadBufferView",value:function(e){var t=this.parser.json;if((e=t.bufferViews[e]).extensions&&e.extensions[this.name]){var r=e.extensions[this.name],n=(e=this.parser.getDependency("buffer",r.buffer),this.parser.options.meshoptDecoder);if(n&&n.supported)return Promise.all([e,n.ready]).then((function(e){var t=r.byteOffset||0,i=r.byteLength||0,o=r.count,a=r.byteStride,s=new ArrayBuffer(o*a);return e=new Uint8Array(e[0],t,i),n.decodeGltfBuffer(new Uint8Array(s),o,a,e,r.mode,r.filter),s}));if(t.extensionsRequired&&0<=t.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files")}return null}}]),e}(),ke="glTF",Le=me((function e(t){pe(this,e),this.name=Se.KHR_BINARY_GLTF,this.content=null,this.body=null;var n=new DataView(t,0,12);if(this.header={magic:r.LoaderUtils.decodeText(new Uint8Array(t.slice(0,4))),version:n.getUint32(4,!0),length:n.getUint32(8,!0)},this.header.magic!==ke)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var i=this.header.length-12,o=new DataView(t,12),a=0;a<i;){var s,l=o.getUint32(a,!0),u=(a+=4,o.getUint32(a,!0));a+=4,1313821514===u?(s=new Uint8Array(t,12+a,l),this.content=r.LoaderUtils.decodeText(s)):5130562===u&&(this.body=t.slice(s=12+a,s+l)),a+=l}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")})),Fe=function(){function e(t,r){if(pe(this,e),!r)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Se.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=r,this.dracoLoader.preload()}return me(e,[{key:"decodePrimitive",value:function(e,t){var r,n,i=this.json,o=this.dracoLoader,a=e.extensions[this.name].bufferView,s=e.extensions[this.name].attributes,l={},u={},c={};for(r in s){var h=Qe[r]||r.toLowerCase();l[h]=s[r]}for(n in e.attributes){var d,p,f=Qe[n]||n.toLowerCase();void 0!==s[n]&&(d=i.accessors[e.attributes[n]],p=Je[d.componentType],c[f]=p,u[f]=!0===d.normalized)}return t.getDependency("bufferView",a).then((function(e){return new Promise((function(t){o.decodeDracoFile(e,(function(e){for(var r in e.attributes){var n=e.attributes[r];void 0!==(r=u[r])&&(n.normalized=r)}t(e)}),l,c)}))}))}}]),e}(),Ue=function(){function e(){pe(this,e),this.name=Se.KHR_TEXTURE_TRANSFORM}return me(e,[{key:"extendTexture",value:function(e,t){return void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),void 0===t.offset&&void 0===t.rotation&&void 0===t.scale||(e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}]),e}(),Ge=function(){ge(t,r.MeshStandardMaterial);var e=ye(t);function t(n){pe(this,t),(i=e.call(this)).isGLTFSpecularGlossinessMaterial=!0;var i,o=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),a=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),s=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),l=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),u=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.roughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.","material.roughness += geometryRoughness;","material.roughness = min( material.roughness, 1.0 );","material.specularColor = specularFactor;"].join("\n"),c={specular:{value:(new r.Color).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};return i._extraUniforms=c,i.onBeforeCompile=function(e){for(var t in c)e.uniforms[t]=c[t];e.fragmentShader=e.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>",o).replace("#include <metalnessmap_pars_fragment>",a).replace("#include <roughnessmap_fragment>",s).replace("#include <metalnessmap_fragment>",l).replace("#include <lights_physical_fragment>",u)},Object.defineProperties(be(i),{specular:{get:function(){return c.specular.value},set:function(e){c.specular.value=e}},specularMap:{get:function(){return c.specularMap.value},set:function(e){(c.specularMap.value=e)?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return c.glossiness.value},set:function(e){c.glossiness.value=e}},glossinessMap:{get:function(){return c.glossinessMap.value},set:function(e){(c.glossinessMap.value=e)?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete i.metalness,delete i.roughness,delete i.metalnessMap,delete i.roughnessMap,i.setValues(n),i}return me(t,[{key:"copy",value:function(e){return de(xe(t.prototype),"copy",this).call(this,e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this}}]),t}(),je=function(){function e(){pe(this,e),this.name=Se.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.specularGlossinessParams=["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"]}return me(e,[{key:"getMaterialType",value:function(){return Ge}},{key:"extendParams",value:function(e,t,n){t=t.extensions[this.name];var i,o=(e.color=new r.Color(1,1,1),e.opacity=1,[]);return Array.isArray(t.diffuseFactor)&&(i=t.diffuseFactor,e.color.fromArray(i),e.opacity=i[3]),void 0!==t.diffuseTexture&&o.push(n.assignTexture(e,"map",t.diffuseTexture)),e.emissive=new r.Color(0,0,0),e.glossiness=void 0!==t.glossinessFactor?t.glossinessFactor:1,e.specular=new r.Color(1,1,1),Array.isArray(t.specularFactor)&&e.specular.fromArray(t.specularFactor),void 0!==t.specularGlossinessTexture&&(i=t.specularGlossinessTexture,o.push(n.assignTexture(e,"glossinessMap",i)),o.push(n.assignTexture(e,"specularMap",i))),Promise.all(o)}},{key:"createMaterial",value:function(e){var t=new Ge(e);return t.fog=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,t.normalMapType=r.TangentSpaceNormalMap,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t}}]),e}(),He=me((function e(){pe(this,e),this.name=Se.KHR_MESH_QUANTIZATION})),Ne=function(){ge(t,r.Interpolant);var e=ye(t);function t(r,n,i,o){return pe(this,t),e.call(this,r,n,i,o)}return me(t,[{key:"copySampleValue_",value:function(e){for(var t=this.resultBuffer,r=this.sampleValues,n=this.valueSize,i=e*n*3+n,o=0;o!==n;o++)t[o]=r[i+o];return t}}]),t}(),ze=(Ne.prototype.beforeStart_=Ne.prototype.copySampleValue_,Ne.prototype.afterEnd_=Ne.prototype.copySampleValue_,Ne.prototype.interpolate_=function(e,t,r,n){for(var i=this.resultBuffer,o=this.sampleValues,a=this.valueSize,s=2*a,l=3*a,u=n-t,c=e*l,h=c-l,d=-2*(t=(r=(n=(r-t)/u)*n)*n)+3*r,p=t-r,f=1-d,m=p-r+n,g=0;g!==a;g++){var v=o[h+g+a],y=o[h+g+s]*u,b=o[c+g+a],x=o[c+g]*u;i[g]=f*v+m*y+d*b+p*x}return i},new r.Quaternion),Ve=function(){ge(t,Ne);var e=ye(t);function t(){return pe(this,t),e.apply(this,arguments)}return me(t,[{key:"interpolate_",value:function(e,r,n,i){return e=de(xe(t.prototype),"interpolate_",this).call(this,e,r,n,i),ze.fromArray(e).normalize().toArray(e),e}}]),t}(),Je={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Ke={9728:r.NearestFilter,9729:r.LinearFilter,9984:r.NearestMipmapNearestFilter,9985:r.LinearMipmapNearestFilter,9986:r.NearestMipmapLinearFilter,9987:r.LinearMipmapLinearFilter},We={33071:r.ClampToEdgeWrapping,33648:r.MirroredRepeatWrapping,10497:r.RepeatWrapping},Xe={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Qe={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Ze={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Ye={CUBICSPLINE:void 0,LINEAR:r.InterpolateLinear,STEP:r.InterpolateDiscrete};function qe(e,t,r){for(var n in r.extensions)void 0===e[n]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[n]=r.extensions[n])}function $e(e,t){void 0!==t.extras&&("object"===he(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function et(e){for(var t="",r=Object.keys(e).sort(),n=0,i=r.length;n<i;n++)t+=r[n]+":"+e[r[n]]+";";return t}function tt(e){switch(e){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.")}}var rt=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};pe(this,e),this.json=t,this.extensions={},this.plugins={},this.options=n,this.cache=new Ae,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={},"undefined"!=typeof createImageBitmap&&!1===/Firefox|^((?!chrome|android).)*safari/i.test(navigator.userAgent)?this.textureLoader=new oe(this.options.manager):this.textureLoader=new r.TextureLoader(this.options.manager),this.options.myOptions.helper.options.setTextureLoader(this.textureLoader),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new r.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}return me(e,[{key:"setExtensions",value:function(e){this.extensions=e}},{key:"setPlugins",value:function(e){this.plugins=e}},{key:"parse",value:function(e,t){var r=this,n=this.json,i=this.extensions;this.cache.removeAll(),this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all([this.options.myOptions.helper.processInput(n,this)].concat(function(e){return function(e){if(Array.isArray(e))return ce(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ue(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))))).then((function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])})).then((function(t){var o={scene:t[0][n.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:n.asset,parser:r,userData:{}};qe(i,o,n),$e(o,n),Promise.all(r._invokeAll((function(e){return e.afterRoot&&e.afterRoot(o)}))).then((function(){e(o)}))})).catch(t)}},{key:"_markDefs",value:function(){for(var e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[],n=0,i=t.length;n<i;n++)for(var o=t[n].joints,a=0,s=o.length;a<s;a++)e[o[a]].isBone=!0;for(var l=0,u=e.length;l<u;l++){var c=e[l];void 0!==c.mesh&&(this._addNodeRef(this.meshCache,c.mesh),void 0!==c.skin&&(r[c.mesh].isSkinnedMesh=!0)),void 0!==c.camera&&this._addNodeRef(this.cameraCache,c.camera)}}},{key:"_addNodeRef",value:function(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}},{key:"_getNodeRef",value:function(e,t,r){var n=this;if(e.refs[t]<=1)return r;var i=r.clone();return function e(t,r){var i,o=n.associations.get(t),a=(null!=o&&n.associations.set(r,o),le(t.children.entries()));try{for(a.s();!(i=a.n()).done;){var s=se(i.value,2),l=s[0];e(s[1],r.children[l])}}catch(e){a.e(e)}finally{a.f()}}(r,i),i.name+="_instance_"+e.uses[t]++,i}},{key:"_invokeOne",value:function(e){var t=Object.values(this.plugins);t.push(this);for(var r=0;r<t.length;r++){var n=e(t[r]);if(n)return n}return null}},{key:"_invokeAll",value:function(e){for(var t=Object.values(this.plugins),r=(t.unshift(this),[]),n=0;n<t.length;n++){var i=e(t[n]);i&&r.push(i)}return r}},{key:"getDependency",value:function(e,t){var r=e+":"+t,n=this.cache.get(r);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this.loadNode(t);break;case"mesh":n=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":n=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":n=this.loadSkin(t);break;case"animation":n=this.loadAnimation(t);break;case"camera":n=this.loadCamera(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(r,n)}return n}},{key:"getDependencies",value:function(e){var t,r,n=this.cache.get(e);return n||(r=(t=this).json[e+("mesh"===e?"es":"s")]||[],n=Promise.all(r.map((function(r,n){return t.getDependency(e,n)}))),this.cache.add(e,n)),n}},{key:"loadBuffer",value:function(e){var t=this.json.buffers[e],n=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[Se.KHR_BINARY_GLTF].body);var i=this.options;return new Promise((function(e,o){n.load(r.LoaderUtils.resolveURL(t.uri,i.path),e,void 0,(function(){o(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))}},{key:"loadBufferView",value:function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var r=t.byteLength||0,n=t.byteOffset||0;return e.slice(n,n+r)}))}},{key:"loadAccessor",value:function(e){var t=this,n=this.json,i=this.json.accessors[e];return void 0===i.bufferView&&void 0===i.sparse?Promise.resolve(null):(e=[],void 0!==i.bufferView?e.push(this.getDependency("bufferView",i.bufferView)):e.push(null),void 0!==i.sparse&&(e.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),e.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(e).then((function(e){var o,a=e[0],s=Xe[i.type],l=Je[i.componentType],u=l.BYTES_PER_ELEMENT,c=i.byteOffset||0,h=void 0!==i.bufferView?n.bufferViews[i.bufferView].byteStride:void 0,d=!0===i.normalized,p=h&&h!==u*s?(f=Math.floor(c/h),m="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+f+":"+i.count,(g=t.cache.get(m))||(o=new l(a,f*h,i.count*h/u),g=new r.InterleavedBuffer(o,h/u),t.cache.add(m,g)),new r.InterleavedBufferAttribute(g,s,c%h/u,d)):(o=null===a?new l(i.count*s):new l(a,c,i.count*s),new r.BufferAttribute(o,s,d));if(void 0!==i.sparse){var f=Je[i.sparse.indices.componentType],m=i.sparse.indices.byteOffset||0,g=i.sparse.values.byteOffset||0,v=new f(e[1],m,i.sparse.count*Xe.SCALAR),y=new l(e[2],g,i.sparse.count*s);null!==a&&(p=new r.BufferAttribute(p.array.slice(),p.itemSize,p.normalized));for(var b=0,x=v.length;b<x;b++){var w=v[b];if(p.setX(w,y[b*s]),2<=s&&p.setY(w,y[b*s+1]),3<=s&&p.setZ(w,y[b*s+2]),4<=s&&p.setW(w,y[b*s+3]),5<=s)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return p})))}},{key:"loadTexture",value:function(e){var t=this.json,r=this.options,n=t.textures[e].source,i=(t=t.images[n],this.textureLoader);return t.uri&&null!==(r=r.manager.getHandler(t.uri))&&(i=r),this.loadTextureImage(e,n,i)}},{key:"loadTextureImage",value:function(e,t,n){var i=this,o=this.json,a=o.textures[e],s=((s=o.images[t]).uri||s.bufferView)+":"+a.sampler;return this.textureCache[s]?this.textureCache[s]:(t=this.loadImageSource(t,n,e).then((function(t){t.flipY=!1,a.name&&(t.name=a.name);var n=(o.samplers||{})[a.sampler]||{};return t.magFilter=Ke[n.magFilter]||r.LinearFilter,t.minFilter=Ke[n.minFilter]||r.LinearMipmapLinearFilter,t.wrapS=We[n.wrapS]||r.RepeatWrapping,t.wrapT=We[n.wrapT]||r.RepeatWrapping,i.associations.set(t,{textures:e}),i.options.myOptions.helper.material.processTexture({texture:t,textureDef:a}),t})).catch((function(e){return null})),this.textureCache[s]=t)}},{key:"loadImageSource",value:function(e,t,n){var i=this.json,o=this.options,a=i.textures[n];if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((function(e){return e.clone()})).catch((function(e){throw e}));var s=i.images[e],l=self.URL||self.webkitURL,u=s.uri||"";if(void 0!==s.bufferView)u=this.getDependency("bufferView",s.bufferView).then((function(e){return e=new Blob([e],{type:s.mimeType}),u=l.createObjectURL(e)}));else if(void 0===s.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");return n=Promise.resolve(u).then((function(e){return new Promise((function(n,i){var s,l;!0===t.isImageBitmapLoader?(s=function(e,t){(e=new r.Texture(e)).needsUpdate=!0,n({texture:e,blob:t})},t.load(r.LoaderUtils.resolveURL(e,o.path),s,void 0,i,a)):(l=o.myOptions.loadConfig.reverseTexture,(0,ae.urlToCanvas)(e).then((function(e){var t=e.ctx,i=e.canvas,o=(e=e.img,new r.Texture(i));l||(t.clearRect(0,0,i.width,i.height),t.translate(0,i.height),t.scale(1,-1),t.drawImage(e,0,0,i.width,i.height)),n(o)})).catch(i))}))})).then((function(e){var r=(e=t.isImageBitmapLoader?e:{texture:e,blob:null}).texture;return e=e.blob,!0===t.isImageBitmapLoader&&(r.userData.url=u,r.userData.blob=e),r.url=u,r})).catch((function(e){throw console.log(e,"error"),console.error("THREE.GLTFLoader: Couldn't load texture",u),e})),this.sourceCache[e]=n}},{key:"assignTexture",value:function(e,t,r){var n=this;return this.getDependency("texture",r.index).then((function(i){var o,a;return void 0===r.texCoord||0==r.texCoord||"aoMap"===t&&1==r.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+t+" not yet supported."),n.extensions[Se.KHR_TEXTURE_TRANSFORM]&&(o=void 0!==r.extensions?r.extensions[Se.KHR_TEXTURE_TRANSFORM]:void 0)&&(a=n.associations.get(i),i=n.extensions[Se.KHR_TEXTURE_TRANSFORM].extendTexture(i,o),n.associations.set(i,a)),e[t]=i}))}},{key:"assignFinalMaterial",value:function(e){var t,n,i=e.geometry,o=e.material,a=void 0===i.attributes.tangent,s=void 0!==i.attributes.color,l=void 0===i.attributes.normal;e.isPoints?(t="PointsMaterial:"+o.uuid,(n=this.cache.get(t))||(n=new r.PointsMaterial,r.Material.prototype.copy.call(n,o),n.color.copy(o.color),n.map=o.map,n.sizeAttenuation=!1,this.cache.add(t,n)),o=n):e.isLine&&(t="LineBasicMaterial:"+o.uuid,(n=this.cache.get(t))||(n=new r.LineBasicMaterial,r.Material.prototype.copy.call(n,o),n.color.copy(o.color),this.cache.add(t,n)),o=n),(a||s||l)&&(t="ClonedMaterial:"+o.uuid+":",o.isGLTFSpecularGlossinessMaterial&&(t+="specular-glossiness:"),a&&(t+="derivative-tangents:"),s&&(t+="vertex-colors:"),l&&(t+="flat-shading:"),(n=this.cache.get(t))||(n=o.clone(),s&&(n.vertexColors=!0),l&&(n.flatShading=!0),a&&(n.normalScale&&(n.normalScale.y*=-1),n.clearcoatNormalScale&&(n.clearcoatNormalScale.y*=-1)),this.cache.add(t,n),this.associations.set(n,this.associations.get(o)))),o.aoMap&&void 0===i.attributes.uv2&&void 0!==i.attributes.uv&&i.setAttribute("uv2",i.attributes.uv),this.options.myOptions.helper.material.process({material:o,materialDef:o.userData,model:e}),e.material=o}},{key:"getMaterialType",value:function(){return r.MeshStandardMaterial}},{key:"loadMaterial",value:function(e){var t,n=this,i=this.json,o=this.extensions,a=i.materials[e],s={},l=[],u=((i=a.extensions||{})[Se.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]?(u=o[Se.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS],t=u.getMaterialType(),l.push(u.extendParams(s,a,n))):i[Se.KHR_MATERIALS_UNLIT]?(u=o[Se.KHR_MATERIALS_UNLIT],t=u.getMaterialType(),l.push(u.extendParams(s,a,n))):(i=a.pbrMetallicRoughness||{},s.color=new r.Color(1,1,1),s.opacity=1,Array.isArray(i.baseColorFactor)&&(u=i.baseColorFactor,s.color.fromArray(u),s.opacity=u[3]),void 0!==i.baseColorTexture&&l.push(n.assignTexture(s,"map",i.baseColorTexture)),s.metalness=void 0!==i.metallicFactor?i.metallicFactor:1,s.roughness=void 0!==i.roughnessFactor?i.roughnessFactor:1,void 0!==i.metallicRoughnessTexture&&(l.push(n.assignTexture(s,"metalnessMap",i.metallicRoughnessTexture)),l.push(n.assignTexture(s,"roughnessMap",i.metallicRoughnessTexture))),t=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),l.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,s)}))))),!0===a.doubleSided&&(s.side=r.DoubleSide),a.alphaMode||"OPAQUE");return"BLEND"===u?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,"MASK"===u&&(s.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==r.MeshBasicMaterial&&(l.push(n.assignTexture(s,"normalMap",a.normalTexture)),s.normalScale=new r.Vector2(1,1),void 0!==a.normalTexture.scale&&(i=a.normalTexture.scale,s.normalScale.set(i,i))),void 0!==a.occlusionTexture&&t!==r.MeshBasicMaterial&&(l.push(n.assignTexture(s,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(s.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==r.MeshBasicMaterial&&(s.emissive=(new r.Color).fromArray(a.emissiveFactor)),void 0!==a.emissiveTexture&&t!==r.MeshBasicMaterial&&l.push(n.assignTexture(s,"emissiveMap",a.emissiveTexture)),Promise.all(l).then((function(){var i=t===Ge?o[Se.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(s):new t(s);return a.name&&(i.name=a.name),i.map&&(i.map.encoding=r.sRGBEncoding),i.emissiveMap&&(i.emissiveMap.encoding=r.sRGBEncoding),$e(i,a),n.associations.set(i,{materials:e}),a.extensions&&qe(o,i,a),i}))}},{key:"createUniqueName",value:function(e){for(var t=r.PropertyBinding.sanitizeNodeName(e||""),n=t,i=1;this.nodeNamesUsed[n];++i)n=t+"_"+i;return this.nodeNamesUsed[n]=!0,n}},{key:"loadGeometries",value:function(e){for(var t=this,n=this.extensions,i=this.primitiveCache,o=[],a=0,s=e.length;a<s;a++){var l=e[a],u=(c=void 0,c=(c=(u=l).extensions&&u.extensions[Se.KHR_DRACO_MESH_COMPRESSION])?"draco:"+c.bufferView+":"+c.indices+":"+et(c.attributes):u.indices+":"+et(u.attributes)+":"+u.mode),c=i[u];c?o.push(c.promise):(c=void 0,c=l.extensions&&l.extensions[Se.KHR_DRACO_MESH_COMPRESSION]?function(e){return n[Se.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(r){return nt(r,e,t)}))}(l):nt(new r.BufferGeometry,l,t),i[u]={primitive:l,promise:c},o.push(c))}return Promise.all(o)}},{key:"loadMesh",value:function(e){for(var t=this,n=this.json,i=this.extensions,o=n.meshes[e],a=o.primitives,s=[],l=0,u=a.length;l<u;l++){var c=void 0===a[l].material?(void 0===(c=this.cache).DefaultMaterial&&(c.DefaultMaterial=new r.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:r.FrontSide})),c.DefaultMaterial):this.getDependency("material",a[l].material);s.push(c)}return s.push(t.loadGeometries(a)),Promise.all(s).then((function(n){for(var s=n.slice(0,n.length-1),l=n[n.length-1],u=[],c=0,h=l.length;c<h;c++){var d=l[c],p=a[c],f=void 0,m=s[c];if(4===p.mode||5===p.mode||6===p.mode||void 0===p.mode)!0!==(f=new(!0===o.isSkinnedMesh?r.SkinnedMesh:r.Mesh)(d,m)).isSkinnedMesh||f.geometry.attributes.skinWeight.normalized||f.normalizeSkinWeights(),5===p.mode?f.geometry=it(f.geometry,r.TriangleStripDrawMode):6===p.mode&&(f.geometry=it(f.geometry,r.TriangleFanDrawMode));else if(1===p.mode)f=new r.LineSegments(d,m);else if(3===p.mode)f=new r.Line(d,m);else if(2===p.mode)f=new r.LineLoop(d,m);else{if(0!==p.mode)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+p.mode);f=new r.Points(d,m)}if(0<Object.keys(f.geometry.morphAttributes).length){A=w=x=b=y=g=void 0;var g=f,v=o;if(g.updateMorphTargets(),void 0!==v.weights)for(var y=0,b=v.weights.length;y<b;y++)g.morphTargetInfluences[y]=v.weights[y];if(v.extras&&Array.isArray(v.extras.targetNames)){var x=v.extras.targetNames;if(g.morphTargetInfluences.length===x.length){g.morphTargetDictionary={};for(var w=0,A=x.length;w<A;w++)g.morphTargetDictionary[x[w]]=w}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}f.name=t.createUniqueName(o.name||"mesh_"+e),$e(f,o),p.extensions&&qe(i,f,p),t.assignFinalMaterial(f),u.push(f)}for(var S=0,B=u.length;S<B;S++)t.associations.set(u[S],{meshes:e,primitives:S});if(1===u.length)return u[0];var M=new r.Group;t.associations.set(M,{meshes:e});for(var C=0,E=u.length;C<E;C++)M.add(u[C]);return M}))}},{key:"loadCamera",value:function(e){var t,n=(e=this.json.cameras[e])[e.type];if(n)return"perspective"===e.type?t=new r.PerspectiveCamera(r.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===e.type&&(t=new r.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),e.name&&(t.name=this.createUniqueName(e.name)),$e(t,e),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}},{key:"loadSkin",value:function(e){var t={joints:(e=this.json.skins[e]).joints};return void 0===e.inverseBindMatrices?Promise.resolve(t):this.getDependency("accessor",e.inverseBindMatrices).then((function(e){return t.inverseBindMatrices=e,t}))}},{key:"loadAnimation",value:function(e){for(var t=this.json.animations[e],n=[],i=[],o=[],a=[],s=[],l=0,u=t.channels.length;l<u;l++){var c=t.channels[l],h=t.samplers[c.sampler],d=void 0!==(c=c.target).node?c.node:c.id,p=void 0!==t.parameters?t.parameters[h.input]:h.input,f=void 0!==t.parameters?t.parameters[h.output]:h.output;n.push(this.getDependency("node",d)),i.push(this.getDependency("accessor",p)),o.push(this.getDependency("accessor",f)),a.push(h),s.push(c)}return Promise.all([Promise.all(n),Promise.all(i),Promise.all(o),Promise.all(a),Promise.all(s)]).then((function(n){for(var i=n[0],o=n[1],a=n[2],s=n[3],l=n[4],u=[],c=0,h=i.length;c<h;c++)!function(e){var t=i[e],n=o[e],c=a[e],h=s[e],d=l[e];if(void 0!==t){t.updateMatrix(),t.matrixAutoUpdate=!0;var p=void 0;switch(Ze[d.path]){case Ze.weights:p=r.NumberKeyframeTrack;break;case Ze.rotation:p=r.QuaternionKeyframeTrack;break;default:p=r.VectorKeyframeTrack}e=t.name||t.uuid;var f=void 0!==h.interpolation?Ye[h.interpolation]:r.InterpolateLinear,m=[],g=(Ze[d.path]===Ze.weights?t.traverse((function(e){e.morphTargetInfluences&&m.push(e.name||e.uuid)})):m.push(e),c.array);if(c.normalized){for(var v=tt(g.constructor),y=new Float32Array(g.length),b=0,x=g.length;b<x;b++)y[b]=g[b]*v;g=y}for(var w=0,A=m.length;w<A;w++){var S=new p(m[w]+"."+Ze[d.path],n.array,g,f);"CUBICSPLINE"===h.interpolation&&(S.createInterpolant=function(e){return new(this instanceof r.QuaternionKeyframeTrack?Ve:Ne)(this.times,this.values,this.getValueSize()/3,e)},S.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),u.push(S)}}}(c);return n=t.name||"animation_"+e,new r.AnimationClip(n,void 0,u)}))}},{key:"createNodeMesh",value:function(e){var t=this.json,r=this,n=t.nodes[e];return void 0===n.mesh?null:r.getDependency("mesh",n.mesh).then((function(e){return e=r._getNodeRef(r.meshCache,n.mesh,e),void 0!==n.weights&&e.traverse((function(e){if(e.isMesh)for(var t=0,r=n.weights.length;t<r;t++)e.morphTargetInfluences[t]=n.weights[t]})),e}))}},{key:"loadNode",value:function(e){var t,n=this.json,i=this.extensions,o=this,a=n.nodes[e],s=a.name?o.createUniqueName(a.name):"";return t=[],(n=o._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)})))&&t.push(n),void 0!==a.camera&&t.push(o.getDependency("camera",a.camera).then((function(e){return o._getNodeRef(o.cameraCache,a.camera,e)}))),o._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){t.push(e)})),Promise.all(t).then((function(t){var n,l=!0===a.isBone?new r.Bone:1<t.length?new r.Group:1===t.length?t[0]:new r.Object3D;if(l!==t[0])for(var u=0,c=t.length;u<c;u++)l.add(t[u]);return a.name&&(l.userData.name=a.name,l.name=s),$e(l,a),a.extensions&&qe(i,l,a),void 0!==a.matrix?((n=new r.Matrix4).fromArray(a.matrix),l.applyMatrix4(n)):(void 0!==a.translation&&l.position.fromArray(a.translation),void 0!==a.rotation&&l.quaternion.fromArray(a.rotation),void 0!==a.scale&&l.scale.fromArray(a.scale)),o.associations.has(l)||o.associations.set(l,{}),o.associations.get(l).nodes=e,o.options.myOptions.helper.processNode({node:l,nodeDef:a})||l}))}},{key:"loadScene",value:function(e){for(var t=this.json,n=this.extensions,i=(e=this.json.scenes[e],this),o=new r.Group,a=(o.isLoadScene=!0,e.name&&(o.name=i.createUniqueName(e.name)),$e(o,e),e.extensions&&qe(n,o,e),e.nodes||[]),s=[],l=0,u=a.length;l<u;l++)s.push(function e(t,n,i,o){var a=i.nodes[t];return o.getDependency("node",t).then((function(e){return void 0===a.skin?e:o.getDependency("skin",a.skin).then((function(e){for(var r=[],n=0,i=(t=e).joints.length;n<i;n++)r.push(o.getDependency("node",t.joints[n]));return Promise.all(r)})).then((function(n){return e.traverse((function(e){if(e.isMesh){for(var i=[],o=[],a=0,s=n.length;a<s;a++){var l=n[a];l?(i.push(l),l=new r.Matrix4,void 0!==t.inverseBindMatrices&&l.fromArray(t.inverseBindMatrices.array,16*a),o.push(l)):console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[a])}e.bind(new r.Skeleton(i,o),e.matrixWorld)}})),e}));var t})).then((function(t){n.isLoadScene&&null!=(r=i.asset.ex)&&r.type,n.add(t);var r,s=[];if(a.children)for(var l=a.children,u=0,c=l.length;u<c;u++){var h=l[u];s.push(e(h,t,i,o))}return Promise.all(s)}))}(a[l],o,t,i));return Promise.all(s).then((function(){return i.options.myOptions&&i.options.myOptions.models.push(o),i.associations=function(e){var t,n=new Map,o=le(i.associations);try{for(o.s();!(t=o.n()).done;){var a=se(t.value,2),s=a[0],l=a[1];(s instanceof r.Material||s instanceof r.Texture)&&n.set(s,l)}}catch(e){o.e(e)}finally{o.f()}return e.traverse((function(e){var t=i.associations.get(e);null!=t&&n.set(e,t)})),n}(o),o}))}}]),e}();function nt(e,t,n){var i,o=t.attributes,a=[];for(i in o){var s=Qe[i]||i.toLowerCase();s in e.attributes||a.push(function(t,r){return n.getDependency("accessor",t).then((function(t){e.setAttribute(r,t)}))}(o[i],s))}void 0===t.indices||e.index||(l=n.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)})),a.push(l)),$e(e,t);var l=e,u=t,c=n,h=u.attributes,d=new r.Box3;if(void 0!==h.POSITION){var p=(h=c.json.accessors[h.POSITION]).min,f=h.max;if(void 0===p||void 0===f)console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");else{d.set(new r.Vector3(p[0],p[1],p[2]),new r.Vector3(f[0],f[1],f[2])),h.normalized&&(p=tt(Je[h.componentType]),d.min.multiplyScalar(p),d.max.multiplyScalar(p));var m=u.targets;if(void 0!==m){for(var g=new r.Vector3,v=new r.Vector3,y=0,b=m.length;y<b;y++){var x,w,A=m[y];void 0!==A.POSITION&&(w=(A=c.json.accessors[A.POSITION]).min,x=A.max,void 0!==w&&void 0!==x?(v.setX(Math.max(Math.abs(w[0]),Math.abs(x[0]))),v.setY(Math.max(Math.abs(w[1]),Math.abs(x[1]))),v.setZ(Math.max(Math.abs(w[2]),Math.abs(x[2]))),A.normalized&&(w=tt(Je[A.componentType]),v.multiplyScalar(w)),g.max(v)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION."))}d.expandByVector(g)}l.boundingBox=d,f=new r.Sphere,d.getCenter(f.center),f.radius=d.min.distanceTo(d.max)/2,l.boundingSphere=f}}return Promise.all(a).then((function(){if(void 0===t.targets)return e;for(var r=e,i=t.targets,o=n,a=!1,s=!1,l=!1,u=0,c=i.length;u<c;u++){var h=i[u];if(void 0!==h.POSITION&&(a=!0),void 0!==h.NORMAL&&(s=!0),void 0!==h.COLOR_0&&(l=!0),a&&s&&l)break}if(!a&&!s&&!l)return Promise.resolve(r);for(var d=[],p=[],f=[],m=0,g=i.length;m<g;m++){var v,y=i[m];a&&(v=void 0!==y.POSITION?o.getDependency("accessor",y.POSITION):r.attributes.position,d.push(v)),s&&(v=void 0!==y.NORMAL?o.getDependency("accessor",y.NORMAL):r.attributes.normal,p.push(v)),l&&(y=void 0!==y.COLOR_0?o.getDependency("accessor",y.COLOR_0):r.attributes.color,f.push(y))}return Promise.all([Promise.all(d),Promise.all(p),Promise.all(f)]).then((function(e){var t=e[0],n=e[1];return e=e[2],a&&(r.morphAttributes.position=t),s&&(r.morphAttributes.normal=n),l&&(r.morphAttributes.color=e),r.morphTargetsRelative=!0,r}))}))}function it(e,t){var n=e.getIndex();if(null===n){var i=[],o=e.getAttribute("position");if(void 0===o)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var a=0;a<o.count;a++)i.push(a);e.setIndex(i),n=e.getIndex()}var s=n.count-2,l=[];if(t===r.TriangleFanDrawMode)for(var u=1;u<=s;u++)l.push(n.getX(0)),l.push(n.getX(u)),l.push(n.getX(u+1));else for(var c=0;c<s;c++)c%2==0?(l.push(n.getX(c)),l.push(n.getX(c+1)),l.push(n.getX(c+2))):(l.push(n.getX(c+2)),l.push(n.getX(c+1)),l.push(n.getX(c)));return l.length/3!=s&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles."),(t=e.clone()).setIndex(l),t}__webpack_require__(8409);var ot=__webpack_require__(5259),at=__webpack_require__(6999),st=__webpack_require__(5105),lt=__webpack_require__(811),ut=__webpack_require__(1736),ct=__webpack_require__(5410),ht=__webpack_require__(9197),dt=__webpack_require__(1994);class pt{constructor(e,t){this.materialMap={},this.textureMap={},this.materialIns={},this.textureIns={},this.pending=[],this.clonedTextures=[],this.parser=null,this.processTextureMap=(()=>{const e=e=>{const{target:t,data:r}=e;var n;r&&(({x:e,y:n}="object"==typeof r?r:{x:r,y:r}),t.x=e,t.y=n)};return t=>{(0,z.js)(t,((t,r)=>{var{format:r,center:n,rotation:i,offset:o,repeat:a}=r;const s=this.textureIns[t];s&&(s.format=r,e({target:s.repeat,data:a}),e({target:s.center,data:n}),e({target:s.offset,data:o}),i&&(s.rotation=i),this.runScene.textureEx.initTextureAndAddtoAll(s))}))}})(),this.processMaterialMap=(()=>{const e=e=>{const{textures:t,normal:r,models:n,material:i}=e;this.runScene.optionsEx.options.texture.load&&this.processBaseMaterialTextures({material:i,textures:t}),this.runScene.materialEx.parseNromals(r,i),n.map((e=>e.material=i))},t=e=>{const{textures:t,normal:r,models:n,material:i}=e;e=(0,z.js)(t,((e,t)=>({type:e,texture:this.textureIns[t]})));const o=this.runScene.materialEx.getDataByType(r.type,{normal:r,textures:e,models:n,material:i});this.runScene.materialEx.parseNromals(r,o),o&&n.map((e=>e.material=o))};return r=>{(0,z.js)(r,((r,n)=>{if(r=this.materialIns[r]){const{material:i,models:o}=r;i&&(({normal:r,textures:n}=n),(r.type?t:e)({textures:n,models:o,material:i,normal:r}),i.needsUpdate=!0)}}))}})(),this.baseMaterialTextures=[],this.processBaseMaterialTextures=e=>{const{textures:t,material:r}=e;(0,z.js)(t,((e,t)=>{var n;(t=this.textureIns[t])&&(this.runScene.optionsEx.options.texture.lazyLoad.open&&"scene"===(null==(n=this.parser)?void 0:n.json.asset.ex.type)&&(null==(n=this.parser)?void 0:n.json.asset.ex.sceneEx.materialId)!==r.userData.id?this.baseMaterialTextures.push({material:r,type:e,texture:t}):(this.runScene.uniqueEx.texture.addMaterial(t,{material:r,type:e}),(0,ht.setMaterialTexture)({material:r,type:e,texture:t})))}))},this.lazyLoad=(()=>{const e=()=>{var e;this.loadConfig.triggerCb&&this.runScene.cb.loaderer.gltf.lazyLoadedTexture.cb(""),null!=(e=this.loadConfig)&&e.lazyLoadedTexture(),this.runScene.optionsEx.log("贴图懒加载完毕","base","success")},t=(r,n)=>{var i=this.baseMaterialTextures[r];if(!i)return n(),e();const{texture:o,type:a,material:s}=i;this.runScene.uniqueEx.texture.addMaterial(o,{material:s,type:a}),(0,ht.setMaterialTexture)({material:s,type:a,texture:o}),s.needsUpdate=!0,setTimeout((()=>t(++r,n)),this.runScene.optionsEx.options.texture.lazyLoad.intervalTime)};return()=>new Promise((r=>{if(!this.runScene.optionsEx.options.texture.lazyLoad.open)return r(0),e();t(0,r)}))})(),this.runScene=e,this.loadConfig=t}processInput(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){this.parser=t}))}processTexture(e){const{textureDef:t,texture:r}=e;var{md5:e,format:n,size:i,uvScript:o,id:a,cloneSourceId:s,minFilter:l}=t;r.userData.md5=e,n&&(r.format=n,r.userData.format=n),o&&(r.userData.uvScript=o),s&&((0,ut.setTextureCloneId)(r,s),this.clonedTextures.push(r)),"nearest"===l&&((0,ut.setTextureMinFilter)(r,"nearest"),(0,dt.M)(r,"minFilter",l)),r.userData.id=a,r.userData.size=i,this.textureIns[t.id]=this.runScene.textureEx.getSameTexture(e,r)||r}process(e){var{materialDef:e,material:t,model:r}=e;(0,ht.initMaterial)(t),this.materialIns[e.id]||(this.materialIns[e.id]={material:t,models:[]}),this.materialIns[e.id].models.push(r)}done(e){var{materialMap:e,textureMap:t}=e.asset.ex||{};return this.processTextureMap(t||{}),this.processMaterialMap(e||{}),this.processClonedTextures(),this.pending.push(this.lazyLoad()),Promise.all(this.pending)}processClonedTextures(){this.clonedTextures.map((e=>{var t=(0,ut.getCloneIdFromTexture)(e);(t=this.textureIns[t])?(e.image=t.image,e.needsUpdate=!0,e.userData.blob=t.userData.blob,e.userData.md5=t.userData.md5,e.userData.url=t.userData.url,(0,ut.bindTextureBaseData)(e)):(this.runScene.textureEx.delete(e),(0,dt.bv)(e,"cloneSourceId"),(0,ut.disposeTexture)(e))}))}}class ft{constructor(e,t){this.runScene=e,this.loadConfig=t}setTextureLoader(e){this.textureLoader=e,this.initTextureLoader(e)}initTextureLoader(e){e instanceof oe&&e.setOptions({reverseTexture:this.loadConfig.reverseTexture,textureQuality:this.runScene.optionsEx.options.texture.quality})}}class mt{constructor(e,t){this.runScene=e,this.loadConfig=t}done(e){var t,r,n,i;e.asset.ex&&(({camera:e,lights:t,options:r,controls:n,tags:i}=e.asset.ex),this.runScene.tags.parseJSON(i||{}),this.camera(e),this.controls(n),this.lights(t),this.options(r))}controls(e){var t,r;e&&(({x:e,y:t,z:r}=e),this.runScene.assetsEx.controls.target.set(e,t,r),this.runScene.assetsEx.controls.update())}camera(e){var{position:e,far:t,near:r,fov:n,name:i,userData:o}=this.runScene.loaderer.object.parse(e);const a=this.runScene.assetsEx.get().camera;a.position.copy(e),a.far=t,a.near=r,a.fov=n,a.name=i,a.updateProjectionMatrix(),a.userData.id=o.id,this.runScene.uniqueEx.model.add(a),this.runScene.assetsEx.get().controls.update()}lights(e){e.map((e=>{var t=e.type;(t=this.runScene.lightEx.lightExMap[t].parseJSON(e)).target&&this.runScene.modelEx.setSelectByModel(t.target),this.runScene.lightEx.setNull(t)}))}options(e){e.map((e=>{var{type:e,data:t}=e;const r=this.runScene.exporter.gltf.options.getParse(e);null!=r&&r.parse(t)}))}}class gt{constructor(e,t){this.helperModels=[],this.pending=[],this.nodeMap=new ot.Z,this.instancedMap={},this.clonedMap={},this.nodeType={MySpriteMaterial:st.Z},this.runScene=e,this.loadConfig=t,this.material=new pt(e,t),this.scene=new mt(e,t),this.options=new ft(e,t)}processInput(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){this.material.processInput(e,t)}))}beforeLoader(e){null!=(t=this.loadConfig)&&t.triggerCb&&this.runScene.cb.loaderer.gltf.getJSON.cb(e);var t=this.processBase64(e);return this.runScene.loaderer.gltf.beforeParse(null==(e=null==(e=e.asset)?void 0:e.ex)?void 0:e.type),"editor"===this.runScene.optionsEx.options.mode||t}processBase64(e){return!e.asset.ex||!(e=e.asset.ex.base64)||!!(e=(0,ct.Ne)(e))&&(e=Number(e),!isNaN(e)&&(new Date).getTime()<e)}processNode(e){let{node:t,nodeDef:r}=e;if((0,z.js)(this.runScene.modelEx.defNodeMap,((e,n)=>{var i=r[e];null!=i&&(t[e]=i)})),r.extras){const{layers:o,normal:a,local:s,cloneId:l,id:u,animations:c,isDynamic:h}=r.extras;var n,i;if(e=(0,lt.isDynamicModel)(t,!0),"running"!==this.runScene.optionsEx.options.mode||e||this.runScene.optionsEx.options.renderConfig.matrixAutoUpdate||(t.matrixAutoUpdate=!1),u&&this.nodeMap.set(u,t),c&&(t.animations=wt.parse(c)),h&&(t.userData.isDynamic=!0),!l||e||(this.instancedMap[l]||(this.instancedMap[l]=new Set),this.instancedMap[l].add(t)),s&&([e,n,i]=s.split(","),t.position.set(e,n,i)),o&&(t.layers.enable(1),this.runScene.cb.model.setLayers.cb({model:t,val:1})),r.extras.isHelper&&this.helperModels.push(t),a&&(e=this.nodeType[null==a?void 0:a.type].modelTools.parseData(t,a),t=e),e=null==(i=null==(n=null==t?void 0:t.material)?void 0:n.userData)?void 0:i.id){const r=this.material.materialIns[e];r&&r.models.push(t)}}return r.wireframe&&(t.material.wireframe=!0),t}done(e){var t;return this.pending.push(this.material.done(e)),"scene"===(null==(t=e.asset.ex)?void 0:t.type)&&(this.scene.done(e),this.sceneEx(e)),this.removeHelperModel(),Promise.all(this.pending)}mergeGeometry(){}mergeClone(){var e;this.runScene.optionsEx.options.instanceClone&&"running"===this.runScene.optionsEx.options.mode&&(this.runScene.assetsEx.scene.updateMatrixWorld(),e=this.instancedMap,(0,z.js)(e,((e,t)=>{var r,n=this.runScene.uniqueEx.model.map[e];t.size<2||!n||!n.geometry||(0,lt.isDynamicModel)(n,!0)||(r=(0,lt.instanceModel)(n,[...t]),this.runScene.modelEx.add(r,void 0,{isClone:!1,select:!1,addUndo:!1}),(0,lt.isGLowModel)(n)&&this.runScene.modelEx.setGlow(r,!0),this.runScene.modelEx.remove(n,!1),t.forEach((e=>this.runScene.modelEx.remove(e,!1))),t.clear(),delete this.instancedMap[e])}))),this.instancedMap={}}sceneEx(e){const t=this.runScene.sceneEx.get();var n=this.material.materialIns,{materialId:e,backgroundMapping:i,backgroundColor:o,fog:a}=e.asset.ex.sceneEx;if(e&&(e=null==(n=n[e])?void 0:n.material)){const{map:r,envMap:n}=e;r&&(r.mapping=i||300,r.needsUpdate=!0,this.runScene.sceneEx.setBackground(r,!1),r.userData.isBackgroud=!0),n&&(t.environment=(0,ut.setTextureMapping)(n))}o&&(t.background=new r.Color("#"+o)),a&&(({color:n,far:e,near:i}=a),o=new r.Fog("#"+n,i,e),t.fog=o,t.fog.open="true",this.runScene.cb.setScene.cb({scene:t,type:"fog",val:o})),this.runScene.cb.setScene.cb({scene:t,type:"any",val:"any"})}removeHelperModel(){this.helperModels.map((e=>{var t;return null==(t=e.parent)?void 0:t.remove(e)}))}}class vt{constructor(e){this.dracoPath="./draco/",this._gltf=new we,this.runScene=e;const t=new Y;t.setDecoderPath(this.runScene.optionsEx.options.decodePath),this._gltf.setMeshoptDecoder(K),this._gltf.setDRACOLoader(t)}load(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){var r=yield H().get(e,{responseType:"arraybuffer",onDownloadProgress:e=>{var{total:e,loaded:r}=e;let n=r/e;1<(n=n<0?0:n)&&(n=1);var r=Number(n.toFixed(2));e=Math.floor(100*r),null!=(r=null==t?void 0:t.progress)&&r.call(t,e),this.runScene.optionsEx.log("下载场景进度:"+e,"detail"),null!=t&&t.triggerCb&&this.runScene.cb.loaderer.gltf.progress.cb(e)}}).then((e=>e.data)).catch((e=>{this.runScene.optionsEx.log("下载场景失败:",e)}));return r?this.parse(r,t):Promise.resolve()}))}parse(e,t){var r;const n=(0,ae.mergeObject)({addToScene:!0,cleanJSON:!0,triggerCb:!1,reverseTexture:!1},t);return null!=(r=null==t?void 0:t.getArrayBuffer)&&r.call(t,e),null!=n&&n.triggerCb&&this.runScene.cb.loaderer.gltf.getArrayBuffer.cb(e),new Promise((t=>{try{e instanceof ArrayBuffer&&this._gltf.parse(e,"",(e=>{e=this.afterParse(e.parser.options.myOptions,e,n),t(e)}),(e=>{console.log(e,"_a")}),{rootModel:this.runScene.assetsEx.get().scene,models:[],helper:new gt(this.runScene,n),runScene:this.runScene,loadConfig:n})}catch(e){throw this.runScene.optionsEx.log("加载场景出错:"+e),TypeError(e)}}))}beforeParse(e){"scene"===e&&this.runScene.optionsEx.sceneOptions.loaded&&this.runScene.sceneEx.clean()}afterParse(e,t,r){const n=e.helper.done(t),{addToScene:i,cleanJSON:o,triggerCb:a,getJSON:s}=r,l=e.models;a&&this.runScene.cb.loaderer.gltf.modelLoaded.cb(l),null!=(c=null==r?void 0:r.modelLoaded)&&c.call(r,l);let u=[];var c=(t.asset.ex||{}).type;return"material"===c?this.parseMaterial(l):("model"===c?u=this.parseModel(l[0]):(u=this.parseScene({model:l[0],json:t,config:r}),this.runScene.optionsEx.sceneOptions.loaded=!0),i&&this.runScene.modelEx.add(u,void 0,{addUndo:!1,select:!1,isClone:"model"===(null==(c=t.asset.ex)?void 0:c.type)}),this.runScene.modelEx.selectNull(),this.runScene.timeLineEx.parseSavedGroupMap((null==(c=t.asset.ex)?void 0:c.timeLine)||{}),i&&e.helper.mergeClone(),this.runScene.optionsEx.log(t,"detail"),n.then((()=>{var e;null!=(e=null==r?void 0:r.complete)&&e.call(r,{models:l,json:t}),a&&this.runScene.cb.loaderer.gltf.complete.cb({models:l,json:t})}))),null!=s&&s(t),o&&this.disposeJSON(t),u}parseMaterial(e){var t,[e]=e;if(e=this.runScene.sceneEx.cleanUnlessLevel(e).material)return this.runScene.materialEx.add(e),({select:t}=this.runScene.modelEx),t&&this.runScene.materialEx.resetMaterial(t,e,{addUndo:!0}),e}parseModel(e){return[e="glb_model"===e.name&&(null==e?void 0:e.children[0])||e]}parseScene(e){const{model:t,json:r,config:n}=e;e=n.triggerCb;var i=t.children.filter((e=>this.runScene.modelEx.isUnless(e)?void 0:e));if(1===i.length){const[e]=i;e.animations=[...e.animations,...r.animations]}return e&&this.runScene.cb.loaderer.gltf.loaded.cb(""),null!=(e=null==n?void 0:n.loaded)&&e.call(n),i}disposeJSON(e){}}class yt{constructor(e){this._objectLoader=new r.ObjectLoader,this.runScene=e,this._parser=new bt(e)}parse(e){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){var t=yield this._objectLoader.parseAsync(JSON.parse(e));return this._parser.afterParse(this.runScene.sceneEx.cleanUnlessLevel(t))}))}}class bt{constructor(e){this.runScene=e}parseModel(e){e.material&&this.parseMaterial(e)}parseMaterial(e){var t=e.material;"SpriteMaterial"===t.type&&(0,dt.M)(t,"tools",st.Z.tools),this.runScene.uniqueEx.material.add(e.material)}afterParse(e){return e instanceof Array?e.map((e=>{e.traverse((e=>{this.parseModel(e)}))})):e.traverse((e=>{this.parseModel(e)})),e}}class xt{constructor(e){this.imgBitMap=new r.ImageBitmapLoader,this.object=new r.ObjectLoader,this.runScene=e,this.gltf=new vt(e),this.json=new yt(e)}}const wt=new class{constructor(){this.load=new r.AnimationLoader}parse(e){return this.load.parse(e)}};class At extends V{constructor(e){super(e),this.map={},this.clock=new r.Clock,this.tickIndex=void 0,this.playings=new Set,this.updates={},e.cb.model.add.add("anima-parse",(({model:e})=>{this.parses(e)})),e.cb.model.remove.add("anima-parse",(({model:e})=>{this.onModelDelete(e)}))}onModelDelete(e){e.traverse((e=>{(0,lt.withAnima)(e)&&e.animations.map((t=>{t.id&&(this.close(e,t.name),delete this.map[t.id])}))}))}parses(e){e.traverse((e=>this.parse(e)))}findId(e,t){for(const r of e.animations)if(r.name===t)return r.id}parse(e,t){if(0!==e.animations.length||t){const o=e.animations.length?e.animations:wt.parse(t),a=new r.AnimationMixer(e);for(const t of o){var n=(0,N.getId)(),i=(t.id=n,a.clipAction(t));const r={finished:()=>{},loop:()=>{}};a.addEventListener("finished",(()=>r.finished())),a.addEventListener("loop",(()=>r.loop())),this.map[n]={mixer:a,action:i,model:e,time:0,runState:"close",clip:t,eventMap:r}}o.map((t=>{e.animations.find((e=>e.uuid===t.uuid))||e.animations.push(t)}))}}play(e,t,r){e=this.findId(e,t);const n=this.map[e];if(n&&!this.playings.has(n)){t=(0,ae.mergeObject)({onLoop:()=>{},onProgress:()=>{},onFinished:()=>{},onClose:()=>{},onPause:()=>{},onResume:()=>{},onBeforeEnd:()=>{},loop:!1,lastFrame:!0,reset:!0},r);const{onProgress:i,onBeforeEnd:o,onLoop:a,onFinished:s,lastFrame:l,loop:u,reset:c}=t,{action:h,clip:d,eventMap:p}=(this.map[e].options=t,n);h.stop(),r=c?0:n.time,h.time=r,this.setPlayState(n,!0),c&&h.reset(),h.play();let f=!(n.runState="play");this.setUpdates(e,(()=>{var e=(0,ae.getProgress)(h.time,d.duration,!0);99<=e&&!f&&(o(),f=!0),i(e)})),u?(h.loop=at.Z.LoopRepeat,p.loop=a):(l&&(h.clampWhenFinished=!0),h.loop=at.Z.LoopOnce,p.finished=()=>{this.setPlayState(n,!1),i(100),s()})}}pause(e,t){e=this.findId(e,t);const r=this.map[e];r&&this.playings.has(r)&&(this.updateTime(r),this.setPlayState(r,!1),r.options.onPause(),r.runState="pause")}resume(e,t){var r=this.findId(e,t);const n=this.map[r];n&&this.playings.has(n)&&(n.options.onResume(),this.play(e,t,null==(r=this.map[t])?void 0:r.options))}playAll(){this.pauseAll(),this.playings.clear(),Object.values(this.map).map((e=>{this.playings.add(e);const t=e.action;t.time=0,t.play()})),this.anima()}setValue(e){let t=this.clock.getDelta();Object.keys(this.map).map((r=>{const{mixer:n,action:i}=this.map[r];i.play(),i.time=e,n.update(t)}))}getDetal(){return this.clock.getDelta()}update(e){const t=e||this.getDetal();(0,z.js)(this.updates,((e,r)=>r(t)))}anima(){let e=this.clock.getDelta();this.update(e),this.playings.forEach((t=>{t.mixer.update(e)})),this.tickIndex=window.requestAnimationFrame(this.anima.bind(this))}closeAnima(){window.cancelAnimationFrame(this.tickIndex)}resetItem(e){const{mixer:t,action:r}=e;r.reset(),r.stop(),t.time=0}pauseAll(){this.closeAnima(),this.playings.forEach((e=>this.resetItem(e))),this.playings.clear()}reset(){this.pauseAll(),this.map={},this.playings.clear(),this.closeAnima()}updateTime(e,t){e.time=t||e.action.time}setPlayState(e,t){t?(this.playings.add(e),1===this.playings.size&&this.anima()):(this.playings.delete(e),delete this.updates[e.clip.id],0===this.playings.size&&this.closeAnima())}getItem(e,t){return e=this.findId(e,t),this.map[e]}close(e,t,r){e=this.findId(e,t);const n=this.map[e];n&&this.playings.has(n)&&n.options&&((t=(0,ae.mergeObject)({resetAction:!0},r).resetAction)&&n.action.reset(),this.setPlayState(n,!1),this.updateTime(n,0),n.options.onClose(),n.options=null,n.runState="pause")}setUpdates(e,t){this.updates[e]=t}fadeTo(e){var{lastModel:e,lastName:t,nextModel:r,nextName:n,duration:i}=e;e=this.findId(e,t);const o=this.map[e];o&&(t=this.findId(r,n),(e=this.map[t])&&o.action.crossFadeTo(e.action,i,!0))}resetTime(e,t){const r=this.getItem(e,t);r&&(r.action.time=0)}}var St=__webpack_require__(8235),Bt=__webpack_require__(2430);class Mt{constructor(e){this.scene=null,this.camera=null,this.controls=null,this.renderer=null,this.engineDom=null,this.disposeRender=e=>{e&&(e.render=()=>{},e.domElement.remove())},this.runScene=e}initRender3(){const e=new St.lX;return e.setSize(this.engineDom.clientWidth,this.engineDom.clientHeight),e.domElement.style.position="absolute",e.domElement.style.top=String(0),e.domElement.className="css3dRenderer",this.engineDom.appendChild(e.domElement),this.runScene.cb.resize.add("render-3",(({width:t,height:r})=>{e.setSize(t,r)})),e}initRender2(){const e=new Bt.M;return e.setSize(this.engineDom.clientWidth,this.engineDom.clientHeight),e.domElement.style.position="absolute",e.domElement.classList.add("css2dRenderer"),e.domElement.style.top="0px",e.domElement.style.left="0px",this.engineDom.insertBefore(e.domElement,this.engineDom.childNodes[0]),this.runScene.cb.resize.add("render-2",(({width:t,height:r})=>{e.setSize(t,r)})),e}reset(){this.renderer=this.runScene.renderEx.create(this.engineDom),this.runScene.renderEx.setSize(),this.renderer.setAnimationLoop(this.runScene.render.bind(this.runScene));var e=this.camera;this.controls=this.runScene.controlsEx.create(e,this.renderer.domElement)}dispose(){this.disposeRender(this.render2),this.disposeRender(this.render3)}setRender2(e){e?this.render2=this.initRender2():this.render2&&(this.disposeRender(this.render2),this.render2=null)}setRender3(e){e?this.render3=this.initRender3():this.render3&&(this.disposeRender(this.render3),this.render3=null)}init(e){var t=this.runScene.sceneEx.create(),r=this.runScene.cameraEx.create(),n=this.runScene.renderEx.create(e),i=this.runScene.controlsEx.create(r,e),{render2:o,render3:a}=this.runScene.optionsEx.options;return this.camera=r,this.scene=t,this.renderer=n,this.controls=i,this.engineDom=e,this.runScene.renderEx.setSize(),this.setRender2(o),this.setRender3(a),{scene:t,camera:r,render:n,controls:i,engineDom:e}}get(){var{scene:e,camera:t,renderer:r,controls:n,engineDom:i}=this;return{scene:e,camera:t,renderer:r,controls:n,engineDom:i}}}class Ct{constructor(e){this.modelLength=new Set,this.runScene=e,this.init()}init(){const{setLayers:e,add:t,remove:r}=this.runScene.cb.model;e.add("glow-set-layers",(e=>{var{model:e,val:t}=e;0===t&&0===this.modelLength.size||this[0===t?"remove":"add"](e)})),r.add("glow-set-layers",(({model:e})=>{1!==e.layers.mask&&this.remove(e)})),t.add("glow-set-layers",(({model:e})=>{1!==e.layers.mask&&this.add(e)}))}add(e){this.modelLength.add(e.userData.id),0<this.modelLength.size&&(this.runScene.cb.bloom.glow.setStatus.cb(!0),this.runScene.bloom.glow.bloomParams.isBloom=!0)}remove(e){this.modelLength.delete(e.userData.id),this.modelLength.size<=0&&(this.runScene.cb.bloom.glow.setStatus.cb(!1),this.runScene.bloom.glow.bloomParams.isBloom=!1)}}var Et={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform float opacity;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tgl_FragColor = texture2D( tDiffuse, vUv );\n\t\t\tgl_FragColor.a *= opacity;\n\n\n\t\t}"},_t=__webpack_require__(8493),Tt=__webpack_require__(8512),Dt={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new r.Color(0)},defaultOpacity:{value:0}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform vec3 defaultColor;\n\t\tuniform float defaultOpacity;\n\t\tuniform float luminosityThreshold;\n\t\tuniform float smoothWidth;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\n\t\t\tvec3 luma = vec3( 0.299, 0.587, 0.114 );\n\n\t\t\tfloat v = dot( texel.xyz, luma );\n\n\t\t\tvec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );\n\n\t\t\tfloat alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );\n\n\t\t\tgl_FragColor = mix( outputColor, texel, alpha );\n\n\t\t}"};function Rt(e){return(Rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ot(e,t){return(Ot=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Pt(e){return(Pt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var It=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ot(t,e);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Pt(e);if(r=t?(r=Pt(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Rt(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e,t,o,a){var s;if(!(this instanceof i))throw new TypeError("Cannot call a class as a function");(s=n.call(this)).strength=void 0!==t?t:1,s.radius=o,s.threshold=a,s.resolution=void 0!==e?new r.Vector2(e.x,e.y):new r.Vector2(256,256),s.clearColor=new r.Color(0,0,0),s.renderTargetsHorizontal=[],s.renderTargetsVertical=[],s.nMips=5;var l=Math.round(s.resolution.x/2),u=Math.round(s.resolution.y/2);s.renderTargetBright=new r.WebGLRenderTarget(l,u),s.renderTargetBright.texture.name="UnrealBloomPass.bright",s.renderTargetBright.texture.generateMipmaps=!1;for(var c=0;c<s.nMips;c++){var h;((h=new r.WebGLRenderTarget(l,u)).texture.name="UnrealBloomPass.h"+c,h.texture.generateMipmaps=!1,s.renderTargetsHorizontal.push(h),h=new r.WebGLRenderTarget(l,u)).texture.name="UnrealBloomPass.v"+c,h.texture.generateMipmaps=!1,s.renderTargetsVertical.push(h),l=Math.round(l/2),u=Math.round(u/2)}o=Dt;for(var d=(s.highPassUniforms=r.UniformsUtils.clone(o.uniforms),s.highPassUniforms.luminosityThreshold.value=a,s.highPassUniforms.smoothWidth.value=.01,s.materialHighPassFilter=new r.ShaderMaterial({uniforms:s.highPassUniforms,vertexShader:o.vertexShader,fragmentShader:o.fragmentShader,defines:{}}),s.separableBlurMaterials=[],[3,5,7,9,11]),p=(l=Math.round(s.resolution.x/2),u=Math.round(s.resolution.y/2),0);p<s.nMips;p++)s.separableBlurMaterials.push(s.getSeperableBlurMaterial(d[p])),s.separableBlurMaterials[p].uniforms.texSize.value=new r.Vector2(l,u),l=Math.round(l/2),u=Math.round(u/2);return s.compositeMaterial=s.getCompositeMaterial(s.nMips),s.compositeMaterial.uniforms.blurTexture1.value=s.renderTargetsVertical[0].texture,s.compositeMaterial.uniforms.blurTexture2.value=s.renderTargetsVertical[1].texture,s.compositeMaterial.uniforms.blurTexture3.value=s.renderTargetsVertical[2].texture,s.compositeMaterial.uniforms.blurTexture4.value=s.renderTargetsVertical[3].texture,s.compositeMaterial.uniforms.blurTexture5.value=s.renderTargetsVertical[4].texture,s.compositeMaterial.uniforms.bloomStrength.value=t,s.compositeMaterial.uniforms.bloomRadius.value=.1,s.compositeMaterial.needsUpdate=!0,s.compositeMaterial.uniforms.bloomFactors.value=[1,.8,.6,.4,.2],s.bloomTintColors=[new r.Vector3(1,1,1),new r.Vector3(1,1,1),new r.Vector3(1,1,1),new r.Vector3(1,1,1),new r.Vector3(1,1,1)],s.compositeMaterial.uniforms.bloomTintColors.value=s.bloomTintColors,e=Et,s.copyUniforms=r.UniformsUtils.clone(e.uniforms),s.copyUniforms.opacity.value=1,s.materialCopy=new r.ShaderMaterial({uniforms:s.copyUniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,blending:r.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0}),s.enabled=!0,s.needsSwap=!1,s._oldClearColor=new r.Color,s.oldClearAlpha=1,s.basic=new r.MeshBasicMaterial,s.fsQuad=new Tt.T(null),s}return t=i,(e=[{key:"dispose",value:function(){for(var e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(var t=0;t<this.renderTargetsVertical.length;t++)this.renderTargetsVertical[t].dispose();this.renderTargetBright.dispose()}},{key:"setSize",value:function(e,t){var n=Math.round(e/2),i=Math.round(t/2);this.renderTargetBright.setSize(n,i);for(var o=0;o<this.nMips;o++)this.renderTargetsHorizontal[o].setSize(n,i),this.renderTargetsVertical[o].setSize(n,i),this.separableBlurMaterials[o].uniforms.texSize.value=new r.Vector2(n,i),n=Math.round(n/2),i=Math.round(i/2)}},{key:"render",value:function(e,t,r,n,o){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();for(var a=e.autoClear,s=(e.autoClear=!1,e.setClearColor(this.clearColor,0),o&&e.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=r.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=r.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this.fsQuad.render(e),this.renderTargetBright),l=0;l<this.nMips;l++)this.fsQuad.material=this.separableBlurMaterials[l],this.separableBlurMaterials[l].uniforms.colorTexture.value=s.texture,this.separableBlurMaterials[l].uniforms.direction.value=i.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[l]),e.clear(),this.fsQuad.render(e),this.separableBlurMaterials[l].uniforms.colorTexture.value=this.renderTargetsHorizontal[l].texture,this.separableBlurMaterials[l].uniforms.direction.value=i.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[l]),e.clear(),this.fsQuad.render(e),s=this.renderTargetsVertical[l];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,o&&e.state.buffers.stencil.setTest(!0),this.renderToScreen?e.setRenderTarget(null):e.setRenderTarget(r),this.fsQuad.render(e),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=a}},{key:"getSeperableBlurMaterial",value:function(e){return new r.ShaderMaterial({defines:{KERNEL_RADIUS:e,SIGMA:e},uniforms:{colorTexture:{value:null},texSize:{value:new r.Vector2(.5,.5)},direction:{value:new r.Vector2(.5,.5)}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec2 direction;\n\n\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\n\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n\t\t\t\t}\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tfloat fSigma = float(SIGMA);\n\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, fSigma);\n\t\t\t\t\tvec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum;\n\t\t\t\t\tfor( int i = 1; i < KERNEL_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = float(i);\n\t\t\t\t\t\tfloat w = gaussianPdf(x, fSigma);\n\t\t\t\t\t\tvec2 uvOffset = direction * invSize * x;\n\t\t\t\t\t\tvec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb;\n\t\t\t\t\t\tvec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb;\n\t\t\t\t\t\tdiffuseSum += (sample1 + sample2) * w;\n\t\t\t\t\t\tweightSum += 2.0 * w;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n\t\t\t\t}"})}},{key:"getCompositeMaterial",value:function(e){return new r.ShaderMaterial({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\t\t\t\tuniform sampler2D blurTexture1;\n\t\t\t\tuniform sampler2D blurTexture2;\n\t\t\t\tuniform sampler2D blurTexture3;\n\t\t\t\tuniform sampler2D blurTexture4;\n\t\t\t\tuniform sampler2D blurTexture5;\n\t\t\t\tuniform float bloomStrength;\n\t\t\t\tuniform float bloomRadius;\n\t\t\t\tuniform float bloomFactors[NUM_MIPS];\n\t\t\t\tuniform vec3 bloomTintColors[NUM_MIPS];\n\n\t\t\t\tfloat lerpBloomFactor(const in float factor) {\n\t\t\t\t\tfloat mirrorFactor = 1.2 - factor;\n\t\t\t\t\treturn mix(factor, mirrorFactor, bloomRadius);\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tgl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );\n\t\t\t\t}"})}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(Tt.w);function kt(e){return(kt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Lt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ft(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ut(e,t,r){t&&Ft(e.prototype,t),r&&Ft(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function Gt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&jt(e,t)}function jt(e,t){return(jt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Ht(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Nt(e);if(r=t?(r=Nt(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===kt(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function Nt(e){return(Nt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}It.BlurDirectionX=new r.Vector2(1,0),It.BlurDirectionY=new r.Vector2(0,1);var zt=function(){Gt(t,Tt.w);var e=Ht(t);function t(r,n){var i;return Lt(this,t),(i=e.call(this)).scene=r,i.camera=n,i.clear=!0,i.needsSwap=!1,i.inverse=!1,i}return Ut(t,[{key:"render",value:function(e,t,r){var n,i,o=e.getContext(),a=e.state;a.buffers.color.setMask(!1),a.buffers.depth.setMask(!1),a.buffers.color.setLocked(!0),a.buffers.depth.setLocked(!0),i=this.inverse?(n=0,1):(n=1,0),a.buffers.stencil.setTest(!0),a.buffers.stencil.setOp(o.REPLACE,o.REPLACE,o.REPLACE),a.buffers.stencil.setFunc(o.ALWAYS,n,4294967295),a.buffers.stencil.setClear(i),a.buffers.stencil.setLocked(!0),e.setRenderTarget(r),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),a.buffers.color.setLocked(!1),a.buffers.depth.setLocked(!1),a.buffers.stencil.setLocked(!1),a.buffers.stencil.setFunc(o.EQUAL,1,4294967295),a.buffers.stencil.setOp(o.KEEP,o.KEEP,o.KEEP),a.buffers.stencil.setLocked(!0)}}]),t}(),Vt=function(){Gt(t,Tt.w);var e=Ht(t);function t(){var r;return Lt(this,t),(r=e.call(this)).needsSwap=!1,r}return Ut(t,[{key:"render",value:function(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}]),t}();function Jt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var Kt=function(){function e(t,n){var i;(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.renderer=t,void 0===n?(i=t.getSize(new r.Vector2),this._pixelRatio=t.getPixelRatio(),this._width=i.width,this._height=i.height,(n=new r.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio)).texture.name="EffectComposer.rt1"):(this._pixelRatio=1,this._width=n.width,this._height=n.height),this.renderTarget1=n,this.renderTarget2=n.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],void 0===_t.T&&console.error("THREE.EffectComposer relies on ShaderPass"),this.copyPass=new _t.T(Et),this.clock=new r.Clock}return function(e,t,r){t&&Jt(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1})}(e,[{key:"swapBuffers",value:function(){var e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}},{key:"addPass",value:function(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}},{key:"insertPass",value:function(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}},{key:"removePass",value:function(e){-1!==(e=this.passes.indexOf(e))&&this.passes.splice(e,1)}},{key:"isLastEnabledPass",value:function(e){for(var t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}},{key:"render",value:function(e){void 0===e&&(e=this.clock.getDelta());for(var t=this.renderer.getRenderTarget(),r=!1,n=0,i=this.passes.length;n<i;n++){var o,a,s=this.passes[n];!1!==s.enabled&&(s.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(n),s.render(this.renderer,this.writeBuffer,this.readBuffer,e,r),s.needsSwap&&(r&&(o=this.renderer.getContext(),(a=this.renderer.state.buffers.stencil).setFunc(o.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),a.setFunc(o.EQUAL,1,4294967295)),this.swapBuffers()),void 0!==zt&&(s instanceof zt?r=!0:s instanceof Vt&&(r=!1)))}this.renderer.setRenderTarget(t)}},{key:"reset",value:function(e){var t;void 0===e&&(t=this.renderer.getSize(new r.Vector2),this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,(e=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)),this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}},{key:"setSize",value:function(e,t){this._width=e,this._height=t;var r=this._width*this._pixelRatio,n=this._height*this._pixelRatio;this.renderTarget1.setSize(r,n),this.renderTarget2.setSize(r,n);for(var i=0;i<this.passes.length;i++)this.passes[i].setSize(r,n)}},{key:"setPixelRatio",value:function(e){this._pixelRatio=e,this.setSize(this._width,this._height)}}]),e}();function Wt(e){return(Wt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Xt(e,t){return(Xt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Qt(e){return(Qt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}new r.OrthographicCamera(-1,1,1,-1,0,1),(j=new r.BufferGeometry).setAttribute("position",new r.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),j.setAttribute("uv",new r.Float32BufferAttribute([0,2,0,0,2,0],2));var Zt=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Xt(t,e);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Qt(e);if(r=t?(r=Qt(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Wt(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e,t,o,a){var s;if(!(this instanceof i))throw new TypeError("Cannot call a class as a function");return(s=n.call(this)).scene=e,s.camera=t,s.sampleLevel=4,s.unbiased=!0,s.clearColor=void 0!==o?o:0,s.clearAlpha=void 0!==a?a:0,s._oldClearColor=new r.Color,e=Et,s.copyUniforms=r.UniformsUtils.clone(e.uniforms),s.copyMaterial=new r.ShaderMaterial({uniforms:s.copyUniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,transparent:!0,blending:r.AdditiveBlending,depthTest:!1,depthWrite:!1}),s.fsQuad=new Tt.T(s.copyMaterial),s}return t=i,(e=[{key:"dispose",value:function(){this.sampleRenderTarget&&(this.sampleRenderTarget.dispose(),this.sampleRenderTarget=null)}},{key:"setSize",value:function(e,t){this.sampleRenderTarget&&this.sampleRenderTarget.setSize(e,t)}},{key:"render",value:function(e,t,n){this.sampleRenderTarget||(this.sampleRenderTarget=new r.WebGLRenderTarget(n.width,n.height),this.sampleRenderTarget.texture.name="SSAARenderPass.sample");var i=Yt[Math.max(0,Math.min(this.sampleLevel,5))],o=e.autoClear,a=(e.autoClear=!1,e.getClearColor(this._oldClearColor),e.getClearAlpha()),s=1/i.length,l=(this.copyUniforms.tDiffuse.value=this.sampleRenderTarget.texture,{fullWidth:n.width,fullHeight:n.height,offsetX:0,offsetY:0,width:n.width,height:n.height});(n=Object.assign({},this.camera.view)).enabled&&Object.assign(l,n);for(var u=0;u<i.length;u++){var c=i[u];this.camera.setViewOffset&&this.camera.setViewOffset(l.fullWidth,l.fullHeight,l.offsetX+.0625*c[0],l.offsetY+.0625*c[1],l.width,l.height),c=s,this.unbiased&&(c+=1/32*((u+.5)/i.length-.5)),this.copyUniforms.opacity.value=c,e.setClearColor(this.clearColor,this.clearAlpha),e.setRenderTarget(this.sampleRenderTarget),e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(this.renderToScreen?null:t),0===u&&(e.setClearColor(0,0),e.clear()),this.fsQuad.render(e)}this.camera.setViewOffset&&n.enabled?this.camera.setViewOffset(n.fullWidth,n.fullHeight,n.offsetX,n.offsetY,n.width,n.height):this.camera.clearViewOffset&&this.camera.clearViewOffset(),e.autoClear=o,e.setClearColor(this._oldClearColor,a)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(Tt.w),Yt=[[[0,0]],[[4,4],[-4,-4]],[[-2,-6],[6,-2],[-6,2],[2,6]],[[1,-3],[-1,3],[5,1],[-3,-5],[-5,5],[-7,-1],[3,7],[7,-7]],[[1,1],[-1,-3],[-3,2],[4,-1],[-5,-2],[2,5],[5,3],[3,-5],[-2,6],[0,-7],[-4,-6],[-6,4],[-8,0],[7,-4],[6,7],[-7,-8]],[[-4,-7],[-7,-5],[-3,-5],[-5,-4],[-1,-4],[-2,-2],[-6,-1],[-4,0],[-7,1],[-1,2],[-6,3],[-3,3],[-7,6],[-3,6],[-5,7],[-1,7],[5,-7],[1,-6],[6,-5],[4,-4],[2,-3],[7,-2],[1,-1],[4,-1],[2,1],[6,2],[0,4],[4,4],[2,5],[7,5],[5,6],[3,7]]];function qt(e){return(qt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function $t(){return($t="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=tr(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function er(e,t){return(er=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function tr(e){return(tr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var rr=function(){var e=i,t=Zt;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&er(e,t);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=tr(e);if(r=t?(r=tr(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===qt(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e,t,r,o){if(this instanceof i)return(e=n.call(this,e,t,r,o)).sampleLevel=0,e.accumulate=!1,e;throw new TypeError("Cannot call a class as a function")}return e=i,(t=[{key:"render",value:function(e,t,n,o){if(!1===this.accumulate)return $t(tr(i.prototype),"render",this).call(this,e,t,n,o),void(this.accumulateIndex=-1);var a=nr[5],s=(void 0===this.sampleRenderTarget&&(this.sampleRenderTarget=new r.WebGLRenderTarget(n.width,n.height,this.params),this.sampleRenderTarget.texture.name="TAARenderPass.sample"),void 0===this.holdRenderTarget&&(this.holdRenderTarget=new r.WebGLRenderTarget(n.width,n.height,this.params),this.holdRenderTarget.texture.name="TAARenderPass.hold"),-1===this.accumulateIndex&&($t(tr(i.prototype),"render",this).call(this,e,this.holdRenderTarget,n,o),this.accumulateIndex=0),o=e.autoClear,e.autoClear=!1,1/a.length);if(0<=this.accumulateIndex&&this.accumulateIndex<a.length){this.copyUniforms.opacity.value=s,this.copyUniforms.tDiffuse.value=t.texture;for(var l=Math.pow(2,this.sampleLevel),u=0;u<l;u++){var c=a[this.accumulateIndex];if(this.camera.setViewOffset&&this.camera.setViewOffset(n.width,n.height,.0625*c[0],.0625*c[1],n.width,n.height),e.setRenderTarget(t),e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(this.sampleRenderTarget),0===this.accumulateIndex&&e.clear(),this.fsQuad.render(e),this.accumulateIndex++,this.accumulateIndex>=a.length)break}this.camera.clearViewOffset&&this.camera.clearViewOffset()}0<(s=this.accumulateIndex*s)&&(this.copyUniforms.opacity.value=1,this.copyUniforms.tDiffuse.value=this.sampleRenderTarget.texture,e.setRenderTarget(t),e.clear(),this.fsQuad.render(e)),s<1&&(this.copyUniforms.opacity.value=1-s,this.copyUniforms.tDiffuse.value=this.holdRenderTarget.texture,e.setRenderTarget(t),0==s&&e.clear(),this.fsQuad.render(e)),e.autoClear=o}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),i}(),nr=[[[0,0]],[[4,4],[-4,-4]],[[-2,-6],[6,-2],[-6,2],[2,6]],[[1,-3],[-1,3],[5,1],[-3,-5],[-5,5],[-7,-1],[3,7],[7,-7]],[[1,1],[-1,-3],[-3,2],[4,-1],[-5,-2],[2,5],[5,3],[3,-5],[-2,6],[0,-7],[-4,-6],[-6,4],[-8,0],[7,-4],[6,7],[-7,-8]],[[-4,-7],[-7,-5],[-3,-5],[-5,-4],[-1,-4],[-2,-2],[-6,-1],[-4,0],[-7,1],[-1,2],[-6,3],[-3,3],[-7,6],[-3,6],[-5,7],[-1,7],[5,-7],[1,-6],[6,-5],[4,-4],[2,-3],[7,-2],[1,-1],[4,-1],[2,1],[6,2],[0,4],[4,4],[2,5],[7,5],[5,6],[3,7]]];class ir extends Tt.w{constructor(e,t,n){super(),this.baseTextureID=void 0!==t?t:"tDiffuse",this.effectTextureID=void 0!==n?n:"tDiffuse",e instanceof r.ShaderMaterial?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=r.UniformsUtils.clone(e.uniforms),this.material=new r.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new Tt.T(this.material)}render(e,t,r){this.uniforms[this.baseTextureID]&&(this.uniforms[this.baseTextureID].value=t.texture),this.uniforms[this.effectTextureID]&&(this.uniforms[this.effectTextureID].value=r.texture),this.fsQuad.material=this.material,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)),this.fsQuad.render(e)}}class or extends Tt.w{constructor(e,t,n,i,o){super(),this.scene=e,this.camera=t,this.layerIndex=0,this.overrideMaterial=n,this.clearColor=i,this.clearAlpha=void 0!==o?o:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.oldClearColor=new r.Color,this.oldCameraLayer=t.layers.mask}render(e,t,r){var n=e.autoClear;let i,o;e.autoClear=!1,void 0!==this.overrideMaterial&&(o=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this.oldClearColor),i=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.sceneBg&&(this.scene.background=null),e.setRenderTarget(this.renderToScreen?null:r),this.clear&&e.clear(e.autoClearColor,this.clearDepth,e.autoClearStencil),this.camera.layers.set(this.layerIndex),e.render(this.scene,this.camera),this.camera.layers.mask=this.oldCameraLayer,this.clearColor&&e.setClearColor(this.oldClearColor,i),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=o),this.scene.background=this.sceneBg,e.autoClear=n}}const ar={uniforms:{baseTexture:{value:null},bloomTexture:{value:null}},vertexShader:"\n varying vec2 vUv;\n \n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform sampler2D baseTexture;\n uniform sampler2D bloomTexture;\n \n varying vec2 vUv;\n \n void main() {\n vec4 lastColor = texture2D(baseTexture, vUv);\n \n // gl_FragColor = lastColor;\n // gl_FragColor = texture2D(bloomTexture, vUv);\n gl_FragColor = lastColor + texture2D(bloomTexture, vUv);\n }\n "};class sr{constructor(e,t){this.runScene=e,this.mtGlow=t,this.BLOOM_SCENE=1;var{camera:t,scene:e,renderer:n}=e.assetsEx.get();this.mainScene=e,this.mainCamera=t,this.renderer=n,this.renderer&&(e=this.renderer.getDrawingBufferSize(new r.Vector2),this.rtSize={width:e.width,height:e.height},this.postProcessing())}postProcessing(){this.renderer&&(this.renderer.autoClear=!1),this.effectRT?(this.effectRT.setSize(this.rtSize.width,this.rtSize.height),this.effectRT.depthTexture.dispose()):(this.effectRT=new r.WebGLRenderTarget(this.rtSize.width,this.rtSize.height),this.effectRT.texture.name="EffectComposer.pass",this.effectRT.texture.type=r.FloatType,this.effectRT.texture.format=r.RGBAFormat,this.effectRT.texture.encoding=r.sRGBEncoding,this.effectRT.texture.minFilter=r.LinearFilter,this.effectRT.texture.magFilter=r.LinearFilter),this.effectRT.depthTexture=new r.DepthTexture(this.rtSize.width,this.rtSize.height),this.effectRT.depthTexture.format=r.DepthFormat,this.effectRT.depthTexture.type=r.UnsignedIntType,this.taaRenderPass?(this.taaRenderPass.scene=this.mainScene,this.taaRenderPass.camera=this.mainCamera):(this.taaRenderPass=new rr(this.mainScene,this.mainCamera,0,0),this.taaRenderPass.unbiased=!1,this.taaRenderPass.sampleLevel=1,this.taaRenderPass.accumulate=!1),this.sampleRT?this.sampleRT.setSize(this.rtSize.width,this.rtSize.height):(this.sampleRT=new r.WebGLRenderTarget(this.rtSize.width,this.rtSize.height),this.sampleRT.texture.name="TAARenderPass.sample",this.sampleRT.texture.type=r.FloatType,this.sampleRT.texture.format=r.RGBAFormat,this.sampleRT.texture.encoding=r.sRGBEncoding,this.sampleRT.texture.minFilter=r.LinearFilter,this.sampleRT.texture.magFilter=r.LinearFilter,this.sampleRT.depthTexture=this.effectRT.depthTexture,this.taaRenderPass.sampleRenderTarget=this.sampleRT),this.holdRT?this.holdRT.setSize(this.rtSize.width,this.rtSize.height):(this.holdRT=new r.WebGLRenderTarget(this.rtSize.width,this.rtSize.height),this.holdRT.texture.name="TAARenderPass.hold",this.holdRT.texture.type=r.FloatType,this.holdRT.texture.format=r.RGBAFormat,this.holdRT.texture.encoding=r.sRGBEncoding,this.holdRT.texture.minFilter=r.LinearFilter,this.holdRT.texture.magFilter=r.LinearFilter,this.holdRT.depthTexture=this.effectRT.depthTexture,this.taaRenderPass.holdRenderTarget=this.holdRT),this.bloomRenderPass?(this.bloomRenderPass.scene=this.mainScene,this.bloomRenderPass.camera=this.mainCamera):(this.bloomRenderPass=new or(this.mainScene,this.mainCamera),this.bloomRenderPass.layerIndex=this.BLOOM_SCENE,this.bloomRenderPass.clearDepth=!1,this.bloomRenderPass.sceneBg=this.mtGlow.sceneBackground),this.mtGlow.bloomPass?this.mtGlow.bloomPass.setSize(this.rtSize.width,this.rtSize.height):this.mtGlow.bloomPass=new It(new r.Vector2(this.rtSize.width,this.rtSize.height),1.5,.4,.85),this.mtGlow.bloomPass.strength=this.mtGlow.bloomParams.bloomStrength,this.mtGlow.bloomPass.radius=this.mtGlow.bloomParams.bloomRadius,this.mtGlow.bloomPass.threshold=this.mtGlow.bloomParams.bloomThreshold,this.mixingPass||(this.mixingPass=new ir(ar,"baseTexture","bloomTexture"),this.mixingPass.renderToScreen=!1),this.effectCopy||(this.effectCopy=new _t.T(Et),this.effectCopy.clear=!1,this.effectCopy.renderToScreen=!1,this.effectCopy.needsSwap=!1,this.effectCopy.material.depthWrite=!1),this.effectComposer?this.effectComposer.renderer=this.renderer:(this.effectComposer=new Kt(this.renderer,this.effectRT),this.effectComposer.addPass(this.taaRenderPass),this.effectComposer.addPass(this.effectCopy),this.effectComposer.addPass(this.bloomRenderPass),this.effectComposer.addPass(this.mtGlow.bloomPass),this.effectComposer.addPass(this.mixingPass))}setSize(e,t){this.renderer&&(this.rtSize={width:e,height:t},this.effectComposer&&this.effectComposer.setSize(this.rtSize.width,this.rtSize.height))}dispose(){this.mainScene=null,this.mainCamera=null,this.effectRT&&(this.effectRT.depthTexture.dispose(),this.effectRT.depthTexture=null,this.effectRT.dispose(),this.effectRT=null),this.sampleRT&&(this.sampleRT.depthTexture.dispose(),this.sampleRT.depthTexture=null,this.sampleRT.dispose(),this.sampleRT=null),this.holdRT&&(this.holdRT.depthTexture.dispose(),this.holdRT.depthTexture=null,this.holdRT.dispose(),this.holdRT=null),this.taaRenderPass&&(this.taaRenderPass.dispose(),this.taaRenderPass=null),this.mtGlow.bloomPass&&(this.mtGlow.bloomPass.dispose(),this.mtGlow.bloomPass=null),this.mixingPass=null,this.effectCopy=null,this.effectComposer&&(this.effectComposer.renderTarget1&&(this.effectComposer.renderTarget1.dispose(),this.effectComposer.renderTarget1=null),this.effectComposer.renderTarget2&&(this.effectComposer.renderTarget2.dispose(),this.effectComposer.renderTarget2=null),this.effectComposer=null)}update(){this.mainCamera&&this.mainScene&&this.renderer&&(this.renderer.clear(),this.mtGlow.bloomParams.isBloom?this.effectComposer.render():this.renderer.render(this.mainScene,this.mainCamera))}setSceneBg(){this.bloomRenderPass&&this.mtGlow&&(this.bloomRenderPass.sceneBg=this.mtGlow.sceneBackground)}}function lr(e){return(lr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ur(e,t){return(ur=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function cr(e){return(cr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var hr=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ur(t,e);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=cr(e);if(r=t?(r=cr(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===lr(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e,t,o,a,s){var l;if(this instanceof i)return(l=n.call(this)).scene=e,l.camera=t,l.overrideMaterial=o,l.clearColor=a,l.clearAlpha=void 0!==s?s:0,l.clear=!0,l.clearDepth=!1,l.needsSwap=!1,l._oldClearColor=new r.Color,l;throw new TypeError("Cannot call a class as a function")}return t=i,(e=[{key:"render",value:function(e,t,r){var n,i,o=e.autoClear;e.autoClear=!1,void 0!==this.overrideMaterial&&(i=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this._oldClearColor),n=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:r),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor&&e.setClearColor(this._oldClearColor,n),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=i),e.autoClear=o}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(Tt.w);const dr="\n varying vec2 vUv;\n \n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",pr="\n uniform sampler2D baseTexture;\n uniform sampler2D bloomTexture;\n \n varying vec2 vUv;\n \n void main() {\n gl_FragColor = (texture2D(baseTexture, vUv) + vec4(1.0) * texture2D(bloomTexture, vUv));\n }\n ";class fr{constructor(e,t){this.runScene=e,this.mtGlow=t,this.ENTIRE_SCENE=0,this.BLOOM_SCENE=1,this.blackColor=new r.Color(0),this.bloomLayer=new r.Layers,this.bloomLayer.set(this.BLOOM_SCENE),this.darkMaterial=new r.MeshBasicMaterial({color:"black"}),this.materials={};var{camera:t,scene:e,renderer:n}=e.assetsEx.get();this.mainScene=e,this.mainCamera=t,this.renderer=n,this.renderer&&(e=this.renderer.getSize(new r.Vector2),this.rtSize={width:e.width,height:e.height},this.postProcessing())}postProcessing(){var e=new hr(this.mainScene,this.mainCamera);this.mtGlow.bloomPass=new It(new r.Vector2(this.rtSize.width,this.rtSize.height),1.5,.4,.85),this.mtGlow.bloomPass.threshold=this.mtGlow.bloomParams.bloomThreshold,this.mtGlow.bloomPass.strength=this.mtGlow.bloomParams.bloomStrength,this.mtGlow.bloomPass.radius=this.mtGlow.bloomParams.bloomRadius,this.bloomComposer=new Kt(this.renderer),this.bloomComposer.renderToScreen=!1,this.bloomComposer.addPass(e),this.bloomComposer.addPass(this.mtGlow.bloomPass);const t=new _t.T(new r.ShaderMaterial({uniforms:{baseTexture:{value:null},bloomTexture:{value:this.bloomComposer.renderTarget2.texture}},vertexShader:dr,fragmentShader:pr,defines:{}}),"baseTexture");t.needsSwap=!0,this.finalComposer=new Kt(this.renderer),this.finalComposer.addPass(e),this.finalComposer.addPass(t)}renderBloom(e){this.mtGlow.sceneFogColor&&this.mainScene.fog.color.copy(this.blackColor),this.mtGlow.sceneBackground&&(this.mainScene.background=this.blackColor),e?(null!=(e=this.mainScene)&&e.traverse((e=>{e.isMesh&&!this.bloomLayer.test(e.layers)&&(this.materials[e.uuid]=e.material,e.material=this.darkMaterial)})),this.bloomComposer.render(),null!=(e=this.mainScene)&&e.traverse((e=>{this.materials[e.uuid]&&(e.material=this.materials[e.uuid],delete this.materials[e.uuid])}))):(null!=(e=this.mainCamera)&&e.layers.set(this.BLOOM_SCENE),this.bloomComposer.render(),null!=(e=this.mainCamera)&&e.layers.set(this.ENTIRE_SCENE)),this.mtGlow.sceneFogColor&&this.mainScene.fog.color.copy(this.mtGlow.sceneFogColor),this.mtGlow.sceneBackground&&(this.mainScene.background=this.mtGlow.sceneBackground)}update(){this.mainCamera&&this.mainScene&&this.renderer&&(this.mtGlow.bloomParams.isBloom?(this.renderBloom(!0),this.finalComposer.render()):this.renderer.render(this.mainScene,this.mainCamera))}setSize(e,t){this.renderer&&(this.rtSize={width:e,height:t},this.bloomComposer&&this.bloomComposer.setSize(this.rtSize.width,this.rtSize.height),this.finalComposer&&this.finalComposer.setSize(this.rtSize.width,this.rtSize.height))}dispose(){this.mainScene=null,this.mainCamera=null,this.mtGlow.bloomPass&&(this.mtGlow.bloomPass.dispose(),this.mtGlow.bloomPass=null),this.bloomComposer&&(this.bloomComposer.renderTarget1&&(this.bloomComposer.renderTarget1.dispose(),this.bloomComposer.renderTarget1=null),this.bloomComposer.renderTarget2&&(this.bloomComposer.renderTarget2.dispose(),this.bloomComposer.renderTarget2=null),this.bloomComposer=null),this.finalComposer&&(this.finalComposer.renderTarget1&&(this.finalComposer.renderTarget1.dispose(),this.finalComposer.renderTarget1=null),this.finalComposer.renderTarget2&&(this.finalComposer.renderTarget2.dispose(),this.finalComposer.renderTarget2=null),this.finalComposer=null)}}class mr{constructor(e){this.bloomParams={isBloom:!1,bloomStrength:2,bloomThreshold:0,bloomRadius:0},this.runScene=e,this.info=new Ct(this.runScene),this.bloomParams.isBloom=!1,this.isUpdate=!0,this.sceneFogColor=null,this.sceneBackground=null,this.isSafari=-1<navigator.userAgent.indexOf("Safari"),this.isChrome=-1<navigator.userAgent.indexOf("Chrome"),this.runScene.exporter.gltf.options.addOption({type:"bloom-glow",process:e=>this.toJSON(),parse:e=>{e=JSON.parse(e),this.setData(e)}}),this.runScene.cb.setScene.add("glow",(({type:e,val:t})=>{"fog"===e&&t&&(this.sceneFogColor?this.sceneFogColor.copy(t.color):this.sceneFogColor=new r.Color(t.color)),"background"===e&&(this.sceneBackground&&(0,ut.isTexture)(this.sceneBackground)&&this.sceneBackground.dispose(),this.sceneBackground=t,this.isChrome?this.bloomMtu.setSceneBg():this.isSafari)}))}static getInstance(e){return mr.instance||(mr.instance=new mr(e)),mr.instance}set rendererTone(e){this.renderer&&(this.renderer.toneMapping=e?r.ACESFilmicToneMapping:r.NoToneMapping)}init(e){e=e.renderer,this.renderer=e,this.isChrome?this.bloomMtu=new sr(this.runScene,this):this.isSafari&&(this.bloomThree=new fr(this.runScene,this))}setData(e){e=e.bloomParams;var{bloomRadius:e,bloomStrength:t,bloomThreshold:r,isBloom:n}=e;this.bloomParams.isBloom=n,this.bloomParams.bloomRadius=e,this.bloomParams.bloomStrength=t,this.bloomParams.bloomThreshold=r,this.bloomPass&&(this.bloomPass.strength=t,this.bloomPass.radius=e,this.bloomPass.threshold=r),this.runScene.cb.bloom.glow.setData.cb(this.bloomParams)}setSize(e,t){this.isChrome&&this.bloomMtu?this.bloomMtu.setSize(e,t):this.isSafari&&this.bloomThree&&this.bloomThree.setSize(e,t)}dispose(){this.isChrome?this.bloomMtu.dispose():this.isSafari&&this.bloomThree.dispose()}setUpdate(e){this.isUpdate=e}update(){this.isUpdate&&this.renderer&&(this.isChrome?this.bloomMtu.update():this.isSafari&&this.bloomThree.update())}toJSON(){const e={};var t=this.bloomParams;return e.bloomParams=Object.assign({},t),JSON.stringify(e)}reset(){this.bloomParams.isBloom=!1,this.rendererTone=!1}}class gr{constructor(){this.cbs=[],this.cb=e=>Promise.all(this.cbs.map((t=>{var r;return null==(r=t.fn)?void 0:r.call(t,e)}))),this.emit=this.cb}add(e,t){return this.cbs.push({fn:t,name:e})}on(e,t){return this.add(t||"custom_"+(0,N.getId)(),e)}get(e){var t=this.cbs.findIndex((t=>t.name===e));if(-1!==t)return{data:this.cbs[t],index:t}}reset(e,t){return!!(e=this.get(e))&&(e.data.fn=t,!0)}remove(e){this.reset(e,null)}delete(e){e=(this.get(e)||{}).index,this.cbs.splice(e,1)}}class vr{constructor(){this.resize=new gr,this.setSelectMaterial=new gr,this.setScene=new gr,this.reset=new gr,this.render=new gr,this.tick=new gr,this.baseLog=new gr,this.inited=new gr,this.texture={add:new gr,remove:new gr,setAnima:new gr},this.model={multiSelect:{setEmpty:new gr},change:new gr,setSelect:new gr,click:new gr,add:new gr,remove:new gr,multipDrop:new gr,focus:new gr,unFocus:new gr,changeName:new gr,setOpen:new gr,setMainStatue:new gr,setVisible:new gr,setParent:new gr,setLayers:new gr,clone:new gr,dispose:new gr},this.material={add:new gr,dispose:new gr,setName:new gr},this.unique={material:{add:new gr}},this.tranControls={changing:new gr},this.undo={addUndos:new gr,addRedus:new gr,removeUndos:new gr,undoByIndex:new gr,reset:new gr},this.scene={save:new gr,saveNet:new gr},this.timeLine={setProgress:new gr,playGroup:new gr,setGroupMap:new gr,reset:new gr,closeGroup:new gr},this.events={key:{down:new gr,up:new gr},mouse:{move:new gr,down:new gr,up:new gr},pointer:{down:new gr,up:new gr,move:new gr}},this.bloom={glow:{setData:new gr,setStatus:new gr}},this.load={getJSON:new gr,progress:new gr,complete:new gr},this.loaderer={gltf:{lazyLoadedTexture:new gr,loaded:new gr,modelLoaded:new gr,progress:new gr,getJSON:new gr,getArrayBuffer:new gr,complete:new gr}},this.custom=new Proxy({},{get:(e,t)=>(e[t]||(e[t]=new gr),e[t])}),this.tags={parseJSON:new gr,clear:new gr}}}class yr{constructor(e){this.backgroudDom=null,this.runScene=e,this.runScene.cb.resize.add("camera-background",(()=>{var e,t;this.backgroudDom&&(({width:e,height:t}=this.runScene.renderEx.getDomSize()),this.backgroudDom.style.width=e+"px",this.backgroudDom.style.height=t+"px")}))}setBackground(e){const t=this.runScene.assetsEx.engineDom;var r,n;this.backgroudDom||(this.backgroudDom=document.createElement("div"),({width:r,height:n}=this.runScene.renderEx.getDomSize()),this.backgroudDom.style.position="absolute",this.backgroudDom.style.width=r+"px",this.backgroudDom.style.height=n+"px",t.appendChild(this.backgroudDom)),e?(this.backgroudDom.style.display="block",this.backgroudDom.style.backgroundImage="url("+e+")",this.backgroudDom.style.backgroundRepeat="no-repeat",this.backgroudDom.style.backgroundSize="100% 100%"):this.backgroudDom.style.display="none"}create(){return new r.PerspectiveCamera}reset(e){e.position.set(0,20,20);const t=this.runScene.assetsEx.get().controls;t.target.set(0,0,0),t.update()}get(){return this.runScene.assetsEx.get().camera}}var br=__webpack_require__(317),xr=__webpack_require__(2016);class wr{constructor(e){this.map=new ot.Z,this.runScene=e}get(e){return this.map.get(e)}add(e){this.get(e)||this.map.set(e,new xr.Z)}rename(e,t){const r=this.get(e);r&&(this.addId(t,r.toArray()),this.remove(e))}addId(e,t){this.map.has(e)||this.add(e),this.map.get(e).add(t)}addModel(e,t){if(this.map.has(e)||this.add(e),(0,ct.lG)(t,"array"))return t.map((t=>{this.addModel(e,t)}));this.map.get(e).add((0,br.K)(t))}removeModel(e,t){if(this.map.has(e))return(0,ct.lG)(t,"array")?t.map((t=>{this.removeModel(e,t)})):void this.map.get(e).remove((0,br.K)(t))}remove(e){this.map.delete(e)}clear(){this.map.clear(),this.runScene.cb.tags.clear.cb()}toJSON(){const e={};return this.map.map(((t,r)=>{e[t]=[...r.filter((e=>this.runScene.modelEx.getById(e)))]})),e}parseJSON(e){let t={};(0,z.js)(e,((e,r)=>{t[e]=new xr.Z(r)})),this.map=ot.Z.formJSON(t),this.runScene.cb.tags.parseJSON.cb(e)}}function Ar(e){return(Ar="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Sr(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Br(e,t)}function Br(e,t){return(Br=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Mr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Cr(e){return(Cr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Er={type:"change"},_r={type:"start"},Tr={type:"end"},Dr=function(){Sr(t,r.EventDispatcher);var e=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Cr(e);if(r=t?(r=Cr(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Ar(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return Mr(n)}}(t);function t(n,i){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,t),o=e.call(this),void 0===i&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),i===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),o.object=n,o.domElement=i,o.domElement.style.touchAction="none",o.enabled=!0,o.target=new r.Vector3,o.minDistance=0,o.maxDistance=1/0,o.minZoom=0,o.maxZoom=1/0,o.minPolarAngle=0,o.maxPolarAngle=Math.PI,o.minAzimuthAngle=-1/0,o.maxAzimuthAngle=1/0,o.enableDamping=!1,o.dampingFactor=.05,o.enableZoom=!0,o.zoomSpeed=1,o.enableRotate=!0,o.rotateSpeed=1,o.enablePan=!0,o.panSpeed=1,o.screenSpacePanning=!0,o.keyPanSpeed=7,o.autoRotate=!1,o.autoRotateSpeed=2,o.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},o.mouseButtons={LEFT:r.MOUSE.ROTATE,MIDDLE:r.MOUSE.DOLLY,RIGHT:r.MOUSE.PAN},o.touches={ONE:r.TOUCH.ROTATE,TWO:r.TOUCH.DOLLY_PAN},o.target0=o.target.clone(),o.position0=o.object.position.clone(),o.zoom0=o.object.zoom,o._domElementKeyEvents=null,o.getPolarAngle=function(){return g.phi},o.getAzimuthalAngle=function(){return g.theta},o.getDistance=function(){return this.object.position.distanceTo(this.target)},o.listenToKeyEvents=function(e){e.addEventListener("keydown",re),this._domElementKeyEvents=e},o.saveState=function(){d.target0.copy(d.target),d.position0.copy(d.object.position),d.zoom0=d.object.zoom},o.reset=function(){d.target.copy(d.target0),d.object.position.copy(d.position0),d.object.zoom=d.zoom0,d.object.updateProjectionMatrix(),d.dispatchEvent(Er),d.update(),f=p.NONE},o.update=(a=new r.Vector3,s=(new r.Quaternion).setFromUnitVectors(n.up,new r.Vector3(0,1,0)),l=s.clone().invert(),u=new r.Vector3,c=new r.Quaternion,h=2*Math.PI,function(){var e=d.object.position,t=(a.copy(e).sub(d.target),a.applyQuaternion(s),g.setFromVector3(a),d.autoRotate&&f===p.NONE&&P(2*Math.PI/60/60*d.autoRotateSpeed),d.enableDamping?(g.theta+=v.theta*d.dampingFactor,g.phi+=v.phi*d.dampingFactor):(g.theta+=v.theta,g.phi+=v.phi),d.minAzimuthAngle),r=d.maxAzimuthAngle;return isFinite(t)&&isFinite(r)&&(t<-Math.PI?t+=h:t>Math.PI&&(t-=h),r<-Math.PI?r+=h:r>Math.PI&&(r-=h),g.theta=t<=r?Math.max(t,Math.min(r,g.theta)):g.theta>(t+r)/2?Math.max(t,g.theta):Math.min(r,g.theta)),g.phi=Math.max(d.minPolarAngle,Math.min(d.maxPolarAngle,g.phi)),g.makeSafe(),g.radius*=y,g.radius=Math.max(d.minDistance,Math.min(d.maxDistance,g.radius)),!0===d.enableDamping?d.target.addScaledVector(b,d.dampingFactor):d.target.add(b),a.setFromSpherical(g),a.applyQuaternion(l),e.copy(d.target).add(a),d.object.lookAt(d.target),!0===d.enableDamping?(v.theta*=1-d.dampingFactor,v.phi*=1-d.dampingFactor,b.multiplyScalar(1-d.dampingFactor)):(v.set(0,0,0),b.set(0,0,0)),y=1,!(!(x||u.distanceToSquared(d.object.position)>m||8*(1-c.dot(d.object.quaternion))>m)||(d.dispatchEvent(Er),u.copy(d.object.position),c.copy(d.object.quaternion),x=!1))}),o.dispose=function(){d.domElement.removeEventListener("contextmenu",ne),d.domElement.removeEventListener("pointerdown",Y),d.domElement.removeEventListener("pointercancel",ee),d.domElement.removeEventListener("wheel",te),d.domElement.removeEventListener("pointermove",q),d.domElement.removeEventListener("pointerup",$),null!==d._domElementKeyEvents&&d._domElementKeyEvents.removeEventListener("keydown",re)};var o,a,s,l,u,c,h,d=Mr(o),p={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},f=p.NONE,m=1e-6,g=new r.Spherical,v=new r.Spherical,y=1,b=new r.Vector3,x=!1,w=new r.Vector2,A=new r.Vector2,S=new r.Vector2,B=new r.Vector2,M=new r.Vector2,C=new r.Vector2,E=new r.Vector2,_=new r.Vector2,T=new r.Vector2,D=[],R={};function O(){return Math.pow(.95,d.zoomSpeed)}function P(e){v.theta-=e}function I(e){v.phi-=e}k=new r.Vector3;var k,L,F,U=function(e,t){k.setFromMatrixColumn(t,0),k.multiplyScalar(-e),b.add(k)},G=(L=new r.Vector3,function(e,t){!0===d.screenSpacePanning?L.setFromMatrixColumn(t,1):(L.setFromMatrixColumn(t,0),L.crossVectors(d.object.up,L)),L.multiplyScalar(e),b.add(L)}),j=(F=new r.Vector3,function(e,t){var r,n=d.domElement;d.object.isPerspectiveCamera?(r=d.object.position,F.copy(r).sub(d.target),r=F.length(),r*=Math.tan(d.object.fov/2*Math.PI/180),U(2*e*r/n.clientHeight,d.object.matrix),G(2*t*r/n.clientHeight,d.object.matrix)):d.object.isOrthographicCamera?(U(e*(d.object.right-d.object.left)/d.object.zoom/n.clientWidth,d.object.matrix),G(t*(d.object.top-d.object.bottom)/d.object.zoom/n.clientHeight,d.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),d.enablePan=!1)});function H(e){d.object.isPerspectiveCamera?y/=e:d.object.isOrthographicCamera?(d.object.zoom=Math.max(d.minZoom,Math.min(d.maxZoom,d.object.zoom*e)),d.object.updateProjectionMatrix(),x=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),d.enableZoom=!1)}function N(e){d.object.isPerspectiveCamera?y*=e:d.object.isOrthographicCamera?(d.object.zoom=Math.max(d.minZoom,Math.min(d.maxZoom,d.object.zoom/e)),d.object.updateProjectionMatrix(),x=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),d.enableZoom=!1)}function z(e){w.set(e.clientX,e.clientY)}function V(e){B.set(e.clientX,e.clientY)}function J(){var e,t;1===D.length?w.set(D[0].pageX,D[0].pageY):(e=.5*(D[0].pageX+D[1].pageX),t=.5*(D[0].pageY+D[1].pageY),w.set(e,t))}function K(){var e,t;1===D.length?B.set(D[0].pageX,D[0].pageY):(e=.5*(D[0].pageX+D[1].pageX),t=.5*(D[0].pageY+D[1].pageY),B.set(e,t))}function W(){var e=D[0].pageX-D[1].pageX,t=D[0].pageY-D[1].pageY;e=Math.sqrt(e*e+t*t),E.set(0,e)}function X(e){1==D.length?A.set(e.pageX,e.pageY):(r=ae(e),t=.5*(e.pageX+r.x),e=.5*(e.pageY+r.y),A.set(t,e)),S.subVectors(A,w).multiplyScalar(d.rotateSpeed);var t,r=d.domElement;P(2*Math.PI*S.x/r.clientHeight),I(2*Math.PI*S.y/r.clientHeight),w.copy(A)}function Q(e){var t,r;1===D.length?M.set(e.pageX,e.pageY):(t=ae(e),r=.5*(e.pageX+t.x),e=.5*(e.pageY+t.y),M.set(r,e)),C.subVectors(M,B).multiplyScalar(d.panSpeed),j(C.x,C.y),B.copy(M)}function Z(e){var t=ae(e),r=e.pageX-t.x;e=e.pageY-t.y,t=Math.sqrt(r*r+e*e),_.set(0,t),T.set(0,Math.pow(_.y/E.y,d.zoomSpeed)),H(T.y),E.copy(_)}function Y(e){if(!1!==d.enabled)if(0===D.length&&(d.domElement.setPointerCapture(e.pointerId),d.domElement.addEventListener("pointermove",q),d.domElement.addEventListener("pointerup",$)),D.push(e),"touch"===e.pointerType){switch(oe(e),D.length){case 1:switch(d.touches.ONE){case r.TOUCH.ROTATE:if(!1===d.enableRotate)return;J(),f=p.TOUCH_ROTATE;break;case r.TOUCH.PAN:if(!1===d.enablePan)return;K(),f=p.TOUCH_PAN;break;default:f=p.NONE}break;case 2:switch(d.touches.TWO){case r.TOUCH.DOLLY_PAN:if(!1===d.enableZoom&&!1===d.enablePan)return;d.enableZoom&&W(),d.enablePan&&K(),f=p.TOUCH_DOLLY_PAN;break;case r.TOUCH.DOLLY_ROTATE:if(!1===d.enableZoom&&!1===d.enableRotate)return;d.enableZoom&&W(),d.enableRotate&&J(),f=p.TOUCH_DOLLY_ROTATE;break;default:f=p.NONE}break;default:f=p.NONE}f!==p.NONE&&d.dispatchEvent(_r)}else{var t,n=e;switch(n.button){case 0:t=d.mouseButtons.LEFT;break;case 1:t=d.mouseButtons.MIDDLE;break;case 2:t=d.mouseButtons.RIGHT;break;default:t=-1}switch(t){case r.MOUSE.DOLLY:if(!1===d.enableZoom)return;!function(e){E.set(e.clientX,e.clientY)}(n),f=p.DOLLY;break;case r.MOUSE.ROTATE:if(n.ctrlKey||n.metaKey||n.shiftKey){if(!1===d.enablePan)return;V(n),f=p.PAN}else{if(!1===d.enableRotate)return;z(n),f=p.ROTATE}break;case r.MOUSE.PAN:if(n.ctrlKey||n.metaKey||n.shiftKey){if(!1===d.enableRotate)return;z(n),f=p.ROTATE}else{if(!1===d.enablePan)return;V(n),f=p.PAN}break;default:f=p.NONE}f!==p.NONE&&d.dispatchEvent(_r)}}function q(e){if(!1!==d.enabled)if("touch"===e.pointerType){var t=e;switch(oe(t),f){case p.TOUCH_ROTATE:if(!1===d.enableRotate)return;X(t),d.update();break;case p.TOUCH_PAN:if(!1===d.enablePan)return;Q(t),d.update();break;case p.TOUCH_DOLLY_PAN:if(!1===d.enableZoom&&!1===d.enablePan)return;!function(e){d.enableZoom&&Z(e),d.enablePan&&Q(e)}(t),d.update();break;case p.TOUCH_DOLLY_ROTATE:if(!1===d.enableZoom&&!1===d.enableRotate)return;!function(e){d.enableZoom&&Z(e),d.enableRotate&&X(e)}(t),d.update();break;default:f=p.NONE}}else{var r=e;if(!1!==d.enabled)switch(f){case p.ROTATE:if(!1===d.enableRotate)return;!function(e){A.set(e.clientX,e.clientY),S.subVectors(A,w).multiplyScalar(d.rotateSpeed),e=d.domElement,P(2*Math.PI*S.x/e.clientHeight),I(2*Math.PI*S.y/e.clientHeight),w.copy(A),d.update()}(r);break;case p.DOLLY:if(!1===d.enableZoom)return;!function(e){_.set(e.clientX,e.clientY),T.subVectors(_,E),0<T.y?H(O()):T.y<0&&N(O()),E.copy(_),d.update()}(r);break;case p.PAN:if(!1===d.enablePan)return;!function(e){M.set(e.clientX,e.clientY),C.subVectors(M,B).multiplyScalar(d.panSpeed),j(C.x,C.y),B.copy(M),d.update()}(r)}}}function $(e){ie(e),0===D.length&&(d.domElement.releasePointerCapture(e.pointerId),d.domElement.removeEventListener("pointermove",q),d.domElement.removeEventListener("pointerup",$)),d.dispatchEvent(Tr),f=p.NONE}function ee(e){ie(e)}function te(e){!1!==d.enabled&&!1!==d.enableZoom&&f===p.NONE&&(e.preventDefault(),d.dispatchEvent(_r),e.deltaY<0?N(O()):0<e.deltaY&&H(O()),d.update(),d.dispatchEvent(Tr))}function re(e){if(!1!==d.enabled&&!1!==d.enablePan){var t=!1;switch(e.code){case d.keys.UP:j(0,d.keyPanSpeed),t=!0;break;case d.keys.BOTTOM:j(0,-d.keyPanSpeed),t=!0;break;case d.keys.LEFT:j(d.keyPanSpeed,0),t=!0;break;case d.keys.RIGHT:j(-d.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),d.update())}}function ne(e){!1!==d.enabled&&e.preventDefault()}function ie(e){delete R[e.pointerId];for(var t=0;t<D.length;t++)if(D[t].pointerId==e.pointerId)return void D.splice(t,1)}function oe(e){var t=R[e.pointerId];void 0===t&&(t=new r.Vector2,R[e.pointerId]=t),t.set(e.pageX,e.pageY)}function ae(e){return e=e.pointerId===D[0].pointerId?D[1]:D[0],R[e.pointerId]}return d.domElement.addEventListener("contextmenu",ne),d.domElement.addEventListener("pointerdown",Y),d.domElement.addEventListener("pointercancel",ee),d.domElement.addEventListener("wheel",te,{passive:!1}),o.update(),o}return function(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}(t)}();class Rr{create(e,t){return new Dr(e,t)}static toJSON(e){return e.target}}class Or{constructor(e){this._state=!1,this._libsState=!1,this.map={val:"Box",type:"base-model"},this.libsMap={data:"Box",type:"texture"},this.events=e}get state(){return this._state}set state(e){this._state=e}setVal(e){this.state=!0,this.map=e}getVal(){if(this.state)return this.state=!1,this.map}setLibsVal(e){this._libsState=!0,this.libsMap=e}getLibsVal(){if(this._libsState)return this._libsState=!1,this.libsMap}}var Pr=function(e,t,r,n){return new(r=r||Promise)((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};class Ir{constructor(e){this.alt=!1,this.ctrl=!1,this.shift=!1,this.unExec=new ot.Z,this.allFn={s_saveScene:()=>Pr(this,void 0,void 0,(function*(){this.events.runScene.optionsEx.log("正在保存","base","info"),this.events.runScene.cb.scene.saveNet.cb("")})),d_copyModel:()=>{var e,t=this.events.runScene.modelEx.select;t&&(this.events.runScene.modelEx.selectNull(),(e=this.events.runScene.modelEx.clone(t,!1))&&this.events.runScene.modelEx.add(e,t.parent,{isClone:!0,select:!0}))},f_focusModel:()=>{var e=this.events.runScene.modelEx.select;e&&this.events.runScene.modelEx.focus(e)},z_undo:e=>{this.events.runScene.undoEx.undo()},y_redo:e=>{this.events.runScene.undoEx.redo()}},this.events=e}init(e){"running"!==this.events.runScene.optionsEx.options.mode&&(document.addEventListener("keydown",this.keyDown.bind(this)),document.addEventListener("keyup",this.keyUp.bind(this)),this.events.runScene.cb.model.setSelect.add("reset-unexec",(()=>{this.unExec.delete("delete")})))}keyDown(e){return Pr(this,void 0,void 0,(function*(){var t=e.key.toLowerCase();if(console.log(t,e.code,"key"),this.events.runScene.cb.events.key.down.cb({key:t,event:e}),!this.unExec.get(t))switch(t){case" ":break;case"s":this.ctrl&&(e.preventDefault(),this.allFn.s_saveScene());break;case"d":this.ctrl&&(e.preventDefault(),this.allFn.d_copyModel());break;case"alt":this.alt=!0;break;case"control":case"ctrl":this.ctrl=!0;break;case"shift":this.shift=!0;break;case"f11":this.events.runScene.cb.resize.cb(this.events.runScene.renderEx.getDomSize());break;case"w":e.preventDefault(),e.stopPropagation(),this.events.runScene.helperEx.transContro.changeMode("position");break;case"e":this.events.runScene.helperEx.transContro.changeMode("rotation");break;case"r":this.events.runScene.helperEx.transContro.changeMode("scale"),e.preventDefault();break;case"f":this.allFn.f_focusModel();break;case"delete":this.events.runScene.helperEx.unfocus();var r=this.events.runScene.multipSelector.getSelectedList("value");this.events.runScene.sceneEx.remove(this.events.runScene.modelEx.select||r),r&&this.events.runScene.multipSelector.delete();break;case"z":if(!this.ctrl)return;this.allFn.z_undo(e);break;case"y":if(!this.ctrl)return;this.allFn.y_redo(e)}}))}keyUp(e){var t=e.key.toLowerCase();switch(this.events.runScene.cb.events.key.up.cb({key:t,event:e}),t){case"meta":break;case"s":if(this.ctrl)break;return;case"alt":this.alt=!1;break;case"control":case"ctrl":this.ctrl=!1;break;case"shift":this.shift=!1}}}var kr=__webpack_require__(7263);class Lr{constructor(e){this.downPosition={x:0,y:0},this.enableUp=!0,this.isMove=!1,this.moveEvent=new MouseEvent("move"),this.down=e=>{this.downPosition={x:e.offsetX,y:e.offsetY},this.isMove=!0},this.up=e=>{var t,r,n,i;this.isMove=!1,2===e.button||null!=(t=this.events.runScene.helperEx.transContro)&&t.isDraggingChange||(t=e.offsetX,r=e.offsetY,({x:n,y:i}=this.downPosition),t===n&&r===i&&this.trigger(e))},this.events=e}init(e){e.addEventListener("pointerdown",this.down.bind(this)),e.addEventListener("pointerup",this.up.bind(this)),window.addEventListener("pointerdown",this.events.runScene.cb.events.pointer.down.cb),window.addEventListener("pointerup",this.events.runScene.cb.events.pointer.up.cb),window.addEventListener("pointermove",(e=>{this.moveEvent=e,this.events.runScene.cb.events.pointer.move.cb(e)})),window.addEventListener("mousemove",this.events.runScene.cb.events.mouse.move.cb),window.addEventListener("mousedown",this.events.runScene.cb.events.mouse.down.cb),window.addEventListener("mouseup",this.events.runScene.cb.events.mouse.up.cb)}getTriggerModels(e){const t=new r.Raycaster,n=new r.Vector2,{engineDom:i,camera:o,scene:a}=this.events.runScene.assetsEx.get();return n.x=e.offsetX/i.clientWidth*2-1,n.y=-e.offsetY/i.clientHeight*2+1,t.setFromCamera(n,o),e=a.children.filter((e=>{if((!this.events.runScene.helperEx.isHelper(e)||e.userData.id)&&!e.userData.unClick)return e})),t.intersectObjects(e,!0).map((e=>e.object))}removeHideOrLockModel(e){return e.find((e=>this.events.runScene.modelEx.deepIsVisible(e)&&!kr.zf.isLock(e,!0)))}trigger(e){let t=this.removeHideOrLockModel(this.getTriggerModels(e));if(!t)return this.events.runScene.multipSelector.setEmpty(),void this.events.runScene.modelEx.selectNull();if(this.events.runScene.helperEx.isHelper(t)&&(e=this.events.runScene.uniqueEx.getId(t),t=this.events.runScene.uniqueEx.model.get(e)),!this.enableUp){if(t===this.events.runScene.helperEx.transContro.multipObj)return;this.enableUp=!0}if(this.events.runScene.cb.model.click.cb(t),this.events.key.ctrl)return this.enableUp=!1,this.events.runScene.multipSelector.add(t);if(this.events.key.shift){const e=t.parent;e&&e.children.map((e=>{this.events.runScene.multipSelector.add(e)}))}else this.events.runScene.modelEx.setSelectByModel(t),this.events.runScene.lightEx.isLight(t)&&this.events.runScene.lightEx.setSelect(t)}}var Fr=__webpack_require__(4547),Ur=__webpack_require__(1643);function Gr(e){return(Gr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function jr(e,t){return(jr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Hr(e){return(Hr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Nr=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&jr(t,e);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Hr(e);if(r=t?(r=Hr(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Gr(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e,t){if(!(this instanceof i))throw new TypeError("Cannot call a class as a function");var o=new r.BufferGeometry,a=(o.setAttribute("position",new r.Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),o.computeBoundingSphere(),new r.LineBasicMaterial({fog:!1}));return((o=n.call(this,o,a)).light=e,o.color=t,o.type="RectAreaLightHelper",a=new r.BufferGeometry).setAttribute("position",new r.Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),a.computeBoundingSphere(),o.add(new r.Mesh(a,new r.MeshBasicMaterial({side:r.BackSide,fog:!1}))),o}return t=i,(e=[{key:"updateMatrixWorld",value:function(){var e,t;this.scale.set(.5*this.light.width,.5*this.light.height,1),void 0!==this.color?(this.material.color.set(this.color),this.children[0].material.color.set(this.color)):(this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),e=this.material.color,1<(t=Math.max(e.r,e.g,e.b))&&e.multiplyScalar(1/t),this.children[0].material.color.copy(this.material.color)),this.matrixWorld.extractRotation(this.light.matrixWorld).scale(this.scale).copyPosition(this.light.matrixWorld),this.children[0].matrixWorld.copy(this.matrixWorld)}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.Line);class zr{constructor(e){this.runScene=e}}class Vr extends zr{get(){}static toJSON(e){const{type:t,intensity:r,name:n,visible:i,color:o}=e;return{type:t,intensity:r,name:n,visible:i,color:o.getHexString()}}parseJSON(e){const t=this.runScene.lightEx.get("AmbientLight",{addUndo:!1});var{type:e,intensity:r,name:n,visible:i,color:o}=e;return t.intensity=r,t.type=e,t.name=n,t.visible=i,t.color=new at.Z.Color("#"+o),t}}class Jr extends zr{get(){throw new Error("Method not implemented.")}static toJSON(e){const{intensity:t,name:r,type:n,position:i,visible:o,color:a,castShadow:s,shadow:l,rotation:u,target:c}=e;var{mapSize:e,camera:h}=l,{scale:h,near:d,far:p}=h;return{type:n,intensity:t,name:r,visible:o,color:a.getHexString(),castShadow:s,shadow:{mapSize:e.x,camera:{near:d,far:p,scale:h.x}},position:{x:i.x,y:i.y,z:i.z},rotation:{x:u.x,y:u.y,z:u.z},targetPosition:{x:c.position.x,y:c.position.y,z:c.position.z}}}parseJSON(e){const t=this.runScene.lightEx.get("DirectionalLight",{addUndo:!1});var{targetPosition:e,intensity:r,name:n,position:i,visible:o,color:a,castShadow:s,shadow:l,rotation:u,type:c}=e,{mapSize:l,camera:h}=l,{scale:h,near:d,far:p}=h;return t.intensity=r,t.type=c,t.name=n,t.visible=o,t.castShadow=s,t.color=new at.Z.Color("#"+a),t.position.set(i.x,i.y,i.z),t.rotation.set(u.x,u.y,u.z),t.target.position.set(e.x,e.y,e.z),t.add(t.target),t.shadow.mapSize.x=l,t.shadow.mapSize.y=l,t.shadow.camera.scale.x=h,t.shadow.camera.scale.y=h,t.shadow.camera.scale.z=h,t.shadow.camera.near=d,t.shadow.camera.far=p,t.shadow.camera.updateProjectionMatrix(),null!=(r=t.cameraHelper)&&r.update(),t}}class Kr extends zr{get(){throw new Error("Method not implemented.")}static toJSON(e){const{type:t,intensity:r,name:n,visible:i,color:o,groundColor:a,position:s}=e;return{name:n,type:t,intensity:r,visible:i,position:{x:s.x,y:s.y,z:s.z},groundColor:a.getHexString(),color:o.getHexString()}}parseJSON(e){const t=this.runScene.lightEx.get("HemisphereLight",{addUndo:!1});var{type:e,intensity:r,name:n,visible:i,color:o,groundColor:a,position:s}=e;return t.type=e,t.intensity=r,t.name=n,t.visible=i,t.color=new at.Z.Color("#"+o),t.groundColor=new at.Z.Color("#"+a),t.position.set(s.x,s.y,s.z),t}}class Wr extends zr{get(){throw new Error("Method not implemented.")}static toJSON(e){const{name:t,type:r,intensity:n,distance:i,decay:o,renderOrder:a,color:s,visible:l,castShadow:u,shadow:c,position:h}=e;var{mapSize:e,camera:d,bias:p,radius:f}=c,{scale:d,near:m,far:g}=d;return{name:t,type:r,intensity:n,visible:l,color:s.getHexString(),castShadow:u,distance:i,decay:o,renderOrder:a,shadow:{mapSize:e.x,camera:{near:m,far:g,scale:d.x},radius:f,bias:p},position:{x:h.x,y:h.y,z:h.z}}}parseJSON(e){const t=this.runScene.lightEx.get("PointLight",{addUndo:!1});var{name:e,type:r,intensity:n,distance:i,decay:o,renderOrder:a,color:s,visible:l,castShadow:u,shadow:c,position:h}=e,{mapSize:c,camera:d,bias:p,radius:f}=c,{scale:d,near:m,far:g}=d;return t.intensity=n,t.type=r,t.name=e,t.visible=l,t.castShadow=u,t.distance=i,t.renderOrder=a,t.color=new at.Z.Color("#"+s),t.position.set(h.x,h.y,h.z),t.shadow.mapSize.x=c,t.shadow.mapSize.y=c,t.shadow.bias=p,t.decay=o,t.shadow.radius=f,t.shadow.camera.scale.x=d,t.shadow.camera.scale.y=d,t.shadow.camera.scale.z=d,t.shadow.camera.near=m,t.shadow.camera.far=g,t.shadow.camera.updateProjectionMatrix(),t}}class Xr{constructor(e){this.runScene=e}static toJSON(e){const{type:t,intensity:r,name:n,visible:i,color:o,position:a}=e;return{name:n,type:t,intensity:r,visible:i,position:{x:a.x,y:a.y,z:a.z},color:o.getHexString()}}parseJSON(e){const t=this.runScene.lightEx.get("RectAreaLight",{addUndo:!1});var{type:e,intensity:r,name:n,visible:i,color:o,position:a}=e;return t.type=e,t.intensity=r,t.name=n,t.visible=i,t.color=new at.Z.Color("#"+o),t.position.set(a.x,a.y,a.z),t}}class Qr{constructor(e){this.runScene=e}static toJSON(e){const{name:t,type:r,color:n,distance:i,decay:o,intensity:a,angle:s,penumbra:l,visible:u,castShadow:c,shadow:h,renderOrder:d,position:p,target:f}=e;var{bias:e,camera:m,normalBias:g,mapSize:v,radius:y}=h,m=m.near;return{type:r,intensity:a,name:t,visible:u,distance:i,angle:s,decay:o,penumbra:l,renderOrder:d,color:n.getHexString(),castShadow:c,shadow:{bias:e,normalBias:g,mapSize:v.x,camera:{near:m},radius:y},position:{x:p.x,y:p.y,z:p.z},targetPosition:{x:f.position.x,y:f.position.y,z:f.position.z}}}parseJSON(e){const t=this.runScene.lightEx.get("SpotLight",{addUndo:!1});var{name:e,type:r,color:n,distance:i,decay:o,intensity:a,angle:s,penumbra:l,visible:u,castShadow:c,shadow:h,renderOrder:d,position:p,targetPosition:f}=e,{bias:h,camera:m,normalBias:g,mapSize:v,radius:y}=h,m=m.near;return t.intensity=a,t.type=r,t.name=e,t.visible=u,t.distance=i,t.decay=o,t.angle=s,t.penumbra=l,t.renderOrder=d,t.castShadow=c,t.color=new at.Z.Color("#"+n),t.position.set(p.x,p.y,p.z),t.shadow.mapSize.x=v,t.shadow.mapSize.y=v,t.shadow.camera.near=m,t.target.position.set(f.x,f.y,f.z),t.shadow.bias=h,t.shadow.normalBias=g,t.shadow.radius=y,t.shadow.camera.updateProjectionMatrix(),t}}var Zr=__webpack_require__(6875),Yr=__webpack_require__(9593),qr=__webpack_require__(5860),$r=__webpack_require__(986);const en={DirectionalLight:Jr,PointLight:Wr,SpotLight:Qr,RectAreaLight:Xr,HemisphereLight:Kr,AmbientLight:Vr};class tn{constructor(e){this.shadowList=["DirectionalLight","PointLight","SpotLight"],this.helperList=["DirectionalLight","PointLight","SpotLight","RectAreaLight","HemisphereLight"],this.lightDom=void 0,this.helperUpdateList=["DirectionalLight","PointLight","SpotLight","HemisphereLight"],this.runScene=e,this.lightExMap={DirectionalLight:new Jr(e),PointLight:new Wr(e),SpotLight:new Qr(e),RectAreaLight:new Xr(e),HemisphereLight:new Kr(e),AmbientLight:new Vr(e)}}getLightsByScene(e=this.runScene.sceneEx.get()){return e.children.filter((e=>e.isLight))}get(e,t){var{isClone:t,id:r,addUndo:n,addToScene:i}=(0,ae.mergeObject)({isClone:!1,id:(0,N.getId)(),addUndo:!0,addToScene:!0},t);let o=new at.Z[e];if(o.position.y=10,o.name=e,o.userData.id=r,this.shadowList.includes(e)&&(o.castShadow=!0),this.setLight(o),i){if(this.helperList.includes(o.type)){const t=this.setLightHelper(o);t.push({model:o,parent:this.runScene.sceneEx.get(),addTree:!0}),r=t.map((e=>new Zr.Z(Object.assign(Object.assign({},e),{runScene:this.runScene})).execute())),n&&this.runScene.undoEx.addUndo(r),null!=(e=null==o?void 0:o.lightHelper)&&e.update()}else this.runScene.modelEx.add(o,void 0,{addUndo:n});this.runScene.modelEx.setSelectByModel(o,{isClone:t})}return o}setNull(e){e.userData.light&&this.setNull(e.userData.light),this.isLight(e)&&("DirectionalLight"===e.type?e.cameraHelper&&(e.cameraHelper.visible=!1):"SpotLight"===e.type&&(e.cameraHelper&&(e.cameraHelper.visible=!1),e.helper&&(e.helper.visible=!0)))}setSelect(e){e.userData.light&&this.setSelect(e.userData.light),this.isLight(e)&&("DirectionalLight"===e.type?e.cameraHelper&&(e.cameraHelper.visible=!0):"SpotLight"===e.type&&(e.cameraHelper&&(e.cameraHelper.visible=!0),e.helper&&(e.helper.visible=!0)))}update(e){var t;e.userData.isLightTarget&&e.userData.light&&(e=e.userData.light),this.isLight(e)&&("DirectionalLight"===e.type||"SpotLight"===e.type?(e.helper.update(),null!=(t=e.cameraHelper)&&t.update()):null!=(e=null==(t=e.helper)?void 0:t.update)&&e.call(t))}remove(e,t=!0){let r;return this.runScene.helperEx.unfocus(),r="DirectionalLight"===e.type||"SpotLight"===e.type?[e,e.cameraHelper,e.helper].map((t=>{if(t)return new $r.Z({addTree:t===e,runScene:this.runScene,model:t,parent:t.parent||this.runScene.sceneEx.get()}).execute()})).filter((e=>e)):[e,e.helper].map((t=>{if(t)return new $r.Z({addTree:t===e,runScene:this.runScene,model:t,parent:t.parent||this.runScene.sceneEx.get()}).execute()})).filter((e=>e)),t&&r&&this.runScene.undoEx.addUndo(r),r}getLightHelper(e,t){this.runScene.uniqueEx.model.add(t);const r=this.runScene.uniqueEx.getId(t);let n,i=[];switch(e){case"RectAreaLight":n=new Nr(t,16773120);break;case"DirectionalLight":if(n=new at.Z.DirectionalLightHelper(t,1,16711680),t.children[0])t.target=t.children[0];else{let e=new at.Z.Object3D;(t.target=e).name="helperModel",e.position.y=-10,t.shadow.autoUpdate=!0,e.userData.isLightTarget=!0,(e.userData.light=t).add(e)}t.shadow.camera.layers.set(1),t.shadow.camera.far=1e5,t.shadowCameraLeft=-5,t.shadowCameraRight=5,t.shadowCameraTop=5,t.shadowCameraBottom=-5,t.shadow.camera.updateProjectionMatrix();const e=new at.Z.CameraHelper(t.shadow.camera);t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(e,!0,(e=>{e.userData.id=r,e.userData.unClick=!0})),e.userData.id=r,e.userData.unClick=!0,t.cameraHelper=e,i.push({model:e,parent:this.runScene.sceneEx.get(),addTree:!1});break;case"PointLight":n=new at.Z.PointLightHelper(t,1,16711935);break;case"SpotLight":n=new at.Z.SpotLightHelper(t);let o=new at.Z.Object3D;(t.target=o).name="helperModel",o.userData.isLightTarget=!0,o.userData.light=t,o.position.y=-10,t.shadow.autoUpdate=!0,t.add(o);const a=new at.Z.CameraHelper(t.shadow.camera);t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(a,!0,(e=>{e.userData.id=r})),a.userData.id=r,t.cameraHelper=a,i.push({model:a,parent:this.runScene.sceneEx.get(),addTree:!1});break;case"HemisphereLight":n=new at.Z.HemisphereLightHelper(t,1,16773135)}return n.name="helperModel",this.runScene.helperEx.setHelper(n,!0,(e=>{e.userData.id=r})),n.userData.id=r,(n.light=t).helper=n,i.push({model:n,parent:this.runScene.sceneEx.get(),addTree:!1}),i}setLightHelper(e){return"editor"!==this.runScene.optionsEx.options.mode?[]:this.getLightHelper(e.type,e)}isUpdateHelper(e){return this.helperUpdateList.includes(e)}initLight(e){e.forEach((e=>this.setLightHelper(e)))}setNormal(e,t=0){var{model:e,info:r,val:n,cb:i}=e;return new qr.Z({target:e,runScene:this.runScene,info:r,oldVal:e[r],newVal:n,cb:i}).execute()}setMultip(e,t,r=!0,n=!0){if(e instanceof Array)return i=e.map((e=>{var{model:e,typeList:n,newVal:i}=e;const o=new Yr.Z({target:e,typeList:n,newVal:i,cb:t});return r?o.execute():o})),n&&this.runScene.undoEx.addUndo(i),i;{var{model:i,typeList:e,newVal:o}=e;const a=new Yr.Z({target:i,typeList:e,newVal:o,cb:t});return n&&this.runScene.undoEx.addUndo(a),r?a.execute():a}}isLight(e){return null==(e=e.userData)?void 0:e.isLight}setLight(e){e.userData.isLight=!0}isHelperTarget(e){return e.userData.isLightTarget}clone(e){return this.runScene.modelEx.selectNull(),this.get(e.type,{isClone:!0,id:(0,N.getId)()})}static toJSON(e){return e.map((e=>{var t=e.type;return en[t].toJSON(e)}))}}class rn{constructor(e){this.materialMap={},this.textureMap={},this.modelType={Sprite:st.Z},this.geoDefMaterialMap=new ot.Z;var{type:e,runScene:t,helper:r}=e;this.type=e,this.helper=r,this.runScene=t}parse(e){var t=this.createTextureGroup(e);this.parseScene(t),this.parseModel(e),this.materialMapToJson(),this.setMultipMaterial(t,Object.keys(this.textureMap))}createTextureGroup(e){const t=new r.Group;return t.name="back-texture-ex",t.userData.isHelper=!0,e.add(t),t}parseScene(e){"scene"===this.type&&(this.helper.ex=Object.assign(Object.assign({},this.helper.ex),this._getBaseEx(e)))}_getBaseEx(e){var t=this.runScene.sceneEx.get();const{controls:r,camera:n}=this.runScene.assetsEx.get();var i=this.runScene.optionsEx.exporterOptions.outTime;return{base64:(0,ct.Ni)(String(i)),lights:tn.toJSON(this.runScene.lightEx.getLightsByScene()),camera:n.toJSON(),sceneEx:Object.assign(Object.assign({},dt.ZP.toJSON(t)),this._bindSceneTextures(e)),timeLine:this.runScene.timeLineEx.getSavedData(),controls:Rr.toJSON(r),tags:this.runScene.tags.toJSON(),options:this.runScene.exporter.gltf.options.getOptions(t)}}_bindSceneTextures(e){var t=this.runScene.sceneEx.get();const r={};if((0,ut.isTexture)(t.background)||(0,ut.isTexture)(t.environment)){this.runScene.bloom.glow.setUpdate(!1);const{background:n,environment:i}=t,o=(this.runScene.bloom.glow.setUpdate(!0),(0,lt.createDefModel)("Box")),a=(0,ht.createDefMaterial)();o.material=a,e.add(o),t=a.userData.id,r.materialId=t,this.materialMap[t]={normalMaterial:a,models:[]},(0,ut.isTexture)(n)&&(n.userData.notCompress=!0,303===(a.map=n).mapping&&(r.backgroundMapping=303)),(0,ut.isTexture)(i)&&(i.userData.notCompress=!0,a.envMap=i)}return r}compressLocal(e){var{x:t,y:r,z:n}=e.position;0===t&&0===r&&0===n||(e.position.set(0,0,0),e.userData.local=t+","+r+","+n)}parseModel(e){const t=new Set;e.traverse((e=>t.add(e))),t.forEach((e=>{this._processMaterial(e),this._processModel(e)}))}_processModel(e){var t;(0,lt.withAnima)(e)&&(t=e.animations.map((e=>e.toJSON())),(0,dt.M)(e,"animations",t));let r=e;const n=this.modelType[e.type];n&&(t=n.modelTools.toNormal(e),this.runScene.optionsEx.options.hideLocal&&this.compressLocal(t),e.parent.add(t),e.parent.remove(e),r=t),this.runScene.optionsEx.options.hideLocal&&this.compressLocal(r)}_processMaterial(e){if((0,ht.isMaterial)(e.material)){const n=this.materialMap[e.material.userData.id];if(n)return n.normalMaterial&&(e.material=n.normalMaterial),void n.models.push(e);var t=this.runScene.materialEx.isBaseMaterial(e.material),r=e.material;const i=t||this.runScene.optionsEx.exporterOptions.notMaterial?this.getMaterialFromModel(e):this.runScene.materialEx.toNromal(e.material);(e.material=i).userData.id=r.userData.id,this.materialMap[i.userData.id]={oldMaterial:r,normalMaterial:i,models:[e]}}}materialMapToJson(){(0,z.js)(this.materialMap,((e,t)=>{var r;t=t.normalMaterial,this.helper.ex.materialMap[t.userData.id]||(r=(0,ht.getTexturesByMaterial)(t),this.helper.ex.materialMap[t.userData.id]={normal:t.userData.normal||{},textures:{}},this.mergeAndRemoveTexture(r,t))}))}mergeSame(e){var t=e.userData;if((0,ut.isClonedTexture)(e))e=this.parseCloneTexture(e);else for(const o in this.textureMap){var r=this.textureMap[o],{md5:n,texture:i}=r;if(t.md5===n&&e.mapping===i.mapping&&!(0,ut.isClonedTexture)(r.texture))return{isSame:!0,texture:i}}return this.textureMap[e.userData.id]=Object.assign(Object.assign({},t),{texture:e}),{isSame:!1,texture:e}}mergeAndRemoveTexture(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){return e.map((e=>{var{type:e,texture:r}=e;this.runScene.uniqueEx.texture.add(r),t[e]=null;const n=this.mergeSame(r).texture;if(!this.helper.ex.textureMap[n.userData.id]){var i,{format:r,repeat:o,center:a,rotation:s,offset:l}=n;const e={format:r};this.runScene.modelEx.isNavieV2(o,1)||(({x:r,y:i}=o),e.repeat=r===i?r:o),this.runScene.modelEx.isNavieV2(a,0)||(({x:i,y:r}=a),e.center=i===r?i:a),this.runScene.modelEx.isNavieV2(l,0)||(({x:o,y:r}=l),e.offset=o===r?o:l),0!==s&&(e.rotation=s),this.helper.ex.textureMap[n.userData.id]=e}"normalMap"!==e||n.userData.isNormalMap||(n.userData.isNormalMap=!0),this.helper.ex.materialMap[t.userData.id].textures[e]=n.userData.id}))}))}parseCloneTexture(e){const t=e.clone();t.userData=Object.assign({},e.userData);var{width:e,height:r}=e.image;const n=document.createElement("canvas");return n.width=e,n.height=r,t.image=n,t.userData.blob=new Blob([]),t}setMultipMaterial(e,t){const r=this.runScene.modelEx.create(),n=(0,ht.createDefMaterial)();r.material=n,e.add(r);for(const e of Ur.sG){if(!t.length)return;var i=t.pop();if(!i)return;n[e]=this.textureMap[i].texture}t.length&&this.setMultipMaterial(e,t)}getMaterialFromModel(e){return e&&e.geometry?(e=e.geometry.uuid,this.geoDefMaterialMap.get(e)||this.geoDefMaterialMap.set(e,(0,ht.createDefMaterial)()),this.geoDefMaterialMap.get(e)):this.runScene.materialEx.defMaterial}}class nn extends V{constructor(){super(...arguments),this.savedMap=new ot.Z,this.clonedMap=new ot.Z}getSameNode(e){return this.savedMap.find(((t,r)=>r.materialUuid===e.material.uuid&&r.geometryUuid===e.geometry.uuid))}parseUnClonedModel(e){var t,r=(0,br.K)(e);e.material&&e.geometry&&((t=this.getSameNode(e))&&(0,lt.setClonedModel)(e,t.id),this.savedMap.set(r,{id:r,geometryUuid:e.geometry.uuid,materialUuid:e.material.uuid}))}parseClonedModel(e){var t=(0,lt.getClonedIdModel)(e),r=(0,br.K)(e);this.clonedMap.get(t)||this.clonedMap.set(t,{newId:void 0,ids:new Set});const n=this.clonedMap.get(t);n&&(n.ids.add(r),n.newId||this.runScene.uniqueEx.model.get(t)||(t=(0,br.K)(e),n.newId=t),n.newId&&(n.newId!==r?(0,lt.setClonedModel)(e,n.newId):(0,lt.delClonedModel)(e)))}parseNode(e){(0,lt.getClonedIdModel)(e)?this.parseClonedModel(e):this.parseUnClonedModel(e)}}class on{constructor(){this.savedMap=new ot.Z}getSameCount(e){return this.savedMap.filter(((t,r)=>r.geometry.attributes.normal.count===e),"value")}setSameNode(e,t){e.geometry=t}getSameGeo(e,t){var{normal:r,position:n,uv:i}=e.attributes;for(const e of t){var{normal:o,position:a,uv:s}=e.attributes;if(r.array.length===o.array.length&&n.array.length===a.array.length&&i.array.length===s.array.length&&(o=(0,ct.F1)([...r.array],[...o.array],20),a=(0,ct.F1)([...n.array],[...a.array],20),s=(0,ct.F1)([...i.array],[...s.array],20),o&&a&&s))return e}}parseNode(e){if(e&&e.geometry&&e.geometry.attributes&&e.geometry.attributes.normal&&e.geometry.attributes.position&&e.geometry.attributes.uv&&!this.savedMap.get(e.geometry.uuid)){var t=e.geometry,r=(r=t.attributes.normal).count;const i=this.getSameCount(r);if(i){var n=this.getSameGeo(t,i.map((e=>e.geometry)));if(n)return this.setSameNode(e,n)}this.savedMap.set(t.uuid,{count:r,geometry:t})}}}class an{constructor(){this.optionsConfigs={}}getParse(e){return this.optionsConfigs[e]}addOption(e){var t=e.type;if(this.optionsConfigs[t])throw TypeError("该配置项已被挂载");this.optionsConfigs[t]=e}getOptions(e){return Object.values(this.optionsConfigs).map((t=>{const{process:r,type:n}=t;return{type:n,data:r(e)}}))}}class sn{constructor(e){this.helperModels=[],this.mergeSameGeo=new on;var{type:e,runScene:t,model:r}=e;this.runScene=t,this.type=e,this.bindClondId=new nn(t),this.ex={materialMap:{},textureMap:{},type:e},this.before=new rn({helper:this,type:e,runScene:t}),this.before.parse(r)}parseNode(e){const{object:t,nodeDef:r}=e;this.mergeSameGeo.parseNode(t),this.bindClondId.parseNode(t),(0,z.js)(this.runScene.modelEx.defNodeMap,((e,n)=>{t[e]!==n&&(r[e]=t[e])})),t.material&&t.material.wireframe&&(t.material.wireframe=!1,r.wireframe=!0)}parseMaterial(e){const{material:t,materialDef:r}=e;r.id=t.userData.id,this.ex.materialMap[t.userData.id]||(this.ex.materialMap[t.userData.id]={normal:{},textures:{}}),this.ex.materialMap[t.userData.id].normal=Object.assign(Object.assign({},this.ex.materialMap[t.userData.id].normal),this.runScene.materialEx.getDefNromals(t))}parseTexture(e){const{texture:t,textureDef:r}=e;var{notCompress:e,minFilter:n}=t.userData,{width:e,height:n}=(e&&(r.notCompress=!0),r.uvScript=t.userData.uvScript,r.md5=t.userData.md5,r.id=t.userData.id,n&&(r.minFilter=n),(0,ut.isClonedTexture)(t)&&(r.cloneSourceId=(0,ut.getCloneIdFromTexture)(t)),r.format=t.userData.format,(0,ut.getSizeByTexture)(t));r.size={w:e,h:n}}getNodeMapValueWithBone(e,t){for(const r of t.keys())if(r.userData.id===e.userData.id)return t.get(r)}done(e){e.asset.ex=this.ex,this.runScene.optionsEx.log([e,"json"])}}function ln(){ln=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=(p="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",i=p.asyncIterator||"@@asyncIterator",o=p.toStringTag||"@@toStringTag";function a(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{a({},"")}catch(t){a=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var i,o,a,s;return t=t&&t.prototype instanceof c?t:c,t=Object.create(t.prototype),n=new x(n||[]),t._invoke=(i=e,o=r,a=n,s="suspendedStart",function(e,t){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===e)throw t;return{value:void 0,done:!0}}for(a.method=e,a.arg=t;;){var r=a.delegate;if(r&&(r=function e(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,e(t,r),"throw"===r.method))return u;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}return"throw"===(n=l(n,t.iterator,r.arg)).type?(r.method="throw",r.arg=n.arg,r.delegate=null,u):(n=n.arg)?n.done?(r[t.resultName]=n.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,u):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,u)}(r,a),r)){if(r===u)continue;return r}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);if(s="executing","normal"===(r=l(i,o,a)).type){if(s=a.done?"completed":"suspendedYield",r.arg===u)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(s="completed",a.method="throw",a.arg=r.arg)}}),t}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var u={};function c(){}function h(){}function d(){}var p,f,m=(a(p={},n,(function(){return this})),(f=(f=Object.getPrototypeOf)&&f(f(w([]))))&&f!==t&&r.call(f,n)&&(p=f),d.prototype=c.prototype=Object.create(p));function g(e){["next","throw","return"].forEach((function(t){a(e,t,(function(e){return this._invoke(t,e)}))}))}function v(e,t){var n;this._invoke=function(i,o){function a(){return new t((function(n,a){!function n(i,o,a,s){var u;if("throw"!==(i=l(e[i],e,o)).type)return(o=(u=i.arg).value)&&"object"==cn(o)&&r.call(o,"__await")?t.resolve(o.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(o).then((function(e){u.value=e,a(u)}),(function(e){return n("throw",e,a,s)}));s(i.arg)}(i,o,n,a)}))}return n=n?n.then(a,a):a()}}function y(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function b(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(y,this),this.reset(!0)}function w(e){if(e){var t,i=e[n];if(i)return i.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(i=function n(){for(;++t<e.length;)if(r.call(e,t))return n.value=e[t],n.done=!1,n;return n.value=void 0,n.done=!0,n}).next=i}return{next:A}}function A(){return{value:void 0,done:!0}}return a(m,"constructor",h.prototype=d),a(d,"constructor",h),h.displayName=a(d,o,"GeneratorFunction"),e.isGeneratorFunction=function(e){return!!(e="function"==typeof e&&e.constructor)&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,a(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},g(v.prototype),a(v.prototype,i,(function(){return this})),e.AsyncIterator=v,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new v(s(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},g(m),a(m,o,"Generator"),a(m,n,(function(){return this})),a(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,r=[];for(t in e)r.push(t);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=w,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(b),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;0<=i;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),l=r.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}var a=(o=o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc?null:o)?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,u):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),b(r),u}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,i=this.tryEntries[t];if(i.tryLoc===e)return"throw"===(r=i.completion).type&&(n=r.arg,b(i)),n}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:w(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),u}},e}function un(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(n,i)}function cn(e){return(cn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function hn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function pn(e,t,r){t&&dn(e.prototype,t),r&&dn(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var fn=function(){function e(){hn(this,e),this.pluginCallbacks=[],this.register((function(e){return new On(e)})),this.register((function(e){return new Pn(e)})),this.register((function(e){return new In(e)})),this.register((function(e){return new Ln(e)})),this.register((function(e){return new Fn(e)})),this.register((function(e){return new kn(e)}))}return pn(e,[{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,r,n){"object"===cn(r)&&(console.warn("THREE.GLTFExporter: parse() expects options as the fourth argument now."),n=r);for(var i=new Rn,o=[],a=0,s=this.pluginCallbacks.length;a<s;a++)o.push(this.pluginCallbacks[a](i));i.setPlugins(o),i.write(e,t,n).catch(r)}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,i){r.parse(e,n,i,t)}))}}]),e}(),mn=5121,gn=5123,vn=(j=9728,9729),yn=9984,bn=9985,xn=9986,wn=9987,An=33071,Sn=33648,Bn=10497,Mn={},Cn=(Mn[r.NearestFilter]=j,Mn[r.NearestMipmapNearestFilter]=yn,Mn[r.NearestMipmapLinearFilter]=xn,Mn[r.LinearFilter]=vn,Mn[r.LinearMipmapNearestFilter]=bn,Mn[r.LinearMipmapLinearFilter]=wn,Mn[r.ClampToEdgeWrapping]=An,Mn[r.RepeatWrapping]=Bn,Mn[r.MirroredRepeatWrapping]=Sn,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"});function En(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function _n(e){return 4*Math.ceil(e/4)}function Tn(e,t){var r=1<arguments.length&&void 0!==t?t:0,n=_n(e.byteLength);if(n===e.byteLength)return e;var i=new Uint8Array(n);if(i.set(new Uint8Array(e)),0!==r)for(var o=e.byteLength;o<n;o++)i[o]=r;return i.buffer}var Dn=null,Rn=function(){function e(){hn(this,e),this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}var t,n;return pn(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=ln().mark((function e(t,r,n){var i,o,a,s,l,u,c;return ln().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.options=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(t),e.next=5,Promise.all(this.pending);case 5:return o=(i=this).buffers,a=i.json,n=i.options,e.next=11,i.options.myOptions.helper.done(a);case 11:l=i.extensionsUsed,s=new Blob(o,{type:"application/octet-stream"}),0<(l=Object.keys(l)).length&&(a.extensionsUsed=l),a.buffers&&0<a.buffers.length&&(a.buffers[0].byteLength=s.size),!0===n.binary?((u=new window.FileReader).readAsArrayBuffer(s),u.onloadend=function(){var e=Tn(u.result),t=new DataView(new ArrayBuffer(8)),n=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),Tn(function(e){if(void 0!==window.TextEncoder)return(new TextEncoder).encode(e).buffer;for(var t=new Uint8Array(new ArrayBuffer(e.length)),r=0,n=e.length;r<n;r++){var i=e.charCodeAt(r);t[r]=255<i?32:i}return t.buffer}(JSON.stringify(a)),32)),i=new DataView(new ArrayBuffer(8)),o=(i.setUint32(0,n.byteLength,!0),i.setUint32(4,1313821514,!0),new ArrayBuffer(12)),s=((l=new DataView(o)).setUint32(0,1179937895,!0),l.setUint32(4,2,!0),12+i.byteLength+n.byteLength+t.byteLength+e.byteLength),l=(l.setUint32(8,s,!0),new Blob([o,i,n,t,e],{type:"application/octet-stream"})),c=new window.FileReader;c.readAsArrayBuffer(l),c.onloadend=function(){r(c.result)}}):a.buffers&&0<a.buffers.length?((c=new window.FileReader).readAsDataURL(s),c.onloadend=function(){var e=c.result;a.buffers[0].uri=e,r(a)}):r(a);case 17:case"end":return e.stop()}}),e,this)})),n=function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function a(e){un(o,n,i,a,s,"next",e)}function s(e){un(o,n,i,a,s,"throw",e)}a(void 0)}))},function(e,t,r){return n.apply(this,arguments)})},{key:"serializeUserData",value:function(e,t){if(0!==Object.keys(e.userData).length){var r=this.options,n=this.extensionsUsed;try{var i=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&i.gltfExtensions){for(var o in void 0===t.extensions&&(t.extensions={}),i.gltfExtensions)t.extensions[o]=i.gltfExtensions[o],n[o]=!0;delete i.gltfExtensions}0<Object.keys(i).length&&(t.extras=i)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}}},{key:"getUID",value:function(e){return this.uids.has(e)||this.uids.set(e,this.uid++),this.uids.get(e)}},{key:"isNormalizedNormalAttribute",value:function(e){if(this.cache.attributesNormalized.has(e))return!1;for(var t=new r.Vector3,n=0,i=e.count;n<i;n++)if(5e-4<Math.abs(t.fromBufferAttribute(e,n).length()-1))return!1;return!0}},{key:"createNormalizedNormalAttribute",value:function(e){var t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);for(var n=e.clone(),i=new r.Vector3,o=0,a=n.count;o<a;o++)i.fromBufferAttribute(n,o),0===i.x&&0===i.y&&0===i.z?i.setX(1):i.normalize(),n.setXYZ(o,i.x,i.y,i.z);return t.attributesNormalized.set(e,n),n}},{key:"applyTextureTransform",value:function(e,t){var r=!1,n={};0===t.offset.x&&0===t.offset.y||(n.offset=t.offset.toArray(),r=!0),0!==t.rotation&&(n.rotation=t.rotation,r=!0),1===t.repeat.x&&1===t.repeat.y||(n.scale=t.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=n,this.extensionsUsed.KHR_texture_transform=!0)}},{key:"buildORMTexture",value:function(e){var t=null==(t=e.aoMap)?void 0:t.image,n=null==(n=e.roughnessMap)?void 0:n.image,i=null==(i=e.metalnessMap)?void 0:i.image;if(t===n&&n===i)return e.aoMap;if(t||n||i){e=Math.max((null==t?void 0:t.width)||0,(null==n?void 0:n.width)||0,(null==i?void 0:i.width)||0);var o=Math.max((null==t?void 0:t.height)||0,(null==n?void 0:n.height)||0,(null==i?void 0:i.height)||0),a=document.createElement("canvas"),s=(a.width=e,a.height=o,a.getContext("2d")),l=(s.fillStyle="#ffffff",s.fillRect(0,0,e,o),s.getImageData(0,0,e,o));if(t){s.drawImage(t,0,0,e,o);for(var u=s.getImageData(0,0,e,o).data,c=0;c<u.length;c+=4)l.data[c]=u[c]}if(n){s.drawImage(n,0,0,e,o);for(var h=s.getImageData(0,0,e,o).data,d=1;d<h.length;d+=4)l.data[d]=h[d]}if(i){s.drawImage(i,0,0,e,o);for(var p=s.getImageData(0,0,e,o).data,f=2;f<p.length;f+=4)l.data[f]=p[f]}return s.putImageData(l,0,0),new r.Texture(a)}}},{key:"processBuffer",value:function(e){var t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}},{key:"processBufferView",value:function(e,t,r,n,i){for(var o,a=this.json,s=(a.bufferViews||(a.bufferViews=[]),o=t===mn?1:t===gn?2:4,_n(n*e.itemSize*o)),l=new DataView(new ArrayBuffer(s)),u=0,c=r;c<r+n;c++)for(var h=0;h<e.itemSize;h++){var d=void 0;4<e.itemSize?d=e.array[c*e.itemSize+h]:0===h?d=e.getX(c):1===h?d=e.getY(c):2===h?d=e.getZ(c):3===h&&(d=e.getW(c)),5126===t?l.setFloat32(u,d,!0):5125===t?l.setUint32(u,d,!0):t===gn?l.setUint16(u,d,!0):t===mn&&l.setUint8(u,d),u+=o}var p={buffer:this.processBuffer(l.buffer),byteOffset:this.byteOffset,byteLength:s};return void 0!==i&&(p.target=i),34962===i&&(p.byteStride=e.itemSize*o),this.byteOffset+=s,a.bufferViews.push(p),{id:a.bufferViews.length-1,byteLength:0}}},{key:"processBufferViewImage",value:function(e){var t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(n,i){var o=new window.FileReader;if(!(e instanceof Blob))return i();o.readAsArrayBuffer(e),o.onloadend=function(){var e=Tn(o.result),i={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,n(r.bufferViews.push(i)-1)}}))}},{key:"processAccessor",value:function(e,t,r,n){var i,o=this.options,a=this.json;if(e.array.constructor===Float32Array)i=5126;else if(e.array.constructor===Uint32Array)i=5125;else if(e.array.constructor===Uint16Array)i=gn;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");i=mn}if(void 0===r&&(r=0),void 0===n&&(n=e.count),o.truncateDrawRange&&void 0!==t&&null===t.index&&(o=r+n,l=t.drawRange.count===1/0?e.count:t.drawRange.start+t.drawRange.count,r=Math.max(r,t.drawRange.start),(n=Math.min(o,l)-r)<0&&(n=0)),0===n)return null;o=function(e,t,r){for(var n={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},i=t;i<t+r;i++)for(var o=0;o<e.itemSize;o++){var a=void 0;4<e.itemSize?a=e.array[i*e.itemSize+o]:0===o?a=e.getX(i):1===o?a=e.getY(i):2===o?a=e.getZ(i):3===o&&(a=e.getW(i)),n.min[o]=Math.min(n.min[o],a),n.max[o]=Math.max(n.max[o],a)}return n}(e,r,n);var s,l=(void 0!==t&&(s=e===t.index?34963:34962),this.processBufferView(e,i,r,n,s));return t={bufferView:l.id,byteOffset:l.byteOffset,componentType:i,count:n,max:o.max,min:o.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]},!0===e.normalized&&(t.normalized=!0),a.accessors||(a.accessors=[]),a.accessors.push(t)-1}},{key:"processImage",value:function(e,t,n,i){var o=this,a=o.cache,s=o.json,l=o.options,u=o.pending,c=(a.images.has(e)||a.images.set(e,{}),a=a.images.get(e),"image/png");if(void 0!==a[n=c+":flipY/"+n.toString()])return a[n];s.images||(s.images=[]);var h={mimeType:c};if(!0===l.binary&&null!=i&&null!=(p=i.userData)&&p.blob&&(null==i||null==(p=i.userData)?void 0:p.blob)instanceof Blob)u.push(new Promise((function(e){o.processBufferViewImage(i.userData.blob).then((function(t){h.bufferView=t,e()}))})));else if(l.embedImages){var d=Dn=Dn||document.createElement("canvas"),p=(d.width=Math.min(e.width,l.maxTextureSize),d.height=Math.min(e.height,l.maxTextureSize),d.getContext("2d"));if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap)p.drawImage(e,0,0,d.width,d.height);else{t!==r.RGBAFormat&&console.error("GLTFExporter: Only RGBAFormat is supported."),(e.width>l.maxTextureSize||e.height>l.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);for(var f=new Uint8ClampedArray(e.height*e.width*4),m=0;m<f.length;m+=4)f[m+0]=e.data[m+0],f[m+1]=e.data[m+1],f[m+2]=e.data[m+2],f[m+3]=e.data[m+3];p.putImageData(new ImageData(f,e.width,e.height),0,0)}!0===l.binary?u.push(new Promise((function(e){d.toBlob((function(t){o.processBufferViewImage(t).then((function(t){h.bufferView=t,e()}))}),c)}))):h.uri=d.toDataURL(c)}else h.uri=e.src;return t=s.images.push(h)-1,a[n]=t}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter:Mn[e.magFilter],minFilter:Mn[e.minFilter],wrapS:Mn[e.wrapS],wrapT:Mn[e.wrapT]},t.samplers.push(e)-1}},{key:"processTexture",value:function(e){var t=this.cache,r=this.json;if(t.textures.has(e))return t.textures.get(e);r.textures||(r.textures=[]);var n={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,e)};return e.name&&(n.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,n)})),r=r.textures.push(n)-1,t.textures.set(e,r),this.options.myOptions.helper.parseTexture({texture:e,textureDef:n}),r}},{key:"processMaterial",value:function(e){var t=this.cache,n=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;n.materials||(n.materials=[]);var i,o={pbrMetallicRoughness:{}},a=(En((this.options.myOptions.helper.parseMaterial({material:e,materialDef:o,options:this}),!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."),a=e.color.toArray().concat([e.opacity])),[1,1,1,1])||(o.pbrMetallicRoughness.baseColorFactor=a),e.isMeshStandardMaterial?(o.pbrMetallicRoughness.metallicFactor=e.metalness,o.pbrMetallicRoughness.roughnessFactor=e.roughness):(o.pbrMetallicRoughness.metallicFactor=.5,o.pbrMetallicRoughness.roughnessFactor=.5),this.buildORMTexture(e));return(e.metalnessMap||e.roughnessMap)&&(a={index:this.processTexture(a)},this.applyTextureTransform(a,e.metalnessMap||e.roughnessMap),o.pbrMetallicRoughness.metallicRoughnessTexture=a),e.map&&(a={index:this.processTexture(e.map)},this.applyTextureTransform(a,e.map),o.pbrMetallicRoughness.baseColorTexture=a),e.emissive&&(a=e.emissive.clone().multiplyScalar(e.emissiveIntensity),1<(i=Math.max(a.r,a.g,a.b))&&(a.multiplyScalar(1/i),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),0<i&&(o.emissiveFactor=a.toArray()),e.emissiveMap&&(i={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(i,e.emissiveMap),o.emissiveTexture=i)),e.normalMap&&(a={index:this.processTexture(e.normalMap)},e.normalScale&&1!==e.normalScale.x&&(a.scale=e.normalScale.x),this.applyTextureTransform(a,e.normalMap),o.normalTexture=a),e.aoMap&&(i={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(i.strength=e.aoMapIntensity),this.applyTextureTransform(i,e.aoMap),o.occlusionTexture=i),e.transparent?o.alphaMode="BLEND":0<e.alphaTest&&(o.alphaMode="MASK",o.alphaCutoff=e.alphaTest),e.side===r.DoubleSide&&(o.doubleSided=!0),""!==e.name&&(o.name=e.name),this.serializeUserData(e,o),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,o)})),a=n.materials.push(o)-1,t.materials.set(e,a),a}},{key:"processMesh",value:function(e){var t=this.cache,n=this.json,i=[e.geometry.uuid];if(Array.isArray(e.material))for(var o=0,a=e.material.length;o<a;o++)i.push(e.material[o].uuid);else i.push(e.material.uuid);var s=i.join(":");if(t.meshes.has(s))return t.meshes.get(s);var l=e.geometry,u=e.isLineSegments?1:e.isLineLoop?2:e.isLine?3:e.isPoints?0:e.material.wireframe?1:4;if(!0!==l.isBufferGeometry)throw new Error("THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry.");var c,h,d,p={},f={},m=[],g=[],v={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},y=l.getAttribute("normal"),b=(void 0===y||this.isNormalizedNormalAttribute(y)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),l.setAttribute("normal",this.createNormalizedNormalAttribute(y))),null);for(h in l.attributes)"morph"!==h.slice(0,5)&&(c=l.attributes[h],h=v[h]||h.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(h)||(h="_"+h),t.attributes.has(this.getUID(c))?f[h]=t.attributes.get(this.getUID(c)):(b=null,d=c.array,"JOINTS_0"!==h||d instanceof Uint16Array||d instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),b=new r.BufferAttribute(new Uint16Array(d),c.itemSize,c.normalized)),null!==(d=this.processAccessor(b||c,l))&&(f[h]=d,t.attributes.set(this.getUID(c),d))));if(void 0!==y&&l.setAttribute("normal",y),0===Object.keys(f).length)return null;if(void 0!==e.morphTargetInfluences&&0<e.morphTargetInfluences.length){var x=[],w=[],A={};if(void 0!==e.morphTargetDictionary)for(var S in e.morphTargetDictionary)A[e.morphTargetDictionary[S]]=S;for(var B=0;B<e.morphTargetInfluences.length;++B){var M,C={},E=!1;for(M in l.morphAttributes)if("position"!==M&&"normal"!==M)E||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),E=!0);else{var _=l.morphAttributes[M][B],T=M.toUpperCase(),D=l.attributes[M];if(t.attributes.has(this.getUID(_)))C[T]=t.attributes.get(this.getUID(_));else{var R=_.clone();if(!l.morphTargetsRelative)for(var O=0,P=_.count;O<P;O++)R.setXYZ(O,_.getX(O)-D.getX(O),_.getY(O)-D.getY(O),_.getZ(O)-D.getZ(O));C[T]=this.processAccessor(R,l),t.attributes.set(this.getUID(D),C[T])}}g.push(C),x.push(e.morphTargetInfluences[B]),void 0!==e.morphTargetDictionary&&w.push(A[B])}p.weights=x,0<w.length&&(p.extras={},p.extras.targetNames=w)}if((y=Array.isArray(e.material))&&0===l.groups.length)return null;for(var I=y?e.material:[e.material],k=y?l.groups:[{materialIndex:0,start:void 0,count:void 0}],L=0,F=k.length;L<F;L++){var U={mode:u,attributes:f},G=(this.serializeUserData(l,U),0<g.length&&(U.targets=g),null!==l.index&&(G=this.getUID(l.index),void 0===k[L].start&&void 0===k[L].count||(G+=":"+k[L].start+":"+k[L].count),t.attributes.has(G)?U.indices=t.attributes.get(G):(U.indices=this.processAccessor(l.index,l,k[L].start,k[L].count),t.attributes.set(G,U.indices)),null===U.indices&&delete U.indices),this.processMaterial(I[k[L].materialIndex]));null!==G&&(U.material=G),m.push(U)}return p.primitives=m,n.meshes||(n.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,p)})),y=n.meshes.push(p)-1,t.meshes.set(s,y),y}},{key:"processCamera",value:function(e){var t=this.json,n=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),i={type:n?"orthographic":"perspective"};return n?i.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:i.perspective={aspectRatio:e.aspect,yfov:r.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(i.name=e.type),t.cameras.push(i)-1}},{key:"processAnimation",value:function(e,t){for(var n=this.json,i=this.nodeMap,o=(n.animations||(n.animations=[]),(e=fn.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),a=[],s=[],l=0;l<o.length;++l){var u=o[l],c=r.PropertyBinding.parseTrackName(u.name),h=r.PropertyBinding.findNode(t,c.nodeName),d=Cn[c.propertyName];if(!(h="bones"===c.objectName?!0===h.isSkinnedMesh?h.skeleton.getBoneByName(c.objectIndex):void 0:h)||!d)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',u.name),null;c=u.values.length/u.times.length;var p=void(d===Cn.morphTargetInfluences&&(c/=h.morphTargetInfluences.length));!0===u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(p="CUBICSPLINE",c/=3):p=u.getInterpolation()===r.InterpolateDiscrete?"STEP":"LINEAR",s.push({input:this.processAccessor(new r.BufferAttribute(u.times,1)),output:this.processAccessor(new r.BufferAttribute(u.values,c)),interpolation:p}),a.push({sampler:s.length-1,target:{node:i.get(h),path:d}})}return n.animations.push({name:e.name||"clip_"+n.animations.length,samplers:s,channels:a}),n.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,n=this.nodeMap,i=t.nodes[n.get(e)],o=e.skeleton;if(void 0===o)return null;var a=e.skeleton.bones[0];if(void 0===a)return null;for(var s=[],l=new Float32Array(16*o.bones.length),u=new r.Matrix4,c=0;c<o.bones.length;++c){var h=o.bones[c];h=this.options.myOptions.helper.getNodeMapValueWithBone(h,n),s.push(h),u.copy(o.boneInverses[c]),u.multiply(e.bindMatrix).toArray(l,16*c)}return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new r.BufferAttribute(l,16)),joints:s,skeleton:n.get(a)}),i.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,r,n=this.json,i=this.options,o=this.nodeMap,a=(n.nodes||(n.nodes=[]),{});if(i.myOptions.helper.parseNode({object:e,nodeDef:a,options:this}),i.trs?(r=e.quaternion.toArray(),h=e.position.toArray(),t=e.scale.toArray(),En(r,[0,0,0,1])||(a.rotation=r),En(h,[0,0,0])||(a.translation=h),En(t,[1,1,1])||(a.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===En(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(a.matrix=e.matrix.elements)),""!==e.name&&(a.name=String(e.name)),this.serializeUserData(e,a),e.isMesh||e.isLine||e.isPoints?null!==(r=this.processMesh(e))&&(a.mesh=r):e.isCamera&&(a.camera=this.processCamera(e)),e.isSkinnedMesh&&this.skins.push(e),0<e.children.length){for(var s=[],l=0,u=e.children.length;l<u;l++){var c=e.children[l];!c.visible&&!1!==i.onlyVisible||null!==(c=this.processNode(c))&&s.push(c)}0<s.length&&(a.children=s)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,a)}));var h=n.nodes.push(a)-1;return o.set(e,h),h}},{key:"processScene",value:function(e){for(var t=this.json,r=this.options,n=(t.scenes||(t.scenes=[],t.scene=0),{}),i=(""!==e.name&&(n.name=e.name),t.scenes.push(n),[]),o=0,a=e.children.length;o<a;o++){var s=e.children[o];!s.visible&&!1!==r.onlyVisible||null!==(s=this.processNode(s))&&i.push(s)}0<i.length&&(n.nodes=i),this.serializeUserData(e,n)}},{key:"processObjects",value:function(e){var t=new r.Scene;t.name="AuxScene";for(var n=0;n<e.length;n++)t.children.push(e[n]);this.processScene(t)}},{key:"processInput",value:function(e){for(var t,n,i=this.options,o=(e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)})),[]),a=0;a<e.length;a++)e[a]instanceof r.Scene?this.processScene(e[a]):o.push(e[a]);1===o.length?(t=o[0],"model"===i.myOptions.helper.type&&((n=new r.Group).name="glb_model",n.add(t),t=n),this.processScene(t)):1<o.length&&this.processObjects(o);for(var s=0;s<this.skins.length;++s)this.processSkin(this.skins[s]);for(var l=0;l<i.animations.length;++l)this.processAnimation(i.animations[l],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}},{key:"_invokeAll",value:function(e){for(var t=0,r=this.plugins.length;t<r;t++)e(this.plugins[t])}}]),e}(),On=function(){function e(t){hn(this,e),this.writer=t,this.name="KHR_lights_punctual"}return pn(e,[{key:"writeNode",value:function(e,t){var r,n,i;e.isLight&&(e.isDirectionalLight||e.isPointLight||e.isSpotLight?(r=(i=this.writer).json,i=i.extensionsUsed,n={},e.name&&(n.name=e.name),n.color=e.color.toArray(),n.intensity=e.intensity,e.isDirectionalLight?n.type="directional":e.isPointLight?(n.type="point",0<e.distance&&(n.range=e.distance)):e.isSpotLight&&(n.type="spot",0<e.distance&&(n.range=e.distance),n.spot={},n.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,n.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),i[this.name]||(r.extensions=r.extensions||{},r.extensions[this.name]={lights:[]},i[this.name]=!0),(i=r.extensions[this.name].lights).push(n),t.extensions=t.extensions||{},t.extensions[this.name]={light:i.length-1}):console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e))}}]),e}(),Pn=function(){function e(t){hn(this,e),this.writer=t,this.name="KHR_materials_unlit"}return pn(e,[{key:"writeMaterial",value:function(e,t){e.isMeshBasicMaterial&&(e=this.writer.extensionsUsed,t.extensions=t.extensions||{},t.extensions[this.name]={},e[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9)}}]),e}(),In=function(){function e(t){hn(this,e),this.writer=t,this.name="KHR_materials_pbrSpecularGlossiness"}return pn(e,[{key:"writeMaterial",value:function(e,t){var r,n,i,o;e.isGLTFSpecularGlossinessMaterial&&(n=(r=this.writer).extensionsUsed,i={},t.pbrMetallicRoughness.baseColorFactor&&(i.diffuseFactor=t.pbrMetallicRoughness.baseColorFactor),e.specular.toArray(o=[1,1,1],0),i.specularFactor=o,i.glossinessFactor=e.glossiness,t.pbrMetallicRoughness.baseColorTexture&&(i.diffuseTexture=t.pbrMetallicRoughness.baseColorTexture),e.specularMap&&(o={index:r.processTexture(e.specularMap)},r.applyTextureTransform(o,e.specularMap),i.specularGlossinessTexture=o),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0)}}]),e}(),kn=function(){function e(t){hn(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return pn(e,[{key:"writeMaterial",value:function(e,t){var r,n,i,o;e.isMeshPhysicalMaterial&&(n=(r=this.writer).extensionsUsed,(i={}).clearcoatFactor=e.clearcoat,e.clearcoatMap&&(o={index:r.processTexture(e.clearcoatMap)},r.applyTextureTransform(o,e.clearcoatMap),i.clearcoatTexture=o),i.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap&&(o={index:r.processTexture(e.clearcoatRoughnessMap)},r.applyTextureTransform(o,e.clearcoatRoughnessMap),i.clearcoatRoughnessTexture=o),e.clearcoatNormalMap&&(o={index:r.processTexture(e.clearcoatNormalMap)},r.applyTextureTransform(o,e.clearcoatNormalMap),i.clearcoatNormalTexture=o),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0)}}]),e}(),Ln=function(){function e(t){hn(this,e),this.writer=t,this.name="KHR_materials_transmission"}return pn(e,[{key:"writeMaterial",value:function(e,t){var r,n,i,o;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(i={}).transmissionFactor=e.transmission,e.transmissionMap&&(o={index:r.processTexture(e.transmissionMap)},r.applyTextureTransform(o,e.transmissionMap),i.transmissionTexture=o),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0)}}]),e}(),Fn=function(){function e(t){hn(this,e),this.writer=t,this.name="KHR_materials_volume"}return pn(e,[{key:"writeMaterial",value:function(e,t){var r,n,i,o;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(i={}).thicknessFactor=e.thickness,e.thicknessMap&&(o={index:r.processTexture(e.thicknessMap)},r.applyTextureTransform(o,e.thicknessMap),i.thicknessTexture=o),i.attenuationDistance=e.attenuationDistance,i.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0)}}]),e}();function Un(){Un=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=(p="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",i=p.asyncIterator||"@@asyncIterator",o=p.toStringTag||"@@toStringTag";function a(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{a({},"")}catch(t){a=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var i,o,a,s;return t=t&&t.prototype instanceof c?t:c,t=Object.create(t.prototype),n=new x(n||[]),t._invoke=(i=e,o=r,a=n,s="suspendedStart",function(e,t){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===e)throw t;return{value:void 0,done:!0}}for(a.method=e,a.arg=t;;){var r=a.delegate;if(r&&(r=function e(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,e(t,r),"throw"===r.method))return u;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}return"throw"===(n=l(n,t.iterator,r.arg)).type?(r.method="throw",r.arg=n.arg,r.delegate=null,u):(n=n.arg)?n.done?(r[t.resultName]=n.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,u):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,u)}(r,a),r)){if(r===u)continue;return r}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===s)throw s="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);if(s="executing","normal"===(r=l(i,o,a)).type){if(s=a.done?"completed":"suspendedYield",r.arg===u)continue;return{value:r.arg,done:a.done}}"throw"===r.type&&(s="completed",a.method="throw",a.arg=r.arg)}}),t}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var u={};function c(){}function h(){}function d(){}var p,f,m=(a(p={},n,(function(){return this})),(f=(f=Object.getPrototypeOf)&&f(f(w([]))))&&f!==t&&r.call(f,n)&&(p=f),d.prototype=c.prototype=Object.create(p));function g(e){["next","throw","return"].forEach((function(t){a(e,t,(function(e){return this._invoke(t,e)}))}))}function v(e,t){var n;this._invoke=function(i,o){function a(){return new t((function(n,a){!function n(i,o,a,s){var u;if("throw"!==(i=l(e[i],e,o)).type)return(o=(u=i.arg).value)&&"object"==jn(o)&&r.call(o,"__await")?t.resolve(o.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(o).then((function(e){u.value=e,a(u)}),(function(e){return n("throw",e,a,s)}));s(i.arg)}(i,o,n,a)}))}return n=n?n.then(a,a):a()}}function y(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function b(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(y,this),this.reset(!0)}function w(e){if(e){var t,i=e[n];if(i)return i.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(i=function n(){for(;++t<e.length;)if(r.call(e,t))return n.value=e[t],n.done=!1,n;return n.value=void 0,n.done=!0,n}).next=i}return{next:A}}function A(){return{value:void 0,done:!0}}return a(m,"constructor",h.prototype=d),a(d,"constructor",h),h.displayName=a(d,o,"GeneratorFunction"),e.isGeneratorFunction=function(e){return!!(e="function"==typeof e&&e.constructor)&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,a(e,o,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},g(v.prototype),a(v.prototype,i,(function(){return this})),e.AsyncIterator=v,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new v(s(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},g(m),a(m,o,"Generator"),a(m,n,(function(){return this})),a(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,r=[];for(t in e)r.push(t);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=w,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(b),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;0<=i;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),l=r.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}var a=(o=o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc?null:o)?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,u):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),b(r),u}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,i=this.tryEntries[t];if(i.tryLoc===e)return"throw"===(r=i.completion).type&&(n=r.arg,b(i)),n}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:w(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),u}},e}function Gn(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(n,i)}function jn(e){return(jn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Hn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Nn(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function zn(e,t,r){t&&Nn(e.prototype,t),r&&Nn(e,r),Object.defineProperty(e,"prototype",{writable:!1})}fn.Utils={insertKeyframe:function(e,t){var r,n=e.getValueSize(),i=new e.TimeBufferType(e.times.length+1),o=new e.ValueBufferType(e.values.length+n),a=e.createInterpolant(new e.ValueBufferType(n));if(0===e.times.length){i[0]=t;for(var s=0;s<n;s++)o[s]=0;r=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<.001)return 0;i[0]=t,i.set(e.times,1),o.set(a.evaluate(t),0),o.set(e.values,n),r=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<.001)return e.times.length-1;i[i.length-1]=t,i.set(e.times,0),o.set(e.values,0),o.set(a.evaluate(t),e.values.length),r=i.length-1}else for(var l=0;l<e.times.length;l++){if(Math.abs(e.times[l]-t)<.001)return l;if(e.times[l]<t&&e.times[l+1]>t){i.set(e.times.slice(0,l+1),0),i[l+1]=t,i.set(e.times.slice(l+1),l+2),o.set(e.values.slice(0,(l+1)*n),0),o.set(a.evaluate(t),(l+1)*n),o.set(e.values.slice((l+1)*n),(l+2)*n),r=l+1;break}}return e.times=i,e.values=o,r},mergeMorphTargetTracks:function(e,t){for(var n=[],i={},o=e.tracks,a=0;a<o.length;++a){var s=o[a],l=r.PropertyBinding.parseTrackName(s.name),u=r.PropertyBinding.findNode(t,l.nodeName);if("morphTargetInfluences"!==l.propertyName||void 0===l.propertyIndex)n.push(s);else{if(s.createInterpolant!==s.InterpolantFactoryMethodDiscrete&&s.createInterpolant!==s.InterpolantFactoryMethodLinear){if(s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),(s=s.clone()).setInterpolation(r.InterpolateLinear)}var c=u.morphTargetInfluences.length,h=u.morphTargetDictionary[l.propertyIndex];if(void 0===h)throw new Error("THREE.GLTFExporter: Morph target name not found: "+l.propertyIndex);var d=void 0;if(void 0===i[u.uuid]){for(var p=new((d=s.clone()).ValueBufferType)(c*d.times.length),f=0;f<d.times.length;f++)p[f*c+h]=d.values[f];d.name=(l.nodeName||"")+".morphTargetInfluences",d.values=p,i[u.uuid]=d,n.push(d)}else{var m=s.createInterpolant(new s.ValueBufferType(1));d=i[u.uuid];for(var g=0;g<d.times.length;g++)d.values[g*c+h]=m.evaluate(d.times[g]);for(var v=0;v<s.times.length;v++){var y=this.insertKeyframe(d,s.times[v]);d.values[y*c+h]=s.values[v]}}}}return e.tracks=n,e}};var Vn=function(){function e(){Hn(this,e),this.pluginCallbacks=[],this.register((function(e){return new ti(e)})),this.register((function(e){return new ri(e)})),this.register((function(e){return new ni(e)})),this.register((function(e){return new oi(e)})),this.register((function(e){return new ai(e)})),this.register((function(e){return new ii(e)}))}return zn(e,[{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,r,n){"object"===jn(r)&&(console.warn("THREE.GLTFExporter: parse() expects options as the fourth argument now."),n=r);for(var i=new ei,o=[],a=0,s=this.pluginCallbacks.length;a<s;a++)o.push(this.pluginCallbacks[a](i));i.setPlugins(o),i.write(e,t,n).catch(r)}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,i){r.parse(e,n,i,t)}))}}]),e}(),Jn=5121,Kn=5123,Wn=(j=9728,yn=9729,xn=9984,vn=9985,bn=9986,wn=9987,An=33071,Bn=33648,Sn=10497,{}),Xn=(Wn[r.NearestFilter]=j,Wn[r.NearestMipmapNearestFilter]=xn,Wn[r.NearestMipmapLinearFilter]=bn,Wn[r.LinearFilter]=yn,Wn[r.LinearMipmapNearestFilter]=vn,Wn[r.LinearMipmapLinearFilter]=wn,Wn[r.ClampToEdgeWrapping]=An,Wn[r.RepeatWrapping]=Sn,Wn[r.MirroredRepeatWrapping]=Bn,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"});function Qn(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function Zn(e){return 4*Math.ceil(e/4)}function Yn(e,t){var r=1<arguments.length&&void 0!==t?t:0,n=Zn(e.byteLength);if(n===e.byteLength)return e;var i=new Uint8Array(n);if(i.set(new Uint8Array(e)),0!==r)for(var o=e.byteLength;o<n;o++)i[o]=r;return i.buffer}var qn=null;function $n(){return qn=qn||("undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"))}var ei=function(){function e(){Hn(this,e),this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}var t,n;return zn(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=Un().mark((function e(t,r,n){var i,o,a,s,l;return Un().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.options=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(t),e.next=5,Promise.all(this.pending);case 5:o=(a=this).buffers,i=a.json,n=a.options,a=a.extensionsUsed,o=new Blob(o,{type:"application/octet-stream"}),0<(a=Object.keys(a)).length&&(i.extensionsUsed=a),i.buffers&&0<i.buffers.length&&(i.buffers[0].byteLength=o.size),!0===n.binary?((s=new FileReader).readAsArrayBuffer(o),s.onloadend=function(){var e=Yn(s.result),t=new DataView(new ArrayBuffer(8)),n=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),Yn((n=JSON.stringify(i),(new TextEncoder).encode(n).buffer),32)),o=new DataView(new ArrayBuffer(8)),a=(o.setUint32(0,n.byteLength,!0),o.setUint32(4,1313821514,!0),new ArrayBuffer(12)),l=((u=new DataView(a)).setUint32(0,1179937895,!0),u.setUint32(4,2,!0),12+o.byteLength+n.byteLength+t.byteLength+e.byteLength),u=(u.setUint32(8,l,!0),new Blob([a,o,n,t,e],{type:"application/octet-stream"})),c=new FileReader;c.readAsArrayBuffer(u),c.onloadend=function(){r(c.result)}}):i.buffers&&0<i.buffers.length?((l=new FileReader).readAsDataURL(o),l.onloadend=function(){var e=l.result;i.buffers[0].uri=e,r(i)}):r(i);case 15:case"end":return e.stop()}}),e,this)})),n=function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function a(e){Gn(o,n,i,a,s,"next",e)}function s(e){Gn(o,n,i,a,s,"throw",e)}a(void 0)}))},function(e,t,r){return n.apply(this,arguments)})},{key:"serializeUserData",value:function(e,t){if(0!==Object.keys(e.userData).length){var r=this.options,n=this.extensionsUsed;try{var i=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&i.gltfExtensions){for(var o in void 0===t.extensions&&(t.extensions={}),i.gltfExtensions)t.extensions[o]=i.gltfExtensions[o],n[o]=!0;delete i.gltfExtensions}0<Object.keys(i).length&&(t.extras=i)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}}},{key:"getUID",value:function(e){return this.uids.has(e)||this.uids.set(e,this.uid++),this.uids.get(e)}},{key:"isNormalizedNormalAttribute",value:function(e){if(this.cache.attributesNormalized.has(e))return!1;for(var t=new r.Vector3,n=0,i=e.count;n<i;n++)if(5e-4<Math.abs(t.fromBufferAttribute(e,n).length()-1))return!1;return!0}},{key:"createNormalizedNormalAttribute",value:function(e){var t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);for(var n=e.clone(),i=new r.Vector3,o=0,a=n.count;o<a;o++)i.fromBufferAttribute(n,o),0===i.x&&0===i.y&&0===i.z?i.setX(1):i.normalize(),n.setXYZ(o,i.x,i.y,i.z);return t.attributesNormalized.set(e,n),n}},{key:"applyTextureTransform",value:function(e,t){var r=!1,n={};0===t.offset.x&&0===t.offset.y||(n.offset=t.offset.toArray(),r=!0),0!==t.rotation&&(n.rotation=t.rotation,r=!0),1===t.repeat.x&&1===t.repeat.y||(n.scale=t.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=n,this.extensionsUsed.KHR_texture_transform=!0)}},{key:"buildMetalRoughTexture",value:function(e,t){if(e===t)return e;console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures.");var n=null==e?void 0:e.image,i=null==t?void 0:t.image,o=Math.max((null==n?void 0:n.width)||0,(null==i?void 0:i.width)||0),a=Math.max((null==n?void 0:n.height)||0,(null==i?void 0:i.height)||0),s=$n(),l=(s.width=o,s.height=a,s.getContext("2d")),u=(l.fillStyle="#00ffff",l.fillRect(0,0,o,a),l.getImageData(0,0,o,a));if(n){l.drawImage(n,0,0,o,a);for(var c=l.getImageData(0,0,o,a).data,h=2;h<c.length;h+=4)u.data[h]=c[h]}if(i){l.drawImage(i,0,0,o,a);for(var d=l.getImageData(0,0,o,a).data,p=1;p<d.length;p+=4)u.data[p]=d[p]}return l.putImageData(u,0,0),(n=(e||t).clone()).source=new r.Source(s),n}},{key:"processBuffer",value:function(e){var t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}},{key:"processBufferView",value:function(e,t,r,n,i){for(var o,a=this.json,s=(a.bufferViews||(a.bufferViews=[]),o=t===Jn?1:t===Kn?2:4,Zn(n*e.itemSize*o)),l=new DataView(new ArrayBuffer(s)),u=0,c=r;c<r+n;c++)for(var h=0;h<e.itemSize;h++){var d=void 0;4<e.itemSize?d=e.array[c*e.itemSize+h]:0===h?d=e.getX(c):1===h?d=e.getY(c):2===h?d=e.getZ(c):3===h&&(d=e.getW(c)),5126===t?l.setFloat32(u,d,!0):5125===t?l.setUint32(u,d,!0):t===Kn?l.setUint16(u,d,!0):t===Jn&&l.setUint8(u,d),u+=o}var p={buffer:this.processBuffer(l.buffer),byteOffset:this.byteOffset,byteLength:s};return void 0!==i&&(p.target=i),34962===i&&(p.byteStride=e.itemSize*o),this.byteOffset+=s,a.bufferViews.push(p),{id:a.bufferViews.length-1,byteLength:0}}},{key:"processBufferViewImage",value:function(e){var t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(n){var i=new FileReader;i.readAsArrayBuffer(e),i.onloadend=function(){var e=Yn(i.result),o={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,n(r.bufferViews.push(o)-1)}}))}},{key:"processAccessor",value:function(e,t,r,n){var i,o=this.options,a=this.json;if(e.array.constructor===Float32Array)i=5126;else if(e.array.constructor===Uint32Array)i=5125;else if(e.array.constructor===Uint16Array)i=Kn;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");i=Jn}if(void 0===r&&(r=0),void 0===n&&(n=e.count),o.truncateDrawRange&&void 0!==t&&null===t.index&&(o=r+n,l=t.drawRange.count===1/0?e.count:t.drawRange.start+t.drawRange.count,r=Math.max(r,t.drawRange.start),(n=Math.min(o,l)-r)<0&&(n=0)),0===n)return null;o=function(e,t,r){for(var n={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},i=t;i<t+r;i++)for(var o=0;o<e.itemSize;o++){var a=void 0;4<e.itemSize?a=e.array[i*e.itemSize+o]:0===o?a=e.getX(i):1===o?a=e.getY(i):2===o?a=e.getZ(i):3===o&&(a=e.getW(i)),n.min[o]=Math.min(n.min[o],a),n.max[o]=Math.max(n.max[o],a)}return n}(e,r,n);var s,l=(void 0!==t&&(s=e===t.index?34963:34962),this.processBufferView(e,i,r,n,s));return t={bufferView:l.id,byteOffset:l.byteOffset,componentType:i,count:n,max:o.max,min:o.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]},!0===e.normalized&&(t.normalized=!0),a.accessors||(a.accessors=[]),a.accessors.push(t)-1}},{key:"processImage",value:function(e,t,n){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"image/png",o=this,a=o.cache,s=o.json,l=o.options,u=o.pending,c=(a.images.has(e)||a.images.set(e,{}),a=a.images.get(e),i+":flipY/"+n.toString());if(void 0!==a[c])return a[c];s.images||(s.images=[]);var h={mimeType:i};if(l.embedImages){var d=$n(),p=(d.width=Math.min(e.width,l.maxTextureSize),d.height=Math.min(e.height,l.maxTextureSize),d.getContext("2d"));if(!0===n&&(p.translate(0,d.height),p.scale(1,-1)),void 0!==e.data){t!==r.RGBAFormat&&console.error("GLTFExporter: Only RGBAFormat is supported."),(e.width>l.maxTextureSize||e.height>l.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);for(var f=new Uint8ClampedArray(e.height*e.width*4),m=0;m<f.length;m+=4)f[m+0]=e.data[m+0],f[m+1]=e.data[m+1],f[m+2]=e.data[m+2],f[m+3]=e.data[m+3];p.putImageData(new ImageData(f,e.width,e.height),0,0)}else p.drawImage(e,0,0,d.width,d.height);!0===l.binary?(n=void 0!==d.toBlob?new Promise((function(e){return d.toBlob(e,i)})):d.convertToBlob({type:i}),u.push(n.then((function(e){return o.processBufferViewImage(e).then((function(e){h.bufferView=e}))})))):h.uri=d.toDataURL(i)}else h.uri=e.src;return t=s.images.push(h)-1,a[c]=t}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter:Wn[e.magFilter],minFilter:Wn[e.minFilter],wrapS:Wn[e.wrapS],wrapT:Wn[e.wrapT]},t.samplers.push(e)-1}},{key:"processTexture",value:function(e){var t=this.cache,r=this.json;if(t.textures.has(e))return t.textures.get(e);r.textures||(r.textures=[]);var n=("image/webp"===(i=e.userData.mimeType)&&(i="image/png"),{sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,i)}),i=(e.name&&(n.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,n)})),r.textures.push(n)-1);return t.textures.set(e,i),i}},{key:"processMaterial",value:function(e){var t=this.cache,n=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;n.materials||(n.materials=[]);var i={pbrMetallicRoughness:{}},o=(!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."),e.color.toArray().concat([e.opacity])),a=(Qn(o,[1,1,1,1])||(i.pbrMetallicRoughness.baseColorFactor=o),e.isMeshStandardMaterial?(i.pbrMetallicRoughness.metallicFactor=e.metalness,i.pbrMetallicRoughness.roughnessFactor=e.roughness):(i.pbrMetallicRoughness.metallicFactor=.5,i.pbrMetallicRoughness.roughnessFactor=.5),(e.metalnessMap||e.roughnessMap)&&(o=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),a={index:this.processTexture(o)},this.applyTextureTransform(a,o),i.pbrMetallicRoughness.metallicRoughnessTexture=a),e.map&&(o={index:this.processTexture(e.map)},this.applyTextureTransform(o,e.map),i.pbrMetallicRoughness.baseColorTexture=o),e.emissive&&(a=e.emissive.clone().multiplyScalar(e.emissiveIntensity),1<(o=Math.max(a.r,a.g,a.b))&&(a.multiplyScalar(1/o),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),0<o&&(i.emissiveFactor=a.toArray()),e.emissiveMap&&(o={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(o,e.emissiveMap),i.emissiveTexture=o)),e.normalMap&&(a={index:this.processTexture(e.normalMap)},e.normalScale&&1!==e.normalScale.x&&(a.scale=e.normalScale.x),this.applyTextureTransform(a,e.normalMap),i.normalTexture=a),e.aoMap&&(o={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(o.strength=e.aoMapIntensity),this.applyTextureTransform(o,e.aoMap),i.occlusionTexture=o),e.transparent?i.alphaMode="BLEND":0<e.alphaTest&&(i.alphaMode="MASK",i.alphaCutoff=e.alphaTest),e.side===r.DoubleSide&&(i.doubleSided=!0),""!==e.name&&(i.name=e.name),this.serializeUserData(e,i),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,i)})),n.materials.push(i)-1);return t.materials.set(e,a),a}},{key:"processMesh",value:function(e){var t=this.cache,n=this.json,i=[e.geometry.uuid];if(Array.isArray(e.material))for(var o=0,a=e.material.length;o<a;o++)i.push(e.material[o].uuid);else i.push(e.material.uuid);var s=i.join(":");if(t.meshes.has(s))return t.meshes.get(s);var l=e.geometry,u=e.isLineSegments?1:e.isLineLoop?2:e.isLine?3:e.isPoints?0:e.material.wireframe?1:4;if(!0!==l.isBufferGeometry)throw new Error("THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry.");var c,h,d,p={},f={},m=[],g=[],v={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},y=l.getAttribute("normal"),b=(void 0===y||this.isNormalizedNormalAttribute(y)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),l.setAttribute("normal",this.createNormalizedNormalAttribute(y))),null);for(h in l.attributes)"morph"!==h.slice(0,5)&&(c=l.attributes[h],h=v[h]||h.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(h)||(h="_"+h),t.attributes.has(this.getUID(c))?f[h]=t.attributes.get(this.getUID(c)):(b=null,d=c.array,"JOINTS_0"!==h||d instanceof Uint16Array||d instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),b=new r.BufferAttribute(new Uint16Array(d),c.itemSize,c.normalized)),null!==(d=this.processAccessor(b||c,l))&&(f[h]=d,t.attributes.set(this.getUID(c),d))));if(void 0!==y&&l.setAttribute("normal",y),0===Object.keys(f).length)return null;if(void 0!==e.morphTargetInfluences&&0<e.morphTargetInfluences.length){var x=[],w=[],A={};if(void 0!==e.morphTargetDictionary)for(var S in e.morphTargetDictionary)A[e.morphTargetDictionary[S]]=S;for(var B=0;B<e.morphTargetInfluences.length;++B){var M,C={},E=!1;for(M in l.morphAttributes)if("position"!==M&&"normal"!==M)E||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),E=!0);else{var _=l.morphAttributes[M][B],T=M.toUpperCase(),D=l.attributes[M];if(t.attributes.has(this.getUID(_)))C[T]=t.attributes.get(this.getUID(_));else{var R=_.clone();if(!l.morphTargetsRelative)for(var O=0,P=_.count;O<P;O++)R.setXYZ(O,_.getX(O)-D.getX(O),_.getY(O)-D.getY(O),_.getZ(O)-D.getZ(O));C[T]=this.processAccessor(R,l),t.attributes.set(this.getUID(D),C[T])}}g.push(C),x.push(e.morphTargetInfluences[B]),void 0!==e.morphTargetDictionary&&w.push(A[B])}p.weights=x,0<w.length&&(p.extras={},p.extras.targetNames=w)}if((y=Array.isArray(e.material))&&0===l.groups.length)return null;for(var I=y?e.material:[e.material],k=y?l.groups:[{materialIndex:0,start:void 0,count:void 0}],L=0,F=k.length;L<F;L++){var U={mode:u,attributes:f},G=(this.serializeUserData(l,U),0<g.length&&(U.targets=g),null!==l.index&&(G=this.getUID(l.index),void 0===k[L].start&&void 0===k[L].count||(G+=":"+k[L].start+":"+k[L].count),t.attributes.has(G)?U.indices=t.attributes.get(G):(U.indices=this.processAccessor(l.index,l,k[L].start,k[L].count),t.attributes.set(G,U.indices)),null===U.indices&&delete U.indices),this.processMaterial(I[k[L].materialIndex]));null!==G&&(U.material=G),m.push(U)}return p.primitives=m,n.meshes||(n.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,p)})),y=n.meshes.push(p)-1,t.meshes.set(s,y),y}},{key:"processCamera",value:function(e){var t=this.json,n=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),i={type:n?"orthographic":"perspective"};return n?i.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:i.perspective={aspectRatio:e.aspect,yfov:r.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(i.name=e.type),t.cameras.push(i)-1}},{key:"processAnimation",value:function(e,t){for(var n=this.json,i=this.nodeMap,o=(n.animations||(n.animations=[]),(e=Vn.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),a=[],s=[],l=0;l<o.length;++l){var u=o[l],c=r.PropertyBinding.parseTrackName(u.name),h=r.PropertyBinding.findNode(t,c.nodeName),d=Xn[c.propertyName];if(!(h="bones"===c.objectName?!0===h.isSkinnedMesh?h.skeleton.getBoneByName(c.objectIndex):void 0:h)||!d)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',u.name),null;c=u.values.length/u.times.length;var p=void(d===Xn.morphTargetInfluences&&(c/=h.morphTargetInfluences.length));!0===u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(p="CUBICSPLINE",c/=3):p=u.getInterpolation()===r.InterpolateDiscrete?"STEP":"LINEAR",s.push({input:this.processAccessor(new r.BufferAttribute(u.times,1)),output:this.processAccessor(new r.BufferAttribute(u.values,c)),interpolation:p}),a.push({sampler:s.length-1,target:{node:i.get(h),path:d}})}return n.animations.push({name:e.name||"clip_"+n.animations.length,samplers:s,channels:a}),n.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,n=this.nodeMap,i=t.nodes[n.get(e)],o=e.skeleton;if(void 0===o)return null;var a=e.skeleton.bones[0];if(void 0===a)return null;for(var s=[],l=new Float32Array(16*o.bones.length),u=new r.Matrix4,c=0;c<o.bones.length;++c)s.push(n.get(o.bones[c])),u.copy(o.boneInverses[c]),u.multiply(e.bindMatrix).toArray(l,16*c);return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new r.BufferAttribute(l,16)),joints:s,skeleton:n.get(a)}),i.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,r,n=this.json,i=this.options,o=this.nodeMap,a=(n.nodes||(n.nodes=[]),{});if(i.trs?(r=e.quaternion.toArray(),h=e.position.toArray(),t=e.scale.toArray(),Qn(r,[0,0,0,1])||(a.rotation=r),Qn(h,[0,0,0])||(a.translation=h),Qn(t,[1,1,1])||(a.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===Qn(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(a.matrix=e.matrix.elements)),""!==e.name&&(a.name=String(e.name)),this.serializeUserData(e,a),e.isMesh||e.isLine||e.isPoints?null!==(r=this.processMesh(e))&&(a.mesh=r):e.isCamera&&(a.camera=this.processCamera(e)),e.isSkinnedMesh&&this.skins.push(e),0<e.children.length){for(var s=[],l=0,u=e.children.length;l<u;l++){var c=e.children[l];!c.visible&&!1!==i.onlyVisible||null!==(c=this.processNode(c))&&s.push(c)}0<s.length&&(a.children=s)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,a)}));var h=n.nodes.push(a)-1;return o.set(e,h),h}},{key:"processScene",value:function(e){for(var t=this.json,r=this.options,n=(t.scenes||(t.scenes=[],t.scene=0),{}),i=(""!==e.name&&(n.name=e.name),t.scenes.push(n),[]),o=0,a=e.children.length;o<a;o++){var s=e.children[o];!s.visible&&!1!==r.onlyVisible||null!==(s=this.processNode(s))&&i.push(s)}0<i.length&&(n.nodes=i),this.serializeUserData(e,n)}},{key:"processObjects",value:function(e){var t=new r.Scene;t.name="AuxScene";for(var n=0;n<e.length;n++)t.children.push(e[n]);this.processScene(t)}},{key:"processInput",value:function(e){for(var t=this.options,n=(e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)})),[]),i=0;i<e.length;i++)e[i]instanceof r.Scene?this.processScene(e[i]):n.push(e[i]);0<n.length&&this.processObjects(n);for(var o=0;o<this.skins.length;++o)this.processSkin(this.skins[o]);for(var a=0;a<t.animations.length;++a)this.processAnimation(t.animations[a],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}},{key:"_invokeAll",value:function(e){for(var t=0,r=this.plugins.length;t<r;t++)e(this.plugins[t])}}]),e}(),ti=function(){function e(t){Hn(this,e),this.writer=t,this.name="KHR_lights_punctual"}return zn(e,[{key:"writeNode",value:function(e,t){var r,n,i;e.isLight&&(e.isDirectionalLight||e.isPointLight||e.isSpotLight?(r=(i=this.writer).json,i=i.extensionsUsed,n={},e.name&&(n.name=e.name),n.color=e.color.toArray(),n.intensity=e.intensity,e.isDirectionalLight?n.type="directional":e.isPointLight?(n.type="point",0<e.distance&&(n.range=e.distance)):e.isSpotLight&&(n.type="spot",0<e.distance&&(n.range=e.distance),n.spot={},n.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,n.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),i[this.name]||(r.extensions=r.extensions||{},r.extensions[this.name]={lights:[]},i[this.name]=!0),(i=r.extensions[this.name].lights).push(n),t.extensions=t.extensions||{},t.extensions[this.name]={light:i.length-1}):console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e))}}]),e}(),ri=function(){function e(t){Hn(this,e),this.writer=t,this.name="KHR_materials_unlit"}return zn(e,[{key:"writeMaterial",value:function(e,t){e.isMeshBasicMaterial&&(e=this.writer.extensionsUsed,t.extensions=t.extensions||{},t.extensions[this.name]={},e[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9)}}]),e}(),ni=function(){function e(t){Hn(this,e),this.writer=t,this.name="KHR_materials_pbrSpecularGlossiness"}return zn(e,[{key:"writeMaterial",value:function(e,t){var r,n,i,o;e.isGLTFSpecularGlossinessMaterial&&(n=(r=this.writer).extensionsUsed,i={},t.pbrMetallicRoughness.baseColorFactor&&(i.diffuseFactor=t.pbrMetallicRoughness.baseColorFactor),e.specular.toArray(o=[1,1,1],0),i.specularFactor=o,i.glossinessFactor=e.glossiness,t.pbrMetallicRoughness.baseColorTexture&&(i.diffuseTexture=t.pbrMetallicRoughness.baseColorTexture),e.specularMap&&(o={index:r.processTexture(e.specularMap)},r.applyTextureTransform(o,e.specularMap),i.specularGlossinessTexture=o),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0)}}]),e}(),ii=function(){function e(t){Hn(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return zn(e,[{key:"writeMaterial",value:function(e,t){var r,n,i,o;e.isMeshPhysicalMaterial&&(n=(r=this.writer).extensionsUsed,(i={}).clearcoatFactor=e.clearcoat,e.clearcoatMap&&(o={index:r.processTexture(e.clearcoatMap)},r.applyTextureTransform(o,e.clearcoatMap),i.clearcoatTexture=o),i.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap&&(o={index:r.processTexture(e.clearcoatRoughnessMap)},r.applyTextureTransform(o,e.clearcoatRoughnessMap),i.clearcoatRoughnessTexture=o),e.clearcoatNormalMap&&(o={index:r.processTexture(e.clearcoatNormalMap)},r.applyTextureTransform(o,e.clearcoatNormalMap),i.clearcoatNormalTexture=o),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0)}}]),e}(),oi=function(){function e(t){Hn(this,e),this.writer=t,this.name="KHR_materials_transmission"}return zn(e,[{key:"writeMaterial",value:function(e,t){var r,n,i,o;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(i={}).transmissionFactor=e.transmission,e.transmissionMap&&(o={index:r.processTexture(e.transmissionMap)},r.applyTextureTransform(o,e.transmissionMap),i.transmissionTexture=o),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0)}}]),e}(),ai=function(){function e(t){Hn(this,e),this.writer=t,this.name="KHR_materials_volume"}return zn(e,[{key:"writeMaterial",value:function(e,t){var r,n,i,o;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(i={}).thicknessFactor=e.thickness,e.thicknessMap&&(o={index:r.processTexture(e.thicknessMap)},r.applyTextureTransform(o,e.thicknessMap),i.thicknessTexture=o),i.attenuationDistance=e.attenuationDistance,i.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0)}}]),e}(),si=(Vn.Utils={insertKeyframe:function(e,t){var r,n=e.getValueSize(),i=new e.TimeBufferType(e.times.length+1),o=new e.ValueBufferType(e.values.length+n),a=e.createInterpolant(new e.ValueBufferType(n));if(0===e.times.length){i[0]=t;for(var s=0;s<n;s++)o[s]=0;r=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<.001)return 0;i[0]=t,i.set(e.times,1),o.set(a.evaluate(t),0),o.set(e.values,n),r=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<.001)return e.times.length-1;i[i.length-1]=t,i.set(e.times,0),o.set(e.values,0),o.set(a.evaluate(t),e.values.length),r=i.length-1}else for(var l=0;l<e.times.length;l++){if(Math.abs(e.times[l]-t)<.001)return l;if(e.times[l]<t&&e.times[l+1]>t){i.set(e.times.slice(0,l+1),0),i[l+1]=t,i.set(e.times.slice(l+1),l+2),o.set(e.values.slice(0,(l+1)*n),0),o.set(a.evaluate(t),(l+1)*n),o.set(e.values.slice((l+1)*n),(l+2)*n),r=l+1;break}}return e.times=i,e.values=o,r},mergeMorphTargetTracks:function(e,t){for(var n=[],i={},o=e.tracks,a=0;a<o.length;++a){var s=o[a],l=r.PropertyBinding.parseTrackName(s.name),u=r.PropertyBinding.findNode(t,l.nodeName);if("morphTargetInfluences"!==l.propertyName||void 0===l.propertyIndex)n.push(s);else{if(s.createInterpolant!==s.InterpolantFactoryMethodDiscrete&&s.createInterpolant!==s.InterpolantFactoryMethodLinear){if(s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),(s=s.clone()).setInterpolation(r.InterpolateLinear)}var c=u.morphTargetInfluences.length,h=u.morphTargetDictionary[l.propertyIndex];if(void 0===h)throw new Error("THREE.GLTFExporter: Morph target name not found: "+l.propertyIndex);var d=void 0;if(void 0===i[u.uuid]){for(var p=new((d=s.clone()).ValueBufferType)(c*d.times.length),f=0;f<d.times.length;f++)p[f*c+h]=d.values[f];d.name=(l.nodeName||"")+".morphTargetInfluences",d.values=p,i[u.uuid]=d,n.push(d)}else{var m=s.createInterpolant(new s.ValueBufferType(1));d=i[u.uuid];for(var g=0;g<d.times.length;g++)d.values[g*c+h]=m.evaluate(d.times[g]);for(var v=0;v<s.times.length;v++){var y=this.insertKeyframe(d,s.times[v]);d.values[y*c+h]=s.values[v]}}}}return e.tracks=n,e}},function(e,t,r,n){return new(r=r||Promise)((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))});class li extends V{constructor(){super(...arguments),this._gltf=new fn,this._originGltf=new Vn,this.options=new an}getArrayBuffer(e=this.runScene.sceneEx.getClear(),t="scene"){return si(this,void 0,void 0,(function*(){const r=new sn({type:t,runScene:this.runScene,model:e});return new Promise((t=>{this._gltf.parse(e,(e=>{t(e)}),{binary:!0,onlyVisible:!1,includeCustomExtensions:!0,myOptions:{helper:r,optionsEx:this.runScene.optionsEx}})}))}))}getOriginArrayBuffer(e){return si(this,void 0,void 0,(function*(){return new Promise((t=>{this._originGltf.parse(e,(e=>{t(e)}),(()=>{}),{binary:!0,onlyVisible:!1,includeCustomExtensions:!0,animations:[...e.animations]})}))}))}export(e){return si(this,void 0,void 0,(function*(){var t=yield this.getArrayBuffer(e);(0,Fr.downloadFile)(new Blob([t]),"scene.glb")}))}model(e){return si(this,void 0,void 0,(function*(){var t,r=e||this.runScene.modelEx.select;r&&(t=r.name||r.type,r=yield this.getArrayBuffer(this.runScene.modelEx.clone(r,!1),"model"),(0,Fr.downloadFile)(new Blob([r]),t+".glb"))}))}material(e){var t;return si(this,void 0,void 0,(function*(){if(r=e||(null==(t=this.runScene.modelEx.select)?void 0:t.material)){const e=(0,lt.createDefModel)("Box");var r=(e.material=r).name||"material",n=yield this.getArrayBuffer(e,"material");(0,Fr.downloadFile)(new Blob([n]),r+".glb")}}))}scene(e=!0){return si(this,void 0,void 0,(function*(){var t=yield this.getArrayBuffer();return e&&(0,Fr.downloadFile)(new Blob([t]),"scene.glb"),t}))}originModel(e){return si(this,void 0,void 0,(function*(){var t,r;e&&(t=e.name||e.type,r=yield this.getOriginArrayBuffer(e),(0,Fr.downloadFile)(new Blob([r]),t+".glb"))}))}}class ui extends V{constructor(e){super(e),this.gltf=new li(e)}}var ci={},hi=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},di=function(e){return new Worker(e)};try{URL.revokeObjectURL(hi(""))}catch(Bi){hi=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)},di=function(e){return new Worker(e,{type:"module"})}}for(var pi=Uint8Array,fi=Uint16Array,mi=Uint32Array,gi=new pi([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),vi=new pi([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),yi=new pi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),bi=(j=function(e,t){for(var r=new fi(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];var i=new mi(r[30]);for(n=1;n<30;++n)for(var o=r[n];o<r[n+1];++o)i[o]=o-r[n]<<5|n;return[r,i]},(xn=j(gi,2))[0]),xi=xn[1],wi=(bi[28]=258,xi[258]=28,bn=j(vi,0))[0],Ai=bn[1],Si=new fi(32768),Bi=0;Bi<32768;++Bi){var Mi=(43690&Bi)>>>1|(21845&Bi)<<1;Si[Bi]=((65280&(Mi=(61680&(Mi=(52428&Mi)>>>2|(13107&Mi)<<2))>>>4|(3855&Mi)<<4))>>>8|(255&Mi)<<8)>>>1}var Ci=function(e,t,r){for(var n=e.length,i=0,o=new fi(t);i<n;++i)++o[e[i]-1];var a=new fi(t);for(i=0;i<t;++i)a[i]=a[i-1]+o[i-1]<<1;if(r){var s=new fi(1<<t),l=15-t;for(i=0;i<n;++i)if(e[i])for(var u=i<<4|e[i],c=t-e[i],h=a[e[i]-1]++<<c,d=h|(1<<c)-1;h<=d;++h)s[Si[h]>>>l]=u}else for(s=new fi(n),i=0;i<n;++i)e[i]&&(s[i]=Si[a[e[i]-1]++]>>>15-e[i]);return s},Ei=new pi(288);for(Bi=0;Bi<144;++Bi)Ei[Bi]=8;for(Bi=144;Bi<256;++Bi)Ei[Bi]=9;for(Bi=256;Bi<280;++Bi)Ei[Bi]=7;for(Bi=280;Bi<288;++Bi)Ei[Bi]=8;var _i=new pi(32);for(Bi=0;Bi<32;++Bi)_i[Bi]=5;function Ti(e){return e.ondata=function(e,t){return postMessage([e,t],[e.buffer])},function(t){return e.push(t.data[0],t.data[1])}}function Di(e,t,r,n,i){var o,a=ao(e,n,i,(function(e,r){e?(a.terminate(),t.ondata.call(t,e)):(r[1]&&a.terminate(),t.ondata.call(t,e,r[0],r[1]))}));a.postMessage(r),t.push=function(e,r){if(o)throw"stream finished";if(!t.ondata)throw"no stream handler";a.postMessage([e,o=r],[e.buffer])},t.terminate=function(){a.terminate()}}function Ri(e,t){return yo(e,t)+4294967296*yo(e,t+4)}var Oi=Ci(Ei,9,0),Pi=Ci(Ei,9,1),Ii=Ci(_i,5,0),ki=Ci(_i,5,1),Li=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},Fi=function(e,t,r){var n=t/8|0;return(e[n]|e[1+n]<<8)>>(7&t)&r},Ui=function(e,t){var r=t/8|0;return(e[r]|e[1+r]<<8|e[2+r]<<16)>>(7&t)},Gi=function(e){return(e/8|0)+(7&e&&1)},ji=function(e,t,r){(null==t||t<0)&&(t=0),(null==r||r>e.length)&&(r=e.length);var n=new(e instanceof fi?fi:e instanceof mi?mi:pi)(r-t);return n.set(e.subarray(t,r)),n},Hi=function(e,t,r){var n=e.length;if(!n||r&&!r.l&&n<5)return t||new pi(0);function i(e){var r=t.length;r<e&&((r=new pi(Math.max(2*r,e))).set(t),t=r)}var o=!t||r,a=!r||r.i,s=(r=r||{},t=t||new pi(3*n),r.f||0),l=r.p||0,u=r.b||0,c=r.l,h=r.d,d=r.m,p=r.n,f=8*n;do{if(!c){r.f=s=Fi(e,l,1);var m=Fi(e,l+1,3);if(l+=3,!m){var g=e[(M=Gi(l)+4)-4]|e[M-3]<<8;if(n<(A=M+g)){if(a)throw"unexpected EOF";break}o&&i(u+g),t.set(e.subarray(M,A),u),r.b=u+=g,r.p=l=8*A;continue}if(1==m)c=Pi,h=ki,d=9,p=5;else{if(2!=m)throw"invalid block type";g=Fi(e,l,31)+257;for(var v=Fi(e,l+10,15)+4,y=g+Fi(e,l+5,31)+1,b=(l+=14,new pi(y)),x=new pi(19),w=0;w<v;++w)x[yi[w]]=Fi(e,l+3*w,7);l+=3*v;var A,S=(1<<(A=Li(x)))-1,B=Ci(x,A,1);for(w=0;w<y;){var M,C=B[Fi(e,l,S)];if(l+=15&C,(M=C>>>4)<16)b[w++]=M;else{var E=0,_=0;for(16==M?(_=3+Fi(e,l,3),l+=2,E=b[w-1]):17==M?(_=3+Fi(e,l,7),l+=3):18==M&&(_=11+Fi(e,l,127),l+=7);_--;)b[w++]=E}}m=b.subarray(0,g);var T=b.subarray(g);d=Li(m),p=Li(T),c=Ci(m,d,1),h=Ci(T,p,1)}if(f<l){if(a)throw"unexpected EOF";break}}o&&i(u+131072);for(var D=(1<<d)-1,R=(1<<p)-1,O=l;;O=l){var P=(E=c[Ui(e,l)&D])>>>4;if(f<(l+=15&E)){if(a)throw"unexpected EOF";break}if(!E)throw"invalid length/literal";if(P<256)t[u++]=P;else{if(256==P){O=l,c=null;break}var I,k=P-254,L=(264<P&&(I=gi[w=P-257],k=Fi(e,l,(1<<I)-1)+bi[w],l+=I),(P=h[Ui(e,l)&R])>>>4);if(!P)throw"invalid distance";if(l+=15&P,T=wi[L],3<L&&(I=vi[L],T+=Ui(e,l)&(1<<I)-1,l+=I),f<l){if(a)throw"unexpected EOF";break}o&&i(u+131072);for(var F=u+k;u<F;u+=4)t[u]=t[u-T],t[u+1]=t[u+1-T],t[u+2]=t[u+2-T],t[u+3]=t[u+3-T];u=F}}r.l=c,r.p=O,r.b=u,c&&(s=1,r.m=d,r.d=h,r.n=p)}while(!s);return u==t.length?t:ji(t,0,u)},Ni=function(e,t,r){var n=t/8|0;e[n]|=r<<=7&t,e[1+n]|=r>>>8},zi=function(e,t,r){var n=t/8|0;e[n]|=r<<=7&t,e[1+n]|=r>>>8,e[2+n]|=r>>>16},Vi=function(e,t){for(var r=[],n=0;n<e.length;++n)e[n]&&r.push({s:n,f:e[n]});var i=r.length,o=r.slice();if(!i)return[Yi,0];if(1==i)return(m=new pi(r[0].s+1))[r[0].s]=1,[m,1];r.sort((function(e,t){return e.f-t.f})),r.push({s:-1,f:25001});var a=r[0],s=r[1],l=0,u=1,c=2;for(r[0]={s:-1,f:a.f+s.f,l:a,r:s};u!=i-1;)a=r[r[l].f<r[c].f?l++:c++],s=r[l!=u&&r[l].f<r[c].f?l++:c++],r[u++]={s:-1,f:a.f+s.f,l:a,r:s};var h=o[0].s;for(n=1;n<i;++n)o[n].s>h&&(h=o[n].s);var d=new fi(h+1),p=Ji(r[u-1],d,0);if(t<p){n=0;var f=0,m=p-t,g=1<<m;for(o.sort((function(e,t){return d[t.s]-d[e.s]||e.f-t.f}));n<i;++n){var v=o[n].s;if(!(d[v]>t))break;f+=g-(1<<p-d[v]),d[v]=t}for(f>>>=m;0<f;){var y=o[n].s;d[y]<t?f-=1<<t-d[y]++-1:++n}for(;0<=n&&f;--n){var b=o[n].s;d[b]==t&&(--d[b],++f)}p=t}return[new pi(d),p]},Ji=function e(t,r,n){return-1==t.s?Math.max(e(t.l,r,n+1),e(t.r,r,n+1)):r[t.s]=n},Ki=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new fi(++t),n=0,i=e[0],o=1,a=function(e){r[n++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++o;else{if(!i&&2<o){for(;138<o;o-=138)a(32754);2<o&&(a(10<o?o-11<<5|28690:o-3<<5|12305),o=0)}else if(3<o){for(a(i),--o;6<o;o-=6)a(8304);2<o&&(a(o-3<<5|8208),o=0)}for(;o--;)a(i);o=1,i=e[s]}return[r.subarray(0,n),t]},Wi=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},Xi=function(e,t,r){var n=r.length,i=Gi(t+2);e[i]=255&n,e[i+1]=n>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var o=0;o<n;++o)e[i+o+4]=r[o];return 8*(i+4+n)},Qi=function(e,t,r,n,i,o,a,s,l,u,c){Ni(t,c++,r),++i[256];for(var h=(r=Vi(i,15))[0],d=(r=r[1],(p=Vi(o,15))[0]),p=p[1],f=(m=Ki(h))[0],m=m[1],g=(v=Ki(d))[0],v=v[1],y=new fi(19),b=0;b<f.length;++b)y[31&f[b]]++;for(b=0;b<g.length;++b)y[31&g[b]]++;for(var x=(w=Vi(y,7))[0],w=w[1],A=19;4<A&&!x[yi[A-1]];--A);var S,B=u+5<<3,M=Wi(i,Ei)+Wi(o,_i)+a;if(i=Wi(i,h)+Wi(o,d)+a+14+3*A+Wi(y,x)+(2*y[16]+3*y[17]+7*y[18]),B<=M&&B<=i)return Xi(t,c,e.subarray(l,l+u));if(Ni(t,c,1+(i<M)),c+=2,i<M){var C=Ci(h,r,0),E=h,_=Ci(d,p,0),T=d,D=Ci(x,w,0);for(Ni(t,c,m-257),Ni(t,c+5,v-1),Ni(t,c+10,A-4),c+=14,b=0;b<A;++b)Ni(t,c+3*b,x[yi[b]]);c+=3*A;for(var R=[f,g],O=0;O<2;++O){var P=R[O];for(b=0;b<P.length;++b){var I=31&P[b];Ni(t,c,D[I]),c+=x[I],15<I&&(Ni(t,c,P[b]>>>5&127),c+=P[b]>>>12)}}}else C=Oi,E=Ei,_=Ii,T=_i;for(b=0;b<s;++b)255<n[b]?(I=n[b]>>>18&31,zi(t,c,C[I+257]),c+=E[I+257],7<I&&(Ni(t,c,n[b]>>>23&31),c+=gi[I]),S=31&n[b],zi(t,c,_[S]),c+=T[S],3<S&&(zi(t,c,n[b]>>>5&8191),c+=vi[S])):(zi(t,c,C[n[b]]),c+=E[n[b]]);return zi(t,c,C[256]),c+E[256]},Zi=new mi([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Yi=new pi(0),qi=function(e,t,r,n,i,o){var a=e.length,s=new pi(n+a+5*(1+Math.ceil(a/7e3))+i),l=s.subarray(n,s.length-i),u=0;if(!t||a<8)for(var c=0;c<=a;c+=65535){var h=c+65535;u=h<a?Xi(l,u,e.subarray(c,h)):(l[c]=o,Xi(l,u,e.subarray(c,a)))}else{for(var d=(t=Zi[t-1])>>>13,p=8191&t,f=(1<<r)-1,m=new fi(32768),g=new fi(1+f),v=Math.ceil(r/3),y=2*v,b=function(t){return(e[t]^e[t+1]<<v^e[t+2]<<y)&f},x=new mi(25e3),w=new fi(288),A=new fi(32),S=0,B=0,M=(c=0,0),C=0,E=0;c<a;++c){var _=b(c),T=32767&c,D=g[_];if(m[T]=D,g[_]=T,C<=c){var R=a-c;if((7e3<S||24576<M)&&423<R){u=Qi(e,l,0,x,w,A,B,M,E,c-E,u),M=S=B=0,E=c;for(var O=0;O<286;++O)w[O]=0;for(O=0;O<30;++O)A[O]=0}var P=2,I=0,k=p,L=T-D&32767;if(2<R&&_==b(c-L))for(var F=Math.min(d,R)-1,U=Math.min(32767,c),G=Math.min(258,R);L<=U&&--k&&T!=D;){if(e[c+P]==e[c+P-L]){for(var j=0;j<G&&e[c+j]==e[c+j-L];++j);if(P<j){if(I=L,F<(P=j))break;var H=Math.min(L,j-2),N=0;for(O=0;O<H;++O){var z=c-L+O+32768&32767,V=z-m[z]+32768&32767;N<V&&(N=V,D=z)}}}L+=(T=D)-(D=m[T])+32768&32767}I?(x[M++]=268435456|xi[P]<<18|Ai[I],_=31&xi[P],R=31&Ai[I],B+=gi[_]+vi[R],++w[257+_],++A[R],C=c+P,++S):(x[M++]=e[c],++w[e[c]])}}u=Qi(e,l,o,x,w,A,B,M,E,c-E,u),!o&&7&u&&(u=Xi(l,u+1,Yi))}return ji(s,0,n+Gi(u)+i)},$i=function(){for(var e=new mi(256),t=0;t<256;++t){for(var r=t,n=9;--n;)r=(1&r&&3988292384)^r>>>1;e[t]=r}return e}(),eo=function(){var e=-1;return{p:function(t){for(var r=e,n=0;n<t.length;++n)r=$i[255&r^t[n]]^r>>>8;e=r},d:function(){return~e}}},to=function(){var e=1,t=0;return{p:function(r){for(var n=e,i=t,o=r.length,a=0;a!=o;){for(var s=Math.min(a+2655,o);a<s;++a)i+=n+=r[a];n=(65535&n)+15*(n>>16),i=(65535&i)+15*(i>>16)}e=n,t=i},d:function(){return(255&(e%=65521))<<24|e>>>8<<16|(255&(t%=65521))<<8|t>>>8}}},ro=function(e,t,r,n,i){return qi(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,r,n,!i)},no=function(e,t){var r,n={};for(r in e)n[r]=e[r];for(r in t)n[r]=t[r];return n},io=function(e,t,r){for(var n=e(),i=(e=e.toString()).slice(e.indexOf("[")+1,e.lastIndexOf("]")).replace(/ /g,"").split(","),o=0;o<n.length;++o){var a=n[o],s=i[o];if("function"==typeof a){t+=";"+s+"=";var l=a.toString();if(a.prototype)if(-1!=l.indexOf("[native code]")){var u=l.indexOf(" ",8)+1;t+=l.slice(u,l.indexOf("(",u))}else for(var c in t+=l,a.prototype)t+=";"+s+".prototype."+c+"="+a.prototype[c].toString();else t+=l}else r[s]=a}return[t,r]},oo=[],ao=function(e,t,r,n){var i;if(!oo[r]){for(var o="",a={},s=e.length-1,l=0;l<s;++l)o=(i=io(e[l],o,a))[0],a=i[1];oo[r]=io(e[s],o,a)}var u=no({},oo[r][1]);return function(e,t,r,n,i){return(t=di(ci[t]||(ci[t]=hi(e)))).onerror=function(e){return i(e.error,null)},t.onmessage=function(e){return i(null,e.data)},t.postMessage(r,n),t}(oo[r][0]+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",r,u,function(e){var t,r=[];for(t in e)(e[t]instanceof pi||e[t]instanceof fi||e[t]instanceof mi)&&r.push((e[t]=new e[t].constructor(e[t])).buffer);return r}(u),n)},so=function(){return[pi,fi,mi,gi,vi,yi,bi,wi,Pi,ki,Si,Ci,Li,Fi,Ui,Gi,ji,Hi,Io,fo,mo]},lo=function(){return[pi,fi,mi,gi,vi,yi,xi,Ai,Oi,Ei,Ii,_i,Si,Zi,Yi,Ci,Ni,zi,Vi,Ji,Ki,Wi,Xi,Qi,Gi,ji,qi,ro,Do,fo]},uo=function(){return[xo,So,bo,eo,$i]},co=function(){return[wo,Ao]},ho=function(){return[Bo,bo,to]},po=function(){return[Mo]},fo=function(e){return postMessage(e,[e.buffer])},mo=function(e){return e&&e.size&&new pi(e.size)},go=function(e,t,r,n,i,o){var a=ao(r,n,i,(function(e,t){a.terminate(),o(e,t)}));return a.postMessage([e,t],t.consume?[e.buffer]:[]),function(){a.terminate()}},vo=function(e,t){return e[t]|e[t+1]<<8},yo=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},bo=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},xo=function(e,t){var r=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&bo(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),r){e[3]=8;for(var n=0;n<=r.length;++n)e[n+10]=r.charCodeAt(n)}},wo=function(e){if(31!=e[0]||139!=e[1]||8!=e[2])throw"invalid gzip data";var t=e[3],r=10;4&t&&(r+=e[10]|2+(e[11]<<8));for(var n=(t>>3&1)+(t>>4&1);0<n;n-=!e[r++]);return r+(2&t)},Ao=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},So=function(e){return 10+(e.filename&&e.filename.length+1||0)},Bo=function(e,t){t=0==(t=t.level)?0:t<6?1:9==t?3:2,e[0]=120,e[1]=t<<6|(t?32-2*t:1)},Mo=function(e){if(8!=(15&e[0])||7<e[0]>>>4||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"};function Co(e,t){return t||"function"!=typeof e||(t=e,e={}),this.ondata=t,e}var Eo=function(){function e(e,t){t||"function"!=typeof e||(t=e,e={}),this.ondata=t,this.o=e||{}}return e.prototype.p=function(e,t){this.ondata(ro(e,this.o,0,0,!t),t)},e.prototype.push=function(e,t){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";this.d=t,this.p(e,t||!1)},e}(),_o=function(e,t){Di([lo,function(){return[Ti,Eo]}],this,Co.call(this,e,t),(function(e){e=new Eo(e.data),onmessage=Ti(e)}),6)};function To(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return go(e,t,[lo],(function(e){return fo(Do(e.data[0],e.data[1]))}),0,r)}function Do(e,t){return ro(e,t||{},0,0)}var Ro=function(){function e(e){this.s={},this.p=new pi(0),this.ondata=e}return e.prototype.e=function(e){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";var t=this.p.length,r=new pi(t+e.length);r.set(this.p),r.set(e,t),this.p=r},e.prototype.c=function(e){this.d=this.s.i=e||!1,e=this.s.b;var t=Hi(this.p,this.o,this.s);this.ondata(ji(t,e,this.s.b),this.d),this.o=ji(t,this.s.b-32768),this.s.b=this.o.length,this.p=ji(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),Oo=function(e){this.ondata=e,Di([so,function(){return[Ti,Ro]}],this,0,(function(){var e=new Ro;onmessage=Ti(e)}),7)};function Po(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return go(e,t,[so],(function(e){return fo(Io(e.data[0],mo(e.data[1])))}),1,r)}function Io(e,t){return Hi(e,t)}var ko=function(){function e(e,t){this.c=eo(),this.l=0,this.v=1,Eo.call(this,e,t)}return e.prototype.push=function(e,t){Eo.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),this.l+=e.length,e=ro(e,this.o,this.v&&So(this.o),t&&8,!t),this.v&&(xo(e,this.o),this.v=0),t&&(bo(e,e.length-8,this.c.d()),bo(e,e.length-4,this.l)),this.ondata(e,t)},e}(),Lo=function(e,t){Di([lo,uo,function(){return[Ti,Eo,ko]}],this,Co.call(this,e,t),(function(e){e=new ko(e.data),onmessage=Ti(e)}),8)};function Fo(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return go(e,t,[lo,uo,function(){return[Uo]}],(function(e){return fo(Uo(e.data[0],e.data[1]))}),2,r)}function Uo(e,t){t=t||{};var r=eo(),n=e.length,i=(r.p(e),e=ro(e,t,So(t),8)).length;return xo(e,t),bo(e,i-8,r.d()),bo(e,i-4,n),e}var Go=function(){function e(e){this.v=1,Ro.call(this,e)}return e.prototype.push=function(e,t){if(Ro.prototype.e.call(this,e),this.v){if((e=3<this.p.length?wo(this.p):4)>=this.p.length&&!t)return;this.p=this.p.subarray(e),this.v=0}if(t){if(this.p.length<8)throw"invalid gzip stream";this.p=this.p.subarray(0,-8)}Ro.prototype.c.call(this,t)},e}(),jo=function(e){this.ondata=e,Di([so,co,function(){return[Ti,Ro,Go]}],this,0,(function(){var e=new Go;onmessage=Ti(e)}),9)};function Ho(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return go(e,t,[so,co,function(){return[No]}],(function(e){return fo(No(e.data[0]))}),3,r)}function No(e,t){return Hi(e.subarray(wo(e),-8),t||new pi(Ao(e)))}var zo=function(){function e(e,t){this.c=to(),this.v=1,Eo.call(this,e,t)}return e.prototype.push=function(e,t){Eo.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),e=ro(e,this.o,this.v&&2,t&&4,!t),this.v&&(Bo(e,this.o),this.v=0),t&&bo(e,e.length-4,this.c.d()),this.ondata(e,t)},e}(),Vo=function(e,t){Di([lo,ho,function(){return[Ti,Eo,zo]}],this,Co.call(this,e,t),(function(e){e=new zo(e.data),onmessage=Ti(e)}),10)};function Jo(e,t){t=t||{};var r=to();return r.p(e),e=ro(e,t,2,4),Bo(e,t),bo(e,e.length-4,r.d()),e}var Ko=function(){function e(e){this.v=1,Ro.call(this,e)}return e.prototype.push=function(e,t){if(Ro.prototype.e.call(this,e),this.v){if(this.p.length<2&&!t)return;this.p=this.p.subarray(2),this.v=0}if(t){if(this.p.length<4)throw"invalid zlib stream";this.p=this.p.subarray(0,-4)}Ro.prototype.c.call(this,t)},e}(),Wo=function(e){this.ondata=e,Di([so,po,function(){return[Ti,Ro,Ko]}],this,0,(function(){var e=new Ko;onmessage=Ti(e)}),11)};function Xo(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return go(e,t,[so,po,function(){return[Qo]}],(function(e){return fo(Qo(e.data[0],mo(e.data[1])))}),5,r)}function Qo(e,t){return Hi((Mo(e),e.subarray(2,-4)),t)}var Zo=function(){function e(e){this.G=Go,this.I=Ro,this.Z=Ko,this.ondata=e}return e.prototype.push=function(e,t){if(!this.ondata)throw"no stream handler";var r,n;this.s?this.s.push(e,t):(this.p&&this.p.length?((r=new pi(this.p.length+e.length)).set(this.p),r.set(e,this.p.length)):this.p=e,2<this.p.length&&((n=this).s=new(31==this.p[0]&&139==this.p[1]&&8==this.p[2]?this.G:8!=(15&this.p[0])||7<this.p[0]>>4||(this.p[0]<<8|this.p[1])%31?this.I:this.Z)((function(){n.ondata.apply(n,arguments)})),this.s.push(this.p,t),this.p=null))},e}(),Yo=function(){function e(e){this.G=jo,this.I=Oo,this.Z=Wo,this.ondata=e}return e.prototype.push=function(e,t){Zo.prototype.push.call(this,e,t)},e}(),qo=function e(t,r,n,i){for(var o in t){var a=t[o];o=r+o,a instanceof pi?n[o]=[a,i]:Array.isArray(a)?n[o]=[a[0],no(i,a[1])]:e(a,o+"/",n,i)}},$o="undefined"!=typeof TextEncoder&&new TextEncoder,ea="undefined"!=typeof TextDecoder&&new TextDecoder,ta=0;try{ea.decode(Yi,{stream:!0}),ta=1}catch(Bi){}var ra=function(e){for(var t="",r=0;;){var n=e[r++],i=(127<n)+(223<n)+(239<n);if(r+i>e.length)return[t,ji(e,r-1)];i?3==i?(n=((15&n)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536,t+=String.fromCharCode(55296|n>>10,56320|1023&n)):t+=1&i?String.fromCharCode((31&n)<<6|63&e[r++]):String.fromCharCode((15&n)<<12|(63&e[r++])<<6|63&e[r++]):t+=String.fromCharCode(n)}},na=function(){function e(e){this.ondata=e,ta?this.t=new TextDecoder:this.p=Yi}return e.prototype.push=function(e,t){if(!this.ondata)throw"no callback";if(t=!!t,this.t){if(this.ondata(this.t.decode(e,{stream:!0}),t),t){if(this.t.decode().length)throw"invalid utf-8 data";this.t=null}}else{if(!this.p)throw"stream finished";var r=((r=new pi(this.p.length+e.length)).set(this.p),r.set(e,this.p.length),e=ra(r))[0];if(e=e[1],t){if(e.length)throw"invalid utf-8 data";this.p=null}else this.p=e;this.ondata(r,t)}},e}(),ia=function(){function e(e){this.ondata=e}return e.prototype.push=function(e,t){if(!this.ondata)throw"no callback";if(this.d)throw"stream finished";this.ondata(oa(e),this.d=t||!1)},e}();function oa(e,t){if(t){for(var r=new pi(e.length),n=0;n<e.length;++n)r[n]=e.charCodeAt(n);return r}if($o)return $o.encode(e);var i=e.length,o=new pi(e.length+(e.length>>1)),a=0,s=function(e){o[a++]=e};for(n=0;n<i;++n){a+5>o.length&&((l=new pi(a+8+(i-n<<1))).set(o),o=l);var l=e.charCodeAt(n);l<128||t?s(l):(l<2048?s(192|l>>6):(55295<l&&l<57344?(s(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++n))>>18),s(128|l>>12&63)):s(224|l>>12),s(128|l>>6&63)),s(128|63&l))}return ji(o,0,a)}function aa(e,t){if(t){for(var r="",n=0;n<e.length;n+=16384)r+=String.fromCharCode.apply(null,e.subarray(n,n+16384));return r}if(ea)return ea.decode(e);var i=(t=ra(e))[0];if(t[1].length)throw"invalid utf-8 data";return i}function sa(e){return 1==e?3:e<6?2:9==e?1:0}var la=function(e,t){return t+30+vo(e,t+26)+vo(e,t+28)},ua=function(e,t,r){var n=vo(e,t+28),i=aa(e.subarray(t+46,t+46+n),!(2048&vo(e,t+8))),o=(n=t+46+n,yo(e,t+20)),a=(o=(r=r&&4294967295==o?ca(e,n):[o,yo(e,t+24),yo(e,t+42)])[0],r[1]);return r=r[2],[vo(e,t+10),o,a,i,n+vo(e,t+30)+vo(e,t+32),r]},ca=function(e,t){for(;1!=vo(e,t);t+=4+vo(e,t+2));return[Ri(e,t+12),Ri(e,t+4),Ri(e,t+20)]},ha=function(e){var t=0;if(e)for(var r in e){if(65535<(r=e[r].length))throw"extra field too long";t+=r+4}return t},da=function(e,t,r,n,i,o,a,s){var l=n.length,u=r.extra,c=s&&s.length,h=ha(u),d=(bo(e,t,null!=a?33639248:67324752),t+=4,null!=a&&(e[t++]=20,e[t++]=r.os),e[t]=20,t+=2,e[t++]=r.flag<<1|(null==o&&8),e[t++]=i&&8,e[t++]=255&r.compression,e[t++]=r.compression>>8,i=new Date(null==r.mtime?Date.now():r.mtime)).getFullYear()-1980;if(d<0||119<d)throw"date not in range 1980-2099";if(bo(e,t,d<<25|i.getMonth()+1<<21|i.getDate()<<16|i.getHours()<<11|i.getMinutes()<<5|i.getSeconds()>>>1),t+=4,null!=o&&(bo(e,t,r.crc),bo(e,t+4,o),bo(e,t+8,r.size)),bo(e,t+12,l),bo(e,t+14,h),t+=16,null!=a&&(bo(e,t,c),bo(e,t+6,r.attrs),bo(e,t+10,a),t+=14),e.set(n,t),t+=l,h)for(var p in u){var f=u[p],m=f.length;bo(e,t,+p),bo(e,t+2,m),e.set(f,t+4),t+=4+m}return c&&(e.set(s,t),t+=c),t},pa=function(e,t,r,n,i){bo(e,t,101010256),bo(e,t+8,r),bo(e,t+10,r),bo(e,t+12,n),bo(e,t+16,i)},fa=function(){function e(e){this.filename=e,this.c=eo(),this.size=0,this.compression=0}return e.prototype.process=function(e,t){this.ondata(null,e,t)},e.prototype.push=function(e,t){if(!this.ondata)throw"no callback - add to ZIP archive before pushing";this.c.p(e),this.size+=e.length,t&&(this.crc=this.c.d()),this.process(e,t||!1)},e}(),ma=function(){function e(e,t){var r=this;t=t||{},fa.call(this,e),this.d=new Eo(t,(function(e,t){r.ondata(null,e,t)})),this.compression=8,this.flag=sa(t.level)}return e.prototype.process=function(e,t){try{this.d.push(e,t)}catch(e){this.ondata(e,null,t)}},e.prototype.push=function(e,t){fa.prototype.push.call(this,e,t)},e}(),ga=function(){function e(e,t){var r=this;t=t||{},fa.call(this,e),this.d=new _o(t,(function(e,t,n){r.ondata(e,t,n)})),this.compression=8,this.flag=sa(t.level),this.terminate=this.d.terminate}return e.prototype.process=function(e,t){this.d.push(e,t)},e.prototype.push=function(e,t){fa.prototype.push.call(this,e,t)},e}(),va=function(){function e(e){this.ondata=e,this.u=[],this.d=1}return e.prototype.add=function(e){var t=this;if(2&this.d)throw"stream finished";var r=oa(e.filename),n=r.length,i=(o=e.comment)&&oa(o),o=n!=e.filename.length||i&&o.length!=i.length,a=n+ha(e.extra)+30;if(65535<n)throw"filename too long";function s(){for(var e=0,r=l;e<r.length;e++){var n=r[e];t.ondata(null,n,!1)}l=[]}n=new pi(a);var l=(da(n,0,e,r,o),[n]),u=this.d,c=(this.d=0,this.u.length),h=no(e,{f:r,u:o,o:i,t:function(){e.terminate&&e.terminate()},r:function(){var e;s(),u&&((e=t.u[c+1])?e.r():t.d=1),u=1}}),d=0;e.ondata=function(r,n,i){r?(t.ondata(r,n,i),t.terminate()):(d+=n.length,l.push(n),i?(r=new pi(16),bo(r,0,134695760),bo(r,4,e.crc),bo(r,8,d),bo(r,12,e.size),l.push(r),h.c=d,h.b=a+d+16,h.crc=e.crc,h.size=e.size,u&&h.r(),u=1):u&&s())},this.u.push(h)},e.prototype.end=function(){var e=this;if(2&this.d){if(1&this.d)throw"stream finishing";throw"stream finished"}this.d?this.e():this.u.push({r:function(){1&e.d&&(e.u.splice(-1,1),e.e())},t:function(){}}),this.d=3},e.prototype.e=function(){for(var e=0,t=0,r=0,n=0,i=this.u;n<i.length;n++)r+=46+(l=i[n]).f.length+ha(l.extra)+(l.o?l.o.length:0);for(var o=new pi(r+22),a=0,s=this.u;a<s.length;a++){var l=s[a];da(o,e,l,l.f,l.u,l.c,t,l.o),e+=46+l.f.length+ha(l.extra)+(l.o?l.o.length:0),t+=l.b}pa(o,e,this.u.length,r,t),this.ondata(null,o,!0),this.d=2},e.prototype.terminate=function(){for(var e=0,t=this.u;e<t.length;e++)t[e].t();this.d=2},e}(),ya=function(){function e(){}return e.prototype.push=function(e,t){this.ondata(null,e,t)},e.compression=0,e}(),ba=function(){function e(){var e=this;this.i=new Ro((function(t,r){e.ondata(null,t,r)}))}return e.prototype.push=function(e,t){try{this.i.push(e,t)}catch(r){this.ondata(r,e,t)}},e.compression=8,e}(),xa=function(){function e(e,t){var r=this;t<32e4?this.i=new Ro((function(e,t){r.ondata(null,e,t)})):(this.i=new Oo((function(e,t,n){r.ondata(e,t,n)})),this.terminate=this.i.terminate)}return e.prototype.push=function(e,t){this.i.terminate&&(e=ji(e,0)),this.i.push(e,t)},e.compression=8,e}(),wa=function(){function e(e){this.onfile=e,this.k=[],this.o={0:ya},this.p=Yi}return e.prototype.push=function(e,t){var r=this;if(!this.onfile)throw"no callback";if(!this.p)throw"stream finished";if(0<this.c){var n=Math.min(this.c,e.length),i=e.subarray(0,n);if(this.c-=n,this.d?this.d.push(i,!this.c):this.k[0].push(i),(e=e.subarray(n)).length)return this.push(e,t)}else{for(var o=0,a=0,s=void 0,l=void 0,u=(this.p.length?e.length?((l=new pi(this.p.length+e.length)).set(this.p),l.set(e,this.p.length)):l=this.p:l=e,l.length),c=this.c,h=(i=c&&this.d,this);a<u-4&&"break"!==function(){var e,t,n,i,d,p,f,m,g,v,y,b=yo(l,a);return 67324752==b?(o=1,s=a,h.d=null,h.c=0,n=vo(l,a+6),e=vo(l,a+8),t=2048&n,n&=8,i=vo(l,a+26),d=vo(l,a+28),a+30+i+d<u&&(h.k.unshift(p=[]),o=2,f=yo(l,a+18),m=yo(l,a+22),g=aa(l.subarray(a+30,a+=30+i),!t),4294967295==f?(i=n?[-2]:ca(l,a),f=i[0],m=i[1]):n&&(f=-1),a+=d,h.c=f,y={name:g,compression:e,start:function(){if(!y.ondata)throw"no callback";if(f){var t=r.o[e];if(!t)throw"unknown compression type "+e;(v=f<0?new t(g):new t(g,f,m)).ondata=function(e,t,r){y.ondata(e,t,r)};for(var n=0,i=p;n<i.length;n++)v.push(i[n],!1);r.k[0]==p&&r.c?r.d=v:v.push(Yi,!0)}else y.ondata(null,Yi,!0)},terminate:function(){v&&v.terminate&&v.terminate()}},0<=f&&(y.size=f,y.originalSize=m),h.onfile(y)),"break"):c?134695760==b?(s=a+=12+(-2==c&&8),o=3,h.c=0,"break"):33639248==b?(s=a-=4,o=3,h.c=0,"break"):void 0:void 0}();++a);if(this.p=Yi,c<0&&(n=o?l.subarray(0,s-12-(-2==c&&8)-(134695760==yo(l,s-16)&&4)):l.subarray(0,a),i?i.push(n,!!o):this.k[+(2==o)].push(n)),2&o)return this.push(l.subarray(a),t);this.p=l.subarray(a)}if(t){if(this.c)throw"invalid zip file";this.p=null}},e.prototype.register=function(e){this.o[e.compression]=e},e}();function Aa(e,t,r){var n=r.length-e-1;if(t>=r[n])return n-1;if(t<=r[e])return e;for(var i=e,o=n,a=Math.floor((i+o)/2);t<r[a]||t>=r[a+1];)t<r[a]?o=a:i=a,a=Math.floor((i+o)/2);return a}function Sa(e,t,r,n){for(var i=[],o=[],a=[],s=i[0]=1;s<=r;++s){o[s]=t-n[e+1-s],a[s]=n[e+s]-t;for(var l=0,u=0;u<s;++u){var c=a[u+1],h=o[s-u],d=i[u]/(c+h);i[u]=l+c*d,l=h*d}i[s]=l}return i}function Ba(e,t,n,i,o){for(var a=o<e?o:e,s=[],l=Aa(e,i,t),u=function(e,t,r,n,i){for(var o=[],a=0;a<=r;++a)o[a]=0;for(var s=[],l=0;l<=n;++l)s[l]=o.slice(0);for(var u=[],c=0;c<=r;++c)u[c]=o.slice(0);u[0][0]=1;for(var h=o.slice(0),d=o.slice(0),p=1;p<=r;++p){h[p]=t-i[e+1-p],d[p]=i[e+p]-t;for(var f=0,m=0;m<p;++m){var g=d[m+1],v=h[p-m],y=(u[p][m]=g+v,u[m][p-1]/u[p][m]);u[m][p]=f+g*y,f=v*y}u[p][p]=f}for(var b=0;b<=r;++b)s[0][b]=u[b][r];for(var x=0;x<=r;++x){for(var w=0,A=1,S=[],B=0;B<=r;++B)S[B]=o.slice(0);for(var M=S[0][0]=1;M<=n;++M){var C=0,E=x-M,_=r-M;M<=x&&(S[A][0]=S[w][0]/u[1+_][E],C=S[A][0]*u[E][_]);for(var T=x-1<=_?M-1:r-x,D=-1<=E?1:-E;D<=T;++D)S[A][D]=(S[w][D]-S[w][D-1])/u[1+_][E+D],C+=S[A][D]*u[E+D][_];x<=_&&(S[A][M]=-S[w][M-1]/u[1+_][x],C+=S[A][M]*u[x][_]),s[M][x]=C;var R=w;w=A,A=R}}for(var O=r,P=1;P<=n;++P){for(var I=0;I<=r;++I)s[P][I]*=O;O*=r-P}return s}(l,i,e,a,t),c=[],h=0;h<n.length;++h){var d=n[h].clone(),p=d.w;d.x*=p,d.y*=p,d.z*=p,c[h]=d}for(var f=0;f<=a;++f){for(var m=c[l-e].clone().multiplyScalar(u[f][0]),g=1;g<=e;++g)m.add(c[l-e+g].clone().multiplyScalar(u[f][g]));s[f]=m}for(var v=a+1;v<=o+1;++v)s[v]=new r.Vector4(0,0,0);return s}function Ma(e){for(var t=e.length,n=[],i=[],o=0;o<t;++o){var a=e[o];n[o]=new r.Vector3(a.x,a.y,a.z),i[o]=a.w}for(var s=[],l=0;l<t;++l){for(var u=n[l].clone(),c=1;c<=l;++c)u.sub(s[l-c].clone().multiplyScalar(function(e,t){for(var r=1,n=2;n<=e;++n)r*=n;for(var i=1,o=2;o<=t;++o)i*=o;for(var a=2;a<=e-t;++a)i*=a;return r/i}(l,c)*i[c]));s[l]=u.divideScalar(i[0])}return s}function Ca(e){return(Ca="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ea(e,t){return(Ea=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _a(e){return(_a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ta,Da,Ra,Oa=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ea(t,e);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=_a(e);if(r=t?(r=_a(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Ca(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e,t,o,a,s){var l;if(!(this instanceof i))throw new TypeError("Cannot call a class as a function");(l=n.call(this)).degree=e,l.knots=t,l.controlPoints=[],l.startKnot=a||0,l.endKnot=s||l.knots.length-1;for(var u=0;u<o.length;++u){var c=o[u];l.controlPoints[u]=new r.Vector4(c.x,c.y,c.z,c.w)}return l}return t=i,(e=[{key:"getPoint",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new r.Vector3;return e=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),e=function(e,t,n,i){for(var o=Aa(e,i,t),a=Sa(o,i,e,t),s=new r.Vector4(0,0,0,0),l=0;l<=e;++l){var u=n[o-e+l],c=a[l],h=u.w*c;s.x+=u.x*h,s.y+=u.y*h,s.z+=u.z*h,s.w+=u.w*c}return s}(this.degree,this.knots,this.controlPoints,e),1!==e.w&&e.divideScalar(e.w),t.set(e.x,e.y,e.z)}},{key:"getTangent",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new r.Vector3,n=(e=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),Ma(Ba(n=this.degree,this.knots,this.controlPoints,e,1)));return t.copy(n[1]).normalize(),t}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.Curve);function Pa(e){return(Pa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ia(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ka(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function La(e,t,r){t&&ka(e.prototype,t),r&&ka(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function Fa(e,t){return(Fa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Ua(e){return(Ua=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ga=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Fa(t,e);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ua(e);if(r=t?(r=Ua(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Pa(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e){return Ia(this,i),n.call(this,e)}return La(i,[{key:"load",value:function(e,t,n,i){var o=this,a=""===o.path?r.LoaderUtils.extractUrlBase(e):o.path,s=new r.FileLoader(this.manager);s.setPath(o.path),s.setResponseType("arraybuffer"),s.setRequestHeader(o.requestHeader),s.setWithCredentials(o.withCredentials),s.load(e,(function(r){try{t(o.parse(r,a))}catch(r){i?i(r):console.error(r),o.manager.itemError(e)}}),n,i)}},{key:"parse",value:function(e,t){if(i="Kaydara FBX Binary \0",(n=e).byteLength>=i.length&&i===rs(n,0,i.length))Ta=(new Va).parse(e);else{if(!function(e){for(var t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],r=0,n=0;n<t.length;++n)if(function(t){var n=e[0];return e=e.slice(r+1),r++,n}()===t[n])return;return 1}(n=rs(e)))throw new Error("THREE.FBXLoader: Unknown format.");if(Wa(n)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Wa(n));Ta=(new za).parse(n)}var n,i=new r.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new ja(i,this.manager).parse(Ta)}}]),i}(r.Loader),ja=function(){function e(t,r){Ia(this,e),this.textureLoader=t,this.manager=r}return La(e,[{key:"parse",value:function(){Da=this.parseConnections();var e=this.parseImages(),t=(e=this.parseTextures(e),e=this.parseMaterials(e),this.parseDeformers()),r=(new Ha).parse(t);return this.parseScene(t,r,e),Ra}},{key:"parseConnections",value:function(){var e=new Map;return"Connections"in Ta&&Ta.Connections.connections.forEach((function(t){var r=t[0],n=t[1],i=(t=t[2],e.has(r)||e.set(r,{parents:[],children:[]}),{ID:n,relationship:t});e.get(r).parents.push(i),e.has(n)||e.set(n,{parents:[],children:[]}),i={ID:r,relationship:t},e.get(n).children.push(i)})),e}},{key:"parseImages",value:function(){var e,t={},r={};if("Video"in Ta.Objects){var n,i=Ta.Objects.Video;for(n in i){var o,a,s=i[n];t[parseInt(n)]=s.RelativeFilename||s.Filename,"Content"in s&&(a=s.Content instanceof ArrayBuffer&&0<s.Content.byteLength,o="string"==typeof s.Content&&""!==s.Content,(a||o)&&(a=this.parseImage(i[n]),r[s.RelativeFilename||s.Filename]=a))}}for(e in t){var l=t[e];void 0!==r[l]?t[e]=r[l]:t[e]=t[e].split("\\").pop()}return t}},{key:"parseImage",value:function(e){var t,r=e.Content,n=e.RelativeFilename||e.Filename,i=n.slice(n.lastIndexOf(".")+1).toLowerCase();switch(i){case"bmp":t="image/bmp";break;case"jpg":case"jpeg":t="image/jpeg";break;case"png":t="image/png";break;case"tif":t="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",n),t="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+i+'" is not supported.')}return"string"==typeof r?"data:"+t+";base64,"+r:(e=new Uint8Array(r),window.URL.createObjectURL(new Blob([e],{type:t})))}},{key:"parseTextures",value:function(e){var t=new Map;if("Texture"in Ta.Objects){var r,n=Ta.Objects.Texture;for(r in n){var i=this.parseTexture(n[r],e);t.set(parseInt(r),i)}}return t}},{key:"parseTexture",value:function(e,t){var n=((t=this.loadTexture(e,t)).ID=e.id,t.name=e.attrName,e.WrapModeU),i=e.WrapModeV;return n=void 0!==n?n.value:0,i=void 0!==i?i.value:0,t.wrapS=0===n?r.RepeatWrapping:r.ClampToEdgeWrapping,t.wrapT=0===i?r.RepeatWrapping:r.ClampToEdgeWrapping,"Scaling"in e&&(n=e.Scaling.value,t.repeat.x=n[0],t.repeat.y=n[1]),"Translation"in e&&(i=e.Translation.value,t.offset.x=i[0],t.offset.y=i[1]),t}},{key:"loadTexture",value:function(e,t){var n,i=this.textureLoader.path,o=Da.get(e.id).children;return o="tga"===(void 0!==o&&0<o.length&&void 0!==t[o[0].ID]&&(0!==(n=t[o[0].ID]).indexOf("blob:")&&0!==n.indexOf("data:")||this.textureLoader.setPath(void 0)),t=e.FileName.slice(-3).toLowerCase())?null===(o=this.manager.getHandler(".tga"))?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),new r.Texture):(o.setPath(this.textureLoader.path),o.load(n)):"psd"===t?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),new r.Texture):this.textureLoader.load(n),this.textureLoader.setPath(i),o}},{key:"parseMaterials",value:function(e){var t=new Map;if("Material"in Ta.Objects){var r,n=Ta.Objects.Material;for(r in n){var i=this.parseMaterial(n[r],e);null!==i&&t.set(parseInt(r),i)}}return t}},{key:"parseMaterial",value:function(e,t){var n,i=e.id,o=e.attrName,a=e.ShadingModel;if("object"===Pa(a)&&(a=a.value),!Da.has(i))return null;switch(e=this.parseParameters(e,t,i),a.toLowerCase()){case"phong":n=new r.MeshPhongMaterial;break;case"lambert":n=new r.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',a),n=new r.MeshPhongMaterial}return n.setValues(e),n.name=o,n}},{key:"parseParameters",value:function(e,t,n){var i={},o=(e.BumpFactor&&(i.bumpScale=e.BumpFactor.value),e.Diffuse?i.color=(new r.Color).fromArray(e.Diffuse.value):!e.DiffuseColor||"Color"!==e.DiffuseColor.type&&"ColorRGB"!==e.DiffuseColor.type||(i.color=(new r.Color).fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=(new r.Color).fromArray(e.Emissive.value):!e.EmissiveColor||"Color"!==e.EmissiveColor.type&&"ColorRGB"!==e.EmissiveColor.type||(i.emissive=(new r.Color).fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(i.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(i.opacity=parseFloat(e.Opacity.value)),i.opacity<1&&(i.transparent=!0),e.ReflectionFactor&&(i.reflectivity=e.ReflectionFactor.value),e.Shininess&&(i.shininess=e.Shininess.value),e.Specular?i.specular=(new r.Color).fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(i.specular=(new r.Color).fromArray(e.SpecularColor.value)),this);return Da.get(n).children.forEach((function(e){var n=e.relationship;switch(n){case"Bump":i.bumpMap=o.getTexture(t,e.ID);break;case"Maya|TEX_ao_map":i.aoMap=o.getTexture(t,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=o.getTexture(t,e.ID),void 0!==i.map&&(i.map.encoding=r.sRGBEncoding);break;case"DisplacementColor":i.displacementMap=o.getTexture(t,e.ID);break;case"EmissiveColor":i.emissiveMap=o.getTexture(t,e.ID),void 0!==i.emissiveMap&&(i.emissiveMap.encoding=r.sRGBEncoding);break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=o.getTexture(t,e.ID);break;case"ReflectionColor":i.envMap=o.getTexture(t,e.ID),void 0!==i.envMap&&(i.envMap.mapping=r.EquirectangularReflectionMapping,i.envMap.encoding=r.sRGBEncoding);break;case"SpecularColor":i.specularMap=o.getTexture(t,e.ID),void 0!==i.specularMap&&(i.specularMap.encoding=r.sRGBEncoding);break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=o.getTexture(t,e.ID),i.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",n)}})),i}},{key:"getTexture",value:function(e,t){return"LayeredTexture"in Ta.Objects&&t in Ta.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Da.get(t).children[0].ID),e.get(t)}},{key:"parseDeformers",value:function(){var e={},t={};if("Deformer"in Ta.Objects){var r,n=Ta.Objects.Deformer;for(r in n){var i,o=n[r],a=Da.get(parseInt(r));"Skin"===o.attrType?((i=this.parseSkeleton(a,n)).ID=r,1<a.parents.length&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),i.geometryID=a.parents[0].ID,e[r]=i):"BlendShape"===o.attrType&&((i={id:r}).rawTargets=this.parseMorphTargets(a,n),i.id=r,1<a.parents.length&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=i)}}return{skeletons:e,morphTargets:t}}},{key:"parseSkeleton",value:function(e,t){var n=[];return e.children.forEach((function(e){var i=t[e.ID];"Cluster"===i.attrType&&(e={ID:e.ID,indices:[],weights:[],transformLink:(new r.Matrix4).fromArray(i.TransformLink.a)},"Indexes"in i&&(e.indices=i.Indexes.a,e.weights=i.Weights.a),n.push(e))})),{rawBones:n,bones:[]}}},{key:"parseMorphTargets",value:function(e,t){for(var r=[],n=0;n<e.children.length;n++){var i=e.children[n],o=t[i.ID],a={name:o.attrName,initialWeight:o.DeformPercent,id:o.id,fullWeights:o.FullWeights.a};if("BlendShapeChannel"!==o.attrType)return;a.geoID=Da.get(parseInt(i.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,r.push(a)}return r}},{key:"parseScene",value:function(e,t,n){Ra=new r.Group;var i=this.parseModels(e.skeletons,t,n),o=Ta.Objects.Model,a=this;i.forEach((function(e){var t=o[e.ID];a.setLookAtProperties(e,t),Da.get(e.ID).parents.forEach((function(t){void 0!==(t=i.get(t.ID))&&t.add(e)})),null===e.parent&&Ra.add(e)})),this.bindSkeleton(e.skeletons,t,i),this.createAmbientLight(),Ra.traverse((function(e){var t;e.userData.transformData&&(e.parent&&(e.userData.transformData.parentMatrix=e.parent.matrix,e.userData.transformData.parentMatrixWorld=e.parent.matrixWorld),t=$a(e.userData.transformData),e.applyMatrix4(t),e.updateWorldMatrix())})),n=(new Na).parse(),1===Ra.children.length&&Ra.children[0].isGroup&&(Ra.children[0].animations=n,Ra=Ra.children[0]),Ra.animations=n}},{key:"parseModels",value:function(e,t,n){var i,o=new Map,a=Ta.Objects.Model;for(i in a){var s=parseInt(i),l=a[i],u=Da.get(s),c=this.buildSkeleton(u,e,s,l.attrName);if(!c){switch(l.attrType){case"Camera":c=this.createCamera(u);break;case"Light":c=this.createLight(u);break;case"Mesh":c=this.createMesh(u,t,n);break;case"NurbsCurve":c=this.createCurve(u,t);break;case"LimbNode":case"Root":c=new r.Bone;break;default:c=new r.Group}c.name=l.attrName?r.PropertyBinding.sanitizeNodeName(l.attrName):"",c.ID=s}this.getTransformData(c,l),o.set(s,c)}return o}},{key:"buildSkeleton",value:function(e,t,n,i){var o=null;return e.parents.forEach((function(e){for(var a in t)!function(a){var s=t[a];s.rawBones.forEach((function(t,a){var l;t.ID===e.ID&&(l=o,(o=new r.Bone).matrixWorld.copy(t.transformLink),o.name=i?r.PropertyBinding.sanitizeNodeName(i):"",o.ID=n,s.bones[a]=o,null!==l&&o.add(l))}))}(a)})),o}},{key:"createCamera",value:function(e){var t,n;if(e.children.forEach((function(e){void 0!==(e=Ta.Objects.NodeAttribute[e.ID])&&(n=e)})),void 0===n)t=new r.Object3D;else{var i=0,o=(void 0!==n.CameraProjectionType&&1===n.CameraProjectionType.value&&(i=1),1),a=(void 0!==n.NearPlane&&(o=n.NearPlane.value/1e3),1e3),s=(void 0!==n.FarPlane&&(a=n.FarPlane.value/1e3),window.innerWidth),l=window.innerHeight,u=(void 0!==n.AspectWidth&&void 0!==n.AspectHeight&&(s=n.AspectWidth.value,l=n.AspectHeight.value),s/l),c=45,h=(void 0!==n.FieldOfView&&(c=n.FieldOfView.value),n.FocalLength?n.FocalLength.value:null);switch(i){case 0:t=new r.PerspectiveCamera(c,u,o,a),null!==h&&t.setFocalLength(h);break;case 1:t=new r.OrthographicCamera(-s/2,s/2,l/2,-l/2,o,a);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+i+"."),t=new r.Object3D}}return t}},{key:"createLight",value:function(e){var t,n;if(e.children.forEach((function(e){void 0!==(e=Ta.Objects.NodeAttribute[e.ID])&&(n=e)})),void 0===n)t=new r.Object3D;else{e=void 0===n.LightType?0:n.LightType.value;var i=16777215,o=(void 0!==n.Color&&(i=(new r.Color).fromArray(n.Color.value)),void 0===n.Intensity?1:n.Intensity.value/100),a=(void 0!==n.CastLightOnObject&&0===n.CastLightOnObject.value&&(o=0),0);switch(void 0!==n.FarAttenuationEnd&&(a=void 0!==n.EnableFarAttenuation&&0===n.EnableFarAttenuation.value?0:n.FarAttenuationEnd.value),e){case 0:t=new r.PointLight(i,o,a,1);break;case 1:t=new r.DirectionalLight(i,o);break;case 2:var s=Math.PI/3,l=(void 0!==n.InnerAngle&&(s=r.MathUtils.degToRad(n.InnerAngle.value)),0);void 0!==n.OuterAngle&&(l=r.MathUtils.degToRad(n.OuterAngle.value),l=Math.max(l,1)),t=new r.SpotLight(i,o,a,s,l,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),t=new r.PointLight(i,o)}void 0!==n.CastShadows&&1===n.CastShadows.value&&(t.castShadow=!0)}return t}},{key:"createMesh",value:function(e,t,n){var i,o=null,a=null,s=[];return e.children.forEach((function(e){t.has(e.ID)&&(o=t.get(e.ID)),n.has(e.ID)&&s.push(n.get(e.ID))})),1<s.length?a=s:0<s.length?a=s[0]:(a=new r.MeshPhongMaterial({color:13421772}),s.push(a)),"color"in o.attributes&&s.forEach((function(e){e.vertexColors=!0})),o.FBX_Deformer?(i=new r.SkinnedMesh(o,a)).normalizeSkinWeights():i=new r.Mesh(o,a),i}},{key:"createCurve",value:function(e,t){e=e.children.reduce((function(e,r){return t.has(r.ID)?t.get(r.ID):e}),null);var n=new r.LineBasicMaterial({color:3342591,linewidth:1});return new r.Line(e,n)}},{key:"getTransformData",value:function(e,t){var r={};"InheritType"in t&&(r.inheritType=parseInt(t.InheritType.value)),r.eulerOrder="RotationOrder"in t?es(t.RotationOrder.value):"ZYX","Lcl_Translation"in t&&(r.translation=t.Lcl_Translation.value),"PreRotation"in t&&(r.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(r.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(r.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(r.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(r.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(r.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(r.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(r.rotationPivot=t.RotationPivot.value),e.userData.transformData=r}},{key:"setLookAtProperties",value:function(e,t){"LookAtProperty"in t&&Da.get(e.ID).children.forEach((function(t){"LookAtProperty"===t.relationship&&"Lcl_Translation"in(t=Ta.Objects.Model[t.ID])&&(t=t.Lcl_Translation.value,void 0!==e.target?(e.target.position.fromArray(t),Ra.add(e.target)):e.lookAt((new r.Vector3).fromArray(t)))}))}},{key:"bindSkeleton",value:function(e,t,n){var i,o=this.parsePoseNodes();for(i in e)!function(i){var a=e[i];Da.get(parseInt(a.ID)).parents.forEach((function(e){t.has(e.ID)&&(e=e.ID,Da.get(e).parents.forEach((function(e){n.has(e.ID)&&n.get(e.ID).bind(new r.Skeleton(a.bones),o[e.ID])})))}))}(i)}},{key:"parsePoseNodes",value:function(){var e={};if("Pose"in Ta.Objects){var t,n,i=Ta.Objects.Pose;for(t in i)"BindPose"===i[t].attrType&&0<i[t].NbPoseNodes&&(n=i[t].PoseNode,Array.isArray(n)?n.forEach((function(t){e[t.Node]=(new r.Matrix4).fromArray(t.Matrix.a)})):e[n.Node]=(new r.Matrix4).fromArray(n.Matrix.a))}return e}},{key:"createAmbientLight",value:function(){var e,t,n;"GlobalSettings"in Ta&&"AmbientColor"in Ta.GlobalSettings&&(n=(t=Ta.GlobalSettings.AmbientColor.value)[0],e=t[1],t=t[2],0===n&&0===e&&0===t||(n=new r.Color(n,e,t),Ra.add(new r.AmbientLight(n,1))))}}]),e}(),Ha=function(){function e(){Ia(this,e)}return La(e,[{key:"parse",value:function(e){var t=new Map;if("Geometry"in Ta.Objects){var r,n=Ta.Objects.Geometry;for(r in n){var i=Da.get(parseInt(r));i=this.parseGeometry(i,n[r],e),t.set(parseInt(r),i)}}return t}},{key:"parseGeometry",value:function(e,t,r){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,r);case"NurbsCurve":return this.parseNurbsGeometry(t)}}},{key:"parseMeshGeometry",value:function(e,t,r){var n,i=r.skeletons,o=[],a=e.parents.map((function(e){return Ta.Objects.Model[e.ID]}));if(0!==a.length)return n=e.children.reduce((function(e,t){return void 0!==i[t.ID]?i[t.ID]:e}),null),e.children.forEach((function(e){void 0!==r.morphTargets[e.ID]&&o.push(r.morphTargets[e.ID])})),e=a[0],a={},"RotationOrder"in e&&(a.eulerOrder=es(e.RotationOrder.value)),"InheritType"in e&&(a.inheritType=parseInt(e.InheritType.value)),"GeometricTranslation"in e&&(a.translation=e.GeometricTranslation.value),"GeometricRotation"in e&&(a.rotation=e.GeometricRotation.value),"GeometricScaling"in e&&(a.scale=e.GeometricScaling.value),e=$a(a),this.genGeometry(t,n,o,e)}},{key:"genGeometry",value:function(e,t,n,i){var o,a,s=new r.BufferGeometry,l=(e.attrName&&(s.name=e.attrName),this.parseGeoNode(e,t)),u=this.genBuffers(l),c=new r.Float32BufferAttribute(u.vertex,3);return c.applyMatrix4(i),s.setAttribute("position",c),0<u.colors.length&&s.setAttribute("color",new r.Float32BufferAttribute(u.colors,3)),t&&(s.setAttribute("skinIndex",new r.Uint16BufferAttribute(u.weightsIndices,4)),s.setAttribute("skinWeight",new r.Float32BufferAttribute(u.vertexWeights,4)),s.FBX_Deformer=t),0<u.normal.length&&(c=(new r.Matrix3).getNormalMatrix(i),(t=new r.Float32BufferAttribute(u.normal,3)).applyNormalMatrix(c),s.setAttribute("normal",t)),u.uvs.forEach((function(e,t){var n="uv"+(t+1).toString();s.setAttribute(n=0===t?"uv":n,new r.Float32BufferAttribute(u.uvs[t],2))})),l.material&&"AllSame"!==l.material.mappingType&&(o=u.materialIndex[0],a=0,u.materialIndex.forEach((function(e,t){e!==o&&(s.addGroup(a,t-a,o),o=e,a=t)})),0<s.groups.length&&(t=(c=s.groups[s.groups.length-1]).start+c.count)!==u.materialIndex.length&&s.addGroup(t,u.materialIndex.length-t,o),0===s.groups.length&&s.addGroup(0,u.materialIndex.length,u.materialIndex[0])),this.addMorphTargets(s,e,n,i),s}},{key:"parseGeoNode",value:function(e,t){var r={};if(r.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],r.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(r.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(r.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(r.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){r.uv=[];for(var n=0;e.LayerElementUV[n];)e.LayerElementUV[n].UV&&r.uv.push(this.parseUVs(e.LayerElementUV[n])),n++}return r.weightTable={},null!==t&&(r.skeleton=t).rawBones.forEach((function(e,t){e.indices.forEach((function(n,i){void 0===r.weightTable[n]&&(r.weightTable[n]=[]),r.weightTable[n].push({id:t,weight:e.weights[i]})}))})),r}},{key:"genBuffers",value:function(e){var t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},r=0,n=0,i=!1,o=[],a=[],s=[],l=[],u=[],c=[],h=this;return e.vertexIndices.forEach((function(d,p){var f,m,g,v,y=!1,b=(d<0&&(d^=-1,y=!0),[]),x=[];if(o.push(3*d,3*d+1,3*d+2),e.color&&(v=Za(p,r,d,e.color),s.push(v[0],v[1],v[2])),e.skeleton){for(void 0!==e.weightTable[d]&&e.weightTable[d].forEach((function(e){x.push(e.weight),b.push(e.id)})),4<x.length&&(i||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),i=!0),m=[0,0,0,0],g=[0,0,0,0],x.forEach((function(e,t){var r=e,n=b[t];g.forEach((function(e,t,i){e<r&&(i[t]=r,r=e,i=m[t],m[t]=n,n=i)}))})),b=m,x=g);x.length<4;)x.push(0),b.push(0);for(var w=0;w<4;++w)u.push(x[w]),c.push(b[w])}e.normal&&(v=Za(p,r,d,e.normal),a.push(v[0],v[1],v[2])),e.material&&"AllSame"!==e.material.mappingType&&(f=Za(p,r,d,e.material)[0]),e.uv&&e.uv.forEach((function(e,t){e=Za(p,r,d,e),void 0===l[t]&&(l[t]=[]),l[t].push(e[0]),l[t].push(e[1])})),n++,y&&(h.genFace(t,e,o,f,a,s,l,u,c,n),r++,n=0,o=[],a=[],s=[],l=[],u=[],c=[])})),t}},{key:"genFace",value:function(e,t,r,n,i,o,a,s,l,u){for(var c=2;c<u;c++)!function(u){e.vertex.push(t.vertexPositions[r[0]]),e.vertex.push(t.vertexPositions[r[1]]),e.vertex.push(t.vertexPositions[r[2]]),e.vertex.push(t.vertexPositions[r[3*(u-1)]]),e.vertex.push(t.vertexPositions[r[3*(u-1)+1]]),e.vertex.push(t.vertexPositions[r[3*(u-1)+2]]),e.vertex.push(t.vertexPositions[r[3*u]]),e.vertex.push(t.vertexPositions[r[3*u+1]]),e.vertex.push(t.vertexPositions[r[3*u+2]]),t.skeleton&&(e.vertexWeights.push(s[0]),e.vertexWeights.push(s[1]),e.vertexWeights.push(s[2]),e.vertexWeights.push(s[3]),e.vertexWeights.push(s[4*(u-1)]),e.vertexWeights.push(s[4*(u-1)+1]),e.vertexWeights.push(s[4*(u-1)+2]),e.vertexWeights.push(s[4*(u-1)+3]),e.vertexWeights.push(s[4*u]),e.vertexWeights.push(s[4*u+1]),e.vertexWeights.push(s[4*u+2]),e.vertexWeights.push(s[4*u+3]),e.weightsIndices.push(l[0]),e.weightsIndices.push(l[1]),e.weightsIndices.push(l[2]),e.weightsIndices.push(l[3]),e.weightsIndices.push(l[4*(u-1)]),e.weightsIndices.push(l[4*(u-1)+1]),e.weightsIndices.push(l[4*(u-1)+2]),e.weightsIndices.push(l[4*(u-1)+3]),e.weightsIndices.push(l[4*u]),e.weightsIndices.push(l[4*u+1]),e.weightsIndices.push(l[4*u+2]),e.weightsIndices.push(l[4*u+3])),t.color&&(e.colors.push(o[0]),e.colors.push(o[1]),e.colors.push(o[2]),e.colors.push(o[3*(u-1)]),e.colors.push(o[3*(u-1)+1]),e.colors.push(o[3*(u-1)+2]),e.colors.push(o[3*u]),e.colors.push(o[3*u+1]),e.colors.push(o[3*u+2])),t.material&&"AllSame"!==t.material.mappingType&&(e.materialIndex.push(n),e.materialIndex.push(n),e.materialIndex.push(n)),t.normal&&(e.normal.push(i[0]),e.normal.push(i[1]),e.normal.push(i[2]),e.normal.push(i[3*(u-1)]),e.normal.push(i[3*(u-1)+1]),e.normal.push(i[3*(u-1)+2]),e.normal.push(i[3*u]),e.normal.push(i[3*u+1]),e.normal.push(i[3*u+2])),t.uv&&t.uv.forEach((function(t,r){void 0===e.uvs[r]&&(e.uvs[r]=[]),e.uvs[r].push(a[r][0]),e.uvs[r].push(a[r][1]),e.uvs[r].push(a[r][2*(u-1)]),e.uvs[r].push(a[r][2*(u-1)+1]),e.uvs[r].push(a[r][2*u]),e.uvs[r].push(a[r][2*u+1])}))}(c)}},{key:"addMorphTargets",value:function(e,t,r,n){var i;0!==r.length&&(e.morphTargetsRelative=!0,e.morphAttributes.position=[],i=this,r.forEach((function(r){r.rawTargets.forEach((function(r){var o=Ta.Objects.Geometry[r.geoID];void 0!==o&&i.genMorphGeometry(e,t,o,n,r.name)}))})))}},{key:"genMorphGeometry",value:function(e,t,n,i,o){t=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[];for(var a=void 0!==n.Vertices?n.Vertices.a:[],s=void 0!==n.Indexes?n.Indexes.a:[],l=3*e.attributes.position.count,u=new Float32Array(l),c=0;c<s.length;c++){var h=3*s[c];u[h]=a[3*c],u[1+h]=a[3*c+1],u[2+h]=a[3*c+2]}l=this.genBuffers({vertexIndices:t,vertexPositions:u}),(t=new r.Float32BufferAttribute(l.vertex,3)).name=o||n.attrName,t.applyMatrix4(i),e.morphAttributes.position.push(t)}},{key:"parseNormals",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=e.Normals.a,i=[];return"IndexToDirect"===r&&("NormalIndex"in e?i=e.NormalIndex.a:"NormalsIndex"in e&&(i=e.NormalsIndex.a)),{dataSize:3,buffer:n,indices:i,mappingType:t,referenceType:r}}},{key:"parseUVs",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=[];return{dataSize:2,buffer:e.UV.a,indices:n="IndexToDirect"===r?e.UVIndex.a:n,mappingType:t,referenceType:r}}},{key:"parseVertexColors",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=[];return{dataSize:4,buffer:e.Colors.a,indices:n="IndexToDirect"===r?e.ColorIndex.a:n,mappingType:t,referenceType:r}}},{key:"parseMaterialIndices",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:r};for(var n=e.Materials.a,i=[],o=0;o<n.length;++o)i.push(o);return{dataSize:1,buffer:n,indices:i,mappingType:t,referenceType:r}}},{key:"parseNurbsGeometry",value:function(e){if(void 0===Oa)return console.error("THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new r.BufferGeometry;var t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new r.BufferGeometry;for(var n=t-1,i=(t=e.KnotVector.a,[]),o=e.Points.a,a=0,s=o.length;a<s;a+=4)i.push((new r.Vector4).fromArray(o,a));if("Closed"===e.Form)i.push(i[0]);else if("Periodic"===e.Form)for(var l=n,u=t.length-1-l,c=0;c<n;++c)i.push(i[c]);return e=new Oa(n,t,i,l,u).getPoints(12*i.length),(new r.BufferGeometry).setFromPoints(e)}}]),e}(),Na=function(){function e(){Ia(this,e)}return La(e,[{key:"parse",value:function(){var e=[],t=this.parseClips();if(void 0!==t)for(var r in t)r=t[r],r=this.addClip(r),e.push(r);return e}},{key:"parseClips",value:function(){var e;if(void 0!==Ta.Objects.AnimationCurve)return e=this.parseAnimationCurveNodes(),this.parseAnimationCurves(e),e=this.parseAnimationLayers(e),this.parseAnimStacks(e)}},{key:"parseAnimationCurveNodes",value:function(){var e,t=Ta.Objects.AnimationCurveNode,r=new Map;for(e in t){var n=t[e];null!==n.attrName.match(/S|R|T|DeformPercent/)&&(n={id:n.id,attr:n.attrName,curves:{}},r.set(n.id,n))}return r}},{key:"parseAnimationCurves",value:function(e){var t,r=Ta.Objects.AnimationCurve;for(t in r){var n,i={id:r[t].id,times:r[t].KeyTime.a.map(Xa),values:r[t].KeyValueFloat.a},o=Da.get(i.id);void 0!==o&&(n=o.parents[0].ID,(o=o.parents[0].relationship).match(/X/)?e.get(n).curves.x=i:o.match(/Y/)?e.get(n).curves.y=i:o.match(/Z/)?e.get(n).curves.z=i:o.match(/d|DeformPercent/)&&e.has(n)&&(e.get(n).curves.morph=i))}}},{key:"parseAnimationLayers",value:function(e){var t,n=Ta.Objects.AnimationLayer,i=new Map;for(t in n)!function(t){var n=[],o=Da.get(parseInt(t));void 0!==o&&(o.children.forEach((function(t,i){if(e.has(t.ID)){var o=e.get(t.ID);if(void 0!==o.curves.x||void 0!==o.curves.y||void 0!==o.curves.z){if(void 0===n[i]){var a=Da.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID;if(void 0!==a){var s=Ta.Objects.Model[a.toString()];if(void 0===s)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",t);var l={modelName:s.attrName?r.PropertyBinding.sanitizeNodeName(s.attrName):"",ID:s.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};Ra.traverse((function(e){e.ID===s.id&&(l.transform=e.matrix,e.userData.transformData&&(l.eulerOrder=e.userData.transformData.eulerOrder))})),l.transform||(l.transform=new r.Matrix4),"PreRotation"in s&&(l.preRotation=s.PreRotation.value),"PostRotation"in s&&(l.postRotation=s.PostRotation.value),n[i]=l}}n[i]&&(n[i][o.attr]=o)}else void 0!==o.curves.morph&&(void 0===n[i]&&(a=Da.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,t=Da.get(a).parents[0].ID,t=Da.get(t).parents[0].ID,t=Da.get(t).parents[0].ID,t={modelName:(t=Ta.Objects.Model[t]).attrName?r.PropertyBinding.sanitizeNodeName(t.attrName):"",morphName:Ta.Objects.Deformer[a].attrName},n[i]=t),n[i][o.attr]=o)}})),i.set(parseInt(t),n))}(t);return i}},{key:"parseAnimStacks",value:function(e){var t,r=Ta.Objects.AnimationStack,n={};for(t in r){var i=(1<(i=Da.get(parseInt(t)).children).length&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers."),e.get(i[0].ID));n[t]={name:r[t].attrName,layer:i}}return n}},{key:"addClip",value:function(e){var t=[],n=this;return e.layer.forEach((function(e){t=t.concat(n.generateTracks(e))})),new r.AnimationClip(e.name,-1,t)}},{key:"generateTracks",value:function(e){var t=[],n=new r.Vector3,i=new r.Quaternion,o=new r.Vector3;return e.transform&&e.transform.decompose(n,i,o),n=n.toArray(),i=(new r.Euler).setFromQuaternion(i,e.eulerOrder).toArray(),o=o.toArray(),void 0!==e.T&&0<Object.keys(e.T.curves).length&&void 0!==(n=this.generateVectorTrack(e.modelName,e.T.curves,n,"position"))&&t.push(n),void 0!==e.R&&0<Object.keys(e.R.curves).length&&void 0!==(n=this.generateRotationTrack(e.modelName,e.R.curves,i,e.preRotation,e.postRotation,e.eulerOrder))&&t.push(n),void 0!==e.S&&0<Object.keys(e.S.curves).length&&void 0!==(i=this.generateVectorTrack(e.modelName,e.S.curves,o,"scale"))&&t.push(i),void 0!==e.DeformPercent&&void 0!==(n=this.generateMorphTrack(e))&&t.push(n),t}},{key:"generateVectorTrack",value:function(e,t,n,i){var o=this.getTimesForAllAxes(t);return t=this.getKeyframeTrackValues(o,t,n),new r.VectorKeyframeTrack(e+"."+i,o,t)}},{key:"generateRotationTrack",value:function(e,t,n,i,o,a){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(r.MathUtils.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(r.MathUtils.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(r.MathUtils.degToRad));for(var s=this.getTimesForAllAxes(t),l=this.getKeyframeTrackValues(s,t,n),u=(void 0!==i&&((i=i.map(r.MathUtils.degToRad)).push(a),i=(new r.Euler).fromArray(i),i=(new r.Quaternion).setFromEuler(i)),void 0!==o&&((o=o.map(r.MathUtils.degToRad)).push(a),o=(new r.Euler).fromArray(o),o=(new r.Quaternion).setFromEuler(o).invert()),new r.Quaternion),c=new r.Euler,h=[],d=0;d<l.length;d+=3)c.set(l[d],l[d+1],l[d+2],a),u.setFromEuler(c),void 0!==i&&u.premultiply(i),void 0!==o&&u.multiply(o),u.toArray(h,d/3*4);return new r.QuaternionKeyframeTrack(e+".quaternion",s,h)}},{key:"generateMorphTrack",value:function(e){var t=e.DeformPercent.curves.morph,n=t.values.map((function(e){return e/100})),i=Ra.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new r.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+i+"]",t.times,n)}},{key:"getTimesForAllAxes",value:function(e){var t=[];if(void 0!==e.x&&(t=t.concat(e.x.times)),void 0!==e.y&&(t=t.concat(e.y.times)),1<(t=(t=void 0!==e.z?t.concat(e.z.times):t).sort((function(e,t){return e-t}))).length){for(var r=1,n=t[0],i=1;i<t.length;i++){var o=t[i];o!==n&&(n=t[r]=o,r++)}t=t.slice(0,r)}return t}},{key:"getKeyframeTrackValues",value:function(e,t,r){var n=r,i=[],o=-1,a=-1,s=-1;return e.forEach((function(e){t.x&&(o=t.x.times.indexOf(e)),t.y&&(a=t.y.times.indexOf(e)),t.z&&(s=t.z.times.indexOf(e)),-1!==o?(e=t.x.values[o],i.push(e),n[0]=e):i.push(n[0]),-1!==a?(e=t.y.values[a],i.push(e),n[1]=e):i.push(n[1]),-1!==s?(e=t.z.values[s],i.push(e),n[2]=e):i.push(n[2])})),i}},{key:"interpolateRotations",value:function(e){for(var t=1;t<e.values.length;t++){var r=e.values[t-1],n=e.values[t]-r;if(180<=(i=Math.abs(n))){for(var i,o=n/(i/=180),a=r+o,s=(n=e.times[t-1],(e.times[t]-n)/i),l=n+s,u=[],c=[];l<e.times[t];)u.push(l),l+=s,c.push(a),a+=o;e.times=ns(e.times,t,u),e.values=ns(e.values,t,c)}}}}]),e}(),za=function(){function e(){Ia(this,e)}return La(e,[{key:"getPrevNode",value:function(){return this.nodeStack[this.currentIndent-2]}},{key:"getCurrentNode",value:function(){return this.nodeStack[this.currentIndent-1]}},{key:"getCurrentProp",value:function(){return this.currentProp}},{key:"pushStack",value:function(e){this.nodeStack.push(e),this.currentIndent+=1}},{key:"popStack",value:function(){this.nodeStack.pop(),--this.currentIndent}},{key:"setCurrentProp",value:function(e,t){this.currentProp=e,this.currentPropName=t}},{key:"parse",value:function(e){this.currentIndent=0,this.allNodes=new Ka,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var t=this,r=e.split(/[\r\n]+/);return r.forEach((function(e,n){var i,o=e.match(/^[\s\t]*;/),a=e.match(/^[\s\t]*$/);o||a||(o=e.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),a=e.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),i=e.match("^\\t{"+(t.currentIndent-1)+"}}"),o?t.parseNodeBegin(e,o):a?t.parseNodeProperty(e,a,r[++n]):i?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e))})),this.allNodes}},{key:"parseNodeBegin",value:function(e,t){var r=t[1].trim().replace(/^"/,"").replace(/"$/,""),n=(t=t[2].split(",").map((function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")})),{name:r}),i=(t=this.parseNodeAttr(t),this.getCurrentNode());0===this.currentIndent?this.allNodes.add(r,n):r in i?("PoseNode"===r?i.PoseNode.push(n):void 0!==i[r].id&&(i[r]={},i[r][i[r].id]=i[r]),""!==t.id&&(i[r][t.id]=n)):"number"==typeof t.id?(i[r]={},i[r][t.id]=n):"Properties70"!==r&&(i[r]="PoseNode"===r?[n]:n),"number"==typeof t.id&&(n.id=t.id),""!==t.name&&(n.attrName=t.name),""!==t.type&&(n.attrType=t.type),this.pushStack(n)}},{key:"parseNodeAttr",value:function(e){var t=e[0],r=(""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0])),""),n="";return 1<e.length&&(r=e[1].replace(/^(\w+)::/,""),n=e[2]),{id:t,name:r,type:n}}},{key:"parseNodeProperty",value:function(e,t,r){var n=t[1].replace(/^"/,"").replace(/"$/,"").trim();if(t=t[2].replace(/^"/,"").replace(/"$/,"").trim(),"Properties70"===("Content"===n&&","===t&&(t=r.replace(/"/g,"").replace(/,$/,"").trim()),r=this.getCurrentNode()).name)this.parseNodeSpecialProperty(e,n,t);else{if("C"===n){e=t.split(",").slice(1);for(var i=parseInt(e[0]),o=(e=parseInt(e[1]),(o=t.split(",").slice(3)).map((function(e){return e.trim().replace(/^"/,"")}))),a=(n="connections",t=[i,e]),s=o,l=0,u=a.length,c=s.length;l<c;l++,u++)a[u]=s[l];void 0===r[n]&&(r[n]=[])}"Node"===n&&(r.id=t),n in r&&Array.isArray(r[n])?r[n].push(t):"a"!==n?r[n]=t:r.a=t,this.setCurrentProp(r,n),"a"===n&&","!==t.slice(-1)&&(r.a=ts(t))}}},{key:"parseNodePropertyContinued",value:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=ts(t.a))}},{key:"parseNodeSpecialProperty",value:function(e,t,r){r=r.split('",').map((function(e){return e.trim().replace(/^\"/,"").replace(/\s/,"_")}));var n=r[0],i=r[1],o=r[2],a=r[3],s=r[4];switch(i){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":s=parseFloat(s);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":s=ts(s)}this.getPrevNode()[n]={type:i,type2:o,flag:a,value:s},this.setCurrentProp(this.getPrevNode(),n)}}]),e}(),Va=function(){function t(){Ia(this,t)}return La(t,[{key:"parse",value:function(e){var t=new Ja(e),r=(t.skip(23),t.getUint32());if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);for(var n=new Ka;!this.endOfContent(t);){var i=this.parseNode(t,r);null!==i&&n.add(i.name,i)}return n}},{key:"endOfContent",value:function(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}},{key:"parseNode",value:function(e,t){var r={},n=7500<=t?e.getUint64():e.getUint32(),i=7500<=t?e.getUint64():e.getUint32(),o=(7500<=t?e.getUint64():e.getUint32(),e.getUint8()),a=e.getString(o);if(0===n)return null;for(var s=[],l=0;l<i;l++)s.push(this.parseProperty(e));o=0<s.length?s[0]:"";var u=1<s.length?s[1]:"",c=2<s.length?s[2]:"";for(r.singleProperty=1===i&&e.getOffset()===n;n>e.getOffset();){var h=this.parseNode(e,t);null!==h&&this.parseSubNode(a,r,h)}return r.propertyList=s,"number"==typeof o&&(r.id=o),""!==u&&(r.attrName=u),""!==c&&(r.attrType=c),""!==a&&(r.name=a),r}},{key:"parseSubNode",value:function(e,t,r){var n,i,o,a,s;!0===r.singleProperty?(i=r.propertyList[0],Array.isArray(i)?(t[r.name]=r).a=i:t[r.name]=i):"Connections"===e&&"C"===r.name?(n=[],r.propertyList.forEach((function(e,t){0!==t&&n.push(e)})),void 0===t.connections&&(t.connections=[]),t.connections.push(n)):"Properties70"===r.name?Object.keys(r).forEach((function(e){t[e]=r[e]})):"Properties70"===e&&"P"===r.name?(i=r.propertyList[0],e=r.propertyList[1],o=r.propertyList[2],a=r.propertyList[3],0===i.indexOf("Lcl ")&&(i=i.replace("Lcl ","Lcl_")),s="Color"===(e=0===e.indexOf("Lcl ")?e.replace("Lcl ","Lcl_"):e)||"ColorRGB"===e||"Vector"===e||"Vector3D"===e||0===e.indexOf("Lcl_")?[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:r.propertyList[4],t[i]={type:e,type2:o,flag:a,value:s}):void 0===t[r.name]?"number"==typeof r.id?(t[r.name]={},t[r.name][r.id]=r):t[r.name]=r:"PoseNode"===r.name?(Array.isArray(t[r.name])||(t[r.name]=[t[r.name]]),t[r.name].push(r)):void 0===t[r.name][r.id]&&(t[r.name][r.id]=r)}},{key:"parseProperty",value:function(t){var r=t.getString(1);switch(r){case"C":return t.getBoolean();case"D":return t.getFloat64();case"F":return t.getFloat32();case"I":return t.getInt32();case"L":return t.getInt64();case"R":return i=t.getUint32(),t.getArrayBuffer(i);case"S":return i=t.getUint32(),t.getString(i);case"Y":return t.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var n=t.getUint32(),i=t.getUint32(),o=t.getUint32();if(0===i)switch(r){case"b":case"c":return t.getBooleanArray(n);case"d":return t.getFloat64Array(n);case"f":return t.getFloat32Array(n);case"i":return t.getInt32Array(n);case"l":return t.getInt64Array(n)}void 0===e&&console.error("THREE.FBXLoader: External library fflate.min.js required."),i=Qo(new Uint8Array(t.getArrayBuffer(o)));var a=new Ja(i.buffer);switch(r){case"b":case"c":return a.getBooleanArray(n);case"d":return a.getFloat64Array(n);case"f":return a.getFloat32Array(n);case"i":return a.getInt32Array(n);case"l":return a.getInt64Array(n)}default:throw new Error("THREE.FBXLoader: Unknown property type "+r)}}}]),t}(),Ja=function(){function e(t,r){Ia(this,e),this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===r||r}return La(e,[{key:"getOffset",value:function(){return this.offset}},{key:"size",value:function(){return this.dv.buffer.byteLength}},{key:"skip",value:function(e){this.offset+=e}},{key:"getBoolean",value:function(){return 1==(1&this.getUint8())}},{key:"getBooleanArray",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getBoolean());return t}},{key:"getUint8",value:function(){var e=this.dv.getUint8(this.offset);return this.offset+=1,e}},{key:"getInt16",value:function(){var e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}},{key:"getInt32",value:function(){var e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getInt32Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getInt32());return t}},{key:"getUint32",value:function(){var e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getInt64",value:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),2147483648&t?(t=4294967295&~t,-(4294967296*(t=4294967295==(e=4294967295&~e)?t+1&4294967295:t)+(e=e+1&4294967295))):4294967296*t+e}},{key:"getInt64Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getInt64());return t}},{key:"getUint64",value:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),4294967296*t+e}},{key:"getFloat32",value:function(){var e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getFloat32Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getFloat32());return t}},{key:"getFloat64",value:function(){var e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}},{key:"getFloat64Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getFloat64());return t}},{key:"getArrayBuffer",value:function(e){var t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}},{key:"getString",value:function(e){for(var t=[],n=0;n<e;n++)t[n]=this.getUint8();var i=t.indexOf(0);return 0<=i&&(t=t.slice(0,i)),r.LoaderUtils.decodeText(new Uint8Array(t))}}]),e}(),Ka=function(){function e(){Ia(this,e)}return La(e,[{key:"add",value:function(e,t){this[e]=t}}]),e}();function Wa(e){if(e=e.match(/FBXVersion: (\d+)/))return parseInt(e[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function Xa(e){return e/46186158e3}var Qa=[];function Za(e,t,r,n){var i;switch(n.mappingType){case"ByPolygonVertex":i=e;break;case"ByPolygon":i=t;break;case"ByVertice":i=r;break;case"AllSame":i=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}for(var o=(i="IndexToDirect"===n.referenceType?n.indices[i]:i)*n.dataSize,a=o+n.dataSize,s=Qa,l=n.buffer,u=a,c=o,h=0;c<u;c++,h++)s[h]=l[c];return s}var Ya=new r.Euler,qa=new r.Vector3;function $a(e){var t=new r.Matrix4,n=new r.Matrix4,i=new r.Matrix4,o=new r.Matrix4,a=new r.Matrix4,s=new r.Matrix4,l=new r.Matrix4,u=new r.Matrix4,c=new r.Matrix4,h=new r.Matrix4,d=new r.Matrix4,p=new r.Matrix4,f=e.inheritType||0,m=(e.translation&&t.setPosition(qa.fromArray(e.translation)),e.preRotation&&((m=e.preRotation.map(r.MathUtils.degToRad)).push(e.eulerOrder),n.makeRotationFromEuler(Ya.fromArray(m))),e.rotation&&((m=e.rotation.map(r.MathUtils.degToRad)).push(e.eulerOrder),i.makeRotationFromEuler(Ya.fromArray(m))),e.postRotation&&((m=e.postRotation.map(r.MathUtils.degToRad)).push(e.eulerOrder),o.makeRotationFromEuler(Ya.fromArray(m)),o.invert()),e.scale&&a.scale(qa.fromArray(e.scale)),e.scalingOffset&&l.setPosition(qa.fromArray(e.scalingOffset)),e.scalingPivot&&s.setPosition(qa.fromArray(e.scalingPivot)),e.rotationOffset&&u.setPosition(qa.fromArray(e.rotationOffset)),e.rotationPivot&&c.setPosition(qa.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(d.copy(e.parentMatrix),h.copy(e.parentMatrixWorld)),n.clone().multiply(i).multiply(o)),g=(((e=new r.Matrix4).extractRotation(h),g=new r.Matrix4).copyPosition(h),g.clone().invert().multiply(h)),v=(g=e.clone().invert().multiply(g),a),y=new r.Matrix4;return 0===f?y.copy(e).multiply(m).multiply(g).multiply(v):1===f?y.copy(e).multiply(g).multiply(m).multiply(v):(f=(new r.Matrix4).scale((new r.Vector3).setFromMatrixScale(d)).clone().invert(),d=g.clone().multiply(f),y.copy(e).multiply(m).multiply(d).multiply(v)),g=c.clone().invert(),f=s.clone().invert(),e=t.clone().multiply(u).multiply(c).multiply(n).multiply(i).multiply(o).multiply(g).multiply(l).multiply(s).multiply(a).multiply(f),m=(new r.Matrix4).copyPosition(e),d=h.clone().multiply(m),p.copyPosition(d),(e=p.clone().multiply(y)).premultiply(h.invert()),e}function es(e){var t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return 6===(e=e||0)?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[e]}function ts(e){return e.split(",").map((function(e){return parseFloat(e)}))}function rs(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=e.byteLength),r.LoaderUtils.decodeText(new Uint8Array(e,t,n))}function ns(e,t,r){return e.slice(0,t).concat(r).concat(e.slice(t))}function is(e){return(is="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function os(e,t){return(os=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function as(e){return(as=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ss=/^[og]\s*(.+)?/,ls=/^mtllib /,us=/^usemtl /,cs=/^usemap /,hs=new r.Vector3,ds=new r.Vector3,ps=new r.Vector3,fs=new r.Vector3,ms=new r.Vector3,gs=new r.Color;function vs(){var e={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=e,void(this.object.fromDeclaration=!1!==t);var r=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:!1!==t,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(e,t){var r=this._finalize(!1);return r&&(r.inherited||r.groupCount<=0)&&this.materials.splice(r.index,1),e={index:this.materials.length,name:e||"",mtllib:Array.isArray(t)&&0<t.length?t[t.length-1]:"",smooth:(void 0!==r?r:this).smooth,groupStart:void 0!==r?r.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){return(e={index:"number"==typeof e?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1}).clone=this.clone.bind(e),e}},this.materials.push(e),e},currentMaterial:function(){if(0<this.materials.length)return this.materials[this.materials.length-1]},_finalize:function(e){var t=this.currentMaterial();if(t&&-1===t.groupEnd&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&1<this.materials.length)for(var r=this.materials.length-1;0<=r;r--)this.materials[r].groupCount<=0&&this.materials.splice(r,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},r&&r.name&&"function"==typeof r.clone&&((e=r.clone(0)).inherited=!0,this.object.materials.push(e)),this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){return 3*(0<=(e=parseInt(e,10))?e-1:e+t/3)},parseNormalIndex:function(e,t){return 3*(0<=(e=parseInt(e,10))?e-1:e+t/3)},parseUVIndex:function(e,t){return 2*(0<=(e=parseInt(e,10))?e-1:e+t/2)},addVertex:function(e,t,r){var n=this.vertices,i=this.object.geometry.vertices;i.push(n[e+0],n[e+1],n[e+2]),i.push(n[t+0],n[t+1],n[t+2]),i.push(n[r+0],n[r+1],n[r+2])},addVertexPoint:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,r){var n=this.normals,i=this.object.geometry.normals;i.push(n[e+0],n[e+1],n[e+2]),i.push(n[t+0],n[t+1],n[t+2]),i.push(n[r+0],n[r+1],n[r+2])},addFaceNormal:function(e,t,r){var n=this.vertices,i=this.object.geometry.normals;hs.fromArray(n,e),ds.fromArray(n,t),ps.fromArray(n,r),ms.subVectors(ps,ds),fs.subVectors(hs,ds),ms.cross(fs),ms.normalize(),i.push(ms.x,ms.y,ms.z),i.push(ms.x,ms.y,ms.z),i.push(ms.x,ms.y,ms.z)},addColor:function(e,t,r){var n=this.colors,i=this.object.geometry.colors;void 0!==n[e]&&i.push(n[e+0],n[e+1],n[e+2]),void 0!==n[t]&&i.push(n[t+0],n[t+1],n[t+2]),void 0!==n[r]&&i.push(n[r+0],n[r+1],n[r+2])},addUV:function(e,t,r){var n=this.uvs,i=this.object.geometry.uvs;i.push(n[e+0],n[e+1]),i.push(n[t+0],n[t+1]),i.push(n[r+0],n[r+1])},addDefaultUV:function(){var e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){var t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,r,n,i,o,a,s,l){var u=this.vertices.length;e=this.parseVertexIndex(e,u),t=this.parseVertexIndex(t,u),r=this.parseVertexIndex(r,u),this.addVertex(e,t,r),this.addColor(e,t,r),void 0!==a&&""!==a?(u=this.normals.length,e=this.parseNormalIndex(a,u),t=this.parseNormalIndex(s,u),r=this.parseNormalIndex(l,u),this.addNormal(e,t,r)):this.addFaceNormal(e,t,r),void 0!==n&&""!==n?(a=this.uvs.length,e=this.parseUVIndex(n,a),t=this.parseUVIndex(i,a),r=this.parseUVIndex(o,a),this.addUV(e,t,r),this.object.geometry.hasUVIndices=!0):this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";for(var t=this.vertices.length,r=0,n=e.length;r<n;r++){var i=this.parseVertexIndex(e[r],t);this.addVertexPoint(i),this.addColor(i)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";for(var r=this.vertices.length,n=this.uvs.length,i=0,o=e.length;i<o;i++)this.addVertexLine(this.parseVertexIndex(e[i],r));for(var a=0,s=t.length;a<s;a++)this.addUVLine(this.parseUVIndex(t[a],n))}};return e.startObject("",!1),e}var ys=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&os(t,e);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=as(e);if(r=t?(r=as(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===is(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e){if(this instanceof i)return(e=n.call(this,e)).materials=null,e;throw new TypeError("Cannot call a class as a function")}return t=i,(e=[{key:"load",value:function(e,t,n,i){var o=this,a=new r.FileLoader(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(r){try{t(o.parse(r))}catch(r){i?i(r):console.error(r),o.manager.itemError(e)}}),n,i)}},{key:"setMaterials",value:function(e){return this.materials=e,this}},{key:"parse",value:function(e){for(var t,n,i,o=new vs,a=(e=-1!==(e=-1!==e.indexOf("\r\n")?e.replace(/\r\n/g,"\n"):e).indexOf("\\\n")?e.replace(/\\\n/g,""):e).split("\n"),s="",l=[],u="function"==typeof"".trimLeft,c=0,h=a.length;c<h;c++)if(s=a[c],0!==(s=u?s.trimLeft():s.trim()).length&&"#"!==(t=s.charAt(0)))if("v"===t){var d=s.split(/\s+/);switch(d[0]){case"v":o.vertices.push(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3])),7<=d.length?(gs.setRGB(parseFloat(d[4]),parseFloat(d[5]),parseFloat(d[6])).convertSRGBToLinear(),o.colors.push(gs.r,gs.g,gs.b)):o.colors.push(void 0,void 0,void 0);break;case"vn":o.normals.push(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3]));break;case"vt":o.uvs.push(parseFloat(d[1]),parseFloat(d[2]))}}else if("f"===t){for(var p=s.slice(1).trim().split(/\s+/),f=[],m=0,g=p.length;m<g;m++){var v=p[m];0<v.length&&(v=v.split("/"),f.push(v))}for(var y=f[0],b=1,x=f.length-1;b<x;b++){var w=f[b],A=f[b+1];o.addFace(y[0],w[0],A[0],y[1],w[1],A[1],y[2],w[2],A[2])}}else if("l"===t){var S=s.substring(1).trim().split(" "),B=[],M=[];if(-1===s.indexOf("/"))B=S;else for(var C=0,E=S.length;C<E;C++){var _=S[C].split("/");""!==_[0]&&B.push(_[0]),""!==_[1]&&M.push(_[1])}o.addLineGeometry(B,M)}else"p"===t?(n=s.slice(1).trim().split(" "),o.addPointGeometry(n)):null!==(l=ss.exec(s))?(n=(" "+l[0].slice(1).trim()).slice(1),o.startObject(n)):us.test(s)?o.object.startMaterial(s.substring(7).trim(),o.materialLibraries):ls.test(s)?o.materialLibraries.push(s.substring(7).trim()):cs.test(s)?console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.'):"s"===t?(1<(l=s.split(" ")).length?(i=l[1].trim().toLowerCase(),o.object.smooth="0"!==i&&"off"!==i):o.object.smooth=!0,(i=o.object.currentMaterial())&&(i.smooth=o.object.smooth)):"\0"!==s&&console.warn('THREE.OBJLoader: Unexpected line: "'+s+'"');o.finalize();var T,D=new r.Group;if(1==(D.materialLibraries=[].concat(o.materialLibraries),e=!(1===o.objects.length&&0===o.objects[0].geometry.vertices.length)))for(var R=0,O=o.objects.length;R<O;R++){var P=o.objects[R],I=P.geometry,k=P.materials,L="Line"===I.type,F="Points"===I.type,U=!1;if(0!==I.vertices.length){for(var G=new r.BufferGeometry,j=(G.setAttribute("position",new r.Float32BufferAttribute(I.vertices,3)),0<I.normals.length&&G.setAttribute("normal",new r.Float32BufferAttribute(I.normals,3)),0<I.colors.length&&(U=!0,G.setAttribute("color",new r.Float32BufferAttribute(I.colors,3))),!0===I.hasUVIndices&&G.setAttribute("uv",new r.Float32BufferAttribute(I.uvs,2)),[]),H=0,N=k.length;H<N;H++){var z,V=k[H],J=V.name+"_"+V.smooth+"_"+U,K=o.materials[J];null!==this.materials&&(K=this.materials.create(V.name),!L||!K||K instanceof r.LineBasicMaterial?!F||!K||K instanceof r.PointsMaterial||(z=new r.PointsMaterial({size:10,sizeAttenuation:!1}),r.Material.prototype.copy.call(z,K),z.color.copy(K.color),z.map=K.map,K=z):(z=new r.LineBasicMaterial,r.Material.prototype.copy.call(z,K),z.color.copy(K.color),K=z)),void 0===K&&((K=L?new r.LineBasicMaterial:F?new r.PointsMaterial({size:1,sizeAttenuation:!1}):new r.MeshPhongMaterial).name=V.name,K.flatShading=!V.smooth,K.vertexColors=U,o.materials[J]=K),j.push(K)}if(I=void 0,1<j.length){for(var W=0,X=k.length;W<X;W++){var Q=k[W];G.addGroup(Q.groupStart,Q.groupCount,W)}I=new(L?r.LineSegments:F?r.Points:r.Mesh)(G,j)}else I=new(L?r.LineSegments:F?r.Points:r.Mesh)(G,j[0]);I.name=P.name,D.add(I)}}else 0<o.vertices.length&&(e=new r.PointsMaterial({size:1,sizeAttenuation:!1}),(T=new r.BufferGeometry).setAttribute("position",new r.Float32BufferAttribute(o.vertices,3)),0<o.colors.length&&void 0!==o.colors[0]&&(T.setAttribute("color",new r.Float32BufferAttribute(o.colors,3)),e.vertexColors=!0),T=new r.Points(T,e),D.add(T));return D}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.Loader),bs=function(e,t,r,n){return new(r=r||Promise)((function(i,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))};const xs=t.FBXLoader;class ws{constructor(e){this.parses={fbx:new xs,obj:new ys,object:new r.ObjectLoader},this.runScene=e}getBack(e){return e.name.substring(e.name.lastIndexOf(".")+1).toLowerCase()}parseFiles(e){return Promise.all(e.map((e=>this.parse(e))))}parse(e){return bs(this,void 0,void 0,(function*(){let t;switch(this.getBack(e).toLowerCase()){case"gltf":case"glb":t=this.glb(e);break;case"fbx":t=this.fbx(e);break;case"obj":t=this.obj(e);break;case"json":t=this.json(e)}return this.runScene.modelEx.beforeLoad(yield t)}))}img(e){console.log(e,"file")}glb(e){return bs(this,void 0,void 0,(function*(){var t=yield(0,Fr.toResult)(e,"arrayBuffer");let r="model";return t=yield this.runScene.loaderer.gltf.parse(t,{addToScene:!1,triggerCb:!0,getJSON(e){r=(null==(e=e.asset.ex)?void 0:e.type)||"scene"}}),{type:r,result:t}}))}fbx(e){return bs(this,void 0,void 0,(function*(){var t=e instanceof ArrayBuffer?e:yield(0,Fr.toResult)(e,"arrayBuffer");const r=this.parses.fbx.parse(t,"");return r.traverse((e=>{e.material&&(e.material=this.runScene.materialEx.create())})),{type:"model",result:this.runScene.sceneEx.cleanUnlessLevel(r)}}))}obj(e){return bs(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,Fr.toResult)(e,"text"):e;const r=this.parses.obj.parse(t);return r.traverse((e=>{e.material&&(e.material=this.runScene.materialEx.create())})),{type:"model",result:this.runScene.sceneEx.cleanUnlessLevel(r)}}))}json(e){return bs(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,Fr.toResult)(e,"text"):e;return{type:"model",result:this.runScene.loaderer.json.parse(t)}}))}}class As extends V{constructor(e){super(e),this._lastRenderMode=null,this.setRenderMode=(()=>{let e=!1;const t=()=>{e||(this.runScene.cb.loaderer.gltf.loaded.add("global-config",(()=>{"controlsChange"===this._lastRenderMode&&this.runScene.render()})),this.runScene.cb.loaderer.gltf.complete.add("global-config",(()=>{"controlsChange"===this._lastRenderMode&&this.runScene.render()})),e=!0)},r=()=>{const{renderer:e,controls:t}=this.runScene.assetsEx;var r=this.runScene.render;"tick"===this._lastRenderMode?e.setAnimationLoop(null):"controlsChange"===this._lastRenderMode&&t.removeEventListener("change",r)},n=e=>{var t=this.runScene.render;const{renderer:r,controls:n}=this.runScene.assetsEx;"tick"===e?r.setAnimationLoop(t):"controlsChange"===e&&n.addEventListener("change",t)};return e=>{this._lastRenderMode!==e&&(t(),r(),n(e),this._lastRenderMode=e)}})()}setGlow(e){this.runScene.bloom.glow.bloomParams.isBloom=e}setRender2(e){this.runScene.assetsEx.setRender2(e)}setRender3(e){this.runScene.assetsEx.setRender3(e)}}class Ss extends A{constructor(e,t){super(e,t),this.transGizmo=this.children[0],this.scaleCoefficient=new r.Vector3,this.beginScale=new r.Vector3,this.posStart=new r.Vector2,this.posEnd=new r.Vector2,this.deleteRedundantParts()}deleteRedundantParts(){this.transGizmo.gizmo.translate.children.splice(1,1),this.transGizmo.gizmo.translate.children.splice(3,1),this.transGizmo.gizmo.translate.children.splice(5,1),this.transGizmo.gizmo.scale.children.splice(0,1),this.transGizmo.gizmo.scale.children.splice(2,1),this.transGizmo.gizmo.scale.children.splice(4,1)}pointerDown(e){void 0===this.object||null===this.axis||this.dragging||0!==e.button||(this.posStart.set(e.x,e.y),this.beginScale.set(this.object.scale.x,this.object.scale.y,this.object.scale.z),super.pointerDown(e))}pointerMove(e){if(super.pointerMove(e),void 0!==this.object&&null!==this.axis&&this.dragging&&-1===e.button&&"scale"===this.mode&&-1!==this.axis.search("XYZ")){this.posEnd.set(e.x,e.y),e=(Math.abs(this.beginScale.x)+Math.abs(this.beginScale.y)+Math.abs(this.beginScale.z))/3;let t=12*this.pointStart.distanceTo(this.pointEnd)/e;this.posEnd.x>this.posStart.x&&(t*=-1),(t=-1.1<t&&t<1.1?1:t)<0&&(t=-1.1/t),this.scaleCoefficient.set(t,t,t),this.object.scale.copy(this._scaleStart).multiply(this.scaleCoefficient)}}}class Bs extends r.Object3D{constructor(e){super(),this.isViewHelper=!0,this.animating=!1,this.controls=null,this.dummy=new r.Object3D,this.turnRate=2*Math.PI,this.targetPosition=new r.Vector3,this.targetQuaternion=new r.Quaternion,this.q1=new r.Quaternion,this.q2=new r.Quaternion,this.radius=0,this.clock=new r.Clock,this.runScene=e;var{camera:e,controls:t}=this.runScene.assetsEx.get();this.editorCamera=e,this.controls=t,this.runScene.cb.render.add("view-helper",(()=>{this.update(this.clock.getDelta())}))}prepareAnimationData(e){console.log(e,"type");var t=this.controls.target;switch(e){case"posX":this.targetPosition.set(1,0,0),this.targetQuaternion.setFromEuler(new r.Euler(0,.5*Math.PI,0));break;case"posY":this.targetPosition.set(0,1,0),this.targetQuaternion.setFromEuler(new r.Euler(.5*-Math.PI,0,0));break;case"posZ":this.targetPosition.set(0,0,1),this.targetQuaternion.setFromEuler(new r.Euler);break;case"negX":this.targetPosition.set(-1,0,0),this.targetQuaternion.setFromEuler(new r.Euler(0,.5*-Math.PI,0));break;case"negY":this.targetPosition.set(0,-1,0),this.targetQuaternion.setFromEuler(new r.Euler(.5*Math.PI,0,0));break;case"negZ":this.targetPosition.set(0,0,-1),this.targetQuaternion.setFromEuler(new r.Euler(0,Math.PI,0));break;default:console.error("ViewHelper: Invalid axis.")}this.radius=this.editorCamera.position.distanceTo(t),this.targetPosition.multiplyScalar(this.radius).add(t),this.dummy.position.copy(t),this.dummy.lookAt(this.editorCamera.position),this.q1.copy(this.dummy.quaternion),this.dummy.lookAt(this.targetPosition),this.q2.copy(this.dummy.quaternion),this.animating=!0}update(e){var t;this.animating&&(e*=this.turnRate,t=this.controls.target,this.q1.rotateTowards(this.q2,e),this.editorCamera.position.set(0,0,1).applyQuaternion(this.q1).multiplyScalar(this.radius).add(t),this.editorCamera.quaternion.rotateTowards(this.targetQuaternion,e),0===this.q1.angleTo(this.q2)&&(this.animating=!1))}}class Ms{constructor(e){this.grid=null,this.transContro=null,this.boxHelper=null,this.deepIsHelper=e=>"Scene"===e.type||!this.isHelper(e)&&!!e.parent&&this.deepIsHelper(e.parent),this.getBoxHelper=e=>(e=new r.BoxHelper(e),this.setHelper(e),this.runScene.assetsEx.get().scene.add(e),e),this.runScene=e,"running"!==this.runScene.optionsEx.options.mode&&(this.transContro=new class{constructor(e){this.tansControls=null,this.controlsMode="position",this.isDraggingChange=!1,this.modelNewVal=new at.Z.Vector3,this.transControlsStatusMap={position:"translate",rotation:"rotate",scale:"scale"},this.multipObj=null,this.draggingChanged=e=>{var t=this.runScene.assetsEx.get().controls,r=this.controlsMode,n=this.runScene.modelEx.select||this.runScene.multipSelector.getLast();n&&(this.runScene.multipSelector.draggingchanged(e),t.enabled?(this.modelNewVal=this.runScene.modelEx.cloneV3(n[r]),this.isDraggingChange=!0):(this.runScene.multipSelector.isEmpty()&&this.runScene.modelEx.setV3({model:n,info:r,newV3:this.runScene.modelEx.cloneV3(n[r]),oldV3:this.modelNewVal},!0,!1),this.isDraggingChange=!1),this.runScene.assetsEx.get().controls.enabled=!e.value)},this.runScene=e}init(){const{camera:e,renderer:t,scene:r}=this.runScene.assetsEx;this.tansControls=new Ss(e,t.domElement),this.tansControls.addEventListener("dragging-changed",this.draggingChanged),this.tansControls.addEventListener("change",this.transChangeFn.bind(this)),this.tansControls.name="helper",r.add(this.tansControls),this.tansControls.traverse((e=>e.isHelper=!0))}changeMode(e){this.controlsMode=e,this.tansControls.setMode(this.transControlsStatusMap[e])}transControSize(e){this.tansControls.setSize(e?this.tansControls.size+.1:Math.max(this.tansControls.size-.1,.1))}changeState(e){this.tansControls.enabled=e}addObject(e){this.removeFocus(),this.tansControls.attach(e)}removeFocus(){this.tansControls.detach()}changeSpaceState(){this.tansControls.setSpace("local"===this.tansControls.space?"world":"local"),this.tansControls.detach()}transChangeFn(e){var t=this.runScene.modelEx.select;t&&(this.runScene.lightEx.update(t),this.runScene.helperEx.boxHelper.setFromObject(t)),this.runScene.multipSelector.transChange(),this.runScene.cb.tranControls.changing.cb(t)}close(){this.tansControls.enabled=!1}open(){this.tansControls.enabled=!0}reset(){this.dispose(),this.init()}dispose(){this.tansControls&&(this.tansControls.removeEventListener("dragging-changed",this.draggingChanged),this.tansControls.removeEventListener("change",this.transChangeFn),this.tansControls.dispose(),this.runScene.assetsEx.get().scene.remove(this.tansControls))}}(e),this.viewHelper=new Bs(e),this.grid=this.createGrid(),this.init())}init(){this.transContro.init(),this.runScene.assetsEx.get().scene.add(this.grid)}createGrid(){const e=new at.Z.GridHelper(20,10);return e.name="helper",e.position.y=0,e.material.opacity=.75,e.material.transparent=!0,e}dispose(){}reset(){"running"!==this.runScene.optionsEx.options.mode&&this.transContro.reset()}isHelper(e){return"GridHelper"===e.type||"CubeCamera"===e.type||e.isTransformControls||e.userData.isHelper}setHelper(e,t=!1,r){return e.userData.isHelper=!0,t&&e.traverse((e=>{e.userData.isHelper=!0,r&&r(e)})),e}focus(e){"running"!==this.runScene.optionsEx.options.mode&&(this.boxHelper||(this.boxHelper=this.getBoxHelper(e)),this.transContro.addObject(e),this.boxHelper.setFromObject(e),this.focusModelId=this.runScene.uniqueEx.getId(e))}unfocus(){var e;"running"!==this.runScene.optionsEx.options.mode&&(this.transContro.removeFocus(),null!=(e=this.boxHelper)&&e.setFromObject(this.runScene.assetsEx.get().scene),this.focusModelId=void 0)}}yn=__webpack_require__(4356);var Cs=__webpack_require__.n(yn),Es=__webpack_require__(6569),_s=__webpack_require__(1682),Ts=__webpack_require__(9960);class Ds{constructor(e){this.selectors={},this.boxHelperMap={},this.savedV3=new ot.Z,this.tempOldval=new Vs.Vector3,this.runScene=e}add(e,t=!1){if("array"===(0,Es.getType)(e))return e.map((e=>this.add(e)));var r=this.runScene.modelEx.select;if(r&&(this.runScene.modelEx.selectNull(),delete this.selectors[e.uuid],this.add(r)),"BoxHelper"!==e.type){if(this.selectors[e.uuid]){if(this.remove(e),this.removeBoxHelper(e),!t)return;this.add(e)}this.addBoxHelper(e),this.selectors[e.uuid]=e,this.runScene.cb.model.focus.cb({model:e,status:!0,domActive:!0}),this.runScene.helperEx.focus(e)}}setInfo(e,t,r,n,i,o){"position"!==t&&(i=n,o=r);const a=this.getSelectedList("value");var{x:i,y:s,z:l}=i;const u=i-o.x,c=s-o.y,h=l-o.z,d=[new _s.Z({target:e,info:t,oldV3:this.runScene.modelEx.cloneV3(r),newV3:n,runScene:this.runScene}).execute()];a.map((r=>{if(r!==e){var{x:n,y:i,z:o}=r[t],n=n+=u,i=i+=c,o=o+=h;let e=r[t].clone();e.x=n,e.y=i,e.z=o,n=new _s.Z({target:r,info:t,oldV3:this.runScene.modelEx.cloneV3(r[t]),newV3:e,runScene:this.runScene}).execute(),d.push(n),this.boxHelperMap[r.uuid].setFromObject(r)}})),this.boxHelperMap[e.uuid].setFromObject(e),this.runScene.undoEx.addUndo(d)}draggingchanged(e){const t=this.runScene.assetsEx.get().controls;var r;this.isEmpty()?this.runScene.events.mouse.enableUp=!0:this.runScene.events.mouse.enableUp=!1,e.value?this.isEmpty()||(t.enabled=!1,e=this.getLast(),r=this.runScene.helperEx.transContro.controlsMode,this.tempOldval="position"===r?(0,Ts.VU)(e,this.runScene.sceneEx.get()):this.runScene.modelEx.cloneV3(e[r]),this.saveV3(r)):t.enabled||this.isEmpty()||(this.runScene.events.mouse.enableUp=!1,this.useV3())}transChange(){if(!this.isEmpty()&&!this.runScene.assetsEx.controls.enabled){var e=this.runScene.helperEx.transContro.controlsMode,t=this.getLast();let r;this.runScene.events.mouse.enableUp=!1,this.runScene.helperEx.boxHelper.setFromObject(this.runScene.assetsEx.get().scene),r="position"===e?(0,Ts.VU)(t,this.runScene.sceneEx.get()):this.runScene.modelEx.cloneV3(t[e]),this.getInfo({model:t,type:e,newV3:r,oldV3:this.tempOldval}),this.tempOldval.copy(r)}}saveV3(e){this.getSelectedList("value").map((t=>{var r=(0,br.K)(t);this.savedV3.set(r,{model:t,type:e,val:this.runScene.modelEx.cloneV3(t[e])})}))}useV3(){var e=this.savedV3.map(((e,{type:t,val:r,model:n})=>new _s.Z({target:n,info:t,newV3:this.runScene.modelEx.cloneV3(n[t]),oldV3:r,runScene:this.runScene})));this.runScene.undoEx.addUndo(e),this.savedV3.clear()}getInfo(e){const{model:t,type:r,newV3:n,oldV3:i}=e,o=this.getSelectedList("value");var{x:e,y:a,z:s}=n;const l=e-i.x,u=a-i.y,c=s-i.z;t[r].copy(n),o.map((e=>{if(e!==t){var{x:n,y:i,z:o}=e[r],n=n+=l,i=i+=u,o=o+=c;let t=e[r].clone();t.x=n,t.y=i,t.z=o,e[r].copy(t),this.boxHelperMap[e.uuid].setFromObject(e)}})),this.boxHelperMap[t.uuid].setFromObject(t)}getLast(){var e=this.getSelectedList("value");return e[e.length-1]}addBoxHelper(e){var t=this.runScene.helperEx.getBoxHelper(e);this.boxHelperMap[e.uuid]=t}removeBoxHelper(e){this.runScene.assetsEx.get().scene.remove(this.boxHelperMap[e.uuid]),this.boxHelperMap[e.uuid]=null,delete this.selectors[e.uuid]}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));this.runScene.cb.model.unFocus.cb(e),this.selectors[e.uuid]=null,delete this.selectors[e.uuid]}isEmpty(){return 0===this.getSelectedList("key").length}getSelectedList(e){return"key"===e?Object.keys(this.selectors):Object.values(this.selectors)}getSelect(){var e=Object.values(this.selectors);return 0!==e.length?e:void 0}selectedLoop(e){return Object.keys(this.selectors).map((t=>e(t,this.selectors[t])))}delete(){this.setBoxHelperEmpty(),this.setEmpty(),this.runScene.helperEx.unfocus()}setBoxHelperEmpty(){var e=Object.values(this.boxHelperMap);this.runScene.assetsEx.get().scene.remove(...e),this.boxHelperMap={}}setEmpty(){this.isEmpty()||(this.getSelectedList("value").map((e=>{this.runScene.cb.model.unFocus.cb(e)})),this.setBoxHelperEmpty(),this.selectors={},this.runScene.cb.model.multiSelect.setEmpty.cb())}createGroup(){this.runScene.helperEx.unfocus(),this.runScene.modelEx.selectNull();var e=new r.Group;const t=new r.Group;this.runScene.modelEx.add(e,void 0,{addUndo:!1}),this.runScene.modelEx.add(t);var n=[...this.getSelectedList("value")],i=(this.runScene.cb.model.multipDrop.cb({models:this.getSelectedList("value"),dropModel:e}),Cs().group.getCenter(e));t.position.copy(i),this.runScene.cb.model.multipDrop.cb({models:n,dropModel:t}),this.runScene.modelEx.remove(e,!1),this.runScene.modelEx.select=t}getSelectorGroup(){const e=this.getSelectedList("value"),t=new r.Group;return e.forEach((e=>t.add(e.clone()))),this.setEmpty(),t}rename(e){const{prefix:t,rmPrefixLength:r,back:n,rmBackLength:i,fullName:o,step:a}=e,s=this.getSelectedList("value");0!==s.length&&(e=s.map(((e,s)=>{let l=e.name;if(0===o.length){if(0!==r){if(r>l.length)return;l=l.substring(r)}if(0!==i){if(i>l.length)return;l=l.substring(0,l.length-i)}0<t.length&&(l=t+l),0<n.length&&(l+=n)}else l=o+(s+1)*a;return new qr.Z({target:e,info:"name",newVal:l,oldVal:e.name,runScene:this.runScene}).execute()})),this.runScene.undoEx.addUndo(e))}}function Rs(){var e=0,t=document.createElement("div");function r(e){return t.appendChild(e.dom),e}function n(r){for(var n=0;n<t.children.length;n++)t.children[n].style.display=n===r?"block":"none";e=r}t.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",t.addEventListener("click",(function(r){r.preventDefault(),n(++e%t.children.length)}),!1);var i,o=(performance||Date).now(),a=o,s=0,l=r(new Rs.Panel("FPS","#0ff","#002")),u=r(new Rs.Panel("MS","#0f0","#020"));return self.performance&&self.performance.memory&&(i=r(new Rs.Panel("MB","#f08","#201"))),n(0),{REVISION:16,dom:t,addPanel:r,showPanel:n,begin:function(){o=(performance||Date).now()},end:function(){s++;var e,t=(performance||Date).now();return u.update(t-o,200),a+1e3<=t&&(l.update(1e3*s/(t-a),100),a=t,s=0,i&&(e=performance.memory,i.update(e.usedJSHeapSize/1048576,e.jsHeapSizeLimit/1048576))),t},update:function(){o=this.end()},domElement:t,setMode:n}}Rs.Panel=function(e,t,r){var n=1/0,i=0,o=Math.round,a=o(window.devicePixelRatio||1),s=80*a,l=48*a,u=3*a,c=2*a,h=3*a,d=15*a,p=74*a,f=30*a,m=document.createElement("canvas"),g=(m.width=s,m.height=l,m.style.cssText="width:80px;height:48px",m.getContext("2d"));return g.font="bold "+9*a+"px Helvetica,Arial,sans-serif",g.textBaseline="top",g.fillStyle=r,g.fillRect(0,0,s,l),g.fillStyle=t,g.fillText(e,u,c),g.fillRect(h,d,p,f),g.fillStyle=r,g.globalAlpha=.9,g.fillRect(h,d,p,f),{dom:m,update:function(l,v){n=Math.min(n,l),i=Math.max(i,l),g.fillStyle=r,g.globalAlpha=1,g.fillRect(0,0,s,d),g.fillStyle=t,g.fillText(o(l)+" "+e+" ("+o(n)+"-"+o(i)+")",u,c),g.drawImage(m,h+a,d,p-a,f,h,d,p-a,f),g.fillRect(h+p-a,d,a,f),g.fillStyle=r,g.globalAlpha=.9,g.fillRect(h+p-a,d,a,o((1-l/v)*f))}}};const Os=Rs;class Ps{constructor(e){this.options={msg:{show:!1,level:"base"},run:!0,decodePath:"./draco/",showFps:!1,loadInterval:2e3,mode:"running",hideLocal:!1,instanceClone:!0,render2:!1,render3:!1,coverSameId:!1,renderConfig:{mode:"tick",frame:-1,scriptFrame:-1,matrixAutoUpdate:!1},texture:{load:!0,lazyLoad:{open:!1,intervalTime:16.6},quality:1}},this.exporterOptions={compressTexture:!1,notMaterial:!1,outTime:(0,ae.getTime)(7)},this.sceneOptions={loaded:!1},this.setLoadInterval=(()=>{let e=null;return t=>{const{inputInterval:r,cb:n}=t;e&&clearTimeout(e),e=setTimeout((()=>{n(),e=null,clearTimeout(e)}),r)}})(),this.runScene=e}init(e){this.options=(0,ae.deepMergeObject)(this.options,e||{}),this.options.showFps&&(this.addFps(),this.runScene.cb.render.add("optionx-ex-render",this.render.bind(this)))}addFps(){this.stats=Os(),this.stats.showPanel(0),this.runScene.assetsEx.engineDom.appendChild(this.stats.dom)}render(){var e;null!=(e=this.stats)&&e.update()}log(e,t="detail",r="success"){var n;null!=(n=null==(n=this.options)?void 0:n.msg)&&n.show&&("base"===this.options.msg.level&&"base"===t&&this.runScene.cb.baseLog.cb({msg:e,type:r}),console.log(e))}}var Is=__webpack_require__(8266);class ks extends V{constructor(e){super(e),this.map=new ot.Z,this.playLimit=new ct.cM,this.renderName="script-texture-render",this._clock=new r.Clock,this.bindEvent()}parse(e,t){var r=(0,br.K)(t);0===Object.keys(e).length?this.map.has(r)&&this.map.delete(r):this.map.set(r,{texture:t,uvScript:e})}bindEvent(){this.runScene.cb.texture.setAnima.add("script-texture-set-anima",(({uvScript:e,texture:t})=>this.parse(e,t))),this.runScene.cb.texture.add.add("script-texture-add-texture",(e=>{var t=e.userData.uvScript;t&&this.parse(t,e)}))}_playAll(){this.map.forEach((e=>{const{texture:t,uvScript:r}=e;var{moveX:e,moveY:n,rotate:i}=r;e&&(t.offset.x+=e),n&&(t.offset.y+=n),i&&(t.rotation+=i)}))}playAll(){const{scriptFrame:e,mode:t}=this.runScene.optionsEx.options.renderConfig;-1===e&&"tick"===t?this.runScene.cb.render.add(this.renderName,(()=>{this._playAll()})):this.runScene.cb.render.add(this.renderName,(()=>{this.playLimit.update({cb:()=>{this._playAll()},cbRate:1/e,now:this._clock.getDelta()})}))}closeAll(){this.map.forEach((e=>{const{texture:t,uvScript:r}=e;var{moveX:e,moveY:n,rotate:i}=r;0!==e&&(t.offset.x=0),0!==n&&(t.offset.y=0),0!==i&&(t.rotation=0)})),this.runScene.cb.render.delete(this.renderName)}}class Ls extends V{constructor(e){super(e),this.runAll=!1,this.texture=new ks(e)}playAll(){this.runAll||(this.runAll=!0,this.texture.playAll())}closeAll(){this.runAll&&(this.runAll=!1,this.texture.closeAll())}}var Fs=__webpack_require__(9716);class Us{constructor(e,t){this.showTransform=!1,this.data=new Proxy({},{set:(e,t,r)=>(e[t]=r,!0)}),this.uuid="",this.getAnimaByModelData=(()=>{const e=(e,t,r,n)=>{const i={},o={};if(e=Us.isNotNow(e)?this.getAllData():e,(0,z.js)(n,((r,n)=>{void 0!==e[r]&&("number"===(n=n.type)?(i[r]=t[r],o[r]=e[r]):"color"===n&&(0,z.js)(e[r],((e,n)=>{var a=r+e;i[a]=t[r][e],o[a]=n})))})),!(0,z.CV)(i))return{begin:i,end:o}};return(t,r,n,i=!1,o)=>{let a=i?n.time:0;const s=Object.keys(t).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t)));var l=(0,Fs.lastArrayEle)(s),u=i?"0.00":String(n.time);return l!==u&&(t[u]=Object.assign({},l),s.push(u)),s.map((s=>{var l=t[String(s)],u=.001*((u=i?a-s:s-a)<=0?.001:u)*n.speed;a=s;{var c=r,h=l,d=u,p=o;const t={color(e){const{animaData:t,defType:r}=e,n={};(0,z.js)(t,(e=>{var i;-1!==e.indexOf(r)&&(i=e.substring(r.length),["r","g","b"].includes(i)&&(n[i]=t[e]))}));var{r:e,g:i,b:o}=n;if(e&&i&&o)return n}};return()=>{let r;return{promise:new Promise((n=>{var i;if(!(i=e(h,c,0,p)))return n(0);var{begin:i,end:o}=i;return r=(0,ae.anima)(i,o,d,(e=>{(0,z.js)(p,((r,n)=>{n=n.type;var i,o=e[r];"number"===n?c[r]=o:"color"===n&&(o=t.color({animaData:e,defType:r}))&&(({r:n,g:o,b:i}=o),c[r].setRGB(n,o,i))}))}),n)})),anima:r}}}}))}})(),this.runScene=t,this.target=e,this.target.userData.isTimeLineUsed=!0,this.uuid=this.getId(e)}toJSON(){var{data:e,type:t}=this;return{data:e,type:t}}addData(e,t,r=!1){return 1e3<Number(e)&&(e="1000.00"),r?this.data[e]=this.getAllData():(this.data[e]||(this.data[e]={}),this.data[e][t]=this.getData(t)),this.data[e]}addTriggerNowData(e){return this.data[e]=this.getAllData(!0)}removeData(e){delete this.data[e]}static isNotNow(e){return"notNow"===Object.values(e)[0]}static getAllDefValByType(e,t,r=!1){const n={};return(0,z.js)(e,(i=>{n[i]=r?"notNow":Us.getValByType(t,i,e)})),n}static getValByType(e,t,r){var n,i;return r=r[t].type,e=e[t],"number"===r?e:"color"===r?(({r:t,g:n,b:i}=e),{r:t,g:n,b:i}):"V3"===r?Cs().model.v3ToMap(e):""}static SetTargetByData(e){const{baseType:t,data:r,defType:n,target:i}=e;var o,a;"number"===t?i[n]=r:"color"===t&&(({r:e,g:o,b:a}=r),i[n].setRGB(e,o,a))}getAllData(e=!1){return Us.getAllDefValByType(this.defOptions,this.target,e)}getData(e){return Us.getValByType(this.target,e,this.defOptions)}static getTarget(e,t){}getAnima(e,t){return this.getAnimaByModelData(this.data,this.target,e,t,this.defOptions)}setTargetByBetween(e,t,r){Us.setTargetByBetween(e,t,r,this.defOptions,this.target)}clone(e){var{data:t,type:r}=this;const n=new(0,js[r])(e);return n.data=t,n}reset(){(0,z.js)(this.defOptions,((e,t)=>{Us.SetTargetByData({baseType:t.type,data:Us.getValByType(this.beginData,e,this.defOptions),target:this.target,defType:e})}))}remove(){delete this.target.userData.isTimeLineUsed}}Us.setTargetByBetween=(()=>{const e=(e,t,r)=>e!==t?(t-e)*r+e:e;return(t,r,n,i,o)=>{(0,z.js)(i,((i,a)=>{var s,l,u,c,h,d;a=a.type,void 0!==t[i]&&void 0!==r[i]&&Us.SetTargetByData({baseType:a,data:(s=t[i],l=r[i],u=n,"number"===a?e(s,l,u):"color"===a?(({r:a,g:s,b:c}=s),({r:l,g:h,b:d}=l),{r:e(a,l,u),g:e(s,h,u),b:e(c,d,u)}):void 0),defType:i,target:o})}))}})();const Gs=Us,js={model:class extends Gs{constructor(e,t){super(e,t),this.type="model",this.defOptions={position:{type:"V3"},scale:{type:"V3"},rotation:{type:"V3"}},this.setTargetByBetween=(()=>{const e=(e,t,r)=>{var{x:e,y:n,z:i}=e,{x:t,y:o,z:a}=t;return{x:e!==t?(t-e)*r+e:e,y:n!==o?(o-n)*r+n:n,z:i!==a?(a-i)*r+i:i}};return(t,r,n)=>{var i,{position:t,scale:o,rotation:a}=t,{position:r,scale:s,rotation:l}=r;t&&r&&(({x:t,y:r,z:i}=e(t,r,n)),this.target.position.set(t,r,i)),o&&s&&(({x:t,y:r,z:i}=e(o,s,n)),this.target.scale.set(t,r,i)),a&&l&&(({x:o,y:s,z:t}=e(a,l,n)),this.target.rotation.set(o,s,t))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,r)=>{var{position:t,scale:n,rotation:i}=t,{position:e,scale:o,rotation:a}=Gs.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},o?{sx:n.x,sy:n.y,sz:n.z}:{},a?{rx:i.x,ry:i.y,rz:i.z}:{}),end:Object.assign({},r.curve?{ease:"none"}:{},e?{px:e.x,py:e.y,pz:e.z}:{},o?{sx:o.x,sy:o.y,sz:o.z}:{},a?{rx:a.x,ry:a.y,rz:a.z}:{})}};return(t,r,n,i=!1)=>{let o=i?n.time:0;const a=Object.keys(t).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t)));var s=(0,Fs.lastArrayEle)(a),l=i?"0.00":String(n.time)+".00";return s!==l&&(t[l]={position:"notNow",rotation:"notNow",scale:"notNow"},a.push(l)),a.map((a=>{var s,l,u,c,h=t[String(a)],d=.001*((d=i?o-a:a-o)<=0?.001:d)*n.speed;return o=a,s=r,l=h,u=d,c=n,()=>{let t;return{promise:new Promise((r=>{var{begin:n,end:i}=e(l,s,c);return t=(0,ae.anima)(n,i,u,(e=>{var{px:e,py:t,pz:r,sx:n,sy:i,sz:o,rx:a,ry:u,rz:c}=e;l.position&&s.position.set(e,t,r),l.scale&&s.scale.set(n,i,o),l.rotation&&s.rotation.set(a,u,c)}),r)})),anima:t}}}))}})(),this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.model.get(e)}isRemoved(){return!(this.target&&this.target.parent)}getAnima(e,t=!1){return this.getAnimaByModelData(this.data,this.target,e,t)}getId(){return this.runScene.uniqueEx.getId(this.target)}reset(){var{position:e,scale:t,rotation:r}=this.beginData;this.target.position.set(e.x,e.y,e.z),this.target.scale.set(t.x,t.y,t.z),this.target.rotation.set(r.x,r.y,r.z)}},camera:class extends Gs{constructor(e,t){super(e,t),this.type="camera",this.defOptions={position:{type:"V3"},scale:{type:"V3"},rotation:{type:"V3"},target:{type:"V3"}},this.setTargetByBetween=(()=>{const e=(e,t,r)=>{var{x:e,y:n,z:i}=e,{x:t,y:o,z:a}=t;return{x:e!==t?(t-e)*r+e:e,y:n!==o?(o-n)*r+n:n,z:i!==a?(a-i)*r+i:i}};return(t,r,n)=>{var i,{position:t,scale:o,rotation:a,target:s}=t,{position:r,scale:l,rotation:u,target:c}=r;t&&r&&(({x:t,y:r,z:i}=e(t,r,n)),this.target.position.set(t,r,i)),o&&l&&(({x:t,y:r,z:i}=e(o,l,n)),this.target.scale.set(t,r,i)),a&&u&&(({x:o,y:l,z:t}=e(a,u,n)),this.target.rotation.set(o,l,t)),s&&c&&(({x:r,y:i,z:a}=e(s,c,n)),this.controls.target.set(r,i,a))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,r)=>{var{position:t,scale:n,rotation:i}=t,{position:e,scale:o,rotation:a,target:s}=Gs.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},o?{sx:n.x,sy:n.y,sz:n.z}:{},a?{rx:i.x,ry:i.y,rz:i.z}:{},s?{tx:this.controls.target.x,ty:this.controls.target.y,tz:this.controls.target.z}:{}),end:Object.assign({},r.curve?{ease:"none"}:{},e?{px:e.x,py:e.y,pz:e.z}:{},o?{sx:o.x,sy:o.y,sz:o.z}:{},a?{rx:a.x,ry:a.y,rz:a.z}:{},s?{tx:s.x,ty:s.y,tz:s.z}:{})}},t=(t,r,n,i)=>()=>{let o;return{promise:new Promise((a=>{var{begin:s,end:l}=e(r,t,i);return o=(0,ae.anima)(s,l,n,(e=>{var{px:e,py:n,pz:i,sx:o,sy:a,sz:s,rx:l,ry:u,rz:c,tx:h,ty:d,tz:p}=e;r.position&&t.position.set(e,n,i),r.scale&&t.scale.set(o,a,s),r.rotation&&t.rotation.set(l,u,c),r.target&&this.controls.target.set(h,d,p)}),a)})),anima:ae.anima}};return(e,r,n,i=!1)=>{let o=i?n.time:0;const a=Object.keys(e).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t)));var s=(0,Fs.lastArrayEle)(a),l=i?"0.00":String(n.time);return s!==l&&(e[l]=Object.assign({},s),a.push(l)),a.map((a=>{var s=e[String(a)],l=.001*((l=i?o-a:a-o)<=0?.001:l)*n.speed;return o=a,t(r,s,l,n)}))}})(),this.controls=this.runScene.assetsEx.get().controls,this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.model.get(e)}getBeginData(e){return this.getAllData()}isRemoved(){return!this.target}getAllData(e=!1){var{position:t,scale:r,rotation:n}=this.target;return{position:e?"notNow":Cs().model.v3ToMap(t),scale:e?"notNow":Cs().model.v3ToMap(r),rotation:e?"notNow":Cs().model.v3ToMap(n),target:e?"notNow":Cs().model.v3ToMap(this.controls.target)}}getData(e){var{position:t,scale:r,rotation:n}=this.target;let i;if("position"===e)i=Cs().model.v3ToMap(t);else if("scale"===e)i=Cs().model.v3ToMap(r);else if("rotation"===e)i=Cs().model.v3ToMap(n);else{if("target"!==e)throw TypeError("输入值不存在");i=Cs().model.v3ToMap(this.controls.target)}return i}getAnima(e,t=!1){return this.getAnimaByModelData(this.data,this.target,e,t)}getId(){return this.runScene.uniqueEx.getId(this.target)}reset(){var{position:e,scale:t,rotation:r,target:n}=this.beginData;this.target.position.set(e.x,e.y,e.z),this.target.scale.set(t.x,t.y,t.z),this.target.rotation.set(r.x,r.y,r.z),this.controls.target.set(n.x,n.y,n.z)}},material:class extends Gs{constructor(e,t){super(e,t),this.type="material",this.defOptions={roughness:{type:"number"},metalness:{type:"number"},opacity:{type:"number"},emissive:{type:"color"},color:{type:"color"}},this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.material.get(e)}isRemoved(){return!0}getId(){return this.runScene.uniqueEx.getId(this.target)}}};var Hs=__webpack_require__(2266),Ns=__webpack_require__(2543);class zs{constructor(e){this.id=0,this.vars=new ot.Z,this.uniqueId=0,this.undoMapCode={三维矩阵修改:e=>{var{target:t,info:r}=e,t=this.getVar({target:t,info:r,type:"model"});this.addCmd(t,{uniqueName:"model_"+r,code:`${t.name}.${e.info}.set(${e.newV3.x},${e.newV3.y},${e.newV3.z})`})},修改属性:e=>{var{target:t,info:r}=e,t=this.getVar({target:t,info:r,type:"model"});this.addCmd(t,{uniqueName:"model_"+r,code:`${t.name}.${e.info} = ${e.newVal})`})},修改材质:e=>{const{target:t,newVal:r,info:n}=e;e=this.getVar({target:t,info:n,type:"material"});let i="";r.isColor?i=`new Three.Color('#${r.getHexString()}')`:r.isVector2&&(i=`new Three.Vector2(${r.x},${r.y})`),this.addCmd(e,{uniqueName:"material_"+n,code:e.name+`.${n} = `+(0<i.length?i:r)}),console.log(e.name+`.${n} = `+(0<i.length?i:r)," `${vars.name}.${undo.info} = ${val.length > 0 ? val : newVal}`")}},this.runScene=e}getUniqueName(e){var t=("model"===e?"mesh":"mate")+this.uniqueId;return this.vars.get(t)?(this.uniqueId++,this.getUniqueName(e)):t}hasAndReplaceCmd(e,t){var{id:r,uniqueName:n,code:i}=t;for(const t of e.cmd)if(t.id===r&&n===t.uniqueName)return t.code=i,!0;return!1}addCmd(e,t){t=Object.assign(Object.assign({},t),{id:this.id});var r=this.hasAndReplaceCmd(e,t);this.getAll(),r||e.cmd.add(t)}getVar(e){var{info:e,target:t,type:r}=e;let n=this.getUniqueName(r),i="";if("model"===r?i=`const ${n} = runScene.modelEx.getModel('${t.name}')`:"material"===r&&(i=`const ${n} = runScene.uniqueEx.material.get('${r=(0,Ns.o)(t)}')`),!this.vars.get(n)){const t=new Set;t.add({code:i,id:this.id,uniqueName:"type_"+e}),this.vars.set(n,{defind:!0,name:n,cmd:t}),this.vars}return this.vars.get(n)}undoBaseToCode(e){var t,r;null!=(r=(t=this.undoMapCode)[e.type])&&r.call(t,e)}observe(){this.runScene.cb.undo.addUndos.add("code",(({undoVal:e})=>{e instanceof Array?e.map((e=>this.undoBaseToCode(e))):this.undoBaseToCode(e)}))}getAll(){let e="";return this.vars.map(((t,r)=>{r.cmd.forEach((t=>{e+=`\n ${t.code}\n `}))})),console.log(e,"str"),e}start(){}}const Vs=at.Z,Js={RunScene:class{constructor(e){this._clock=new r.Clock,this.cb=new vr,this.script=new Ls(this),this.uniqueEx=new br.Z(this),this.fileEx=new ws(this),this.optionsEx=new Ps(this),this.undoEx=new Hs.ZP(this),this.textureEx=new ut.default(this),this.controlsEx=new Rr,this.assetsEx=new Mt(this),this.renderEx=new Is.Z(this),this.events=new class{constructor(e){this.key=new Ir(this),this.mouse=new Lr(this),this.drag=new Or(this),this.runScene=e}init(e){this.key.init(e),this.mouse.init(e),window.addEventListener("resize",(()=>this.runScene.cb.resize.cb(this.runScene.renderEx.getDomSize())))}}(this),this.multipSelector=new Ds(this),this.helperEx=null,this.materialEx=new ht.default(this),this.cameraEx=new yr(this),this.sceneEx=new dt.ZP(this),this.modelEx=new lt.default(this),this.loaderer=new xt(this),this.exporter=new ui(this),this.lightEx=new tn(this),this.timeLineEx=new class{constructor(e){this.timerMap={},this.animaMap={},this.groupMap={},this.setModelLocal=(e,t)=>{Object.values(e.data).map((e=>{var r,n,i=((e,t)=>{let r=-1,n=1e3;const i=Object.keys(e).sort(((e,t)=>Number(e)-Number(t)));if(1!==i.length&&(i.map(((e,i)=>{e=Number(e),0<(e=t-e)&&e<n&&(n=e,r=i)})),-1!==r)){var o=i[r],a=i[r+1],s=e[o];if(e=e[a],s&&e){var l=Object.values(s)[0],u=Object.values(e)[0];if("notNow"!==l&&"notNow"!==u)return{left:s,right:e,progress:(t-Number(o))/(Number(a)-Number(o))}}}})(e.data,t);i&&(({left:i,right:r,progress:n}=i),e.setTargetByBetween(i,r,n))}))},this.runScene=e}reset(){this.timerMap={},this.animaMap={},this.groupMap={},this.runScene.cb.timeLine.reset.cb("")}closeGroup(e){var t,r;this.timerMap[e]&&(({setProgressTime:t,awaitRuned:r}=this.timerMap[e]),t&&clearInterval(t),r&&clearInterval(r)),this.groupMap[e].run=!1,this.runScene.cb.timeLine.closeGroup.cb(e);const n=this.animaMap[e];n&&n.length&&n.map((e=>{e.controls.clean=!0}))}resetGroup(e){var t=this.groupMap[e];t&&(this.closeGroup(e),this.runScene.cb.timeLine.setProgress.cb(0),Object.values(t.data).map((e=>e.reset())))}getSavedData(){return(0,z.js)(this.groupMap,((e,t)=>{t.run=!1})),this.groupMap}parseSavedGroupMap(e){Object.keys(e).map((t=>{const r=e[t],n={};(0,z.js)(r.data,((e,t)=>{var{type:t,data:r}=t;const i=js[t];if(t=i.getTarget(e,this.runScene)){const o=new i(t,this.runScene);o.data=r,n[e]=o}})),r.data=n,this.groupMap[t]=r,this.runScene.cb.timeLine.setGroupMap.cb({group:r,groupName:t})}))}playGroup(e){this.runScene.helperEx.unfocus();const t=this.groupMap[e];if(t&&!t.run){t.run=!0;const n=Object.keys(t.data).map((e=>{const r=t.data[e],n=(r.data=new Proxy(r.data,{set:(e,t,r)=>(e[t]=r,!0)}),r.getAnima(t));return t.reverse&&(e=r.getAnima(t,!0),n.push(...e)),n})),i=(this.animaMap[e]||(this.animaMap[e]=[]),this.animaMap[e]=n.map((e=>(0,Fs.eachTriggerArrGetControls)(e))),t.time*t.speed*(t.reverse?2:1)),o=(new Date).valueOf(),a=i;var r=setInterval((()=>{var t=((new Date).valueOf()-o)/a;this.runScene.cb.timeLine.playGroup.cb({groupName:e,progress:t})}),16.6);let s;const l=new Promise((e=>s=setTimeout(e,i)));return this.timerMap[e]={setProgressTime:r,awaitRuned:s},l.then((()=>{if(clearInterval(this.timerMap[e].setProgressTime),t.run)return t.run=!1,t.loop?this.playGroup(e):void 0}))}}}(this),this.anima=new At(this),this.tags=new wr(this),this.core=new zs(this),this.globalConfig=new As(this),this.bloom={glow:new mr(this)},this._renderLimit=new ct.cM,this._render=()=>{const{render2:e,render3:t,scene:r,camera:n}=this.assetsEx;this.cb.render.cb(""),this.bloom.glow.update(),null!=t&&t.render(r,n),null!=e&&e.render(r,n)},this.render=()=>{if(null!=(e=this.optionsEx.options)&&e.run){const r=this._render;var{frame:e,mode:t}=this.optionsEx.options.renderConfig;-1!==e&&"tick"===t?(t=this._clock.getDelta(),this._renderLimit.update({cb(){r()},cbRate:1/e,now:t})):this._render()}};var{rootDom:t,options:n}=e;if(!t)throw TypeError("根节点或路径不可为空");this.optionsEx.init(n),(t=(n||{}).loadInterval)?this.optionsEx.setLoadInterval({inputInterval:t,cb:this.load.bind(this,e)}):this.load(e)}load(e){var{path:e,rootDom:t,loadConfig:r}=e;this.events.init(t),this.assetsEx.init(t),this.globalConfig.setRenderMode(this.optionsEx.options.renderConfig.mode),this.helperEx=new Ms(this);const{camera:n,controls:i}=this.assetsEx.get();this.uniqueEx.model.add(n),this.renderEx.setSize(),i.update(),this.bloom.glow.init(this.assetsEx.get()),this.cb.inited.cb(0),this.cameraEx.reset(n),this.loadScene(e,r)}loadScene(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function o(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(o,a)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){var r=Object.assign(Object.assign({},t),{getJSON:this.cb.load.getJSON.cb,progress:this.cb.load.progress.cb,complete:this.cb.load.complete.cb,triggerCb:!1});if(e instanceof ArrayBuffer)return this.optionsEx.log("正在解析二进制文件","base","info"),this.loaderer.gltf.parse(e,r);this.optionsEx.log("正在拉取场景","base","info");var n=yield H().get(e,{responseType:"arraybuffer",onDownloadProgress:e=>{var{total:e,loaded:t}=e;let r=t/e;1<(r=r<0?0:r)&&(r=1),t=Number(r.toFixed(2)),e=Math.floor(100*t),this.optionsEx.log("下载场景进度:"+e,"detail"),this.cb.load.progress.cb(e)}}).then((e=>e.data)).catch((e=>{this.sceneEx.clean(),this.optionsEx.log("下载场景失败:",e)}));return n?(this.optionsEx.log("拉取场景成功、正在解析","base","success"),this.loaderer.gltf.parse(n,r)):void 0}))}dispose(){this.assetsEx.dispose(),this.sceneEx.clean()}on(e,t){return null!=(e=this.cb.load[e])&&e.add("load-callback"+(0,N.getId)(),t),this}setSize(e,t){const{camera:r,render3:n,render2:i,renderer:o}=this.assetsEx;r.aspect=e/t,r.updateProjectionMatrix(),null!=n&&n.setSize(e,t),null!=i&&i.setSize(e,t),o.setSize(e,t,!0),this.bloom.glow.setSize(e,t)}},Utils:ae,ModelEx:lt,MaterialEx:ht,TextureEx:ut,Three:Vs,ThreeEx:{TransformControls:A},Bus:class{constructor(){this.list={}}on(e,t){this.list[e]=t}emit(...e){if(void 0===this.list[e[0]])throw Error("请先挂载在使用");return this.list[e[0]](...[...e].filter(((e,t)=>0!==t)))}off(e){this.list[e]&&delete this.list[e]}}}})(),__webpack_exports__=__webpack_exports__.default,__webpack_exports__})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("three"),require("axios"),require("uuid1"),require("js-funcs"),require("js-funcs-three"),require("@allex/md5")):"function"==typeof define&&define.amd?define(["three","axios","uuid1","js-funcs","js-funcs-three","@allex/md5"],t):"object"==typeof exports?exports.RunScene=t(require("three"),require("axios"),require("uuid1"),require("js-funcs"),require("js-funcs-three"),require("@allex/md5")):e.RunScene=t(e.three,e.axios,e.uuid1,e["js-funcs"],e["js-funcs-three"],e["@allex/md5"])}(self,((__WEBPACK_EXTERNAL_MODULE__8881__,__WEBPACK_EXTERNAL_MODULE__3300__,__WEBPACK_EXTERNAL_MODULE__7937__,__WEBPACK_EXTERNAL_MODULE__6001__,__WEBPACK_EXTERNAL_MODULE__4356__,__WEBPACK_EXTERNAL_MODULE__1129__)=>(()=>{var __webpack_modules__={2958:(e,t,r)=>{"use strict";function n(){return(n="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=l(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t)}function a(e,t){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function o(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===f(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return s(n)}}function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(e,t,r){return t&&u(e.prototype,t),r&&u(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){var r;if(e)return"string"==typeof e?p(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?p(e,t):void 0}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function f(e){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e){return void 0===e}function v(){return"undefined"!=typeof window}function g(e){return ze(e)||He(e)}function y(e){return(nt=_(e,rt))&&Ar}function b(e,t){return!t&&console.warn(e)}function x(e,t){return e&&(rt[e]=t)&&nt&&(nt[e]=t)||rt}function w(){return 0}function A(e,t,r){return(r=e[t])&&ze(r)?e[t]():m(r)&&e.getAttribute&&e.getAttribute(t)||r}function S(e,t){(e=e.split(",")).forEach(t)}function M(e,t,r,n){ot.length&&vt(),e.render(t,r,n),ot.length&&vt()}function B(e){var t=parseFloat(e);return(t||0===t)&&(e+"").match(et).length<2?t:He(e)?e.trim():e}function C(e){return e}function _(e,t){for(var r in t)e[r]=t[r];return e}function E(e,t){for(var r in t)"__proto__"!==r&&"constructor"!==r&&"prototype"!==r&&(e[r]=Je(t[r])?E(e[r]||(e[r]={}),t[r]):t[r]);return e}function T(e){var t,r=e.parent||le,n=e.keyframes?(t=Qe(e.keyframes),function(e,r){for(var n in r)n in e||"duration"===n&&t||"ease"===n||(e[n]=r[n])}):gt;if(Ke(e.inherit))for(;r;)n(e,r.vars.defaults),r=r.parent||r._dp;return e}function D(e){return!e||e._ts&&D(e.parent)}function P(e){return e._repeat?O(e._tTime,e=e.duration()+e._rDelay)*e:0}function O(e,t){return t=Math.floor(e/=t),e&&t===e?t-1:t}function R(e,t){return(e-t._start)*t._ts+(0<=t._ts?0:t._dirty?t.totalDuration():t._tDur)}function I(e,t){var r;if((t._time||t._initted&&!t._dur)&&(r=R(e.rawTime(),t),(!t._dur||V(0,t.totalDuration(),r)-t._tTime>ke)&&t.render(r,!0)),wt(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur<e.duration())for(r=e;r._dp;)0<=r.rawTime()&&r.totalTime(r._tTime),r=r._dp;e._zTime=-ke}}function k(e,t,r,n){return t.parent&&xt(t),t._start=mt((Ve(r)?r:r||e!==le?H(e,r,t):e._time)+t._delay),t._end=mt(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),function(e,t){var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"_first",i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"_last",a=4<arguments.length?arguments[4]:void 0,o=e[i];if(a)for(r=t[a];o&&o[a]>r;)o=o._prev;o?(t._next=o._next,o._next=t):(t._next=e[n],e[n]=t),t._next?t._next._prev=t:e[i]=t,t._prev=o,t.parent=t._dp=e}(e,t,"_first","_last",e._sort?"_start":0),G(t)||(e._recent=t),n||I(e,t),e}function L(e,t){(rt.ScrollTrigger||it("scrollTrigger",t))&&rt.ScrollTrigger.create(t,e)}function F(e,t,r,n){return Wt(e,t),e._initted?!r&&e._pt&&(e._dur&&!1!==e.vars.lazy||!e._dur&&e.vars.lazy)&&pe!==Ut.frame?(ot.push(e),e._lazy=[t,n]):void 0:1}function U(e){return(e=e.parent)&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||U(e))}function G(e){return"isFromStart"===(e=e.data)||"isStart"===e}function j(e,t,r,n){var i=e._repeat,a=mt(t)||0;return(t=e._tTime/e._tDur)&&!n&&(e._time*=a/e._dur),e._dur=a,e._tDur=i?i<0?1e10:mt(a*(i+1)+e._rDelay*i):a,0<t&&!n?St(e,e._tTime=e._tDur*t):e.parent&&At(e),r||wt(e.parent,e),e}function N(e){return e instanceof ar?wt(e):j(e,e._dur)}function H(e,t,r){var n,i,a,o=e.labels,s=e._recent||Mt,l=e.duration()>=Ie?s.endTime(!1):e._dur;return He(t)&&(isNaN(t)||t in o)?(i=t.charAt(0),a="%"===t.substr(-1),n=t.indexOf("="),"<"===i||">"===i?(0<=n&&(t=t.replace(/=/,"")),("<"===i?s._start:s.endTime(0<=s._repeat))+(parseFloat(t.substr(1))||0)*(a?(n<0?s:r).totalDuration()/100:1)):n<0?(t in o||(o[t]=l),o[t]):(i=parseFloat(t.charAt(n-1)+t.substr(n+1)),a&&r&&(i=i/100*(Qe(r)?r[0]:r).totalDuration()),1<n?H(e,t.substr(0,n-1),r)+i:l+i)):null==t?l:+t}function z(e,t,r){var n,i,a=Ve(t[1]),o=(a?2:1)+(e<2?0:1),s=t[o];if(a&&(s.duration=t[1]),s.parent=r,e){for(n=s,i=r;i&&!("immediateRender"in n);)n=i.vars.defaults||{},i=Ke(i.vars.inherit)&&i.parent;s.immediateRender=Ke(n.immediateRender),e<2?s.runBackwards=1:s.startAt=t[o-1]}return new hr(t[0],s,t[1+o])}function V(e,t,r){return r<e?e:t<r?t:r}function J(e){var t,r,n,i,a,o,s,l,u;return ze(e)?e:(t=Je(e)?e:{each:e},r=Vt(t.ease),n=t.from||0,i=parseFloat(t.base)||0,a={},e=0<n&&n<1,o=isNaN(n)||e,s=t.axis,He(u=l=n)?l=u={center:.5,edges:.5,end:1}[n]||0:!e&&o&&(l=n[0],u=n[1]),function(e,c,h){var d,p,f,m,v,g,y,b,x=(h||t).length,w=a[x];if(!w){if(!(b="auto"===t.grid?0:(t.grid||[1,Ie])[1])){for(g=-Ie;g<(g=h[b++].getBoundingClientRect().left)&&b<x;);b--}for(w=a[x]=[],d=o?Math.min(b,x)*l-.5:n%b,p=b===Ie?0:o?x*u/b-.5:n/b|0,y=Ie,v=g=0;v<x;v++)m=v%b-d,f=p-(v/b|0),w[v]=m=s?Math.abs("y"===s?f:m):Ge(m*m+f*f),g<m&&(g=m),m<y&&(y=m);"random"===n&&Dt(w),w.max=g-y,w.min=y,w.v=x=(parseFloat(t.amount)||parseFloat(t.each)*(x<b?x-1:s?"y"===s?x/b:b:Math.max(b,x/b))||0)*("edges"===n?-1:1),w.b=x<0?i-x:i,w.u=Ct(t.amount||t.each)||0,r=r&&x<0?zt(r):r}return x=(w[e]-w.min)/w.max||0,mt(w.b+(r?r(x):x)*w.v)+w.u})}function K(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(r){var n=Math.round(parseFloat(r)/e)*e*t;return(n-n%1)/t+(Ve(r)?0:Ct(r))}}function W(e,t){var r,n,i=Qe(e);return!i&&Je(e)&&(r=i=e.radius||Ie,e.values?(e=Tt(e.values),(n=!Ve(e[0]))&&(r*=r)):e=K(e.increment)),Bt(t,i?ze(e)?function(t){return n=e(t),Math.abs(n-t)<=r?n:t}:function(t){for(var i,a,o=parseFloat(n?t.x:t),s=parseFloat(n?t.y:0),l=Ie,u=0,c=e.length;c--;)(i=n?(i=e[c].x-o)*i+(a=e[c].y-s)*a:Math.abs(e[c]-o))<l&&(l=i,u=c);return u=!r||l<=r?e[u]:t,n||u===t||Ve(t)?u:u+Ct(t)}:K(e))}function Q(e,t,r,n){return Bt(Qe(e)?!t:!0===r?!!(r=0):!n,(function(){return Qe(e)?e[~~(Math.random()*e.length)]:(r=r||1e-5)&&(n=r<1?Math.pow(10,(r+"").length-2):1)&&Math.floor(Math.round((e-r/2+Math.random()*(t-e+.99*r))/r)*r*n)/n}))}function X(e,t,r){return Bt(r,(function(r){return e[~~t(r)]}))}function Z(e,t,r,n,i){var a=t-e,o=n-r;return Bt(i,(function(t){return r+((t-e)/a*o||0)}))}function Y(e,t,r){var n,i,a,o=e.labels,s=Ie;for(n in o)(i=o[n]-t)<0==!!r&&i&&s>(i=Math.abs(i))&&(a=n,s=i);return a}function q(e,t,r){var n=e.vars,i=n[t];i&&(t=n[t+"Params"],n=n.callbackScope||e,r&&ot.length&&vt(),t?i.apply(n,t):i.call(n))}function $(e){return xt(e),e.scrollTrigger&&e.scrollTrigger.kill(!1),e.progress()<1&&q(e,"onInterrupt"),e}function ee(e,t,r){return(6*(e+=e<0?1:1<e?-1:0)<1?t+(r-t)*e*6:e<.5?r:3*e<2?t+(r-t)*(2/3-e)*6:t)*Ot+.5|0}function te(e,t,r){var n,i,a,o,s="",l=(e+s).match(Lt),u=t?"hsla(":"rgba(",c=0;if(!l)return e;if(l=l.map((function(e){return(e=It(e,t,1))&&u+(t?e[0]+","+e[1]+"%,"+e[2]+"%,"+e[3]:e.join(","))+")"})),r&&(a=kt(e),(n=r.c).join(s)!==a.c.join(s)))for(o=(i=e.replace(Lt,"1").split(Ye)).length-1;c<o;c++)s+=i[c]+(~n.indexOf(c)?l.shift()||u+"0,0,0,0)":(a.length?a:l.length?l:r).shift());if(!i)for(o=(i=e.split(Lt)).length-1;c<o;c++)s+=i[c]+l[c];return s+i[o]}function re(e,t){for(var r,n=e._first;n;)n instanceof ar?re(n,t):!n.vars.yoyoEase||n._yoyo&&n._repeat||n._yoyo===t||(n.timeline?re(n.timeline,t):(r=n._ease,n._ease=n._yEase,n._yEase=r,n._yoyo=t)),n=n._next}function ne(e,t){var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:function(e){return 1-t(1-e)},i={easeIn:t,easeOut:n,easeInOut:3<arguments.length&&void 0!==arguments[3]?arguments[3]:function(e){return e<.5?t(2*e)/2:1-t(2*(1-e))/2}};S(e,(function(e){for(var t in jt[e]=rt[e]=i,jt[r=e.toLowerCase()]=n,i)jt[r+("easeIn"===t?".in":"easeOut"===t?".out":".inOut")]=jt[e+"."+t]=i[t]}))}function ie(e){return function(t){return t<.5?(1-e(1-2*t))/2:.5+e(2*(t-.5))/2}}function ae(e,t,r){function n(e){return 1===e?1:i*Math.pow(2,-10*e)*Ne((e-a)*o)+1}var i=1<=t?t:1,a=(o=(r||(e?.3:.45))/(t<1?t:1))/Le*(Math.asin(1/i)||0),o=(r="out"===e?n:"in"===e?function(e){return 1-n(1-e)}:ie(n),Le/o);return r.config=function(t,r){return ae(e,t,r)},r}function oe(e){function t(e){return e?--e*e*((r+1)*e+r)+1:0}var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1.70158,n="out"===e?t:"in"===e?function(e){return 1-t(1-e)}:ie(t);return n.config=function(t){return oe(e,t)},n}r.d(t,{Q3:()=>hr});var se,le,ue,ce,he,de,pe,fe,me,ve,ge,ye,be,xe,we,Ae,Se,Me,Be,Ce,_e,Ee,Te,De,Pe,Oe={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Re={duration:.5,overwrite:!1,delay:0},Ie=1e8,ke=1/Ie,Le=2*Math.PI,Fe=Le/4,Ue=0,Ge=Math.sqrt,je=Math.cos,Ne=Math.sin,He=function(e){return"string"==typeof e},ze=function(e){return"function"==typeof e},Ve=function(e){return"number"==typeof e},Je=function(e){return"object"==f(e)},Ke=function(e){return!1!==e},We="function"==typeof ArrayBuffer&&ArrayBuffer.isView||function(){},Qe=Array.isArray,Xe=/(?:-?\.?\d|\.)+/gi,Ze=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Ye=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,qe=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,$e=/[+-]=-?[.\d]+/,et=/[^,'"\[\]\s]+/gi,tt=/[\d.+\-=]+(?:e[-+]\d*)*/i,rt={},nt={},it=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},at={},ot=[],st={},lt={},ut={},ct=30,ht=[],dt="",pt=function(e){var t,r,n=e[0];if(Je(n)||ze(n)||(e=[e]),!(t=(n._gsap||{}).harness)){for(r=ht.length;r--&&!ht[r].targetTest(n););t=ht[r]}for(r=e.length;r--;)e[r]&&(e[r]._gsap||(e[r]._gsap=new nr(e[r],t)))||e.splice(r,1);return e},ft=function(e){return e._gsap||pt(Tt(e))[0]._gsap},mt=function(e){return Math.round(1e7*e)/1e7||0},vt=function(){var e,t,r=ot.length,n=ot.slice(0);for(st={},e=ot.length=0;e<r;e++)(t=n[e])&&t._lazy&&(t.render(t._lazy[0],t._lazy[1],!0)._lazy=0)},gt=function(e,t){for(var r in t)r in e||(e[r]=t[r]);return e},yt=function(e,t){var r,n={};for(r in e)r in t||(n[r]=e[r]);return n},bt=function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"_first",n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"_last",i=t._prev,a=t._next;i?i._next=a:e[r]===t&&(e[r]=a),a?a._prev=i:e[n]===t&&(e[n]=i),t._next=t._prev=t.parent=null},xt=function(e,t){!e.parent||t&&!e.parent.autoRemoveChildren||e.parent.remove(e),e._act=0},wt=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var r=e;r;)r._dirty=1,r=r.parent;return e},At=function(e){return e._end=mt(e._start+(e._tDur/Math.abs(e._ts||e._rts||ke)||0))},St=function(e,t){var r=e._dp;return r&&r.smoothChildTiming&&e._ts&&(e._start=mt(r._time-(0<e._ts?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),At(e),r._dirty||wt(r,e)),e},Mt={_start:0,endTime:w,totalDuration:w},Bt=function(e,t){return e||0===e?t(e):t},Ct=function(e,t){return He(e)&&(t=tt.exec(e))?e.substr(t.index+t[0].length):""},_t=[].slice,Et=function(e,t){return e&&Je(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&Je(e[0]))&&!e.nodeType&&e!==ue},Tt=function(e,t,r){return!He(e)||r||!ce&&Gt()?Qe(e)?function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[];return e.forEach((function(e){return He(e)&&!t||Et(e,1)?r.push.apply(r,d(Tt(e))):r.push(e)}))||r}(e,r):Et(e)?_t.call(e,0):e?[e]:[]:_t.call((t||he).querySelectorAll(e),0)},Dt=function(e){return e.sort((function(){return.5-Math.random()}))},Pt=function(e){for(var t,r,n,i,a=0,o="";~(t=e.indexOf("random(",a));)n=e.indexOf(")",t),i="["===e.charAt(t+7),r=e.substr(t+7,n-t-7).match(i?et:Xe),o+=e.substr(a,t-a)+Q(i?r:+r[0],i?0:+r[1],+r[2]||1e-5),a=n+1;return o+e.substr(a,e.length-a)},Ot=255,Rt={aqua:[0,Ot,Ot],lime:[0,Ot,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Ot],navy:[0,0,128],white:[Ot,Ot,Ot],olive:[128,128,0],yellow:[Ot,Ot,0],orange:[Ot,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Ot,0,0],pink:[Ot,192,203],cyan:[0,Ot,Ot],transparent:[Ot,Ot,Ot,0]},It=function(e,t,r){var n,i,a,o,s,l,u,c=e?Ve(e)?[e>>16,e>>8&Ot,e&Ot]:0:Rt.black;if(!c){if(","===e.substr(-1)&&(e=e.substr(0,e.length-1)),Rt[e])c=Rt[e];else if("#"===e.charAt(0)){if(9===(e=e.length<6?"#"+(n=e.charAt(1))+n+(i=e.charAt(2))+i+(a=e.charAt(3))+a+(5===e.length?e.charAt(4)+e.charAt(4):""):e).length)return[(c=parseInt(e.substr(1,6),16))>>16,c>>8&Ot,c&Ot,parseInt(e.substr(7),16)/255];c=[(e=parseInt(e.substr(1),16))>>16,e>>8&Ot,e&Ot]}else if("hsl"===e.substr(0,3))if(c=u=e.match(Xe),t){if(~e.indexOf("="))return c=e.match(Ze),r&&c.length<4&&(c[3]=1),c}else o=+c[0]%360/360,s=+c[1]/100,n=2*(l=+c[2]/100)-(i=l<=.5?l*(s+1):l+s-l*s),3<c.length&&(c[3]*=1),c[0]=ee(o+1/3,n,i),c[1]=ee(o,n,i),c[2]=ee(o-1/3,n,i);else c=e.match(Xe)||Rt.transparent;c=c.map(Number)}return t&&!u&&(n=c[0]/Ot,i=c[1]/Ot,a=c[2]/Ot,l=((e=Math.max(n,i,a))+(t=Math.min(n,i,a)))/2,e===t?o=s=0:(u=e-t,s=.5<l?u/(2-e-t):u/(e+t),o=e===n?(i-a)/u+(i<a?6:0):e===i?(a-n)/u+2:(n-i)/u+4,o*=60),c[0]=~~(o+.5),c[1]=~~(100*s+.5),c[2]=~~(100*l+.5)),r&&c.length<4&&(c[3]=1),c},kt=function(e){var t=[],r=[],n=-1;return e.split(Lt).forEach((function(e){e=e.match(Ye)||[],t.push.apply(t,d(e)),r.push(n+=e.length+1)})),t.c=r,t},Lt=function(){var e,t="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b";for(e in Rt)t+="|"+e+"\\b";return new RegExp(t+")","gi")}(),Ft=/hsl[a]?\(/,Ut=(we=Date.now,Ae=500,Se=33,Me=we(),Be=Me,_e=Ce=1e3/240,Te={time:0,frame:0,tick:function(){Jt(!0)},deltaRatio:function(e){return be/(1e3/(e||60))},wake:function(){de&&(!ce&&v()&&(ue=ce=window,he=ue.document||{},rt.gsap=Ar,(ue.gsapVersions||(ue.gsapVersions=[])).push(Ar.version),y(nt||ue.GreenSockGlobals||!ue.gsap&&ue||{}),ye=ue.requestAnimationFrame),ve&&Te.sleep(),ge=ye||function(e){return setTimeout(e,_e-1e3*Te.time+1|0)},me=1,Jt(2))},sleep:function(){(ye?ue.cancelAnimationFrame:clearTimeout)(ve),me=0,ge=w},lagSmoothing:function(e,t){Ae=e||1/ke,Se=Math.min(t,Ae,0)},fps:function(e){Ce=1e3/(e||240),_e=1e3*Te.time+Ce},add:function(e){Ee.indexOf(e)<0&&Ee.push(e),Gt()},remove:function(e,t){~(t=Ee.indexOf(e))&&Ee.splice(t,1)&&t<=xe&&xe--},_listeners:Ee=[]}),Gt=function(){return!me&&Ut.wake()},jt={},Nt=/^[\d.\-M][\d.\-,\s]/,Ht=/["']/g,zt=function(e){return function(t){return 1-e(1-t)}},Vt=function(e,t){return e&&(ze(e)?e:jt[e]||function(e){var t,r,n,i=(e+"").split("("),a=jt[i[0]];return a&&1<i.length&&a.config?a.config.apply(null,~e.indexOf("{")?[function(e){for(var t,r,n,i={},a=e.substr(1,e.length-3).split(":"),o=a[0],s=1,l=a.length;s<l;s++)r=a[s],t=s!==l-1?r.lastIndexOf(","):r.length,n=r.substr(0,t),i[o]=isNaN(n)?n.replace(Ht,"").trim():+n,o=r.substr(t+1).trim();return i}(i[1])]:(t=(i=e).indexOf("(")+1,r=i.indexOf(")"),n=i.indexOf("(",t),i.substring(t,~n&&n<r?i.indexOf(")",r+1):r).split(",").map(B))):jt._CE&&Nt.test(e)?jt._CE("",e):a}(e))||t};function Jt(e){var t,r,n,i=we()-Be,a=!0===e;if(Ae<i&&(Me+=i-Se),(0<(i=(r=(Be+=i)-Me)-_e)||a)&&(n=++Te.frame,be=r-1e3*Te.time,Te.time=r/=1e3,_e+=i+(Ce<=i?4:Ce-i),t=1),a||(ve=ge(Jt)),t)for(xe=0;xe<Ee.length;xe++)Ee[xe](r,be,n,e)}function Kt(e){return e<Pe?De*e*e:e<.7272727272727273?De*Math.pow(e-1.5/2.75,2)+.75:e<.9090909090909092?De*(e-=2.25/2.75)*e+.9375:De*Math.pow(e-2.625/2.75,2)+.984375}function Wt(e,t){var r,n,i,a,o,s,l,u,c,h,d,p,f,m=e.vars,v=m.ease,g=m.startAt,y=m.immediateRender,b=m.lazy,x=m.onUpdate,w=m.onUpdateParams,A=m.callbackScope,S=m.runBackwards,M=m.yoyoEase,B=m.keyframes,C=m.autoRevert,_=e._dur,E=e._startAt,T=e._targets,D=e.parent,P=D&&"nested"===D.data?D.parent._targets:T,O="auto"===e._overwrite&&!se,R=e.timeline;if(e._ease=Vt(v=!R||B&&v?v:"none",Re.ease),e._yEase=M?zt(Vt(!0===M?v:M,Re.ease)):0,M&&e._yoyo&&!e._repeat&&(M=e._yEase,e._yEase=e._ease,e._ease=M),e._from=!R&&!!m.runBackwards,!R||B&&!m.stagger){if(p=(u=T[0]?ft(T[0]).harness:0)&&m[u.prop],r=yt(m,at),E&&xt(E.render(-1,!0)),g)if(xt(e._startAt=hr.set(T,gt({data:"isStart",overwrite:!1,parent:D,immediateRender:!0,lazy:Ke(b),startAt:null,delay:0,onUpdate:x,onUpdateParams:w,callbackScope:A,stagger:0},g))),t<0&&!y&&!C&&e._startAt.render(-1,!0),y){if(0<t&&!C&&(e._startAt=0),_&&t<=0)return void(t&&(e._zTime=t))}else!1===C&&(e._startAt=0);else if(S&&_)if(E)C||(e._startAt=0);else if(i=gt({overwrite:!1,data:"isFromStart",lazy:(y=!t&&y)&&Ke(b),immediateRender:y,stagger:0,parent:D},r),p&&(i[u.prop]=p),xt(e._startAt=hr.set(T,i)),t<0&&e._startAt.render(-1,!0),e._zTime=t,y){if(!t)return}else Wt(e._startAt,ke);for(e._pt=0,b=_&&Ke(b)||b&&!_,n=0;n<T.length;n++){if(l=(o=T[n])._gsap||pt(T)[n]._gsap,e._ptLookup[n]=h={},st[l.id]&&ot.length&&vt(),d=P===T?n:P.indexOf(o),u&&!1!==(c=new u).init(o,p||r,e,d,P)&&(e._pt=a=new br(e._pt,o,c.name,0,1,c.render,c,0,c.priority),c._props.forEach((function(e){h[e]=a})),c.priority&&(s=1)),!u||p)for(i in r)lt[i]&&(c=lr(i,r,e,d,o,P))?c.priority&&(s=1):h[i]=a=sr.call(e,o,i,"get",r[i],d,P,0,m.stringFilter);e._op&&e._op[n]&&e.kill(o,e._op[n]),O&&e._pt&&(rr=e,le.killTweensOf(o,h,e.globalTime(t)),f=!e.parent,rr=0),e._pt&&b&&(st[l.id]=1)}s&&yr(e),e._onInit&&e._onInit(e)}e._onUpdate=x,e._initted=(!e._op||e._pt)&&!f,B&&t<=0&&R.render(Ie,!0,!0)}function Qt(e,t,r,n,i){return ze(e)?e.call(t,r,n,i):He(e)&&~e.indexOf("random(")?Pt(e):e}function Xt(e,t,r){return e.setAttribute(t,r)}function Zt(e,t){var r=t._pt,n="";if(!e&&t.b)n=t.b;else if(1===e&&t.e)n=t.e;else{for(;r;)n=r.p+(r.m?r.m(r.s+r.c*e):Math.round(1e4*(r.s+r.c*e))/1e4)+n,r=r._next;n+=t.c}t.set(t.t,t.p,n,t)}function Yt(e,t){for(var r=t._pt;r;)r.r(e,r.d),r=r._next}function qt(e,t,r,n){for(var i,a=this._pt;a;)i=a._next,a.p===n&&a.modifier(e,t,r),a=i}function $t(e){for(var t,r,n=this._pt;n;)r=n._next,n.p===e&&!n.op||n.op===e?bt(this,n,"_pt"):n.dep||(t=1),n=r;return!t}function er(e,t,r,n){n.mSet(e,t,n.m.call(n.tween,r,n.mt),n)}function tr(e,t){return{name:e,rawVars:1,init:function(e,r,n){n._onInit=function(e){var n,i;if(He(r)&&(n={},S(r,(function(e){return n[e]=1})),r=n),t){for(i in n={},r)n[i]=t(r[i]);r=n}var a,o,s,l=e,u=r,c=l._targets;for(a in u)for(o=c.length;o--;)(s=(s=l._ptLookup[o][a])&&s.d)&&(s=s._pt?wr(s,a):s)&&s.modifier&&s.modifier(u[a],l,c[o],a)}}}}S("Linear,Quad,Cubic,Quart,Quint,Strong",(function(e,t){var r=t<5?t+1:t;ne(e+",Power"+(r-1),t?function(e){return Math.pow(e,r)}:function(e){return e},(function(e){return 1-Math.pow(1-e,r)}),(function(e){return e<.5?Math.pow(2*e,r)/2:1-Math.pow(2*(1-e),r)/2}))})),jt.Linear.easeNone=jt.none=jt.Linear.easeIn,ne("Elastic",ae("in"),ae("out"),ae()),De=7.5625,Pe=1/2.75,ne("Bounce",(function(e){return 1-Kt(1-e)}),Kt),ne("Expo",(function(e){return e?Math.pow(2,10*(e-1)):0})),ne("Circ",(function(e){return-(Ge(1-e*e)-1)})),ne("Sine",(function(e){return 1===e?1:1-je(e*Fe)})),ne("Back",oe("in"),oe("out"),oe()),jt.SteppedEase=jt.steps=rt.SteppedEase={config:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length?arguments[1]:void 0,r=1/e,n=e+(t?0:1),i=t?1:0,a=1-ke;return function(e){return((n*V(0,a,e)|0)+i)*r}}},Re.ease=jt["quad.out"],S("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",(function(e){return dt+=e+","+e+"Params,"}));var rr,nr=c((function e(t,r){h(this,e),this.id=Ue++,(t._gsap=this).target=t,this.harness=r,this.get=r?r.get:A,this.set=r?r.getSetter:mr})),ir=function(){function e(t){h(this,e),this.vars=t,this._delay=+t.delay||0,(this._repeat=t.repeat===1/0?-2:t.repeat||0)&&(this._rDelay=t.repeatDelay||0,this._yoyo=!!t.yoyo||!!t.yoyoEase),this._ts=1,j(this,+t.duration,1,1),this.data=t.data,me||Ut.wake()}return c(e,[{key:"delay",value:function(e){return e||0===e?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+e-this._delay),this._delay=e,this):this._delay}},{key:"duration",value:function(e){return arguments.length?this.totalDuration(0<this._repeat?e+(e+this._rDelay)*this._repeat:e):this.totalDuration()&&this._dur}},{key:"totalDuration",value:function(e){return arguments.length?(this._dirty=0,j(this,this._repeat<0?e:(e-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur}},{key:"totalTime",value:function(e,t){if(Gt(),!arguments.length)return this._tTime;var r=this._dp;if(r&&r.smoothChildTiming&&this._ts){for(St(this,e),r._dp&&!r.parent&&I(r,this);r&&r.parent;)r.parent._time!==r._start+(0<=r._ts?r._tTime/r._ts:(r.totalDuration()-r._tTime)/-r._ts)&&r.totalTime(r._tTime,!0),r=r.parent;!this.parent&&this._dp.autoRemoveChildren&&(0<this._ts&&e<this._tDur||this._ts<0&&0<e||!this._tDur&&!e)&&k(this._dp,this,this._start-this._delay)}return(this._tTime!==e||!this._dur&&!t||this._initted&&Math.abs(this._zTime)===ke||!e&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=e),M(this,e,t)),this}},{key:"time",value:function(e,t){return arguments.length?this.totalTime(Math.min(this.totalDuration(),e+P(this))%(this._dur+this._rDelay)||(e?this._dur:0),t):this._time}},{key:"totalProgress",value:function(e,t){return arguments.length?this.totalTime(this.totalDuration()*e,t):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.ratio}},{key:"progress",value:function(e,t){return arguments.length?this.totalTime(this.duration()*(!this._yoyo||1&this.iteration()?e:1-e)+P(this),t):this.duration()?Math.min(1,this._time/this._dur):this.ratio}},{key:"iteration",value:function(e,t){var r=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(e-1)*r,t):this._repeat?O(this._tTime,r)+1:1}},{key:"timeScale",value:function(e){if(!arguments.length)return this._rts===-ke?0:this._rts;if(this._rts!==e){for(var t=this.parent&&this._ts?R(this.parent._time,this):this._tTime,r=(this._rts=+e||0,this._ts=this._ps||e===-ke?0:this._rts,e=this.totalTime(V(-this._delay,this._tDur,t),!0)).parent;r&&r.parent;)r._dirty=1,r.totalDuration(),r=r.parent;At(this)}return this}},{key:"paused",value:function(e){return arguments.length?(this._ps!==e&&((this._ps=e)?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(Gt(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,1===this.progress()&&Math.abs(this._zTime)!==ke&&(this._tTime-=ke)))),this):this._ps}},{key:"startTime",value:function(e){var t;return arguments.length?(this._start=e,!(t=this.parent||this._dp)||!t._sort&&this.parent||k(t,this,e-this._delay),this):this._start}},{key:"endTime",value:function(e){return this._start+(Ke(e)?this.totalDuration():this.duration())/Math.abs(this._ts||1)}},{key:"rawTime",value:function(e){var t=this.parent||this._dp;return t?e&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?R(t.rawTime(e),this):this._tTime:this._tTime}},{key:"globalTime",value:function(e){for(var t=this,r=arguments.length?e:t.rawTime();t;)r=t._start+r/(t._ts||1),t=t._dp;return r}},{key:"repeat",value:function(e){return arguments.length?(this._repeat=e===1/0?-2:e,N(this)):-2===this._repeat?1/0:this._repeat}},{key:"repeatDelay",value:function(e){var t;return arguments.length?(t=this._time,this._rDelay=e,N(this),t?this.time(t):this):this._rDelay}},{key:"yoyo",value:function(e){return arguments.length?(this._yoyo=e,this):this._yoyo}},{key:"seek",value:function(e,t){return this.totalTime(H(this,e),Ke(t))}},{key:"restart",value:function(e,t){return this.play().totalTime(e?-this._delay:0,Ke(t))}},{key:"play",value:function(e,t){return null!=e&&this.seek(e,t),this.reversed(!1).paused(!1)}},{key:"reverse",value:function(e,t){return null!=e&&this.seek(e||this.totalDuration(),t),this.reversed(!0).paused(!1)}},{key:"pause",value:function(e,t){return null!=e&&this.seek(e,t),this.paused(!0)}},{key:"resume",value:function(){return this.paused(!1)}},{key:"reversed",value:function(e){return arguments.length?(!!e!==this.reversed()&&this.timeScale(-this._rts||(e?-ke:0)),this):this._rts<0}},{key:"invalidate",value:function(){return this._initted=this._act=0,this._zTime=-ke,this}},{key:"isActive",value:function(){var e=this.parent||this._dp,t=this._start;return!(e&&!(this._ts&&this._initted&&e.isActive()&&(e=e.rawTime(!0))>=t&&e<this.endTime(!0)-ke))}},{key:"eventCallback",value:function(e,t,r){var n=this.vars;return 1<arguments.length?(t?(n[e]=t,r&&(n[e+"Params"]=r),"onUpdate"===e&&(this._onUpdate=t)):delete n[e],this):n[e]}},{key:"then",value:function(e){var t=this;return new Promise((function(r){function n(){var e=t.then;t.then=null,ze(i)&&(i=i(t))&&(i.then||i===t)&&(t.then=e),r(i),t.then=e}var i=ze(e)?e:C;t._initted&&1===t.totalProgress()&&0<=t._ts||!t._tTime&&t._ts<0?n():t._prom=n}))}},{key:"kill",value:function(){$(this)}}]),e}(),ar=(gt(ir.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-ke,_prom:0,_ps:!1,_rts:1}),function(){i(t,ir);var e=o(t);function t(){var r,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},i=1<arguments.length?arguments[1]:void 0;return h(this,t),(r=e.call(this,n)).labels={},r.smoothChildTiming=!!n.smoothChildTiming,r.autoRemoveChildren=!!n.autoRemoveChildren,r._sort=Ke(n.sortChildren),le&&k(n.parent||le,s(r),i),n.reversed&&r.reverse(),n.paused&&r.paused(!0),n.scrollTrigger&&L(s(r),n.scrollTrigger),r}return c(t,[{key:"to",value:function(e,t,r){return z(0,arguments,this),this}},{key:"from",value:function(e,t,r){return z(1,arguments,this),this}},{key:"fromTo",value:function(e,t,r,n){return z(2,arguments,this),this}},{key:"set",value:function(e,t,r){return t.duration=0,t.parent=this,T(t).repeatDelay||(t.repeat=0),t.immediateRender=!!t.immediateRender,new hr(e,t,H(this,r),1),this}},{key:"call",value:function(e,t,r){return k(this,hr.delayedCall(0,e,t),r)}},{key:"staggerTo",value:function(e,t,r,n,i,a,o){return r.duration=t,r.stagger=r.stagger||n,r.onComplete=a,r.onCompleteParams=o,r.parent=this,new hr(e,r,H(this,i)),this}},{key:"staggerFrom",value:function(e,t,r,n,i,a,o){return r.runBackwards=1,T(r).immediateRender=Ke(r.immediateRender),this.staggerTo(e,t,r,n,i,a,o)}},{key:"staggerFromTo",value:function(e,t,r,n,i,a,o,s){return n.startAt=r,T(n).immediateRender=Ke(n.immediateRender),this.staggerTo(e,t,n,i,a,o,s)}},{key:"render",value:function(e,t,r){var n,i,a,o,s,l,u,c,h,d,p=this._time,f=this._dirty?this.totalDuration():this._tDur,m=this._dur,v=e<=0?0:mt(e),g=this._zTime<0!=e<0&&(this._initted||!m);if((v=this!==le&&f<v&&0<=e?f:v)!==this._tTime||r||g){if(p!==this._time&&m&&(v+=this._time-p,e+=this._time-p),n=v,c=this._start,s=!(u=this._ts),g&&(m||(p=this._zTime),!e&&t||(this._zTime=e)),this._repeat){if(g=this._yoyo,o=m+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*o+e,t,r);if(n=mt(v%o),v===f?(a=this._repeat,n=m):((a=~~(v/o))&&a===v/o&&(n=m,a--),m<n&&(n=m)),h=O(this._tTime,o),g&&1&a&&(n=m-n,d=1),a!==(h=!p&&this._tTime&&h!==a?a:h)&&!this._lock){var y=g&&1&h;if(g=y===(g&&1&a),p=(y=a<h?!y:y)?0:m,this._lock=1,this.render(p||(d?0:mt(a*o)),t,!m)._lock=0,this._tTime=v,!t&&this.parent&&q(this,"onRepeat"),this.vars.repeatRefresh&&!d&&(this.invalidate()._lock=1),p&&p!==this._time||s!=!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(m=this._dur,f=this._tDur,g&&(this._lock=2,this.render(p=y?m:-1e-4,!0),this.vars.repeatRefresh&&!d&&this.invalidate()),this._lock=0,!this._ts&&!s)return this;re(this,d)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(l=function(e,t,r){var n;if(t<r)for(n=e._first;n&&n._start<=r;){if("isPause"===n.data&&n._start>t)return n;n=n._next}else for(n=e._last;n&&n._start>=r;){if("isPause"===n.data&&n._start<t)return n;n=n._prev}}(this,mt(p),mt(n)))&&(v-=n-(n=l._start)),this._tTime=v,this._time=n,this._act=!u,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=e,p=0),!p&&n&&!t&&(q(this,"onStart"),this._tTime!==v))return this;if(p<=n&&0<=e)for(b=this._first;b;){if(i=b._next,(b._act||n>=b._start)&&b._ts&&l!==b){if(b.parent!==this)return this.render(e,t,r);if(b.render(0<b._ts?(n-b._start)*b._ts:(b._dirty?b.totalDuration():b._tDur)+(n-b._start)*b._ts,t,r),n!==this._time||!this._ts&&!s){l=0,i&&(v+=this._zTime=-ke);break}}b=i}else for(var b=this._last,x=e<0?e:n;b;){if(i=b._prev,(b._act||x<=b._end)&&b._ts&&l!==b){if(b.parent!==this)return this.render(e,t,r);if(b.render(0<b._ts?(x-b._start)*b._ts:(b._dirty?b.totalDuration():b._tDur)+(x-b._start)*b._ts,t,r),n!==this._time||!this._ts&&!s){l=0,i&&(v+=this._zTime=x?-ke:ke);break}}b=i}if(l&&!t&&(this.pause(),l.render(p<=n?0:-ke)._zTime=p<=n?1:-1,this._ts))return this._start=c,At(this),this.render(e,t,r);this._onUpdate&&!t&&q(this,"onUpdate",!0),!(v===f&&f>=this.totalDuration()||!v&&p)||c!==this._start&&Math.abs(u)===Math.abs(this._ts)||this._lock||(!e&&m||!(v===f&&0<this._ts||!v&&this._ts<0)||xt(this,1),t||e<0&&!p||!v&&!p&&f||(q(this,v===f&&0<=e?"onComplete":"onReverseComplete",!0),!this._prom||v<f&&0<this.timeScale()||this._prom()))}return this}},{key:"add",value:function(e,t){var r=this;if(Ve(t)||(t=H(this,t,e)),!(e instanceof ir)){if(Qe(e))return e.forEach((function(e){return r.add(e,t)})),this;if(He(e))return this.addLabel(e,t);if(!ze(e))return this;e=hr.delayedCall(0,e)}return this!==e?k(this,e,t):this}},{key:"getChildren",value:function(){for(var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],r=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:-Ie,i=[],a=this._first;a;)a._start>=n&&(a instanceof hr?t&&i.push(a):(r&&i.push(a),e&&i.push.apply(i,d(a.getChildren(!0,t,r))))),a=a._next;return i}},{key:"getById",value:function(e){for(var t=this.getChildren(1,1,1),r=t.length;r--;)if(t[r].vars.id===e)return t[r]}},{key:"remove",value:function(e){return He(e)?this.removeLabel(e):ze(e)?this.killTweensOf(e):(bt(this,e),e===this._recent&&(this._recent=this._last),wt(this))}},{key:"totalTime",value:function(e,r){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=mt(Ut.time-(0<this._ts?e/this._ts:(this.totalDuration()-e)/-this._ts))),n(l(t.prototype),"totalTime",this).call(this,e,r),this._forcing=0,this):this._tTime}},{key:"addLabel",value:function(e,t){return this.labels[e]=H(this,t),this}},{key:"removeLabel",value:function(e){return delete this.labels[e],this}},{key:"addPause",value:function(e,t,r){return(t=hr.delayedCall(0,t||w,r)).data="isPause",this._hasPause=1,k(this,t,H(this,e))}},{key:"removePause",value:function(e){var t=this._first;for(e=H(this,e);t;)t._start===e&&"isPause"===t.data&&xt(t),t=t._next}},{key:"killTweensOf",value:function(e,t,r){for(var n=this.getTweensOf(e,r),i=n.length;i--;)rr!==n[i]&&n[i].kill(e,t);return this}},{key:"getTweensOf",value:function(e,t){for(var r,n=[],i=Tt(e),a=this._first,o=Ve(t);a;)a instanceof hr?function(e,t){for(var r=t.length,n=0;e.indexOf(t[n])<0&&++n<r;);return n<r}(a._targets,i)&&(o?(!rr||a._initted&&a._ts)&&a.globalTime(0)<=t&&a.globalTime(a.totalDuration())>t:!t||a.isActive())&&n.push(a):(r=a.getTweensOf(i,t)).length&&n.push.apply(n,d(r)),a=a._next;return n}},{key:"tweenTo",value:function(e,t){t=t||{};var r,n=this,i=H(n,e),a=(e=t).startAt,o=e.onStart,s=e.onStartParams,l=(e=e.immediateRender,hr.to(n,gt({ease:t.ease||"none",lazy:!1,immediateRender:!1,time:i,overwrite:"auto",duration:t.duration||Math.abs((i-(a&&"time"in a?a.time:n._time))/n.timeScale())||ke,onStart:function(){var e;n.pause(),r||(e=t.duration||Math.abs((i-(a&&"time"in a?a.time:n._time))/n.timeScale()),l._dur!==e&&j(l,e,0,1).render(l._time,!0,!0),r=1),o&&o.apply(l,s||[])}},t)));return e?l.render(0):l}},{key:"tweenFromTo",value:function(e,t,r){return this.tweenTo(t,gt({startAt:{time:H(this,e)}},r))}},{key:"recent",value:function(){return this._recent}},{key:"nextLabel",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._time;return Y(this,H(this,e))}},{key:"previousLabel",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._time;return Y(this,H(this,e),1)}},{key:"currentLabel",value:function(e){return arguments.length?this.seek(e,!0):this.previousLabel(this._time+ke)}},{key:"shiftChildren",value:function(e,t){for(var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=this._first,a=this.labels;i;)i._start>=n&&(i._start+=e,i._end+=e),i=i._next;if(t)for(r in a)a[r]>=n&&(a[r]+=e);return wt(this)}},{key:"invalidate",value:function(){var e=this._first;for(this._lock=0;e;)e.invalidate(),e=e._next;return n(l(t.prototype),"invalidate",this).call(this)}},{key:"clear",value:function(){for(var e,t=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],r=this._first;r;)e=r._next,this.remove(r),r=e;return this._dp&&(this._time=this._tTime=this._pTime=0),t&&(this.labels={}),wt(this)}},{key:"totalDuration",value:function(e){var t,r,n,i=0,a=this,o=a._last,s=Ie;if(arguments.length)return a.timeScale((a._repeat<0?a.duration():a.totalDuration())/(a.reversed()?-e:e));if(a._dirty){for(n=a.parent;o;)t=o._prev,o._dirty&&o.totalDuration(),(r=o._start)>s&&a._sort&&o._ts&&!a._lock?(a._lock=1,k(a,o,r-o._delay,1)._lock=0):s=r,r<0&&o._ts&&(i-=r,(!n&&!a._dp||n&&n.smoothChildTiming)&&(a._start+=r/a._ts,a._time-=r,a._tTime-=r),a.shiftChildren(-r,!1,-1/0),s=0),o._end>i&&o._ts&&(i=o._end),o=t;j(a,a===le&&a._time>i?a._time:i,1,1),a._dirty=0}return a._tDur}}],[{key:"updateRoot",value:function(e){if(le._ts&&(M(le,R(e,le)),pe=Ut.frame),Ut.frame>=ct){ct+=Oe.autoSleep||120;var t=le._first;if((!t||!t._ts)&&Oe.autoSleep&&Ut._listeners.length<2){for(;t&&!t._ts;)t=t._next;t||Ut.sleep()}}}}]),t}()),or=(gt(ar.prototype,{_lock:0,_hasPause:0,_forcing:0}),function(e,t,r,n,i,a,o){var s,l,u,c,h,d=new br(this._pt,e,t,0,1,Zt,null,i),p=0,f=0;for(d.b=r,d.e=n,r+="",(i=~(n+="").indexOf("random("))&&(n=Pt(n)),a&&(a(a=[r,n],e,t),r=a[0],n=a[1]),s=r.match(qe)||[];c=qe.exec(n);)u=c[0],c=n.substring(p,c.index),l?l=(l+1)%5:"rgba("===c.substr(-5)&&(l=1),u!==s[f++]&&(h=parseFloat(s[f-1])||0,d._pt={_next:d._pt,p:c||1===f?c:",",s:h,c:"="===u.charAt(1)?parseFloat(u.substr(2))*("-"===u.charAt(0)?-1:1):parseFloat(u)-h,m:l&&l<4?Math.round:0},p=qe.lastIndex);return d.c=p<n.length?n.substring(p,n.length):"",d.fp=o,($e.test(n)||i)&&(d.e=0),this._pt=d}),sr=function(e,t,r,n,i,a,o,s,l){var u;if(ze(n)&&(n=n(i||0,e,a)),i=e[t],a="get"!==r?r:ze(i)?l?e[t.indexOf("set")||!ze(e["get"+t.substr(3)])?t:"get"+t.substr(3)](l):e[t]():i,r=ze(i)?l?fr:pr:dr,He(n)&&"="===(n=~n.indexOf("random(")?Pt(n):n).charAt(1)&&(!(u=parseFloat(a)+parseFloat(n.substr(2))*("-"===n.charAt(0)?-1:1)+(Ct(a)||0))&&0!==u||(n=u)),a!==n)return isNaN(a*n)||""===n?(i||t in e||it(t,n),or.call(this,e,t,a,n,r,s||Oe.stringFilter,l)):(u=new br(this._pt,e,t,+a||0,n-(a||0),"boolean"==typeof i?gr:vr,0,r),l&&(u.fp=l),o&&u.modifier(o,this,e),this._pt=u)},lr=function(e,t,r,n,i,a){var o,s,l,u;if(lt[e]&&!1!==(o=new lt[e]).init(i,o.rawVars?t[e]:function(e,t,r,n,i){if(ze(e)&&(e=Qt(e,i,t,r,n)),!Je(e)||e.style&&e.nodeType||Qe(e)||We(e))return He(e)?Qt(e,i,t,r,n):e;var a,o={};for(a in e)o[a]=Qt(e[a],i,t,r,n);return o}(t[e],n,i,a,r),r,n,a)&&(r._pt=s=new br(r._pt,i,e,0,1,o.render,o,0,o.priority),r!==fe))for(l=r._ptLookup[r._targets.indexOf(i)],u=o._props.length;u--;)l[o._props[u]]=s;return o},ur=dt+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase",cr={},hr=(S(ur+",id,stagger,delay,duration,paused,scrollTrigger",(function(e){return cr[e]=1})),function(){i(t,ir);var e=o(t);function t(r,n,i,a){h(this,t),"number"==typeof n&&(i.duration=n,n=i,i=null);var o,l,u,c,d,p,f,m,v,y=(a=(o=e.call(this,a?n:T(n))).vars).duration,x=a.delay,w=a.immediateRender,A=a.stagger,S=a.overwrite,M=a.keyframes,B=a.defaults,C=a.scrollTrigger,E=a.yoyoEase,P=(a=n.parent||le,(Qe(r)||We(r)?Ve(r[0]):"length"in n)?[r]:Tt(r));if(o._targets=P.length?pt(P):b("GSAP target "+r+" not found. https://greensock.com",!Oe.nullTargetWarn)||[],o._ptLookup=[],o._overwrite=S,M||A||g(y)||g(x)){if(n=o.vars,(l=o.timeline=new ar({data:"nested",defaults:B||{}})).kill(),l.parent=l._dp=s(o),l._start=0,A||g(y)||g(x)){if(d=P.length,m=A&&J(A),Je(A))for(p in A)~ur.indexOf(p)&&((v=v||{})[p]=A[p]);for(u=0;u<d;u++)(c=yt(n,cr)).stagger=0,E&&(c.yoyoEase=E),v&&_(c,v),f=P[u],c.duration=+Qt(y,s(o),u,f,P),c.delay=(+Qt(x,s(o),u,f,P)||0)-o._delay,!A&&1===d&&c.delay&&(o._delay=x=c.delay,o._start+=x,c.delay=0),l.to(f,c,m?m(u,f,P):0),l._ease=jt.none;l.duration()?y=x=0:o.timeline=0}else if(M){T(gt(l.vars.defaults,{ease:"none"})),l._ease=Vt(M.ease||n.ease||"none");var O,R,I,F=0;if(Qe(M))M.forEach((function(e){return l.to(P,e,">")}));else{for(p in c={},M)"ease"!==p&&"easeEach"!==p&&function(e,t,r,n){var i,a,o=t.ease||n||"power1.inOut";if(Qe(t))a=r[e]||(r[e]=[]),t.forEach((function(e,r){return a.push({t:r/(t.length-1)*100,v:e,e:o})}));else for(i in t)a=r[i]||(r[i]=[]),"ease"!==i&&a.push({t:parseFloat(e),v:t[i],e:o})}(p,M[p],c,M.easeEach);for(p in c)for(O=c[p].sort((function(e,t){return e.t-t.t})),u=F=0;u<O.length;u++)(I={ease:(R=O[u]).e,duration:(R.t-(u?O[u-1].t:0))/100*y})[p]=R.v,l.to(P,I,F),F+=I.duration;l.duration()<y&&l.to({},{duration:y-l.duration()})}}y||o.duration(y=l.duration())}else o.timeline=0;return!0!==S||se||(rr=s(o),le.killTweensOf(P),rr=0),k(a,s(o),i),n.reversed&&o.reverse(),n.paused&&o.paused(!0),(w||!y&&!M&&o._start===mt(a._time)&&Ke(w)&&D(s(o))&&"nested"!==a.data)&&(o._tTime=-ke,o.render(Math.max(0,-x))),C&&L(s(o),C),o}return c(t,[{key:"render",value:function(e,t,r){var n,i,a=this._time,o=this._tDur,s=this._dur,l=o-ke<e&&0<=e?o:e<ke?0:e;if(s){if(l!==this._tTime||!e||r||!this._initted&&this._tTime||this._startAt&&this._zTime<0!=e<0){if(m=l,f=this.timeline,this._repeat){if(h=s+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*h+e,t,r);if(m=mt(l%h),l===o?(g=this._repeat,m=s):((g=~~(l/h))&&g===l/h&&(m=s,g--),s<m&&(m=s)),(p=this._yoyo&&1&g)&&(d=this._yEase,m=s-m),y=O(this._tTime,h),m===a&&!r&&this._initted)return this;g!==y&&(f&&this._yEase&&re(f,p),!this.vars.repeatRefresh||p||this._lock||(this._lock=r=1,this.render(mt(h*g),!0).invalidate()._lock=0))}if(!this._initted){if(F(this,e<0?e:m,r,t))return this._tTime=0,this;if(s!==this._dur)return this.render(e,t,r)}if(this._tTime=l,this._time=m,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=i=(d||this._ease)(m/s),this._from&&(this.ratio=i=1-i),m&&!a&&!t&&(q(this,"onStart"),this._tTime!==l))return this;for(n=this._pt;n;)n.r(i,n.d),n=n._next;f&&f.render(e<0?e:!m&&p?-ke:f._dur*f._ease(m/this._dur),t,r)||this._startAt&&(this._zTime=e),this._onUpdate&&!t&&(e<0&&this._startAt&&this._startAt.render(e,!0,r),q(this,"onUpdate")),this._repeat&&g!==y&&this.vars.onRepeat&&!t&&this.parent&&q(this,"onRepeat"),l!==this._tDur&&l||this._tTime!==l||(e<0&&this._startAt&&!this._onUpdate&&this._startAt.render(e,!0,!0),!e&&s||!(l===this._tDur&&0<this._ts||!l&&this._ts<0)||xt(this,1),t||e<0&&!a||!l&&!a||(q(this,l===o?"onComplete":"onReverseComplete",!0),!this._prom||l<o&&0<this.timeScale()||this._prom()))}}else{var u,c,h=this,d=e,p=t,f=r,m=h.ratio,v=d<0||!d&&(!h._start&&U(h)&&(h._initted||!G(h))||(h._ts<0||h._dp._ts<0)&&!G(h))?0:1,g=h._rDelay,y=0;if(g&&h._repeat&&(c=O(y=V(0,h._tDur,d),g),h._yoyo&&1&c&&(v=1-v),c!==O(h._tTime,g)&&(m=1-v,h.vars.repeatRefresh&&h._initted&&h.invalidate())),v!==m||f||h._zTime===ke||!d&&h._zTime){if(h._initted||!F(h,d,f,p)){for(c=h._zTime,h._zTime=d||(p?ke:0),p=p||d&&!c,h.ratio=v,h._from&&(v=1-v),h._time=0,h._tTime=y,u=h._pt;u;)u.r(v,u.d),u=u._next;h._startAt&&d<0&&h._startAt.render(d,!0,!0),h._onUpdate&&!p&&q(h,"onUpdate"),y&&h._repeat&&!p&&h.parent&&q(h,"onRepeat"),(d>=h._tDur||d<0)&&h.ratio===v&&(v&&xt(h,1),p||(q(h,v?"onComplete":"onReverseComplete",!0),h._prom&&h._prom()))}}else h._zTime||(h._zTime=d)}return this}},{key:"targets",value:function(){return this._targets}},{key:"invalidate",value:function(){return this._pt=this._op=this._startAt=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(),n(l(t.prototype),"invalidate",this).call(this)}},{key:"kill",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"all";if(!(e||t&&"all"!==t))return this._lazy=this._pt=0,this.parent?$(this):this;if(this.timeline)d=this.timeline.totalDuration(),this.timeline.killTweensOf(e,t,rr&&!0!==rr.vars.overwrite)._first||$(this),this.parent&&d!==this.timeline.totalDuration()&&j(this,this._dur*this.timeline._tDur/d,0,1);else{var r,n,i,a,o,s,l,u=this._targets,c=e?Tt(e):u,h=this._ptLookup,d=this._pt;if((!t||"all"===t)&&function(e,t){for(var r=e.length,n=r===t.length;n&&r--&&e[r]===t[r];);return r<0}(u,c))return"all"===t&&(this._pt=0),$(this);for(r=this._op=this._op||[],"all"!==t&&(He(t)&&(o={},S(t,(function(e){return o[e]=1})),t=o),t=function(e,t){var r,n,i,a,o=(e=e[0]?ft(e[0]).harness:0)&&e.aliases;if(!o)return t;for(n in r=_({},t),o)if(n in r)for(i=(a=o[n].split(",")).length;i--;)r[a[i]]=r[n];return r}(u,t)),l=u.length;l--;)if(~c.indexOf(u[l]))for(o in n=h[l],"all"===t?(r[l]=t,a=n,i={}):(i=r[l]=r[l]||{},a=t),a)(s=n&&n[o])&&("kill"in s.d&&!0!==s.d.kill(o)||bt(this,s,"_pt"),delete n[o]),"all"!==i&&(i[o]=1);this._initted&&!this._pt&&d&&$(this)}return this}}],[{key:"to",value:function(e,r){return new t(e,r,arguments[2])}},{key:"from",value:function(e,t){return z(1,arguments)}},{key:"delayedCall",value:function(e,r,n,i){return new t(r,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:e,onComplete:r,onReverseComplete:r,onCompleteParams:n,onReverseCompleteParams:n,callbackScope:i})}},{key:"fromTo",value:function(e,t,r){return z(2,arguments)}},{key:"set",value:function(e,r){return r.duration=0,r.repeatDelay||(r.repeat=0),new t(e,r)}},{key:"killTweensOf",value:function(e,t,r){return le.killTweensOf(e,t,r)}}]),t}()),dr=(gt(hr.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),S("staggerTo,staggerFrom,staggerFromTo",(function(e){hr[e]=function(){var t=new ar,r=_t.call(arguments,0);return r.splice("staggerFromTo"===e?5:4,0,0),t[e].apply(t,r)}})),function(e,t,r){return e[t]=r}),pr=function(e,t,r){return e[t](r)},fr=function(e,t,r,n){return e[t](n.fp,r)},mr=function(e,t){return ze(e[t])?pr:m(e[t])&&e.setAttribute?Xt:dr},vr=function(e,t){return t.set(t.t,t.p,Math.round(1e6*(t.s+t.c*e))/1e6,t)},gr=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},yr=function(e){for(var t,r,n,i,a=e._pt;a;){for(t=a._next,r=n;r&&r.pr>a.pr;)r=r._next;(a._prev=r?r._prev:i)?a._prev._next=a:n=a,(a._next=r)?r._prev=a:i=a,a=t}e._pt=n},br=function(){function e(t,r,n,i,a,o,s,l,u){h(this,e),this.t=r,this.s=i,this.c=a,this.p=n,this.r=o||vr,this.d=s||this,this.set=l||dr,this.pr=u||0,(this._next=t)&&(t._prev=this)}return c(e,[{key:"modifier",value:function(e,t,r){this.mSet=this.mSet||this.set,this.set=er,this.m=e,this.mt=r,this.tween=t}}]),e}(),xr=(S(dt+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",(function(e){return at[e]=1})),rt.TweenMax=rt.TweenLite=hr,rt.TimelineLite=rt.TimelineMax=ar,le=new ar({sortChildren:!1,defaults:Re,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Oe.stringFilter=function(e){var t=e.join(" ");if(Lt.lastIndex=0,Lt.test(t))return t=Ft.test(t),e[1]=te(e[1],t),e[0]=te(e[0],t,kt(e[1])),!0},{registerPlugin:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.forEach((function(e){var t=(e=!e.name&&e.default||e).name,r=ze(e),n=(r=t&&!r&&e.init?function(){this._props=[]}:e,{init:w,render:Yt,add:sr,kill:$t,modifier:qt,rawVars:0}),i={targetTest:0,get:0,getSetter:mr,aliases:{},register:0};if(Gt(),e!==r){if(lt[t])return;gt(r,gt(yt(e,n),i)),_(r.prototype,_(n,yt(e,i))),lt[r.prop=t]=r,e.targetTest&&(ht.push(r),at[t]=1),t=("css"===t?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}x(t,r),e.register&&e.register(Ar,r,br)}))},timeline:function(e){return new ar(e)},getTweensOf:function(e,t){return le.getTweensOf(e,t)},getProperty:function(e,t,r,n){He(e)&&(e=Tt(e)[0]);var i=ft(e||{}).get,a=r?C:B;return"native"===r&&(r=""),e&&(t?a((lt[t]&&lt[t].get||i)(e,t,r,n)):function(t,r,n){return a((lt[t]&&lt[t].get||i)(e,t,r,n))})},quickSetter:function(e,t,r){var n,i;if(1<(e=Tt(e)).length)return n=e.map((function(e){return Ar.quickSetter(e,t,r)})),i=n.length,function(e){for(var t=i;t--;)n[t](e)};e=e[0]||{};var a=lt[t],o=ft(e),s=o.harness&&(o.harness.aliases||{})[t]||t,l=a?function(t){var n=new a;fe._pt=0,n.init(e,r?t+r:t,fe,0,[e]),n.render(1,n),fe._pt&&Yt(1,fe)}:o.set(e,s);return a?l:function(t){return l(e,s,r?t+r:t,o,1)}},isTweening:function(e){return 0<le.getTweensOf(e,!0).length},defaults:function(e){return e&&e.ease&&(e.ease=Vt(e.ease,Re.ease)),E(Re,e||{})},config:function(e){return E(Oe,e||{})},registerEffect:function(e){var t=e.name,r=e.effect,n=e.plugins,i=e.defaults;e=e.extendTimeline,(n||"").split(",").forEach((function(e){return e&&!lt[e]&&!rt[e]&&b(t+" effect requires "+e+" plugin.")})),ut[t]=function(e,t,n){return r(Tt(e),gt(t||{},i),n)},e&&(ar.prototype[t]=function(e,r,n){return this.add(ut[t](e,Je(r)?r:(n=r)&&{},this),n)})},registerEase:function(e,t){jt[e]=Vt(t)},parseEase:function(e,t){return arguments.length?Vt(e,t):jt},getById:function(e){return le.getById(e)},exportRoot:function(){var e,t,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length?arguments[1]:void 0,i=new ar(r);for(i.smoothChildTiming=Ke(r.smoothChildTiming),le.remove(i),i._dp=0,i._time=i._tTime=le._time,e=le._first;e;)t=e._next,!n&&!e._dur&&e instanceof hr&&e.vars.onComplete===e._targets[0]||k(i,e,e._start-e._delay),e=t;return k(le,i,0),i},utils:{wrap:function e(t,r,n){var i=r-t;return Qe(t)?X(t,e(0,t.length),r):Bt(n,(function(e){return(i+(e-t)%i)%i+t}))},wrapYoyo:function e(t,r,n){var i=r-t,a=2*i;return Qe(t)?X(t,e(0,t.length-1),r):Bt(n,(function(e){return t+(i<(e=(a+(e-t)%a)%a||0)?a-e:e)}))},distribute:J,random:Q,snap:W,normalize:function(e,t,r){return Z(e,t,0,1,r)},getUnit:Ct,clamp:function(e,t,r){return Bt(r,(function(r){return V(e,t,r)}))},splitColor:It,toArray:Tt,selector:function(e){return e=Tt(e)[0]||b("Invalid scope")||{},function(t){var r=e.current||e.nativeElement||e;return Tt(t,r.querySelectorAll?r:r===e?b("Invalid scope")||he.createElement("div"):e)}},mapRange:Z,pipe:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e){return t.reduce((function(e,t){return t(e)}),e)}},unitize:function(e,t){return function(r){return e(parseFloat(r))+(t||Ct(r))}},interpolate:function e(t,r,n,i){var a=isNaN(t+r)?0:function(e){return(1-e)*t+e*r};if(!a){var o,s,l,u,c,h=He(t),d={};if(!0===n&&(i=1)&&(n=null),h)t={p:t},r={p:r};else if(Qe(t)&&!Qe(r)){for(l=[],u=t.length,c=u-2,s=1;s<u;s++)l.push(e(t[s-1],t[s]));u--,a=function(e){e*=u;var t=Math.min(c,~~e);return l[t](e-t)},n=r}else i||(t=_(Qe(t)?[]:{},t));if(!l){for(o in r)sr.call(d,t,o,"get",r[o]);a=function(e){return Yt(e,d),h?t.p:t}}}return Bt(n,a)},shuffle:Dt},install:y,effects:ut,ticker:Ut,updateRoot:ar.updateRoot,plugins:lt,globalTimeline:le,core:{PropTween:br,globals:x,Tween:hr,Timeline:ar,Animation:ir,getCache:ft,_removeLinkedListItem:bt,suppressOverwrites:function(e){return se=e}}}),wr=(S("to,from,fromTo,delayedCall,set,killTweensOf",(function(e){return xr[e]=hr[e]})),Ut.add(ar.updateRoot),fe=xr.to({},{duration:0}),function(e,t){for(var r=e._pt;r&&r.p!==t&&r.op!==t&&r.fp!==t;)r=r._next;return r}),Ar=xr.registerPlugin({name:"attr",init:function(e,t,r,n,i){var a,o;for(a in t)(o=this.add(e,"setAttribute",(e.getAttribute(a)||0)+"",t[a],n,i,0,0,a))&&(o.op=a),this._props.push(a)}},{name:"endArray",init:function(e,t){for(var r=t.length;r--;)this.add(e,r,e[r]||0,t[r])}},tr("roundProps",K),tr("modifiers"),tr("snap",W))||xr;hr.version=ar.version=Ar.version="3.9.1",de=1,v()&&Gt(),jt.Power0,jt.Power1,jt.Power2,jt.Power3,jt.Power4,jt.Linear,jt.Quad,jt.Cubic,jt.Quart,jt.Quint,jt.Strong,jt.Elastic,jt.Back,jt.SteppedEase,jt.Bounce,jt.Sine,jt.Expo,jt.Circ},3685:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},i=(Object.defineProperty(t,"__esModule",{value:!0}),t.downloadFile=t.getFileName=t.urlToBase64=t.toResult=t.getPrefixWord=t.getBackWord=t.bToMB=t.arrayBufferToStr=t.strToArrayBuffer=t.toUrl=t.blobToDataUrl=t.bufferToArrayBuffer=t.base64ToFile=void 0,n(r(3300)));t.base64ToFile=function(e,t){for(var r=(e=e.split(","))[0].match(/:(.*?);/)[1],n=atob(e[1]),i=n.length,a=new Uint8Array(i);i--;)a[i]=n.charCodeAt(i);return new File([a],t,{type:r})},t.bufferToArrayBuffer=function(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n<e.length;++n)r[n]=e[n];return t},t.blobToDataUrl=function(e){return i.default.get(e,{baseURL:"",responseType:"blob",timeout:5e3}).then((function(e){return(0,t.toResult)(e.data)})).catch((function(e){return!1}))},t.toUrl=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"any.json";return e=e instanceof File?e:(e=JSON.stringify(e),new File([e],t)),window.URL.createObjectURL(e)},t.strToArrayBuffer=function(e){for(var t="",r=0;r<e.length;r++)""===t?t=e.charCodeAt(r).toString(16):t+=","+e.charCodeAt(r).toString(16);return new Uint8Array(t.match(/[\da-f]{2}/gi).map((function(e){return parseInt(e,16)}))).buffer},t.arrayBufferToStr=function(e){return new Promise((function(t){var r=new Blob([e]),n=new FileReader;n.readAsText(r,"utf-8"),n.onload=function(){t(n.result)}}))},t.bToMB=function(e){return e=e/1024/1024,1<arguments.length&&void 0!==arguments[1]&&arguments[1]?e:e.toFixed(2)+"MB"},t.getBackWord=function(e){return e.substr(e.lastIndexOf(".")+1).toLowerCase()},t.getPrefixWord=function(e){return e.substr(0,e.lastIndexOf("."))},t.toResult=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"text",r=new FileReader;return"text"===t?r.readAsText(e):"arrayBuffer"===t?r.readAsArrayBuffer(e):"base64"===t&&r.readAsDataURL(e),new Promise((function(e){r.onload=function(t){return e(t.target.result)}}))},t.urlToBase64=function(e){return i.default.get(e,{responseType:"arraybuffer"}).then((function(e){var t=e.headers["content-type"];return e=new Buffer(e.data,"binary").toString("base64"),"data:".concat(t,";base64,")+e}))},t.getFileName=function(e){return e.substring(e.lastIndexOf("-")+1)},t.downloadFile=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"any.text",r=document.createElement("a");e instanceof File||e instanceof Blob?r.setAttribute("href",window.URL.createObjectURL(e)):r.setAttribute("href",e),r.setAttribute("download",t),document.body.insertAdjacentElement("beforeend",r),r.click(),r.remove()}},4298:function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(){i=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,a=(m="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",o=m.asyncIterator||"@@asyncIterator",s=m.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(t){l=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var i,a,o,s;return t=t&&t.prototype instanceof d?t:d,t=Object.create(t.prototype),n=new A(n||[]),t._invoke=(i=e,a=r,o=n,s="suspendedStart",function(e,t){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===e)throw t;return{value:void 0,done:!0}}for(o.method=e,o.arg=t;;){var r=o.delegate;if(r&&(r=function e(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,e(t,r),"throw"===r.method))return h;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}return"throw"===(n=c(n,t.iterator,r.arg)).type?(r.method="throw",r.arg=n.arg,r.delegate=null,h):(n=n.arg)?n.done?(r[t.resultName]=n.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,h):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,h)}(r,o),r)){if(r===h)continue;return r}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if("suspendedStart"===s)throw s="completed",o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);if(s="executing","normal"===(r=c(i,a,o)).type){if(s=o.done?"completed":"suspendedYield",r.arg===h)continue;return{value:r.arg,done:o.done}}"throw"===r.type&&(s="completed",o.method="throw",o.arg=r.arg)}}),t}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var h={};function d(){}function p(){}function f(){}var m,v,g=(l(m={},a,(function(){return this})),(v=(v=Object.getPrototypeOf)&&v(v(S([]))))&&v!==t&&r.call(v,a)&&(m=v),f.prototype=d.prototype=Object.create(m));function y(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){var i;this._invoke=function(a,o){function s(){return new t((function(i,s){!function i(a,o,s,l){var u;if("throw"!==(a=c(e[a],e,o)).type)return(o=(u=a.arg).value)&&"object"==n(o)&&r.call(o,"__await")?t.resolve(o.__await).then((function(e){i("next",e,s,l)}),(function(e){i("throw",e,s,l)})):t.resolve(o).then((function(e){u.value=e,s(u)}),(function(e){return i("throw",e,s,l)}));l(a.arg)}(a,o,i,s)}))}return i=i?i.then(s,s):s()}}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function S(e){if(e){var t,n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(n=function n(){for(;++t<e.length;)if(r.call(e,t))return n.value=e[t],n.done=!1,n;return n.value=void 0,n.done=!0,n}).next=n}return{next:M}}function M(){return{value:void 0,done:!0}}return l(g,"constructor",p.prototype=f),l(f,"constructor",p),p.displayName=l(f,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){return!!(e="function"==typeof e&&e.constructor)&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,l(e,s,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},y(b.prototype),l(b.prototype,o,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var o=new b(u(t,r,n,i),a);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},y(g),l(g,s,"Generator"),l(g,a,(function(){return this})),l(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,r=[];for(t in e)r.push(t);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=S,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(w),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return o.type="throw",o.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;0<=i;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}var o=(a=a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc?null:a)?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,h):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),w(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,i=this.tryEntries[t];if(i.tryLoc===e)return"throw"===(r=i.completion).type&&(n=r.arg,w(i)),n}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:S(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},e}function a(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){var r;if(e)return"string"==typeof e?o(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var s=this&&this.__awaiter||function(e,t,r,n){return new(r=r||Promise)((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(o,s)}l((n=n.apply(e,t||[])).next())}))},l=(Object.defineProperty(t,"__esModule",{value:!0}),t.deepArrByMaps=t.map=t.multiArrToArr=t.eachTriggerArray=t.eachTriggerArrGetControls=t.emptyArray=t.delArrEle=t.lastArrayEle=void 0,r(3185));function u(e,t,r,n){return s(void 0,void 0,void 0,i().mark((function a(){var o,s,l;return i().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(o=e[t++]){i.next=3;break}return i.abrupt("return",r());case 3:if((s=o())instanceof Promise)return i.next=7,s;i.next=11;break;case 7:l=i.sent,null!=n&&n.eachCb(l,t),i.next=18;break;case 11:if(s.promise&&s.promise instanceof Promise)return null!=n&&n.eachCb(s,t),i.next=15,s.promise;i.next=17;break;case 15:i.next=18;break;case 17:null!=n&&n.eachCb(s,t);case 18:u(e,t,r,n);case 19:case"end":return i.stop()}}),a)})))}function c(e,t){e.map((function(e){if("array"===(0,l.getType)(e))return c(e,t);t.push(e)}))}t.lastArrayEle=function(e){return e.slice(-1)[0]},t.delArrEle=function(e,t){var r=e.slice(0,t);return e=e.slice(t+1),[].concat(a(r),a(e))},t.emptyArray=function(e){return 0===e.length},t.eachTriggerArrGetControls=function(e){var r=new Proxy({run:!0,clean:!1,target:e,index:0,runningAnima:null,eachCb:function(e,t){e.anima&&(r.runningAnima=e.anima),r.index=t}},{set:function(e,t,n){return"clean"===t&&!0===n&&!1===e[t]&&(r.run=!1,r.target.splice(0)),"run"===t&&!1===n&&!0===e[t]&&(console.log(r,"controls"),r.runningAnima&&r.runningAnima.pause()),"run"===t&&!0===n&&!1===e[t]&&r.runningAnima&&r.runningAnima.resume(),e[t]=n,!0}});return e=(0,t.eachTriggerArray)(e,r),{controls:r,promise:e}},t.eachTriggerArray=function(e,t){return new Promise((function(r){return u(e,0,r,t)}))},t.multiArrToArr=function(e){var t=[];return c(e,t),t},t.map=function(e,t){return e.map((function(r,n){return t(r,n,e)})).filter((function(e){return e}))},t.deepArrByMaps=function(e){var r,n,i=e.arr,o=e.typeList,s=e.findType;return e=e.mapType,i&&o&&s&&(r=a(o),n=i.find((function(e){return e[s]===o[0]})))?1!==o.length&&n[e]instanceof Array?(r.shift(),(0,t.deepArrByMaps)({arr:n[e],typeList:r,findType:s,mapType:e})):n:i}},9594:(e,t,r)=>{"use strict";t.qR=t.js=t.CV=void 0,r(3185),t.CV=function(e){return 0===Object.values(e).length},t.js=function(e,t){return Object.keys(e).map((function(r,n){var i=e[r];return t(r,i,n)}))},t.qR=function(e,t){var r=-1;return function e(n){return r++,t.length===r+1?n:e(n[t[r]])}(e)}},9251:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},i=(Object.defineProperty(t,"__esModule",{value:!0}),t.getId=t.getMacro=t.getUuid=void 0,n(r(7937))),a=n(r(181));t.getUuid=function(){return i.default.UUID1()},t.getMacro=function(e){var t=setTimeout((function(){return clearTimeout(t),t=null,e()}),1<arguments.length&&void 0!==arguments[1]?arguments[1]:0)},t.getId=function(){return(0,a.default)()}},3185:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isTrue=t.getType=void 0,t.getType=function(e){if(void 0!==e){if(null===e)return null;var t;switch(e.constructor){case Array:t="Array";break;case Object:t="Object";break;case String:t="String";break;case Number:t="Number";break;case Boolean:t="Boolean";break;case Function:t="Function"}return t&&t.toLowerCase()||"Object"}},t.isTrue=function(e){return!(null==e||!1===e)}},4326:e=>{e.exports=function(e,t,r){for(var n=(2<<Math.log(t.length-1)/Math.LN2)-1,i=-~(1.6*n*r/t.length),a="";;)for(var o=e(i),s=i;s--;)if((a+=t[o[s]&n]||"").length===+r)return a}},181:(e,t,r)=>{"use strict";e.exports=r(1882)},488:(e,t,r)=>{"use strict";var n,i,a,o=r(87),s="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";function l(){a=!1}function u(e){if(e){if(e!==n){if(e.length!==s.length)throw new Error("Custom alphabet for shortid must be "+s.length+" unique characters. You submitted "+e.length+" characters: "+e);var t=e.split("").filter((function(e,t,r){return t!==r.lastIndexOf(e)}));if(t.length)throw new Error("Custom alphabet for shortid must be "+s.length+" unique characters. These characters were not unique: "+t.join(", "));n=e,l()}}else n!==s&&(n=s,l())}function c(){return a=a||function(){n||u(s);var e,t=n.split(""),r=[];for(o.nextValue();0<t.length;)e=o.nextValue(),e=Math.floor(e*t.length),r.push(t.splice(e,1)[0]);return r.join("")}()}e.exports={get:function(){return n||s},characters:function(e){return u(e),n},seed:function(e){o.seed(e),i!==e&&(l(),i=e)},lookup:function(e){return c()[e]},shuffled:c}},6239:(e,t,r)=>{"use strict";var n,i,a=r(5253);r(488),e.exports=function(e){var t="",r=Math.floor(.001*(Date.now()-1567752802062));return r===i?n++:(n=0,i=r),t=(t+=a(7))+a(e),0<n&&(t+=a(n)),t+a(r)}},5253:(e,t,r)=>{"use strict";var n=r(488),i=r(2019),a=r(4326);e.exports=function(e){for(var t,r=0,o="";!t;)o+=a(i,n.get(),1),t=e<Math.pow(16,r+1),r++;return o}},1882:(e,t,r)=>{"use strict";var n=r(488),i=r(6239),a=r(2040),o=r(3595)||0;function s(){return i(o)}e.exports=s,e.exports.generate=s,e.exports.seed=function(t){return n.seed(t),e.exports},e.exports.worker=function(t){return o=t,e.exports},e.exports.characters=function(e){return void 0!==e&&n.characters(e),n.shuffled()},e.exports.isValid=a},2040:(e,t,r)=>{"use strict";var n=r(488);e.exports=function(e){return!(!e||"string"!=typeof e||e.length<6||new RegExp("[^"+n.get().replace(/[|\\{}()[\]^$+*?.-]/g,"\\$&")+"]").test(e))}},2019:e=>{"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r="object"===("undefined"==typeof window?"undefined":t(window))&&(window.crypto||window.msCrypto),n=r&&r.getRandomValues?function(e){return r.getRandomValues(new Uint8Array(e))}:function(e){for(var t=[],r=0;r<e;r++)t.push(Math.floor(256*Math.random()));return t};e.exports=n},87:e=>{"use strict";var t=1;e.exports={nextValue:function(){return(t=(9301*t+49297)%233280)/233280},seed:function(e){t=e}}},3595:e=>{"use strict";e.exports=0},4230:(e,t,r)=>{"use strict";r.d(t,{N:()=>a,Z:()=>i});var n=r(8881);class i{constructor(e){this.mode="PerspectiveCamera",this.oCam=this.createOrthographic(),this.pCam=this.create(),this.backgroudDom=null,this.runScene=e,this.runScene.cb.resize.add("camera-background",(()=>{var e,t;this.backgroudDom&&(({width:e,height:t}=this.runScene.renderEx.getDomSize()),this.backgroudDom.style.width=e+"px",this.backgroudDom.style.height=t+"px")}))}setBackground(e){var t,r,n=this.runScene.assetsEx.engineDom;this.backgroudDom||(this.backgroudDom=document.createElement("div"),({width:t,height:r}=this.runScene.renderEx.getDomSize()),this.backgroudDom.style.position="absolute",this.backgroudDom.style.width=t+"px",this.backgroudDom.style.height=r+"px",n.appendChild(this.backgroudDom)),e?(this.backgroudDom.style.display="block",this.backgroudDom.style.backgroundImage="url("+e+")",this.backgroudDom.style.backgroundRepeat="no-repeat",this.backgroudDom.style.backgroundSize="100% 100%"):this.backgroudDom.style.display="none"}create(){return new n.PerspectiveCamera}createOrthographic(){return new n.OrthographicCamera}setMode(e){var t;e!==this.mode&&(this.runScene.helperEx.transContro.reset(),console.log(e,"mode"),this.mode=e,this.runScene.assetsEx.reset(),this.reset(this.getCamera()),this.setSize(),t=this.runScene.assetsEx.get().controls,"OrthographicCamera"===e&&(t.enableRotate=!1,t.enablePan=!1))}getCamera(){return"OrthographicCamera"===this.mode?this.oCam:this.pCam}reset(e){e.position.set(0,20,20),(e=this.runScene.assetsEx.get().controls).target.set(0,0,0),e.update()}get(){return this.runScene.assetsEx.get().camera}setSize(){var{width:e,height:t}=this.runScene.renderEx.getDomSize(),r=this.getCamera();r.aspect=e/t,r.updateProjectionMatrix()}}const a=e=>null==e?void 0:e.isCamera},4330:(e,t,r)=>{"use strict";r.d(t,{sG:()=>n,zX:()=>i});const n=["map","normalMap","aoMap"],i=["map","metalnessMap","roughnessMap","normalMap","aoMap","emissiveMap","alphaMap","lightMap","envMap","displacementMap"]},1794:(e,t,r)=>{"use strict";r.d(t,{Z:()=>i});var n=r(9594);class i extends Map{constructor(e){e?super((0,n.js)(e,((e,t)=>[e,t]))):super()}toArray(e){var t=[];for(const r of this.entries())t.push("key"==e?r[0]:r[1]);return t}map(e){return[...this.entries()].map((t=>{var[t,r]=t;return e(t,r)}))}toJSON(){const e={};return this.forEach(((t,r)=>{e[t]=r})),e}filter(e,t){var r,n,i=[];for([r,n]of this.entries())e(r,n)&&i.push("key"===t?r:n);return i}find(e){for(var[t,r]of this.entries())if(e(t,r))return r}static formJSON(e){return new i(e)}}},272:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});class n extends Set{constructor(e){super(),this.isSet=!0,this.add(e||[])}add(e){return Array.isArray(e)?e.map((e=>this.add(e))):super.add(e),this}remove(e){if(Array.isArray(e))e.map((e=>this.remove(e)));else{if(!super.has(e))return;super.delete(e)}return this}toArray(){return[...this]}map(e,t=!1){const r=[];return this.forEach((n=>{if(n=e(n),!t)return r.push(n);n&&r.push(n)})),r}find(e){for(const t of this)if(e(t))return t}filter(e){var t=[];for(const r of this)e(r)&&t.push(r);return t}}},5247:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});const n=t=r(8881)},2931:(e,t,r)=>{"use strict";r.d(t,{ZP:()=>M,RQ:()=>B});var n=r(9251),i=r(8881);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return(o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function s(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===a(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=function(e){var t=n;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e);var r=s(n);function n(e,t){var a,o;if(this instanceof n)return(a=new i.BufferGeometry).setAttribute("position",new i.Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),a.computeBoundingSphere(),o=new i.LineBasicMaterial({fog:!1}),(a=r.call(this,a,o)).light=e,a.color=t,a.type="RectAreaLightHelper",(o=new i.BufferGeometry).setAttribute("position",new i.Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),o.computeBoundingSphere(),a.add(new i.Mesh(o,new i.MeshBasicMaterial({side:i.BackSide,fog:!1}))),a;throw new TypeError("Cannot call a class as a function")}return t=n,(e=[{key:"updateMatrixWorld",value:function(){var e,t;this.scale.set(.5*this.light.width,.5*this.light.height,1),void 0!==this.color?(this.material.color.set(this.color),this.children[0].material.color.set(this.color)):(this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),e=this.material.color,1<(t=Math.max(e.r,e.g,e.b))&&e.multiplyScalar(1/t),this.children[0].material.color.copy(this.material.color)),this.matrixWorld.extractRotation(this.light.matrixWorld).scale(this.scale).copyPosition(this.light.matrixWorld),this.children[0].matrixWorld.copy(this.matrixWorld)}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),n}(i.Line),c=r(5247);class h{constructor(e){this.runScene=e}}class d extends h{get(){}static toJSON(e){var{type:e,intensity:t,name:r,visible:n,color:i}=e;return{type:e,intensity:t,name:r,visible:n,color:i.getHexString()}}parseJSON(e){var t=this.runScene.lightEx.get("AmbientLight",{addUndo:!1}),{type:e,intensity:r,name:n,visible:i,color:a}=e;return t.intensity=r,t.type=e,t.name=n,t.visible=i,t.color=new c.Z.Color("#"+a),t}}class p extends h{get(){throw new Error("Method not implemented.")}static toJSON(e){var{intensity:e,name:t,type:r,position:n,visible:i,color:a,castShadow:o,shadow:s,rotation:l,target:u}=e,{mapSize:s,camera:c}=s,{scale:c,near:h,far:d}=c;return{type:r,intensity:e,name:t,visible:i,color:a.getHexString(),castShadow:o,shadow:{mapSize:s.x,camera:{near:h,far:d,scale:c.x}},position:{x:n.x,y:n.y,z:n.z},rotation:{x:l.x,y:l.y,z:l.z},targetPosition:{x:u.position.x,y:u.position.y,z:u.position.z}}}parseJSON(e){var t=this.runScene.lightEx.get("DirectionalLight",{addUndo:!1}),{targetPosition:e,intensity:r,name:n,position:i,visible:a,color:o,castShadow:s,shadow:l,rotation:u,type:h}=e,{mapSize:l,camera:d}=l,{scale:d,near:p,far:f}=d;return t.intensity=r,t.type=h,t.name=n,t.visible=a,t.castShadow=s,t.color=new c.Z.Color("#"+o),t.position.set(i.x,i.y,i.z),t.rotation.set(u.x,u.y,u.z),t.target.position.set(e.x,e.y,e.z),t.add(t.target),t.shadow.mapSize.x=l,t.shadow.mapSize.y=l,t.shadow.camera.scale.x=d,t.shadow.camera.scale.y=d,t.shadow.camera.scale.z=d,t.shadow.camera.near=p,t.shadow.camera.far=f,t.shadow.camera.updateProjectionMatrix(),null!=(r=t.cameraHelper)&&r.update(),t}}class f extends h{get(){throw new Error("Method not implemented.")}static toJSON(e){var{type:e,intensity:t,name:r,visible:n,color:i,groundColor:a,position:o}=e;return{name:r,type:e,intensity:t,visible:n,position:{x:o.x,y:o.y,z:o.z},groundColor:a.getHexString(),color:i.getHexString()}}parseJSON(e){var t=this.runScene.lightEx.get("HemisphereLight",{addUndo:!1}),{type:e,intensity:r,name:n,visible:i,color:a,groundColor:o,position:s}=e;return t.type=e,t.intensity=r,t.name=n,t.visible=i,t.color=new c.Z.Color("#"+a),t.groundColor=new c.Z.Color("#"+o),t.position.set(s.x,s.y,s.z),t}}class m extends h{get(){throw new Error("Method not implemented.")}static toJSON(e){var{name:e,type:t,intensity:r,distance:n,decay:i,renderOrder:a,color:o,visible:s,castShadow:l,shadow:u,position:c}=e,{mapSize:u,camera:h,bias:d,radius:p}=u,{scale:h,near:f,far:m}=h;return{name:e,type:t,intensity:r,visible:s,color:o.getHexString(),castShadow:l,distance:n,decay:i,renderOrder:a,shadow:{mapSize:u.x,camera:{near:f,far:m,scale:h.x},radius:p,bias:d},position:{x:c.x,y:c.y,z:c.z}}}parseJSON(e){var t=this.runScene.lightEx.get("PointLight",{addUndo:!1}),{name:e,type:r,intensity:n,distance:i,decay:a,renderOrder:o,color:s,visible:l,castShadow:u,shadow:h,position:d}=e,{mapSize:h,camera:p,bias:f,radius:m}=h,{scale:p,near:v,far:g}=p;return t.intensity=n,t.type=r,t.name=e,t.visible=l,t.castShadow=u,t.distance=i,t.renderOrder=o,t.color=new c.Z.Color("#"+s),t.position.set(d.x,d.y,d.z),t.shadow.mapSize.x=h,t.shadow.mapSize.y=h,t.shadow.bias=f,t.decay=a,t.shadow.radius=m,t.shadow.camera.scale.x=p,t.shadow.camera.scale.y=p,t.shadow.camera.scale.z=p,t.shadow.camera.near=v,t.shadow.camera.far=g,t.shadow.camera.updateProjectionMatrix(),t}}class v{constructor(e){this.runScene=e}static toJSON(e){var{type:e,intensity:t,name:r,visible:n,color:i,position:a}=e;return{name:r,type:e,intensity:t,visible:n,position:{x:a.x,y:a.y,z:a.z},color:i.getHexString()}}parseJSON(e){var t=this.runScene.lightEx.get("RectAreaLight",{addUndo:!1}),{type:e,intensity:r,name:n,visible:i,color:a,position:o}=e;return t.type=e,t.intensity=r,t.name=n,t.visible=i,t.color=new c.Z.Color("#"+a),t.position.set(o.x,o.y,o.z),t}}class g{constructor(e){this.runScene=e}static toJSON(e){var{name:e,type:t,color:r,distance:n,decay:i,intensity:a,angle:o,penumbra:s,visible:l,castShadow:u,shadow:c,renderOrder:h,position:d,target:p}=e,{bias:c,camera:f,normalBias:m,mapSize:v,radius:g}=c,f=f.near;return{type:t,intensity:a,name:e,visible:l,distance:n,angle:o,decay:i,penumbra:s,renderOrder:h,color:r.getHexString(),castShadow:u,shadow:{bias:c,normalBias:m,mapSize:v.x,camera:{near:f},radius:g},position:{x:d.x,y:d.y,z:d.z},targetPosition:{x:p.position.x,y:p.position.y,z:p.position.z}}}parseJSON(e){var t=this.runScene.lightEx.get("SpotLight",{addUndo:!1}),{name:e,type:r,color:n,distance:i,decay:a,intensity:o,angle:s,penumbra:l,visible:u,castShadow:h,shadow:d,renderOrder:p,position:f,targetPosition:m}=e,{bias:d,camera:v,normalBias:g,mapSize:y,radius:b}=d,v=v.near;return t.intensity=o,t.type=r,t.name=e,t.visible=u,t.distance=i,t.decay=a,t.angle=s,t.penumbra=l,t.renderOrder=p,t.castShadow=h,t.color=new c.Z.Color("#"+n),t.position.set(f.x,f.y,f.z),t.shadow.mapSize.x=y,t.shadow.mapSize.y=y,t.shadow.camera.near=v,t.target.position.set(m.x,m.y,m.z),t.shadow.bias=d,t.shadow.normalBias=g,t.shadow.radius=b,t.shadow.camera.updateProjectionMatrix(),t}}var y=r(4852),b=r(3735),x=r(2510),w=r(7169),A=r(9887);const S={DirectionalLight:p,PointLight:m,SpotLight:g,RectAreaLight:v,HemisphereLight:f,AmbientLight:d};class M{constructor(e){this.shadowList=["DirectionalLight","PointLight","SpotLight"],this.helperList=["DirectionalLight","PointLight","SpotLight","RectAreaLight","HemisphereLight"],this.lightDom=void 0,this.helperUpdateList=["DirectionalLight","PointLight","SpotLight","HemisphereLight"],this.runScene=e,this.lightExMap={DirectionalLight:new p(e),PointLight:new m(e),SpotLight:new g(e),RectAreaLight:new v(e),HemisphereLight:new f(e),AmbientLight:new d(e)}}getLightsByScene(e=this.runScene.sceneEx.get()){return e.children.filter((e=>e.isLight))}get(e,t){var{isClone:t,id:r,addUndo:i,addToScene:a}=(0,A.mergeObject)({isClone:!1,id:(0,n.getId)(),addUndo:!0,addToScene:!0},t),o=new c.Z[e];return o.position.y=10,o.name=e,o.userData.id=r,this.shadowList.includes(e)&&(o.castShadow=!0),this.setLight(o),a&&(this.helperList.includes(o.type)?((r=this.setLightHelper(o)).push({model:o,parent:this.runScene.sceneEx.get(),addTree:!0}),e=r.map((e=>new y.Z(Object.assign(Object.assign({},e),{runScene:this.runScene})).execute())),i&&this.runScene.undoEx.addUndo(e),null!=(a=null==o?void 0:o.lightHelper)&&a.update()):this.runScene.modelEx.add(o,void 0,{addUndo:i}),this.runScene.modelEx.setSelectByModel(o,{isClone:t})),o}setNull(e){e.userData.light&&this.setNull(e.userData.light),this.isLight(e)&&("DirectionalLight"===e.type?e.cameraHelper&&(e.cameraHelper.visible=!1):"SpotLight"===e.type&&(e.cameraHelper&&(e.cameraHelper.visible=!1),e.helper&&(e.helper.visible=!0)))}setSelect(e){e.userData.light&&this.setSelect(e.userData.light),this.isLight(e)&&("DirectionalLight"===e.type?e.cameraHelper&&(e.cameraHelper.visible=!0):"SpotLight"===e.type&&(e.cameraHelper&&(e.cameraHelper.visible=!0),e.helper&&(e.helper.visible=!0)))}update(e){var t;e.userData.isLightTarget&&e.userData.light&&(e=e.userData.light),this.isLight(e)&&("DirectionalLight"===e.type||"SpotLight"===e.type?(e.helper.update(),null!=(t=e.cameraHelper)&&t.update()):null!=(e=null==(t=e.helper)?void 0:t.update)&&e.call(t))}remove(e,t=!0){let r;return this.runScene.helperEx.unfocus(),r="DirectionalLight"===e.type||"SpotLight"===e.type?[e,e.cameraHelper,e.helper].map((t=>{if(t)return new w.Z({addTree:t===e,runScene:this.runScene,model:t,parent:t.parent||this.runScene.sceneEx.get()}).execute()})).filter((e=>e)):[e,e.helper].map((t=>{if(t)return new w.Z({addTree:t===e,runScene:this.runScene,model:t,parent:t.parent||this.runScene.sceneEx.get()}).execute()})).filter((e=>e)),t&&r&&this.runScene.undoEx.addUndo(r),r}getLightHelper(e,t){this.runScene.uniqueEx.model.add(t);const r=this.runScene.uniqueEx.getId(t);var n=[];let i;switch(e){case"RectAreaLight":i=new u(t,16773120);break;case"DirectionalLight":i=new c.Z.DirectionalLightHelper(t,1,16711680),t.children[0]?t.target=t.children[0]:(a=new c.Z.Object3D,(t.target=a).name="helperModel",a.position.y=-10,t.shadow.autoUpdate=!0,a.userData.isLightTarget=!0,(a.userData.light=t).add(a)),t.shadow.camera.layers.set(1),t.shadow.camera.far=1e5,t.shadowCameraLeft=-5,t.shadowCameraRight=5,t.shadowCameraTop=5,t.shadowCameraBottom=-5,t.shadow.camera.updateProjectionMatrix();var a=new c.Z.CameraHelper(t.shadow.camera);t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(a,!0,(e=>{e.userData.id=r,e.userData.unClick=!0})),a.userData.id=r,a.userData.unClick=!0,t.cameraHelper=a,n.push({model:a,parent:this.runScene.sceneEx.get(),addTree:!1});break;case"PointLight":i=new c.Z.PointLightHelper(t,1,16711935);break;case"SpotLight":i=new c.Z.SpotLightHelper(t),a=new c.Z.Object3D,(t.target=a).name="helperModel",a.userData.isLightTarget=!0,a.userData.light=t,a.position.y=-10,t.shadow.autoUpdate=!0,t.add(a),a=new c.Z.CameraHelper(t.shadow.camera),t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(a,!0,(e=>{e.userData.id=r})),a.userData.id=r,t.cameraHelper=a,n.push({model:a,parent:this.runScene.sceneEx.get(),addTree:!1});break;case"HemisphereLight":i=new c.Z.HemisphereLightHelper(t,1,16773135)}return i.name="helperModel",this.runScene.helperEx.setHelper(i,!0,(e=>{e.userData.id=r})),i.userData.id=r,(i.light=t).helper=i,n.push({model:i,parent:this.runScene.sceneEx.get(),addTree:!1}),n}setLightHelper(e){return"editor"!==this.runScene.optionsEx.options.mode?[]:this.getLightHelper(e.type,e)}isUpdateHelper(e){return this.helperUpdateList.includes(e)}initLight(e){e.forEach((e=>this.setLightHelper(e)))}setNormal(e,t=0){var{model:e,info:r,val:n,cb:i}=e;return new x.Z({target:e,runScene:this.runScene,info:r,oldVal:e[r],newVal:n,cb:i}).execute()}setMultip(e,t,r=!0,n=!0){var i,a;return e instanceof Array?(a=e.map((e=>{var{model:e,typeList:n,newVal:i}=e;return e=new b.Z({target:e,typeList:n,newVal:i,cb:t}),r?e.execute():e})),n&&this.runScene.undoEx.addUndo(a),a):(({model:a,typeList:e,newVal:i}=e),a=new b.Z({target:a,typeList:e,newVal:i,cb:t}),n&&this.runScene.undoEx.addUndo(a),r?a.execute():a)}isLight(e){return null==(e=e.userData)?void 0:e.isLight}setLight(e){e.userData.isLight=!0}isHelperTarget(e){return e.userData.isLightTarget}clone(e){return this.runScene.modelEx.selectNull(),this.get(e.type,{isClone:!0,id:(0,n.getId)()})}static toJSON(e){return e.map((e=>{var t=e.type;return S[t].toJSON(e)}))}}const B=e=>null==(e=null==e?void 0:e.userData)?void 0:e.isLight},3765:(e,t,r)=>{"use strict";r.r(t),r.d(t,{SpecialMaterial:()=>Y,createDefMaterial:()=>U,defAllMaterialMap:()=>L,defBaseMaterialMap:()=>k,default:()=>F,disposeMaterial:()=>j,getBaseTextures:()=>z,getMaterialType:()=>q,getTextures:()=>H,getTexturesByMaterial:()=>N,initMaterial:()=>J,isBaseMaterial:()=>Z,isColor:()=>K,isMaterial:()=>Q,mergeMaterial:()=>G,setDefMaterialForSameGeo:()=>X,setMaterialTexture:()=>V,updateMaterial:()=>W});var n=r(9594),i=r(9251),a=r(8881),o=r(4330);class s{static create(){return new a.MeshStandardMaterial}static isDefval(e){for(const n in this.defVal){var t=this.defVal[n],r=e[n];if(t instanceof a.Color){if(t.getHexString()!==r.getHexString())return!1}else if("object"==typeof t){if(r.x!==t.x)return!1}else if(r!==t)return!1}for(const t of o.zX)if(e[t])return!1;return!0}}s.defVal={color:new a.Color(16777215),emissive:new a.Color(0),roughness:1,metalness:0,lightMapIntensity:1,aoMapIntensity:1,emissiveIntensity:1,bumpScale:1,normalScale:new a.Vector2(1,1),displacementScale:1,envMapIntensity:1,wireframe:!1,transparent:!1,depthTest:!0,depthWrite:!0,opacity:1};var l=r(6651),u=r(3735);class c{constructor(e){this.tools={type:"FakeInterior",getTextures(e){var t=[];return e.uniforms.ceilingTex.value&&t.push({type:"ceilingTex",texture:e.uniforms.ceilingTex.value}),e.uniforms.floorTex.value&&t.push({type:"floorTex",texture:e.uniforms.floorTex.value}),e.uniforms.sideWallTex.value&&t.push({type:"sideWallTex",texture:e.uniforms.sideWallTex.value}),e.uniforms.backWallTex.value&&t.push({type:"backWallTex",texture:e.uniforms.backWallTex.value}),t},parseData:e=>{const{textures:t,normal:r}=e,n=new a.ShaderMaterial({uniforms:(0,l.d9)(h.uniforms),vertexShader:h.vertexShader,fragmentShader:h.fragmentShader});return n.name=r.name,t.forEach((e=>{"ceilingTex"===e.type?n.uniforms.ceilingTex.value=e.texture||null:"floorTex"===e.type?n.uniforms.floorTex.value=e.texture||null:"sideWallTex"===e.type?n.uniforms.sideWallTex.value=e.texture||null:"backWallTex"===e.type&&(n.uniforms.backWallTex.value=e.texture||null)})),Object.keys(r.uniforms).filter((e=>!c.TextureNames.includes(e))).map((e=>{var t=r.uniforms[e];n.uniforms[e].value="roomsXYZPropsW"===e||"positionOffsetRoomsXYZPropsW"===e||"roomColorTint"===e?new a.Vector4(t.x,t.y,t.z,t.w):t})),n.userData.tools=this.tools,n},toNormal:e=>{var t=U();t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:this.tools.type,uniforms:{},name:e.name},textures:this.tools.getTextures(e)});const r={},n=e.uniforms,i=h.uniforms;return Object.keys(n).filter((e=>!c.TextureNames.includes(e))).map((e=>{var t,o,s,l,u,c,h=n[e].value,d=i[e].value;h instanceof a.Vector4?(({x:t,y:o,z:s}=h),({x:l,y:u,z:c}=d),t===l&&o===u&&s===c||(r[e]=h)):h!==d&&(r[e]=h)})),t.userData.normal.uniforms=r,t},clone:function(e,t){return e}},this.runScene=e}create(){var e=new a.ShaderMaterial({uniforms:(0,l.d9)(h.uniforms),vertexShader:h.vertexShader,fragmentShader:h.fragmentShader});return e.userData.tools=this.tools,e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new u.Z({target:e,typeList:["uniforms",...t],newVal:r}).execute())}}c.TextureNames=["sideWallTex","backWallTex","floorTex","ceilingTex"];const h={uniforms:{roomIntensity:{value:1},roomColorTint:{value:new a.Vector4(1,1,1,1)},sideWallTex:{value:null},backWallTex:{value:null},floorTex:{value:null},ceilingTex:{value:null},sideWallTexTiling:{value:.097},backWallTexTiling:{value:.097},floorTexTiling:{value:.15},ceilingTexTiling:{value:.15},roomTile:{value:.3},roomsXYZPropsW:{value:new a.Vector4(.35,.65,.1,1)},positionOffsetRoomsXYZPropsW:{value:new a.Vector4(4.7,2,-11,-3)},depthTest:{value:!0},depthWrite:{value:!0}},vertexShader:"\n varying vec2 vUv;\n varying vec3 vPos;\n varying mat4 vModelMatrix;\n \n void main() {\n vUv = uv;\n vPos = position;\n vModelMatrix = modelMatrix;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform float roomIntensity;\n uniform vec4 roomColorTint;\n \n uniform sampler2D sideWallTex;\n uniform sampler2D backWallTex;\n uniform sampler2D floorTex;\n uniform sampler2D ceilingTex;\n \n uniform float sideWallTexTiling;\n uniform float backWallTexTiling;\n uniform float floorTexTiling;\n uniform float ceilingTexTiling;\n \n uniform float roomTile;\n uniform vec4 roomsXYZPropsW;\n uniform vec4 positionOffsetRoomsXYZPropsW;\n \n varying vec2 vUv;\n varying vec3 vPos;\n varying mat4 vModelMatrix;\n \n void main() {\n vec4 interpVertexPos = vec4(vPos.xyz, vPos.z);\n // 将相机世界空间坐标转换为对象空间坐标\n vec4 cameraObjectPos = inverse(vModelMatrix) * vec4(cameraPosition, 1.0);\n vec4 transCameraPos = vec4(cameraObjectPos.xyz, cameraObjectPos.z);\n \n vec4 temp1 = (interpVertexPos - positionOffsetRoomsXYZPropsW);\n vec4 temp2 = ((roomsXYZPropsW + vec4(-1E-05, -1E-05, -1E-05, -1E-05)) * roomTile);\n vec4 V2 = transCameraPos - positionOffsetRoomsXYZPropsW;\n vec4 V1 = temp1 - V2;\n vec4 middleman = ((floor(temp2 * temp1) + step(vec4(0, 0, 0, 0), V1)) / temp2 - V2) / V1;\n \n // Side Walls\n vec2 sideWallUv = (middleman.x * V1 + V2).zy * sideWallTexTiling;\n vec4 sideWallColor = texture2D(sideWallTex, sideWallUv);\n \n // Back Wall\n vec2 backWallUv = (middleman.z * V1 + V2).xy * backWallTexTiling;\n vec4 backWallColor = texture2D(backWallTex, backWallUv);\n \n // Floor Ceiling\n vec2 floorUv = ((middleman.y * V1) + V2).xz * floorTexTiling;\n vec2 ceilingUv = ((middleman.y * V1) + V2).xz * ceilingTexTiling;\n vec4 floorColor = texture2D(floorTex, floorUv);\n vec4 ceilingColor = texture2D(ceilingTex, ceilingUv);\n vec4 cfColor = mix(floorColor, ceilingColor, step(0.0, V1.y));\n \n // Mix\n float compareXZ = 0.0;\n float stepXZ = step(middleman.z, middleman.x);\n if(stepXZ <= 0.0)\n compareXZ = middleman.x;\n else\n compareXZ = middleman.z;\n \n vec4 wallColor = vec4(0);\n if(stepXZ <= 0.0)\n wallColor = sideWallColor;\n else\n wallColor = backWallColor;\n \n vec4 finalColor = vec4(0);\n if(middleman.y <= compareXZ)\n finalColor = cfColor;\n else\n finalColor = wallColor;\n \n // Tint Room\n vec4 tintColor = roomColorTint * finalColor * roomIntensity;\n \n gl_FragColor = tintColor;\n }\n "};class d{constructor(e){this.tools={type:"Fresnel",getTextures(e){var t=[];return e.envMap&&t.push({type:"envMap",texture:e.envMap}),e.displacementMap&&t.push({type:"displacementMap",texture:e.displacementMap}),t},parseData:e=>{const{textures:t,normal:r,material:n}=e,i=G(n,new p(void 0,void 0,this.runScene));return i.name=r.name,t.forEach((e=>{i[e.type]=e.texture})),Object.keys(r.uniforms).filter((e=>!d.TextureNames.includes(e))).map((e=>{i[e]=r.uniforms[e]})),i.insertFresnelShader(),i.userData.tools=this.tools,i},toNormal:e=>{var t=G(e,U());t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:this.tools.type,uniforms:{},name:e.name},textures:this.tools.getTextures(e)}),t.name=e.name;const r={},n=f.uniforms;return Object.keys(n).filter((e=>!d.TextureNames.includes(e))).map((t=>{var i=e[t],a=n[t].value;"fresnelBias"===t||"fresnelScale"===t||"fresnelPower"===t||"isSurge"===t?i.value!==a&&(r[t]=i):i!==a&&(r[t]=i)})),t.userData.normal.uniforms=r,t},clone:(e,t)=>this.create(t)},this.runScene=e}create(e){var t=new p(void 0,void 0,this.runScene);return t.insertFresnelShader(),t.userData.tools=this.tools,(e=e||this.runScene.modelEx.select)&&(t.name=e.name),t}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new u.Z({target:e,typeList:[...t],newVal:r}).execute())}}d.TextureNames=["envMap","displacementMap"];class p extends a.MeshPhysicalMaterial{constructor(e,t,r){e?super(e):(super(),this.emissive=new a.Color(65535),this.envMap=null,this.displacementMap=null,this.metalness=0,this.roughness=0,this.ior=1.5,this.transmission=1,this.opacity=1,this.transparent=!0,this.thickness=0),this.runScene=r,t?(this.fresnelBias=new a.Uniform(t.fresnelBias),this.fresnelScale=new a.Uniform(t.fresnelScale),this.fresnelPower=new a.Uniform(t.fresnelPower)):(this.fresnelBias=new a.Uniform(f.uniforms.fresnelBias.value),this.fresnelScale=new a.Uniform(f.uniforms.fresnelScale.value),this.fresnelPower=new a.Uniform(f.uniforms.fresnelPower.value)),this.clock=new a.Clock,this.isSurge=new a.Uniform(!1),this.deltaTime=new a.Uniform(0),this.cubeCamera||((e=new a.WebGLCubeRenderTarget(2048)).texture.mapping=a.CubeRefractionMapping,this.cubeCamera=new a.CubeCamera(.1,1e5,e),this.runScene.assetsEx.scene.add(this.cubeCamera),this.runScene.cb.render.add("Fresnel",(()=>{this.update()})))}insertFresnelShader(){this.onBeforeCompile=e=>{e.uniforms.isSurge=this.isSurge,e.uniforms.deltaTime=this.deltaTime,e.uniforms.fresnelBias=this.fresnelBias,e.uniforms.fresnelScale=this.fresnelScale,e.uniforms.fresnelPower=this.fresnelPower,e.vertexShader=e.vertexShader.replace(/varying vec3 vWorldPosition;/g,f.vertexParas),e.vertexShader=e.vertexShader.replace(/#include <begin_vertex>/g,f.vertexShader1),e.vertexShader=e.vertexShader.replace(/vWorldPosition = worldPosition.xyz;/g,f.vertexShader2),e.fragmentShader=e.fragmentShader.replace(/#include <transmission_pars_fragment>/g,f.fragmentParas),e.fragmentShader=e.fragmentShader.replace(/vec3 totalEmissiveRadiance = emissive;/g,f.fragmentShaderEmissive)}}update(){this.clock&&(this.deltaTime.value+=3*this.clock.getDelta()),this.cubeCamera&&(this.cubeCamera.position.copy(this.runScene.assetsEx.camera.position),this.cubeCamera.update(this.runScene.assetsEx.renderer,this.runScene.assetsEx.scene))}}const f={uniforms:{depthTest:new a.Uniform(!0),depthWrite:new a.Uniform(!0),isSurge:new a.Uniform(!1),deltaTime:new a.Uniform(0),fresnelBias:new a.Uniform(0),fresnelScale:new a.Uniform(1),fresnelPower:new a.Uniform(3)},vertexParas:"\n uniform bool isSurge;\n uniform float deltaTime;\n varying vec3 vWorldPosition;\n varying vec3 vWorldNormal;\n ",vertexShader1:"\n vec3 transformed = vec3(position);\n if(isSurge) {\n // 0.15作为系数控制气泡表面波纹的稀疏程度,数值越大越密\n float wobbleValue = 0.15 * transformed.y + deltaTime;\n // 三角函数的系数控制气泡表面波纹的波动幅度,数值越大波幅越大\n vec3 wobblePos = vec3(0.75 * cos(wobbleValue) + 0.25 * sin(wobbleValue));\n transformed += wobblePos;\n }\n ",vertexShader2:"\n vWorldPosition = worldPosition.xyz;\n vWorldNormal = normalize(vec3(modelMatrix * vec4(normal, 0.0)));\n ",fragmentParas:"\n #include <transmission_pars_fragment>\n varying vec3 vWorldNormal;\n uniform float fresnelBias;\n uniform float fresnelScale;\n uniform float fresnelPower;\n ",fragmentShaderEmissive:"\n vec3 viewDir = normalize(cameraPosition - vWorldPosition);\n float fresnelNdot = dot(viewDir, vWorldNormal);\n float fresnelValue = fresnelBias + fresnelScale * pow(1.0 - fresnelNdot, fresnelPower);\n // fresnelValue = [0, 1], 0=center,1=edge\n \n vec3 totalEmissiveRadiance = emissive * fresnelValue;\n "};var m=r(110);class v{constructor(e){this.tools={type:"Physical",getTextures(e){const t=[];return v.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},parseData:e=>{const{normal:t,textures:r,material:n}=e,i=G(n,new a.MeshPhysicalMaterial);return i.name=t.name,r.forEach((e=>{i[e.type]=e.texture})),Object.keys(t.uniforms).filter((e=>!v.IgnoredAttributes.includes(e))).map((e=>{var r=t.uniforms[e];i[e]="attenuationColor"===e||"sheenColor"===e||"specularColor"===e?new a.Color(r):"clearcoatNormalScale"===e?new a.Vector2(r.x,r.y):r})),i.userData.tools=this.tools,i},toNormal:e=>{const t=G(e,U()),r=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:this.tools.type,uniforms:{},name:e.name},textures:this.tools.getTextures(e)}),t.name=e.name,{}),n=new a.MeshPhysicalMaterial;return Object.keys(e).filter((e=>!v.TextureNames.includes(e))).filter((e=>!v.IgnoredAttributes.includes(e))).filter((e=>void 0===t[e])).map((t=>{var i=e[t],a=n[t];"attenuationColor"===t||"sheenColor"===t||"specularColor"===t?i.getHexString()!==a.getHexString()&&(r[t]=i.getHexString()):"clearcoatNormalScale"===t?i.x===a.x&&i.y===a.y||(r[t]=i):i!==a&&(r[t]=i)})),t.userData.normal.uniforms=r,t},clone:(e,t)=>this.create(t)},this.runScene=e}create(e){var t=new a.MeshPhysicalMaterial;return t.userData.tools=this.tools,(e=e||this.runScene.modelEx.select)&&(t.name="MeshPhysicalMaterial-"+e.name),t}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new u.Z({target:e,typeList:[...t],newVal:r}).execute())}}v.IgnoredAttributes=["_listeners","version","userData"],v.TextureNames=["alphaMap","aoMap","bumpMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap","clearcoatMap","clearcoatNormalMap","clearcoatRoughnessMap","sheenRoughnessMap","sheenColorMap","specularIntensityMap","specularColorMap","thicknessMap","transmissionMap"];class g{constructor(e){this.tools={type:"Matcap",getTextures(e){const t=[];return g.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},toNormal:e=>{var t=this.tools.getTextures(e),r=G(e,U());r.userData=Object.assign(Object.assign({},r.userData),{normal:{type:this.tools.type,uniforms:{},name:e.name},textures:t}),r.name=e.name;const n={},i=new a.MeshMatcapMaterial;return Object.keys(e).filter((e=>!g.TextureNames.includes(e))).filter((e=>!g.IgnoredAttributes.includes(e))).map((t=>{var r=e[t],a=i[t];"bumpScale"===t||"displacementScale"===t||"displacementBias"===t||"depthTest"===t||"depthWrite"===t||"transparent"===t||"opacity"===t?r!==a&&(n[t]=r):"normalScale"!==t||r.x===a.x&&r.y===a.y||(n[t]=r)})),r.userData.normal.uniforms=n,r},parseData:e=>{const{normal:t,textures:r,material:n}=e,i=G(n,new a.MeshMatcapMaterial);return delete i.emissive,i.name=t.name,r.forEach((e=>{i[e.type]=e.texture})),Object.keys(t.uniforms).filter((e=>!g.IgnoredAttributes.includes(e))).map((e=>{i[e]="normalScale"===e?new a.Vector2(t.uniforms[e].x,t.uniforms[e].y):t.uniforms[e]})),i.userData.tools=this.tools,i},clone:(e,t)=>{const r=this.create(t);return Object.keys(r).filter((e=>!g.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r}},this.runScene=e}create(e){var t=new a.MeshMatcapMaterial;return t.userData.tools=this.tools,(e=e||this.runScene.modelEx.select)&&(t.name="Matcap-"+e.name),t}undo(e){const{material:t,list:r,val:n}=e;this.runScene.undoEx.addUndo(new u.Z({target:t,typeList:[...r],newVal:n,cb:()=>{t.needsUpdate=!0}}).execute())}}g.IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],g.TextureNames=["alphaMap","bumpMap","displacementMap","map","normalMap","matcap"];const y="\n#define STANDARD\n\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n\n// Insert Noise3D\n\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nuniform float uTime;\nuniform float uWindForce;\nuniform float uWindSpeed;\nuniform float uWindWaveScale;\nvarying vec3 vWorldPos;\nvarying vec3 vWorldNor;\n\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n\n vec4 mvPosition = vec4(transformed, 1.0);\n #ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n #endif\n mvPosition = modelViewMatrix * mvPosition;\n\n // Wind Vertex Start\n vWorldNor = normalize((modelMatrix * vec4(transformedNormal, 1.0)).xyz);\n vWorldPos = (modelMatrix * vec4(transformed, 1.0)).xyz;\n float tSpeed = uTime * uWindSpeed * 5.0;\n float wNoise = snoise((vWorldPos + vec3(tSpeed)) * uWindWaveScale);\n float pOffset = wNoise * uWindForce * 30.0;\n transformed.xyz += vec3(pOffset);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(transformed, 1.0);\n // Wind Vertex End\n\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n #ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n #endif\n}\n ",b="\n#define STANDARD\n#ifdef PHYSICAL\n#define IOR\n#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n#ifdef USE_SPECULARINTENSITYMAP\n uniform sampler2D specularIntensityMap;\n#endif\n#ifdef USE_SPECULARCOLORMAP\n uniform sampler2D specularColorMap;\n#endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n#ifdef USE_SHEENCOLORMAP\n uniform sampler2D sheenColorMap;\n#endif\n#ifdef USE_SHEENROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n#endif\n#endif\n\nuniform vec3 uColorGradient;\nuniform float uColorLevel;\nuniform float uColorFade;\nuniform float uLeavesCore;\nuniform vec3 uLeavesSize;\nuniform vec3 uLeavesPos;\n//uniform float uDirectLightOffset;\n//uniform float uDirectLightInt;\n//uniform float uIndirectLightInt;\nvarying vec3 vViewPosition;\nvarying vec3 vWorldPos;\nvarying vec3 vWorldNor;\n\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n//#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n//#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(diffuse, opacity);\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <clearcoat_normal_fragment_begin>\n #include <clearcoat_normal_fragment_maps>\n #include <emissivemap_fragment>\n\n #ifdef USE_MAP\n // Gradient Colors Start\n float normalizeY = vWorldPos.y / uLeavesSize.y;\n float secColorMask = saturate((normalizeY + uColorLevel) * uColorFade * 30.0);\n vec3 diffuseColor2 = uColorGradient * texture2D(map, vUv).rgb;\n vec3 mixColor = mix(diffuseColor.rgb, diffuseColor2, secColorMask);\n diffuseColor.rgb = mixColor;\n // Gradient Colors End\n #endif\n\n // Custom Normal Start\n vec3 leafCore = vec3(uLeavesPos.x, uLeavesPos.y + uLeavesCore * uLeavesSize.y, uLeavesPos.z);\n normal = normalize(vWorldPos - leafCore);\n // Custom Normal End\n\n #include <lights_physical_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n\n // 直射光:DirectLight = IncidentLight\n // float dotNL = saturate(dot(geometry.normal, directLight.direction));\n // vec3 irradiance = dotNL * directLight.color;\n // reflectedLight.directDiffuse += irradiance * BRDF_Lambert(material.diffuseColor);\n // 间接光:IndirectLight = ReflectedLight\n // vec3 irradiance = getAmbientLightIrradiance(ambientLightColor);\n // irradiance += getLightProbeIrradiance(lightProbe, geometry.normal);\n // irradiance += getHemisphereLightIrradiance(hemisphereLights[i], geometry.normal);\n // reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert(material.diffuseColor);\n\n // Custom Lighting Start\n // float dotNL = dot(geometry.normal, directLight.direction);\n // vec3 customIrradiance = clamp((dotNL + uDirectLightOffset), 0.01, 1.0) * vec3(1.0, 0.87, 0.67);\n // vec3 customDirectLight = customIrradiance * diffuseColor.rgb * uDirectLightInt;\n // vec3 customIndirectLight = (irradiance + vWorldNor * 0.001) * diffuseColor.rgb * uIndirectLightInt;\n // vec3 totalDiffuse = customDirectLight + customIndirectLight;\n // Custom Lighting End\n\n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include <transmission_fragment>\n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n float sheenEnergyComp = 1.0 - 0.157 * max3(material.sheenColor);\n outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate(dot(geometry.clearcoatNormal, geometry.viewDir));\n vec3 Fcc = F_Schlick(material.clearcoatF0, material.clearcoatF90, dotNVcc);\n outgoingLight = outgoingLight * (1.0 - material.clearcoat * Fcc) + clearcoatSpecular * material.clearcoat;\n #endif\n #include <output_fragment>\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}\n ",x="\n vec3 mod289(vec3 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n }\n \n vec4 mod289(vec4 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n }\n \n vec4 permute(vec4 x) {\n return mod289(((x*34.0)+1.0)*x);\n }\n \n vec4 taylorInvSqrt(vec4 r) {\n return 1.79284291400159 - 0.85373472095314 * r;\n }\n \n float snoise(vec3 v) {\n const vec2 C = vec2(1.0/6.0, 1.0/3.0);\n const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n \n // First corner\n vec3 i = floor(v + dot(v, C.yyy));\n vec3 x0 = v - i + dot(i, C.xxx);\n \n // Other corners\n vec3 g = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g;\n vec3 i1 = min(g.xyz, l.zxy);\n vec3 i2 = max(g.xyz, l.zxy);\n \n // x0 = x0 - 0.0 + 0.0 * C.xxx;\n // x1 = x0 - i1 + 1.0 * C.xxx;\n // x2 = x0 - i2 + 2.0 * C.xxx;\n // x3 = x0 - 1.0 + 3.0 * C.xxx;\n vec3 x1 = x0 - i1 + C.xxx;\n vec3 x2 = x0 - i2 + C.yyy;\n // 2.0*C.x = 1/3 = C.y\n vec3 x3 = x0 - D.yyy;\n // -1.0+3.0*C.x = -0.5 = -D.y\n \n // Permutations\n i = mod289(i);\n vec4 p = permute(permute(permute(i.z + vec4(0.0, i1.z, i2.z, 1.0 )) + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));\n \n // Gradients: 7x7 points over a square, mapped onto an octahedron.\n // The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)\n float n_ = 0.142857142857; // 1.0/7.0\n vec3 ns = n_ * D.wyz - D.xzx;\n \n vec4 j = p - 49.0 * floor(p * ns.z * ns.z); // mod(p,7*7)\n \n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N)\n \n vec4 x = x_ *ns.x + ns.yyyy;\n vec4 y = y_ *ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n \n vec4 b0 = vec4( x.xy, y.xy );\n vec4 b1 = vec4( x.zw, y.zw );\n \n //vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0;\n //vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0;\n vec4 s0 = floor(b0)*2.0 + 1.0;\n vec4 s1 = floor(b1)*2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n \n vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy;\n vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww;\n \n vec3 p0 = vec3(a0.xy,h.x);\n vec3 p1 = vec3(a0.zw,h.y);\n vec3 p2 = vec3(a1.xy,h.z);\n vec3 p3 = vec3(a1.zw,h.w);\n \n //Normalise gradients\n vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));\n p0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n \n // Mix final noise value\n vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);\n m = m * m;\n return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), dot(p2,x2), dot(p3,x3) ) );\n }\n ";class w{constructor(e){this.tools={type:"TreeLeaf",getTextures(e){const t=[];return w.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},toNormal:e=>{var t=this.tools.getTextures(e),r=G(e,U());r.userData=Object.assign(Object.assign({},r.userData),{normal:{type:this.tools.type,uniforms:{},name:e.name},textures:t}),r.name=e.name;const n={},i=new S(this.runScene);return Object.keys(e).filter((e=>!w.TextureNames.includes(e))).filter((e=>!w.IgnoredAttributes.includes(e))).map((t=>{var r=e[t],a=i[t];"color"!==t&&"emissive"!==t&&("normalScale"===t?r.x===a.x&&r.y===a.y||(n[t]=r):"uniforms"===t?Object.keys(r).map((t=>{var r=e.uniforms[t].value,a=i.uniforms[t].value;"windForce"===t||"windSpeed"===t||"windWaveScale"===t||"colorLevel"===t||"colorFade"===t||"leavesCore"===t?r!==a&&(n[t]=r):"colorGradient"===t&&r.getHexString()!==a.getHexString()&&(n[t]=r.getHexString())})):r!==a&&(n[t]=r))})),r.userData.normal.uniforms=n,r},parseData:e=>{const{normal:t,textures:r,material:n,models:i}=e,o=G(n,new S(this.runScene));return o.name=t.name,o.setSize(i[0]),o.setWorldPos(i[0]),r.forEach((e=>{o[e.type]=e.texture})),Object.keys(t.uniforms).filter((e=>!w.IgnoredAttributes.includes(e))).map((e=>{var r=t.uniforms[e];"color"!==e&&"emissive"!==e&&("normalScale"===e?o[e]=new a.Vector2(r.x,r.y):"windForce"===e||"windSpeed"===e||"windWaveScale"===e||"colorLevel"===e||"colorFade"===e||"leavesCore"===e?o.uniforms[e]=new a.Uniform(r):"colorGradient"===e?o.uniforms[e]=new a.Uniform(new a.Color(parseInt(r,16))):o[e]=t.uniforms[e])})),o.userData.tools=this.tools,console.log(o,"parseData"),o},clone:(e,t)=>{const r=this.create(t);return Object.keys(r).filter((e=>!w.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r}},this.runScene=e}create(e){var t=new S(this.runScene);return t.userData.tools=this.tools,(e=e||this.runScene.modelEx.select)&&(t.name="TreeLeaf-"+e.name,t.setSize(e),t.setWorldPos(e)),t}undo(e){const{material:t,list:r,val:n}=e;this.runScene.undoEx.addUndo(new u.Z({target:t,typeList:[...r],newVal:n,cb:()=>{t.needsUpdate=!0}}).execute())}}w.IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines","onBeforeCompile"],w.TextureNames=["alphaMap","aoMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap"];const A=new a.Clock;class S extends a.MeshStandardMaterial{constructor(e){super(),this.uniforms={time:new a.Uniform(0),windForce:new a.Uniform(.3),windSpeed:new a.Uniform(.5),windWaveScale:new a.Uniform(.25),colorGradient:new a.Uniform(new a.Color(65280)),colorLevel:new a.Uniform(-.5),colorFade:new a.Uniform(-.25),leavesCore:new a.Uniform(.3),leavesSize:new a.Uniform(new a.Vector3),leavesPos:new a.Uniform(new a.Vector3)},this.insertShader(),e&&e.cb.render.add("TreeLeaf",(()=>{this.update()}))}insertShader(){this.onBeforeCompile=e=>{e.uniforms.uTime=this.uniforms.time,e.uniforms.uWindForce=this.uniforms.windForce,e.uniforms.uWindSpeed=this.uniforms.windSpeed,e.uniforms.uWindWaveScale=this.uniforms.windWaveScale,e.uniforms.uColorGradient=this.uniforms.colorGradient,e.uniforms.uColorLevel=this.uniforms.colorLevel,e.uniforms.uColorFade=this.uniforms.colorFade,e.uniforms.uLeavesCore=this.uniforms.leavesCore,e.uniforms.uLeavesSize=this.uniforms.leavesSize,e.uniforms.uLeavesPos=this.uniforms.leavesPos,e.vertexShader=y,e.fragmentShader=b,e.vertexShader=e.vertexShader.replace(/\/\/ Insert Noise3D/g,x)}}update(){this.uniforms.time.value=A.getElapsedTime()}setSize(e){var t=new a.Vector3;e.getWorldScale(t),t=new a.Vector3,(new a.Box3).setFromObject(e).getSize(t),this.uniforms.leavesSize.value=t}setWorldPos(e){var t=new a.Vector3;e.getWorldPosition(t),this.uniforms.leavesPos.value=t}}var M=r(5180);const B={uniforms:{tDiffuse:new a.Uniform(null),h:new a.Uniform(1/512)},vertexShader:"\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}",fragmentShader:"\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float h;\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvec4 sum = vec4( 0.0 );\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\t\n\t\t\tgl_FragColor = sum;\n\t\t}"},C={uniforms:{tDiffuse:new a.Uniform(null),v:new a.Uniform(1/512)},vertexShader:"\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}",fragmentShader:"\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float v;\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvec4 sum = vec4( 0.0 );\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\t\t\t\n\t\t\tgl_FragColor = sum;\n\t\t}"};new a.Uniform(null),new a.Uniform(null),new a.Uniform(0),new a.Uniform(0),new a.Uniform(0),new a.Uniform(new a.Vector2),new a.Uniform(.1),new a.Uniform(1e3);class _{constructor(e){this.materials={},this.render=()=>{(0,n.js)(this.materials,((e,t)=>{var{model:t,material:r}=t;r.update(t)}))},this.tools={type:"Reflector",getTextures:e=>N(e),parseData:e=>{const{textures:t,normal:r,models:n,material:i}=e,o=G(i,new E(void 0,void 0,this.runScene));return o.name=r.name,t.forEach((e=>{o[e.type]=e.texture})),Object.keys(r.uniforms).filter((e=>!_.TextureNames.includes(e))).map((e=>{o[e]="normalScale"===e?new a.Vector2(r.uniforms[e].x,r.uniforms[e].y):r.uniforms[e]})),o.setRTSize(o.resolution),o.setBlurPass(o.blurSize),o.insertReflectorShader(),o.userData.tools=this.tools,this.bindData({model:n[0],material:o}),o},toNormal:e=>{var t=G(e,U());t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:this.tools.type,uniforms:{},name:e.name},textures:this.tools.getTextures(e)}),t.name=e.name;const r={},n=T.uniforms;return Object.keys(n).filter((e=>!_.TextureNames.includes(e))).map((t=>{var i=e[t],a=n[t].value;"mirror"===t||"mixBlur"===t||"mixStrength"===t||"mixContrast"===t?i.value!==a&&(r[t]=i):i!==a&&(r[t]=i)})),t.normalScale&&(r.normalScale=t.normalScale),t.userData.normal.uniforms=r,t},clone:(e,t)=>this.create(t)},this.runScene=e,this.init()}init(){this.runScene.cb.render.add("Reflector-render",this.render),this.runScene.cb.model.add.add("",(({model:e})=>{var t;e.material&&"Reflector"===(null==(t=null==(t=e.material.userData)?void 0:t.tools)?void 0:t.type)&&(t=e.material,this.materials[t.userData.id]||(this.materials[t.userData.id]={model:e,material:t}))})),this.runScene.cb.model.remove.add("",(({model:e})=>{var t;e.material&&"Reflector"===(null==(t=null==(t=e.material.userData)?void 0:t.tools)?void 0:t.type)&&(t=e.material,delete this.materials[t.userData.id])}))}bindData(e){var t=e.material,r=(0,i.getId)();t.userData.id=r,this.materials[r]=e}create(e){var t=new E(void 0,void 0,this.runScene);return t.insertReflectorShader(),t.userData.tools=this.tools,(e=e||this.runScene.modelEx.select)&&(t.name=e.name),this.bindData({model:e,material:t}),t}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new u.Z({target:e,typeList:[...t],newVal:r}).execute())}dispose(){this.materials={}}}_.TextureNames=["map","normalMap","roughnessMap","metalnessMap","tDiffuse","tDiffuseBlur"];class E extends a.MeshStandardMaterial{constructor(e,t,r){e?super(e):(super(),this.opacity=T.uniforms.opacity.value,this.transparent=T.uniforms.transparent.value,this.roughness=T.uniforms.roughness.value,this.metalness=T.uniforms.metalness.value),this.runScene=r,t?(this.resolution=t.resolution,this.blurSize=t.blurSize,this.mirror=new a.Uniform(t.mirror),this.mixBlur=new a.Uniform(t.mixBlur),this.mixStrength=new a.Uniform(t.mixStrength),this.mixContrast=new a.Uniform(t.mixContrast)):(this.resolution=T.uniforms.resolution.value,this.blurSize=T.uniforms.blurSize.value,this.mirror=new a.Uniform(T.uniforms.mirror.value),this.mixBlur=new a.Uniform(T.uniforms.mixBlur.value),this.mixStrength=new a.Uniform(T.uniforms.mixStrength.value),this.mixContrast=new a.Uniform(T.uniforms.mixContrast.value)),this.textureMatrix=new a.Uniform(new a.Matrix4),this.reflectorWorldPosition=new a.Vector3,this.cameraWorldPosition=new a.Vector3,this.rotationMatrix=new a.Matrix4,this.normal=new a.Vector3,this.view=new a.Vector3,this.lookAtPosition=new a.Vector3,this.target=new a.Vector3,this.tempQuaternion=new a.Vector4,this.virtualCamera=new a.PerspectiveCamera,this.reflectorPlane=new a.Plane,this.clipPlane=new a.Vector4,e={minFilter:a.LinearFilter,magFilter:a.LinearFilter,type:a.HalfFloatType,encoding:this.runScene.assetsEx.get().renderer.outputEncoding},this.glRT1=new a.WebGLRenderTarget(this.resolution,this.resolution,e),this.glRT2=new a.WebGLRenderTarget(this.resolution,this.resolution,e),this.tDiffuse=new a.Uniform(this.glRT1.texture),this.tDiffuseBlur=new a.Uniform(this.glRT2.texture),this.hBlurPass=new M.T(B),this.hBlurPass.uniforms.h.value=1/this.blurSize,this.hBlurPass.clear=!1,this.hBlurPass.renderToScreen=!1,this.hBlurPass.enabled=0<this.blurSize,this.hBlurPass.material.depthWrite=!1,this.vBlurPass=new M.T(C),this.vBlurPass.uniforms.v.value=1/this.blurSize,this.vBlurPass.clear=!1,this.vBlurPass.renderToScreen=!1,this.vBlurPass.enabled=0<this.blurSize,this.vBlurPass.material.depthWrite=!1}insertReflectorShader(){this.onBeforeCompile=e=>{var t;null!=(t=e.defines)&&t.USE_UV||(e.defines.USE_UV=""),null!=(t=e.defines)&&t.USE_BLUR||(e.defines.USE_BLUR=""),e.uniforms.tDiffuse=this.tDiffuse,e.uniforms.tDiffuseBlur=this.tDiffuseBlur,e.uniforms.textureMatrix=this.textureMatrix,e.uniforms.mirror=this.mirror,e.uniforms.mixBlur=this.mixBlur,e.uniforms.mixStrength=this.mixStrength,e.uniforms.mixContrast=this.mixContrast,e.vertexShader=T.vertexParas+""+e.vertexShader,e.vertexShader=e.vertexShader.replace("#include <project_vertex>",T.vertexShader),e.fragmentShader=T.fragmentParas+""+e.fragmentShader,e.fragmentShader=e.fragmentShader.replace("#include <emissivemap_fragment>",T.fragmentShader)}}setRTSize(e){this.glRT1.setSize(e,e),this.glRT2.setSize(e,e),this.hBlurPass.setSize(e,e),this.vBlurPass.setSize(e,e)}setBlurPass(e){this.hBlurPass.enabled=0<e,this.hBlurPass.enabled&&(this.hBlurPass.uniforms.h.value=1/e),this.vBlurPass.enabled=0<e,this.vBlurPass.enabled&&(this.vBlurPass.uniforms.v.value=1/e)}copy(e){return super.copy(e),this.resolution=e.resolution,this.blurSize=e.blurSize,this.mirror.value=e.mirror.value,this.mixBlur.value=e.mixBlur.value,this.mixStrength.value=e.mixStrength.value,this.mixContrast.value=e.mixContrast.value,this}swapBuffers(){var e=this.glRT1;this.glRT1=this.glRT2,this.glRT2=e}beforeRender(e){this.reflectorWorldPosition.setFromMatrixPosition(e.matrixWorld),this.cameraWorldPosition.setFromMatrixPosition(this.runScene.assetsEx.get().camera.matrixWorld),this.rotationMatrix.extractRotation(e.matrixWorld),this.normal.set(0,0,1),this.normal.applyMatrix4(this.rotationMatrix),this.reflectorWorldPosition.addScaledVector(this.normal,0),this.view.subVectors(this.reflectorWorldPosition,this.cameraWorldPosition),0<this.view.dot(this.normal)||(this.view.reflect(this.normal).negate(),this.view.add(this.reflectorWorldPosition),this.rotationMatrix.extractRotation(this.runScene.assetsEx.get().camera.matrixWorld),this.lookAtPosition.set(0,0,-1),this.lookAtPosition.applyMatrix4(this.rotationMatrix),this.lookAtPosition.add(this.cameraWorldPosition),this.target.subVectors(this.reflectorWorldPosition,this.lookAtPosition),this.target.reflect(this.normal).negate(),this.target.add(this.reflectorWorldPosition),this.virtualCamera.position.copy(this.view),this.virtualCamera.up.set(0,1,0),this.virtualCamera.up.applyMatrix4(this.rotationMatrix),this.virtualCamera.up.reflect(this.normal),this.virtualCamera.lookAt(this.target),this.virtualCamera.far=this.runScene.assetsEx.get().camera.far,this.virtualCamera.updateMatrixWorld(),this.virtualCamera.projectionMatrix.copy(this.runScene.assetsEx.get().camera.projectionMatrix),this.textureMatrix.value.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),this.textureMatrix.value.multiply(this.virtualCamera.projectionMatrix),this.textureMatrix.value.multiply(this.virtualCamera.matrixWorldInverse),this.textureMatrix.value.multiply(e.matrixWorld),this.reflectorPlane.setFromNormalAndCoplanarPoint(this.normal,this.reflectorWorldPosition),this.reflectorPlane.applyMatrix4(this.virtualCamera.matrixWorldInverse),this.clipPlane.set(this.reflectorPlane.normal.x,this.reflectorPlane.normal.y,this.reflectorPlane.normal.z,this.reflectorPlane.constant),e=this.virtualCamera.projectionMatrix,this.tempQuaternion.x=(Math.sign(this.clipPlane.x)+e.elements[8])/e.elements[0],this.tempQuaternion.y=(Math.sign(this.clipPlane.y)+e.elements[9])/e.elements[5],this.tempQuaternion.z=-1,this.tempQuaternion.w=(1+e.elements[10])/e.elements[14],this.clipPlane.multiplyScalar(2/this.clipPlane.dot(this.tempQuaternion)),e.elements[2]=this.clipPlane.x,e.elements[6]=this.clipPlane.y,e.elements[10]=this.clipPlane.z+1,e.elements[14]=this.clipPlane.w)}update(e){e&&e.visible&&(this.beforeRender(e),e.visible=!1,this.runScene.assetsEx.get().renderer.setRenderTarget(this.glRT1),this.runScene.assetsEx.get().renderer.clear(),this.runScene.assetsEx.get().renderer.render(this.runScene.assetsEx.get().scene,this.virtualCamera),this.hBlurPass&&this.hBlurPass.enabled&&(this.hBlurPass.render(this.runScene.assetsEx.get().renderer,this.glRT2,this.glRT1,0,!1),this.swapBuffers()),this.vBlurPass&&this.vBlurPass.enabled&&(this.vBlurPass.render(this.runScene.assetsEx.get().renderer,this.glRT2,this.glRT1,0,!1),this.swapBuffers()),e.visible=!0,this.runScene.assetsEx.get().renderer.setRenderTarget(null))}}const T={uniforms:{opacity:new a.Uniform(1),transparent:new a.Uniform(!1),roughness:new a.Uniform(1),metalness:new a.Uniform(.6),resolution:new a.Uniform(1024),blurSize:new a.Uniform(1024),mirror:new a.Uniform(0),mixBlur:new a.Uniform(10),mixStrength:new a.Uniform(2),mixContrast:new a.Uniform(1),depthTest:new a.Uniform(!0),depthWrite:new a.Uniform(!0)},vertexParas:"\n uniform mat4 textureMatrix;\n varying vec4 my_vUv;\n ",vertexShader:"\n #include <project_vertex>\n my_vUv = textureMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n ",fragmentParas:"\n uniform sampler2D tDiffuse;\n uniform sampler2D tDiffuseBlur;\n uniform sampler2D tDepth;\n uniform sampler2D distortionMap;\n uniform float distortion;\n uniform float mirror;\n uniform float mixBlur;\n uniform float mixStrength;\n uniform float mixContrast;\n uniform float minDepthThreshold;\n uniform float maxDepthThreshold;\n uniform float depthScale;\n uniform float depthToBlurRatioBias;\n varying vec4 my_vUv;\n ",fragmentShader:"\n #include <emissivemap_fragment>\n float distortionFactor = 0.0;\n #ifdef USE_DISTORTION\n distortionFactor = texture2D(distortionMap, vUv).r * distortion;\n #endif\n \n vec4 new_vUv = my_vUv;\n new_vUv.x += distortionFactor;\n new_vUv.y += distortionFactor;\n \n vec4 base = texture2DProj(tDiffuse, new_vUv);\n vec4 blur = texture2DProj(tDiffuseBlur, new_vUv);\n \n vec4 merge = base;\n \n #ifdef USE_NORMALMAP\n vec2 normal_uv = vec2(0.0);\n vec4 normalColor = texture2D(normalMap, vUv * normalScale);\n vec3 my_normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) );\n vec3 coord = new_vUv.xyz / new_vUv.w;\n normal_uv = coord.xy + coord.z * my_normal.xz * 0.05;\n vec4 base_normal = texture2D(tDiffuse, normal_uv);\n vec4 blur_normal = texture2D(tDiffuseBlur, normal_uv);\n merge = base_normal;\n blur = blur_normal;\n #endif\n \n float blurFactor = 0.0;\n float depthFactor = 0.0001;\n \n #ifdef USE_DEPTH\n vec4 depth = texture2DProj(tDepth, new_vUv);\n depthFactor = smoothstep(minDepthThreshold, maxDepthThreshold, 1.0-(depth.r * depth.a));\n depthFactor *= depthScale;\n depthFactor = max(0.0001, min(1.0, depthFactor));\n #ifdef USE_BLUR\n blur = blur * min(1.0, depthFactor + depthToBlurRatioBias);\n merge = merge * min(1.0, depthFactor + 0.5);\n #else\n merge = merge * depthFactor;\n #endif\n #endif\n \n float reflectorRoughnessFactor = roughness;\n #ifdef USE_ROUGHNESSMAP\n vec4 reflectorTexelRoughness = texture2D( roughnessMap, vUv );\n reflectorRoughnessFactor *= reflectorTexelRoughness.g;\n #endif\n \n #ifdef USE_BLUR\n blurFactor = min(1.0, mixBlur * reflectorRoughnessFactor);\n merge = mix(merge, blur, blurFactor);\n #endif\n \n vec4 newMerge = vec4(0.0, 0.0, 0.0, 1.0);\n newMerge.r = (merge.r - 0.5) * mixContrast + 0.5;\n newMerge.g = (merge.g - 0.5) * mixContrast + 0.5;\n newMerge.b = (merge.b - 0.5) * mixContrast + 0.5;\n \n diffuseColor.rgb = diffuseColor.rgb * ((1.0 - min(1.0, mirror)) + newMerge.rgb * mixStrength);\n "};var D=r(911),P=r(8024),O=r(2510),R=r(6272),I=function(e,t,r,n){return new(r=r||Promise)((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(o,s)}l((n=n.apply(e,t||[])).next())}))};const k={depthTest:!0,depthWrite:!0,alphaTest:0,side:0,displacementScale:1,visible:!0,normalScale:{x:1,y:1},aoMapIntensity:1,lightMapIntensity:1,envMapIntensity:1},L=["color","emissive","roughness","metalness","normalScale","aoMapIntensity","displacementScale","transparent","lightMapIntensity","envMapIntensity","opacity","alphaTest"];class F{constructor(e){this.defMaterialMap={BaseMaterial:s,SpriteMaterial:m.Z,FakeInterior:c,Reflector:_,Fresnel:d,Physical:v,Matcap:g,TreeLeaf:w},this.defMaterial=U(),this.addCb=e=>{this.runScene.cb.material.add.cb(e)},this.setParses=[],this.runScene=e,this.runScene.cb.unique.material.add.add("engine-material-add",(e=>{this.addCb(e)})),this.defMaterialMap={BaseMaterial:s,SpriteMaterial:m.Z,FakeInterior:new c(e),Reflector:new _(e),Fresnel:new d(e),Physical:new v(e),Matcap:new g(e),TreeLeaf:new w(e)},this.addSetParses((e=>{var{material:e,type:t,newVal:r}=e;"opacity"===t&&r<1&&(e.transparent=!0)}))}add(e,t,r){this.runScene.uniqueEx.material.add(e,t,r)}create(){var e=new a.MeshStandardMaterial;return this.add(e),e}clone(e){return(e=e.clone()).userData.id=(0,i.getId)(),e}addSetParses(e){this.setParses.push(e)}set(e){const{material:t,type:r,val:n}=e,i=t[r];return t[r]=n,t.needsUpdate=!0,this.setParses.map((e=>e({material:t,type:r,newVal:n,oldVal:i})))}setNormals(e,t=!0){console.log(e,"map");const{info:r,newVal:n,materials:i,oldval:a,cb:o}=e;let s=n;return s.isVector2&&(s=s.clone()),e=i.map((e=>new P.Z({info:r,target:e,newVal:s,oldVal:a||e[r],runScene:this.runScene,cb:o}).execute())),t&&this.runScene.undoEx.addUndo(e),e}setNormal(e,t=!0){return e=new P.Z(Object.assign(Object.assign({},e),{runScene:this.runScene})).execute(),t&&this.runScene.undoEx.addUndo(e),e}setTextures(e,t=!0){return I(this,void 0,void 0,(function*(){const{info:r,newVal:n,materials:i,oldVal:a}=e;n instanceof File&&(e.newVal=yield this.runScene.textureEx.parse(n)),"envMap"===r&&(0,D.setTextureMapping)(e.newVal);var o=i.map((t=>new P.Z({info:r,target:t,newVal:e.newVal,oldVal:a||t[r],runScene:this.runScene}).execute()));return t&&this.runScene.undoEx.addUndo(o),i[0][r]}))}setTexture(e,t=!0){return I(this,void 0,void 0,(function*(){var{info:r,newVal:n,target:i}=e,n=(n instanceof File&&(e.newVal=yield this.runScene.textureEx.parse(n)),"envMap"===r&&(0,D.setTextureMapping)(e.newVal),new P.Z(Object.assign(Object.assign({},e),{oldVal:i[r],runScene:this.runScene})).execute());return t&&this.runScene.undoEx.addUndo(n),e.newVal}))}resetMaterial(e,t,r){const{addUndo:n,includeChild:i}=r=(0,R.Gm)({addUndo:!0,includeChild:!1},r);if(e&&t){const r=new Set;((0,R.lG)(e,"array")?e:[e]).map((e=>{i?e.traverse((e=>{Z(e.material)&&r.add(e)})):e.material&&r.add(e)}));const a=[];r.forEach((e=>{a.push(new O.Z({target:e,runScene:this.runScene,info:"material",newVal:t,oldVal:e.material}).execute())})),this.runScene.modelEx.select===e&&this.runScene.cb.setSelectMaterial.cb(t),n&&this.runScene.undoEx.addUndo(a)}}getBase(e){var t=this.defMaterialMap[e];if(("SpriteMaterial"!==e||"Sprite"===(null==(e=this.runScene.modelEx.select)?void 0:e.type))&&t)return t.create()}toNromal(e){var t,r=(null==(r=null==(t=e.userData.tools)?void 0:t.toNormal)?void 0:r.call(t,e))||e.clone();return r.userData=Object.assign(Object.assign({},r.userData),e.userData),r}setSelect(e){this.select=e,this.runScene.cb.setSelectMaterial.cb(e)}getDataByType(e,t){return this.defMaterialMap[e].tools.parseData(t)}dispose(){this.defMaterialMap.Reflector.dispose(),this.runScene.cb.material.dispose.cb("")}remove(e){}getDefNromals(e){var t;if(null!=(t=null==(t=e.userData)?void 0:t.tools)&&t.type)return{};const r={};return(0,n.js)(k,((t,n)=>{var i=e[t];if("object"==typeof i)for(const e in i)if(i[e]!==n[e])return void(r[t]=i.clone());i!==n&&(r[t]=i)})),r}parseNromals(e,t){(0,n.js)(e,((e,r)=>{var n,i,a,o,s;void 0!==k[e]&&("object"==typeof r?(({x:a,y:o,z:s}=r),null!=(i=null==(n=t[e])?void 0:n.set)&&i.call(n,a,o,s)):t[e]=r)}))}isBaseMaterial(e){return"MeshStandardMaterial"===e.type&&!e.userData.tools&&!e.userData.isTimeLineUsed&&s.isDefval(e)}}const U=e=>((e=new a.MeshStandardMaterial(e)).userData.id=(0,i.getId)(),e),G=(e,t)=>(L.map((r=>{var n=e[r];"object"==typeof n&&(t[r]=n.clone()),t[r]=n})),t),j=e=>{e.dispose(),0!==(e=N(e)).length&&e.map((e=>{e=e.texture,(0,D.disposeTexture)(e)}))},N=e=>{var t=e.userData.textures||z(e);return delete e.userData.textures,t},H=e=>{var t;return(null==(t=null==(t=e.userData)?void 0:t.tools)?void 0:t.getTextures(e))||z(e)},z=e=>o.zX.map((t=>({type:t,texture:e[t]}))).filter((e=>e.texture)),V=e=>{var{material:e,type:t,texture:r}=e;"envMap"===t&&(0,D.setTextureMapping)(r),e[t]=r,e.needsUpdate=!0},J=e=>{e.vertexColors=!1,e.depthWrite=!0,e.needsUpdate=!1},K=e=>null==e?void 0:e.isColor,W=e=>{e.needsUpdate=!0},Q=e=>null==e?void 0:e.isMaterial,X=e=>{},Z=e=>null==e?void 0:e.isMeshStandardMaterial,Y={Sprite:m.Z},q=e=>{var t;return(null==(t=null==e?void 0:e.userData.tools)?void 0:t.type)||(null==e?void 0:e.type)}},110:(e,t,r)=>{"use strict";r.d(t,{Z:()=>s});var n=r(8881),i=r(3765),a=r(3778),o=r(4233);class s{static create(){var e=new n.SpriteMaterial;return e.userData.tools=this.tools,e}}s.modelTools={merge(e,t){t.position.copy(e.position),t.rotation.copy(e.rotation),t.scale.copy(e.scale),t.renderOrder=e.renderOrder,t.castShadow=e.castShadow,t.receiveShadow=e.receiveShadow,t.name=e.name,(0,o.M)(e,"name",e.name),(0,a.setLayers)(t,1===e.layers.mask?0:1)},toNormal:(e,t)=>{var r=(0,a.createDefModel)("Box");return r.userData.normal={type:"MySpriteMaterial"},r.material=e.material,s.modelTools.merge(e,r),r},parseData:(e,t)=>{var r=(0,a.createDefModel)("Sprite"),n=e.userData.layers;return(0,a.setLayers)(r,n),s.modelTools.merge(e,r),r.material=e.material,r}},s.tools={type:"SpriteMaterial",getTextures:function(e){return["map","alphaMap"].map((t=>{var r=e[t];if(r)return{type:t,texture:r}})).filter((e=>e))},parseData:e=>{var{textures:e,material:t}=e;const r=(0,i.mergeMaterial)(t,s.create());var{depthWrite:t,depthTest:n,name:a}=t.userData.normal;return void 0!==t&&(r.depthWrite=t),void 0!==n&&(r.depthTest=n),a&&(r.name=a),e.map((e=>{var{type:e,texture:t}=e;r[e]=t})),r},toNormal:e=>{var t=(0,i.mergeMaterial)(e,(0,i.createDefMaterial)()),r=Object.assign(Object.assign({},t.userData),{normal:{type:s.tools.type,name:e.name},textures:s.tools.getTextures(e)});return e.depthWrite!==i.defBaseMaterialMap.depthWrite&&(r.normal.depthWrite=e.depthWrite),e.depthTest!==i.defBaseMaterialMap.depthTest&&(r.normal.depthTest=e.depthTest),t.userData=r,t},clone:function(e,t){return e}}},3801:(e,t,r)=>{"use strict";r.d(t,{Ju:()=>a,t9:()=>i,zf:()=>o});var n=r(4233);const i={isDynamic:()=>{}},a={isDeleted(e,t=!1){var r;return!!e&&(!(null==(r=null==e?void 0:e.userData)||!r.isDeleted)||!!t&&a.isDeleted(e.parent,t))},setDeleted(e,t){e.userData&&(t?(0,n.M)(e,"isDeleted",!0):null!=(t=null==e?void 0:e.userData)&&delete t.isDeleted)}},o={setLock(e){(0,n.M)(e,"lock",!0)},reLock(e){delete e.userData.lock},isLock(e,t=!1){var r;return!(!e||"Scene"===e.type)&&(r=e.userData.lock,t?!!r||o.isLock(e.parent,t):void 0!==r&&r)}}},3778:(e,t,r)=>{"use strict";r.r(t),r.d(t,{createDefModel:()=>E,default:()=>_,delClonedModel:()=>N,deletedModel:()=>C.Ju,disposeModel:()=>T,dynamicModel:()=>C.t9,getClonedIdModel:()=>G,getDeepModels:()=>k,getModelSize:()=>J,hasSkeleton:()=>L,instanceModel:()=>D,isDynamicModel:()=>U,isGLowModel:()=>H,isGroup:()=>V,isSprite:()=>z,lockModel:()=>C.zf,mergeModel:()=>P,normalModel:()=>W,selectableModel:()=>K,setClonedModel:()=>j,setDynamicModel:()=>F,setHelper:()=>R,setLayers:()=>I,withAnima:()=>O}),t=r(4356);var n=r.n(t),i=r(4298),a=r(9594),o=r(8881),s=r(4091),l=r(4230);const u=["Group","Box","Circle","Cylinder","Dodecahedron","Icosahedron","Lathe","Octahedron","Plane","Ring","Sphere","Sprite","Tetrahedron","Torus","TorusKnot","Tube","Reflector"];var c=r(1794),h=r(272),d=r(5247),p=r(2931),f=r(110),m=r(3765),v=r(4233),g=r(4852),y=r(3735),b=r(2510);class x extends r(4616).Z{constructor(e){super(),this.type="修改父元素",this.isUndoParent=!0,this.runScene=e.runScene,this.oldParent=e.oldParent,this.newParent=e.newParent,this.target=e.target}execute(){return this.redo(),this}_execute(e,t){e.attach(this.target),this.runScene.cb.model.setParent.cb({model:this.target,parent:e}),(null==(e=this.runScene.modelEx.select)?void 0:e.userData.id)===t.userData.id&&this.runScene.modelEx.selectNull()}undo(){this._execute(this.oldParent,this.newParent)}redo(){this._execute(this.newParent,this.oldParent)}}const w=x;var A=r(7169),S=r(4380),M=r(3729),B=r(9887);var C=r(3801);class _{constructor(e){this._selectModel=void 0,this.geometryMap=new c.Z,this.clonedMap=new c.Z,this.defNodeMap={castShadow:!1,receiveShadow:!1,renderOrder:0,visible:!0},this.add=(()=>{const e=(e,t)=>{t?(this.runScene.uniqueEx.model.add(e,{hasReset:!0}),this.runScene.cb.model.clone.cb(e)):this.runScene.uniqueEx.model.add(e)};return(t,r,n)=>{var{addUndo:i,isClone:a,select:o,addToTree:s}=(0,B.mergeObject)({addUndo:!0,isClone:!1,select:!1,addToTree:!0},n);return t instanceof Array?t.map((e=>this.add(e,r,n))):(e(t,a),this.setGeometryMap(t),this.setCloneMap(t),s=new g.Z({model:t,parent:r||this.runScene.sceneEx.get(),isClone:a,addTree:s,runScene:this.runScene}).execute(),!0===i&&this.runScene.undoEx.addUndo(s),o&&this.setSelectByModel(t,{isDomTreeActive:!1,isClone:a}),s)}})(),this.deepIsVisible=e=>"Scene"===e.type||!!e.visible&&!!e.parent&&this.deepIsVisible(e.parent),this.runScene=e,this.clone=(e=>(t,r=!0)=>{if(e.lightEx.isLight(t))return e.lightEx.clone(t);var n,i,o=L(t),s=(e=>{const t={};return(0,B.getModelMap)(e,"id",(e=>{0<e.animations.length&&(t[(0,M.K)(e)]=e.animations)})),t})(t),l=(o=o?function(e){var t=new Map,r=new Map,n=e.clone();return function e(t,r,n){n(t,r);for(var i=0;i<t.children.length;i++)e(t.children[i],r.children[i],n)}(e,n,(function(e,n){t.set(n,e),r.set(e,n)})),n.traverse((function(e){var n,i;e.isSkinnedMesh&&(i=(n=t.get(e)).skeleton.bones,e.skeleton=n.skeleton.clone(),e.bindMatrix.copy(n.bindMatrix),e.skeleton.bones=i.map((function(e){return r.get(e)})),e.bind(e.skeleton,e.bindMatrix))})),n}(t):t.clone(),l=t,(0,v.M)(o,"cloneId",G(l)||l.userData.id),(0,v.is)(t,"isDynamic")&&F(o,!0),(0,B.getModelMap)(o,"id"));u=o,null!=(n=null==(i=null==t?void 0:t.material)?void 0:i.userData)&&n.tools&&(n=null==(n=i.userData.tools)?void 0:n.clone(i,u))&&n.uuid!==i.uuid&&(e.materialEx.resetMaterial(u,n,{addUndo:!0}),e.materialEx.add(n,t,i));{var u={newModel:o,newModelMap:l,animaMap:s};const{animaMap:e,newModelMap:t}=u;(0,a.js)(e,((e,r)=>{(e=t[e])&&(e.animations=[...r.map((e=>e.clone()))])}))}return r&&e.uniqueEx.model.add(o,{reset:!0,hasReset:!0}),o})(e)}get select(){return this._selectModel}set select(e){this.setSelectByModel(e)}setGeometryMap(e){if((0,B.validType)(e,"array"))return e.map((e=>this.setGeometryMap(e)));var t;e.geometry&&(t=e.geometry.uuid,this.geometryMap.get(t)||this.geometryMap.set(t,new Set),this.geometryMap.get(t).add((0,M.K)(e))),this.setGeometryMap(e.children)}isSameGeo(e,t){var{normal:e,position:r,uv:n}=e.attributes,{normal:t,position:i,uv:a}=t.attributes;return e.array.length===t.array.length&&r.array.length===i.array.length&&n.array.length===a.array.length&&(e=(0,B.sameArr)([...e.array],[...t.array],20),t=(0,B.sameArr)([...r.array],[...i.array],20),r=(0,B.sameArr)([...n.array],[...a.array],20),e&&t&&r)}getClonedIdFromModel(e){if(e.geometry){for(const e of this.clonedMap){var[t,r]=e;if(0!==r.size){if(!(r=r.values()[0]))return;const e=this.runScene.uniqueEx.model.get(r);if(!e||!e.geometry)return;if(this.isSameGeo(e.geometry,e.geometry))return t}}this.clonedMap.map(((e,t)=>{t.size}))}}setCloneMap(e){if((0,B.validType)(e,"array"))return e.map((e=>this.setGeometryMap(e)));var t=G(e);(t||this.getClonedIdFromModel(e))&&(this.clonedMap.get(t)||this.clonedMap.set(t,new h.Z),this.clonedMap.get(t).add((0,M.K)(e)),this.setCloneMap(e.children))}removeCloneMap(e){this.clonedMap.get((0,M.K)(e))}replaceClonedGroup(e,t){t=G(t)||(0,M.K)(t);var r=this.clonedMap.get(t);r&&0!==r.size&&(e.userData.id=t,r.map((t=>{var r,n,i,a,o,s;(t=this.runScene.modelEx.getById(t))&&(({position:r,rotation:n,scale:i,name:a,parent:o}=t),this.remove(t,!1),(s=this.runScene.modelEx.clone(e)).userData.id=(0,M.K)(t),s.position.copy(r),s.rotation.copy(n),s.scale.copy(i),s.name=a,this.add(s,o,{addUndo:!1,isClone:!0,select:!1}))})))}replaceGeometry(e,t){t=t.uuid;var r=this.geometryMap.get(t);r&&0!==r.size&&(r.forEach((t=>{(t=this.runScene.uniqueEx.model.get(t))&&(t.geometry=e,t.updateMatrix())})),this.geometryMap.delete(t),this.geometryMap.set(e.uuid,r))}setSelectByModel(e,t){this.runScene.optionsEx.log([e,"选中的模型",(0,M.K)(e)],"detail");var r,{isDomTreeActive:t,isClone:n}=t||{};if(this.runScene.events.key.shift&&this._selectModel)return!!(r=this.getBeTweenChildByTwoModel(this._selectModel,e))&&(this.runScene.multipSelector.add([...r,e],!0),!0);if(this.runScene.events.key.ctrl&&!n)this.runScene.multipSelector.add(e);else{if(this.runScene.multipSelector.isEmpty()||this.runScene.multipSelector.setEmpty(),this._selectModel){if(this._selectModel===e)return void(this.runScene.helperEx.focusModelId||this.runScene.helperEx.focus(e));this.runScene.lightEx.setNull(this._selectModel),this.runScene.cb.model.unFocus.cb(this._selectModel)}e&&(e.isCamera||(this.runScene.helperEx.focus(e),this.runScene.lightEx.setSelect(e)),this.runScene.cb.model.focus.cb({model:e,status:!0,domActive:!t}),this.runScene.materialEx.setSelect(e.material),this.runScene.cb.model.setSelect.cb(e),this._selectModel=e)}}setSelectById(e){(e=this.runScene.uniqueEx.model.get(e))&&this.setSelectByModel(e)}remove(e,t=!0){if(e instanceof Array)return e.map((e=>this.remove(e)));e=new A.Z({runScene:this.runScene,model:e,parent:e.parent||this.runScene.sceneEx.get()}).execute(),t&&this.runScene.undoEx.addUndo(e)}isNavieV3(e,t=0){var{x:e,y:r,z:n}=e;return e+r+n===t}isNavieV2(e,t=0){var{x:e,y:r}=e;return e===t&&r===t}isUnless(e){return!e.material&&this.isNavieV3(e.position)&&this.isNavieV3(e.rotation)&&this.isNavieV3(e.scale,3)&&0===e.children.length}isUnlessLevel(e){return this.isNavieV3(e.position)&&this.isNavieV3(e.rotation)&&this.isNavieV3(e.scale,3)&&1===e.children.length&&!O(e)}create(){return n().model.getModelByType("Box")}getById(e){return this.runScene.uniqueEx.model.get(e)}getLevel(e,t=0){return e.parent&&"Scene"!==e.parent.type?this.getLevel(e.parent,++t):t}selectNull(){var e=this._selectModel;e&&(this.runScene.cb.model.unFocus.cb(e),this.runScene.materialEx.setSelect(null),this.runScene.lightEx.setNull(e)),this._selectModel=void 0,this.runScene.cb.model.setSelect.cb(null),this.runScene.helperEx.unfocus()}cloneV3(e){return e.clone()}setParent(e,t,r=!0){if(t=new w({oldParent:e.parent,newParent:t,target:e,runScene:this.runScene}).execute(),!r)return t;this.runScene.undoEx.addUndo(t)}_setV3(e){const{model:t,info:r,newV3:n}=e;if(Array.isArray(t))return t.map((e=>{e[r].set(n.x,n.y,n.z),e.updateMatrix()}));t[r].set(n.x,n.y,n.z),t.updateMatrix()}update(e){if(Array.isArray(e))return e.map((e=>e.updateMatrix()));e.updateMatrix()}setV3(e,t=!0,r=!0){let{model:n,info:i,newV3:a,oldV3:s}=e;var l,u;if(a.isVector3||a.isEuler||(({x:c,y:l,z:u}=a),a=new o.Vector3(c,l,u)),(0,B.isRunning)(this.runScene))return this._setV3(e);var c=n instanceof Array?n.map((e=>new S.Z({target:e,info:i,runScene:this.runScene,oldV3:s||e[i].clone(),newV3:a}).execute(r))):new S.Z({target:n,info:i,oldV3:s||n[i].clone(),newV3:a,runScene:this.runScene}).execute(r);t&&this.runScene.undoEx.addUndo(c)}setNormal(e,t=!0){const{model:r,oldVal:n,info:i,val:a,executeCb:o}=e;return e=r instanceof Array?r.map((e=>new b.Z({target:e,info:i,runScene:this.runScene,oldVal:n||r[i],newVal:a,executeCb:o}).execute())):new b.Z({target:r,info:i,runScene:this.runScene,oldVal:n||r[i],newVal:a,executeCb:o}).execute(),t&&this.runScene.undoEx.addUndo(e),e}setMaterial(e,t,r=!0){var n=new b.Z({target:e,info:"material",runScene:this.runScene,oldVal:e.material,newVal:t}).execute();this.select===e&&this.runScene.cb.setSelectMaterial.cb(t),e.material.needsUpdate=!0,r&&this.runScene.undoEx.addUndo(n)}addDef(e){this.add(E(e),void 0,{select:!0})}isModel(e){return!(e.isLight||e.isCamera)}getSphere(){var e=new o.MeshBasicMaterial,t=new o.SphereGeometry(.7,150,150);return new o.Mesh(t,e)}getIndexByModel(e){var t;return e.parent?null==(t=e.parent)?void 0:t.children.findIndex((t=>t===e)):-1}getBeTweenChildByTwoModel(e,t){if(e.parent.uuid===t.parent.uuid){var r=this.getIndexByModel(e);if(t=this.getIndexByModel(t),-1!==r&&-1!==t){const n=Math.max(r,t),i=r===n?t:r;return e.parent.children.map(((e,t)=>t>i&&t<n&&e)).filter((e=>e))}}}setMultip(e){var{model:e,typeList:t,newVal:r}=e;this.runScene.undoEx.addUndo(new y.Z({target:e,typeList:t,newVal:r}).execute())}createGroup(e,t,r){const n=t||new o.Group;(t=[]).push(new g.Z({model:n,runScene:this.runScene,parent:r||this.runScene.assetsEx.get().scene}).execute()),e instanceof Array?t.push(...e.map((e=>new w({target:e,oldParent:e.parent,newParent:n,runScene:this.runScene}).execute()))):t.push(new w({target:e,oldParent:e.parent,newParent:n,runScene:this.runScene}).execute()),r&&this.runScene.cb.model.setOpen.cb({isOpen:!0,model:r}),this.runScene.cb.model.setOpen.cb({isOpen:!0,model:n}),this.runScene.cb.model.setMainStatue.cb({status:!0,model:n}),this.runScene.undoEx.addUndo(t),this.setSelectByModel(n)}cleanGroup(e,t=!0){if(e instanceof Array){const t=(0,i.multiArrToArr)(e.map((e=>(this.runScene.cb.model.unFocus.cb(e),this.cleanGroup(e,!1)))).filter((e=>e)));return this.runScene.undoEx.addUndo(t),t}if(this.runScene.cb.model.unFocus.cb(e),0!==e.children.length){var r=[];const n=e.children.map((e=>{if(e.parent.parent)return new w({target:e,oldParent:e.parent,newParent:e.parent.parent,runScene:this.runScene})})).filter((e=>e));return r.push(...n.map((e=>e.execute()))),r.push(new A.Z({runScene:this.runScene,model:e,parent:e.parent}).execute()),t&&this.runScene.undoEx.addUndo(r),r}}hideOther(e){const t=e.uuid,r=0<e.children.length;var i=this.runScene.sceneEx.getClearModels();const a=[];i.map((i=>{i.traverse((i=>{r?!1===n().model.deepFindParentByUuid(i,t)&&i.uuid!==e.uuid&&a.push(i):i.uuid!==e.uuid&&a.push(i)}))})),i=a.map((e=>new b.Z({target:e,info:"visible",newVal:!1,runScene:this.runScene,oldVal:e.visible}).execute())),this.runScene.undoEx.addUndo(i),n().model.setParentVisible(e,!0)}showAll(){var e=this.runScene.sceneEx.getClearModels();const t=[];e.map((e=>{e.traverse((e=>{"materialHelper"!==e.name&&!1===e.visible&&t.push(e)}))})),e=t.map((e=>new b.Z({target:e,info:"visible",runScene:this.runScene,newVal:!0,oldVal:e.visible}).execute())),this.runScene.undoEx.addUndo(e)}removeHide(){var e=this.runScene.sceneEx.getClearModels();const t=new Set,r=[];e.map((e=>{e.traverse((e=>{e.visible||t.add(e)}))})),t.forEach((e=>{r.push(new A.Z({runScene:this.runScene,model:e,parent:e.parent}).execute())})),this.runScene.undoEx.addUndo(r)}_getModel(e){var t=this.runScene.uniqueEx.model.nameMap[e];if(t)return this.runScene.uniqueEx.model.get(t)||this.runScene.assetsEx.scene.getObjectByName(e)}getModel(e,t="array"){if(!(e instanceof Array))return this._getModel(e);if("array"===t)return e.map((e=>this._getModel(e)));if("map"===t){const t={};return e.map((e=>{t[e]=this.getModel(e)})),t}}getWorldLocal(e){this.runScene.assetsEx.scene.updateMatrixWorld(!0);var t=new o.Vector3;return e.getWorldPosition(t),t}getClickObj(e,t,r=!1){var i=new o.Raycaster,a=new o.Vector2;let s={intersects:null,obj:null};if(0!==(a.x=e.offsetX/this.runScene.assetsEx.engineDom.clientWidth*2-1,a.y=-e.offsetY/this.runScene.assetsEx.engineDom.clientHeight*2+1,i.setFromCamera(a,this.runScene.assetsEx.camera),e=i.intersectObjects(t,!0)).length)if(r){if(0===(a=e.filter((e=>n().model.isVisible(e.object)))).length)return s;s={intersects:a,obj:a[0].object}}else s={intersects:e,obj:e[0].object};return s}getCamLocal(){var{x:e,y:t,z:r}=this.runScene.assetsEx.camera.position,{x:n,y:i,z:a}=this.runScene.assetsEx.controls.target;return{cx:e,cy:t,cz:r,tx:n,ty:i,tz:a}}camAnima(e,t,r=1,n,i){return(0,B.anima)(e,t,r,(e=>{i&&i(e),this.runScene.assetsEx.camera.position.set(e.cx,e.cy,e.cz),this.runScene.assetsEx.controls.target.set(e.tx,e.ty,e.tz),this.runScene.assetsEx.camera.lookAt(this.runScene.assetsEx.controls.target)}),(e=>{n&&n()}))}setGlow(e,t=!0){t=t?1:0,0==(e.userData.layers=t)?e.layers.set(0):e.layers.enable(1),this.runScene.cb.model.setLayers.cb({model:e,val:t})}setOutline(e,t=!0){e.userData.outline=t,this.runScene.pp.addOutlineObj(e,t),this.runScene.cb.model.setOutline.cb({model:e,val:t})}beforeLoad(e){return e instanceof Array?e.map((e=>this.beforeLoad(e))):e}focus(e){const{scene:t,camera:r,renderer:n,controls:i}=this.runScene.assetsEx.get();var a=new o.Vector3,s=new o.Vector3;if("Mesh"===e.type||"Group"===e.type||"Object3D"===e.type){if((u=this.runScene.helperEx.boxHelper).update(),!u||!u.object)return;let e=(l=n.domElement.getBoundingClientRect()).width/l.height;var l=new o.Vector3,u=u.geometry.attributes.position.array,c=((l.set(Math.abs(u[0]-u[3]),Math.abs(u[1]-u[7]),Math.abs(u[2]-u[14])),s.x=.5*(u[0]+u[3]),s.y=.5*(u[1]+u[7]),s.z=.5*(u[2]+u[14]),u=new o.Vector3).subVectors(r.position,s),u.projectOnPlane(new o.Vector3(0,1,0)),u.normalize(),1<e&&(e=1/e),2*Math.tan(.5*r.fov*Math.PI/180));l=l.length()/e/c,a.addVectors(s,u.multiplyScalar(l))}else t.updateMatrixWorld(!0),c=new o.Vector3,e.getWorldPosition(c),s.set(c.x,c.y,c.z),(u=new o.Vector3).subVectors(r.position,s),u.projectOnPlane(new o.Vector3(0,1,0)),u.normalize(),a.addVectors(s,u.multiplyScalar(3));(0,B.anima)({positionX:r.position.x,positionY:r.position.y,positionZ:r.position.z,targetX:i.target.x,targetY:i.target.y,targetZ:i.target.z},{positionX:a.x,positionY:a.y,positionZ:a.z,targetX:s.x,targetY:s.y,targetZ:s.z},.5,(e=>{r.position.set(e.positionX,e.positionY,e.positionZ),r.lookAt(e.targetX,e.targetY,e.targetZ),i.target.set(e.targetX,e.targetY,e.targetZ),i.update()}))}instance(e){this.runScene.assetsEx.scene.updateMatrixWorld();const t={};e=Array.isArray(e)?e:[e];const r=[];e.map((e=>{e.traverse((e=>{var n;e.geometry&&!U(e)&&(n=G(e))&&(r.push(e),t[n]||(t[n]=new Set),t[n].add(e))}))})),(0,a.js)(t,((e,t)=>{e=this.runScene.uniqueEx.model.get(e),t.size<2||!e||(t=D(e,[...t]),this.runScene.modelEx.add(t,void 0,{isClone:!1,select:!1,addUndo:!1}),H(e)&&this.setGlow(t,!0),this.runScene.modelEx.remove(e,!1))})),r.map((e=>{this.runScene.modelEx.remove(e,!1)}))}reset(){this.runScene.modelEx.selectNull(),this.geometryMap.clear()}getHoverFromModels(e,t,r){const{getOriginData:n,ignoreMove:i}=(0,B.mergeObject)({ignoreMove:!1,getOriginData:!1},r);this.runScene.cb.events.pointer.move.add("get-hover-from-models",(r=>{var a,s,l,u;!i&&this.runScene.events.mouse.isMove||(a=new o.Raycaster,s=new o.Vector2,({engineDom:l,camera:u}=this.runScene.assetsEx.get()),s.x=r.offsetX/l.clientWidth*2-1,s.y=-r.offsetY/l.clientHeight*2+1,a.setFromCamera(s,u),r=a.intersectObjects(e||[],!0),null!=t&&t(0===r.length?null:n?r:r.map((e=>e.object))))}))}}const E=e=>{if(u.includes(e))return"Sprite"===(e=n().model.getModelByType(e)).type&&(e.material.userData.tools=f.Z.tools),e;throw TypeError("")},T=(e,t)=>{t=(t||{}).remove;var{geometry:r,material:n}=e;r&&(null!=r&&r.dispose(),delete e.geometry),n&&((0,m.disposeMaterial)(e.material),e.material.dispose(),delete e.material),!1!==t&&e.parent&&e.parent.remove(e)},D=(e,t)=>{var{material:r,geometry:n}=e;const i=new d.Z.InstancedMesh(n,r,t.length+1);return[e,...t].map(((e,t)=>{e.updateMatrix(),i.setMatrixAt(t,e.matrixWorld)})),i.name=e.name,i},P=(e,t)=>{const r=[];if(t.map((e=>{e=e.geometry,r.push(e)})),t=s.qf(r))return new d.Z.Mesh(t,e)},O=e=>0!==e.animations.length,R=e=>{e&&e.userData&&(e.userData.isHelper=!0)},I=(e,t)=>{null!=t&&(0===t?e.layers.set(0):e.layers.enable(1),(0,v.M)(e,"layers",t))},k=e=>{const t=[];e.traverse((e=>{t.push(e)}))},L=e=>{let t=!1;return e.traverse((e=>{e.isSkinnedMesh&&(t=!0)})),t},F=(e,t)=>{t?(0,v.M)(e,"isDynamic",!0):delete e.userData.isDynamic},U=(e,t)=>e&&t?!!e.userData.isDynamic||!!e.parent&&U(e.parent,t):null==(t=null==e?void 0:e.userData)?void 0:t.isDynamic,G=e=>e.userData.cloneId,j=(e,t)=>{(0,v.M)(e,"cloneId",t)},N=e=>{delete e.userData.cloneId},H=e=>1===e.userData.layers,z=e=>e.isSprite,V=e=>{},J=e=>{var t=new o.Vector3;return(new o.Box3).setFromObject(e).getSize(t),t},K={open(e){delete e.userData.unSelectable},close(e){e.userData.unSelectable=!0},is:e=>void 0===e.userData.unSelectable},W={set(e,t){t?delete e.userData.unNormal:e.userData.unNormal=!0},is:e=>!(0,p.RQ)(e)&&!(0,l.N)(e)&&void 0===e.userData.unNormal,hasUnNormal:e=>void 0!==(null==(e=null==e?void 0:e.userData)?void 0:e.unNormal)}},7738:(e,t,r)=>{"use strict";r.d(t,{Z:()=>i,s:()=>a});var n=r(8881);class i{constructor(e){this.setSize=(e,t)=>{var{width:r,height:n}=this.getDomSize();this.runScene.setSize(e||r,t||n)},this.runScene=e,this.runScene.cb.resize.add("render-ex-resize",(({width:e,height:t})=>{this.setSize(e,t)}))}setBackground(e){this.runScene.assetsEx.engineDom.style.background=e}create(e){var t=new n.WebGLRenderer({antialias:!0,alpha:!0,powerPreference:"high-performance"});return t.domElement.style.position="absolute",t.setPixelRatio(window.devicePixelRatio),t.shadowMap.enabled=!0,t.shadowMap.type=n.PCFSoftShadowMap,t.physicallyCorrectLights=!0,t.localClippingEnabled=!0,e.appendChild(t.domElement),t}getDomSize(){var{clientWidth:e,clientHeight:t}=this.runScene.assetsEx.get().engineDom;return{width:e,height:t}}}const a=(e,t)=>{t=(t||{}).removeDom,!(e.render=()=>{})!==t&&e.domElement.remove(),e.setAnimationLoop(null),e.dispose(),e.renderLists&&e.renderLists.dispose()}},4233:(e,t,r)=>{"use strict";r.d(t,{M:()=>m,ZP:()=>f,bv:()=>y,is:()=>g});var n=r(3685),i=r(4298),a=r(8881),o=r(3765),s=r(3778),l=r(7738),u=r(911),c=r(3735),h=r(2510),d=r(7169),p=function(e,t,r,n){return new(r=r||Promise)((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(o,s)}l((n=n.apply(e,t||[])).next())}))};class f{constructor(e){this.oldFog=null,this.removeMap={light:{valid:e=>this.runScene.lightEx.isLight(e),remove:e=>this.runScene.lightEx.remove(e)}},this.runScene=e}each(e){return this.runScene.assetsEx.get().scene.traverseAncestors(e)}get(){return new Proxy(this.runScene.assetsEx.get().scene,{set:(e,t,r)=>(e[t]=r,!0)})}getNromal(){return this.get().children.filter((e=>!this.runScene.helperEx.isHelper(e)))}remove(e){var t;if(e){if(e instanceof Array){const t=[];return e.map((e=>{for(const a in this.removeMap){var{valid:r,remove:n}=this.removeMap[a];if(r(e))return t.push(...(0,i.multiArrToArr)(n(e)))}t.push(new d.Z({model:e,runScene:this.runScene,parent:e.parent}).execute())})),this.runScene.undoEx.addUndo(t),t}for(const t in this.removeMap){var{valid:r,remove:n}=this.removeMap[t];if(r(e))return n(e)}this.runScene.modelEx.remove(e),null!=(t=this.runScene.helperEx.boxHelper)&&t.setFromObject(this.get())}}cleanUnlessLevel(e){return this.runScene.modelEx.isUnlessLevel(e)&&!this.runScene.helperEx.isHelper(e)&&0!==e.children.length&&1===e.children.length?this.cleanUnlessLevel(e.children[0]):e}searchModel(e){return this.runScene.uniqueEx.model.findModelWithName(e)}getClearModels(){return this.get().children.filter((e=>!this.runScene.helperEx.isHelper(e)&&!this.runScene.lightEx.isLight(e)))}getClear(){var e=this.get();const t=new a.Group;return e.children.filter((e=>!this.runScene.helperEx.isHelper(e)&&!this.runScene.lightEx.isLight(e))).map((e=>{var r=e.clone();(0,s.withAnima)(e)&&(r.animations=[...e.animations]),t.add(r)})),this.runScene.helperEx.setHelper(t),this.cleanUnlessLevel(t)}cleanNormal(){this.getNromal().map((e=>this.remove(e)))}cleanSceneInfo(e){e.background=null,e.environment=null,e.fog=null,this.runScene.cb.setScene.cb({scene:e,type:"any",val:null})}setBackground(e,t=!0){return p(this,void 0,void 0,(function*(){e instanceof String&&(e=yield this.runScene.textureEx.load(e)),(0,u.isTexture)(e)&&(e.userData.isBackgroud=!0);var r=this.get(),n=new h.Z({target:r,info:"background",newVal:e,oldVal:r.background,runScene:this.runScene,cb:e=>{}}).execute();return t&&this.runScene.undoEx.addUndo(n),this.runScene.cb.setScene.cb({scene:r,type:"background",val:r.background}),e}))}isBackground(e){return e.userData.isBackgroud}clean(){this.setBackground(null),this.setEnv(null),this.runScene.tags.clear(),this.runScene.assetsEx.scene.fog=null,this.runScene.helperEx.unfocus(),this.runScene.anima.reset();var e=this.getClearModels();let t=[];e.map((e=>{e.traverse((e=>t.push(e)))})),t.map((e=>{(0,s.disposeModel)(e,{remove:!1}),this.runScene.cb.model.dispose.cb(e)})),(0,l.s)(this.runScene.assetsEx.get().renderer),this.runScene.assetsEx.get().controls.dispose(),this.runScene.assetsEx.reset(),this.runScene.modelEx.reset(),this.cleanSceneInfo(this.get()),this.runScene.cameraEx.reset(this.runScene.assetsEx.get().camera),this.cleanNormal(),this.runScene.assetsEx.get().renderer.resetState(),this.runScene.assetsEx.get().controls.update(),this.runScene.uniqueEx.dispose(),this.runScene.materialEx.dispose(),this.runScene.undoEx.reset(),this.runScene.timeLineEx.reset(),this.runScene.pp.dispose(),this.runScene.pp.init(),this.runScene.helperEx.reset(),this.runScene.cb.reset.cb(this.get())}dispose(){var{renderer:e,controls:t}=this.runScene.assetsEx.get();this.clean(),(0,l.s)(e),t.dispose(),this.runScene.pp.dispose(),a.Cache.clear()}render(){}create(){return new a.Scene}setEnv(e){return p(this,void 0,void 0,(function*(){var t=this.runScene.assetsEx.scene;let r;return e instanceof String&&(r=yield this.runScene.textureEx.load(e)),e instanceof File&&(r=yield this.runScene.textureEx.parse(e)),r=(r=null!=e&&e.isTexture?this.runScene.textureEx.clone(e):r)&&(0,u.setTextureMapping)(r),this.setNormal({model:t,info:"environment",val:r}),this.runScene.cb.setScene.cb({scene:t,type:"environment",val:r}),r}))}setNormal(e,t=!0){var{model:e,info:r,val:n}=e;e=new h.Z({target:e,info:r,oldVal:e[r],newVal:n,runScene:this.runScene}).execute(),t&&this.runScene.undoEx.addUndo(e)}setFogShow(e){var t=this.runScene.assetsEx.scene,{show:e,color:r}=e;e?this.setNormal({model:t,info:"fog",val:this.oldFog||new a.Fog(r||"#ffffff")}):(this.oldFog=t.fog,this.setNormal({model:t,info:"fog",val:null})),this.runScene.cb.setScene.cb({scene:t,type:"fog",val:t.fog})}setFog(e){var t=this.runScene.assetsEx.scene,{type:e,val:r}=e;t=new c.Z({target:t,typeList:["fog",e],newVal:r}).execute(),this.runScene.undoEx.addUndo(t)}sreenShotDefFile(e,t){e=e||Number(prompt("请输入截图的宽"))||1920,t=t||Number(prompt("请输入截图的高"))||1080;var{width:r,height:i}=(this.runScene.helperEx.unfocus(),this.runScene.renderEx.getDomSize()),a=this.runScene.assetsEx.get().renderer.domElement,{renderer:e,scene:t,camera:o}=(a.width=e,a.height=t,this.runScene.renderEx.setSize(e,t),this.runScene.assetsEx.get()),s=(e.render(t,o),a.toDataURL("image/png",1));return s=(0,n.base64ToFile)(s,"screenShot.png"),a.width=r,a.height=i,this.runScene.renderEx.setSize(),e.render(t,o),s}static toJSON(e){var t={};return e.fog&&(t.fog=v(e.fog)),(0,o.isColor)(e.background)&&(t.backgroundColor=e.background.getHexString()),t}setEnvStrength(e){this.runScene.uniqueEx.material.each((t=>{void 0!==t.envMapIntensity&&(t.envMapIntensity=e,(0,o.updateMaterial)(t))}))}}const m=(e,t,r)=>{e.userData[t]=r},v=e=>{var{color:e,far:t,near:r}=e;return{color:e.getHexString(),far:t,near:r}},g=(e,t)=>(null==(e=null==e?void 0:e.userData)?void 0:e[t])||"",y=(e,t)=>{delete e.userData[t]}},911:(e,t,r)=>{"use strict";r.r(t),r.d(t,{bindTextureBaseData:()=>w,default:()=>v,disposeTexture:()=>x,getBlobByTexture:()=>A,getCloneIdFromTexture:()=>P,getMimeByTexture:()=>y,getSizeByTexture:()=>E,getTextureGpuMemory:()=>b,getTextureMinFilter:()=>k,getUrlByTexture:()=>C,initTexture:()=>S,isClonedTexture:()=>D,isTexture:()=>T,loadTexture:()=>B,parseImageBitMapByBlob:()=>M,setTextureCloneId:()=>O,setTextureMapping:()=>_,setTextureMinFilter:()=>I,textureNameMap:()=>g,updateTexture:()=>R});var n=r(9594),i=r(9251),a=r(8881),o=r(5247),s=r(8024),l=r(9887),u=r(3729),c=r(2510);class h extends r(4616).Z{constructor(e){super(),this.info="函数修改",this.map=e}_execute(e,t){throw new Error("Method not implemented.")}execute(){return this.map.redo(),this}undo(){this.map.undo()}redo(){this.map.redo()}}const d=h;var p=r(3765),f=r(4233),m=function(e,t,r,n){return new(r=r||Promise)((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(o,s)}l((n=n.apply(e,t||[])).next())}))};class v{constructor(e){this.allTextures=new Set,this.setAnima=e=>{var{texture:e,type:t,val:r}=e,n=e.userData.uvScript||{};e.userData.uvScript||(e.userData.uvScript=n),0===r?delete n[t]:n[t]=r,this.runScene.cb.texture.setAnima.cb({texture:e,uvScript:n})},this.runScene=e}load(e,t){return m(this,void 0,void 0,(function*(){var r=yield(0,l.urlToBlob)(e);return this.parse(r,t)}))}parse(e,t){return m(this,void 0,void 0,(function*(){t=(0,l.mergeObject)({flipY:!0},t);var r="Blob"===(0,l.getType)(e)?e:yield(0,l.fileToBlob)(e);return this.afterLoad(yield B(r,t),r)}))}clone(e){var t=new a.Texture(e.image);return t.userData=Object.assign(Object.assign({},e.userData),{id:(0,i.getId)(),cloneSourceId:(0,u.K)(e)}),(0,f.bv)(t,"minFilter"),w(t),this.getSameAndAddtoAll(t)}getDef(e){return e=new a.Texture(e),w(e),this.getSameAndAddtoAll(e)}getSameAndAddtoAll(e){var t=e.userData.md5;return(t=this.getSameTexture(t,e))?(x(e),t):(this.initTextureAndAddtoAll(e),e)}afterLoad(e,t){return m(this,void 0,void 0,(function*(){return this.getSameAndAddtoAll(yield w(e,t))}))}getSameTexture(e,t){if(!D(t))for(const n in this.runScene.uniqueEx.texture.map){var r=this.runScene.uniqueEx.texture.get(n);if(r.userData.md5===e&&r.mapping===t.mapping)return r}}initTextureAndAddtoAll(e){return m(this,void 0,void 0,(function*(){return S(e),w(e),this.addTextureToAll(e),e}))}addTextureToAll(e){var t=this.runScene.uniqueEx.texture.getLength();this.runScene.uniqueEx.texture.add(e),this.runScene.uniqueEx.texture.getLength()!==t&&this.runScene.cb.texture.add.cb(e)}getBlobAndBase64(e){return e.userData.blob?e.userData:(0,l.imgBitMapToBlobAndBase64)(e)}coverByImage(e,t){return m(this,void 0,void 0,(function*(){let r;r=T(t)?t:t?yield this.parse(t):null;var i=this.runScene.uniqueEx.texture.getMaterials(this.runScene.uniqueEx.getId(e));if(i){const t=[];(0,n.js)(i,((n,i)=>{const a=this.runScene.uniqueEx.material.get(n);a&&i.forEach((n=>{t.push(new s.Z({target:a,info:n,newVal:r,oldVal:e,runScene:this.runScene}).execute())}))})),this.runScene.undoEx.addUndo(t)}}))}remove(e){const t=(0,u.K)(e);var r=this.runScene.uniqueEx.texture.map[t];if(r){const i=[];r=r.materialMap,(0,n.js)(r,((e,t)=>{const r=this.runScene.uniqueEx.material.get(e);r&&(t.forEach((e=>{i.push(new c.Z({target:r,info:e,oldVal:r[e],newVal:null,runScene:this.runScene,cb(){(0,p.updateMaterial)(r)}}).execute())})),(0,p.updateMaterial)(r))}));const a=this.runScene.uniqueEx.texture.map[t];i.push(new d({undo:()=>{this.runScene.cb.texture.add.cb(e),this.runScene.uniqueEx.texture.add(e)},redo:()=>{this.runScene.cb.texture.remove.cb(e),this.runScene.uniqueEx.texture.remove(e)}}).execute(),new d({undo:()=>{this.runScene.uniqueEx.texture.map[t]=a},redo:()=>{this.runScene.uniqueEx.texture.map[t]=null}}).execute()),this.runScene.undoEx.addUndo(i)}}delete(e){this.runScene.cb.texture.remove.cb(e),this.runScene.uniqueEx.texture.remove(e),x(e)}reverseImageBitMapTexture(e){return m(this,void 0,void 0,(function*(){var{canvas:t,imageBitMap:r}=yield(0,l.reverseImageBitMap)(e.image);const i=new a.Texture(r);return i.needsUpdate=!0,r=this.runScene.uniqueEx.texture.map[e.userData.id],(0,n.js)(r.materialMap,((e,t)=>{const r=this.runScene.uniqueEx.material.get(e);t.forEach((e=>{r[e]=i,this.runScene.uniqueEx.texture.addMaterial(i,{material:r,type:e})}))})),S(i),yield w(i),this.runScene.cb.texture.add.cb(i),this.delete(e),(0,l.disposeCanvas)(t),i}))}}const g={环境遮蔽:"aoMap",法线:"normalMap",金属度:"metalnessMap",粗糙度:"roughnessMap",自发光:"emissiveMap",颜色:"map",置换:"displacementMap",光照贴图:"lightMap",环境:"envMap",透明度:"alphaMap"},y=e=>1023===e.format?"image/png":"image/jpeg",b=e=>{var{width:e,height:t}=e.image;return e*t*4*1.33},x=e=>{var t,r;e&&(t=e.image,r=e.userData.url,t instanceof ImageBitmap?(0,l.disposeImageBitMap)(t):t instanceof HTMLCanvasElement&&(0,l.disposeCanvas)(t),URL.revokeObjectURL(r),e.dispose())},w=(e,t)=>m(void 0,void 0,void 0,(function*(){var r=(0,l.isBlob)(e.userData.blob)?e.userData.blob:null,{md5:n,url:i}=(r=t||r||(yield A(e)),e.userData.blob=r,e.userData);return n||(e.userData.md5=(0,l.getMd5)(yield r.arrayBuffer())),i||(e.userData.url=URL.createObjectURL(r)),e.userData.gm=b(e),e.format=e.userData.format||-1!==r.type.indexOf("png")?1023:1022,e})),A=e=>(0,l.isBlob)(e.userData.blob)?e.userData.blob:(0,l.imgBitMapToBlob)(e.image),S=e=>(e.magFilter=1003,e.wrapS=o.Z.RepeatWrapping,e.wrapT=o.Z.RepeatWrapping,e.encoding=3e3,e.version=3,e.flipY=!1,"nearest"!==k(e)&&(e.minFilter=o.Z.LinearMipmapLinearFilter),e.needsUpdate=!0,e),M=(e,t)=>{var r={resizeQuality:"pixelated"};return null!=t&&t.flipY&&(r.imageOrientation="flipY"),createImageBitmap(e,r)},B=(e,t)=>m(void 0,void 0,void 0,(function*(){var r=yield M(e instanceof Blob?e:yield(0,l.urlToBlob)(e),t);return new a.Texture(r)})),C=e=>null==(e=e.userData)?void 0:e.url,_=(e,t="repeat")=>(e.mapping="repeat"===t?o.Z.EquirectangularReflectionMapping:300,e.needsUpdate=!0,e),E=e=>{var{width:e,height:t}=e.image;return{width:e,height:t}},T=e=>null==e?void 0:e.isTexture,D=e=>0<(null==(e=e.userData.cloneSourceId)?void 0:e.length),P=e=>e.userData.cloneSourceId,O=(e,t)=>{e.userData.cloneSourceId=t},R=e=>{e.needsUpdate=!0},I=(e,t)=>{e.minFilter=o.Z["linear"===t?"LinearMipmapLinearFilter":"NearestFilter"],(0,f.M)(e,"minFilter",t),R(e)},k=e=>(0,f.is)(e,"minFilter")},6651:(e,t,r)=>{"use strict";r.d(t,{ZP:()=>n,d9:()=>i});class n{constructor(e){this.undos=[],this.redos=[],this.dataMap={history:[],index:0},this.runScene=e}undo(){var e;0!==this.undos.length&&(e=this.removeUndos(-1)[0])&&(e instanceof Array?e.reverse().map((e=>e.undo())):e.undo(),this.redos.push(e))}addUndos(e){var t;return this.undos.push(e),t=this.dataMap.history.push(e),this.dataMap.index=this.undos.length-1,this.runScene.cb.undo.addUndos.cb({undoVal:e,undos:this.undos}),t}removeUndos(e){var t;return this.undos.splice(e),t=this.dataMap.history.splice(e),this.dataMap.index=this.undos.length-1,this.runScene.cb.undo.removeUndos.cb({index:e}),t}undoByIndex(e){e>this.dataMap.index?this.undos.slice(this.dataMap.index+1,e+1).map((e=>{e instanceof Array?e.map((e=>e.redo())):e.redo()})):e<this.dataMap.index&&this.undos.slice(e+1,this.dataMap.index+1).reverse().map((e=>{e instanceof Array?e.map((e=>e.undo())):e.undo()})),this.dataMap.index=e,this.runScene.cb.undo.undoByIndex.cb(e)}addUndo(e){this.dataMap.index!==this.undos.length&&this.removeUndos(this.dataMap.index+1),this.addUndos(e)}addRedo(e){this.redos.push(e)}redo(){var e;0!==this.redos.length&&(e=this.redos.splice(-1)[0])&&(e instanceof Array?e.reverse().map((e=>e.redo())):e.redo(),this.addUndo(e))}reset(){this.undos=[],this.redos=[],this.dataMap.history=[],this.dataMap.index=0,this.runScene.cb.undo.reset.cb("")}}var i=function(e){if("object"!=typeof e)return e;if(null===e)return null;if(e){var t,r,n=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(r=i(e[t]),n[t]=r);return n}}},4852:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});class n extends r(4773).Z{constructor(e){super(e),this.type="添加模型",this.isUndoAdd=!0}_execute(e){return Promise.reject()}undo(){this.remove({model:this.model,parent:this.parent,addTree:this.addTree,isClone:this.isClone,runScene:this.runScene})}redo(){this.add({model:this.model,parent:this.parent,addTree:this.addTree,isClone:this.isClone,runScene:this.runScene})}execute(){return this.redo(),this}}},4773:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});class n{constructor(e){this.addTree=!0,this.isClone=!1,this.cb=(e,t)=>{};var{model:e,parent:t,cb:r,addTree:n,isClone:i,runScene:a}=e;this.runScene=a,this.model=e,this.parent=t,!1===n&&(this.addTree=n),!0===i&&(this.isClone=i),r&&(this.cb=r)}remove(e){var{model:e,parent:t,addTree:r,runScene:n}=e;n.modelEx.select===e&&n.modelEx.selectNull(),t.remove(e),r&&n.uniqueEx.model.remove(e),r&&n.cb.model.remove.cb({model:e,parent:t}),this.cb(e,"remove"),n.uniqueEx.material.addModel(e,void 0,e.material)}add(e){var{model:e,parent:t,addTree:r,isClone:n,runScene:i}=e;t.add(e),r&&i.uniqueEx.model.add(e),r&&i.cb.model.add.cb({model:e,parent:t,isClone:n}),this.cb(e,"add"),i.uniqueEx.material.addModel(e,e.material)}}},4616:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});class n{}},8024:(e,t,r)=>{"use strict";r.d(t,{Z:()=>a});var n=r(4330);class i extends r(4616).Z{constructor(e){super(),this.isUndoMaterial=!0,this.type="修改材质";var{target:e,info:t,newVal:r,oldVal:n,runScene:i,cb:a}=e;this.runScene=i,this.target=e,this.info=t,this.newVal=r,this.oldVal=n,this.cb=a}_execute(e,t){if(this.target[this.info]=e,this.target.needsUpdate=!0,n.zX.includes(this.info)){if(!e)return;this.runScene.uniqueEx.texture.addMaterial(e,{material:this.target,type:this.info})}"depthWrite"===this.info&&!0===e&&delete this.target.userData[this.info],null!=(e=this.cb)&&e.call(this,this)}execute(){return this.redo(),this}undo(){this._execute(this.oldVal,this.newVal)}redo(){this._execute(this.newVal,this.oldVal)}}const a=i},3735:(e,t,r)=>{"use strict";r.d(t,{Z:()=>o});var n=r(4298),i=r(9594);class a extends r(4616).Z{constructor(e){super(),this.type="多层级修改",this.isUndoMultipLevel=!0,this.target=e.target,this.typeList=e.typeList,this.new=e.newVal,this.cb=e.cb,this.old=(0,i.qR)(e.target,this.typeList)[(0,n.lastArrayEle)(e.typeList)]}execute(){return this.redo(),this}_execute(e){var t=(0,i.qR)(this.target,this.typeList);t[(0,n.lastArrayEle)(this.typeList)]=e,this.cb&&this.cb(t),"shadow"!==this.typeList[0]&&this.typeList[1]}undo(){this._execute(this.old)}redo(){this._execute(this.new)}}const o=a},2510:(e,t,r)=>{"use strict";r.d(t,{Z:()=>i});class n extends r(4616).Z{constructor(e){super(),this.type="修改属性",this.isUndoNormal=!0,this.cb=e=>{};var{target:e,info:t,oldVal:r,newVal:n,runScene:i,cb:a,executeCb:o}=e;this.runScene=i,this.target=e,this.info=t,this.newVal=n,this.oldVal=r,a&&(this.cb=a),o&&(this.executeCb=o)}_execute(e){var{target:t,info:r}=this;if(this.executeCb)return this.executeCb({target:t,info:r,val:e});this.target[this.info]=e,"name"===this.info&&this.target.isObject3D?(t=this.runScene.uniqueEx.model.parseName(this.target),r=e,this.runScene.cb.model.changeName.cb({model:this.target,name:e=t||e,oldName:r})):"material"===this.info?this.runScene.uniqueEx.material.addModel(this.target,e,e===this.newVal?this.oldVal:this.newVal):"visible"===this.info&&this.runScene.cb.model.setVisible.cb({model:this.target,visible:e}),this.runScene.cb.model.change.cb({type:this.info,model:this.target,val:e}),this.cb(this.target)}execute(){return this.redo(),this}undo(){this._execute(this.oldVal)}redo(){this._execute(this.newVal)}}const i=n},7169:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});class n extends r(4773).Z{constructor(e){super(e),this.type="移除模型",this.isUndoRemove=!0}undo(){this.add({model:this.model,parent:this.parent,addTree:this.addTree,runScene:this.runScene})}redo(){this.remove({model:this.model,parent:this.parent,addTree:this.addTree,runScene:this.runScene})}_execute(e){return Promise.reject()}execute(){return this.redo(),this}}},4380:(e,t,r)=>{"use strict";r.d(t,{Z:()=>i});class n extends r(4616).Z{constructor(e){super(),this.isUndoV3=!0,this.type="三维矩阵修改";var{target:e,info:t,newV3:r,oldV3:n,runScene:i}=e;this.target=e,this.info=t,this.runScene=i,this.newV3=r,this.oldV3=n,this.target.uuid===(null==(e=this.runScene.modelEx.select)?void 0:e.uuid)&&(this.runScene.cb.model.setSelect.cb(null),this.runScene.cb.model.setSelect.cb(this.target))}_execute(e){this.target[this.info].copy(e),this.target.uuid===(null==(e=this.runScene.modelEx.select)?void 0:e.uuid)&&this.runScene.helperEx.focus(this.target)}execute(e=!0){return e&&this.redo(),this}undo(){this._execute(this.oldV3)}redo(){this._execute(this.newV3)}}const i=n},3729:(e,t,r)=>{"use strict";r.d(t,{Z:()=>c,K:()=>h});var n=r(9594),i=r(9251);class a{constructor(e){this.map={},this.removes=[],this.unique=e}add(e,t,r){if(e&&e.userData){let n=e.userData.id;n||(n=(0,i.getId)(),e.userData.id=n),this.map[n]||(this.map[n]={material:e,models:new Set},this.unique.runScene.cb.unique.material.add.cb(e),t&&this.addModel(t,e,r))}}addModel(e,t,r){t&&t.userData&&(t=t.userData.id,null!=(t=this.map[t])&&t.models.add(e)),r&&null!=(t=this.map[r.userData.id])&&t.models.delete(e)}each(e){return this.getAll("values").map((({material:t})=>e(t)))}getAll(e){return Object[e](this.map)}get(e){return null==(e=this.map[e])?void 0:e.material}remove(e){delete this.map[e]}addRemoved(e){this.map[e.uuid]&&this.removes.push(e.uuid)}dispose(){(0,n.js)(this.map,((e,t)=>{t.material.dispose()})),this.map={}}}var o=r(6001),s=r(158);class l extends class{constructor(e){this.map={},this.unique=e}add(e){if(e instanceof Array)return e.map((e=>this.add(e)));let t=e.userData.id;return t||(t=(0,i.getId)(),e.userData.id=t),this.map[t]?void 0:(this.map[t]=e,t)}get(e){return this.map[e]}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));delete this.map[e.userData.id]}}{constructor(){super(...arguments),this.nameMap={},this.parseName=(()=>{const e=e=>{var t=e.lastIndexOf("_");return-1!==t&&(e=e.slice(t+1),o.type.isNumber(e))?Number.parseInt(e):-1},t=(r,n)=>{var i,a=(-1===e(a=r)||-1===(i=a.lastIndexOf("_"))?a:a.slice(0,i))+"_"+n++;return this.nameMap[a]?t(r,n):a},r=e=>Object.keys(this.nameMap).find((t=>this.nameMap[t]===e)),n=["PerspectiveCamera"];return i=>{if(n.includes(i.type))return i.name=i.type;let a=i.name;if(a=a||i.type,this.nameMap[a]){var o=this.nameMap[a];if(this.unique.model.get(o)!==i)return o=-1===(o=e(a))?0:o,o=t(a,o),this.nameMap[o]=this.unique.getId(i),i.name=o}else o=this.unique.getId(i),(i=r(o))&&delete this.nameMap[i],this.nameMap[a]=o}})()}add(e,t){var{reset:r,hasReset:n}=t||{};if(e instanceof Array)return e.map((e=>this.add(e,t)));if(e){let a=e.userData.id;if(a&&!r||(a=(0,i.getId)(),e.userData.id=a),this.map[a]){if(!(n||(0,s.An)(this.unique.runScene)&&(0,s.FW)(this.unique.runScene).coverSameId))return void(e.name!==this.map[a].name&&this.unique.runScene.optionsEx.log(`解析模型出错,${e.name} 与 ${this.map[a].name} 拥有相同的id,请选择任意一个模型导出并删除,并重新导入。`,"base","error"));a=(0,i.getId)(),e.userData.id=a}return this.map[a]=e,this.parseName(e),e.material&&this.unique.material.add(e.material,e),e.children.length?this.add(e.children,t):a}}get(e){return this.map[e]}getModelsWithIds(e){return e.map((e=>this.get(e))).filter((e=>e))}getByName(e){return this.nameMap[e]}getIdByNames(e){return e.map((e=>this.getByName(e))).filter((e=>e))}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));e.traverse((e=>{delete this.nameMap[e.name]})),delete this.map[e.userData.id]}dispose(){this.map={},this.nameMap={}}findModelWithName(e){var t=Object.keys(this.nameMap).filter((t=>{t=t.toLowerCase();var r=e.toLowerCase();return t===r||-1!==t.indexOf(r)}));return t=this.getIdByNames(t),this.getModelsWithIds(t)}}class u{constructor(e){this.map={},this.unique=e}add(e){if(e&&e.userData){if(e instanceof Array)return e.map((e=>this.add(e)));let t=e.userData.id;return t||(t=(0,i.getId)(),e.userData.id=t),this.map[t]?void 0:(this.map[t]={texture:e,materialMap:{}},t)}}getLength(){return Object.keys(this.map).length}addMaterial(e,t,r){var n;e=e.userData.id||this.add(e),t&&(({material:t,type:n}=t),this.map[e].materialMap[t.userData.id]||(this.map[e].materialMap[t.userData.id]=new Set),this.map[e].materialMap[t.userData.id].add(n)),r&&(({material:t,type:n}=r),this.map[e].materialMap[t.userData.id]&&this.map[e].materialMap[t.userData.id].delete(n))}get(e){return null==(e=this.map[e])?void 0:e.texture}getMaterials(e){return null==(e=this.map[e])?void 0:e.materialMap}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));var t=this.map[e.userData.id];t&&((0,n.js)(t.materialMap,((e,t)=>{const r=this.unique.runScene.uniqueEx.material.get(e);r&&t.forEach((e=>{r[e]=null}))})),delete this.map[e.userData.id])}dispose(){(0,n.js)(this.map,((e,t)=>{t.texture.dispose()})),this.map={}}}class c{constructor(e){this.runScene=e,this.model=new l(this),this.material=new a(this),this.texture=new u(this)}getId(e){return e.userData.id}dispose(){this.material.dispose(),this.model.dispose(),this.texture.dispose()}}const h=e=>(null==(e=null==e?void 0:e.userData)?void 0:e.id)||""},9887:(e,t,r)=>{"use strict";r.r(t),r.d(t,{LimitCb:()=>i.cM,addElesFromIndexToArr:()=>i.Rn,angleToNum:()=>a.Zv,anima:()=>i.gY,arrayBufferToBase64:()=>i.sM,arrayBufferToBlobUr:()=>i.oo,arrayToVector3:()=>a.F,base64ToArrayBuffer:()=>i.RG,base64ToBlob:()=>i.Jr,bitMapToCanvas:()=>n.Rd,blobToFile:()=>i.hl,bufferToArrayBuffer:()=>i.cO,canvasToBlob:()=>i._c,changeModelOpc:()=>a.Hg,changeModelOpcs:()=>a.Z7,clone:()=>i.d9,compressImgToUrl:()=>n.jH,deepMergeObject:()=>i.U,disposeCanvas:()=>n.eZ,disposeImageBitMap:()=>n.oZ,domTo2Dui:()=>a.UZ,domTo3DSprite:()=>a.YG,domTo3Dui:()=>a.ol,fileAndBlobToCanvas:()=>i.OE,fileToBlob:()=>i.a_,filterFiles:()=>i.Rz,fromCode:()=>i.Ne,getArrIndexByItem:()=>i.B1,getBetweenByV3:()=>a.A2,getCamAnimaData:()=>a.Gm,getClock:()=>a.aM,getCurve:()=>a.kG,getDistance:()=>a.Sp,getEmptyImageData:()=>n.mH,getFilesByDataTransfer:()=>i.xl,getFilesFromFileList:()=>i.kk,getImg:()=>n.Pk,getImgPixels:()=>n.BW,getImgPixels1:()=>n.Cm,getLine2:()=>a.SI,getMacro:()=>i.Ls,getMd5:()=>i.ZM,getModelMap:()=>a.yT,getNamesByNum:()=>i.nR,getOptions:()=>o.FW,getProgress:()=>i.xC,getRandomColor:()=>i.mr,getRes:()=>i.sR,getResultFromCanvas:()=>n.xK,getTime:()=>i.hK,getTruthBase64:()=>i.Mh,getType:()=>i.oL,getTypeByBase64:()=>i.Op,getTypeFromGlb:()=>o.te,getVideoTexture:()=>a.hX,getWorldLocal:()=>a.VU,hslToRgb:()=>n.ve,imgArrayBufferToBlobUrl:()=>n.lU,imgBitMapToBase64:()=>n.s4,imgBitMapToBlob:()=>n.gW,imgBitMapToBlobAndBase64:()=>n.v1,isBlob:()=>i.Lj,isEditor:()=>o.hz,isEmpty:()=>i.xb,isRunning:()=>o.An,longestCommonPrefix:()=>i.GG,mergeObject:()=>i.Gm,removeUnLess:()=>a.hs,reverseImageBitMap:()=>n.Fs,reverseImg:()=>n.rx,rgbToHsl:()=>n.lC,rmArrEle:()=>i.J9,rmPartOfString:()=>i.h3,sameArr:()=>i.F1,textureToThreeD:()=>a.vp,toCode:()=>i.Ni,toTimeString:()=>i.U9,transByte:()=>i.iM,urlToBlob:()=>i.pX,urlToCanvas:()=>i.o4,validType:()=>i.lG,vector:()=>a.xr});var n=r(5137),i=r(6272),a=r(7453),o=r(158)},5137:(e,t,r)=>{"use strict";r.d(t,{BW:()=>f,Cm:()=>p,Fs:()=>x,Pk:()=>y,Rd:()=>m,eZ:()=>w,gW:()=>l,jH:()=>d,lC:()=>v,lU:()=>h,mH:()=>S,oZ:()=>A,rx:()=>u,s4:()=>s,v1:()=>c,ve:()=>g,xK:()=>b});var n=r(5247),i=r(911),a=r(6272),o=function(e,t,r,n){return new(r=r||Promise)((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(o,s)}l((n=n.apply(e,t||[])).next())}))};const s=e=>{var t=document.createElement("canvas");return t.width=e.width,t.height=e.height,t.getContext("2d").drawImage(e,0,0,t.width,t.height),t.toDataURL()},l=e=>o(void 0,void 0,void 0,(function*(){const t=document.createElement("canvas");return t.width=e.width,t.height=e.height,t.getContext("2d").drawImage(e,0,0,t.width,t.height),new Promise((e=>{t.toBlob((t=>{e(t)}))}))})),u=e=>{var t=document.createElement("canvas"),r=(t.width=e.width,t.height=e.height,t.getContext("2d"));r.translate(0,t.height),r.scale(1,-1),r.drawImage(e,0,0,t.width,t.height)},c=e=>o(void 0,void 0,void 0,(function*(){var t=e.image;const r=document.createElement("canvas");r.width=t.width,r.height=t.height;var n=r.getContext("2d");const a=(0,i.getMimeByTexture)(e);return n.drawImage(t,0,0,r.width,r.height),new Promise((e=>{r.toBlob((t=>{e({blob:t,base64:r.toDataURL(a)})}),a)}))})),h=(e,t)=>URL.createObjectURL(new Blob([e],t)),d=(e,t)=>{const r=document.createElement("canvas");var n=r.getContext("2d");return r.width=e.width,r.height=e.height,n.drawImage(e,0,0,e.width,e.height),new Promise((e=>{r.toBlob((t=>{t&&e(URL.createObjectURL(t))}),"image/webp",t)}))},p=e=>o(void 0,void 0,void 0,(function*(){for(var{bitmap:t,texture:r}=e,{ctx:r,canvas:i}=yield(0,a.OE)(URL.createObjectURL(r.userData.blob),{width:t.width,height:t.height}),o=r.getImageData(0,0,t.width,t.height,{colorSpace:"srgb"}),s=0,l=o.data.length;s<l;s+=4){var u=(h=v(o.data[s],o.data[s+1],o.data[s+2]))[0]/100,c=h[1]/100,h=h[2]/100;u=g(u,c,h),o.data[s]=u[0],o.data[s+1]=u[1],o.data[s+2]=u[2]}return r.putImageData(o,0,0),new n.Z.Texture(i)})),f=e=>{for(var t=(e=e.bitmap).width,r=e.height,n=(e=m(e).ctx).getImageData(0,0,t,r).data,i=[],a=0;a<n/4;a+=1)i.push(n.slice(4*a,4*(a+1)))},m=e=>{var t=document.createElement("canvas"),r=t.getContext("2d");return r.drawImage(e,0,0,e.width,e.height),{ctx:r,canvas:t}},v=(e,t,r)=>{e/=255,t/=255,r/=255;var n,i=Math.max(e,t,r),a=Math.min(e,t,r),o=(i+a)/2;if(i==a)n=l=0;else{var s=i-a,l=.5<o?s/(2-i-a):s/(i+a);switch(i){case e:n=(t-r)/s+(t<r?6:0);break;case t:n=(r-e)/s+2;break;case r:n=(e-t)/s+4}n/=6}return[100*n,100*l,100*o]},g=(e,t,r)=>{var n,i,a,o;return 0==t?i=a=o=r:(i=(n=function(e,t,r){return r<0&&(r+=1),1<r&&--r,r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e})(t=2*r-(r=r<.5?r*(1+t):r+t-r*t),r,e+1/3),a=n(t,r,e),o=n(t,r,e-1/3)),[255*i,255*a,255*o]},y=e=>{const t=new Image;return t.src=e,new Promise((e=>{t.onload=()=>{e(t)}}))},b=(e,t,r)=>{const n=(0,a.Gm)({base64Type:"webp"},r).base64Type;return new Promise(((r,i)=>{"blob"===t?e.toBlob((e=>{(e?r:i)(e)})):"base64"===t&&r(e.toDataURL("image/"+n))}))},x=e=>o(void 0,void 0,void 0,(function*(){var{width:t,height:r}=e,n=document.createElement("canvas"),i=(n.width=t,n.height=r,n.getContext("2d"));if(i)return i.translate(0,r),i.scale(1,-1),i.drawImage(e,0,0,t,r),{imageBitMap:yield createImageBitmap(i.getImageData(0,0,t,r)),canvas:n}})),w=e=>{e.remove()},A=e=>{e.close()},S=e=>{var{width:e,height:t}=e,r=document.createElement("canvas");return r.width=e,r.height=t,r.getContext("2d").drawImage(new Image,0,0),r}},6272:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{B1:()=>getArrIndexByItem,F1:()=>sameArr,GG:()=>longestCommonPrefix,Gm:()=>mergeObject,J9:()=>rmArrEle,Jr:()=>base64ToBlob,Lj:()=>isBlob,Ls:()=>getMacro,Mh:()=>getTruthBase64,Ne:()=>fromCode,Ni:()=>toCode,OE:()=>fileAndBlobToCanvas,Op:()=>getTypeByBase64,RG:()=>base64ToArrayBuffer,Rn:()=>addElesFromIndexToArr,Rz:()=>filterFiles,U:()=>deepMergeObject,U9:()=>toTimeString,ZM:()=>getMd5,_c:()=>canvasToBlob,a_:()=>fileToBlob,cM:()=>LimitCb,cO:()=>bufferToArrayBuffer,d9:()=>clone,gY:()=>anima,h3:()=>rmPartOfString,hK:()=>getTime,hl:()=>blobToFile,iM:()=>transByte,kk:()=>getFilesFromFileList,lG:()=>validType,mr:()=>getRandomColor,nR:()=>getNamesByNum,o4:()=>urlToCanvas,oL:()=>getType,oo:()=>arrayBufferToBlobUr,pX:()=>urlToBlob,sM:()=>arrayBufferToBase64,sR:()=>getRes,xC:()=>getProgress,xb:()=>isEmpty,xl:()=>getFilesByDataTransfer});var _allex_md5__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(1129),_allex_md5__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(_allex_md5__WEBPACK_IMPORTED_MODULE_0__),axios__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(3300),axios__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(axios__WEBPACK_IMPORTED_MODULE_1__),js_funcs_trans_trans_file__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(3685),js_funcs_trans_trans_file__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__.n(js_funcs_trans_trans_file__WEBPACK_IMPORTED_MODULE_2__),js_funcs_type_obj__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(9594),_libs_Anima__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(2958),_UtilsImage__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(5137),__awaiter=function(e,t,r,n){return new(r=r||Promise)((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(o,s)}l((n=n.apply(e,t||[])).next())}))};const anima=(e,t,r,n,i)=>{let a=Object.assign({},e),o=new _libs_Anima__WEBPACK_IMPORTED_MODULE_4__.Q3(a,r,t).eventCallback("onUpdate",(e=>n&&n(a))).eventCallback("onComplete",(e=>{i&&i(),_libs_Anima__WEBPACK_IMPORTED_MODULE_4__.Q3.killTweensOf(o)}));return o},base64ToArrayBuffer=e=>__awaiter(void 0,void 0,void 0,(function*(){-1!==e.indexOf(",")&&(e=getTruthBase64(e));var t=window.atob(e),r=t.length,n=new Uint8Array(r);for(let e=0;e<r;e++)n[e]=t.charCodeAt(e);return n.buffer})),getTruthBase64=e=>e.substring(e.indexOf(",")+1),arrayBufferToBlobUr=e=>URL.createObjectURL(new Blob([e])),arrayBufferToBase64=e=>{let t="";var r=new Uint8Array(e);for(let e=0,n=r.byteLength;e<n;e++)t+=String.fromCharCode(r[e]);return"data:image/jpg;base64,"+window.btoa(t)},urlToBlob=e=>__awaiter(void 0,void 0,void 0,(function*(){return(yield axios__WEBPACK_IMPORTED_MODULE_1___default().get(e,{responseType:"blob"})).data})),base64ToBlob=e=>{let t=e.split(","),r=t[0].match(/:(.*?);/)[1],n=atob(t[1]),i=n.length,a=new Uint8Array(i);for(;i--;)a[i]=n.charCodeAt(i);return new Blob([a],{type:r})},fileToBlob=e=>__awaiter(void 0,void 0,void 0,(function*(){return base64ToBlob(yield(0,js_funcs_trans_trans_file__WEBPACK_IMPORTED_MODULE_2__.toResult)(e,"base64"))})),blobToFile=(e,t)=>new File([e],t),getTypeByBase64=e=>e.substring(e.indexOf(":")+1,e.indexOf(";")),transByte=e=>{let t="";var r=(e=t=e<102.4?e.toFixed(2)+"B":e<1048576?(e/1024).toFixed(2)+"KB":e<1073741824?(e/1048576).toFixed(2)+"M":(e/1073741824).toFixed(2)+"G").indexOf(".");return"00"==e.substr(r+1,2)?e.substring(0,r)+e.substr(r+3,2):t},getMd5=e=>(0,_allex_md5__WEBPACK_IMPORTED_MODULE_0__.md5)(e),fileAndBlobToCanvas=(e,t)=>{var{width:t,height:r}=t;let n=new Image,i=(n.src=e,n.width=t,n.height=r,document.createElement("canvas")),a=(i.width=t,i.height=r,i.getContext("2d"));return new Promise((e=>{n.onload=function(){a.drawImage(n,0,0,i.width,i.height),e({canvas:i,ctx:a})}}))},getFilesByDataTransfer=e=>new Array(e.files.length).fill(0).map(((t,r)=>e.files.item(r))).filter((e=>null!==e)),canvasToBlob=e=>new Promise((t=>{e.toBlob((e=>{t(e)}))})),getRes=(e,t)=>axios__WEBPACK_IMPORTED_MODULE_1___default().get(e,{responseType:t||"arraybuffer"}).then((e=>e.data)).catch((e=>{console.log(e,"加载出错")})),mergeObject=(e,t)=>Object.assign(e,t||{}),getMacro=(e,t=0)=>{let r=setTimeout((()=>(null!==r&&clearTimeout(r),r=null,e())),t)},clone=e=>{if(null===e)return null;if("object"!=typeof e)return e;var t,r,n=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(r=e[t],n[t]=r);return n},getNamesByNum=(e,t,r=1,n)=>new Array(t).fill("").map(((t,i)=>e+(i+r)+(n||""))),getType=e=>e.toString().replace(/(\[object )([a-zA-Z]+)(])/,"$2"),deepMergeObject=(e,t)=>((0,js_funcs_type_obj__WEBPACK_IMPORTED_MODULE_3__.js)(e,((r,n)=>{let i=t[r];void 0!==i&&("Object"===getType(n)&&"Object"===getType(i)&&(i=deepMergeObject(n,i)),e[r]=i)})),e),getArrIndexByItem=(e,t)=>e.find((e=>e===t)),getProgress=(e,t,r=!1)=>{let n=e/t;return r&&(n*=100),Number(n.toFixed(2))},urlToCanvas=e=>__awaiter(void 0,void 0,void 0,(function*(){var t,r,n;if(e)return t=yield(0,_UtilsImage__WEBPACK_IMPORTED_MODULE_5__.Pk)(e),(r=document.createElement("canvas")).width=t.width,r.height=t.height,(n=r.getContext("2d")).drawImage(t,0,0),{img:t,canvas:r,ctx:n};throw TypeError("该参数为空")})),bufferToArrayBuffer=e=>{for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n<e.length;++n)r[n]=e[n];return t},isEmpty=e=>null==e||(Array.isArray(e)||"string"==typeof e?0===e.length:"number"==typeof e?0===e:"object"==typeof e?0===Object.keys(e).length:void 0),isBlob=e=>e&&e instanceof Blob,getTime=e=>{var t=new Date;return t.setTime(t.getTime()+864e5*e),t.getTime()},key="gltf-version-2.0",toCode=e=>{for(var t,r,n=key.length,i=key.split(""),a="",o=0;o<e.length;o++)a+=i[((r=((r=e.charCodeAt(o))-(t=r%n))/n)-(r%=n))/n%n]+i[r]+i[t];return a},fromCode=str=>{for(var st=key.length,b,b1,b2,b3,d=0,s,s=new Array(Math.floor(str.length/3)),b=s.length,i=0;i<b;i++)b1=key.indexOf(str.charAt(d)),d++,b2=key.indexOf(str.charAt(d)),d++,b3=key.indexOf(str.charAt(d)),d++,s[i]=b1*st*st+b2*st+b3;return b=eval("String.fromCharCode("+s.join(",")+")"),b},getFilesFromFileList=e=>{var t=[];for(let n=0;n<e.length;n++){var r=e.item(n);t.push(r)}return t},filterFiles=(e,t)=>"any"===t?e:e.filter((e=>-1!==e.type.indexOf(t))),toTimeString=e=>{if(e)return e.getFullYear()+"/"+(e.getMonth()+1)+"/"+e.getDate()},rmPartOfString=(e,t)=>e.replace(new RegExp(t),""),rmArrEle=(e,t)=>{var r=e.findIndex((e=>e===t));if(-1!==r)return e.splice(r,1),r},addElesFromIndexToArr=(e,t,r)=>(t=Array.isArray(t)?t:[t],e.splice(r,0,...t)),sameArr=(e,t,r)=>{if("fill"===r){for(var[n,i]of e)if(n!==t[i])return!1}else{var a=e.length;const n=Math.floor(a/r);for(const i of new Array(r).fill("").map(((e,t)=>(t+1)*n)))if(e[i]!==t[i])return!1}return!0};class LimitCb{constructor(){this.timer=0}update(e){var{cb:e,now:t,cbRate:r}=e;this.timer+=t,this.timer>r&&(e(),this.timer=0)}}const longestCommonPrefix=e=>{if(0==e.length)return"";for(var t=e[0],r="",n=1;n<e.length;n++){for(var i=0;i<=e[n].length;i++){if(t[i]!=e[n][i]){t=r;break}r+=t[i]}r=""}return t},getRandomColor=()=>{var e=[];for(let r=0;r<3;++r){var t=1==(t=Math.floor(256*Math.random()).toString(16)).length?"0"+t:t;e.push(t)}return"#"+e.join("")},validType=(e,t)=>{var r;return"number"===t?(r=Number(e),!isNaN(r)):"array"===t?Array.isArray(e):void 0}},158:(e,t,r)=>{"use strict";r.d(t,{An:()=>a,FW:()=>o,hz:()=>i,te:()=>n});const n=e=>{},i=e=>"editor"===e.optionsEx.options.mode,a=e=>"running"===e.optionsEx.options.mode,o=e=>e.optionsEx.options},7453:(e,t,r)=>{"use strict";r.d(t,{Zv:()=>ue,F:()=>se,Hg:()=>te,Z7:()=>re,UZ:()=>$,YG:()=>ee,ol:()=>q,A2:()=>de,Gm:()=>he,aM:()=>pe,kG:()=>oe,Sp:()=>Y,SI:()=>le,yT:()=>ce,hX:()=>ae,VU:()=>X,hs:()=>ie,vp:()=>ne,xr:()=>Z});var n=r(8881);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function o(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=s(e);if(r=t?(r=s(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===i(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var l=new n.Box3,u=new n.Vector3,c=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e);var r=o(i);function i(){var e;if(!(this instanceof i))throw new TypeError("Cannot call a class as a function");return(e=r.call(this)).isLineSegmentsGeometry=!0,e.type="LineSegmentsGeometry",e.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),e.setAttribute("position",new n.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),e.setAttribute("uv",new n.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),e}return t=i,(e=[{key:"applyMatrix4",value:function(e){var t=this.attributes.instanceStart,r=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),r.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"setPositions",value:function(e){var t;return e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e)),e=new n.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceStart",new n.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceEnd",new n.InterleavedBufferAttribute(e,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}},{key:"setColors",value:function(e){var t;return e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e)),e=new n.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceColorStart",new n.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceColorEnd",new n.InterleavedBufferAttribute(e,3,3)),this}},{key:"fromWireframeGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromEdgesGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromMesh",value:function(e){return this.fromWireframeGeometry(new n.WireframeGeometry(e.geometry)),this}},{key:"fromLineSegments",value:function(e){return e=e.geometry,this.setPositions(e.attributes.position.array),this}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new n.Box3);var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),l.setFromBufferAttribute(t),this.boundingBox.union(l))}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new n.Sphere),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){for(var r=this.boundingSphere.center,i=(this.boundingBox.getCenter(r),0),a=0,o=e.count;a<o;a++)u.fromBufferAttribute(e,a),i=Math.max(i,r.distanceToSquared(u)),u.fromBufferAttribute(t,a),i=Math.max(i,r.distanceToSquared(u));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}},{key:"toJSON",value:function(){}},{key:"applyMatrix",value:function(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(n.InstancedBufferGeometry);function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function d(e,t){return(d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}n.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new n.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},n.ShaderLib.line={uniforms:n.UniformsUtils.merge([n.UniformsLib.common,n.UniformsLib.fog,n.UniformsLib.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// get the offset direction as perpendicular to the view vector\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 offset;\n\t\t\t\tif ( position.y < 0.5 ) {\n\n\t\t\t\t\toffset = normalize( cross( start.xyz, worldDir ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toffset = normalize( cross( end.xyz, worldDir ) );\n\n\t\t\t\t}\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\tfloat forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// extend the line bounds to encompass endcaps\n\t\t\t\t\tstart.xyz += - worldDir * linewidth * 0.5;\n\t\t\t\t\tend.xyz += worldDir * linewidth * 0.5;\n\n\t\t\t\t\t// shift the position of the quad so it hugs the forward edge of the line\n\t\t\t\t\toffset.xy -= dir * forwardOffset;\n\t\t\t\t\toffset.z += 0.5;\n\n\t\t\t\t#endif\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\toffset.xy += dir * 2.0 * forwardOffset;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth * 0.5;\n\n\t\t\t\t// set the world position\n\t\t\t\tworldPos = ( position.y < 0.5 ) ? start : end;\n\t\t\t\tworldPos.xyz += offset;\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"};var m=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=f(e);if(r=t?(r=f(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===h(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return p(n)}}(i);function i(e){var t;if(this instanceof i)return(t=r.call(this,{type:"LineMaterial",uniforms:n.UniformsUtils.clone(n.ShaderLib.line.uniforms),vertexShader:n.ShaderLib.line.vertexShader,fragmentShader:n.ShaderLib.line.fragmentShader,clipping:!0})).isLineMaterial=!0,Object.defineProperties(p(t),{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(e){!0===e?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashed:{enumerable:!0,get:function(){return Boolean("USE_DASH"in this.defines)},set:function(e){Boolean(e)!==Boolean("USE_DASH"in this.defines)&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},alphaToCoverage:{enumerable:!0,get:function(){return Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)},set:function(e){Boolean(e)!==Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),!0===e?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),t.setValues(e),t;throw new TypeError("Cannot call a class as a function")}return t=i,Object.defineProperty(t,"prototype",{writable:!1}),t}(n.ShaderMaterial);function v(e){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function g(e,t){return(g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var b,x,w,A,S=new n.Vector3,M=new n.Vector3,B=new n.Vector4,C=new n.Vector4,_=new n.Vector4,E=new n.Vector3,T=new n.Matrix4,D=new n.Line3,P=new n.Vector3,O=new n.Box3,R=new n.Sphere,I=new n.Vector4;function k(e,t,r){return I.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),I.multiplyScalar(1/I.w),I.x=A/r.width,I.y=A/r.height,I.applyMatrix4(e.projectionMatrixInverse),I.multiplyScalar(1/I.w),Math.abs(Math.max(I.x,I.y))}var L=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&g(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=y(e);if(r=t?(r=y(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===v(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new c,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new m({color:16777215*Math.random()}),n=this,a=i;if(n instanceof a)return(n=r.call(this,e,t)).isLineSegments2=!0,n.type="LineSegments2",n;throw new TypeError("Cannot call a class as a function")}return t=i,(e=[{key:"computeLineDistances",value:function(){for(var e=this.geometry,t=e.attributes.instanceStart,r=e.attributes.instanceEnd,i=new Float32Array(2*t.count),a=0,o=0,s=t.count;a<s;a++,o+=2)S.fromBufferAttribute(t,a),M.fromBufferAttribute(r,a),i[o]=0===o?0:i[o-1],i[o+1]=i[o]+S.distanceTo(M);var l=new n.InstancedInterleavedBuffer(i,2,1);return e.setAttribute("instanceDistanceStart",new n.InterleavedBufferAttribute(l,1,0)),e.setAttribute("instanceDistanceEnd",new n.InterleavedBufferAttribute(l,1,1)),this}},{key:"raycast",value:function(e,t){var r=this.material.worldUnits,i=e.camera,a=(null!==i||r||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),void 0!==e.params.Line2&&e.params.Line2.threshold||0),o=(b=e.ray,e=this.matrixWorld,this.geometry),s=this.material;if(A=s.linewidth+a,x=o.attributes.instanceStart,w=o.attributes.instanceEnd,null===o.boundingSphere&&o.computeBoundingSphere(),R.copy(o.boundingSphere).applyMatrix4(e),a=r?.5*A:k(i,Math.max(i.near,R.distanceToPoint(b.origin)),s.resolution),R.radius+=a,!1!==b.intersectsSphere(R)&&(null===o.boundingBox&&o.computeBoundingBox(),O.copy(o.boundingBox).applyMatrix4(e),a=r?.5*A:k(i,Math.max(i.near,O.distanceToPoint(b.origin)),s.resolution),O.expandByScalar(a),!1!==b.intersectsBox(O)))if(r)for(var l=t,u=0,c=x.count;u<c;u++){D.start.fromBufferAttribute(x,u),D.end.fromBufferAttribute(w,u);var h=new n.Vector3,d=new n.Vector3;b.distanceSqToSegment(D.start,D.end,d,h),d.distanceTo(h)<.5*A&&l.push({point:d,pointOnLine:h,distance:b.origin.distanceTo(d),object:this,face:null,faceIndex:u,uv:null,uv2:null})}else{var p=this,f=t,m=(o=i).projectionMatrix,v=p.material.resolution,g=p.matrixWorld,y=(e=p.geometry).attributes.instanceStart,S=e.attributes.instanceEnd,M=-o.near;b.at(1,_),_.w=1,_.applyMatrix4(o.matrixWorldInverse),_.applyMatrix4(m),_.multiplyScalar(1/_.w),_.x*=v.x/2,_.y*=v.y/2,_.z=0,E.copy(_),T.multiplyMatrices(o.matrixWorldInverse,g);for(var I,L,F,U,G=0,j=y.count;G<j;G++)B.fromBufferAttribute(y,G),C.fromBufferAttribute(S,G),B.w=1,C.w=1,B.applyMatrix4(T),C.applyMatrix4(T),B.z>M&&C.z>M||(B.z>M?(I=B.z-C.z,I=(B.z-M)/I,B.lerp(C,I)):C.z>M&&(I=C.z-B.z,L=(C.z-M)/I,C.lerp(B,L)),B.applyMatrix4(m),C.applyMatrix4(m),B.multiplyScalar(1/B.w),C.multiplyScalar(1/C.w),B.x*=v.x/2,B.y*=v.y/2,C.x*=v.x/2,C.y*=v.y/2,D.start.copy(B),D.start.z=0,D.end.copy(C),D.end.z=0,L=D.closestPointToPointParameter(E,!0),D.at(L,P),F=-1<=(F=n.MathUtils.lerp(B.z,C.z,L))&&F<=1,U=E.distanceTo(P)<.5*A,F&&U&&(D.start.fromBufferAttribute(y,G),D.end.fromBufferAttribute(S,G),D.start.applyMatrix4(g),D.end.applyMatrix4(g),F=new n.Vector3,U=new n.Vector3,b.distanceSqToSegment(D.start,D.end,U,F),f.push({point:U,pointOnLine:F,distance:b.origin.distanceTo(U),object:p,face:null,faceIndex:G,uv:null,uv2:null})))}}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(n.Mesh);function F(e){return(F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function U(){return(U="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=j(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function G(e,t){return(G=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var N=function(){var e=n,t=c;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&G(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=j(e);if(r=t?(r=j(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===F(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){var e;if(this instanceof n)return(e=r.call(this)).isLineGeometry=!0,e.type="LineGeometry",e;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"setPositions",value:function(e){for(var t=e.length-3,r=new Float32Array(2*t),i=0;i<t;i+=3)r[2*i]=e[i],r[2*i+1]=e[i+1],r[2*i+2]=e[i+2],r[2*i+3]=e[i+3],r[2*i+4]=e[i+4],r[2*i+5]=e[i+5];return U(j(n.prototype),"setPositions",this).call(this,r),this}},{key:"setColors",value:function(e){for(var t=e.length-3,r=new Float32Array(2*t),i=0;i<t;i+=3)r[2*i]=e[i],r[2*i+1]=e[i+1],r[2*i+2]=e[i+2],r[2*i+3]=e[i+3],r[2*i+4]=e[i+4],r[2*i+5]=e[i+5];return U(j(n.prototype),"setColors",this).call(this,r),this}},{key:"fromLine",value:function(e){return e=e.geometry,this.setPositions(e.attributes.position.array),this}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();function H(e){return(H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function z(e,t){return(z=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function V(e){return(V=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var J=function(){var e=n,t=L;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&z(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=V(e);if(r=t?(r=V(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===H(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new N,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new m({color:16777215*Math.random()}),i=this,a=n;if(i instanceof a)return(i=r.call(this,e,t)).isLine2=!0,i.type="Line2",i;throw new TypeError("Cannot call a class as a function")}return e=n,Object.defineProperty(e,"prototype",{writable:!1}),e}(),K=r(699),W=r(3693),Q=r(5247);const X=(e,t)=>(t.updateMatrixWorld(!0),t=new Q.Z.Vector3,e.getWorldPosition(t),t),Z={parse(e){var{x:e,y:t,z:r}=e;return void 0===r?new n.Vector2(e,t):new n.Vector3(e,t,r)},toJSON(e){var{x:e,y:t,z:r}=e;return null==r?{x:e,y:t}:{x:e,y:t,z:r}}},Y=(e,t)=>e.distanceTo(t),q=e=>new W.cp(e),$=e=>new K.j(e),ee=e=>new W.P7(e),te=(e,t=.5,r=!1)=>{if("Group"===e.type)throw TypeError("该模型为Group类型");if(!e.material)throw TypeError("该模型没有材质");void 0===e.material.oldOpc&&(e.material.oldOpc=e.material.opacity,e.material.oldTransparent=e.material.transparent),r?(e.material.opacity=e.material.oldOpc,e.material.transparent=e.material.oldTransparent):1===t?(e.material.transparent=!1,e.material.opacity=1):(e.material.transparent=!0,e.material.opacity=t)},re=(e,t,r)=>{"Group"===e.type||"Object3D"===e.type?e.children.forEach((e=>re(e,t,r))):te(e,t,r)},ne=e=>(e.mapping=n.EquirectangularReflectionMapping,e),ie=e=>{let t=e=>"Group"!==e.type&&"Object3D"!==e.type||1!==e.children.length?e:t(e.children[0]);return t(e)},ae=(e,t)=>{var r=document.createElement("video");return r.style="position:absolute;top:0;left:0;z-index:1000000;",r.src=e,r.loop="loop",r.muted="muted",r.play(),t.appendChild(r),new n.VideoTexture(r)},oe=(e,t=!1)=>{e=new n.CatmullRomCurve3(e);var r=new n.BufferGeometry,i=e.getSpacedPoints(100);return r.setFromPoints(i),i=new n.LineBasicMaterial({color:26214}),(r=new n.Line(r,i)).visible=t,{line:r,curve:e}},se=e=>{let t=0;const r=[],i={},a={0:"x",1:"y",2:"z"};return e.map((e=>{var o,s,l;3===t&&(t=0,({x:o,y:s,z:l}=i),r.push(new n.Vector3(o,s,l))),i[a[t]]=e,t++})),r},le=e=>{var t,{pointArray:e,material:t,lineWidth:r,colorArray:i}=e,a=new N;return a.setPositions(e),e=t||new m({transparent:!0,side:n.DoubleSide,linewidth:r||5,vertexColors:!0}),(a.setColors(i||[1,1,1]),e.resolution.set(window.innerWidth,window.innerHeight),t=new J(a,e)).name="gw",t.computeLineDistances(),t},ue=e=>3.1415926*e/180,ce=(e,t="name",r)=>{const n={};return e.traverse((e=>{"id"===t?n[e.userData.id]=e:n[e[t]]=e,null!=r&&r(e)})),n},he=(e,t,r,n,i,a)=>({cx:e,cy:t,cz:r,tx:n,ty:i,tz:a}),de=(e,t)=>{var{x:e,y:r,z:n}=e,{x:t,y:i,z:a}=t;return{x:e-t,y:r-i,z:n-a}},pe=()=>new Q.Z.Clock},1129:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__1129__},3300:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__3300__},6001:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__6001__},4356:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__4356__},8881:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__8881__},7937:e=>{"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__7937__},4819:(e,t,r)=>{"use strict";r.d(t,{T:()=>c,w:()=>s});var n=r(8881);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){t&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var s=function(){function e(){i(this,e),this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}return o(e,[{key:"setSize",value:function(){}},{key:"render",value:function(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}}]),e}(),l=new n.OrthographicCamera(-1,1,1,-1,0,1),u=new n.BufferGeometry,c=(u.setAttribute("position",new n.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),u.setAttribute("uv",new n.Float32BufferAttribute([0,2,0,0,2,0],2)),function(){function e(t){i(this,e),this._mesh=new n.Mesh(u,t)}return o(e,[{key:"dispose",value:function(){this._mesh.geometry.dispose()}},{key:"render",value:function(e){e.render(this._mesh,l)}},{key:"material",get:function(){return this._mesh.material},set:function(e){this._mesh.material=e}}]),e}())},5180:(e,t,r)=>{"use strict";r.d(t,{T:()=>u});var n=r(8881),i=r(4819);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return(o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function s(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===a(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=function(e){var t=a;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e);var r=s(a);function a(e,t){var o;if(this instanceof a)return(o=r.call(this)).textureID=void 0!==t?t:"tDiffuse",e instanceof n.ShaderMaterial?(o.uniforms=e.uniforms,o.material=e):e&&(o.uniforms=n.UniformsUtils.clone(e.uniforms),o.material=new n.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:o.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),o.fsQuad=new i.T(o.material),o;throw new TypeError("Cannot call a class as a function")}return t=a,(e=[{key:"render",value:function(e,t,r){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=r.texture),this.fsQuad.material=this.material,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)),this.fsQuad.render(e)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),a}(i.w)},699:(e,t,r)=>{"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(){return(s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=u(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function l(e,t){return(l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}r.d(t,{M:()=>v,j:()=>c});var c=function(e){var t=a;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,i=u(e);if(r=t?(r=u(this).constructor,Reflect.construct(i,arguments,r)):i.apply(this,arguments),i=this,r&&("object"===n(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==i)return i;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(a);function a(){var e,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return i(this,a),(e=r.call(this)).isCSS2DObject=!0,e.element=t,e.element.style.position="absolute",e.element.style.userSelect="none",e.element.setAttribute("draggable",!1),e.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),e}return o(a,[{key:"copy",value:function(e,t){return s(u(a.prototype),"copy",this).call(this,e,t),this.element=e.element.cloneNode(!0),this}}]),a}((t=r(8881)).Object3D),h=new t.Vector3,d=new t.Matrix4,p=new t.Matrix4,f=new t.Vector3,m=new t.Vector3,v=o((function e(){var t,r,n,a,o=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},s=(i(this,e),this),l={objects:new WeakMap},u=void 0!==o.element?o.element:document.createElement("div");function c(e,t){return f.setFromMatrixPosition(e.matrixWorld),m.setFromMatrixPosition(t.matrixWorld),f.distanceToSquared(m)}u.style.overflow="hidden",this.domElement=u,this.getSize=function(){return{width:t,height:r}},this.render=function(e,t){!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),d.copy(t.matrixWorldInverse),p.multiplyMatrices(t.projectionMatrix,d),function e(t,r,i){var o;t.isCSS2DObject&&(h.setFromMatrixPosition(t.matrixWorld),h.applyMatrix4(p),o=!0===t.visible&&-1<=h.z&&h.z<=1&&!0===t.layers.test(i.layers),t.element.style.display=1==o?"":"none",1==o&&(t.onBeforeRender(s,r,i),(o=t.element).style.transform="translate(-50%,-50%) translate("+(h.x*n+n)+"px,"+(-h.y*a+a)+"px)",o.parentNode!==u&&u.appendChild(o),t.onAfterRender(s,r,i)),o={distanceToCameraSquared:c(i,t)},l.objects.set(t,o));for(var d=0,f=t.children.length;d<f;d++)e(t.children[d],r,i)}(e,e,t);for(var r=function(e){var t=[];return e.traverse((function(e){e.isCSS2DObject&&t.push(e)})),t}(e).sort((function(e,t){return e.renderOrder!==t.renderOrder?t.renderOrder-e.renderOrder:l.objects.get(e).distanceToCameraSquared-l.objects.get(t).distanceToCameraSquared})),i=r.length,o=0,f=r.length;o<f;o++)r[o].element.style.zIndex=i-o},this.setSize=function(e,i){n=(t=e)/2,a=(r=i)/2,u.style.width=e+"px",u.style.height=i+"px"}}))},3693:(e,t,r)=>{"use strict";r.d(t,{P7:()=>g,cp:()=>v,lX:()=>x});var n=r(8881);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(){return(l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}function c(e,t){return(c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=d(e);if(r=t?(r=d(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===i(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var p=new n.Vector3,f=new n.Quaternion,m=new n.Vector3,v=function(){u(t,n.Object3D);var e=h(t);function t(){var r,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return a(this,t),(r=e.call(this)).isCSS3DObject=!0,r.element=n,r.element.style.position="absolute",r.element.style.pointerEvents="auto",r.element.style.userSelect="none",r.element.setAttribute("draggable",!1),r.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),r}return s(t,[{key:"copy",value:function(e,r){return l(d(t.prototype),"copy",this).call(this,e,r),this.element=e.element.cloneNode(!0),this}}]),t}(),g=function(){u(t,v);var e=h(t);function t(r){return a(this,t),(r=e.call(this,r)).isCSS3DSprite=!0,r.rotation2D=0,r}return s(t,[{key:"copy",value:function(e,r){return l(d(t.prototype),"copy",this).call(this,e,r),this.rotation2D=e.rotation2D,this}}]),t}(),y=new n.Matrix4,b=new n.Matrix4,x=s((function e(){var t,r,n,i,o=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},s=(a(this,e),this),l={camera:{fov:0,style:""},objects:new WeakMap},u=void 0!==o.element?o.element:document.createElement("div"),c=(u.style.overflow="hidden",this.domElement=u,document.createElement("div"));function h(e){return Math.abs(e)<1e-10?0:e}function d(e){return"matrix3d("+h((e=e.elements)[0])+","+h(-e[1])+","+h(e[2])+","+h(e[3])+","+h(e[4])+","+h(-e[5])+","+h(e[6])+","+h(e[7])+","+h(e[8])+","+h(-e[9])+","+h(e[10])+","+h(e[11])+","+h(e[12])+","+h(-e[13])+","+h(e[14])+","+h(e[15])+")"}function v(e){return"translate(-50%,-50%)matrix3d("+h((e=e.elements)[0])+","+h(e[1])+","+h(e[2])+","+h(e[3])+","+h(-e[4])+","+h(-e[5])+","+h(-e[6])+","+h(-e[7])+","+h(e[8])+","+h(e[9])+","+h(e[10])+","+h(e[11])+","+h(e[12])+","+h(e[13])+","+h(e[14])+","+h(e[15])+")"}c.style.transformStyle="preserve-3d",c.style.pointerEvents="none",u.appendChild(c),this.getSize=function(){return{width:t,height:r}},this.render=function(e,t){var r=t.projectionMatrix.elements[5]*i,a=(l.camera.fov!==r&&(u.style.perspective=t.isPerspectiveCamera?r+"px":"",l.camera.fov=r),!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),t.isOrthographicCamera&&(a=-(t.right+t.left)/2,o=(t.top+t.bottom)/2),t.isOrthographicCamera?"scale("+r+")translate("+h(a)+"px,"+h(o)+"px)"+d(t.matrixWorldInverse):"translateZ("+r+"px)"+d(t.matrixWorldInverse)),o=a+"translate("+n+"px,"+i+"px)";l.camera.style!==o&&(c.style.transform=o,l.camera.style=o),function e(t,r,n,i){var a,o,u;t.isCSS3DObject&&(a=!0===t.visible&&!0===t.layers.test(n.layers),t.element.style.display=1==a?"":"none",1==a&&(t.onBeforeRender(s,r,n),a=t.isCSS3DSprite?(y.copy(n.matrixWorldInverse),y.transpose(),0!==t.rotation2D&&y.multiply(b.makeRotationZ(t.rotation2D)),t.matrixWorld.decompose(p,f,m),y.setPosition(p),y.scale(m),y.elements[3]=0,y.elements[7]=0,y.elements[11]=0,y.elements[15]=1,v(y)):v(t.matrixWorld),o=t.element,void 0!==(u=l.objects.get(t))&&u.style===a||(u={style:o.style.transform=a},l.objects.set(t,u)),o.parentNode!==c&&c.appendChild(o),t.onAfterRender(s,r,n)));for(var h=0,d=t.children.length;h<d;h++)e(t.children[h],r,n,i)}(e,e,t,a)},this.setSize=function(e,a){n=(t=e)/2,i=(r=a)/2,u.style.width=e+"px",u.style.height=a+"px",c.style.width=e+"px",c.style.height=a+"px"}}))},4091:(e,t,r)=>{"use strict";r.d(t,{qf:()=>function(e){for(var t,r,a=1<arguments.length&&void 0!==arguments[1]&&arguments[1],o=null!==e[0].index,s=new Set(Object.keys(e[0].attributes)),l=new Set(Object.keys(e[0].morphAttributes)),u={},c={},h=e[0].morphTargetsRelative,d=new n.BufferGeometry,p=0,f=0;f<e.length;++f){var m,v,g=e[f],y=0;if(o!=(null!==g.index))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(m in g.attributes){if(!s.has(m))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+'. All geometries must have compatible attributes; make sure "'+m+'" attribute exists among all geometries, or in none of them.'),null;void 0===u[m]&&(u[m]=[]),u[m].push(g.attributes[m]),y++}if(y!==s.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". Make sure all geometries have the same number of attributes."),null;if(h!==g.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(v in g.morphAttributes){if(!l.has(v))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". .morphAttributes must be consistent throughout all geometries."),null;void 0===c[v]&&(c[v]=[]),c[v].push(g.morphAttributes[v])}if(d.userData.mergedUserData=d.userData.mergedUserData||[],d.userData.mergedUserData.push(g.userData),a){var b=void 0;if(o)b=g.index.count;else{if(void 0===g.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". The geometry must have either an index or a position attribute"),null;b=g.attributes.position.count}d.addGroup(p,b,f),p+=b}}if(o){for(var x=0,w=[],A=0;A<e.length;++A){for(var S=e[A].index,M=0;M<S.count;++M)w.push(S.getX(M)+x);x+=e[A].attributes.position.count}d.setIndex(w)}for(t in u){var B=i(u[t]);if(!B)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+t+" attribute."),null;d.setAttribute(t,B)}for(r in c){var C=c[r][0].length;if(0===C)break;d.morphAttributes=d.morphAttributes||{},d.morphAttributes[r]=[];for(var _=0;_<C;++_){for(var E=[],T=0;T<c[r].length;++T)E.push(c[r][T][_]);var D=i(E);if(!D)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+r+" morphAttribute."),null;d.morphAttributes[r].push(D)}}return d}});var n=r(8881);function i(e){for(var t,r,i,a=0,o=0;o<e.length;++o){var s=e[o];if(s.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if((t=void 0===t?s.array.constructor:t)!==s.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if((r=void 0===r?s.itemSize:r)!==s.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if((i=void 0===i?s.normalized:i)!==s.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;a+=s.array.length}for(var l=new t(a),u=0,c=0;c<e.length;++c)l.set(e[c].array,u),u+=e[c].array.length;return new n.BufferAttribute(l,r,i)}}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];return void 0!==t||(t=__webpack_module_cache__[e]={exports:{}},__webpack_modules__[e].call(t.exports,t,t.exports,__webpack_require__)),t.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};return(()=>{"use strict";__webpack_require__.d(__webpack_exports__,{default:()=>Ts});var e={},t=(__webpack_require__.r(e),__webpack_require__.d(e,{AsyncCompress:()=>ki,AsyncDecompress:()=>Zi,AsyncDeflate:()=>_i,AsyncGunzip:()=>Gi,AsyncGzip:()=>ki,AsyncInflate:()=>Pi,AsyncUnzipInflate:()=>ba,AsyncUnzlib:()=>Ki,AsyncZipDeflate:()=>ma,AsyncZlib:()=>zi,Compress:()=>Ii,DecodeUTF8:()=>ra,Decompress:()=>Xi,Deflate:()=>Ci,EncodeUTF8:()=>na,Gunzip:()=>Ui,Gzip:()=>Ii,Inflate:()=>Di,Unzip:()=>xa,UnzipInflate:()=>ya,UnzipPassThrough:()=>ga,Unzlib:()=>Ji,Zip:()=>va,ZipDeflate:()=>fa,ZipPassThrough:()=>pa,Zlib:()=>Hi,compress:()=>Li,compressSync:()=>Fi,decompress:()=>function(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return(31==e[0]&&139==e[1]&&8==e[2]?ji:8!=(15&e[0])||7<e[0]>>4||(e[0]<<8|e[1])%31?Oi:Wi)(e,t,r)},decompressSync:()=>function(e,t){return(31==e[0]&&139==e[1]&&8==e[2]?Ni:8!=(15&e[0])||7<e[0]>>4||(e[0]<<8|e[1])%31?Ri:Qi)(e,t)},deflate:()=>Ei,deflateSync:()=>Ti,gunzip:()=>ji,gunzipSync:()=>Ni,gzip:()=>Li,gzipSync:()=>Fi,inflate:()=>Oi,inflateSync:()=>Ri,strFromU8:()=>aa,strToU8:()=>ia,unzip:()=>function(e,t){if("function"!=typeof t)throw"no callback";for(var r=[],n=function(){for(var e=0;e<r.length;++e)r[e]()},i={},a=e.length-22;101010256!=gi(e,a);--a)if(!a||65558<e.length-a)return void t("invalid zip file",null);var o=vi(e,a+8);o||t(null,{});var s=o,l=gi(e,a+16),u=4294967295==l;if(u){if(a=gi(e,a-12),101075792!=gi(e,a))return void t("invalid zip file",null);s=o=gi(e,a+32),l=gi(e,a+48)}for(var c=function(a){function s(e,r){e?(n(),t(e,null)):(i[p]=r,--o||t(null,i))}var c=(m=la(e,l,u))[0],h=m[1],d=m[2],p=m[3],f=m[4],m=m[5];if(m=sa(e,m),l=f,c)if(8==c)if(f=e.subarray(m,m+h),h<32e4)try{s(null,Ri(f,new pn(d)))}catch(a){s(a,null)}else r.push(Oi(f,{size:d},s));else s("unknown compression type "+c,null);else s(null,jn(e,m,m+h))},h=0;h<s;++h)c();return n},unzipSync:()=>function(e){for(var t={},r=e.length-22;101010256!=gi(e,r);--r)if(!r||65558<e.length-r)throw"invalid zip file";var n=vi(e,r+8);if(!n)return{};var i=gi(e,r+16),a=4294967295==i;if(a){if(r=gi(e,r-12),101075792!=gi(e,r))throw"invalid zip file";n=gi(e,r+32),i=gi(e,r+48)}for(var o=0;o<n;++o){var s=(d=la(e,i,a))[0],l=d[1],u=d[2],c=d[3],h=d[4],d=d[5];if(d=sa(e,d),i=h,s){if(8!=s)throw"unknown compression type "+s;t[c]=Ri(e.subarray(d,d+l),new pn(u))}else t[c]=jn(e,d,d+l)}return t},unzlib:()=>Wi,unzlibSync:()=>Qi,zip:()=>function(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";function n(){for(var e=0;e<d.length;++e)d[e]()}function i(){for(var e=new pn(u+22),t=l,n=u-l,i=u=0;i<c;++i){var a=h[i];try{var o=a.c.length,s=(ha(e,u,a,a.f,a.u,o),30+a.f.length+ca(a.extra)),d=u+s;e.set(a.c,d),ha(e,l,a,a.f,a.u,o,u,a.m),l+=16+s+(a.m?a.m.length:0),u=d+o}catch(e){return r(e,null)}}da(e,l,h.length,n,t),r(null,e)}var a={},o=(Yi(e,"",a,t),Object.keys(a)),s=o.length,l=0,u=0,c=s,h=new Array(s),d=[];s||i();for(var p=function(e){function t(t,a){t?(n(),r(t,null)):(t=a.length,h[e]=ni(m,{size:g,crc:v.d(),c:a,f:y,m:w,u:b!=c.length||w&&x.length!=A,compression:M}),l+=30+b+S+t,u+=76+2*(b+S)+(A||0)+t,--s||i())}var c=o[e],p=a[c],f=p[0],m=p[1],v=ei(),g=f.length,y=(v.p(f),ia(c)),b=y.length,x=m.comment,w=x&&ia(x),A=w&&w.length,S=ca(m.extra),M=0==m.level?0:8;if(65535<b&&t("filename too long",null),M)if(g<16e4)try{t(null,Ti(f,m))}catch(p){t(p,null)}else d.push(Ei(f,m,t));else t(null,f)},f=0;f<c;++f)p(f);return n},zipSync:()=>function(e,t){var r,n={},i=[],a=(Yi(e,"",n,t=t||{}),0),o=0;for(r in n){var s,l=(s=n[r])[0],u=0==(s=s[1]).level?0:8,c=(x=ia(r)).length,h=s.comment,d=h&&ia(h),p=d&&d.length,f=ca(s.extra);if(65535<c)throw"filename too long";var m=u?Ti(l,s):l,v=m.length,g=ei();g.p(l),i.push(ni(s,{size:l.length,crc:g.d(),c:m,f:x,m:d,u:c!=r.length||d&&h.length!=p,o:a,compression:u})),a+=30+c+f+v,o+=76+2*(c+f)+(p||0)+v}for(var y=new pn(o+22),b=(e=a,t=o-a,0);b<i.length;++b){ha(y,(x=i[b]).o,x,x.f,x.u,x.c.length);var x,w=30+x.f.length+ca(x.extra);y.set(x.c,x.o+w),ha(y,a,x,x.f,x.u,x.c.length,x.o,x.m),a+=16+w+(x.m?x.m.length:0)}return da(y,a,i.length,t,e),y},zlib:()=>function(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return mi(e,t,[li,hi,function(){return[Vi]}],(function(e){return pi(Vi(e.data[0],e.data[1]))}),4,r)},zlibSync:()=>Vi}),{}),r=(__webpack_require__.r(t),__webpack_require__.d(t,{FBXLoader:()=>Ua}),__webpack_require__(8881));function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){t&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function s(){return(s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}function u(e,t){return(u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,i=d(e);if(r=t?(r=d(this).constructor,Reflect.construct(i,arguments,r)):i.apply(this,arguments),i=this,r&&("object"===n(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return h(i)}}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var p=new r.Raycaster,f=new r.Vector3,m=new r.Vector3,v=new r.Quaternion,g={X:new r.Vector3(1,0,0),Y:new r.Vector3(0,1,0),Z:new r.Vector3(0,0,1)},y={type:"change"},b={type:"mouseDown"},x={type:"mouseUp",mode:null},w={type:"objectChange"},A=function(){l(t,r.Object3D);var e=c(t);function t(n,a){i(this,t),o=e.call(this),void 0===a&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),a=document),o.isTransformControls=!0,o.visible=!1,o.domElement=a,o.domElement.style.touchAction="none";var o,s=new U,l=(o._gizmo=s,o.add(s),new G),u=(o._plane=l,o.add(l),h(o));function c(e,t){var r=t;Object.defineProperty(u,e,{get:function(){return void 0!==r?r:t},set:function(t){r!==t&&(r=t,l[e]=t,s[e]=t,u.dispatchEvent({type:e+"-changed",value:t}),u.dispatchEvent(y))}}),u[e]=t,l[e]=t,s[e]=t}c("camera",n),c("object",void 0),c("enabled",!0),c("axis",null),c("mode","translate"),c("translationSnap",null),c("rotationSnap",null),c("scaleSnap",null),c("space","world"),c("size",1),c("dragging",!1),c("showX",!0),c("showY",!0),c("showZ",!0),a=new r.Vector3,n=new r.Vector3;var d=new r.Quaternion,p=new r.Quaternion,f=new r.Vector3,m=new r.Quaternion,v=new r.Vector3,g=new r.Vector3,b=new r.Vector3,x=new r.Vector3;return c("worldPosition",a),c("worldPositionStart",n),c("worldQuaternion",d),c("worldQuaternionStart",p),c("cameraPosition",f),c("cameraQuaternion",m),c("pointStart",v),c("pointEnd",g),c("rotationAxis",b),c("rotationAngle",0),c("eye",x),o._offset=new r.Vector3,o._startNorm=new r.Vector3,o._endNorm=new r.Vector3,o._cameraScale=new r.Vector3,o._parentPosition=new r.Vector3,o._parentQuaternion=new r.Quaternion,o._parentQuaternionInv=new r.Quaternion,o._parentScale=new r.Vector3,o._worldScaleStart=new r.Vector3,o._worldQuaternionInv=new r.Quaternion,o._worldScale=new r.Vector3,o._positionStart=new r.Vector3,o._quaternionStart=new r.Quaternion,o._scaleStart=new r.Vector3,o._getPointer=function(e){var t;return this.domElement.ownerDocument.pointerLockElement?{x:0,y:0,button:e.button}:(t=this.domElement.getBoundingClientRect(),{x:(e.clientX-t.left)/t.width*2-1,y:-(e.clientY-t.top)/t.height*2+1,button:e.button})}.bind(h(o)),o._onPointerDown=function(e){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(e.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(e)),this.pointerDown(this._getPointer(e)))}.bind(h(o)),o._onPointerHover=function(e){if(this.enabled)switch(e.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(e))}}.bind(h(o)),o._onPointerMove=function(e){this.enabled&&this.pointerMove(this._getPointer(e))}.bind(h(o)),o._onPointerUp=function(e){this.enabled&&(this.domElement.releasePointerCapture(e.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(e)))}.bind(h(o)),o.domElement.addEventListener("pointerdown",o._onPointerDown),o.domElement.addEventListener("pointermove",o._onPointerHover),o.domElement.addEventListener("pointerup",o._onPointerUp),o}return o(t,[{key:"updateMatrixWorld",value:function(){void 0!==this.object&&(this.object.updateMatrixWorld(),null===this.object.parent?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye):this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),s(d(t.prototype),"updateMatrixWorld",this).call(this,this)}},{key:"pointerHover",value:function(e){void 0!==this.object&&!0!==this.dragging&&(p.setFromCamera(e,this.camera),e=S(this._gizmo.picker[this.mode],p),this.axis=e?e.object.name:null)}},{key:"pointerDown",value:function(e){void 0!==this.object&&!0!==this.dragging&&0===e.button&&null!==this.axis&&(p.setFromCamera(e,this.camera),(e=S(this._plane,p,!0))&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(e.point).sub(this.worldPositionStart)),this.dragging=!0,b.mode=this.mode,this.dispatchEvent(b))}},{key:"pointerMove",value:function(e){var t=this.axis,r=this.mode,n=this.object,i=this.space;"scale"===r?i="local":"E"!==t&&"XYZE"!==t&&"XYZ"!==t||(i="world"),void 0!==n&&null!==t&&!1!==this.dragging&&-1===e.button&&(p.setFromCamera(e,this.camera),(e=S(this._plane,p,!0))&&(this.pointEnd.copy(e.point).sub(this.worldPositionStart),"translate"===r?(this._offset.copy(this.pointEnd).sub(this.pointStart),"local"===i&&"XYZ"!==t&&this._offset.applyQuaternion(this._worldQuaternionInv),-1===t.indexOf("X")&&(this._offset.x=0),-1===t.indexOf("Y")&&(this._offset.y=0),-1===t.indexOf("Z")&&(this._offset.z=0),("local"===i&&"XYZ"!==t?this._offset.applyQuaternion(this._quaternionStart):this._offset.applyQuaternion(this._parentQuaternionInv)).divide(this._parentScale),n.position.copy(this._offset).add(this._positionStart),this.translationSnap&&("local"===i&&(n.position.applyQuaternion(v.copy(this._quaternionStart).invert()),-1!==t.search("X")&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.position.applyQuaternion(this._quaternionStart)),"world"===i&&(n.parent&&n.position.add(f.setFromMatrixPosition(n.parent.matrixWorld)),-1!==t.search("X")&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.parent&&n.position.sub(f.setFromMatrixPosition(n.parent.matrixWorld))))):"scale"===r?(-1!==t.search("XYZ")?(e=this.pointEnd.length()/this.pointStart.length(),this.pointEnd.dot(this.pointStart)<0&&(e*=-1),m.set(e,e,e)):(f.copy(this.pointStart),m.copy(this.pointEnd),f.applyQuaternion(this._worldQuaternionInv),m.applyQuaternion(this._worldQuaternionInv),m.divide(f),-1===t.search("X")&&(m.x=1),-1===t.search("Y")&&(m.y=1),-1===t.search("Z")&&(m.z=1)),n.scale.copy(this._scaleStart).multiply(m),this.scaleSnap&&(-1!==t.search("X")&&(n.scale.x=Math.round(n.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Y")&&(n.scale.y=Math.round(n.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Z")&&(n.scale.z=Math.round(n.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))):"rotate"===r&&(this._offset.copy(this.pointEnd).sub(this.pointStart),e=20/this.worldPosition.distanceTo(f.setFromMatrixPosition(this.camera.matrixWorld)),"E"===t?(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1):"XYZE"===t?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(f.copy(this.rotationAxis).cross(this.eye))*e):"X"!==t&&"Y"!==t&&"Z"!==t||(this.rotationAxis.copy(g[t]),f.copy(g[t]),"local"===i&&f.applyQuaternion(this.worldQuaternion),this.rotationAngle=this._offset.dot(f.cross(this.eye).normalize())*e),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),("local"===i&&"E"!==t&&"XYZE"!==t?(n.quaternion.copy(this._quaternionStart),n.quaternion.multiply(v.setFromAxisAngle(this.rotationAxis,this.rotationAngle))):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),n.quaternion.copy(v.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),n.quaternion.multiply(this._quaternionStart))).normalize()),this.dispatchEvent(y),this.dispatchEvent(w)))}},{key:"pointerUp",value:function(e){0===e.button&&(this.dragging&&null!==this.axis&&(x.mode=this.mode,this.dispatchEvent(x)),this.dragging=!1,this.axis=null)}},{key:"dispose",value:function(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse((function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()}))}},{key:"attach",value:function(e){return this.object=e,this.visible=!0,this}},{key:"detach",value:function(){return this.object=void 0,this.visible=!1,this.axis=null,this}},{key:"reset",value:function(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(y),this.dispatchEvent(w),this.pointStart.copy(this.pointEnd))}},{key:"getRaycaster",value:function(){return p}},{key:"getMode",value:function(){return this.mode}},{key:"setMode",value:function(e){this.mode=e}},{key:"setTranslationSnap",value:function(e){this.translationSnap=e}},{key:"setRotationSnap",value:function(e){this.rotationSnap=e}},{key:"setScaleSnap",value:function(e){this.scaleSnap=e}},{key:"setSize",value:function(e){this.size=e}},{key:"setSpace",value:function(e){this.space=e}},{key:"update",value:function(){console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.")}}]),t}();function S(e,t,r){for(var n=t.intersectObject(e,!0),i=0;i<n.length;i++)if(n[i].object.visible||r)return n[i];return!1}var M=new r.Euler,B=new r.Vector3(0,1,0),C=new r.Vector3(0,0,0),_=new r.Matrix4,E=new r.Quaternion,T=new r.Quaternion,D=new r.Vector3,P=new r.Matrix4,O=new r.Vector3(1,0,0),R=new r.Vector3(0,1,0),I=new r.Vector3(0,0,1),k=new r.Vector3,L=new r.Vector3,F=new r.Vector3,U=function(){l(t,r.Object3D);var e=c(t);function t(){i(this,t),(n=e.call(this)).isTransformControlsGizmo=!0,n.type="TransformControlsGizmo";var n,a=new r.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),o=new r.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),s=a.clone(),l=((((s.opacity=.15,o=o.clone()).opacity=.5,w=a.clone()).color.setHex(16711680),A=a.clone()).color.setHex(65280),a.clone()),u=(l.color.setHex(255),a.clone()),c=(u.color.setHex(16711680),u.opacity=.5,a.clone()),h=(c.color.setHex(65280),c.opacity=.5,a.clone()),d=(h.color.setHex(255),h.opacity=.5,a.clone());(d.opacity=.25,b=a.clone()).color.setHex(16776960),b.opacity=.25,a.clone().color.setHex(16776960);var p=(((a=a.clone()).color.setHex(7895160),v=new r.CylinderGeometry(0,.04,.1,12)).translate(0,.05,0),new r.BoxGeometry(.08,.08,.08)),f=(p.translate(0,.04,0),new r.BufferGeometry);function m(e,t){return(e=new r.TorusGeometry(e,.0075,3,64,t*Math.PI*2)).rotateY(Math.PI/2),e.rotateX(Math.PI/2),e}(f.setAttribute("position",new r.Float32BufferAttribute([0,0,0,1,0,0],3)),S=new r.CylinderGeometry(.0075,.0075,.5,3)).translate(0,.25,0);var v={X:[[new r.Mesh(v,w),[.5,0,0],[0,0,-Math.PI/2]],[new r.Mesh(v,w),[-.5,0,0],[0,0,Math.PI/2]],[new r.Mesh(S,w),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new r.Mesh(v,A),[0,.5,0]],[new r.Mesh(v,A),[0,-.5,0],[Math.PI,0,0]],[new r.Mesh(S,A)]],Z:[[new r.Mesh(v,l),[0,0,.5],[Math.PI/2,0,0]],[new r.Mesh(v,l),[0,0,-.5],[-Math.PI/2,0,0]],[new r.Mesh(S,l),null,[Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.OctahedronGeometry(.1,0),d.clone()),[0,0,0]]],XY:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),h.clone()),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),u.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),c.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},g={X:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[.3,0,0],[0,0,-Math.PI/2]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,.3,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,-.3,0],[0,0,Math.PI]]],Z:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,0,.3],[Math.PI/2,0,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.OctahedronGeometry(.2,0),s)]],XY:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]]},y={START:[[new r.Mesh(new r.OctahedronGeometry(.01,2),o),null,null,null,"helper"]],END:[[new r.Mesh(new r.OctahedronGeometry(.01,2),o),null,null,null,"helper"]],DELTA:[[new r.Line(((y=new r.BufferGeometry).setAttribute("position",new r.Float32BufferAttribute([0,0,0,1,1,1],3)),y),o),null,null,null,"helper"]],X:[[new r.Line(f,o.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new r.Line(f,o.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new r.Line(f,o.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},b=(a={XYZE:[[new r.Mesh(m(.5,1),a),null,[0,Math.PI/2,0]]],X:[[new r.Mesh(m(.5,.5),w)]],Y:[[new r.Mesh(m(.5,.5),A),null,[0,0,-Math.PI/2]]],Z:[[new r.Mesh(m(.5,.5),l),null,[0,Math.PI/2,0]]],E:[[new r.Mesh(m(.75,1),b),null,[0,Math.PI/2,0]]]},{AXIS:[[new r.Line(f,o.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]}),x={XYZE:[[new r.Mesh(new r.SphereGeometry(.25,10,8),s)]],X:[[new r.Mesh(new r.TorusGeometry(.5,.1,4,24),s),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new r.Mesh(new r.TorusGeometry(.5,.1,4,24),s),[0,0,0],[Math.PI/2,0,0]]],Z:[[new r.Mesh(new r.TorusGeometry(.5,.1,4,24),s),[0,0,0],[0,0,-Math.PI/2]]],E:[[new r.Mesh(new r.TorusGeometry(.75,.1,2,24),s)]]},w={X:[[new r.Mesh(p,w),[.5,0,0],[0,0,-Math.PI/2]],[new r.Mesh(S,w),[0,0,0],[0,0,-Math.PI/2]],[new r.Mesh(p,w),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new r.Mesh(p,A),[0,.5,0]],[new r.Mesh(S,A)],[new r.Mesh(p,A),[0,-.5,0],[0,0,Math.PI]]],Z:[[new r.Mesh(p,l),[0,0,.5],[Math.PI/2,0,0]],[new r.Mesh(S,l),[0,0,0],[Math.PI/2,0,0]],[new r.Mesh(p,l),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),h),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),u),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),c),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.BoxGeometry(.1,.1,.1),d.clone())]]},A={X:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[.3,0,0],[0,0,-Math.PI/2]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,.3,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,-.3,0],[0,0,Math.PI]]],Z:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,0,.3],[Math.PI/2,0,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.2),s),[0,0,0]]]},S={X:[[new r.Line(f,o.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new r.Line(f,o.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new r.Line(f,o.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function M(e){var t,n=new r.Object3D;for(t in e)for(var i=e[t].length;i--;){var a=e[t][i][0].clone(),o=e[t][i][1],s=e[t][i][2],l=e[t][i][3],u=e[t][i][4];(a.name=t,a.tag=u,o&&a.position.set(o[0],o[1],o[2]),s&&a.rotation.set(s[0],s[1],s[2]),l&&a.scale.set(l[0],l[1],l[2]),a.updateMatrix(),u=a.geometry.clone()).applyMatrix4(a.matrix),a.geometry=u,a.renderOrder=1/0,a.position.set(0,0,0),a.rotation.set(0,0,0),a.scale.set(1,1,1),n.add(a)}return n}return n.gizmo={},n.picker={},n.helper={},n.add(n.gizmo.translate=M(v)),n.add(n.gizmo.rotate=M(a)),n.add(n.gizmo.scale=M(w)),n.add(n.picker.translate=M(g)),n.add(n.picker.rotate=M(x)),n.add(n.picker.scale=M(A)),n.add(n.helper.translate=M(y)),n.add(n.helper.rotate=M(b)),n.add(n.helper.scale=M(S)),n.picker.translate.visible=!1,n.picker.rotate.visible=!1,n.picker.scale.visible=!1,n}return o(t,[{key:"updateMatrixWorld",value:function(e){var r=this,n="local"===("scale"===this.mode?"local":this.space)?this.worldQuaternion:T,i=(this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode,this.helper.translate.visible="translate"===this.mode,this.helper.rotate.visible="rotate"===this.mode,this.helper.scale.visible="scale"===this.mode,[]);i=(i=(i=i.concat(this.picker[this.mode].children)).concat(this.gizmo[this.mode].children)).concat(this.helper[this.mode].children);for(var a=0;a<i.length;a++)!function(e){var t=i[e];if(t.visible=!0,t.rotation.set(0,0,0),e=void t.position.copy(r.worldPosition),e=r.camera.isOrthographicCamera?(r.camera.top-r.camera.bottom)/r.camera.zoom:r.worldPosition.distanceTo(r.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*r.camera.fov/360)/r.camera.zoom,7),t.scale.set(1,1,1).multiplyScalar(e*r.size/4),"helper"===t.tag)return t.visible=!1,"AXIS"===t.name?(t.position.copy(r.worldPositionStart),t.visible=!!r.axis,"X"===r.axis&&(v.setFromEuler(M.set(0,0,0)),t.quaternion.copy(n).multiply(v),.9<Math.abs(B.copy(O).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"Y"===r.axis&&(v.setFromEuler(M.set(0,0,Math.PI/2)),t.quaternion.copy(n).multiply(v),.9<Math.abs(B.copy(R).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"Z"===r.axis&&(v.setFromEuler(M.set(0,Math.PI/2,0)),t.quaternion.copy(n).multiply(v),.9<Math.abs(B.copy(I).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"XYZE"===r.axis&&(v.setFromEuler(M.set(0,Math.PI/2,0)),B.copy(r.rotationAxis),t.quaternion.setFromRotationMatrix(_.lookAt(C,B,R)),t.quaternion.multiply(v),t.visible=r.dragging),"E"===r.axis&&(t.visible=!1)):"START"===t.name?(t.position.copy(r.worldPositionStart),t.visible=r.dragging):"END"===t.name?(t.position.copy(r.worldPosition),t.visible=r.dragging):"DELTA"===t.name?(t.position.copy(r.worldPositionStart),t.quaternion.copy(r.worldQuaternionStart),f.set(1e-10,1e-10,1e-10).add(r.worldPositionStart).sub(r.worldPosition).multiplyScalar(-1),f.applyQuaternion(r.worldQuaternionStart.clone().invert()),t.scale.copy(f),t.visible=r.dragging):(t.quaternion.copy(n),r.dragging?t.position.copy(r.worldPositionStart):t.position.copy(r.worldPosition),r.axis&&(t.visible=-1!==r.axis.search(t.name)));t.quaternion.copy(n),"translate"===r.mode||"scale"===r.mode?("X"===t.name&&.99<Math.abs(B.copy(O).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Y"===t.name&&.99<Math.abs(B.copy(R).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Z"===t.name&&.99<Math.abs(B.copy(I).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XY"===t.name&&Math.abs(B.copy(I).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"YZ"===t.name&&Math.abs(B.copy(O).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XZ"===t.name&&Math.abs(B.copy(R).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1)):"rotate"===r.mode&&(E.copy(n),B.copy(r.eye).applyQuaternion(v.copy(n).invert()),-1!==t.name.search("E")&&t.quaternion.setFromRotationMatrix(_.lookAt(r.eye,C,R)),"X"===t.name&&(v.setFromAxisAngle(O,Math.atan2(-B.y,B.z)),v.multiplyQuaternions(E,v),t.quaternion.copy(v)),"Y"===t.name&&(v.setFromAxisAngle(R,Math.atan2(B.x,B.z)),v.multiplyQuaternions(E,v),t.quaternion.copy(v)),"Z"===t.name&&(v.setFromAxisAngle(I,Math.atan2(B.y,B.x)),v.multiplyQuaternions(E,v),t.quaternion.copy(v))),t.visible=t.visible&&(-1===t.name.indexOf("X")||r.showX),t.visible=t.visible&&(-1===t.name.indexOf("Y")||r.showY),t.visible=t.visible&&(-1===t.name.indexOf("Z")||r.showZ),t.visible=t.visible&&(-1===t.name.indexOf("E")||r.showX&&r.showY&&r.showZ),t.material._color=t.material._color||t.material.color.clone(),t.material._opacity=t.material._opacity||t.material.opacity,t.material.color.copy(t.material._color),t.material.opacity=t.material._opacity,r.enabled&&r.axis&&(t.name===r.axis||r.axis.split("").some((function(e){return t.name===e})))&&(t.material.color.setHex(16776960),t.material.opacity=1)}(a);s(d(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}(),G=function(){l(t,r.Mesh);var e=c(t);function t(){var n;return i(this,t),(n=e.call(this,new r.PlaneGeometry(1e5,1e5,2,2),new r.MeshBasicMaterial({visible:!1,wireframe:!0,side:r.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1}))).isTransformControlsPlane=!0,n.type="TransformControlsPlane",n}return o(t,[{key:"updateMatrixWorld",value:function(e){var r=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(r="local"),k.copy(O).applyQuaternion("local"===r?this.worldQuaternion:T),L.copy(R).applyQuaternion("local"===r?this.worldQuaternion:T),F.copy(I).applyQuaternion("local"===r?this.worldQuaternion:T),B.copy(L),this.mode){case"translate":case"scale":switch(this.axis){case"X":B.copy(this.eye).cross(k),D.copy(k).cross(B);break;case"Y":B.copy(this.eye).cross(L),D.copy(L).cross(B);break;case"Z":B.copy(this.eye).cross(F),D.copy(F).cross(B);break;case"XY":D.copy(F);break;case"YZ":D.copy(k);break;case"XZ":B.copy(F),D.copy(L);break;case"XYZ":case"E":D.set(0,0,0)}break;default:D.set(0,0,0)}0===D.length()?this.quaternion.copy(this.cameraQuaternion):(P.lookAt(f.set(0,0,0),D,B),this.quaternion.setFromRotationMatrix(P)),s(d(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}(),j=__webpack_require__(3300),N=__webpack_require__.n(j),H=__webpack_require__(9251),z=__webpack_require__(9594);class V{constructor(e){this.runScene=e}}function J(e){return(J="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}j=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),X=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);var K,W,Q,X,Z="object"!==("undefined"==typeof WebAssembly?"undefined":J(WebAssembly))?{supported:!1}:(vr="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB",WebAssembly.validate(j)&&(vr="B9h9z9tFBBBFiI9gBB9gLaaaaaFa9gEaaaB9gFaFaEMcBBFBFFGGGEILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBOn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBNI9z9iqlBVc+N9IcIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMk8lLbaE97F9+FaL978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAeDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAeDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBReCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBH8ZCFD9tA8ZAPD9OD9hD9RH8ZDQBTFtGmEYIPLdKeOnHpAIAQJDBIBHyCFD9tAyAPD9OD9hD9RHyAIASJDBIBH8cCFD9tA8cAPD9OD9hD9RH8cDQBTFtGmEYIPLdKeOnH8dDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAeD9uHeDyBjGBAEAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeApA8dDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNiV8ZcpMyS8cQ8df8eb8fHdAyA8cDQNiV8ZcpMyS8cQ8df8eb8fH8ZDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/dLEK97FaF97GXGXAGCI9HQBAF9FQFCBRGEXABABDBBBHECiD+rFCiD+sFD/6FHIAECND+rFCiD+sFD/6FAID/gFAECTD+rFCiD+sFD/6FHLD/gFD/kFD/lFHKCBDtD+2FHOAICUUUU94DtHND9OD9RD/kFHI9DBB/+hDYAIAID/mFAKAKD/mFALAOALAND9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHLD/mF9DBBX9LDYHOD/kFCgFDtD9OAECUUU94DtD9OD9QAIALD/mFAOD/kFCND+rFCU/+EDtD9OD9QAKALD/mFAOD/kFCTD+rFCUU/8ODtD9OD9QDMBBABCTJRBAGCIJHGAF9JQBSGMMAF9FQBCBRGEXABCTJHVAVDBBBHECBDtHOCUU98D8cFCUU98D8cEHND9OABDBBBHKAEDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAKAEDQBFGENVcMTtmYi8ZpyHECTD+sFD/6FHID/gFAECTD+rFCTD+sFD/6FHLD/gFD/kFD/lFHE9DB/+g6DYALAEAOD+2FHOALCUUUU94DtHcD9OD9RD/kFHLALD/mFAEAED/mFAIAOAIAcD9OD9RD/kFHEAED/mFD/kFD/kFD/jFD/nFHID/mF9DBBX9LDYHOD/kFCTD+rFALAID/mFAOD/kFCggEDtD9OD9QHLAEAID/mFAOD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHEDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAKAND9OALAEDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM/hEIGaF97FaL978jUUUUBCTlREGXAF9FQBCBRIEXAEABDBBBHLABCTJHKDBBBHODQILKOSQfbPden8c8d8e8fHNCTD+sFHVCID+rFDMIBAB9DBBU8/DY9D/zI818/DYAVCEDtD9QD/6FD/nFHVALAODQBFGENVcMTtmYi8ZpyHLCTD+rFCTD+sFD/6FD/mFHOAOD/mFAVALCTD+sFD/6FD/mFHcAcD/mFAVANCTD+rFCTD+sFD/6FD/mFHNAND/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHVD/mF9DBBX9LDYHLD/kFCggEDtHMD9OAcAVD/mFALD/kFCTD+rFD9QHcANAVD/mFALD/kFCTD+rFAOAVD/mFALD/kFAMD9OD9QHVDQBFTtGEmYILPdKOenHLD8dBAEDBIBDyB+t+J83EBABCNJALD8dFAEDBIBDyF+t+J83EBAKAcAVDQNVi8ZcMpySQ8c8dfb8e8fHVD8dBAEDBIBDyG+t+J83EBABCiJAVD8dFAEDBIBDyE+t+J83EBABCAJRBAICIJHIAF9JQBMMM9jFF97GXAGCGrAF9sHG9FQBCBRFEXABABDBBBHECND+rFCND+sFD/6FAECiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBABCTJRBAFCIJHFAG9JQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",console.log("Warning: meshopt_decoder is using experimental SIMD support")),j=WebAssembly.instantiate(function(e){for(var t=new Uint8Array(e.length),r=0;r<e.length;++r){var n=e.charCodeAt(r);t[r]=96<n?n-71:64<n?n-65:47<n?n+4:46<n?63:62}var i=0;for(r=0;r<e.length;++r)t[i++]=t[r]<60?X[t[r]]:64*(t[r]-60)+t[++r];return t.buffer.slice(0,i)}(vr),{}).then((function(e){(K=e.instance).exports.__wasm_call_ctors()})),W={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},Q={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},{ready:j,supported:!0,decodeVertexBuffer:function(e,t,r,n,i){Y(K.exports.meshopt_decodeVertexBuffer,e,t,r,n,K.exports[W[i]])},decodeIndexBuffer:function(e,t,r,n){Y(K.exports.meshopt_decodeIndexBuffer,e,t,r,n)},decodeIndexSequence:function(e,t,r,n){Y(K.exports.meshopt_decodeIndexSequence,e,t,r,n)},decodeGltfBuffer:function(e,t,r,n,i,a){Y(K.exports[Q[i]],e,t,r,n,K.exports[W[a]])}});function Y(e,t,r,n,i,a){var o=K.exports.sbrk,s=r+3&-4,l=o(s*n),u=o(i.length),c=new Uint8Array(K.exports.memory.buffer);if(0==(c.set(i,u),e=e(l,r,n,u,i.length))&&a&&a(l,s,n),t.set(c.subarray(l,l+r*n)),o(l-o(0)),0!=e)throw new Error("Malformed buffer data: "+e)}function q(e){return(q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function $(e,t){return($=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function ee(e){return(ee=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var te=new WeakMap,re=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&$(t,e);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ee(e);if(r=t?(r=ee(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===q(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e){if(this instanceof i)return(e=n.call(this,e)).decoderPath="",e.decoderConfig={},e.decoderBinary=null,e.decoderPending=null,e.workerLimit=4,e.workerPool=[],e.workerNextTaskID=1,e.workerSourceURL="",e.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},e.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},e;throw new TypeError("Cannot call a class as a function")}return t=i,(e=[{key:"setDecoderPath",value:function(e){return this.decoderPath=e,this}},{key:"setDecoderConfig",value:function(e){return this.decoderConfig=e,this}},{key:"setWorkerLimit",value:function(e){return this.workerLimit=e,this}},{key:"load",value:function(e,t,n,i){var a=this,o=new r.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(function(e){var r={attributeIDs:a.defaultAttributeIDs,attributeTypes:a.defaultAttributeTypes,useUniqueIDs:!1};a.decodeGeometry(e,r).then(t).catch(i)}),n,i)}},{key:"decodeDracoFile",value:function(e,t,r,n){n={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!r},this.decodeGeometry(e,n).then(t)}},{key:"decodeGeometry",value:function(e,t){var r,n=this;for(r in t.attributeTypes){var i=t.attributeTypes[r];void 0!==i.BYTES_PER_ELEMENT&&(t.attributeTypes[r]=i.name)}var a,o=JSON.stringify(t);if(te.has(e)){if((l=te.get(e)).key===o)return l.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}var s=this.workerNextTaskID++,l=e.byteLength;return l=this._getWorker(s,l).then((function(r){return a=r,new Promise((function(r,n){a._callbacks[s]={resolve:r,reject:n},a.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))})).then((function(e){return n._createGeometry(e.geometry)})),l.catch((function(){return!0})).then((function(){a&&s&&n._releaseTask(a,s)})),te.set(e,{key:o,promise:l}),l}},{key:"_createGeometry",value:function(e){var t=new r.BufferGeometry;e.index&&t.setIndex(new r.BufferAttribute(e.index.array,1));for(var n=0;n<e.attributes.length;n++){var i=(o=e.attributes[n]).name,a=o.array,o=o.itemSize;t.setAttribute(i,new r.BufferAttribute(a,o))}return t}},{key:"_loadLibrary",value:function(e,t){var n=new r.FileLoader(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((function(t,r){n.load(e,t,void 0,r)}))}},{key:"preload",value:function(){return this._initDecoder(),this}},{key:"_initDecoder",value:function(){var e,t,r=this;return this.decoderPending||(t=[],(e="object"!==("undefined"==typeof WebAssembly?"undefined":q(WebAssembly))||"js"===this.decoderConfig.type)?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((function(t){var n=t[0];e||(r.decoderConfig.wasmBinary=t[1]),t=function(){var e,t;onmessage=function(r){var n=r.data;switch(n.type){case"init":e=n.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var i=n.buffer,a=n.taskConfig;t.then((function(e){var t=new(e=e.draco).Decoder,r=new e.DecoderBuffer;r.Init(new Int8Array(i),i.byteLength);try{var o=function(e,t,r,n){var i,a=n.attributeIDs,o=n.attributeTypes,s=t.GetEncodedGeometryType(r);if(s===e.TRIANGULAR_MESH)i=new e.Mesh,g=t.DecodeBufferToMesh(r,i);else{if(s!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");i=new e.PointCloud,g=t.DecodeBufferToPointCloud(r,i)}if(!g.ok()||0===i.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+g.error_msg());var l,u,c,h,d,p,f,m,v,g,y,b,x,w={index:null,attributes:[]};for(l in a){var A=self[o[l]],S=void 0,M=void 0;if(n.useUniqueIDs)M=a[l],S=t.GetAttributeByUniqueId(i,M);else{if(-1===(M=t.GetAttributeId(i,e[a[l]])))continue;S=t.GetAttribute(i,M)}w.attributes.push((M=e,u=t,c=i,h=l,d=S.num_components(),f=(p=c.num_points()*d)*A.BYTES_PER_ELEMENT,m=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(M,A),v=M._malloc(f),u.GetAttributeDataArrayForAllPoints(c,S,m,f,v),u=new A(M.HEAPF32.buffer,v,p).slice(),M._free(v),{name:h,array:u,itemSize:d}))}return s===e.TRIANGULAR_MESH&&(w.index=(r=e,g=t,b=4*(y=3*(s=i).num_faces()),x=r._malloc(b),g.GetTrianglesUInt32Array(s,b,x),g=new Uint32Array(r.HEAPF32.buffer,x,y).slice(),r._free(x),{array:g,itemSize:1})),e.destroy(i),w}(e,t,r,a),s=o.attributes.map((function(e){return e.array.buffer}));o.index&&s.push(o.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:o},s)}catch(e){console.error(e),self.postMessage({type:"error",id:n.id,error:e.message})}finally{e.destroy(r),e.destroy(t)}}))}}}.toString(),n=["/* draco decoder */",n,"","/* worker */",t.substring(t.indexOf("{")+1,t.lastIndexOf("}"))].join("\n"),r.workerSourceURL=URL.createObjectURL(new Blob([n]))}))),this.decoderPending}},{key:"_getWorker",value:function(e,t){var r=this;return this._initDecoder().then((function(){r.workerPool.length<r.workerLimit?((n=new Worker(r.workerSourceURL))._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:r.decoderConfig}),n.onmessage=function(e){var t=e.data;switch(t.type){case"decode":n._callbacks[t.id].resolve(t);break;case"error":n._callbacks[t.id].reject(t);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+t.type+'"')}},r.workerPool.push(n)):r.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));var n,i=r.workerPool[r.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i}))}},{key:"_releaseTask",value:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}},{key:"debug",value:function(){console.log("Task load: ",this.workerPool.map((function(e){return e._taskLoad})))}},{key:"dispose",value:function(){for(var e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.Loader),ne={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};var ie=new(function(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(t,r,n){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var i=this,a=!1,o=0,s=0,l=void 0,u=[];this.onStart=void 0,this.onLoad=t,this.onProgress=r,this.onError=n,this.itemStart=function(e){s++,!1===a&&void 0!==i.onStart&&i.onStart(e,o,s),a=!0},this.itemEnd=function(e){o++,void 0!==i.onProgress&&i.onProgress(e,o,s),o===s&&(a=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return l?l(e):e},this.setURLModifier=function(e){return l=e,this},this.addHandler=function(e,t){return u.push(e,t),this},this.removeHandler=function(e){return-1!==(e=u.indexOf(e))&&u.splice(e,2),this},this.getHandler=function(e){for(var t=0,r=u.length;t<r;t+=2){var n=u[t],i=u[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return i}return null}})));var ae=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.manager=void 0!==t?t:ie,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}var t,r;return t=e,(r=[{key:"load",value:function(){}},{key:"loadAsync",value:function(e,t){var r=this;return new Promise((function(n,i){r.load(e,n,t,i)}))}},{key:"parse",value:function(){}},{key:"setCrossOrigin",value:function(e){return this.crossOrigin=e,this}},{key:"setWithCredentials",value:function(e){return this.withCredentials=e,this}},{key:"setPath",value:function(e){return this.path=e,this}},{key:"setResourcePath",value:function(e){return this.resourcePath=e,this}},{key:"setRequestHeader",value:function(e){return this.requestHeader=e,this}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();function oe(e){return(oe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function se(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function le(e,t){return(le=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function ue(e){return(ue=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ce=function(){var e=n,t=ae;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&le(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ue(e);if(r=t?(r=ue(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===oe(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e){if(this instanceof n)return e=r.call(this,e),"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),e.options={premultiplyAlpha:"none"},e;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"setOptions",value:function(e){return this.options=e,this}},{key:"load",value:function(e,t,r,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var a=this,o=ne.get(e);if(void 0!==o)return a.manager.itemStart(e),setTimeout((function(){t&&t(o),a.manager.itemEnd(e)}),0),o;var s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader,fetch(e,s).then((function(e){return e.blob()})).then((function(e){return Promise.all([new Promise((function(t){var r=(n=a.options).textureQuality,n=n.reverseTexture,o=i.notCompress,s=i.size,l=0===e.size?new ImageData(1,1):e;t(s&&1!==r?(s=(t=i.size).w,t=t.h,o=o?1:r,createImageBitmap(l,Object.assign(a.options,{imageOrientation:n?"none":"flipY",resizeHeight:t*o,resizeWidth:s*o}))):createImageBitmap(l,Object.assign(a.options,{imageOrientation:n?"none":"flipY"})))})),Promise.resolve(e)])})).then((function(r){r=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a=[],o=!0,s=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(a.push(n.value),2!==a.length);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==r.return||r.return()}finally{if(s)throw i}}return a}}(e)||function(e,t){var r;if(e)return"string"==typeof e?se(e,2):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?se(e,2):void 0}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(r);var n=r[0];r=r[1],ne.add(e,n),t&&t(n,r),a.manager.itemEnd(e)})).catch((function(t){n&&n(t),a.manager.itemError(e),a.manager.itemEnd(e)})),a.manager.itemStart(e)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}(),he=(ce.prototype.isImageBitmapLoader=!0,__webpack_require__(9887));function de(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a=[],o=!0,s=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==r.return||r.return()}finally{if(s)throw i}}return a}}(e,t)||me(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pe(e,t){var r,n,i,a,o="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(o)return n=!(r=!0),{s:function(){o=o.call(e)},n:function(){var e=o.next();return r=e.done,e},e:function(e){n=!0,i=e},f:function(){try{r||null==o.return||o.return()}finally{if(n)throw i}}};if(Array.isArray(e)||(o=me(e))||t&&e&&"number"==typeof e.length)return o&&(e=o),a=0,{s:t=function(){},n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function fe(e){return function(e){if(Array.isArray(e))return ve(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||me(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function me(e,t){var r;if(e)return"string"==typeof e?ve(e,t):"Map"===(r="Object"===(r=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ve(e,t):void 0}function ve(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ge(e){return(ge="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ye(){return(ye="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Ce(e)););return e}(e,t);if(n)return(n=Object.getOwnPropertyDescriptor(n,t)).get?n.get.call(arguments.length<3?e:r):n.value}).apply(this,arguments)}function be(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xe(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function we(e,t,r){return t&&xe(e.prototype,t),r&&xe(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ae(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Se(e,t)}function Se(e,t){return(Se=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Me(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ce(e);if(r=t?(r=Ce(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===ge(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return Be(n)}}function Be(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ce(e){return(Ce=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var _e=function(){Ae(t,r.Loader);var e=Me(t);function t(r){return be(this,t),(r=e.call(this,r)).dracoLoader=null,r.ktx2Loader=null,r.meshoptDecoder=null,r.pluginCallbacks=[],r.register((function(e){return new Oe(e)})),r.register((function(e){return new Ue(e)})),r.register((function(e){return new Ge(e)})),r.register((function(e){return new Re(e)})),r.register((function(e){return new Ie(e)})),r.register((function(e){return new ke(e)})),r.register((function(e){return new Le(e)})),r.register((function(e){return new Fe(e)})),r.register((function(e){return new De(e)})),r.register((function(e){return new je(e)})),r}return we(t,[{key:"load",value:function(e,t,n,i){function a(t){i?i(t):console.error(t),o.manager.itemError(e),o.manager.itemEnd(e)}var o=this,s=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:r.LoaderUtils.extractUrlBase(e),l=(this.manager.itemStart(e),new r.FileLoader(this.manager));l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,(function(r){try{o.parse(r,s,(function(r){t(r),o.manager.itemEnd(e)}),a)}catch(r){a(r)}}),n,a)}},{key:"setDRACOLoader",value:function(e){return this.dracoLoader=e,this}},{key:"setDDSLoader",value:function(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}},{key:"setKTX2Loader",value:function(e){return this.ktx2Loader=e,this}},{key:"setMeshoptDecoder",value:function(e){return this.meshoptDecoder=e,this}},{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,n,i,a){var o,s={},l={};if("string"==typeof e)o=e;else if(r.LoaderUtils.decodeText(new Uint8Array(e,0,4))===Ne){try{s[Te.KHR_BINARY_GLTF]=new He(e)}catch(e){return void(i&&i(e))}o=s[Te.KHR_BINARY_GLTF].content}else o=r.LoaderUtils.decodeText(new Uint8Array(e));var u=JSON.parse(o);if(void 0===u.asset||u.asset.version[0]<2)i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else if(a.helper.beforeLoader(u)){var c=new lt(u,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder,myOptions:a});c.fileLoader.setRequestHeader(this.requestHeader);for(var h=0;h<this.pluginCallbacks.length;h++){var d=this.pluginCallbacks[h](c);s[(l[d.name]=d).name]=!0}if(u.extensionsUsed)for(var p=0;p<u.extensionsUsed.length;++p){var f=u.extensionsUsed[p],m=u.extensionsRequired||[];switch(f){case Te.KHR_MATERIALS_UNLIT:s[f]=new Pe;break;case Te.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:s[f]=new Ke;break;case Te.KHR_DRACO_MESH_COMPRESSION:s[f]=new ze(u,this.dracoLoader);break;case Te.KHR_TEXTURE_TRANSFORM:s[f]=new Ve;break;case Te.KHR_MESH_QUANTIZATION:s[f]=new We;break;default:0<=m.indexOf(f)&&void 0===l[f]&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}c.setExtensions(s),c.setPlugins(l),c.parse(n,i)}}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,i){r.parse(e,t,n,i)}))}}]),t}();function Ee(){var e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}var Te={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_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",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",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"},De=function(){function e(t){be(this,e),this.parser=t,this.name=Te.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return we(e,[{key:"_markDefs",value:function(){for(var e=this.parser,t=this.parser.json.nodes||[],r=0,n=t.length;r<n;r++){var i=t[r];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}},{key:"_loadLight",value:function(e){var t=this.parser,n="light:"+e,i=t.cache.get(n);if(!i){var a,o=t.json,s=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e],l=new r.Color(16777215),u=(void 0!==s.color&&l.fromArray(s.color),void 0!==s.range?s.range:0);switch(s.type){case"directional":(a=new r.DirectionalLight(l)).target.position.set(0,0,-1),a.add(a.target);break;case"point":(a=new r.PointLight(l)).distance=u;break;case"spot":(a=new r.SpotLight(l)).distance=u,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,a.angle=s.spot.outerConeAngle,a.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,a.target.position.set(0,0,-1),a.add(a.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}a.position.set(0,0,0),a.decay=2,void 0!==s.intensity&&(a.intensity=s.intensity),a.name=t.createUniqueName(s.name||"light_"+e),i=Promise.resolve(a),t.cache.add(n,i)}return i}},{key:"createNodeAttachment",value:function(e){var t=this,r=this.parser,n=((e=r.json.nodes[e]).extensions&&e.extensions[this.name]||{}).light;return void 0===n?null:this._loadLight(n).then((function(e){return r._getNodeRef(t.cache,n,e)}))}}]),e}(),Pe=function(){function e(){be(this,e),this.name=Te.KHR_MATERIALS_UNLIT}return we(e,[{key:"getMaterialType",value:function(){return r.MeshBasicMaterial}},{key:"extendParams",value:function(e,t,n){var i,a=[];return e.color=new r.Color(1,1,1),e.opacity=1,(t=t.pbrMetallicRoughness)&&(Array.isArray(t.baseColorFactor)&&(i=t.baseColorFactor,e.color.fromArray(i),e.opacity=i[3]),void 0!==t.baseColorTexture&&a.push(n.assignTexture(e,"map",t.baseColorTexture))),Promise.all(a)}}]),e}(),Oe=function(){function e(t){be(this,e),this.parser=t,this.name=Te.KHR_MATERIALS_CLEARCOAT}return we(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var n,i=this.parser;return(e=i.json.materials[e]).extensions&&e.extensions[this.name]?(n=[],void 0!==(e=e.extensions[this.name]).clearcoatFactor&&(t.clearcoat=e.clearcoatFactor),void 0!==e.clearcoatTexture&&n.push(i.assignTexture(t,"clearcoatMap",e.clearcoatTexture)),void 0!==e.clearcoatRoughnessFactor&&(t.clearcoatRoughness=e.clearcoatRoughnessFactor),void 0!==e.clearcoatRoughnessTexture&&n.push(i.assignTexture(t,"clearcoatRoughnessMap",e.clearcoatRoughnessTexture)),void 0!==e.clearcoatNormalTexture&&(n.push(i.assignTexture(t,"clearcoatNormalMap",e.clearcoatNormalTexture)),void 0!==e.clearcoatNormalTexture.scale&&(i=e.clearcoatNormalTexture.scale,t.clearcoatNormalScale=new r.Vector2(i,i))),Promise.all(n)):Promise.resolve()}}]),e}(),Re=function(){function e(t){be(this,e),this.parser=t,this.name=Te.KHR_MATERIALS_SHEEN}return we(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var n,i=this.parser;return(e=i.json.materials[e]).extensions&&e.extensions[this.name]?(n=[],t.sheenColor=new r.Color(0,0,0),t.sheenRoughness=0,t.sheen=1,void 0!==(e=e.extensions[this.name]).sheenColorFactor&&t.sheenColor.fromArray(e.sheenColorFactor),void 0!==e.sheenRoughnessFactor&&(t.sheenRoughness=e.sheenRoughnessFactor),void 0!==e.sheenColorTexture&&n.push(i.assignTexture(t,"sheenColorMap",e.sheenColorTexture)),void 0!==e.sheenRoughnessTexture&&n.push(i.assignTexture(t,"sheenRoughnessMap",e.sheenRoughnessTexture)),Promise.all(n)):Promise.resolve()}}]),e}(),Ie=function(){function e(t){be(this,e),this.parser=t,this.name=Te.KHR_MATERIALS_TRANSMISSION}return we(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var r,n=this.parser;return(e=n.json.materials[e]).extensions&&e.extensions[this.name]?(r=[],void 0!==(e=e.extensions[this.name]).transmissionFactor&&(t.transmission=e.transmissionFactor),void 0!==e.transmissionTexture&&r.push(n.assignTexture(t,"transmissionMap",e.transmissionTexture)),Promise.all(r)):Promise.resolve()}}]),e}(),ke=function(){function e(t){be(this,e),this.parser=t,this.name=Te.KHR_MATERIALS_VOLUME}return we(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var n,i=this.parser;return(e=i.json.materials[e]).extensions&&e.extensions[this.name]?(n=[],e=e.extensions[this.name],t.thickness=void 0!==e.thicknessFactor?e.thicknessFactor:0,void 0!==e.thicknessTexture&&n.push(i.assignTexture(t,"thicknessMap",e.thicknessTexture)),t.attenuationDistance=e.attenuationDistance||0,i=e.attenuationColor||[1,1,1],t.attenuationColor=new r.Color(i[0],i[1],i[2]),Promise.all(n)):Promise.resolve()}}]),e}(),Le=function(){function e(t){be(this,e),this.parser=t,this.name=Te.KHR_MATERIALS_IOR}return we(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]&&(e=e.extensions[this.name],t.ior=void 0!==e.ior?e.ior:1.5),Promise.resolve()}}]),e}(),Fe=function(){function e(t){be(this,e),this.parser=t,this.name=Te.KHR_MATERIALS_SPECULAR}return we(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var n,i,a=this.parser;return(e=a.json.materials[e]).extensions&&e.extensions[this.name]?(n=[],e=e.extensions[this.name],t.specularIntensity=void 0!==e.specularFactor?e.specularFactor:1,void 0!==e.specularTexture&&n.push(a.assignTexture(t,"specularIntensityMap",e.specularTexture)),i=e.specularColorFactor||[1,1,1],t.specularColor=new r.Color(i[0],i[1],i[2]),void 0!==e.specularColorTexture&&n.push(a.assignTexture(t,"specularColorMap",e.specularColorTexture).then((function(e){e.encoding=r.sRGBEncoding}))),Promise.all(n)):Promise.resolve()}}]),e}(),Ue=function(){function e(t){be(this,e),this.parser=t,this.name=Te.KHR_TEXTURE_BASISU}return we(e,[{key:"loadTexture",value:function(e){var t=this.parser,r=t.json;if((n=r.textures[e]).extensions&&n.extensions[this.name]){var n=n.extensions[this.name],i=t.options.ktx2Loader;if(i)return t.loadTextureImage(e,n.source,i);if(r.extensionsRequired&&0<=r.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures")}return null}}]),e}(),Ge=function(){function e(t){be(this,e),this.parser=t,this.name=Te.EXT_TEXTURE_WEBP,this.isSupported=null}return we(e,[{key:"loadTexture",value:function(e){var t,r,n=this.name,i=this.parser,a=i.json,o=a.textures[e];return o.extensions&&o.extensions[n]?(o=o.extensions[n],t=a.images[o.source],r=i.textureLoader,t.uri&&null!==(o=i.options.manager.getHandler(t.uri))&&(r=o),this.detectSupport().then((function(o){if(o)return i.loadTextureImage(e,t,r);if(a.extensionsRequired&&0<=a.extensionsRequired.indexOf(n))throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(e)}))):null}},{key:"detectSupport",value:function(){return this.isSupported||(this.isSupported=new Promise((function(e){var t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}]),e}(),je=function(){function e(t){be(this,e),this.name=Te.EXT_MESHOPT_COMPRESSION,this.parser=t}return we(e,[{key:"loadBufferView",value:function(e){var t=this.parser.json;if((e=t.bufferViews[e]).extensions&&e.extensions[this.name]){var r=e.extensions[this.name],n=(e=this.parser.getDependency("buffer",r.buffer),this.parser.options.meshoptDecoder);if(n&&n.supported)return Promise.all([e,n.ready]).then((function(e){var t=r.byteOffset||0,i=r.byteLength||0,a=r.count,o=r.byteStride,s=new ArrayBuffer(a*o);return e=new Uint8Array(e[0],t,i),n.decodeGltfBuffer(new Uint8Array(s),a,o,e,r.mode,r.filter),s}));if(t.extensionsRequired&&0<=t.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files")}return null}}]),e}(),Ne="glTF",He=we((function e(t){be(this,e),this.name=Te.KHR_BINARY_GLTF,this.content=null,this.body=null;var n=new DataView(t,0,12);if(this.header={magic:r.LoaderUtils.decodeText(new Uint8Array(t.slice(0,4))),version:n.getUint32(4,!0),length:n.getUint32(8,!0)},this.header.magic!==Ne)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var i=this.header.length-12,a=new DataView(t,12),o=0;o<i;){var s,l=a.getUint32(o,!0),u=(o+=4,a.getUint32(o,!0));o+=4,1313821514===u?(s=new Uint8Array(t,12+o,l),this.content=r.LoaderUtils.decodeText(s)):5130562===u&&(this.body=t.slice(s=12+o,s+l)),o+=l}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")})),ze=function(){function e(t,r){if(be(this,e),!r)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Te.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=r,this.dracoLoader.preload()}return we(e,[{key:"decodePrimitive",value:function(e,t){var r,n,i=this.json,a=this.dracoLoader,o=e.extensions[this.name].bufferView,s=e.extensions[this.name].attributes,l={},u={},c={};for(r in s){var h=tt[r]||r.toLowerCase();l[h]=s[r]}for(n in e.attributes){var d,p,f=tt[n]||n.toLowerCase();void 0!==s[n]&&(d=i.accessors[e.attributes[n]],p=Ye[d.componentType],c[f]=p,u[f]=!0===d.normalized)}return t.getDependency("bufferView",o).then((function(e){return new Promise((function(t){a.decodeDracoFile(e,(function(e){for(var r in e.attributes){var n=e.attributes[r];void 0!==(r=u[r])&&(n.normalized=r)}t(e)}),l,c)}))}))}}]),e}(),Ve=function(){function e(){be(this,e),this.name=Te.KHR_TEXTURE_TRANSFORM}return we(e,[{key:"extendTexture",value:function(e,t){return void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),void 0===t.offset&&void 0===t.rotation&&void 0===t.scale||(e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}]),e}(),Je=function(){Ae(t,r.MeshStandardMaterial);var e=Me(t);function t(n){be(this,t),(i=e.call(this)).isGLTFSpecularGlossinessMaterial=!0;var i,a=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),o=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),s=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","\tvec4 texelSpecular = texture2D( specularMap, vUv );","\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","\tspecularFactor *= texelSpecular.rgb;","#endif"].join("\n"),l=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );","\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","\tglossinessFactor *= texelGlossiness.a;","#endif"].join("\n"),u=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );","material.roughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.","material.roughness += geometryRoughness;","material.roughness = min( material.roughness, 1.0 );","material.specularColor = specularFactor;"].join("\n"),c={specular:{value:(new r.Color).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};return i._extraUniforms=c,i.onBeforeCompile=function(e){for(var t in c)e.uniforms[t]=c[t];e.fragmentShader=e.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>",a).replace("#include <metalnessmap_pars_fragment>",o).replace("#include <roughnessmap_fragment>",s).replace("#include <metalnessmap_fragment>",l).replace("#include <lights_physical_fragment>",u)},Object.defineProperties(Be(i),{specular:{get:function(){return c.specular.value},set:function(e){c.specular.value=e}},specularMap:{get:function(){return c.specularMap.value},set:function(e){(c.specularMap.value=e)?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return c.glossiness.value},set:function(e){c.glossiness.value=e}},glossinessMap:{get:function(){return c.glossinessMap.value},set:function(e){(c.glossinessMap.value=e)?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete i.metalness,delete i.roughness,delete i.metalnessMap,delete i.roughnessMap,i.setValues(n),i}return we(t,[{key:"copy",value:function(e){return ye(Ce(t.prototype),"copy",this).call(this,e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this}}]),t}(),Ke=function(){function e(){be(this,e),this.name=Te.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.specularGlossinessParams=["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"]}return we(e,[{key:"getMaterialType",value:function(){return Je}},{key:"extendParams",value:function(e,t,n){t=t.extensions[this.name];var i,a=(e.color=new r.Color(1,1,1),e.opacity=1,[]);return Array.isArray(t.diffuseFactor)&&(i=t.diffuseFactor,e.color.fromArray(i),e.opacity=i[3]),void 0!==t.diffuseTexture&&a.push(n.assignTexture(e,"map",t.diffuseTexture)),e.emissive=new r.Color(0,0,0),e.glossiness=void 0!==t.glossinessFactor?t.glossinessFactor:1,e.specular=new r.Color(1,1,1),Array.isArray(t.specularFactor)&&e.specular.fromArray(t.specularFactor),void 0!==t.specularGlossinessTexture&&(i=t.specularGlossinessTexture,a.push(n.assignTexture(e,"glossinessMap",i)),a.push(n.assignTexture(e,"specularMap",i))),Promise.all(a)}},{key:"createMaterial",value:function(e){var t=new Je(e);return t.fog=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,t.normalMapType=r.TangentSpaceNormalMap,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t}}]),e}(),We=we((function e(){be(this,e),this.name=Te.KHR_MESH_QUANTIZATION})),Qe=function(){Ae(t,r.Interpolant);var e=Me(t);function t(r,n,i,a){return be(this,t),e.call(this,r,n,i,a)}return we(t,[{key:"copySampleValue_",value:function(e){for(var t=this.resultBuffer,r=this.sampleValues,n=this.valueSize,i=e*n*3+n,a=0;a!==n;a++)t[a]=r[i+a];return t}}]),t}(),Xe=(Qe.prototype.beforeStart_=Qe.prototype.copySampleValue_,Qe.prototype.afterEnd_=Qe.prototype.copySampleValue_,Qe.prototype.interpolate_=function(e,t,r,n){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=2*o,l=3*o,u=n-t,c=e*l,h=c-l,d=-2*(t=(r=(n=(r-t)/u)*n)*n)+3*r,p=t-r,f=1-d,m=p-r+n,v=0;v!==o;v++){var g=a[h+v+o],y=a[h+v+s]*u,b=a[c+v+o],x=a[c+v]*u;i[v]=f*g+m*y+d*b+p*x}return i},new r.Quaternion),Ze=function(){Ae(t,Qe);var e=Me(t);function t(){return be(this,t),e.apply(this,arguments)}return we(t,[{key:"interpolate_",value:function(e,r,n,i){return e=ye(Ce(t.prototype),"interpolate_",this).call(this,e,r,n,i),Xe.fromArray(e).normalize().toArray(e),e}}]),t}(),Ye={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},qe={9728:r.NearestFilter,9729:r.LinearFilter,9984:r.NearestMipmapNearestFilter,9985:r.LinearMipmapNearestFilter,9986:r.NearestMipmapLinearFilter,9987:r.LinearMipmapLinearFilter},$e={33071:r.ClampToEdgeWrapping,33648:r.MirroredRepeatWrapping,10497:r.RepeatWrapping},et={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},tt={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},rt={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},nt={CUBICSPLINE:void 0,LINEAR:r.InterpolateLinear,STEP:r.InterpolateDiscrete};function it(e,t,r){for(var n in r.extensions)void 0===e[n]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[n]=r.extensions[n])}function at(e,t){void 0!==t.extras&&("object"===ge(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function ot(e){for(var t="",r=Object.keys(e).sort(),n=0,i=r.length;n<i;n++)t+=r[n]+":"+e[r[n]]+";";return t}function st(e){switch(e){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.")}}var lt=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};be(this,e),this.json=t,this.extensions={},this.plugins={},this.options=n,this.cache=new Ee,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={},"undefined"!=typeof createImageBitmap&&!1===/Firefox|^((?!chrome|android).)*safari/i.test(navigator.userAgent)?this.textureLoader=new ce(this.options.manager):this.textureLoader=new r.TextureLoader(this.options.manager),this.options.myOptions.helper.options.setTextureLoader(this.textureLoader),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new r.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}return we(e,[{key:"setExtensions",value:function(e){this.extensions=e}},{key:"setPlugins",value:function(e){this.plugins=e}},{key:"parse",value:function(e,t){var r=this,n=this.json,i=this.extensions;this.cache.removeAll(),this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all([this.options.myOptions.helper.processInput(n,this)].concat(fe(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))))).then((function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])})).then((function(t){var a={scene:t[0][n.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:n.asset,parser:r,userData:{}};it(i,a,n),at(a,n),Promise.all(r._invokeAll((function(e){return e.afterRoot&&e.afterRoot(a)}))).then((function(){e(a)}))})).catch(t)}},{key:"_markDefs",value:function(){for(var e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[],n=0,i=t.length;n<i;n++)for(var a=t[n].joints,o=0,s=a.length;o<s;o++)e[a[o]].isBone=!0;for(var l=0,u=e.length;l<u;l++){var c=e[l];void 0!==c.mesh&&(this._addNodeRef(this.meshCache,c.mesh),void 0!==c.skin&&(r[c.mesh].isSkinnedMesh=!0)),void 0!==c.camera&&this._addNodeRef(this.cameraCache,c.camera)}}},{key:"_addNodeRef",value:function(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}},{key:"_getNodeRef",value:function(e,t,r){var n,i=this;return e.refs[t]<=1?r:(n=r.clone(),function e(t,r){var n,a=i.associations.get(t),o=(null!=a&&i.associations.set(r,a),pe(t.children.entries()));try{for(o.s();!(n=o.n()).done;){var s=de(n.value,2),l=s[0];e(s[1],r.children[l])}}catch(e){o.e(e)}finally{o.f()}}(r,n),n.name+="_instance_"+e.uses[t]++,n)}},{key:"_invokeOne",value:function(e){var t=Object.values(this.plugins);t.push(this);for(var r=0;r<t.length;r++){var n=e(t[r]);if(n)return n}return null}},{key:"_invokeAll",value:function(e){for(var t=Object.values(this.plugins),r=(t.unshift(this),[]),n=0;n<t.length;n++){var i=e(t[n]);i&&r.push(i)}return r}},{key:"getDependency",value:function(e,t){var r=e+":"+t,n=this.cache.get(r);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this.loadNode(t);break;case"mesh":n=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":n=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":n=this.loadSkin(t);break;case"animation":n=this.loadAnimation(t);break;case"camera":n=this.loadCamera(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(r,n)}return n}},{key:"getDependencies",value:function(e){var t,r,n=this.cache.get(e);return n||(r=(t=this).json[e+("mesh"===e?"es":"s")]||[],n=Promise.all(r.map((function(r,n){return t.getDependency(e,n)}))),this.cache.add(e,n)),n}},{key:"loadBuffer",value:function(e){var t,n=this.json.buffers[e],i=this.fileLoader;if(n.type&&"arraybuffer"!==n.type)throw new Error("THREE.GLTFLoader: "+n.type+" buffer type is not supported.");return void 0===n.uri&&0===e?Promise.resolve(this.extensions[Te.KHR_BINARY_GLTF].body):(t=this.options,new Promise((function(e,a){i.load(r.LoaderUtils.resolveURL(n.uri,t.path),e,void 0,(function(){a(new Error('THREE.GLTFLoader: Failed to load buffer "'+n.uri+'".'))}))})))}},{key:"loadBufferView",value:function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var r=t.byteLength||0,n=t.byteOffset||0;return e.slice(n,n+r)}))}},{key:"loadAccessor",value:function(e){var t=this,n=this.json,i=this.json.accessors[e];return void 0===i.bufferView&&void 0===i.sparse?Promise.resolve(null):(e=[],void 0!==i.bufferView?e.push(this.getDependency("bufferView",i.bufferView)):e.push(null),void 0!==i.sparse&&(e.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),e.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(e).then((function(e){var a,o=e[0],s=et[i.type],l=Ye[i.componentType],u=l.BYTES_PER_ELEMENT,c=i.byteOffset||0,h=void 0!==i.bufferView?n.bufferViews[i.bufferView].byteStride:void 0,d=!0===i.normalized,p=h&&h!==u*s?(f=Math.floor(c/h),m="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+f+":"+i.count,(v=t.cache.get(m))||(a=new l(o,f*h,i.count*h/u),v=new r.InterleavedBuffer(a,h/u),t.cache.add(m,v)),new r.InterleavedBufferAttribute(v,s,c%h/u,d)):(a=null===o?new l(i.count*s):new l(o,c,i.count*s),new r.BufferAttribute(a,s,d));if(void 0!==i.sparse){var f=Ye[i.sparse.indices.componentType],m=i.sparse.indices.byteOffset||0,v=i.sparse.values.byteOffset||0,g=new f(e[1],m,i.sparse.count*et.SCALAR),y=new l(e[2],v,i.sparse.count*s);null!==o&&(p=new r.BufferAttribute(p.array.slice(),p.itemSize,p.normalized));for(var b=0,x=g.length;b<x;b++){var w=g[b];if(p.setX(w,y[b*s]),2<=s&&p.setY(w,y[b*s+1]),3<=s&&p.setZ(w,y[b*s+2]),4<=s&&p.setW(w,y[b*s+3]),5<=s)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return p})))}},{key:"loadTexture",value:function(e){var t=this.json,r=this.options,n=t.textures[e].source,i=(t=t.images[n],this.textureLoader);return t.uri&&null!==(r=r.manager.getHandler(t.uri))&&(i=r),this.loadTextureImage(e,n,i)}},{key:"loadTextureImage",value:function(e,t,n){var i=this,a=this.json,o=a.textures[e],s=((s=a.images[t]).uri||s.bufferView)+":"+o.sampler;return this.textureCache[s]||(t=this.loadImageSource(t,n,e).then((function(t){t.flipY=!1,o.name&&(t.name=o.name);var n=(a.samplers||{})[o.sampler]||{};return t.magFilter=qe[n.magFilter]||r.LinearFilter,t.minFilter=qe[n.minFilter]||r.LinearMipmapLinearFilter,t.wrapS=$e[n.wrapS]||r.RepeatWrapping,t.wrapT=$e[n.wrapT]||r.RepeatWrapping,i.associations.set(t,{textures:e}),i.options.myOptions.helper.material.processTexture({texture:t,textureDef:o}),t})).catch((function(e){return null})),this.textureCache[s]=t)}},{key:"loadImageSource",value:function(e,t,n){var i=this.json,a=this.options,o=i.textures[n];if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((function(e){return e.clone()})).catch((function(e){throw e}));var s=i.images[e],l=self.URL||self.webkitURL,u=s.uri||"";if(void 0!==s.bufferView)u=this.getDependency("bufferView",s.bufferView).then((function(e){return e=new Blob([e],{type:s.mimeType}),u=l.createObjectURL(e)}));else if(void 0===s.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");return n=Promise.resolve(u).then((function(e){return new Promise((function(n,i){var s,l;!0===t.isImageBitmapLoader?(s=function(e,t){(e=new r.Texture(e)).needsUpdate=!0,n({texture:e,blob:t})},t.load(r.LoaderUtils.resolveURL(e,a.path),s,void 0,i,o)):(l=a.myOptions.loadConfig.reverseTexture,(0,he.urlToCanvas)(e).then((function(e){var t=e.ctx,i=e.canvas,a=(e=e.img,new r.Texture(i));l||(t.clearRect(0,0,i.width,i.height),t.translate(0,i.height),t.scale(1,-1),t.drawImage(e,0,0,i.width,i.height)),n(a)})).catch(i))}))})).then((function(e){var r=(e=t.isImageBitmapLoader?e:{texture:e,blob:null}).texture;return e=e.blob,!0===t.isImageBitmapLoader&&(r.userData.url=u,r.userData.blob=e),r.url=u,r})).catch((function(e){throw console.log(e,"error"),console.error("THREE.GLTFLoader: Couldn't load texture",u),e})),this.sourceCache[e]=n}},{key:"assignTexture",value:function(e,t,r){var n=this;return this.getDependency("texture",r.index).then((function(i){var a,o;return void 0===r.texCoord||0==r.texCoord||"aoMap"===t&&1==r.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+t+" not yet supported."),n.extensions[Te.KHR_TEXTURE_TRANSFORM]&&(a=void 0!==r.extensions?r.extensions[Te.KHR_TEXTURE_TRANSFORM]:void 0)&&(o=n.associations.get(i),i=n.extensions[Te.KHR_TEXTURE_TRANSFORM].extendTexture(i,a),n.associations.set(i,o)),e[t]=i}))}},{key:"assignFinalMaterial",value:function(e){var t,n,i=e.geometry,a=e.material,o=void 0===i.attributes.tangent,s=void 0!==i.attributes.color,l=void 0===i.attributes.normal;e.isPoints?(t="PointsMaterial:"+a.uuid,(n=this.cache.get(t))||(n=new r.PointsMaterial,r.Material.prototype.copy.call(n,a),n.color.copy(a.color),n.map=a.map,n.sizeAttenuation=!1,this.cache.add(t,n)),a=n):e.isLine&&(t="LineBasicMaterial:"+a.uuid,(n=this.cache.get(t))||(n=new r.LineBasicMaterial,r.Material.prototype.copy.call(n,a),n.color.copy(a.color),this.cache.add(t,n)),a=n),(o||s||l)&&(t="ClonedMaterial:"+a.uuid+":",a.isGLTFSpecularGlossinessMaterial&&(t+="specular-glossiness:"),o&&(t+="derivative-tangents:"),s&&(t+="vertex-colors:"),l&&(t+="flat-shading:"),(n=this.cache.get(t))||(n=a.clone(),s&&(n.vertexColors=!0),l&&(n.flatShading=!0),o&&(n.normalScale&&(n.normalScale.y*=-1),n.clearcoatNormalScale&&(n.clearcoatNormalScale.y*=-1)),this.cache.add(t,n),this.associations.set(n,this.associations.get(a)))),a.aoMap&&void 0===i.attributes.uv2&&void 0!==i.attributes.uv&&i.setAttribute("uv2",i.attributes.uv),this.options.myOptions.helper.material.process({material:a,materialDef:a.userData,model:e}),e.material=a}},{key:"getMaterialType",value:function(){return r.MeshStandardMaterial}},{key:"loadMaterial",value:function(e){var t,n=this,i=this.json,a=this.extensions,o=i.materials[e],s={},l=[],u=((i=o.extensions||{})[Te.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]?(u=a[Te.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS],t=u.getMaterialType(),l.push(u.extendParams(s,o,n))):i[Te.KHR_MATERIALS_UNLIT]?(u=a[Te.KHR_MATERIALS_UNLIT],t=u.getMaterialType(),l.push(u.extendParams(s,o,n))):(i=o.pbrMetallicRoughness||{},s.color=new r.Color(1,1,1),s.opacity=1,Array.isArray(i.baseColorFactor)&&(u=i.baseColorFactor,s.color.fromArray(u),s.opacity=u[3]),void 0!==i.baseColorTexture&&l.push(n.assignTexture(s,"map",i.baseColorTexture)),s.metalness=void 0!==i.metallicFactor?i.metallicFactor:1,s.roughness=void 0!==i.roughnessFactor?i.roughnessFactor:1,void 0!==i.metallicRoughnessTexture&&(l.push(n.assignTexture(s,"metalnessMap",i.metallicRoughnessTexture)),l.push(n.assignTexture(s,"roughnessMap",i.metallicRoughnessTexture))),t=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),l.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,s)}))))),!0===o.doubleSided&&(s.side=r.DoubleSide),o.alphaMode||"OPAQUE");return"BLEND"===u?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,"MASK"===u&&(s.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&t!==r.MeshBasicMaterial&&(l.push(n.assignTexture(s,"normalMap",o.normalTexture)),s.normalScale=new r.Vector2(1,1),void 0!==o.normalTexture.scale&&(i=o.normalTexture.scale,s.normalScale.set(i,i))),void 0!==o.occlusionTexture&&t!==r.MeshBasicMaterial&&(l.push(n.assignTexture(s,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(s.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&t!==r.MeshBasicMaterial&&(s.emissive=(new r.Color).fromArray(o.emissiveFactor)),void 0!==o.emissiveTexture&&t!==r.MeshBasicMaterial&&l.push(n.assignTexture(s,"emissiveMap",o.emissiveTexture)),Promise.all(l).then((function(){var i=t===Je?a[Te.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(s):new t(s);return o.name&&(i.name=o.name),i.map&&(i.map.encoding=r.sRGBEncoding),i.emissiveMap&&(i.emissiveMap.encoding=r.sRGBEncoding),at(i,o),n.associations.set(i,{materials:e}),o.extensions&&it(a,i,o),i}))}},{key:"createUniqueName",value:function(e){for(var t=r.PropertyBinding.sanitizeNodeName(e||""),n=t,i=1;this.nodeNamesUsed[n];++i)n=t+"_"+i;return this.nodeNamesUsed[n]=!0,n}},{key:"loadGeometries",value:function(e){for(var t=this,n=this.extensions,i=this.primitiveCache,a=[],o=0,s=e.length;o<s;o++){var l=e[o],u=(c=void 0,c=(c=(u=l).extensions&&u.extensions[Te.KHR_DRACO_MESH_COMPRESSION])?"draco:"+c.bufferView+":"+c.indices+":"+ot(c.attributes):u.indices+":"+ot(u.attributes)+":"+u.mode),c=i[u];c?a.push(c.promise):(c=void 0,c=l.extensions&&l.extensions[Te.KHR_DRACO_MESH_COMPRESSION]?function(e){return n[Te.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(r){return ut(r,e,t)}))}(l):ut(new r.BufferGeometry,l,t),i[u]={primitive:l,promise:c},a.push(c))}return Promise.all(a)}},{key:"loadMesh",value:function(e){for(var t=this,n=this.json,i=this.extensions,a=n.meshes[e],o=a.primitives,s=[],l=0,u=o.length;l<u;l++){var c=void 0===o[l].material?(void 0===(c=this.cache).DefaultMaterial&&(c.DefaultMaterial=new r.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:r.FrontSide})),c.DefaultMaterial):this.getDependency("material",o[l].material);s.push(c)}return s.push(t.loadGeometries(o)),Promise.all(s).then((function(n){for(var s=n.slice(0,n.length-1),l=n[n.length-1],u=[],c=0,h=l.length;c<h;c++){var d=l[c],p=o[c],f=void 0,m=s[c];if(4===p.mode||5===p.mode||6===p.mode||void 0===p.mode)!0!==(f=new(!0===a.isSkinnedMesh?r.SkinnedMesh:r.Mesh)(d,m)).isSkinnedMesh||f.geometry.attributes.skinWeight.normalized||f.normalizeSkinWeights(),5===p.mode?f.geometry=ct(f.geometry,r.TriangleStripDrawMode):6===p.mode&&(f.geometry=ct(f.geometry,r.TriangleFanDrawMode));else if(1===p.mode)f=new r.LineSegments(d,m);else if(3===p.mode)f=new r.Line(d,m);else if(2===p.mode)f=new r.LineLoop(d,m);else{if(0!==p.mode)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+p.mode);f=new r.Points(d,m)}if(0<Object.keys(f.geometry.morphAttributes).length){A=w=x=b=y=v=void 0;var v=f,g=a;if(v.updateMorphTargets(),void 0!==g.weights)for(var y=0,b=g.weights.length;y<b;y++)v.morphTargetInfluences[y]=g.weights[y];if(g.extras&&Array.isArray(g.extras.targetNames)){var x=g.extras.targetNames;if(v.morphTargetInfluences.length===x.length){v.morphTargetDictionary={};for(var w=0,A=x.length;w<A;w++)v.morphTargetDictionary[x[w]]=w}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}f.name=t.createUniqueName(a.name||"mesh_"+e),at(f,a),p.extensions&&it(i,f,p),t.assignFinalMaterial(f),u.push(f)}for(var S=0,M=u.length;S<M;S++)t.associations.set(u[S],{meshes:e,primitives:S});if(1===u.length)return u[0];var B=new r.Group;t.associations.set(B,{meshes:e});for(var C=0,_=u.length;C<_;C++)B.add(u[C]);return B}))}},{key:"loadCamera",value:function(e){var t,n=(e=this.json.cameras[e])[e.type];if(n)return"perspective"===e.type?t=new r.PerspectiveCamera(r.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===e.type&&(t=new r.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),e.name&&(t.name=this.createUniqueName(e.name)),at(t,e),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}},{key:"loadSkin",value:function(e){var t={joints:(e=this.json.skins[e]).joints};return void 0===e.inverseBindMatrices?Promise.resolve(t):this.getDependency("accessor",e.inverseBindMatrices).then((function(e){return t.inverseBindMatrices=e,t}))}},{key:"loadAnimation",value:function(e){for(var t=this.json.animations[e],n=[],i=[],a=[],o=[],s=[],l=0,u=t.channels.length;l<u;l++){var c=t.channels[l],h=t.samplers[c.sampler],d=void 0!==(c=c.target).node?c.node:c.id,p=void 0!==t.parameters?t.parameters[h.input]:h.input,f=void 0!==t.parameters?t.parameters[h.output]:h.output;n.push(this.getDependency("node",d)),i.push(this.getDependency("accessor",p)),a.push(this.getDependency("accessor",f)),o.push(h),s.push(c)}return Promise.all([Promise.all(n),Promise.all(i),Promise.all(a),Promise.all(o),Promise.all(s)]).then((function(n){for(var i=n[0],a=n[1],o=n[2],s=n[3],l=n[4],u=[],c=0,h=i.length;c<h;c++)!function(e){var t=i[e],n=a[e],c=o[e],h=s[e],d=l[e];if(void 0!==t){t.updateMatrix(),t.matrixAutoUpdate=!0;var p=void 0;switch(rt[d.path]){case rt.weights:p=r.NumberKeyframeTrack;break;case rt.rotation:p=r.QuaternionKeyframeTrack;break;default:p=r.VectorKeyframeTrack}e=t.name||t.uuid;var f=void 0!==h.interpolation?nt[h.interpolation]:r.InterpolateLinear,m=[],v=(rt[d.path]===rt.weights?t.traverse((function(e){e.morphTargetInfluences&&m.push(e.name||e.uuid)})):m.push(e),c.array);if(c.normalized){for(var g=st(v.constructor),y=new Float32Array(v.length),b=0,x=v.length;b<x;b++)y[b]=v[b]*g;v=y}for(var w=0,A=m.length;w<A;w++){var S=new p(m[w]+"."+rt[d.path],n.array,v,f);"CUBICSPLINE"===h.interpolation&&(S.createInterpolant=function(e){return new(this instanceof r.QuaternionKeyframeTrack?Ze:Qe)(this.times,this.values,this.getValueSize()/3,e)},S.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),u.push(S)}}}(c);return n=t.name||"animation_"+e,new r.AnimationClip(n,void 0,u)}))}},{key:"createNodeMesh",value:function(e){var t=this.json,r=this,n=t.nodes[e];return void 0===n.mesh?null:r.getDependency("mesh",n.mesh).then((function(e){return e=r._getNodeRef(r.meshCache,n.mesh,e),void 0!==n.weights&&e.traverse((function(e){if(e.isMesh)for(var t=0,r=n.weights.length;t<r;t++)e.morphTargetInfluences[t]=n.weights[t]})),e}))}},{key:"loadNode",value:function(e){var t,n=this.json,i=this.extensions,a=this,o=n.nodes[e],s=o.name?a.createUniqueName(o.name):"";return t=[],(n=a._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)})))&&t.push(n),void 0!==o.camera&&t.push(a.getDependency("camera",o.camera).then((function(e){return a._getNodeRef(a.cameraCache,o.camera,e)}))),a._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){t.push(e)})),Promise.all(t).then((function(t){var n,l=!0===o.isBone?new r.Bone:1<t.length?new r.Group:1===t.length?t[0]:new r.Object3D;if(l!==t[0])for(var u=0,c=t.length;u<c;u++)l.add(t[u]);return o.name&&(l.userData.name=o.name,l.name=s),at(l,o),o.extensions&&it(i,l,o),void 0!==o.matrix?((n=new r.Matrix4).fromArray(o.matrix),l.applyMatrix4(n)):(void 0!==o.translation&&l.position.fromArray(o.translation),void 0!==o.rotation&&l.quaternion.fromArray(o.rotation),void 0!==o.scale&&l.scale.fromArray(o.scale)),a.associations.has(l)||a.associations.set(l,{}),a.associations.get(l).nodes=e,a.options.myOptions.helper.processNode({node:l,nodeDef:o})||l}))}},{key:"loadScene",value:function(e){for(var t=this.json,n=this.extensions,i=(e=this.json.scenes[e],this),a=new r.Group,o=(a.isLoadScene=!0,e.name&&(a.name=i.createUniqueName(e.name)),at(a,e),e.extensions&&it(n,a,e),e.nodes||[]),s=[],l=0,u=o.length;l<u;l++)s.push(function e(t){var n=t.nodeId,i=t.parentObject,a=t.json,o=t.parser,s=t.idMap,l=t.children,u=a.nodes[n];return o.getDependency("node",n).then((function(e){var t;return void 0===u.skin?e:o.getDependency("skin",u.skin).then((function(e){for(var r=[],n=0,i=(t=e).joints.length;n<i;n++)r.push(o.getDependency("node",t.joints[n]));return Promise.all(r)})).then((function(n){return e.traverse((function(e){if(e.isMesh){for(var i=[],a=[],o=0,s=n.length;o<s;o++){var l=n[o];l?(i.push(l),l=new r.Matrix4,void 0!==t.inverseBindMatrices&&l.fromArray(t.inverseBindMatrices.array,16*o),a.push(l)):console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[o])}e.bind(new r.Skeleton(i,a),e.matrixWorld)}})),e}))})).then((function(t){var r,c;i.isLoadScene&&null!=(r=a.asset.ex)&&r.type,s&&s.set(n,t),i.add(t);try{void 0!==l&&(null==l?void 0:l.length)===i.children.length&&(l[0],c=!0,l.forEach((function(e){s.get(e)||(c=!1)})),c&&(i.children=fe(s.entries()).sort((function(e,t){return e[0]-t[0]})).map((function(e){return(e=de(e,2))[0],e[1]})),s.clear()))}catch(t){console.log(t,"e")}var h=[];if(u.children)for(var d=u.children,p=new Map,f=0,m=d.length;f<m;f++){var v=d[f];h.push(e({idMap:p,nodeId:v,parentObject:t,json:a,parser:o,children:d}))}return Promise.all(h)}))}({nodeId:o[l],parentObject:a,json:t,parser:i}));return Promise.all(s).then((function(){return i.options.myOptions&&i.options.myOptions.models.push(a),i.associations=function(e){var t,n=new Map,a=pe(i.associations);try{for(a.s();!(t=a.n()).done;){var o=de(t.value,2),s=o[0],l=o[1];(s instanceof r.Material||s instanceof r.Texture)&&n.set(s,l)}}catch(e){a.e(e)}finally{a.f()}return e.traverse((function(e){var t=i.associations.get(e);null!=t&&n.set(e,t)})),n}(a),a}))}}]),e}();function ut(e,t,n){var i,a=t.attributes,o=[];for(i in a){var s=tt[i]||i.toLowerCase();s in e.attributes||o.push(function(t,r){return n.getDependency("accessor",t).then((function(t){e.setAttribute(r,t)}))}(a[i],s))}void 0===t.indices||e.index||(l=n.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)})),o.push(l)),at(e,t);var l=e,u=t,c=n,h=u.attributes,d=new r.Box3;if(void 0!==h.POSITION){var p=(h=c.json.accessors[h.POSITION]).min,f=h.max;if(void 0===p||void 0===f)console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");else{d.set(new r.Vector3(p[0],p[1],p[2]),new r.Vector3(f[0],f[1],f[2])),h.normalized&&(p=st(Ye[h.componentType]),d.min.multiplyScalar(p),d.max.multiplyScalar(p));var m=u.targets;if(void 0!==m){for(var v=new r.Vector3,g=new r.Vector3,y=0,b=m.length;y<b;y++){var x,w,A=m[y];void 0!==A.POSITION&&(w=(A=c.json.accessors[A.POSITION]).min,x=A.max,void 0!==w&&void 0!==x?(g.setX(Math.max(Math.abs(w[0]),Math.abs(x[0]))),g.setY(Math.max(Math.abs(w[1]),Math.abs(x[1]))),g.setZ(Math.max(Math.abs(w[2]),Math.abs(x[2]))),A.normalized&&(w=st(Ye[A.componentType]),g.multiplyScalar(w)),v.max(g)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION."))}d.expandByVector(v)}l.boundingBox=d,f=new r.Sphere,d.getCenter(f.center),f.radius=d.min.distanceTo(d.max)/2,l.boundingSphere=f}}return Promise.all(o).then((function(){if(void 0===t.targets)return e;for(var r=e,i=t.targets,a=n,o=!1,s=!1,l=!1,u=0,c=i.length;u<c;u++){var h=i[u];if(void 0!==h.POSITION&&(o=!0),void 0!==h.NORMAL&&(s=!0),void 0!==h.COLOR_0&&(l=!0),o&&s&&l)break}if(!o&&!s&&!l)return Promise.resolve(r);for(var d=[],p=[],f=[],m=0,v=i.length;m<v;m++){var g,y=i[m];o&&(g=void 0!==y.POSITION?a.getDependency("accessor",y.POSITION):r.attributes.position,d.push(g)),s&&(g=void 0!==y.NORMAL?a.getDependency("accessor",y.NORMAL):r.attributes.normal,p.push(g)),l&&(y=void 0!==y.COLOR_0?a.getDependency("accessor",y.COLOR_0):r.attributes.color,f.push(y))}return Promise.all([Promise.all(d),Promise.all(p),Promise.all(f)]).then((function(e){var t=e[0],n=e[1];return e=e[2],o&&(r.morphAttributes.position=t),s&&(r.morphAttributes.normal=n),l&&(r.morphAttributes.color=e),r.morphTargetsRelative=!0,r}))}))}function ct(e,t){var n=e.getIndex();if(null===n){var i=[],a=e.getAttribute("position");if(void 0===a)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var o=0;o<a.count;o++)i.push(o);e.setIndex(i),n=e.getIndex()}var s=n.count-2,l=[];if(t===r.TriangleFanDrawMode)for(var u=1;u<=s;u++)l.push(n.getX(0)),l.push(n.getX(u)),l.push(n.getX(u+1));else for(var c=0;c<s;c++)c%2==0?(l.push(n.getX(c)),l.push(n.getX(c+1)),l.push(n.getX(c+2))):(l.push(n.getX(c+2)),l.push(n.getX(c+1)),l.push(n.getX(c)));return l.length/3!=s&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles."),(t=e.clone()).setIndex(l),t}__webpack_require__(4091);var ht=__webpack_require__(1794),dt=__webpack_require__(5247),pt=__webpack_require__(110),ft=__webpack_require__(3778),mt=__webpack_require__(911),vt=__webpack_require__(6272),gt=__webpack_require__(3765),yt=__webpack_require__(4233);class bt{constructor(e,t){this.materialMap={},this.textureMap={},this.materialIns={},this.textureIns={},this.pending=[],this.clonedTextures=[],this.parser=null,this.processTextureMap=(()=>{const e=e=>{var t,{target:e,data:r}=e;r&&(({x:r,y:t}="object"==typeof r?r:{x:r,y:r}),e.x=r,e.y=t)};return t=>{(0,z.js)(t,((t,r)=>{var{format:r,center:n,rotation:i,offset:a,repeat:o}=r;(t=this.textureIns[t])&&(t.format=r,e({target:t.repeat,data:o}),e({target:t.center,data:n}),e({target:t.offset,data:a}),i&&(t.rotation=i),this.runScene.textureEx.initTextureAndAddtoAll(t))}))}})(),this.processMaterialMap=(()=>{const e=e=>{const{textures:t,normal:r,models:n,material:i}=e;this.runScene.optionsEx.options.texture.load&&this.processBaseMaterialTextures({material:i,textures:t}),this.runScene.materialEx.parseNromals(r,i),n.map((e=>e.material=i))},t=e=>{var{textures:e,normal:t,models:r,material:n}=e;e=(0,z.js)(e,((e,t)=>({type:e,texture:this.textureIns[t]})));const i=this.runScene.materialEx.getDataByType(t.type,{normal:t,textures:e,models:r,material:n});this.runScene.materialEx.parseNromals(t,i),i&&r.map((e=>e.material=i))};return r=>{(0,z.js)(r,((r,n)=>{var i,a;(r=this.materialIns[r])&&(({material:r,models:i}=r),r&&(({normal:n,textures:a}=n),(n.type?t:e)({textures:a,models:i,material:r,normal:n}),r.needsUpdate=!0))}))}})(),this.baseMaterialTextures=[],this.processBaseMaterialTextures=e=>{const{textures:t,material:r}=e;(0,z.js)(t,((e,t)=>{var n;(t=this.textureIns[t])&&(this.runScene.optionsEx.options.texture.lazyLoad.open&&"scene"===(null==(n=this.parser)?void 0:n.json.asset.ex.type)&&(null==(n=this.parser)?void 0:n.json.asset.ex.sceneEx.materialId)!==r.userData.id?this.baseMaterialTextures.push({material:r,type:e,texture:t}):(this.runScene.uniqueEx.texture.addMaterial(t,{material:r,type:e}),(0,gt.setMaterialTexture)({material:r,type:e,texture:t})))}))},this.lazyLoad=(()=>{const e=()=>{var e;this.loadConfig.triggerCb&&this.runScene.cb.loaderer.gltf.lazyLoadedTexture.cb(""),null!=(e=this.loadConfig)&&e.lazyLoadedTexture(),this.runScene.optionsEx.log("贴图懒加载完毕","base","success")},t=(r,n)=>{var i;if(!(i=this.baseMaterialTextures[r]))return n(),e();var{texture:i,type:a,material:o}=i;this.runScene.uniqueEx.texture.addMaterial(i,{material:o,type:a}),(0,gt.setMaterialTexture)({material:o,type:a,texture:i}),o.needsUpdate=!0,setTimeout((()=>t(++r,n)),this.runScene.optionsEx.options.texture.lazyLoad.intervalTime)};return()=>new Promise((r=>{if(!this.runScene.optionsEx.options.texture.lazyLoad.open)return r(0),e();t(0,r)}))})(),this.runScene=e,this.loadConfig=t}processInput(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function a(e){try{s(n.next(e))}catch(e){i(e)}}function o(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(a,o)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){this.parser=t}))}processTexture(e){var{textureDef:e,texture:t}=e,{md5:r,format:n,size:i,uvScript:a,id:o,cloneSourceId:s,minFilter:l}=e;t.userData.md5=r,n&&(t.format=n,t.userData.format=n),a&&(t.userData.uvScript=a),s&&((0,mt.setTextureCloneId)(t,s),this.clonedTextures.push(t)),"nearest"===l&&((0,mt.setTextureMinFilter)(t,"nearest"),(0,yt.M)(t,"minFilter",l)),t.userData.id=o,t.userData.size=i,this.textureIns[e.id]=this.runScene.textureEx.getSameTexture(r,t)||t}process(e){var{materialDef:e,material:t,model:r}=e;(0,gt.initMaterial)(t),this.materialIns[e.id]||(this.materialIns[e.id]={material:t,models:[]}),this.materialIns[e.id].models.push(r)}done(e){var{materialMap:e,textureMap:t}=e.asset.ex||{};return this.processTextureMap(t||{}),this.processMaterialMap(e||{}),this.processClonedTextures(),this.pending.push(this.lazyLoad()),Promise.all(this.pending)}processClonedTextures(){this.clonedTextures.map((e=>{var t=(0,mt.getCloneIdFromTexture)(e);((t=this.textureIns[t])?(e.image=t.image,e.needsUpdate=!0,e.userData.blob=t.userData.blob,e.userData.md5=t.userData.md5,e.userData.url=t.userData.url,mt.bindTextureBaseData):(this.runScene.textureEx.delete(e),(0,yt.bv)(e,"cloneSourceId"),mt.disposeTexture))(e)}))}}class xt{constructor(e,t){this.runScene=e,this.loadConfig=t}setTextureLoader(e){this.textureLoader=e,this.initTextureLoader(e)}initTextureLoader(e){e instanceof ce&&e.setOptions({reverseTexture:this.loadConfig.reverseTexture,textureQuality:this.runScene.optionsEx.options.texture.quality})}}class wt{constructor(e,t){this.runScene=e,this.loadConfig=t}done(e){var t,r,n,i;e.asset.ex&&(({camera:e,lights:t,options:r,controls:n,tags:i}=e.asset.ex),this.runScene.tags.parseJSON(i||{}),this.camera(e),this.controls(n),this.lights(t),this.options(r))}controls(e){var t,r;e&&(({x:e,y:t,z:r}=e),this.runScene.assetsEx.controls.target.set(e,t,r),this.runScene.assetsEx.controls.update())}camera(e){var{position:e,far:t,near:r,fov:n,name:i,userData:a}=this.runScene.loaderer.object.parse(e),o=this.runScene.assetsEx.get().camera;o.position.copy(e),o.far=t,o.near=r,o.fov=n,o.name=i,o.updateProjectionMatrix(),o.userData.id=a.id,this.runScene.uniqueEx.model.add(o),this.runScene.assetsEx.get().controls.update()}lights(e){e.map((e=>{var t=e.type;(t=this.runScene.lightEx.lightExMap[t].parseJSON(e)).target&&this.runScene.modelEx.setSelectByModel(t.target),this.runScene.lightEx.setNull(t)}))}options(e){e.map((e=>{var{type:e,data:t}=e;null!=(e=this.runScene.exporter.gltf.options.getParse(e))&&e.parse(t)}))}}class At{constructor(e,t){this.helperModels=[],this.pending=[],this.nodeMap=new ht.Z,this.instancedMap={},this.clonedMap={},this.nodeType={MySpriteMaterial:pt.Z},this.runScene=e,this.loadConfig=t,this.material=new bt(e,t),this.scene=new wt(e,t),this.options=new xt(e,t)}processInput(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function a(e){try{s(n.next(e))}catch(e){i(e)}}function o(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(a,o)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){this.material.processInput(e,t)}))}beforeLoader(e){null!=(t=this.loadConfig)&&t.triggerCb&&this.runScene.cb.loaderer.gltf.getJSON.cb(e);var t=this.processBase64(e);return this.runScene.loaderer.gltf.beforeParse(null==(e=null==(e=e.asset)?void 0:e.ex)?void 0:e.type),"editor"===this.runScene.optionsEx.options.mode||t}processBase64(e){return!e.asset.ex||!(e=e.asset.ex.base64)||!!(e=(0,vt.Ne)(e))&&(e=Number(e),!isNaN(e)&&(new Date).getTime()<e)}processNode(e){var t,r,n,i,a,o,s;this.runScene.cb.loaderer.gltf.loadNode.cb(e);let{node:l,nodeDef:u}=e;return(0,z.js)(this.runScene.modelEx.defNodeMap,((e,t)=>{var r=u[e];null!=r&&(l[e]=r)})),u.extras&&(({layers:e,normal:t,local:r,cloneId:n,id:o,animations:s,isDynamic:i}=u.extras),a=(0,ft.isDynamicModel)(l,!0),"running"!==this.runScene.optionsEx.options.mode||a||this.runScene.optionsEx.options.renderConfig.matrixAutoUpdate||(l.matrixAutoUpdate=!1),o&&this.nodeMap.set(o,l),s&&(l.animations=_t.parse(s)),i&&(l.userData.isDynamic=!0),n&&!a&&(this.instancedMap[n]||(this.instancedMap[n]=new Set),this.instancedMap[n].add(l)),r&&([o,s,i]=r.split(","),l.position.set(o,s,i)),e&&(l.layers.enable(1),this.runScene.cb.model.setLayers.cb({model:l,val:1})),u.extras.isHelper&&this.helperModels.push(l),t&&(a=this.nodeType[null==t?void 0:t.type].modelTools.parseData(l,t),l=a),(o=null==(r=null==(n=null==l?void 0:l.material)?void 0:n.userData)?void 0:r.id)&&(s=this.material.materialIns[o])&&s.models.push(l)),u.wireframe&&(l.material.wireframe=!0),l}done(e){var t;return this.pending.push(this.material.done(e)),"scene"===(null==(t=e.asset.ex)?void 0:t.type)&&(this.scene.done(e),this.sceneEx(e)),this.removeHelperModel(),Promise.all(this.pending)}mergeGeometry(){}mergeClone(){var e;this.runScene.optionsEx.options.instanceClone&&"running"===this.runScene.optionsEx.options.mode&&(this.runScene.assetsEx.scene.updateMatrixWorld(),e=this.instancedMap,(0,z.js)(e,((e,t)=>{var r,n=this.runScene.uniqueEx.model.map[e];t.size<2||!n||!n.geometry||(0,ft.isDynamicModel)(n,!0)||(r=(0,ft.instanceModel)(n,[...t]),this.runScene.modelEx.add(r,void 0,{isClone:!1,select:!1,addUndo:!1}),(0,ft.isGLowModel)(n)&&this.runScene.modelEx.setGlow(r,!0),this.runScene.modelEx.remove(n,!1),t.forEach((e=>this.runScene.modelEx.remove(e,!1))),t.clear(),delete this.instancedMap[e])}))),this.instancedMap={}}sceneEx(e){var t=this.runScene.sceneEx.get(),n=this.material.materialIns,{materialId:e,backgroundMapping:i,backgroundColor:a,fog:o}=e.asset.ex.sceneEx;e&&(e=null==(n=n[e])?void 0:n.material)&&(({map:n,envMap:e}=e),n&&(n.mapping=i||300,n.needsUpdate=!0,this.runScene.sceneEx.setBackground(n,!1),n.userData.isBackgroud=!0),e&&(t.environment=(0,mt.setTextureMapping)(e))),a&&(t.background=new r.Color("#"+a)),o&&(({color:i,far:n,near:e}=o),a=new r.Fog("#"+i,e,n),t.fog=a,t.fog.open="true",this.runScene.cb.setScene.cb({scene:t,type:"fog",val:a})),this.runScene.cb.setScene.cb({scene:t,type:"any",val:"any"})}removeHelperModel(){this.helperModels.map((e=>{var t;return null==(t=e.parent)?void 0:t.remove(e)}))}}class St{constructor(e){this.dracoPath="./draco/",this._gltf=new _e,this.runScene=e,(e=new re).setDecoderPath(this.runScene.optionsEx.options.decodePath),this._gltf.setMeshoptDecoder(Z),this._gltf.setDRACOLoader(e)}load(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function a(e){try{s(n.next(e))}catch(e){i(e)}}function o(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(a,o)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){var r=yield N().get(e,{responseType:"arraybuffer",onDownloadProgress:e=>{var{total:e,loaded:r}=e;let n=r/e;1<(n=n<0?0:n)&&(n=1);var r=Number(n.toFixed(2));e=Math.floor(100*r),null!=(r=null==t?void 0:t.progress)&&r.call(t,e),this.runScene.optionsEx.log("下载场景进度:"+e,"detail"),null!=t&&t.triggerCb&&this.runScene.cb.loaderer.gltf.progress.cb(e)}}).then((e=>e.data)).catch((e=>{this.runScene.optionsEx.log("下载场景失败:",e)}));return r?this.parse(r,t):Promise.resolve()}))}parse(e,t){var r;const n=(0,he.mergeObject)({addToScene:!0,cleanJSON:!0,triggerCb:!1,reverseTexture:!1},t);return null!=(r=null==t?void 0:t.getArrayBuffer)&&r.call(t,e),null!=n&&n.triggerCb&&this.runScene.cb.loaderer.gltf.getArrayBuffer.cb(e),new Promise((t=>{try{e instanceof ArrayBuffer&&this._gltf.parse(e,"",(e=>{e=this.afterParse(e.parser.options.myOptions,e,n),t(e)}),(e=>{console.log(e,"_a")}),{rootModel:this.runScene.assetsEx.get().scene,models:[],helper:new At(this.runScene,n),runScene:this.runScene,loadConfig:n})}catch(e){throw this.runScene.optionsEx.log("加载场景出错:"+e),TypeError(e)}}))}beforeParse(e){"scene"===e&&this.runScene.optionsEx.sceneOptions.loaded&&this.runScene.sceneEx.clean()}afterParse(e,t,r){var n=e.helper.done(t);const{addToScene:i,cleanJSON:a,triggerCb:o,getJSON:s}=r,l=e.models;o&&this.runScene.cb.loaderer.gltf.modelLoaded.cb(l),null!=(c=null==r?void 0:r.modelLoaded)&&c.call(r,l);let u=[];var c=(t.asset.ex||{}).type;return"material"===c?this.parseMaterial(l):("model"===c?u=this.parseModel(l[0]):(u=this.parseScene({model:l[0],json:t,config:r}),this.runScene.optionsEx.sceneOptions.loaded=!0),i&&this.runScene.modelEx.add(u,void 0,{addUndo:!1,select:!1,isClone:"model"===(null==(c=t.asset.ex)?void 0:c.type)}),this.runScene.modelEx.selectNull(),this.runScene.timeLineEx.parseSavedGroupMap((null==(c=t.asset.ex)?void 0:c.timeLine)||{}),i&&e.helper.mergeClone(),this.runScene.optionsEx.log(t,"detail"),n.then((()=>{var e;null!=(e=null==r?void 0:r.complete)&&e.call(r,{models:l,json:t}),o&&this.runScene.cb.loaderer.gltf.complete.cb({models:l,json:t})}))),null!=s&&s(t),a&&this.disposeJSON(t),u}parseMaterial(e){var t,[e]=e;if(e=this.runScene.sceneEx.cleanUnlessLevel(e).material)return this.runScene.materialEx.add(e),(t=this.runScene.modelEx.select)&&this.runScene.materialEx.resetMaterial(t,e,{addUndo:!0}),e}parseModel(e){return[e="glb_model"===e.name&&(null==e?void 0:e.children[0])||e]}parseScene(e){const{model:t,json:r,config:n}=e;e=n.triggerCb;var i=t.children.filter((e=>this.runScene.modelEx.isUnless(e)?void 0:e));if(1===i.length){const[e]=i;e.animations=[...e.animations,...r.animations]}return e&&this.runScene.cb.loaderer.gltf.loaded.cb(""),null!=(e=null==n?void 0:n.loaded)&&e.call(n),i}disposeJSON(e){}}class Mt{constructor(e){this._objectLoader=new r.ObjectLoader,this.runScene=e,this._parser=new Bt(e)}parse(e){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function a(e){try{s(n.next(e))}catch(e){i(e)}}function o(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(a,o)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){var t=yield this._objectLoader.parseAsync(JSON.parse(e));return this._parser.afterParse(this.runScene.sceneEx.cleanUnlessLevel(t))}))}}class Bt{constructor(e){this.runScene=e}parseModel(e){e.material&&this.parseMaterial(e)}parseMaterial(e){var t=e.material;"SpriteMaterial"===t.type&&(0,yt.M)(t,"tools",pt.Z.tools),this.runScene.uniqueEx.material.add(e.material)}afterParse(e){return e instanceof Array?e.map((e=>{e.traverse((e=>{this.parseModel(e)}))})):e.traverse((e=>{this.parseModel(e)})),e}}class Ct{constructor(e){this.imgBitMap=new r.ImageBitmapLoader,this.object=new r.ObjectLoader,this.runScene=e,this.gltf=new St(e),this.json=new Mt(e)}}const _t=new class{constructor(){this.load=new r.AnimationLoader}parse(e){return this.load.parse(e)}};class Et extends V{constructor(e){super(e),this.map={},this.clock=new r.Clock,this.tickIndex=void 0,this.playings=new Set,this.updates={},e.cb.model.add.add("anima-parse",(({model:e})=>{this.parses(e)})),e.cb.model.remove.add("anima-parse",(({model:e})=>{this.onModelDelete(e)}))}onModelDelete(e){e.traverse((e=>{(0,ft.withAnima)(e)&&e.animations.map((t=>{t.id&&(this.close(e,t.name),delete this.map[t.id])}))}))}parses(e){e.traverse((e=>this.parse(e)))}findId(e,t){for(const r of e.animations)if(r.name===t)return r.id}parse(e,t){if(0!==e.animations.length||t){t=e.animations.length?e.animations:_t.parse(t);var n=new r.AnimationMixer(e);for(const r of t){var i=(0,H.getId)(),a=(r.id=i,n.clipAction(r));const t={finished:()=>{},loop:()=>{}};n.addEventListener("finished",(()=>t.finished())),n.addEventListener("loop",(()=>t.loop())),this.map[i]={mixer:n,action:a,model:e,time:0,runState:"close",clip:r,eventMap:t}}t.map((t=>{e.animations.find((e=>e.uuid===t.uuid))||e.animations.push(t)}))}}play(e,t,r){e=this.findId(e,t);const n=this.map[e];if(n&&!this.playings.has(n)){t=(0,he.mergeObject)({onLoop:()=>{},onProgress:()=>{},onFinished:()=>{},onClose:()=>{},onPause:()=>{},onResume:()=>{},onBeforeEnd:()=>{},loop:!1,lastFrame:!0,reset:!0},r);const{onProgress:i,onBeforeEnd:a,onLoop:o,onFinished:s,lastFrame:l,loop:u,reset:c}=t,{action:h,clip:d,eventMap:p}=(this.map[e].options=t,n);h.stop(),r=c?0:n.time,h.time=r,this.setPlayState(n,!0),c&&h.reset(),h.play();let f=!(n.runState="play");this.setUpdates(e,(()=>{var e=(0,he.getProgress)(h.time,d.duration,!0);99<=e&&!f&&(a(),f=!0),i(e)})),u?(h.loop=dt.Z.LoopRepeat,p.loop=o):(l&&(h.clampWhenFinished=!0),h.loop=dt.Z.LoopOnce,p.finished=()=>{this.setPlayState(n,!1),i(100),s()})}}pause(e,t){e=this.findId(e,t),(t=this.map[e])&&this.playings.has(t)&&(this.updateTime(t),this.setPlayState(t,!1),t.options.onPause(),t.runState="pause")}resume(e,t){var r=this.findId(e,t);(r=this.map[r])&&this.playings.has(r)&&(r.options.onResume(),this.play(e,t,null==(r=this.map[t])?void 0:r.options))}playAll(){this.pauseAll(),this.playings.clear(),Object.values(this.map).map((e=>{this.playings.add(e),(e=e.action).time=0,e.play()})),this.anima()}setValue(e){let t=this.clock.getDelta();Object.keys(this.map).map((r=>{var{mixer:r,action:n}=this.map[r];n.play(),n.time=e,r.update(t)}))}getDetal(){return this.clock.getDelta()}update(e){const t=e||this.getDetal();(0,z.js)(this.updates,((e,r)=>r(t)))}anima(){let e=this.clock.getDelta();this.update(e),this.playings.forEach((t=>{t.mixer.update(e)})),this.tickIndex=window.requestAnimationFrame(this.anima.bind(this))}closeAnima(){window.cancelAnimationFrame(this.tickIndex)}resetItem(e){var{mixer:e,action:t}=e;t.reset(),t.stop(),e.time=0}pauseAll(){this.closeAnima(),this.playings.forEach((e=>this.resetItem(e))),this.playings.clear()}reset(){this.pauseAll(),this.map={},this.playings.clear(),this.closeAnima()}updateTime(e,t){e.time=t||e.action.time}setPlayState(e,t){t?(this.playings.add(e),1===this.playings.size&&this.anima()):(this.playings.delete(e),delete this.updates[e.clip.id],0===this.playings.size&&this.closeAnima())}getItem(e,t){return e=this.findId(e,t),this.map[e]}close(e,t,r){e=this.findId(e,t),(t=this.map[e])&&this.playings.has(t)&&t.options&&((e=(0,he.mergeObject)({resetAction:!0},r).resetAction)&&t.action.reset(),this.setPlayState(t,!1),this.updateTime(t,0),t.options.onClose(),t.options=null,t.runState="pause")}setUpdates(e,t){this.updates[e]=t}fadeTo(e){var t,{lastModel:e,lastName:t,nextModel:r,nextName:n,duration:i}=e;e=this.findId(e,t),(t=this.map[e])&&(e=this.findId(r,n),(r=this.map[e])&&t.action.crossFadeTo(r.action,i,!0))}resetTime(e,t){(e=this.getItem(e,t))&&(e.action.time=0)}}var Tt=__webpack_require__(3693),Dt=__webpack_require__(699);class Pt{constructor(e){this.scene=null,this.camera=null,this.controls=null,this.renderer=null,this.engineDom=null,this.disposeRender=e=>{e&&(e.render=()=>{},e.domElement.remove())},this.runScene=e}initRender3(){const e=new Tt.lX;return e.setSize(this.engineDom.clientWidth,this.engineDom.clientHeight),e.domElement.style.position="absolute",e.domElement.style.top=String(0),e.domElement.className="css3dRenderer",this.engineDom.appendChild(e.domElement),this.runScene.cb.resize.add("render-3",(({width:t,height:r})=>{e.setSize(t,r)})),e}initRender2(){const e=new Dt.M;return e.setSize(this.engineDom.clientWidth,this.engineDom.clientHeight),e.domElement.style.position="absolute",e.domElement.classList.add("css2dRenderer"),e.domElement.style.top="0px",e.domElement.style.left="0px",this.engineDom.insertBefore(e.domElement,this.engineDom.childNodes[0]),this.runScene.cb.resize.add("render-2",(({width:t,height:r})=>{e.setSize(t,r)})),e}reset(){this.renderer=this.runScene.renderEx.create(this.engineDom),this.runScene.renderEx.setSize(),this.renderer.setAnimationLoop(this.runScene.render.bind(this.runScene));var e=this.get().camera;this.controls=this.runScene.controlsEx.create(e,this.renderer.domElement)}dispose(){this.disposeRender(this.render2),this.disposeRender(this.render3)}setRender2(e){e?this.render2=this.initRender2():this.render2&&(this.disposeRender(this.render2),this.render2=null)}setRender3(e){e?this.render3=this.initRender3():this.render3&&(this.disposeRender(this.render3),this.render3=null)}init(e){var t=this.runScene.sceneEx.create(),r=this.runScene.cameraEx.pCam,n=this.runScene.renderEx.create(e),i=this.runScene.controlsEx.create(r,e),{render2:a,render3:o}=this.runScene.optionsEx.options;return this.camera=r,this.scene=t,this.renderer=n,this.controls=i,this.engineDom=e,this.runScene.renderEx.setSize(),this.setRender2(a),this.setRender3(o),{scene:t,camera:r,render:n,controls:i,engineDom:e}}get(){var{scene:e,renderer:t,controls:r,engineDom:n}=this;return{scene:e,camera:this.runScene.cameraEx.getCamera(),renderer:t,controls:r,engineDom:n}}}class Ot{constructor(){this.cbs=[],this.cb=e=>Promise.all(this.cbs.map((t=>{var r;return null==(r=t.fn)?void 0:r.call(t,e)}))),this.emit=this.cb}add(e,t){return this.cbs.push({fn:t,name:e})}on(e,t){return this.add(t||"custom_"+(0,H.getId)(),e)}get(e){var t=this.cbs.findIndex((t=>t.name===e));if(-1!==t)return{data:this.cbs[t],index:t}}reset(e,t){return!!(e=this.get(e))&&((e=e.data).fn=t,!0)}remove(e){this.reset(e,null)}delete(e){e=(this.get(e)||{}).index,this.cbs.splice(e,1)}}class Rt{constructor(){this.resize=new Ot,this.setSelectMaterial=new Ot,this.setScene=new Ot,this.reset=new Ot,this.render=new Ot,this.tick=new Ot,this.baseLog=new Ot,this.inited=new Ot,this.texture={add:new Ot,remove:new Ot,setAnima:new Ot},this.model={multiSelect:{setEmpty:new Ot},change:new Ot,setSelect:new Ot,click:new Ot,add:new Ot,remove:new Ot,multipDrop:new Ot,focus:new Ot,unFocus:new Ot,changeName:new Ot,setOpen:new Ot,setMainStatue:new Ot,setVisible:new Ot,setParent:new Ot,setLayers:new Ot,setOutline:new Ot,clone:new Ot,dispose:new Ot},this.material={add:new Ot,dispose:new Ot,setName:new Ot},this.unique={material:{add:new Ot}},this.tranControls={changing:new Ot},this.undo={addUndos:new Ot,addRedus:new Ot,removeUndos:new Ot,undoByIndex:new Ot,reset:new Ot},this.scene={save:new Ot,saveNet:new Ot},this.timeLine={setProgress:new Ot,playGroup:new Ot,setGroupMap:new Ot,reset:new Ot,closeGroup:new Ot},this.events={key:{down:new Ot,up:new Ot},mouse:{move:new Ot,down:new Ot,up:new Ot},pointer:{down:new Ot,up:new Ot,move:new Ot,trigger:new Ot}},this.pp={glow:{setData:new Ot,setStatus:new Ot},outline:{setData:new Ot,setStatus:new Ot}},this.load={getJSON:new Ot,progress:new Ot,complete:new Ot},this.loaderer={gltf:{loadNode:new Ot,lazyLoadedTexture:new Ot,loaded:new Ot,modelLoaded:new Ot,progress:new Ot,getJSON:new Ot,getArrayBuffer:new Ot,complete:new Ot}},this.custom=new Proxy({},{get:(e,t)=>(e[t]||(e[t]=new Ot),e[t])}),this.tags={parseJSON:new Ot,clear:new Ot}}}var It=__webpack_require__(4230),kt=__webpack_require__(3729),Lt=__webpack_require__(272);class Ft{constructor(e){this.map=new ht.Z,this.runScene=e}get(e){return this.map.get(e)}add(e){this.get(e)||this.map.set(e,new Lt.Z)}rename(e,t){var r=this.get(e);r&&(this.addId(t,r.toArray()),this.remove(e))}addId(e,t){this.map.has(e)||this.add(e),this.map.get(e).add(t)}addModel(e,t){if(this.map.has(e)||this.add(e),(0,vt.lG)(t,"array"))return t.map((t=>{this.addModel(e,t)}));this.map.get(e).add((0,kt.K)(t))}removeModel(e,t){if(this.map.has(e))return(0,vt.lG)(t,"array")?t.map((t=>{this.removeModel(e,t)})):void this.map.get(e).remove((0,kt.K)(t))}remove(e){this.map.delete(e)}clear(){this.map.clear(),this.runScene.cb.tags.clear.cb()}toJSON(){const e={};return this.map.map(((t,r)=>{e[t]=[...r.filter((e=>this.runScene.modelEx.getById(e)))]})),e}parseJSON(e){let t={};(0,z.js)(e,((e,r)=>{t[e]=new Lt.Z(r)})),this.map=ht.Z.formJSON(t),this.runScene.cb.tags.parseJSON.cb(e)}}function Ut(e){return(Ut="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Gt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&jt(e,t)}function jt(e,t){return(jt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Nt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ht(e){return(Ht=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var zt={type:"change"},Vt={type:"start"},Jt={type:"end"},Kt=function(){Gt(t,r.EventDispatcher);var e=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ht(e);if(r=t?(r=Ht(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Ut(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return Nt(n)}}(t);function t(n,i){(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,t),a=e.call(this),void 0===i&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),i===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),a.object=n,a.domElement=i,a.domElement.style.touchAction="none",a.enabled=!0,a.target=new r.Vector3,a.minDistance=0,a.maxDistance=1/0,a.minZoom=0,a.maxZoom=1/0,a.minPolarAngle=0,a.maxPolarAngle=Math.PI,a.minAzimuthAngle=-1/0,a.maxAzimuthAngle=1/0,a.enableDamping=!1,a.dampingFactor=.05,a.enableZoom=!0,a.zoomSpeed=1,a.enableRotate=!0,a.rotateSpeed=1,a.enablePan=!0,a.panSpeed=1,a.screenSpacePanning=!0,a.keyPanSpeed=7,a.autoRotate=!1,a.autoRotateSpeed=2,a.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},a.mouseButtons={LEFT:r.MOUSE.ROTATE,MIDDLE:r.MOUSE.DOLLY,RIGHT:r.MOUSE.PAN},a.touches={ONE:r.TOUCH.ROTATE,TWO:r.TOUCH.DOLLY_PAN},a.target0=a.target.clone(),a.position0=a.object.position.clone(),a.zoom0=a.object.zoom,a._domElementKeyEvents=null,a.getPolarAngle=function(){return v.phi},a.getAzimuthalAngle=function(){return v.theta},a.getDistance=function(){return this.object.position.distanceTo(this.target)},a.listenToKeyEvents=function(e){e.addEventListener("keydown",re),this._domElementKeyEvents=e},a.saveState=function(){d.target0.copy(d.target),d.position0.copy(d.object.position),d.zoom0=d.object.zoom},a.reset=function(){d.target.copy(d.target0),d.object.position.copy(d.position0),d.object.zoom=d.zoom0,d.object.updateProjectionMatrix(),d.dispatchEvent(zt),d.update(),f=p.NONE},a.update=(o=new r.Vector3,s=(new r.Quaternion).setFromUnitVectors(n.up,new r.Vector3(0,1,0)),l=s.clone().invert(),u=new r.Vector3,c=new r.Quaternion,h=2*Math.PI,function(){var e=d.object.position,t=(o.copy(e).sub(d.target),o.applyQuaternion(s),v.setFromVector3(o),d.autoRotate&&f===p.NONE&&R(2*Math.PI/60/60*d.autoRotateSpeed),d.enableDamping?(v.theta+=g.theta*d.dampingFactor,v.phi+=g.phi*d.dampingFactor):(v.theta+=g.theta,v.phi+=g.phi),d.minAzimuthAngle),r=d.maxAzimuthAngle;return isFinite(t)&&isFinite(r)&&(t<-Math.PI?t+=h:t>Math.PI&&(t-=h),r<-Math.PI?r+=h:r>Math.PI&&(r-=h),v.theta=t<=r?Math.max(t,Math.min(r,v.theta)):v.theta>(t+r)/2?Math.max(t,v.theta):Math.min(r,v.theta)),v.phi=Math.max(d.minPolarAngle,Math.min(d.maxPolarAngle,v.phi)),v.makeSafe(),v.radius*=y,v.radius=Math.max(d.minDistance,Math.min(d.maxDistance,v.radius)),!0===d.enableDamping?d.target.addScaledVector(b,d.dampingFactor):d.target.add(b),o.setFromSpherical(v),o.applyQuaternion(l),e.copy(d.target).add(o),d.object.lookAt(d.target),!0===d.enableDamping?(g.theta*=1-d.dampingFactor,g.phi*=1-d.dampingFactor,b.multiplyScalar(1-d.dampingFactor)):(g.set(0,0,0),b.set(0,0,0)),y=1,!(!(x||u.distanceToSquared(d.object.position)>m||8*(1-c.dot(d.object.quaternion))>m)||(d.dispatchEvent(zt),u.copy(d.object.position),c.copy(d.object.quaternion),x=!1))}),a.dispose=function(){d.domElement.removeEventListener("contextmenu",ne),d.domElement.removeEventListener("pointerdown",Y),d.domElement.removeEventListener("pointercancel",ee),d.domElement.removeEventListener("wheel",te),d.domElement.removeEventListener("pointermove",q),d.domElement.removeEventListener("pointerup",$),null!==d._domElementKeyEvents&&d._domElementKeyEvents.removeEventListener("keydown",re)};var a,o,s,l,u,c,h,d=Nt(a),p={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},f=p.NONE,m=1e-6,v=new r.Spherical,g=new r.Spherical,y=1,b=new r.Vector3,x=!1,w=new r.Vector2,A=new r.Vector2,S=new r.Vector2,M=new r.Vector2,B=new r.Vector2,C=new r.Vector2,_=new r.Vector2,E=new r.Vector2,T=new r.Vector2,D=[],P={};function O(){return Math.pow(.95,d.zoomSpeed)}function R(e){g.theta-=e}function I(e){g.phi-=e}k=new r.Vector3;var k,L,F,U=function(e,t){k.setFromMatrixColumn(t,0),k.multiplyScalar(-e),b.add(k)},G=(L=new r.Vector3,function(e,t){!0===d.screenSpacePanning?L.setFromMatrixColumn(t,1):(L.setFromMatrixColumn(t,0),L.crossVectors(d.object.up,L)),L.multiplyScalar(e),b.add(L)}),j=(F=new r.Vector3,function(e,t){var r,n=d.domElement;d.object.isPerspectiveCamera?(r=d.object.position,F.copy(r).sub(d.target),r=F.length(),r*=Math.tan(d.object.fov/2*Math.PI/180),U(2*e*r/n.clientHeight,d.object.matrix),G(2*t*r/n.clientHeight,d.object.matrix)):d.object.isOrthographicCamera?(U(e*(d.object.right-d.object.left)/d.object.zoom/n.clientWidth,d.object.matrix),G(t*(d.object.top-d.object.bottom)/d.object.zoom/n.clientHeight,d.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),d.enablePan=!1)});function N(e){d.object.isPerspectiveCamera?y/=e:d.object.isOrthographicCamera?(d.object.zoom=Math.max(d.minZoom,Math.min(d.maxZoom,d.object.zoom*e)),d.object.updateProjectionMatrix(),x=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),d.enableZoom=!1)}function H(e){d.object.isPerspectiveCamera?y*=e:d.object.isOrthographicCamera?(d.object.zoom=Math.max(d.minZoom,Math.min(d.maxZoom,d.object.zoom/e)),d.object.updateProjectionMatrix(),x=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),d.enableZoom=!1)}function z(e){w.set(e.clientX,e.clientY)}function V(e){M.set(e.clientX,e.clientY)}function J(){var e,t;1===D.length?w.set(D[0].pageX,D[0].pageY):(e=.5*(D[0].pageX+D[1].pageX),t=.5*(D[0].pageY+D[1].pageY),w.set(e,t))}function K(){var e,t;1===D.length?M.set(D[0].pageX,D[0].pageY):(e=.5*(D[0].pageX+D[1].pageX),t=.5*(D[0].pageY+D[1].pageY),M.set(e,t))}function W(){var e=D[0].pageX-D[1].pageX,t=D[0].pageY-D[1].pageY;e=Math.sqrt(e*e+t*t),_.set(0,e)}function Q(e){1==D.length?A.set(e.pageX,e.pageY):(r=oe(e),t=.5*(e.pageX+r.x),e=.5*(e.pageY+r.y),A.set(t,e)),S.subVectors(A,w).multiplyScalar(d.rotateSpeed);var t,r=d.domElement;R(2*Math.PI*S.x/r.clientHeight),I(2*Math.PI*S.y/r.clientHeight),w.copy(A)}function X(e){var t,r;1===D.length?B.set(e.pageX,e.pageY):(t=oe(e),r=.5*(e.pageX+t.x),e=.5*(e.pageY+t.y),B.set(r,e)),C.subVectors(B,M).multiplyScalar(d.panSpeed),j(C.x,C.y),M.copy(B)}function Z(e){var t=oe(e),r=e.pageX-t.x;e=e.pageY-t.y,t=Math.sqrt(r*r+e*e),E.set(0,t),T.set(0,Math.pow(E.y/_.y,d.zoomSpeed)),N(T.y),_.copy(E)}function Y(e){if(!1!==d.enabled){if(0===D.length&&(d.domElement.setPointerCapture(e.pointerId),d.domElement.addEventListener("pointermove",q),d.domElement.addEventListener("pointerup",$)),D.push(e),"touch"===e.pointerType)switch(ae(e),D.length){case 1:switch(d.touches.ONE){case r.TOUCH.ROTATE:if(!1===d.enableRotate)return;J(),f=p.TOUCH_ROTATE;break;case r.TOUCH.PAN:if(!1===d.enablePan)return;K(),f=p.TOUCH_PAN;break;default:f=p.NONE}break;case 2:switch(d.touches.TWO){case r.TOUCH.DOLLY_PAN:if(!1===d.enableZoom&&!1===d.enablePan)return;d.enableZoom&&W(),d.enablePan&&K(),f=p.TOUCH_DOLLY_PAN;break;case r.TOUCH.DOLLY_ROTATE:if(!1===d.enableZoom&&!1===d.enableRotate)return;d.enableZoom&&W(),d.enableRotate&&J(),f=p.TOUCH_DOLLY_ROTATE;break;default:f=p.NONE}break;default:f=p.NONE}else{var t,n=e;switch(n.button){case 0:t=d.mouseButtons.LEFT;break;case 1:t=d.mouseButtons.MIDDLE;break;case 2:t=d.mouseButtons.RIGHT;break;default:t=-1}switch(t){case r.MOUSE.DOLLY:if(!1===d.enableZoom)return;!function(e){_.set(e.clientX,e.clientY)}(n),f=p.DOLLY;break;case r.MOUSE.ROTATE:if(n.ctrlKey||n.metaKey||n.shiftKey){if(!1===d.enablePan)return;V(n),f=p.PAN}else{if(!1===d.enableRotate)return;z(n),f=p.ROTATE}break;case r.MOUSE.PAN:if(n.ctrlKey||n.metaKey||n.shiftKey){if(!1===d.enableRotate)return;z(n),f=p.ROTATE}else{if(!1===d.enablePan)return;V(n),f=p.PAN}break;default:f=p.NONE}}f!==p.NONE&&d.dispatchEvent(Vt)}}function q(e){if(!1!==d.enabled)if("touch"===e.pointerType){var t=e;switch(ae(t),f){case p.TOUCH_ROTATE:!1!==d.enableRotate&&(Q(t),d.update());break;case p.TOUCH_PAN:!1!==d.enablePan&&(X(t),d.update());break;case p.TOUCH_DOLLY_PAN:!1===d.enableZoom&&!1===d.enablePan||(function(e){d.enableZoom&&Z(e),d.enablePan&&X(e)}(t),d.update());break;case p.TOUCH_DOLLY_ROTATE:!1===d.enableZoom&&!1===d.enableRotate||(function(e){d.enableZoom&&Z(e),d.enableRotate&&Q(e)}(t),d.update());break;default:f=p.NONE}}else{var r=e;switch(f){case p.ROTATE:!1!==d.enableRotate&&function(e){A.set(e.clientX,e.clientY),S.subVectors(A,w).multiplyScalar(d.rotateSpeed),e=d.domElement,R(2*Math.PI*S.x/e.clientHeight),I(2*Math.PI*S.y/e.clientHeight),w.copy(A),d.update()}(r);break;case p.DOLLY:!1!==d.enableZoom&&function(e){E.set(e.clientX,e.clientY),T.subVectors(E,_),0<T.y?N(O()):T.y<0&&H(O()),_.copy(E),d.update()}(r);break;case p.PAN:!1!==d.enablePan&&function(e){B.set(e.clientX,e.clientY),C.subVectors(B,M).multiplyScalar(d.panSpeed),j(C.x,C.y),M.copy(B),d.update()}(r)}}}function $(e){ie(e),0===D.length&&(d.domElement.releasePointerCapture(e.pointerId),d.domElement.removeEventListener("pointermove",q),d.domElement.removeEventListener("pointerup",$)),d.dispatchEvent(Jt),f=p.NONE}function ee(e){ie(e)}function te(e){!1!==d.enabled&&!1!==d.enableZoom&&f===p.NONE&&(e.preventDefault(),d.dispatchEvent(Vt),e.deltaY<0?H(O()):0<e.deltaY&&N(O()),d.update(),d.dispatchEvent(Jt))}function re(e){if(!1!==d.enabled&&!1!==d.enablePan){var t=!1;switch(e.code){case d.keys.UP:j(0,d.keyPanSpeed),t=!0;break;case d.keys.BOTTOM:j(0,-d.keyPanSpeed),t=!0;break;case d.keys.LEFT:j(d.keyPanSpeed,0),t=!0;break;case d.keys.RIGHT:j(-d.keyPanSpeed,0),t=!0}t&&(e.preventDefault(),d.update())}}function ne(e){!1!==d.enabled&&e.preventDefault()}function ie(e){delete P[e.pointerId];for(var t=0;t<D.length;t++)if(D[t].pointerId==e.pointerId)return void D.splice(t,1)}function ae(e){var t=P[e.pointerId];void 0===t&&(t=new r.Vector2,P[e.pointerId]=t),t.set(e.pageX,e.pageY)}function oe(e){return e=e.pointerId===D[0].pointerId?D[1]:D[0],P[e.pointerId]}return d.domElement.addEventListener("contextmenu",ne),d.domElement.addEventListener("pointerdown",Y),d.domElement.addEventListener("pointercancel",ee),d.domElement.addEventListener("wheel",te,{passive:!1}),a.update(),a}return function(e,t,r){return Object.defineProperty(e,"prototype",{writable:!1}),e}(t)}();class Wt{create(e,t){return new Kt(e,t)}static toJSON(e){return e.target}}class Qt{constructor(e){this._state=!1,this._libsState=!1,this.map={val:"Box",type:"base-model"},this.libsMap={data:"Box",type:"texture"},this.events=e}get state(){return this._state}set state(e){this._state=e}setVal(e){this.state=!0,this.map=e}getVal(){if(this.state)return this.state=!1,this.map}setLibsVal(e){this._libsState=!0,this.libsMap=e}getLibsVal(){if(this._libsState)return this._libsState=!1,this.libsMap}}var Xt=function(e,t,r,n){return new(r=r||Promise)((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(o,s)}l((n=n.apply(e,t||[])).next())}))};class Zt{constructor(e){this.alt=!1,this.ctrl=!1,this.shift=!1,this.unExec=new ht.Z,this.allFn={s_saveScene:()=>Xt(this,void 0,void 0,(function*(){this.events.runScene.optionsEx.log("正在保存","base","info"),this.events.runScene.cb.scene.saveNet.cb("")})),d_copyModel:()=>{var e,t=this.events.runScene.modelEx.select;t&&(this.events.runScene.modelEx.selectNull(),(e=this.events.runScene.modelEx.clone(t,!1))&&this.events.runScene.modelEx.add(e,t.parent,{isClone:!0,select:!0}))},f_focusModel:()=>{var e=this.events.runScene.modelEx.select;e&&this.events.runScene.modelEx.focus(e)},z_undo:e=>{this.events.runScene.undoEx.undo()},y_redo:e=>{this.events.runScene.undoEx.redo()}},this.events=e}init(e){"running"!==this.events.runScene.optionsEx.options.mode&&(document.addEventListener("keydown",this.keyDown.bind(this)),document.addEventListener("keyup",this.keyUp.bind(this)),this.events.runScene.cb.model.setSelect.add("reset-unexec",(()=>{this.unExec.delete("delete")})))}keyDown(e){return Xt(this,void 0,void 0,(function*(){if("INPUT"!==document.activeElement.nodeName){var t=e.key.toLowerCase();if(console.log(t,e.code,"key"),this.events.runScene.cb.events.key.down.cb({key:t,event:e}),!this.unExec.get(t))switch(t){case" ":break;case"s":this.ctrl&&(e.preventDefault(),this.allFn.s_saveScene());break;case"d":this.ctrl&&(e.preventDefault(),this.allFn.d_copyModel());break;case"alt":this.alt=!0;break;case"control":case"ctrl":this.ctrl=!0;break;case"shift":this.shift=!0;break;case"f11":this.events.runScene.cb.resize.cb(this.events.runScene.renderEx.getDomSize());break;case"w":e.preventDefault(),e.stopPropagation(),this.events.runScene.helperEx.transContro.changeMode("position");break;case"e":this.events.runScene.helperEx.transContro.changeMode("rotation");break;case"r":this.events.runScene.helperEx.transContro.changeMode("scale"),e.preventDefault();break;case"f":this.allFn.f_focusModel();break;case"delete":this.events.runScene.helperEx.unfocus();var r=this.events.runScene.multipSelector.getSelectedList("value");this.events.runScene.sceneEx.remove(this.events.runScene.modelEx.select||r),r&&this.events.runScene.multipSelector.delete();break;case"z":if(!this.ctrl)return;this.allFn.z_undo(e);break;case"y":this.ctrl&&this.allFn.y_redo(e)}}}))}keyUp(e){if("INPUT"!==document.activeElement.nodeName){var t=e.key.toLowerCase();switch(this.events.runScene.cb.events.key.up.cb({key:t,event:e}),t){case"meta":break;case"s":this.ctrl;break;case"alt":this.alt=!1;break;case"control":case"ctrl":this.ctrl=!1;break;case"shift":this.shift=!1}}}}var Yt=__webpack_require__(3801);class qt{constructor(e){this.downPosition={x:0,y:0},this.enableUp=!0,this.isMove=!1,this.moveEvent=new MouseEvent("move"),this.down=e=>{this.downPosition={x:e.offsetX,y:e.offsetY},this.isMove=!0},this.up=e=>{var t,r,n,i;this.isMove=!1,2===e.button||null!=(t=this.events.runScene.helperEx.transContro)&&t.isDraggingChange||(t=e.offsetX,r=e.offsetY,({x:n,y:i}=this.downPosition),t===n&&r===i&&this.trigger(e))},this.selectable=!0,this.events=e}init(e){e.addEventListener("pointerdown",this.down.bind(this)),e.addEventListener("pointerup",this.up.bind(this)),window.addEventListener("pointerdown",this.events.runScene.cb.events.pointer.down.cb),window.addEventListener("pointerup",this.events.runScene.cb.events.pointer.up.cb),window.addEventListener("pointermove",(e=>{this.moveEvent=e,this.events.runScene.cb.events.pointer.move.cb(e)})),window.addEventListener("mousemove",this.events.runScene.cb.events.mouse.move.cb),window.addEventListener("mousedown",this.events.runScene.cb.events.mouse.down.cb),window.addEventListener("mouseup",this.events.runScene.cb.events.mouse.up.cb)}getTriggerModels(e){var t=new r.Raycaster,n=new r.Vector2,{engineDom:i,camera:a,scene:o}=this.events.runScene.assetsEx.get(),i=(n.x=e.offsetX/i.clientWidth*2-1,n.y=-e.offsetY/i.clientHeight*2+1,t.setFromCamera(n,a),e=o.children.filter((e=>{if((!this.events.runScene.helperEx.isHelper(e)||e.userData.id)&&!e.userData.unClick)return e})),t.intersectObjects(e,!0));return this.events.runScene.cb.events.pointer.trigger.cb(i),i.map((e=>e.object))}removeHideOrLockModel(e){return e.find((e=>this.events.runScene.modelEx.deepIsVisible(e)&&!Yt.zf.isLock(e,!0)&&ft.selectableModel.is(e)))}trigger(e){let t=this.removeHideOrLockModel(this.getTriggerModels(e));if(this.selectable){if(t){if(this.events.runScene.helperEx.isHelper(t)&&(e=this.events.runScene.uniqueEx.getId(t),t=this.events.runScene.uniqueEx.model.get(e)),!this.enableUp){if(t===this.events.runScene.helperEx.transContro.multipObj)return;this.enableUp=!0}return this.events.runScene.cb.model.click.cb(t),this.events.key.ctrl?(this.enableUp=!1,this.events.runScene.multipSelector.add(t)):this.events.key.shift?(e=t.parent)?void e.children.map((e=>{this.events.runScene.multipSelector.add(e)})):void 0:(this.events.runScene.modelEx.setSelectByModel(t),void(this.events.runScene.lightEx.isLight(t)&&this.events.runScene.lightEx.setSelect(t)))}this.events.runScene.multipSelector.setEmpty(),this.events.runScene.modelEx.selectNull()}}}var $t=__webpack_require__(3685),er=__webpack_require__(4330),tr=__webpack_require__(2931);class rr{constructor(e){this.materialMap={},this.textureMap={},this.modelType={Sprite:pt.Z},this.geoDefMaterialMap=new ht.Z;var{type:e,runScene:t,helper:r}=e;this.type=e,this.helper=r,this.runScene=t}parse(e){var t=this.createTextureGroup(e);this.parseScene(t),this.parseModel(e),this.materialMapToJson(),this.setMultipMaterial(t,Object.keys(this.textureMap))}createTextureGroup(e){var t=new r.Group;return t.name="back-texture-ex",t.userData.isHelper=!0,e.add(t),t}parseScene(e){"scene"===this.type&&(this.helper.ex=Object.assign(Object.assign({},this.helper.ex),this._getBaseEx(e)))}_getBaseEx(e){var t=this.runScene.sceneEx.get(),{controls:r,camera:n}=this.runScene.assetsEx.get(),i=this.runScene.optionsEx.exporterOptions.outTime;return{base64:(0,vt.Ni)(String(i)),lights:tr.ZP.toJSON(this.runScene.lightEx.getLightsByScene()),camera:n.toJSON(),sceneEx:Object.assign(Object.assign({},yt.ZP.toJSON(t)),this._bindSceneTextures(e)),timeLine:this.runScene.timeLineEx.getSavedData(),controls:Wt.toJSON(r),tags:this.runScene.tags.toJSON(),options:this.runScene.exporter.gltf.options.getOptions(t)}}_bindSceneTextures(e){var t,r,n,i=this.runScene.sceneEx.get(),a={};return((0,mt.isTexture)(i.background)||(0,mt.isTexture)(i.environment))&&(this.runScene.pp.setUpdate(!1),({background:i,environment:t}=i),this.runScene.pp.setUpdate(!0),r=(0,ft.createDefModel)("Box"),n=(0,gt.createDefMaterial)(),r.material=n,e.add(r),e=n.userData.id,this.materialMap[a.materialId=e]={normalMaterial:n,models:[]},(0,mt.isTexture)(i)&&(i.userData.notCompress=!0,303===(n.map=i).mapping&&(a.backgroundMapping=303)),(0,mt.isTexture)(t)&&(t.userData.notCompress=!0,n.envMap=t)),a}compressLocal(e){var{x:t,y:r,z:n}=e.position;0===t&&0===r&&0===n||(e.position.set(0,0,0),e.userData.local=t+","+r+","+n)}parseModel(e){const t=new Set;e.traverse((e=>t.add(e))),t.forEach((e=>{this._processMaterial(e),this._processModel(e)}))}_processModel(e){(0,ft.withAnima)(e)&&(r=e.animations.map((e=>e.toJSON())),(0,yt.M)(e,"animations",r));let t=e;var r=this.modelType[e.type];r&&(r=r.modelTools.toNormal(e),this.runScene.optionsEx.options.hideLocal&&this.compressLocal(r),e.parent.add(r),e.parent.remove(e),t=r),this.runScene.optionsEx.options.hideLocal&&this.compressLocal(t)}_processMaterial(e){var t,r;(0,gt.isMaterial)(e.material)&&((r=this.materialMap[e.material.userData.id])?(r.normalMaterial&&(e.material=r.normalMaterial),r.models.push(e)):(r=this.runScene.materialEx.isBaseMaterial(e.material),t=e.material,r=r||this.runScene.optionsEx.exporterOptions.notMaterial?this.getMaterialFromModel(e):this.runScene.materialEx.toNromal(e.material),(e.material=r).userData.id=t.userData.id,this.materialMap[r.userData.id]={oldMaterial:t,normalMaterial:r,models:[e]}))}materialMapToJson(){(0,z.js)(this.materialMap,((e,t)=>{var r;t=t.normalMaterial,this.helper.ex.materialMap[t.userData.id]||(r=(0,gt.getTexturesByMaterial)(t),console.log(r,"textures"),this.helper.ex.materialMap[t.userData.id]={normal:t.userData.normal||{},textures:{}},this.mergeAndRemoveTexture(r,t))}))}mergeSame(e){e.userData||(e.userData={});var t=e.userData;if((0,mt.isClonedTexture)(e))e=this.parseCloneTexture(e);else for(const a in this.textureMap){var r=this.textureMap[a],{md5:n,texture:i}=r;if(t.md5===n&&e.mapping===i.mapping&&!(0,mt.isClonedTexture)(r.texture))return{isSame:!0,texture:i}}return this.textureMap[e.userData.id]=Object.assign(Object.assign({},t),{texture:e}),{isSame:!1,texture:e}}mergeAndRemoveTexture(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function a(e){try{s(n.next(e))}catch(e){i(e)}}function o(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(a,o)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){return e.map((e=>{var{type:e,texture:r}=e,r=(this.runScene.uniqueEx.texture.add(r),t[e]=null,this.mergeSame(r)).texture;if(!this.helper.ex.textureMap[r.userData.id]){var n,{format:i,repeat:a,center:o,rotation:s,offset:l}=r;const e={format:i};this.runScene.modelEx.isNavieV2(a,1)||(({x:i,y:n}=a),e.repeat=i===n?i:a),this.runScene.modelEx.isNavieV2(o,0)||(({x:n,y:i}=o),e.center=n===i?n:o),this.runScene.modelEx.isNavieV2(l,0)||(({x:a,y:i}=l),e.offset=a===i?a:l),0!==s&&(e.rotation=s),this.helper.ex.textureMap[r.userData.id]=e}"normalMap"!==e||r.userData.isNormalMap||(r.userData.isNormalMap=!0),this.helper.ex.materialMap[t.userData.id].textures[e]=r.userData.id}))}))}parseCloneTexture(e){var t=e.clone(),{width:e,height:r}=(t.userData=Object.assign({},e.userData),e.image),n=document.createElement("canvas");return n.width=e,n.height=r,t.image=n,t.userData.blob=new Blob([]),t}setMultipMaterial(e,t){var r=this.runScene.modelEx.create(),n=(0,gt.createDefMaterial)();r.material=n,e.add(r);for(const e of er.sG){if(!t.length)return;var i=t.pop();if(!i)return;n[e]=this.textureMap[i].texture}t.length&&this.setMultipMaterial(e,t)}getMaterialFromModel(e){return e&&e.geometry?(e=e.geometry.uuid,this.geoDefMaterialMap.get(e)||this.geoDefMaterialMap.set(e,(0,gt.createDefMaterial)()),this.geoDefMaterialMap.get(e)):this.runScene.materialEx.defMaterial}}class nr extends V{constructor(){super(...arguments),this.savedMap=new ht.Z,this.clonedMap=new ht.Z}getSameNode(e){return this.savedMap.find(((t,r)=>r.materialUuid===e.material.uuid&&r.geometryUuid===e.geometry.uuid))}parseUnClonedModel(e){var t,r=(0,kt.K)(e);e.material&&e.geometry&&((t=this.getSameNode(e))&&(0,ft.setClonedModel)(e,t.id),this.savedMap.set(r,{id:r,geometryUuid:e.geometry.uuid,materialUuid:e.material.uuid}))}parseClonedModel(e){var t=(0,ft.getClonedIdModel)(e),r=(0,kt.K)(e),n=(this.clonedMap.get(t)||this.clonedMap.set(t,{newId:void 0,ids:new Set}),this.clonedMap.get(t));n&&(n.ids.add(r),n.newId||this.runScene.uniqueEx.model.get(t)||(t=(0,kt.K)(e),n.newId=t),n.newId&&(n.newId!==r?(0,ft.setClonedModel)(e,n.newId):(0,ft.delClonedModel)(e)))}parseNode(e){(0,ft.getClonedIdModel)(e)?this.parseClonedModel(e):this.parseUnClonedModel(e)}}class ir{constructor(){this.savedMap=new ht.Z}getSameCount(e){return this.savedMap.filter(((t,r)=>r.geometry.attributes.normal.count===e),"value")}setSameNode(e,t){e.geometry=t}getSameGeo(e,t){var{normal:r,position:n,uv:i}=e.attributes;for(const e of t){var{normal:a,position:o,uv:s}=e.attributes;if(r.array.length===a.array.length&&n.array.length===o.array.length&&i.array.length===s.array.length&&(a=(0,vt.F1)([...r.array],[...a.array],20),o=(0,vt.F1)([...n.array],[...o.array],20),s=(0,vt.F1)([...i.array],[...s.array],20),a&&o&&s))return e}}parseNode(e){if(e&&e.geometry&&e.geometry.attributes&&e.geometry.attributes.normal&&e.geometry.attributes.position&&e.geometry.attributes.uv&&!this.savedMap.get(e.geometry.uuid)){var t=e.geometry,r=(r=t.attributes.normal).count,n=this.getSameCount(r);if(n&&(n=this.getSameGeo(t,n.map((e=>e.geometry))),n))return this.setSameNode(e,n);this.savedMap.set(t.uuid,{count:r,geometry:t})}}}class ar{constructor(){this.optionsConfigs={}}getParse(e){return this.optionsConfigs[e]}addOption(e){var t=e.type;if(this.optionsConfigs[t])throw TypeError("该配置项已被挂载");this.optionsConfigs[t]=e}getOptions(e){return Object.values(this.optionsConfigs).map((t=>{var{process:t,type:r}=t;return{type:r,data:t(e)}}))}}class or{constructor(e){this.helperModels=[],this.mergeSameGeo=new ir;var{type:e,runScene:t,model:r}=e;this.runScene=t,this.type=e,this.bindClondId=new nr(t),this.ex={materialMap:{},textureMap:{},type:e},this.before=new rr({helper:this,type:e,runScene:t}),this.before.parse(r)}parseNode(e){const{object:t,nodeDef:r}=e;this.mergeSameGeo.parseNode(t),this.bindClondId.parseNode(t),(0,z.js)(this.runScene.modelEx.defNodeMap,((e,n)=>{t[e]!==n&&(r[e]=t[e])})),t.material&&t.material.wireframe&&(t.material.wireframe=!1,r.wireframe=!0)}parseMaterial(e){var{material:e,materialDef:t}=e;t.id=e.userData.id,this.ex.materialMap[e.userData.id]||(this.ex.materialMap[e.userData.id]={normal:{},textures:{}}),this.ex.materialMap[e.userData.id].normal=Object.assign(Object.assign({},this.ex.materialMap[e.userData.id].normal),this.runScene.materialEx.getDefNromals(e))}parseTexture(e){var{texture:e,textureDef:t}=e,{notCompress:r,minFilter:n}=e.userData,{width:r,height:n}=(r&&(t.notCompress=!0),t.uvScript=e.userData.uvScript,t.md5=e.userData.md5,t.id=e.userData.id,n&&(t.minFilter=n),(0,mt.isClonedTexture)(e)&&(t.cloneSourceId=(0,mt.getCloneIdFromTexture)(e)),t.format=e.userData.format,(0,mt.getSizeByTexture)(e));t.size={w:r,h:n}}getNodeMapValueWithBone(e,t){for(const r of t.keys())if(r.userData.id===e.userData.id)return t.get(r)}done(e){e.asset.ex=this.ex,this.runScene.optionsEx.log([e,"json"])}}function sr(){sr=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=(p="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",i=p.asyncIterator||"@@asyncIterator",a=p.toStringTag||"@@toStringTag";function o(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{o({},"")}catch(t){o=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var i,a,o,s;return t=t&&t.prototype instanceof c?t:c,t=Object.create(t.prototype),n=new x(n||[]),t._invoke=(i=e,a=r,o=n,s="suspendedStart",function(e,t){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===e)throw t;return{value:void 0,done:!0}}for(o.method=e,o.arg=t;;){var r=o.delegate;if(r&&(r=function e(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,e(t,r),"throw"===r.method))return u;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}return"throw"===(n=l(n,t.iterator,r.arg)).type?(r.method="throw",r.arg=n.arg,r.delegate=null,u):(n=n.arg)?n.done?(r[t.resultName]=n.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,u):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,u)}(r,o),r)){if(r===u)continue;return r}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if("suspendedStart"===s)throw s="completed",o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);if(s="executing","normal"===(r=l(i,a,o)).type){if(s=o.done?"completed":"suspendedYield",r.arg===u)continue;return{value:r.arg,done:o.done}}"throw"===r.type&&(s="completed",o.method="throw",o.arg=r.arg)}}),t}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var u={};function c(){}function h(){}function d(){}var p,f,m=(o(p={},n,(function(){return this})),(f=(f=Object.getPrototypeOf)&&f(f(w([]))))&&f!==t&&r.call(f,n)&&(p=f),d.prototype=c.prototype=Object.create(p));function v(e){["next","throw","return"].forEach((function(t){o(e,t,(function(e){return this._invoke(t,e)}))}))}function g(e,t){var n;this._invoke=function(i,a){function o(){return new t((function(n,o){!function n(i,a,o,s){var u;if("throw"!==(i=l(e[i],e,a)).type)return(a=(u=i.arg).value)&&"object"==ur(a)&&r.call(a,"__await")?t.resolve(a.__await).then((function(e){n("next",e,o,s)}),(function(e){n("throw",e,o,s)})):t.resolve(a).then((function(e){u.value=e,o(u)}),(function(e){return n("throw",e,o,s)}));s(i.arg)}(i,a,n,o)}))}return n=n?n.then(o,o):o()}}function y(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function b(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(y,this),this.reset(!0)}function w(e){if(e){var t,i=e[n];if(i)return i.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(i=function n(){for(;++t<e.length;)if(r.call(e,t))return n.value=e[t],n.done=!1,n;return n.value=void 0,n.done=!0,n}).next=i}return{next:A}}function A(){return{value:void 0,done:!0}}return o(m,"constructor",h.prototype=d),o(d,"constructor",h),h.displayName=o(d,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){return!!(e="function"==typeof e&&e.constructor)&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,o(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},v(g.prototype),o(g.prototype,i,(function(){return this})),e.AsyncIterator=g,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var o=new g(s(t,r,n,i),a);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},v(m),o(m,a,"Generator"),o(m,n,(function(){return this})),o(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,r=[];for(t in e)r.push(t);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=w,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(b),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return o.type="throw",o.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;0<=i;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}var o=(a=a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc?null:a)?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,u):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),b(r),u}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,i=this.tryEntries[t];if(i.tryLoc===e)return"throw"===(r=i.completion).type&&(n=r.arg,b(i)),n}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:w(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),u}},e}function lr(e,t,r,n,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(n,i)}function ur(e){return(ur="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function cr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function dr(e,t,r){t&&hr(e.prototype,t),r&&hr(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var pr=function(){function e(){cr(this,e),this.pluginCallbacks=[],this.register((function(e){return new Pr(e)})),this.register((function(e){return new Or(e)})),this.register((function(e){return new Rr(e)})),this.register((function(e){return new kr(e)})),this.register((function(e){return new Lr(e)})),this.register((function(e){return new Ir(e)}))}return dr(e,[{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,r,n){"object"===ur(r)&&(console.warn("THREE.GLTFExporter: parse() expects options as the fourth argument now."),n=r);for(var i=new Dr,a=[],o=0,s=this.pluginCallbacks.length;o<s;o++)a.push(this.pluginCallbacks[o](i));i.setPlugins(a),i.write(e,t,n).catch(r)}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,i){r.parse(e,n,i,t)}))}}]),e}(),fr=5121,mr=5123,vr=9728,gr=(j=9729,9984),yr=9985,br=9986,xr=9987,wr=33071,Ar=33648,Sr=10497,Mr={},Br=(Mr[r.NearestFilter]=vr,Mr[r.NearestMipmapNearestFilter]=gr,Mr[r.NearestMipmapLinearFilter]=br,Mr[r.LinearFilter]=j,Mr[r.LinearMipmapNearestFilter]=yr,Mr[r.LinearMipmapLinearFilter]=xr,Mr[r.ClampToEdgeWrapping]=wr,Mr[r.RepeatWrapping]=Sr,Mr[r.MirroredRepeatWrapping]=Ar,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"});function Cr(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function _r(e){return 4*Math.ceil(e/4)}function Er(e,t){var r=1<arguments.length&&void 0!==t?t:0,n=_r(e.byteLength);if(n===e.byteLength)return e;var i=new Uint8Array(n);if(i.set(new Uint8Array(e)),0!==r)for(var a=e.byteLength;a<n;a++)i[a]=r;return i.buffer}var Tr=null,Dr=function(){function e(){cr(this,e),this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}var t,n;return dr(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=sr().mark((function e(t,r,n){var i,a,o,s,l,u,c;return sr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.options=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(t),e.next=5,Promise.all(this.pending);case 5:return a=(i=this).buffers,o=i.json,n=i.options,e.next=11,i.options.myOptions.helper.done(o);case 11:l=i.extensionsUsed,s=new Blob(a,{type:"application/octet-stream"}),0<(l=Object.keys(l)).length&&(o.extensionsUsed=l),o.buffers&&0<o.buffers.length&&(o.buffers[0].byteLength=s.size),!0===n.binary?((u=new window.FileReader).readAsArrayBuffer(s),u.onloadend=function(){var e=Er(u.result),t=new DataView(new ArrayBuffer(8)),n=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),Er(function(e){if(void 0!==window.TextEncoder)return(new TextEncoder).encode(e).buffer;for(var t=new Uint8Array(new ArrayBuffer(e.length)),r=0,n=e.length;r<n;r++){var i=e.charCodeAt(r);t[r]=255<i?32:i}return t.buffer}(JSON.stringify(o)),32)),i=new DataView(new ArrayBuffer(8)),a=(i.setUint32(0,n.byteLength,!0),i.setUint32(4,1313821514,!0),new ArrayBuffer(12)),s=((l=new DataView(a)).setUint32(0,1179937895,!0),l.setUint32(4,2,!0),12+i.byteLength+n.byteLength+t.byteLength+e.byteLength),l=(l.setUint32(8,s,!0),new Blob([a,i,n,t,e],{type:"application/octet-stream"})),c=new window.FileReader;c.readAsArrayBuffer(l),c.onloadend=function(){r(c.result)}}):o.buffers&&0<o.buffers.length?((c=new window.FileReader).readAsDataURL(s),c.onloadend=function(){var e=c.result;o.buffers[0].uri=e,r(o)}):r(o);case 17:case"end":return e.stop()}}),e,this)})),n=function(){var e=this,r=arguments;return new Promise((function(n,i){var a=t.apply(e,r);function o(e){lr(a,n,i,o,s,"next",e)}function s(e){lr(a,n,i,o,s,"throw",e)}o(void 0)}))},function(e,t,r){return n.apply(this,arguments)})},{key:"serializeUserData",value:function(e,t){if(0!==Object.keys(e.userData).length){var r=this.options,n=this.extensionsUsed;try{var i=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&i.gltfExtensions){for(var a in void 0===t.extensions&&(t.extensions={}),i.gltfExtensions)t.extensions[a]=i.gltfExtensions[a],n[a]=!0;delete i.gltfExtensions}0<Object.keys(i).length&&(t.extras=i)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}}},{key:"getUID",value:function(e){return this.uids.has(e)||this.uids.set(e,this.uid++),this.uids.get(e)}},{key:"isNormalizedNormalAttribute",value:function(e){if(this.cache.attributesNormalized.has(e))return!1;for(var t=new r.Vector3,n=0,i=e.count;n<i;n++)if(5e-4<Math.abs(t.fromBufferAttribute(e,n).length()-1))return!1;return!0}},{key:"createNormalizedNormalAttribute",value:function(e){var t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);for(var n=e.clone(),i=new r.Vector3,a=0,o=n.count;a<o;a++)i.fromBufferAttribute(n,a),0===i.x&&0===i.y&&0===i.z?i.setX(1):i.normalize(),n.setXYZ(a,i.x,i.y,i.z);return t.attributesNormalized.set(e,n),n}},{key:"applyTextureTransform",value:function(e,t){var r=!1,n={};0===t.offset.x&&0===t.offset.y||(n.offset=t.offset.toArray(),r=!0),0!==t.rotation&&(n.rotation=t.rotation,r=!0),1===t.repeat.x&&1===t.repeat.y||(n.scale=t.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=n,this.extensionsUsed.KHR_texture_transform=!0)}},{key:"buildORMTexture",value:function(e){var t=null==(t=e.aoMap)?void 0:t.image,n=null==(n=e.roughnessMap)?void 0:n.image,i=null==(i=e.metalnessMap)?void 0:i.image;if(t===n&&n===i)return e.aoMap;if(t||n||i){e=Math.max((null==t?void 0:t.width)||0,(null==n?void 0:n.width)||0,(null==i?void 0:i.width)||0);var a=Math.max((null==t?void 0:t.height)||0,(null==n?void 0:n.height)||0,(null==i?void 0:i.height)||0),o=document.createElement("canvas"),s=(o.width=e,o.height=a,o.getContext("2d")),l=(s.fillStyle="#ffffff",s.fillRect(0,0,e,a),s.getImageData(0,0,e,a));if(t){s.drawImage(t,0,0,e,a);for(var u=s.getImageData(0,0,e,a).data,c=0;c<u.length;c+=4)l.data[c]=u[c]}if(n){s.drawImage(n,0,0,e,a);for(var h=s.getImageData(0,0,e,a).data,d=1;d<h.length;d+=4)l.data[d]=h[d]}if(i){s.drawImage(i,0,0,e,a);for(var p=s.getImageData(0,0,e,a).data,f=2;f<p.length;f+=4)l.data[f]=p[f]}return s.putImageData(l,0,0),new r.Texture(o)}}},{key:"processBuffer",value:function(e){var t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}},{key:"processBufferView",value:function(e,t,r,n,i){for(var a,o=this.json,s=(o.bufferViews||(o.bufferViews=[]),a=t===fr?1:t===mr?2:4,_r(n*e.itemSize*a)),l=new DataView(new ArrayBuffer(s)),u=0,c=r;c<r+n;c++)for(var h=0;h<e.itemSize;h++){var d=void 0;4<e.itemSize?d=e.array[c*e.itemSize+h]:0===h?d=e.getX(c):1===h?d=e.getY(c):2===h?d=e.getZ(c):3===h&&(d=e.getW(c)),5126===t?l.setFloat32(u,d,!0):5125===t?l.setUint32(u,d,!0):t===mr?l.setUint16(u,d,!0):t===fr&&l.setUint8(u,d),u+=a}var p={buffer:this.processBuffer(l.buffer),byteOffset:this.byteOffset,byteLength:s};return void 0!==i&&(p.target=i),34962===i&&(p.byteStride=e.itemSize*a),this.byteOffset+=s,o.bufferViews.push(p),{id:o.bufferViews.length-1,byteLength:0}}},{key:"processBufferViewImage",value:function(e){var t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(n,i){var a=new window.FileReader;if(!(e instanceof Blob))return i();a.readAsArrayBuffer(e),a.onloadend=function(){var e=Er(a.result),i={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,n(r.bufferViews.push(i)-1)}}))}},{key:"processAccessor",value:function(e,t,r,n){var i,a,o,s=this.options,l=this.json;if(e.array.constructor===Float32Array)i=5126;else if(e.array.constructor===Uint32Array)i=5125;else if(e.array.constructor===Uint16Array)i=mr;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");i=fr}return void 0===r&&(r=0),void 0===n&&(n=e.count),s.truncateDrawRange&&void 0!==t&&null===t.index&&(s=r+n,o=t.drawRange.count===1/0?e.count:t.drawRange.start+t.drawRange.count,r=Math.max(r,t.drawRange.start),(n=Math.min(s,o)-r)<0&&(n=0)),0===n?null:(s=function(e,t,r){for(var n={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},i=t;i<t+r;i++)for(var a=0;a<e.itemSize;a++){var o=void 0;4<e.itemSize?o=e.array[i*e.itemSize+a]:0===a?o=e.getX(i):1===a?o=e.getY(i):2===a?o=e.getZ(i):3===a&&(o=e.getW(i)),n.min[a]=Math.min(n.min[a],o),n.max[a]=Math.max(n.max[a],o)}return n}(e,r,n),void 0!==t&&(a=e===t.index?34963:34962),t={bufferView:(o=this.processBufferView(e,i,r,n,a)).id,byteOffset:o.byteOffset,componentType:i,count:n,max:s.max,min:s.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]},!0===e.normalized&&(t.normalized=!0),l.accessors||(l.accessors=[]),l.accessors.push(t)-1)}},{key:"processImage",value:function(e,t,n,i){var a=this,o=a.cache,s=a.json,l=a.options,u=a.pending,c=(o.images.has(e)||o.images.set(e,{}),o=o.images.get(e),"image/png");if(void 0!==o[n=c+":flipY/"+n.toString()])return o[n];s.images||(s.images=[]);var h={mimeType:c};if(!0===l.binary&&null!=i&&null!=(p=i.userData)&&p.blob&&(null==i||null==(p=i.userData)?void 0:p.blob)instanceof Blob)u.push(new Promise((function(e){a.processBufferViewImage(i.userData.blob).then((function(t){h.bufferView=t,e()}))})));else if(l.embedImages){var d=Tr=Tr||document.createElement("canvas"),p=(d.width=Math.min(e.width,l.maxTextureSize),d.height=Math.min(e.height,l.maxTextureSize),d.getContext("2d"));if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap)p.drawImage(e,0,0,d.width,d.height);else{t!==r.RGBAFormat&&console.error("GLTFExporter: Only RGBAFormat is supported."),(e.width>l.maxTextureSize||e.height>l.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);for(var f=new Uint8ClampedArray(e.height*e.width*4),m=0;m<f.length;m+=4)f[m+0]=e.data[m+0],f[m+1]=e.data[m+1],f[m+2]=e.data[m+2],f[m+3]=e.data[m+3];p.putImageData(new ImageData(f,e.width,e.height),0,0)}!0===l.binary?u.push(new Promise((function(e){d.toBlob((function(t){a.processBufferViewImage(t).then((function(t){h.bufferView=t,e()}))}),c)}))):h.uri=d.toDataURL(c)}else h.uri=e.src;return t=s.images.push(h)-1,o[n]=t}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter:Mr[e.magFilter],minFilter:Mr[e.minFilter],wrapS:Mr[e.wrapS],wrapT:Mr[e.wrapT]},t.samplers.push(e)-1}},{key:"processTexture",value:function(e){var t=this.cache,r=this.json;if(t.textures.has(e))return t.textures.get(e);r.textures||(r.textures=[]);var n={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,e)};return e.name&&(n.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,n)})),r=r.textures.push(n)-1,t.textures.set(e,r),this.options.myOptions.helper.parseTexture({texture:e,textureDef:n}),r}},{key:"processMaterial",value:function(e){var t=this.cache,n=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;n.materials||(n.materials=[]);var i,a={pbrMetallicRoughness:{}},o=(Cr((this.options.myOptions.helper.parseMaterial({material:e,materialDef:a,options:this}),!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."),o=e.color.toArray().concat([e.opacity])),[1,1,1,1])||(a.pbrMetallicRoughness.baseColorFactor=o),e.isMeshStandardMaterial?(a.pbrMetallicRoughness.metallicFactor=e.metalness,a.pbrMetallicRoughness.roughnessFactor=e.roughness):(a.pbrMetallicRoughness.metallicFactor=.5,a.pbrMetallicRoughness.roughnessFactor=.5),this.buildORMTexture(e));return(e.metalnessMap||e.roughnessMap)&&(o={index:this.processTexture(o)},this.applyTextureTransform(o,e.metalnessMap||e.roughnessMap),a.pbrMetallicRoughness.metallicRoughnessTexture=o),e.map&&(o={index:this.processTexture(e.map)},this.applyTextureTransform(o,e.map),a.pbrMetallicRoughness.baseColorTexture=o),e.emissive&&(o=e.emissive.clone().multiplyScalar(e.emissiveIntensity),1<(i=Math.max(o.r,o.g,o.b))&&(o.multiplyScalar(1/i),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),0<i&&(a.emissiveFactor=o.toArray()),e.emissiveMap&&(i={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(i,e.emissiveMap),a.emissiveTexture=i)),e.normalMap&&(o={index:this.processTexture(e.normalMap)},e.normalScale&&1!==e.normalScale.x&&(o.scale=e.normalScale.x),this.applyTextureTransform(o,e.normalMap),a.normalTexture=o),e.aoMap&&(i={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(i.strength=e.aoMapIntensity),this.applyTextureTransform(i,e.aoMap),a.occlusionTexture=i),e.transparent?a.alphaMode="BLEND":0<e.alphaTest&&(a.alphaMode="MASK",a.alphaCutoff=e.alphaTest),e.side===r.DoubleSide&&(a.doubleSided=!0),""!==e.name&&(a.name=e.name),this.serializeUserData(e,a),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,a)})),o=n.materials.push(a)-1,t.materials.set(e,o),o}},{key:"processMesh",value:function(e){var t=this.cache,n=this.json,i=[e.geometry.uuid];if(Array.isArray(e.material))for(var a=0,o=e.material.length;a<o;a++)i.push(e.material[a].uuid);else i.push(e.material.uuid);var s=i.join(":");if(t.meshes.has(s))return t.meshes.get(s);var l=e.geometry,u=e.isLineSegments?1:e.isLineLoop?2:e.isLine?3:e.isPoints?0:e.material.wireframe?1:4;if(!0!==l.isBufferGeometry)throw new Error("THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry.");var c,h,d,p={},f={},m=[],v=[],g={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},y=l.getAttribute("normal"),b=(void 0===y||this.isNormalizedNormalAttribute(y)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),l.setAttribute("normal",this.createNormalizedNormalAttribute(y))),null);for(h in l.attributes)"morph"!==h.slice(0,5)&&(c=l.attributes[h],h=g[h]||h.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(h)||(h="_"+h),t.attributes.has(this.getUID(c))?f[h]=t.attributes.get(this.getUID(c)):(b=null,d=c.array,"JOINTS_0"!==h||d instanceof Uint16Array||d instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),b=new r.BufferAttribute(new Uint16Array(d),c.itemSize,c.normalized)),null!==(d=this.processAccessor(b||c,l))&&(f[h]=d,t.attributes.set(this.getUID(c),d))));if(void 0!==y&&l.setAttribute("normal",y),0===Object.keys(f).length)return null;if(void 0!==e.morphTargetInfluences&&0<e.morphTargetInfluences.length){var x=[],w=[],A={};if(void 0!==e.morphTargetDictionary)for(var S in e.morphTargetDictionary)A[e.morphTargetDictionary[S]]=S;for(var M=0;M<e.morphTargetInfluences.length;++M){var B,C={},_=!1;for(B in l.morphAttributes)if("position"!==B&&"normal"!==B)_||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),_=!0);else{var E=l.morphAttributes[B][M],T=B.toUpperCase(),D=l.attributes[B];if(t.attributes.has(this.getUID(E)))C[T]=t.attributes.get(this.getUID(E));else{var P=E.clone();if(!l.morphTargetsRelative)for(var O=0,R=E.count;O<R;O++)P.setXYZ(O,E.getX(O)-D.getX(O),E.getY(O)-D.getY(O),E.getZ(O)-D.getZ(O));C[T]=this.processAccessor(P,l),t.attributes.set(this.getUID(D),C[T])}}v.push(C),x.push(e.morphTargetInfluences[M]),void 0!==e.morphTargetDictionary&&w.push(A[M])}p.weights=x,0<w.length&&(p.extras={},p.extras.targetNames=w)}if((y=Array.isArray(e.material))&&0===l.groups.length)return null;for(var I=y?e.material:[e.material],k=y?l.groups:[{materialIndex:0,start:void 0,count:void 0}],L=0,F=k.length;L<F;L++){var U={mode:u,attributes:f},G=(this.serializeUserData(l,U),0<v.length&&(U.targets=v),null!==l.index&&(G=this.getUID(l.index),void 0===k[L].start&&void 0===k[L].count||(G+=":"+k[L].start+":"+k[L].count),t.attributes.has(G)?U.indices=t.attributes.get(G):(U.indices=this.processAccessor(l.index,l,k[L].start,k[L].count),t.attributes.set(G,U.indices)),null===U.indices&&delete U.indices),this.processMaterial(I[k[L].materialIndex]));null!==G&&(U.material=G),m.push(U)}return p.primitives=m,n.meshes||(n.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,p)})),y=n.meshes.push(p)-1,t.meshes.set(s,y),y}},{key:"processCamera",value:function(e){var t=this.json,n=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),i={type:n?"orthographic":"perspective"};return n?i.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:i.perspective={aspectRatio:e.aspect,yfov:r.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(i.name=e.type),t.cameras.push(i)-1}},{key:"processAnimation",value:function(e,t){for(var n=this.json,i=this.nodeMap,a=(n.animations||(n.animations=[]),(e=pr.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),o=[],s=[],l=0;l<a.length;++l){var u=a[l],c=r.PropertyBinding.parseTrackName(u.name),h=r.PropertyBinding.findNode(t,c.nodeName),d=Br[c.propertyName];if(!(h="bones"===c.objectName?!0===h.isSkinnedMesh?h.skeleton.getBoneByName(c.objectIndex):void 0:h)||!d)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',u.name),null;c=u.values.length/u.times.length;var p=void(d===Br.morphTargetInfluences&&(c/=h.morphTargetInfluences.length));!0===u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(p="CUBICSPLINE",c/=3):p=u.getInterpolation()===r.InterpolateDiscrete?"STEP":"LINEAR",s.push({input:this.processAccessor(new r.BufferAttribute(u.times,1)),output:this.processAccessor(new r.BufferAttribute(u.values,c)),interpolation:p}),o.push({sampler:s.length-1,target:{node:i.get(h),path:d}})}return n.animations.push({name:e.name||"clip_"+n.animations.length,samplers:s,channels:o}),n.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,n=this.nodeMap,i=t.nodes[n.get(e)],a=e.skeleton;if(void 0===a)return null;var o=e.skeleton.bones[0];if(void 0===o)return null;for(var s=[],l=new Float32Array(16*a.bones.length),u=new r.Matrix4,c=0;c<a.bones.length;++c){var h=a.bones[c];h=this.options.myOptions.helper.getNodeMapValueWithBone(h,n),s.push(h),u.copy(a.boneInverses[c]),u.multiply(e.bindMatrix).toArray(l,16*c)}return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new r.BufferAttribute(l,16)),joints:s,skeleton:n.get(o)}),i.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,r,n=this.json,i=this.options,a=this.nodeMap,o=(n.nodes||(n.nodes=[]),{});if(i.myOptions.helper.parseNode({object:e,nodeDef:o,options:this}),console.log(e.children,"object.children"),i.trs?(r=e.quaternion.toArray(),d=e.position.toArray(),t=e.scale.toArray(),Cr(r,[0,0,0,1])||(o.rotation=r),Cr(d,[0,0,0])||(o.translation=d),Cr(t,[1,1,1])||(o.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===Cr(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(o.matrix=e.matrix.elements)),""!==e.name&&(o.name=String(e.name)),this.serializeUserData(e,o),e.isMesh||e.isLine||e.isPoints?null!==(r=this.processMesh(e))&&(o.mesh=r):e.isCamera&&(o.camera=this.processCamera(e)),e.isSkinnedMesh&&this.skins.push(e),0<e.children.length){var s=[];console.log(e.children,"object.children");for(var l=0,u=e.children.length;l<u;l++){var c,h=e.children[l];console.log(h,"child"),!h.visible&&!1!==i.onlyVisible||(c=this.processNode(h),console.log(h,c,"child"),null!==c&&s.push(c))}0<s.length&&(o.children=s)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,o)}));var d=n.nodes.push(o)-1;return a.set(e,d),d}},{key:"processScene",value:function(e){for(var t=this.json,r=this.options,n=(t.scenes||(t.scenes=[],t.scene=0),{}),i=(""!==e.name&&(n.name=e.name),t.scenes.push(n),[]),a=0,o=e.children.length;a<o;a++){var s=e.children[a];!s.visible&&!1!==r.onlyVisible||null!==(s=this.processNode(s))&&i.push(s)}0<i.length&&(n.nodes=i),this.serializeUserData(e,n)}},{key:"processObjects",value:function(e){var t=new r.Scene;t.name="AuxScene";for(var n=0;n<e.length;n++)t.children.push(e[n]);this.processScene(t)}},{key:"processInput",value:function(e){for(var t,n,i=this.options,a=(e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)})),[]),o=0;o<e.length;o++)e[o]instanceof r.Scene?this.processScene(e[o]):a.push(e[o]);1===a.length?(t=a[0],"model"===i.myOptions.helper.type&&((n=new r.Group).name="glb_model",n.add(t),t=n),this.processScene(t)):1<a.length&&this.processObjects(a);for(var s=0;s<this.skins.length;++s)this.processSkin(this.skins[s]);for(var l=0;l<i.animations.length;++l)this.processAnimation(i.animations[l],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}},{key:"_invokeAll",value:function(e){for(var t=0,r=this.plugins.length;t<r;t++)e(this.plugins[t])}}]),e}(),Pr=function(){function e(t){cr(this,e),this.writer=t,this.name="KHR_lights_punctual"}return dr(e,[{key:"writeNode",value:function(e,t){var r,n,i;e.isLight&&(e.isDirectionalLight||e.isPointLight||e.isSpotLight?(r=(i=this.writer).json,i=i.extensionsUsed,n={},e.name&&(n.name=e.name),n.color=e.color.toArray(),n.intensity=e.intensity,e.isDirectionalLight?n.type="directional":e.isPointLight?(n.type="point",0<e.distance&&(n.range=e.distance)):e.isSpotLight&&(n.type="spot",0<e.distance&&(n.range=e.distance),n.spot={},n.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,n.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),i[this.name]||(r.extensions=r.extensions||{},r.extensions[this.name]={lights:[]},i[this.name]=!0),(i=r.extensions[this.name].lights).push(n),t.extensions=t.extensions||{},t.extensions[this.name]={light:i.length-1}):console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e))}}]),e}(),Or=function(){function e(t){cr(this,e),this.writer=t,this.name="KHR_materials_unlit"}return dr(e,[{key:"writeMaterial",value:function(e,t){e.isMeshBasicMaterial&&(e=this.writer.extensionsUsed,t.extensions=t.extensions||{},t.extensions[this.name]={},e[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9)}}]),e}(),Rr=function(){function e(t){cr(this,e),this.writer=t,this.name="KHR_materials_pbrSpecularGlossiness"}return dr(e,[{key:"writeMaterial",value:function(e,t){var r,n,i,a;e.isGLTFSpecularGlossinessMaterial&&(n=(r=this.writer).extensionsUsed,i={},t.pbrMetallicRoughness.baseColorFactor&&(i.diffuseFactor=t.pbrMetallicRoughness.baseColorFactor),e.specular.toArray(a=[1,1,1],0),i.specularFactor=a,i.glossinessFactor=e.glossiness,t.pbrMetallicRoughness.baseColorTexture&&(i.diffuseTexture=t.pbrMetallicRoughness.baseColorTexture),e.specularMap&&(a={index:r.processTexture(e.specularMap)},r.applyTextureTransform(a,e.specularMap),i.specularGlossinessTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0)}}]),e}(),Ir=function(){function e(t){cr(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return dr(e,[{key:"writeMaterial",value:function(e,t){var r,n,i,a;e.isMeshPhysicalMaterial&&(n=(r=this.writer).extensionsUsed,(i={}).clearcoatFactor=e.clearcoat,e.clearcoatMap&&(a={index:r.processTexture(e.clearcoatMap)},r.applyTextureTransform(a,e.clearcoatMap),i.clearcoatTexture=a),i.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap&&(a={index:r.processTexture(e.clearcoatRoughnessMap)},r.applyTextureTransform(a,e.clearcoatRoughnessMap),i.clearcoatRoughnessTexture=a),e.clearcoatNormalMap&&(a={index:r.processTexture(e.clearcoatNormalMap)},r.applyTextureTransform(a,e.clearcoatNormalMap),i.clearcoatNormalTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0)}}]),e}(),kr=function(){function e(t){cr(this,e),this.writer=t,this.name="KHR_materials_transmission"}return dr(e,[{key:"writeMaterial",value:function(e,t){var r,n,i,a;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(i={}).transmissionFactor=e.transmission,e.transmissionMap&&(a={index:r.processTexture(e.transmissionMap)},r.applyTextureTransform(a,e.transmissionMap),i.transmissionTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0)}}]),e}(),Lr=function(){function e(t){cr(this,e),this.writer=t,this.name="KHR_materials_volume"}return dr(e,[{key:"writeMaterial",value:function(e,t){var r,n,i,a;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(i={}).thicknessFactor=e.thickness,e.thicknessMap&&(a={index:r.processTexture(e.thicknessMap)},r.applyTextureTransform(a,e.thicknessMap),i.thicknessTexture=a),i.attenuationDistance=e.attenuationDistance,i.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0)}}]),e}();function Fr(){Fr=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=(p="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",i=p.asyncIterator||"@@asyncIterator",a=p.toStringTag||"@@toStringTag";function o(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{o({},"")}catch(t){o=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var i,a,o,s;return t=t&&t.prototype instanceof c?t:c,t=Object.create(t.prototype),n=new x(n||[]),t._invoke=(i=e,a=r,o=n,s="suspendedStart",function(e,t){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===e)throw t;return{value:void 0,done:!0}}for(o.method=e,o.arg=t;;){var r=o.delegate;if(r&&(r=function e(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,e(t,r),"throw"===r.method))return u;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}return"throw"===(n=l(n,t.iterator,r.arg)).type?(r.method="throw",r.arg=n.arg,r.delegate=null,u):(n=n.arg)?n.done?(r[t.resultName]=n.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,u):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,u)}(r,o),r)){if(r===u)continue;return r}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if("suspendedStart"===s)throw s="completed",o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);if(s="executing","normal"===(r=l(i,a,o)).type){if(s=o.done?"completed":"suspendedYield",r.arg===u)continue;return{value:r.arg,done:o.done}}"throw"===r.type&&(s="completed",o.method="throw",o.arg=r.arg)}}),t}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var u={};function c(){}function h(){}function d(){}var p,f,m=(o(p={},n,(function(){return this})),(f=(f=Object.getPrototypeOf)&&f(f(w([]))))&&f!==t&&r.call(f,n)&&(p=f),d.prototype=c.prototype=Object.create(p));function v(e){["next","throw","return"].forEach((function(t){o(e,t,(function(e){return this._invoke(t,e)}))}))}function g(e,t){var n;this._invoke=function(i,a){function o(){return new t((function(n,o){!function n(i,a,o,s){var u;if("throw"!==(i=l(e[i],e,a)).type)return(a=(u=i.arg).value)&&"object"==Gr(a)&&r.call(a,"__await")?t.resolve(a.__await).then((function(e){n("next",e,o,s)}),(function(e){n("throw",e,o,s)})):t.resolve(a).then((function(e){u.value=e,o(u)}),(function(e){return n("throw",e,o,s)}));s(i.arg)}(i,a,n,o)}))}return n=n?n.then(o,o):o()}}function y(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function b(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(y,this),this.reset(!0)}function w(e){if(e){var t,i=e[n];if(i)return i.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(i=function n(){for(;++t<e.length;)if(r.call(e,t))return n.value=e[t],n.done=!1,n;return n.value=void 0,n.done=!0,n}).next=i}return{next:A}}function A(){return{value:void 0,done:!0}}return o(m,"constructor",h.prototype=d),o(d,"constructor",h),h.displayName=o(d,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){return!!(e="function"==typeof e&&e.constructor)&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,o(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},v(g.prototype),o(g.prototype,i,(function(){return this})),e.AsyncIterator=g,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var o=new g(s(t,r,n,i),a);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},v(m),o(m,a,"Generator"),o(m,n,(function(){return this})),o(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,r=[];for(t in e)r.push(t);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=w,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(b),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return o.type="throw",o.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;0<=i;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}var o=(a=a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc?null:a)?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,u):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),u},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),b(r),u}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,i=this.tryEntries[t];if(i.tryLoc===e)return"throw"===(r=i.completion).type&&(n=r.arg,b(i)),n}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:w(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),u}},e}function Ur(e,t,r,n,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void r(e)}s.done?t(l):Promise.resolve(l).then(n,i)}function Gr(e){return(Gr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function jr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Nr(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Hr(e,t,r){t&&Nr(e.prototype,t),r&&Nr(e,r),Object.defineProperty(e,"prototype",{writable:!1})}pr.Utils={insertKeyframe:function(e,t){var r,n=e.getValueSize(),i=new e.TimeBufferType(e.times.length+1),a=new e.ValueBufferType(e.values.length+n),o=e.createInterpolant(new e.ValueBufferType(n));if(0===e.times.length){i[0]=t;for(var s=0;s<n;s++)a[s]=0;r=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<.001)return 0;i[0]=t,i.set(e.times,1),a.set(o.evaluate(t),0),a.set(e.values,n),r=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<.001)return e.times.length-1;i[i.length-1]=t,i.set(e.times,0),a.set(e.values,0),a.set(o.evaluate(t),e.values.length),r=i.length-1}else for(var l=0;l<e.times.length;l++){if(Math.abs(e.times[l]-t)<.001)return l;if(e.times[l]<t&&e.times[l+1]>t){i.set(e.times.slice(0,l+1),0),i[l+1]=t,i.set(e.times.slice(l+1),l+2),a.set(e.values.slice(0,(l+1)*n),0),a.set(o.evaluate(t),(l+1)*n),a.set(e.values.slice((l+1)*n),(l+2)*n),r=l+1;break}}return e.times=i,e.values=a,r},mergeMorphTargetTracks:function(e,t){for(var n=[],i={},a=e.tracks,o=0;o<a.length;++o){var s=a[o],l=r.PropertyBinding.parseTrackName(s.name),u=r.PropertyBinding.findNode(t,l.nodeName);if("morphTargetInfluences"!==l.propertyName||void 0===l.propertyIndex)n.push(s);else{if(s.createInterpolant!==s.InterpolantFactoryMethodDiscrete&&s.createInterpolant!==s.InterpolantFactoryMethodLinear){if(s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),(s=s.clone()).setInterpolation(r.InterpolateLinear)}var c=u.morphTargetInfluences.length,h=u.morphTargetDictionary[l.propertyIndex];if(void 0===h)throw new Error("THREE.GLTFExporter: Morph target name not found: "+l.propertyIndex);var d=void 0;if(void 0===i[u.uuid]){for(var p=new((d=s.clone()).ValueBufferType)(c*d.times.length),f=0;f<d.times.length;f++)p[f*c+h]=d.values[f];d.name=(l.nodeName||"")+".morphTargetInfluences",d.values=p,i[u.uuid]=d,n.push(d)}else{var m=s.createInterpolant(new s.ValueBufferType(1));d=i[u.uuid];for(var v=0;v<d.times.length;v++)d.values[v*c+h]=m.evaluate(d.times[v]);for(var g=0;g<s.times.length;g++){var y=this.insertKeyframe(d,s.times[g]);d.values[y*c+h]=s.values[g]}}}}return e.tracks=n,e}};var zr=function(){function e(){jr(this,e),this.pluginCallbacks=[],this.register((function(e){return new en(e)})),this.register((function(e){return new tn(e)})),this.register((function(e){return new rn(e)})),this.register((function(e){return new an(e)})),this.register((function(e){return new on(e)})),this.register((function(e){return new nn(e)}))}return Hr(e,[{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,r,n){"object"===Gr(r)&&(console.warn("THREE.GLTFExporter: parse() expects options as the fourth argument now."),n=r);for(var i=new $r,a=[],o=0,s=this.pluginCallbacks.length;o<s;o++)a.push(this.pluginCallbacks[o](i));i.setPlugins(a),i.write(e,t,n).catch(r)}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,i){r.parse(e,n,i,t)}))}}]),e}(),Vr=5121,Jr=5123,Kr=(gr=9728,br=9729,j=9984,yr=9985,xr=9986,wr=9987,Sr=33071,Ar=33648,{}),Wr=(Kr[r.NearestFilter]=gr,Kr[r.NearestMipmapNearestFilter]=j,Kr[r.NearestMipmapLinearFilter]=xr,Kr[r.LinearFilter]=br,Kr[r.LinearMipmapNearestFilter]=yr,Kr[r.LinearMipmapLinearFilter]=wr,Kr[r.ClampToEdgeWrapping]=Sr,Kr[r.RepeatWrapping]=10497,Kr[r.MirroredRepeatWrapping]=Ar,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"});function Qr(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function Xr(e){return 4*Math.ceil(e/4)}function Zr(e,t){var r=1<arguments.length&&void 0!==t?t:0,n=Xr(e.byteLength);if(n===e.byteLength)return e;var i=new Uint8Array(n);if(i.set(new Uint8Array(e)),0!==r)for(var a=e.byteLength;a<n;a++)i[a]=r;return i.buffer}var Yr=null;function qr(){return Yr=Yr||("undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"))}var $r=function(){function e(){jr(this,e),this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}var t,n;return Hr(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=Fr().mark((function e(t,r,n){var i,a,o,s,l;return Fr().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.options=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(t),e.next=5,Promise.all(this.pending);case 5:a=(o=this).buffers,i=o.json,n=o.options,o=o.extensionsUsed,a=new Blob(a,{type:"application/octet-stream"}),0<(o=Object.keys(o)).length&&(i.extensionsUsed=o),i.buffers&&0<i.buffers.length&&(i.buffers[0].byteLength=a.size),!0===n.binary?((s=new FileReader).readAsArrayBuffer(a),s.onloadend=function(){var e=Zr(s.result),t=new DataView(new ArrayBuffer(8)),n=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),Zr((n=JSON.stringify(i),(new TextEncoder).encode(n).buffer),32)),a=new DataView(new ArrayBuffer(8)),o=(a.setUint32(0,n.byteLength,!0),a.setUint32(4,1313821514,!0),new ArrayBuffer(12)),l=((u=new DataView(o)).setUint32(0,1179937895,!0),u.setUint32(4,2,!0),12+a.byteLength+n.byteLength+t.byteLength+e.byteLength),u=(u.setUint32(8,l,!0),new Blob([o,a,n,t,e],{type:"application/octet-stream"})),c=new FileReader;c.readAsArrayBuffer(u),c.onloadend=function(){r(c.result)}}):i.buffers&&0<i.buffers.length?((l=new FileReader).readAsDataURL(a),l.onloadend=function(){var e=l.result;i.buffers[0].uri=e,r(i)}):r(i);case 15:case"end":return e.stop()}}),e,this)})),n=function(){var e=this,r=arguments;return new Promise((function(n,i){var a=t.apply(e,r);function o(e){Ur(a,n,i,o,s,"next",e)}function s(e){Ur(a,n,i,o,s,"throw",e)}o(void 0)}))},function(e,t,r){return n.apply(this,arguments)})},{key:"serializeUserData",value:function(e,t){if(0!==Object.keys(e.userData).length){var r=this.options,n=this.extensionsUsed;try{var i=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&i.gltfExtensions){for(var a in void 0===t.extensions&&(t.extensions={}),i.gltfExtensions)t.extensions[a]=i.gltfExtensions[a],n[a]=!0;delete i.gltfExtensions}0<Object.keys(i).length&&(t.extras=i)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}}},{key:"getUID",value:function(e){return this.uids.has(e)||this.uids.set(e,this.uid++),this.uids.get(e)}},{key:"isNormalizedNormalAttribute",value:function(e){if(this.cache.attributesNormalized.has(e))return!1;for(var t=new r.Vector3,n=0,i=e.count;n<i;n++)if(5e-4<Math.abs(t.fromBufferAttribute(e,n).length()-1))return!1;return!0}},{key:"createNormalizedNormalAttribute",value:function(e){var t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);for(var n=e.clone(),i=new r.Vector3,a=0,o=n.count;a<o;a++)i.fromBufferAttribute(n,a),0===i.x&&0===i.y&&0===i.z?i.setX(1):i.normalize(),n.setXYZ(a,i.x,i.y,i.z);return t.attributesNormalized.set(e,n),n}},{key:"applyTextureTransform",value:function(e,t){var r=!1,n={};0===t.offset.x&&0===t.offset.y||(n.offset=t.offset.toArray(),r=!0),0!==t.rotation&&(n.rotation=t.rotation,r=!0),1===t.repeat.x&&1===t.repeat.y||(n.scale=t.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=n,this.extensionsUsed.KHR_texture_transform=!0)}},{key:"buildMetalRoughTexture",value:function(e,t){if(e===t)return e;console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures.");var n=null==e?void 0:e.image,i=null==t?void 0:t.image,a=Math.max((null==n?void 0:n.width)||0,(null==i?void 0:i.width)||0),o=Math.max((null==n?void 0:n.height)||0,(null==i?void 0:i.height)||0),s=qr(),l=(s.width=a,s.height=o,s.getContext("2d")),u=(l.fillStyle="#00ffff",l.fillRect(0,0,a,o),l.getImageData(0,0,a,o));if(n){l.drawImage(n,0,0,a,o);for(var c=l.getImageData(0,0,a,o).data,h=2;h<c.length;h+=4)u.data[h]=c[h]}if(i){l.drawImage(i,0,0,a,o);for(var d=l.getImageData(0,0,a,o).data,p=1;p<d.length;p+=4)u.data[p]=d[p]}return l.putImageData(u,0,0),(n=(e||t).clone()).source=new r.Source(s),n}},{key:"processBuffer",value:function(e){var t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}},{key:"processBufferView",value:function(e,t,r,n,i){for(var a,o=this.json,s=(o.bufferViews||(o.bufferViews=[]),a=t===Vr?1:t===Jr?2:4,Xr(n*e.itemSize*a)),l=new DataView(new ArrayBuffer(s)),u=0,c=r;c<r+n;c++)for(var h=0;h<e.itemSize;h++){var d=void 0;4<e.itemSize?d=e.array[c*e.itemSize+h]:0===h?d=e.getX(c):1===h?d=e.getY(c):2===h?d=e.getZ(c):3===h&&(d=e.getW(c)),5126===t?l.setFloat32(u,d,!0):5125===t?l.setUint32(u,d,!0):t===Jr?l.setUint16(u,d,!0):t===Vr&&l.setUint8(u,d),u+=a}var p={buffer:this.processBuffer(l.buffer),byteOffset:this.byteOffset,byteLength:s};return void 0!==i&&(p.target=i),34962===i&&(p.byteStride=e.itemSize*a),this.byteOffset+=s,o.bufferViews.push(p),{id:o.bufferViews.length-1,byteLength:0}}},{key:"processBufferViewImage",value:function(e){var t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(n){var i=new FileReader;i.readAsArrayBuffer(e),i.onloadend=function(){var e=Zr(i.result),a={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,n(r.bufferViews.push(a)-1)}}))}},{key:"processAccessor",value:function(e,t,r,n){var i,a,o,s=this.options,l=this.json;if(e.array.constructor===Float32Array)i=5126;else if(e.array.constructor===Uint32Array)i=5125;else if(e.array.constructor===Uint16Array)i=Jr;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");i=Vr}return void 0===r&&(r=0),void 0===n&&(n=e.count),s.truncateDrawRange&&void 0!==t&&null===t.index&&(s=r+n,o=t.drawRange.count===1/0?e.count:t.drawRange.start+t.drawRange.count,r=Math.max(r,t.drawRange.start),(n=Math.min(s,o)-r)<0&&(n=0)),0===n?null:(s=function(e,t,r){for(var n={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},i=t;i<t+r;i++)for(var a=0;a<e.itemSize;a++){var o=void 0;4<e.itemSize?o=e.array[i*e.itemSize+a]:0===a?o=e.getX(i):1===a?o=e.getY(i):2===a?o=e.getZ(i):3===a&&(o=e.getW(i)),n.min[a]=Math.min(n.min[a],o),n.max[a]=Math.max(n.max[a],o)}return n}(e,r,n),void 0!==t&&(a=e===t.index?34963:34962),t={bufferView:(o=this.processBufferView(e,i,r,n,a)).id,byteOffset:o.byteOffset,componentType:i,count:n,max:s.max,min:s.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]},!0===e.normalized&&(t.normalized=!0),l.accessors||(l.accessors=[]),l.accessors.push(t)-1)}},{key:"processImage",value:function(e,t,n){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"image/png",a=this,o=a.cache,s=a.json,l=a.options,u=a.pending,c=(o.images.has(e)||o.images.set(e,{}),o=o.images.get(e),i+":flipY/"+n.toString());if(void 0!==o[c])return o[c];s.images||(s.images=[]);var h={mimeType:i};if(l.embedImages){var d=qr(),p=(d.width=Math.min(e.width,l.maxTextureSize),d.height=Math.min(e.height,l.maxTextureSize),d.getContext("2d"));if(!0===n&&(p.translate(0,d.height),p.scale(1,-1)),void 0!==e.data){t!==r.RGBAFormat&&console.error("GLTFExporter: Only RGBAFormat is supported."),(e.width>l.maxTextureSize||e.height>l.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);for(var f=new Uint8ClampedArray(e.height*e.width*4),m=0;m<f.length;m+=4)f[m+0]=e.data[m+0],f[m+1]=e.data[m+1],f[m+2]=e.data[m+2],f[m+3]=e.data[m+3];p.putImageData(new ImageData(f,e.width,e.height),0,0)}else p.drawImage(e,0,0,d.width,d.height);!0===l.binary?(n=void 0!==d.toBlob?new Promise((function(e){return d.toBlob(e,i)})):d.convertToBlob({type:i}),u.push(n.then((function(e){return a.processBufferViewImage(e).then((function(e){h.bufferView=e}))})))):h.uri=d.toDataURL(i)}else h.uri=e.src;return t=s.images.push(h)-1,o[c]=t}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter:Kr[e.magFilter],minFilter:Kr[e.minFilter],wrapS:Kr[e.wrapS],wrapT:Kr[e.wrapT]},t.samplers.push(e)-1}},{key:"processTexture",value:function(e){var t=this.cache,r=this.json;if(t.textures.has(e))return t.textures.get(e);r.textures||(r.textures=[]);var n=("image/webp"===(i=e.userData.mimeType)&&(i="image/png"),{sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,i)}),i=(e.name&&(n.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,n)})),r.textures.push(n)-1);return t.textures.set(e,i),i}},{key:"processMaterial",value:function(e){var t=this.cache,n=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;n.materials||(n.materials=[]);var i={pbrMetallicRoughness:{}},a=(!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."),e.color.toArray().concat([e.opacity])),o=(Qr(a,[1,1,1,1])||(i.pbrMetallicRoughness.baseColorFactor=a),e.isMeshStandardMaterial?(i.pbrMetallicRoughness.metallicFactor=e.metalness,i.pbrMetallicRoughness.roughnessFactor=e.roughness):(i.pbrMetallicRoughness.metallicFactor=.5,i.pbrMetallicRoughness.roughnessFactor=.5),(e.metalnessMap||e.roughnessMap)&&(a=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),o={index:this.processTexture(a)},this.applyTextureTransform(o,a),i.pbrMetallicRoughness.metallicRoughnessTexture=o),e.map&&(a={index:this.processTexture(e.map)},this.applyTextureTransform(a,e.map),i.pbrMetallicRoughness.baseColorTexture=a),e.emissive&&(o=e.emissive.clone().multiplyScalar(e.emissiveIntensity),1<(a=Math.max(o.r,o.g,o.b))&&(o.multiplyScalar(1/a),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),0<a&&(i.emissiveFactor=o.toArray()),e.emissiveMap&&(a={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(a,e.emissiveMap),i.emissiveTexture=a)),e.normalMap&&(o={index:this.processTexture(e.normalMap)},e.normalScale&&1!==e.normalScale.x&&(o.scale=e.normalScale.x),this.applyTextureTransform(o,e.normalMap),i.normalTexture=o),e.aoMap&&(a={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),i.occlusionTexture=a),e.transparent?i.alphaMode="BLEND":0<e.alphaTest&&(i.alphaMode="MASK",i.alphaCutoff=e.alphaTest),e.side===r.DoubleSide&&(i.doubleSided=!0),""!==e.name&&(i.name=e.name),this.serializeUserData(e,i),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,i)})),n.materials.push(i)-1);return t.materials.set(e,o),o}},{key:"processMesh",value:function(e){var t=this.cache,n=this.json,i=[e.geometry.uuid];if(Array.isArray(e.material))for(var a=0,o=e.material.length;a<o;a++)i.push(e.material[a].uuid);else i.push(e.material.uuid);var s=i.join(":");if(t.meshes.has(s))return t.meshes.get(s);var l=e.geometry,u=e.isLineSegments?1:e.isLineLoop?2:e.isLine?3:e.isPoints?0:e.material.wireframe?1:4;if(!0!==l.isBufferGeometry)throw new Error("THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry.");var c,h,d,p={},f={},m=[],v=[],g={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},y=l.getAttribute("normal"),b=(void 0===y||this.isNormalizedNormalAttribute(y)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),l.setAttribute("normal",this.createNormalizedNormalAttribute(y))),null);for(h in l.attributes)"morph"!==h.slice(0,5)&&(c=l.attributes[h],h=g[h]||h.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(h)||(h="_"+h),t.attributes.has(this.getUID(c))?f[h]=t.attributes.get(this.getUID(c)):(b=null,d=c.array,"JOINTS_0"!==h||d instanceof Uint16Array||d instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),b=new r.BufferAttribute(new Uint16Array(d),c.itemSize,c.normalized)),null!==(d=this.processAccessor(b||c,l))&&(f[h]=d,t.attributes.set(this.getUID(c),d))));if(void 0!==y&&l.setAttribute("normal",y),0===Object.keys(f).length)return null;if(void 0!==e.morphTargetInfluences&&0<e.morphTargetInfluences.length){var x=[],w=[],A={};if(void 0!==e.morphTargetDictionary)for(var S in e.morphTargetDictionary)A[e.morphTargetDictionary[S]]=S;for(var M=0;M<e.morphTargetInfluences.length;++M){var B,C={},_=!1;for(B in l.morphAttributes)if("position"!==B&&"normal"!==B)_||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),_=!0);else{var E=l.morphAttributes[B][M],T=B.toUpperCase(),D=l.attributes[B];if(t.attributes.has(this.getUID(E)))C[T]=t.attributes.get(this.getUID(E));else{var P=E.clone();if(!l.morphTargetsRelative)for(var O=0,R=E.count;O<R;O++)P.setXYZ(O,E.getX(O)-D.getX(O),E.getY(O)-D.getY(O),E.getZ(O)-D.getZ(O));C[T]=this.processAccessor(P,l),t.attributes.set(this.getUID(D),C[T])}}v.push(C),x.push(e.morphTargetInfluences[M]),void 0!==e.morphTargetDictionary&&w.push(A[M])}p.weights=x,0<w.length&&(p.extras={},p.extras.targetNames=w)}if((y=Array.isArray(e.material))&&0===l.groups.length)return null;for(var I=y?e.material:[e.material],k=y?l.groups:[{materialIndex:0,start:void 0,count:void 0}],L=0,F=k.length;L<F;L++){var U={mode:u,attributes:f},G=(this.serializeUserData(l,U),0<v.length&&(U.targets=v),null!==l.index&&(G=this.getUID(l.index),void 0===k[L].start&&void 0===k[L].count||(G+=":"+k[L].start+":"+k[L].count),t.attributes.has(G)?U.indices=t.attributes.get(G):(U.indices=this.processAccessor(l.index,l,k[L].start,k[L].count),t.attributes.set(G,U.indices)),null===U.indices&&delete U.indices),this.processMaterial(I[k[L].materialIndex]));null!==G&&(U.material=G),m.push(U)}return p.primitives=m,n.meshes||(n.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,p)})),y=n.meshes.push(p)-1,t.meshes.set(s,y),y}},{key:"processCamera",value:function(e){var t=this.json,n=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),i={type:n?"orthographic":"perspective"};return n?i.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:i.perspective={aspectRatio:e.aspect,yfov:r.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(i.name=e.type),t.cameras.push(i)-1}},{key:"processAnimation",value:function(e,t){for(var n=this.json,i=this.nodeMap,a=(n.animations||(n.animations=[]),(e=zr.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),o=[],s=[],l=0;l<a.length;++l){var u=a[l],c=r.PropertyBinding.parseTrackName(u.name),h=r.PropertyBinding.findNode(t,c.nodeName),d=Wr[c.propertyName];if(!(h="bones"===c.objectName?!0===h.isSkinnedMesh?h.skeleton.getBoneByName(c.objectIndex):void 0:h)||!d)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',u.name),null;c=u.values.length/u.times.length;var p=void(d===Wr.morphTargetInfluences&&(c/=h.morphTargetInfluences.length));!0===u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(p="CUBICSPLINE",c/=3):p=u.getInterpolation()===r.InterpolateDiscrete?"STEP":"LINEAR",s.push({input:this.processAccessor(new r.BufferAttribute(u.times,1)),output:this.processAccessor(new r.BufferAttribute(u.values,c)),interpolation:p}),o.push({sampler:s.length-1,target:{node:i.get(h),path:d}})}return n.animations.push({name:e.name||"clip_"+n.animations.length,samplers:s,channels:o}),n.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,n=this.nodeMap,i=t.nodes[n.get(e)],a=e.skeleton;if(void 0===a)return null;var o=e.skeleton.bones[0];if(void 0===o)return null;for(var s=[],l=new Float32Array(16*a.bones.length),u=new r.Matrix4,c=0;c<a.bones.length;++c)s.push(n.get(a.bones[c])),u.copy(a.boneInverses[c]),u.multiply(e.bindMatrix).toArray(l,16*c);return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new r.BufferAttribute(l,16)),joints:s,skeleton:n.get(o)}),i.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,r,n=this.json,i=this.options,a=this.nodeMap,o=(n.nodes||(n.nodes=[]),{});if(i.trs?(r=e.quaternion.toArray(),h=e.position.toArray(),t=e.scale.toArray(),Qr(r,[0,0,0,1])||(o.rotation=r),Qr(h,[0,0,0])||(o.translation=h),Qr(t,[1,1,1])||(o.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===Qr(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(o.matrix=e.matrix.elements)),""!==e.name&&(o.name=String(e.name)),this.serializeUserData(e,o),e.isMesh||e.isLine||e.isPoints?null!==(r=this.processMesh(e))&&(o.mesh=r):e.isCamera&&(o.camera=this.processCamera(e)),e.isSkinnedMesh&&this.skins.push(e),0<e.children.length){for(var s=[],l=0,u=e.children.length;l<u;l++){var c=e.children[l];!c.visible&&!1!==i.onlyVisible||null!==(c=this.processNode(c))&&s.push(c)}0<s.length&&(o.children=s)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,o)}));var h=n.nodes.push(o)-1;return a.set(e,h),h}},{key:"processScene",value:function(e){for(var t=this.json,r=this.options,n=(t.scenes||(t.scenes=[],t.scene=0),{}),i=(""!==e.name&&(n.name=e.name),t.scenes.push(n),[]),a=0,o=e.children.length;a<o;a++){var s=e.children[a];!s.visible&&!1!==r.onlyVisible||null!==(s=this.processNode(s))&&i.push(s)}0<i.length&&(n.nodes=i),this.serializeUserData(e,n)}},{key:"processObjects",value:function(e){var t=new r.Scene;t.name="AuxScene";for(var n=0;n<e.length;n++)t.children.push(e[n]);this.processScene(t)}},{key:"processInput",value:function(e){for(var t=this.options,n=(e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)})),[]),i=0;i<e.length;i++)e[i]instanceof r.Scene?this.processScene(e[i]):n.push(e[i]);0<n.length&&this.processObjects(n);for(var a=0;a<this.skins.length;++a)this.processSkin(this.skins[a]);for(var o=0;o<t.animations.length;++o)this.processAnimation(t.animations[o],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}},{key:"_invokeAll",value:function(e){for(var t=0,r=this.plugins.length;t<r;t++)e(this.plugins[t])}}]),e}(),en=function(){function e(t){jr(this,e),this.writer=t,this.name="KHR_lights_punctual"}return Hr(e,[{key:"writeNode",value:function(e,t){var r,n,i;e.isLight&&(e.isDirectionalLight||e.isPointLight||e.isSpotLight?(r=(i=this.writer).json,i=i.extensionsUsed,n={},e.name&&(n.name=e.name),n.color=e.color.toArray(),n.intensity=e.intensity,e.isDirectionalLight?n.type="directional":e.isPointLight?(n.type="point",0<e.distance&&(n.range=e.distance)):e.isSpotLight&&(n.type="spot",0<e.distance&&(n.range=e.distance),n.spot={},n.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,n.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),i[this.name]||(r.extensions=r.extensions||{},r.extensions[this.name]={lights:[]},i[this.name]=!0),(i=r.extensions[this.name].lights).push(n),t.extensions=t.extensions||{},t.extensions[this.name]={light:i.length-1}):console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e))}}]),e}(),tn=function(){function e(t){jr(this,e),this.writer=t,this.name="KHR_materials_unlit"}return Hr(e,[{key:"writeMaterial",value:function(e,t){e.isMeshBasicMaterial&&(e=this.writer.extensionsUsed,t.extensions=t.extensions||{},t.extensions[this.name]={},e[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9)}}]),e}(),rn=function(){function e(t){jr(this,e),this.writer=t,this.name="KHR_materials_pbrSpecularGlossiness"}return Hr(e,[{key:"writeMaterial",value:function(e,t){var r,n,i,a;e.isGLTFSpecularGlossinessMaterial&&(n=(r=this.writer).extensionsUsed,i={},t.pbrMetallicRoughness.baseColorFactor&&(i.diffuseFactor=t.pbrMetallicRoughness.baseColorFactor),e.specular.toArray(a=[1,1,1],0),i.specularFactor=a,i.glossinessFactor=e.glossiness,t.pbrMetallicRoughness.baseColorTexture&&(i.diffuseTexture=t.pbrMetallicRoughness.baseColorTexture),e.specularMap&&(a={index:r.processTexture(e.specularMap)},r.applyTextureTransform(a,e.specularMap),i.specularGlossinessTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0)}}]),e}(),nn=function(){function e(t){jr(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return Hr(e,[{key:"writeMaterial",value:function(e,t){var r,n,i,a;e.isMeshPhysicalMaterial&&(n=(r=this.writer).extensionsUsed,(i={}).clearcoatFactor=e.clearcoat,e.clearcoatMap&&(a={index:r.processTexture(e.clearcoatMap)},r.applyTextureTransform(a,e.clearcoatMap),i.clearcoatTexture=a),i.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap&&(a={index:r.processTexture(e.clearcoatRoughnessMap)},r.applyTextureTransform(a,e.clearcoatRoughnessMap),i.clearcoatRoughnessTexture=a),e.clearcoatNormalMap&&(a={index:r.processTexture(e.clearcoatNormalMap)},r.applyTextureTransform(a,e.clearcoatNormalMap),i.clearcoatNormalTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0)}}]),e}(),an=function(){function e(t){jr(this,e),this.writer=t,this.name="KHR_materials_transmission"}return Hr(e,[{key:"writeMaterial",value:function(e,t){var r,n,i,a;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(i={}).transmissionFactor=e.transmission,e.transmissionMap&&(a={index:r.processTexture(e.transmissionMap)},r.applyTextureTransform(a,e.transmissionMap),i.transmissionTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0)}}]),e}(),on=function(){function e(t){jr(this,e),this.writer=t,this.name="KHR_materials_volume"}return Hr(e,[{key:"writeMaterial",value:function(e,t){var r,n,i,a;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(i={}).thicknessFactor=e.thickness,e.thicknessMap&&(a={index:r.processTexture(e.thicknessMap)},r.applyTextureTransform(a,e.thicknessMap),i.thicknessTexture=a),i.attenuationDistance=e.attenuationDistance,i.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0)}}]),e}(),sn=(zr.Utils={insertKeyframe:function(e,t){var r,n=e.getValueSize(),i=new e.TimeBufferType(e.times.length+1),a=new e.ValueBufferType(e.values.length+n),o=e.createInterpolant(new e.ValueBufferType(n));if(0===e.times.length){i[0]=t;for(var s=0;s<n;s++)a[s]=0;r=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<.001)return 0;i[0]=t,i.set(e.times,1),a.set(o.evaluate(t),0),a.set(e.values,n),r=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<.001)return e.times.length-1;i[i.length-1]=t,i.set(e.times,0),a.set(e.values,0),a.set(o.evaluate(t),e.values.length),r=i.length-1}else for(var l=0;l<e.times.length;l++){if(Math.abs(e.times[l]-t)<.001)return l;if(e.times[l]<t&&e.times[l+1]>t){i.set(e.times.slice(0,l+1),0),i[l+1]=t,i.set(e.times.slice(l+1),l+2),a.set(e.values.slice(0,(l+1)*n),0),a.set(o.evaluate(t),(l+1)*n),a.set(e.values.slice((l+1)*n),(l+2)*n),r=l+1;break}}return e.times=i,e.values=a,r},mergeMorphTargetTracks:function(e,t){for(var n=[],i={},a=e.tracks,o=0;o<a.length;++o){var s=a[o],l=r.PropertyBinding.parseTrackName(s.name),u=r.PropertyBinding.findNode(t,l.nodeName);if("morphTargetInfluences"!==l.propertyName||void 0===l.propertyIndex)n.push(s);else{if(s.createInterpolant!==s.InterpolantFactoryMethodDiscrete&&s.createInterpolant!==s.InterpolantFactoryMethodLinear){if(s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),(s=s.clone()).setInterpolation(r.InterpolateLinear)}var c=u.morphTargetInfluences.length,h=u.morphTargetDictionary[l.propertyIndex];if(void 0===h)throw new Error("THREE.GLTFExporter: Morph target name not found: "+l.propertyIndex);var d=void 0;if(void 0===i[u.uuid]){for(var p=new((d=s.clone()).ValueBufferType)(c*d.times.length),f=0;f<d.times.length;f++)p[f*c+h]=d.values[f];d.name=(l.nodeName||"")+".morphTargetInfluences",d.values=p,i[u.uuid]=d,n.push(d)}else{var m=s.createInterpolant(new s.ValueBufferType(1));d=i[u.uuid];for(var v=0;v<d.times.length;v++)d.values[v*c+h]=m.evaluate(d.times[v]);for(var g=0;g<s.times.length;g++){var y=this.insertKeyframe(d,s.times[g]);d.values[y*c+h]=s.values[g]}}}}return e.tracks=n,e}},function(e,t,r,n){return new(r=r||Promise)((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(o,s)}l((n=n.apply(e,t||[])).next())}))});class ln extends V{constructor(){super(...arguments),this._gltf=new pr,this._originGltf=new zr,this.options=new ar}getArrayBuffer(e=this.runScene.sceneEx.getClear(),t="scene"){return sn(this,void 0,void 0,(function*(){const r=new or({type:t,runScene:this.runScene,model:e});return new Promise((t=>{this._gltf.parse(e,(e=>{t(e)}),{binary:!0,onlyVisible:!1,includeCustomExtensions:!0,myOptions:{helper:r,optionsEx:this.runScene.optionsEx}})}))}))}getOriginArrayBuffer(e){return sn(this,void 0,void 0,(function*(){return new Promise((t=>{this._originGltf.parse(e,(e=>{t(e)}),(()=>{}),{binary:!0,onlyVisible:!1,includeCustomExtensions:!0,animations:[...e.animations]})}))}))}export(e){return sn(this,void 0,void 0,(function*(){var t=yield this.getArrayBuffer(e);(0,$t.downloadFile)(new Blob([t]),"scene.glb")}))}model(e){return sn(this,void 0,void 0,(function*(){var t,r=e||this.runScene.modelEx.select;r&&(t=r.name||r.type,r=yield this.getArrayBuffer(this.runScene.modelEx.clone(r,!1),"model"),(0,$t.downloadFile)(new Blob([r]),t+".glb"))}))}material(e){var t;return sn(this,void 0,void 0,(function*(){var r,n=e||(null==(t=this.runScene.modelEx.select)?void 0:t.material);n&&(n=((r=(0,ft.createDefModel)("Box")).material=n).name||"material",r=yield this.getArrayBuffer(r,"material"),(0,$t.downloadFile)(new Blob([r]),n+".glb"))}))}scene(e=!0){return sn(this,void 0,void 0,(function*(){var t=yield this.getArrayBuffer();return e&&(0,$t.downloadFile)(new Blob([t]),"scene.glb"),t}))}originModel(e){return sn(this,void 0,void 0,(function*(){var t,r;e&&(t=e.name||e.type,r=yield this.getOriginArrayBuffer(e),(0,$t.downloadFile)(new Blob([r]),t+".glb"))}))}}class un extends V{constructor(e){super(e),this.gltf=new ln(e)}}var cn={},hn=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},dn=function(e){return new Worker(e)};try{URL.revokeObjectURL(hn(""))}catch(Mn){hn=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)},dn=function(e){return new Worker(e,{type:"module"})}}for(var pn=Uint8Array,fn=Uint16Array,mn=Uint32Array,vn=new pn([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),gn=new pn([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),yn=new pn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),bn=(gr=function(e,t){for(var r=new fn(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];var i=new mn(r[30]);for(n=1;n<30;++n)for(var a=r[n];a<r[n+1];++a)i[a]=a-r[n]<<5|n;return[r,i]},(j=gr(vn,2))[0]),xn=j[1],wn=(bn[28]=258,xn[258]=28,xr=gr(gn,0))[0],An=xr[1],Sn=new fn(32768),Mn=0;Mn<32768;++Mn){var Bn=(43690&Mn)>>>1|(21845&Mn)<<1;Sn[Mn]=((65280&(Bn=(61680&(Bn=(52428&Bn)>>>2|(13107&Bn)<<2))>>>4|(3855&Bn)<<4))>>>8|(255&Bn)<<8)>>>1}var Cn=function(e,t,r){for(var n=e.length,i=0,a=new fn(t);i<n;++i)++a[e[i]-1];var o=new fn(t);for(i=0;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;if(r){var s=new fn(1<<t),l=15-t;for(i=0;i<n;++i)if(e[i])for(var u=i<<4|e[i],c=t-e[i],h=o[e[i]-1]++<<c,d=h|(1<<c)-1;h<=d;++h)s[Sn[h]>>>l]=u}else for(s=new fn(n),i=0;i<n;++i)e[i]&&(s[i]=Sn[o[e[i]-1]++]>>>15-e[i]);return s},_n=new pn(288);for(Mn=0;Mn<144;++Mn)_n[Mn]=8;for(Mn=144;Mn<256;++Mn)_n[Mn]=9;for(Mn=256;Mn<280;++Mn)_n[Mn]=7;for(Mn=280;Mn<288;++Mn)_n[Mn]=8;var En=new pn(32);for(Mn=0;Mn<32;++Mn)En[Mn]=5;function Tn(e){return e.ondata=function(e,t){return postMessage([e,t],[e.buffer])},function(t){return e.push(t.data[0],t.data[1])}}function Dn(e,t,r,n,i){var a,o=oi(e,n,i,(function(e,r){e?(o.terminate(),t.ondata.call(t,e)):(r[1]&&o.terminate(),t.ondata.call(t,e,r[0],r[1]))}));o.postMessage(r),t.push=function(e,r){if(a)throw"stream finished";if(!t.ondata)throw"no stream handler";o.postMessage([e,a=r],[e.buffer])},t.terminate=function(){o.terminate()}}function Pn(e,t){return gi(e,t)+4294967296*gi(e,t+4)}var On=Cn(_n,9,0),Rn=Cn(_n,9,1),In=Cn(En,5,0),kn=Cn(En,5,1),Ln=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},Fn=function(e,t,r){var n=t/8|0;return(e[n]|e[1+n]<<8)>>(7&t)&r},Un=function(e,t){var r=t/8|0;return(e[r]|e[1+r]<<8|e[2+r]<<16)>>(7&t)},Gn=function(e){return(e/8|0)+(7&e&&1)},jn=function(e,t,r){(null==t||t<0)&&(t=0),(null==r||r>e.length)&&(r=e.length);var n=new(e instanceof fn?fn:e instanceof mn?mn:pn)(r-t);return n.set(e.subarray(t,r)),n},Nn=function(e,t,r){var n=e.length;if(!n||r&&!r.l&&n<5)return t||new pn(0);function i(e){var r=t.length;r<e&&((r=new pn(Math.max(2*r,e))).set(t),t=r)}var a=!t||r,o=!r||r.i,s=(r=r||{},t=t||new pn(3*n),r.f||0),l=r.p||0,u=r.b||0,c=r.l,h=r.d,d=r.m,p=r.n,f=8*n;do{if(!c){r.f=s=Fn(e,l,1);var m=Fn(e,l+1,3);if(l+=3,!m){var v=e[(B=Gn(l)+4)-4]|e[B-3]<<8;if(n<(A=B+v)){if(o)throw"unexpected EOF";break}a&&i(u+v),t.set(e.subarray(B,A),u),r.b=u+=v,r.p=l=8*A;continue}if(1==m)c=Rn,h=kn,d=9,p=5;else{if(2!=m)throw"invalid block type";v=Fn(e,l,31)+257;for(var g=Fn(e,l+10,15)+4,y=v+Fn(e,l+5,31)+1,b=(l+=14,new pn(y)),x=new pn(19),w=0;w<g;++w)x[yn[w]]=Fn(e,l+3*w,7);l+=3*g;var A,S=(1<<(A=Ln(x)))-1,M=Cn(x,A,1);for(w=0;w<y;){var B,C=M[Fn(e,l,S)];if(l+=15&C,(B=C>>>4)<16)b[w++]=B;else{var _=0,E=0;for(16==B?(E=3+Fn(e,l,3),l+=2,_=b[w-1]):17==B?(E=3+Fn(e,l,7),l+=3):18==B&&(E=11+Fn(e,l,127),l+=7);E--;)b[w++]=_}}m=b.subarray(0,v);var T=b.subarray(v);d=Ln(m),p=Ln(T),c=Cn(m,d,1),h=Cn(T,p,1)}if(f<l){if(o)throw"unexpected EOF";break}}a&&i(u+131072);for(var D=(1<<d)-1,P=(1<<p)-1,O=l;;O=l){var R=(_=c[Un(e,l)&D])>>>4;if(f<(l+=15&_)){if(o)throw"unexpected EOF";break}if(!_)throw"invalid length/literal";if(R<256)t[u++]=R;else{if(256==R){O=l,c=null;break}var I,k=R-254,L=(264<R&&(I=vn[w=R-257],k=Fn(e,l,(1<<I)-1)+bn[w],l+=I),(R=h[Un(e,l)&P])>>>4);if(!R)throw"invalid distance";if(l+=15&R,T=wn[L],3<L&&(I=gn[L],T+=Un(e,l)&(1<<I)-1,l+=I),f<l){if(o)throw"unexpected EOF";break}a&&i(u+131072);for(var F=u+k;u<F;u+=4)t[u]=t[u-T],t[u+1]=t[u+1-T],t[u+2]=t[u+2-T],t[u+3]=t[u+3-T];u=F}}r.l=c,r.p=O,r.b=u,c&&(s=1,r.m=d,r.d=h,r.n=p)}while(!s);return u==t.length?t:jn(t,0,u)},Hn=function(e,t,r){var n=t/8|0;e[n]|=r<<=7&t,e[1+n]|=r>>>8},zn=function(e,t,r){var n=t/8|0;e[n]|=r<<=7&t,e[1+n]|=r>>>8,e[2+n]|=r>>>16},Vn=function(e,t){for(var r=[],n=0;n<e.length;++n)e[n]&&r.push({s:n,f:e[n]});var i=r.length,a=r.slice();if(!i)return[Yn,0];if(1==i)return(m=new pn(r[0].s+1))[r[0].s]=1,[m,1];r.sort((function(e,t){return e.f-t.f})),r.push({s:-1,f:25001});var o=r[0],s=r[1],l=0,u=1,c=2;for(r[0]={s:-1,f:o.f+s.f,l:o,r:s};u!=i-1;)o=r[r[l].f<r[c].f?l++:c++],s=r[l!=u&&r[l].f<r[c].f?l++:c++],r[u++]={s:-1,f:o.f+s.f,l:o,r:s};var h=a[0].s;for(n=1;n<i;++n)a[n].s>h&&(h=a[n].s);var d=new fn(h+1),p=Jn(r[u-1],d,0);if(t<p){n=0;var f=0,m=p-t,v=1<<m;for(a.sort((function(e,t){return d[t.s]-d[e.s]||e.f-t.f}));n<i;++n){var g=a[n].s;if(!(d[g]>t))break;f+=v-(1<<p-d[g]),d[g]=t}for(f>>>=m;0<f;){var y=a[n].s;d[y]<t?f-=1<<t-d[y]++-1:++n}for(;0<=n&&f;--n){var b=a[n].s;d[b]==t&&(--d[b],++f)}p=t}return[new pn(d),p]},Jn=function e(t,r,n){return-1==t.s?Math.max(e(t.l,r,n+1),e(t.r,r,n+1)):r[t.s]=n},Kn=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new fn(++t),n=0,i=e[0],a=1,o=function(e){r[n++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&2<a){for(;138<a;a-=138)o(32754);2<a&&(o(10<a?a-11<<5|28690:a-3<<5|12305),a=0)}else if(3<a){for(o(i),--a;6<a;a-=6)o(8304);2<a&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return[r.subarray(0,n),t]},Wn=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},Qn=function(e,t,r){var n=r.length,i=Gn(t+2);e[i]=255&n,e[i+1]=n>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var a=0;a<n;++a)e[i+a+4]=r[a];return 8*(i+4+n)},Xn=function(e,t,r,n,i,a,o,s,l,u,c){Hn(t,c++,r),++i[256];for(var h=(r=Vn(i,15))[0],d=(r=r[1],(p=Vn(a,15))[0]),p=p[1],f=(m=Kn(h))[0],m=m[1],v=(g=Kn(d))[0],g=g[1],y=new fn(19),b=0;b<f.length;++b)y[31&f[b]]++;for(b=0;b<v.length;++b)y[31&v[b]]++;for(var x=(w=Vn(y,7))[0],w=w[1],A=19;4<A&&!x[yn[A-1]];--A);var S,M=u+5<<3,B=Wn(i,_n)+Wn(a,En)+o;if(i=Wn(i,h)+Wn(a,d)+o+14+3*A+Wn(y,x)+(2*y[16]+3*y[17]+7*y[18]),M<=B&&M<=i)return Qn(t,c,e.subarray(l,l+u));if(Hn(t,c,1+(i<B)),c+=2,i<B){var C=Cn(h,r,0),_=h,E=Cn(d,p,0),T=d,D=Cn(x,w,0);for(Hn(t,c,m-257),Hn(t,c+5,g-1),Hn(t,c+10,A-4),c+=14,b=0;b<A;++b)Hn(t,c+3*b,x[yn[b]]);c+=3*A;for(var P=[f,v],O=0;O<2;++O){var R=P[O];for(b=0;b<R.length;++b){var I=31&R[b];Hn(t,c,D[I]),c+=x[I],15<I&&(Hn(t,c,R[b]>>>5&127),c+=R[b]>>>12)}}}else C=On,_=_n,E=In,T=En;for(b=0;b<s;++b)255<n[b]?(I=n[b]>>>18&31,zn(t,c,C[I+257]),c+=_[I+257],7<I&&(Hn(t,c,n[b]>>>23&31),c+=vn[I]),S=31&n[b],zn(t,c,E[S]),c+=T[S],3<S&&(zn(t,c,n[b]>>>5&8191),c+=gn[S])):(zn(t,c,C[n[b]]),c+=_[n[b]]);return zn(t,c,C[256]),c+_[256]},Zn=new mn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Yn=new pn(0),qn=function(e,t,r,n,i,a){var o=e.length,s=new pn(n+o+5*(1+Math.ceil(o/7e3))+i),l=s.subarray(n,s.length-i),u=0;if(!t||o<8)for(var c=0;c<=o;c+=65535){var h=c+65535;u=h<o?Qn(l,u,e.subarray(c,h)):(l[c]=a,Qn(l,u,e.subarray(c,o)))}else{for(var d=(t=Zn[t-1])>>>13,p=8191&t,f=(1<<r)-1,m=new fn(32768),v=new fn(1+f),g=Math.ceil(r/3),y=2*g,b=function(t){return(e[t]^e[t+1]<<g^e[t+2]<<y)&f},x=new mn(25e3),w=new fn(288),A=new fn(32),S=0,M=0,B=(c=0,0),C=0,_=0;c<o;++c){var E=b(c),T=32767&c,D=v[E];if(m[T]=D,v[E]=T,C<=c){var P=o-c;if((7e3<S||24576<B)&&423<P){u=Xn(e,l,0,x,w,A,M,B,_,c-_,u),B=S=M=0,_=c;for(var O=0;O<286;++O)w[O]=0;for(O=0;O<30;++O)A[O]=0}var R=2,I=0,k=p,L=T-D&32767;if(2<P&&E==b(c-L))for(var F=Math.min(d,P)-1,U=Math.min(32767,c),G=Math.min(258,P);L<=U&&--k&&T!=D;){if(e[c+R]==e[c+R-L]){for(var j=0;j<G&&e[c+j]==e[c+j-L];++j);if(R<j){if(I=L,F<(R=j))break;var N=Math.min(L,j-2),H=0;for(O=0;O<N;++O){var z=c-L+O+32768&32767,V=z-m[z]+32768&32767;H<V&&(H=V,D=z)}}}L+=(T=D)-(D=m[T])+32768&32767}I?(x[B++]=268435456|xn[R]<<18|An[I],E=31&xn[R],P=31&An[I],M+=vn[E]+gn[P],++w[257+E],++A[P],C=c+R,++S):(x[B++]=e[c],++w[e[c]])}}u=Xn(e,l,a,x,w,A,M,B,_,c-_,u),!a&&7&u&&(u=Qn(l,u+1,Yn))}return jn(s,0,n+Gn(u)+i)},$n=function(){for(var e=new mn(256),t=0;t<256;++t){for(var r=t,n=9;--n;)r=(1&r&&3988292384)^r>>>1;e[t]=r}return e}(),ei=function(){var e=-1;return{p:function(t){for(var r=e,n=0;n<t.length;++n)r=$n[255&r^t[n]]^r>>>8;e=r},d:function(){return~e}}},ti=function(){var e=1,t=0;return{p:function(r){for(var n=e,i=t,a=r.length,o=0;o!=a;){for(var s=Math.min(o+2655,a);o<s;++o)i+=n+=r[o];n=(65535&n)+15*(n>>16),i=(65535&i)+15*(i>>16)}e=n,t=i},d:function(){return(255&(e%=65521))<<24|e>>>8<<16|(255&(t%=65521))<<8|t>>>8}}},ri=function(e,t,r,n,i){return qn(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,r,n,!i)},ni=function(e,t){var r,n={};for(r in e)n[r]=e[r];for(r in t)n[r]=t[r];return n},ii=function(e,t,r){for(var n=e(),i=(e=e.toString()).slice(e.indexOf("[")+1,e.lastIndexOf("]")).replace(/ /g,"").split(","),a=0;a<n.length;++a){var o=n[a],s=i[a];if("function"==typeof o){t+=";"+s+"=";var l=o.toString();if(o.prototype)if(-1!=l.indexOf("[native code]")){var u=l.indexOf(" ",8)+1;t+=l.slice(u,l.indexOf("(",u))}else for(var c in t+=l,o.prototype)t+=";"+s+".prototype."+c+"="+o.prototype[c].toString();else t+=l}else r[s]=o}return[t,r]},ai=[],oi=function(e,t,r,n){var i;if(!ai[r]){for(var a="",o={},s=e.length-1,l=0;l<s;++l)a=(i=ii(e[l],a,o))[0],o=i[1];ai[r]=ii(e[s],a,o)}var u=ni({},ai[r][1]);return function(e,t,r,n,i){return(t=dn(cn[t]||(cn[t]=hn(e)))).onerror=function(e){return i(e.error,null)},t.onmessage=function(e){return i(null,e.data)},t.postMessage(r,n),t}(ai[r][0]+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",r,u,function(e){var t,r=[];for(t in e)(e[t]instanceof pn||e[t]instanceof fn||e[t]instanceof mn)&&r.push((e[t]=new e[t].constructor(e[t])).buffer);return r}(u),n)},si=function(){return[pn,fn,mn,vn,gn,yn,bn,wn,Rn,kn,Sn,Cn,Ln,Fn,Un,Gn,jn,Nn,Ri,pi,fi]},li=function(){return[pn,fn,mn,vn,gn,yn,xn,An,On,_n,In,En,Sn,Zn,Yn,Cn,Hn,zn,Vn,Jn,Kn,Wn,Qn,Xn,Gn,jn,qn,ri,Ti,pi]},ui=function(){return[bi,Ai,yi,ei,$n]},ci=function(){return[xi,wi]},hi=function(){return[Si,yi,ti]},di=function(){return[Mi]},pi=function(e){return postMessage(e,[e.buffer])},fi=function(e){return e&&e.size&&new pn(e.size)},mi=function(e,t,r,n,i,a){var o=oi(r,n,i,(function(e,t){o.terminate(),a(e,t)}));return o.postMessage([e,t],t.consume?[e.buffer]:[]),function(){o.terminate()}},vi=function(e,t){return e[t]|e[t+1]<<8},gi=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},yi=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},bi=function(e,t){var r=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&yi(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),r){e[3]=8;for(var n=0;n<=r.length;++n)e[n+10]=r.charCodeAt(n)}},xi=function(e){if(31!=e[0]||139!=e[1]||8!=e[2])throw"invalid gzip data";var t=e[3],r=10;4&t&&(r+=e[10]|2+(e[11]<<8));for(var n=(t>>3&1)+(t>>4&1);0<n;n-=!e[r++]);return r+(2&t)},wi=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},Ai=function(e){return 10+(e.filename&&e.filename.length+1||0)},Si=function(e,t){t=0==(t=t.level)?0:t<6?1:9==t?3:2,e[0]=120,e[1]=t<<6|(t?32-2*t:1)},Mi=function(e){if(8!=(15&e[0])||7<e[0]>>>4||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"};function Bi(e,t){return t||"function"!=typeof e||(t=e,e={}),this.ondata=t,e}var Ci=function(){function e(e,t){t||"function"!=typeof e||(t=e,e={}),this.ondata=t,this.o=e||{}}return e.prototype.p=function(e,t){this.ondata(ri(e,this.o,0,0,!t),t)},e.prototype.push=function(e,t){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";this.d=t,this.p(e,t||!1)},e}(),_i=function(e,t){Dn([li,function(){return[Tn,Ci]}],this,Bi.call(this,e,t),(function(e){e=new Ci(e.data),onmessage=Tn(e)}),6)};function Ei(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return mi(e,t,[li],(function(e){return pi(Ti(e.data[0],e.data[1]))}),0,r)}function Ti(e,t){return ri(e,t||{},0,0)}var Di=function(){function e(e){this.s={},this.p=new pn(0),this.ondata=e}return e.prototype.e=function(e){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";var t=this.p.length,r=new pn(t+e.length);r.set(this.p),r.set(e,t),this.p=r},e.prototype.c=function(e){this.d=this.s.i=e||!1,e=this.s.b;var t=Nn(this.p,this.o,this.s);this.ondata(jn(t,e,this.s.b),this.d),this.o=jn(t,this.s.b-32768),this.s.b=this.o.length,this.p=jn(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),Pi=function(e){this.ondata=e,Dn([si,function(){return[Tn,Di]}],this,0,(function(){var e=new Di;onmessage=Tn(e)}),7)};function Oi(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return mi(e,t,[si],(function(e){return pi(Ri(e.data[0],fi(e.data[1])))}),1,r)}function Ri(e,t){return Nn(e,t)}var Ii=function(){function e(e,t){this.c=ei(),this.l=0,this.v=1,Ci.call(this,e,t)}return e.prototype.push=function(e,t){Ci.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),this.l+=e.length,e=ri(e,this.o,this.v&&Ai(this.o),t&&8,!t),this.v&&(bi(e,this.o),this.v=0),t&&(yi(e,e.length-8,this.c.d()),yi(e,e.length-4,this.l)),this.ondata(e,t)},e}(),ki=function(e,t){Dn([li,ui,function(){return[Tn,Ci,Ii]}],this,Bi.call(this,e,t),(function(e){e=new Ii(e.data),onmessage=Tn(e)}),8)};function Li(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return mi(e,t,[li,ui,function(){return[Fi]}],(function(e){return pi(Fi(e.data[0],e.data[1]))}),2,r)}function Fi(e,t){t=t||{};var r=ei(),n=e.length,i=(r.p(e),e=ri(e,t,Ai(t),8)).length;return bi(e,t),yi(e,i-8,r.d()),yi(e,i-4,n),e}var Ui=function(){function e(e){this.v=1,Di.call(this,e)}return e.prototype.push=function(e,t){if(Di.prototype.e.call(this,e),this.v){if((e=3<this.p.length?xi(this.p):4)>=this.p.length&&!t)return;this.p=this.p.subarray(e),this.v=0}if(t){if(this.p.length<8)throw"invalid gzip stream";this.p=this.p.subarray(0,-8)}Di.prototype.c.call(this,t)},e}(),Gi=function(e){this.ondata=e,Dn([si,ci,function(){return[Tn,Di,Ui]}],this,0,(function(){var e=new Ui;onmessage=Tn(e)}),9)};function ji(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return mi(e,t,[si,ci,function(){return[Ni]}],(function(e){return pi(Ni(e.data[0]))}),3,r)}function Ni(e,t){return Nn(e.subarray(xi(e),-8),t||new pn(wi(e)))}var Hi=function(){function e(e,t){this.c=ti(),this.v=1,Ci.call(this,e,t)}return e.prototype.push=function(e,t){Ci.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),e=ri(e,this.o,this.v&&2,t&&4,!t),this.v&&(Si(e,this.o),this.v=0),t&&yi(e,e.length-4,this.c.d()),this.ondata(e,t)},e}(),zi=function(e,t){Dn([li,hi,function(){return[Tn,Ci,Hi]}],this,Bi.call(this,e,t),(function(e){e=new Hi(e.data),onmessage=Tn(e)}),10)};function Vi(e,t){t=t||{};var r=ti();return r.p(e),e=ri(e,t,2,4),Si(e,t),yi(e,e.length-4,r.d()),e}var Ji=function(){function e(e){this.v=1,Di.call(this,e)}return e.prototype.push=function(e,t){if(Di.prototype.e.call(this,e),this.v){if(this.p.length<2&&!t)return;this.p=this.p.subarray(2),this.v=0}if(t){if(this.p.length<4)throw"invalid zlib stream";this.p=this.p.subarray(0,-4)}Di.prototype.c.call(this,t)},e}(),Ki=function(e){this.ondata=e,Dn([si,di,function(){return[Tn,Di,Ji]}],this,0,(function(){var e=new Ji;onmessage=Tn(e)}),11)};function Wi(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return mi(e,t,[si,di,function(){return[Qi]}],(function(e){return pi(Qi(e.data[0],fi(e.data[1])))}),5,r)}function Qi(e,t){return Nn((Mi(e),e.subarray(2,-4)),t)}var Xi=function(){function e(e){this.G=Ui,this.I=Di,this.Z=Ji,this.ondata=e}return e.prototype.push=function(e,t){if(!this.ondata)throw"no stream handler";var r,n;this.s?this.s.push(e,t):(this.p&&this.p.length?((r=new pn(this.p.length+e.length)).set(this.p),r.set(e,this.p.length)):this.p=e,2<this.p.length&&((n=this).s=new(31==this.p[0]&&139==this.p[1]&&8==this.p[2]?this.G:8!=(15&this.p[0])||7<this.p[0]>>4||(this.p[0]<<8|this.p[1])%31?this.I:this.Z)((function(){n.ondata.apply(n,arguments)})),this.s.push(this.p,t),this.p=null))},e}(),Zi=function(){function e(e){this.G=Gi,this.I=Pi,this.Z=Ki,this.ondata=e}return e.prototype.push=function(e,t){Xi.prototype.push.call(this,e,t)},e}(),Yi=function e(t,r,n,i){for(var a in t){var o=t[a];a=r+a,o instanceof pn?n[a]=[o,i]:Array.isArray(o)?n[a]=[o[0],ni(i,o[1])]:e(o,a+"/",n,i)}},qi="undefined"!=typeof TextEncoder&&new TextEncoder,$i="undefined"!=typeof TextDecoder&&new TextDecoder,ea=0;try{$i.decode(Yn,{stream:!0}),ea=1}catch(Mn){}var ta=function(e){for(var t="",r=0;;){var n=e[r++],i=(127<n)+(223<n)+(239<n);if(r+i>e.length)return[t,jn(e,r-1)];i?3==i?(n=((15&n)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536,t+=String.fromCharCode(55296|n>>10,56320|1023&n)):t+=1&i?String.fromCharCode((31&n)<<6|63&e[r++]):String.fromCharCode((15&n)<<12|(63&e[r++])<<6|63&e[r++]):t+=String.fromCharCode(n)}},ra=function(){function e(e){this.ondata=e,ea?this.t=new TextDecoder:this.p=Yn}return e.prototype.push=function(e,t){if(!this.ondata)throw"no callback";if(t=!!t,this.t){if(this.ondata(this.t.decode(e,{stream:!0}),t),t){if(this.t.decode().length)throw"invalid utf-8 data";this.t=null}}else{if(!this.p)throw"stream finished";var r=((r=new pn(this.p.length+e.length)).set(this.p),r.set(e,this.p.length),e=ta(r))[0];if(e=e[1],t){if(e.length)throw"invalid utf-8 data";this.p=null}else this.p=e;this.ondata(r,t)}},e}(),na=function(){function e(e){this.ondata=e}return e.prototype.push=function(e,t){if(!this.ondata)throw"no callback";if(this.d)throw"stream finished";this.ondata(ia(e),this.d=t||!1)},e}();function ia(e,t){if(t){for(var r=new pn(e.length),n=0;n<e.length;++n)r[n]=e.charCodeAt(n);return r}if(qi)return qi.encode(e);var i=e.length,a=new pn(e.length+(e.length>>1)),o=0,s=function(e){a[o++]=e};for(n=0;n<i;++n){o+5>a.length&&((l=new pn(o+8+(i-n<<1))).set(a),a=l);var l=e.charCodeAt(n);l<128||t?s(l):(l<2048?s(192|l>>6):(55295<l&&l<57344?(s(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++n))>>18),s(128|l>>12&63)):s(224|l>>12),s(128|l>>6&63)),s(128|63&l))}return jn(a,0,o)}function aa(e,t){if(t){for(var r="",n=0;n<e.length;n+=16384)r+=String.fromCharCode.apply(null,e.subarray(n,n+16384));return r}if($i)return $i.decode(e);var i=(t=ta(e))[0];if(t[1].length)throw"invalid utf-8 data";return i}function oa(e){return 1==e?3:e<6?2:9==e?1:0}var sa=function(e,t){return t+30+vi(e,t+26)+vi(e,t+28)},la=function(e,t,r){var n=vi(e,t+28),i=aa(e.subarray(t+46,t+46+n),!(2048&vi(e,t+8))),a=(n=t+46+n,gi(e,t+20)),o=(a=(r=r&&4294967295==a?ua(e,n):[a,gi(e,t+24),gi(e,t+42)])[0],r[1]);return r=r[2],[vi(e,t+10),a,o,i,n+vi(e,t+30)+vi(e,t+32),r]},ua=function(e,t){for(;1!=vi(e,t);t+=4+vi(e,t+2));return[Pn(e,t+12),Pn(e,t+4),Pn(e,t+20)]},ca=function(e){var t=0;if(e)for(var r in e){if(65535<(r=e[r].length))throw"extra field too long";t+=r+4}return t},ha=function(e,t,r,n,i,a,o,s){var l=n.length,u=r.extra,c=s&&s.length,h=ca(u),d=(yi(e,t,null!=o?33639248:67324752),t+=4,null!=o&&(e[t++]=20,e[t++]=r.os),e[t]=20,t+=2,e[t++]=r.flag<<1|(null==a&&8),e[t++]=i&&8,e[t++]=255&r.compression,e[t++]=r.compression>>8,i=new Date(null==r.mtime?Date.now():r.mtime)).getFullYear()-1980;if(d<0||119<d)throw"date not in range 1980-2099";if(yi(e,t,d<<25|i.getMonth()+1<<21|i.getDate()<<16|i.getHours()<<11|i.getMinutes()<<5|i.getSeconds()>>>1),t+=4,null!=a&&(yi(e,t,r.crc),yi(e,t+4,a),yi(e,t+8,r.size)),yi(e,t+12,l),yi(e,t+14,h),t+=16,null!=o&&(yi(e,t,c),yi(e,t+6,r.attrs),yi(e,t+10,o),t+=14),e.set(n,t),t+=l,h)for(var p in u){var f=u[p],m=f.length;yi(e,t,+p),yi(e,t+2,m),e.set(f,t+4),t+=4+m}return c&&(e.set(s,t),t+=c),t},da=function(e,t,r,n,i){yi(e,t,101010256),yi(e,t+8,r),yi(e,t+10,r),yi(e,t+12,n),yi(e,t+16,i)},pa=function(){function e(e){this.filename=e,this.c=ei(),this.size=0,this.compression=0}return e.prototype.process=function(e,t){this.ondata(null,e,t)},e.prototype.push=function(e,t){if(!this.ondata)throw"no callback - add to ZIP archive before pushing";this.c.p(e),this.size+=e.length,t&&(this.crc=this.c.d()),this.process(e,t||!1)},e}(),fa=function(){function e(e,t){var r=this;t=t||{},pa.call(this,e),this.d=new Ci(t,(function(e,t){r.ondata(null,e,t)})),this.compression=8,this.flag=oa(t.level)}return e.prototype.process=function(e,t){try{this.d.push(e,t)}catch(e){this.ondata(e,null,t)}},e.prototype.push=function(e,t){pa.prototype.push.call(this,e,t)},e}(),ma=function(){function e(e,t){var r=this;t=t||{},pa.call(this,e),this.d=new _i(t,(function(e,t,n){r.ondata(e,t,n)})),this.compression=8,this.flag=oa(t.level),this.terminate=this.d.terminate}return e.prototype.process=function(e,t){this.d.push(e,t)},e.prototype.push=function(e,t){pa.prototype.push.call(this,e,t)},e}(),va=function(){function e(e){this.ondata=e,this.u=[],this.d=1}return e.prototype.add=function(e){var t=this;if(2&this.d)throw"stream finished";var r=ia(e.filename),n=r.length,i=(a=e.comment)&&ia(a),a=n!=e.filename.length||i&&a.length!=i.length,o=n+ca(e.extra)+30;if(65535<n)throw"filename too long";function s(){for(var e=0,r=l;e<r.length;e++){var n=r[e];t.ondata(null,n,!1)}l=[]}n=new pn(o);var l=(ha(n,0,e,r,a),[n]),u=this.d,c=(this.d=0,this.u.length),h=ni(e,{f:r,u:a,o:i,t:function(){e.terminate&&e.terminate()},r:function(){var e;s(),u&&((e=t.u[c+1])?e.r():t.d=1),u=1}}),d=0;e.ondata=function(r,n,i){r?(t.ondata(r,n,i),t.terminate()):(d+=n.length,l.push(n),i?(r=new pn(16),yi(r,0,134695760),yi(r,4,e.crc),yi(r,8,d),yi(r,12,e.size),l.push(r),h.c=d,h.b=o+d+16,h.crc=e.crc,h.size=e.size,u&&h.r(),u=1):u&&s())},this.u.push(h)},e.prototype.end=function(){var e=this;if(2&this.d){if(1&this.d)throw"stream finishing";throw"stream finished"}this.d?this.e():this.u.push({r:function(){1&e.d&&(e.u.splice(-1,1),e.e())},t:function(){}}),this.d=3},e.prototype.e=function(){for(var e=0,t=0,r=0,n=0,i=this.u;n<i.length;n++)r+=46+(l=i[n]).f.length+ca(l.extra)+(l.o?l.o.length:0);for(var a=new pn(r+22),o=0,s=this.u;o<s.length;o++){var l=s[o];ha(a,e,l,l.f,l.u,l.c,t,l.o),e+=46+l.f.length+ca(l.extra)+(l.o?l.o.length:0),t+=l.b}da(a,e,this.u.length,r,t),this.ondata(null,a,!0),this.d=2},e.prototype.terminate=function(){for(var e=0,t=this.u;e<t.length;e++)t[e].t();this.d=2},e}(),ga=function(){function e(){}return e.prototype.push=function(e,t){this.ondata(null,e,t)},e.compression=0,e}(),ya=function(){function e(){var e=this;this.i=new Di((function(t,r){e.ondata(null,t,r)}))}return e.prototype.push=function(e,t){try{this.i.push(e,t)}catch(r){this.ondata(r,e,t)}},e.compression=8,e}(),ba=function(){function e(e,t){var r=this;t<32e4?this.i=new Di((function(e,t){r.ondata(null,e,t)})):(this.i=new Pi((function(e,t,n){r.ondata(e,t,n)})),this.terminate=this.i.terminate)}return e.prototype.push=function(e,t){this.i.terminate&&(e=jn(e,0)),this.i.push(e,t)},e.compression=8,e}(),xa=function(){function e(e){this.onfile=e,this.k=[],this.o={0:ga},this.p=Yn}return e.prototype.push=function(e,t){var r=this;if(!this.onfile)throw"no callback";if(!this.p)throw"stream finished";if(0<this.c){var n=Math.min(this.c,e.length),i=e.subarray(0,n);if(this.c-=n,this.d?this.d.push(i,!this.c):this.k[0].push(i),(e=e.subarray(n)).length)return this.push(e,t)}else{for(var a=0,o=0,s=void 0,l=void 0,u=(this.p.length?e.length?((l=new pn(this.p.length+e.length)).set(this.p),l.set(e,this.p.length)):l=this.p:l=e,l.length),c=this.c,h=(i=c&&this.d,this);o<u-4&&"break"!==function(){var e,t,n,i,d,p,f,m,v,g,y,b=gi(l,o);return 67324752==b?(a=1,s=o,h.d=null,h.c=0,n=vi(l,o+6),e=vi(l,o+8),t=2048&n,n&=8,i=vi(l,o+26),d=vi(l,o+28),o+30+i+d<u&&(h.k.unshift(p=[]),a=2,f=gi(l,o+18),m=gi(l,o+22),v=aa(l.subarray(o+30,o+=30+i),!t),4294967295==f?(i=n?[-2]:ua(l,o),f=i[0],m=i[1]):n&&(f=-1),o+=d,h.c=f,y={name:v,compression:e,start:function(){if(!y.ondata)throw"no callback";if(f){var t=r.o[e];if(!t)throw"unknown compression type "+e;(g=f<0?new t(v):new t(v,f,m)).ondata=function(e,t,r){y.ondata(e,t,r)};for(var n=0,i=p;n<i.length;n++)g.push(i[n],!1);r.k[0]==p&&r.c?r.d=g:g.push(Yn,!0)}else y.ondata(null,Yn,!0)},terminate:function(){g&&g.terminate&&g.terminate()}},0<=f&&(y.size=f,y.originalSize=m),h.onfile(y)),"break"):c?134695760==b?(s=o+=12+(-2==c&&8),a=3,h.c=0,"break"):33639248==b?(s=o-=4,a=3,h.c=0,"break"):void 0:void 0}();++o);if(this.p=Yn,c<0&&(n=a?l.subarray(0,s-12-(-2==c&&8)-(134695760==gi(l,s-16)&&4)):l.subarray(0,o),i?i.push(n,!!a):this.k[+(2==a)].push(n)),2&a)return this.push(l.subarray(o),t);this.p=l.subarray(o)}if(t){if(this.c)throw"invalid zip file";this.p=null}},e.prototype.register=function(e){this.o[e.compression]=e},e}();function wa(e,t,r){var n=r.length-e-1;if(t>=r[n])return n-1;if(t<=r[e])return e;for(var i=e,a=n,o=Math.floor((i+a)/2);t<r[o]||t>=r[o+1];)t<r[o]?a=o:i=o,o=Math.floor((i+a)/2);return o}function Aa(e,t,r,n){for(var i=[],a=[],o=[],s=i[0]=1;s<=r;++s){a[s]=t-n[e+1-s],o[s]=n[e+s]-t;for(var l=0,u=0;u<s;++u){var c=o[u+1],h=a[s-u],d=i[u]/(c+h);i[u]=l+c*d,l=h*d}i[s]=l}return i}function Sa(e,t,n,i,a){for(var o=a<e?a:e,s=[],l=wa(e,i,t),u=function(e,t,r,n,i){for(var a=[],o=0;o<=r;++o)a[o]=0;for(var s=[],l=0;l<=n;++l)s[l]=a.slice(0);for(var u=[],c=0;c<=r;++c)u[c]=a.slice(0);u[0][0]=1;for(var h=a.slice(0),d=a.slice(0),p=1;p<=r;++p){h[p]=t-i[e+1-p],d[p]=i[e+p]-t;for(var f=0,m=0;m<p;++m){var v=d[m+1],g=h[p-m],y=(u[p][m]=v+g,u[m][p-1]/u[p][m]);u[m][p]=f+v*y,f=g*y}u[p][p]=f}for(var b=0;b<=r;++b)s[0][b]=u[b][r];for(var x=0;x<=r;++x){for(var w=0,A=1,S=[],M=0;M<=r;++M)S[M]=a.slice(0);for(var B=S[0][0]=1;B<=n;++B){var C=0,_=x-B,E=r-B;B<=x&&(S[A][0]=S[w][0]/u[1+E][_],C=S[A][0]*u[_][E]);for(var T=x-1<=E?B-1:r-x,D=-1<=_?1:-_;D<=T;++D)S[A][D]=(S[w][D]-S[w][D-1])/u[1+E][_+D],C+=S[A][D]*u[_+D][E];x<=E&&(S[A][B]=-S[w][B-1]/u[1+E][x],C+=S[A][B]*u[x][E]),s[B][x]=C;var P=w;w=A,A=P}}for(var O=r,R=1;R<=n;++R){for(var I=0;I<=r;++I)s[R][I]*=O;O*=r-R}return s}(l,i,e,o,t),c=[],h=0;h<n.length;++h){var d=n[h].clone(),p=d.w;d.x*=p,d.y*=p,d.z*=p,c[h]=d}for(var f=0;f<=o;++f){for(var m=c[l-e].clone().multiplyScalar(u[f][0]),v=1;v<=e;++v)m.add(c[l-e+v].clone().multiplyScalar(u[f][v]));s[f]=m}for(var g=o+1;g<=a+1;++g)s[g]=new r.Vector4(0,0,0);return s}function Ma(e){for(var t=e.length,n=[],i=[],a=0;a<t;++a){var o=e[a];n[a]=new r.Vector3(o.x,o.y,o.z),i[a]=o.w}for(var s=[],l=0;l<t;++l){for(var u=n[l].clone(),c=1;c<=l;++c)u.sub(s[l-c].clone().multiplyScalar(function(e,t){for(var r=1,n=2;n<=e;++n)r*=n;for(var i=1,a=2;a<=t;++a)i*=a;for(var o=2;o<=e-t;++o)i*=o;return r/i}(l,c)*i[c]));s[l]=u.divideScalar(i[0])}return s}function Ba(e){return(Ba="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ca(e,t){return(Ca=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function _a(e){return(_a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ea,Ta,Da,Pa=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ca(t,e);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=_a(e);if(r=t?(r=_a(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Ba(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e,t,a,o,s){var l;if(!(this instanceof i))throw new TypeError("Cannot call a class as a function");(l=n.call(this)).degree=e,l.knots=t,l.controlPoints=[],l.startKnot=o||0,l.endKnot=s||l.knots.length-1;for(var u=0;u<a.length;++u){var c=a[u];l.controlPoints[u]=new r.Vector4(c.x,c.y,c.z,c.w)}return l}return t=i,(e=[{key:"getPoint",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new r.Vector3;return e=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),e=function(e,t,n,i){for(var a=wa(e,i,t),o=Aa(a,i,e,t),s=new r.Vector4(0,0,0,0),l=0;l<=e;++l){var u=n[a-e+l],c=o[l],h=u.w*c;s.x+=u.x*h,s.y+=u.y*h,s.z+=u.z*h,s.w+=u.w*c}return s}(this.degree,this.knots,this.controlPoints,e),1!==e.w&&e.divideScalar(e.w),t.set(e.x,e.y,e.z)}},{key:"getTangent",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new r.Vector3,n=(e=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),Ma(Sa(n=this.degree,this.knots,this.controlPoints,e,1)));return t.copy(n[1]).normalize(),t}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.Curve);function Oa(e){return(Oa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ra(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ia(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function ka(e,t,r){t&&Ia(e.prototype,t),r&&Ia(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function La(e,t){return(La=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Fa(e){return(Fa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ua=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&La(t,e);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Fa(e);if(r=t?(r=Fa(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Oa(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e){return Ra(this,i),n.call(this,e)}return ka(i,[{key:"load",value:function(e,t,n,i){var a=this,o=""===a.path?r.LoaderUtils.extractUrlBase(e):a.path,s=new r.FileLoader(this.manager);s.setPath(a.path),s.setResponseType("arraybuffer"),s.setRequestHeader(a.requestHeader),s.setWithCredentials(a.withCredentials),s.load(e,(function(r){try{t(a.parse(r,o))}catch(r){i?i(r):console.error(r),a.manager.itemError(e)}}),n,i)}},{key:"parse",value:function(e,t){if(i="Kaydara FBX Binary \0",(n=e).byteLength>=i.length&&i===to(n,0,i.length))Ea=(new za).parse(e);else{if(!function(e){for(var t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],r=0,n=0;n<t.length;++n)if(function(t){var n=e[0];return e=e.slice(r+1),r++,n}()===t[n])return;return 1}(n=to(e)))throw new Error("THREE.FBXLoader: Unknown format.");if(Ka(n)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Ka(n));Ea=(new Ha).parse(n)}var n,i=new r.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new Ga(i,this.manager).parse(Ea)}}]),i}(r.Loader),Ga=function(){function e(t,r){Ra(this,e),this.textureLoader=t,this.manager=r}return ka(e,[{key:"parse",value:function(){Ta=this.parseConnections();var e=this.parseImages(),t=(e=this.parseTextures(e),e=this.parseMaterials(e),this.parseDeformers()),r=(new ja).parse(t);return this.parseScene(t,r,e),Da}},{key:"parseConnections",value:function(){var e=new Map;return"Connections"in Ea&&Ea.Connections.connections.forEach((function(t){var r=t[0],n=t[1],i=(t=t[2],e.has(r)||e.set(r,{parents:[],children:[]}),{ID:n,relationship:t});e.get(r).parents.push(i),e.has(n)||e.set(n,{parents:[],children:[]}),i={ID:r,relationship:t},e.get(n).children.push(i)})),e}},{key:"parseImages",value:function(){var e,t={},r={};if("Video"in Ea.Objects){var n,i=Ea.Objects.Video;for(n in i){var a,o,s=i[n];t[parseInt(n)]=s.RelativeFilename||s.Filename,"Content"in s&&(o=s.Content instanceof ArrayBuffer&&0<s.Content.byteLength,a="string"==typeof s.Content&&""!==s.Content,(o||a)&&(o=this.parseImage(i[n]),r[s.RelativeFilename||s.Filename]=o))}}for(e in t){var l=t[e];t[e]=void 0!==r[l]?r[l]:t[e].split("\\").pop()}return t}},{key:"parseImage",value:function(e){var t,r=e.Content,n=e.RelativeFilename||e.Filename,i=n.slice(n.lastIndexOf(".")+1).toLowerCase();switch(i){case"bmp":t="image/bmp";break;case"jpg":case"jpeg":t="image/jpeg";break;case"png":t="image/png";break;case"tif":t="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",n),t="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+i+'" is not supported.')}return"string"==typeof r?"data:"+t+";base64,"+r:(e=new Uint8Array(r),window.URL.createObjectURL(new Blob([e],{type:t})))}},{key:"parseTextures",value:function(e){var t=new Map;if("Texture"in Ea.Objects){var r,n=Ea.Objects.Texture;for(r in n){var i=this.parseTexture(n[r],e);t.set(parseInt(r),i)}}return t}},{key:"parseTexture",value:function(e,t){var n=((t=this.loadTexture(e,t)).ID=e.id,t.name=e.attrName,e.WrapModeU),i=e.WrapModeV;return n=void 0!==n?n.value:0,i=void 0!==i?i.value:0,t.wrapS=0===n?r.RepeatWrapping:r.ClampToEdgeWrapping,t.wrapT=0===i?r.RepeatWrapping:r.ClampToEdgeWrapping,"Scaling"in e&&(n=e.Scaling.value,t.repeat.x=n[0],t.repeat.y=n[1]),"Translation"in e&&(i=e.Translation.value,t.offset.x=i[0],t.offset.y=i[1]),t}},{key:"loadTexture",value:function(e,t){var n,i=this.textureLoader.path,a=Ta.get(e.id).children;return a="tga"===(void 0!==a&&0<a.length&&void 0!==t[a[0].ID]&&(0!==(n=t[a[0].ID]).indexOf("blob:")&&0!==n.indexOf("data:")||this.textureLoader.setPath(void 0)),t=e.FileName.slice(-3).toLowerCase())?null===(a=this.manager.getHandler(".tga"))?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),new r.Texture):(a.setPath(this.textureLoader.path),a.load(n)):"psd"===t?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),new r.Texture):this.textureLoader.load(n),this.textureLoader.setPath(i),a}},{key:"parseMaterials",value:function(e){var t=new Map;if("Material"in Ea.Objects){var r,n=Ea.Objects.Material;for(r in n){var i=this.parseMaterial(n[r],e);null!==i&&t.set(parseInt(r),i)}}return t}},{key:"parseMaterial",value:function(e,t){var n,i=e.id,a=e.attrName,o=e.ShadingModel;if("object"===Oa(o)&&(o=o.value),!Ta.has(i))return null;switch(e=this.parseParameters(e,t,i),o.toLowerCase()){case"phong":n=new r.MeshPhongMaterial;break;case"lambert":n=new r.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',o),n=new r.MeshPhongMaterial}return n.setValues(e),n.name=a,n}},{key:"parseParameters",value:function(e,t,n){var i={},a=(e.BumpFactor&&(i.bumpScale=e.BumpFactor.value),e.Diffuse?i.color=(new r.Color).fromArray(e.Diffuse.value):!e.DiffuseColor||"Color"!==e.DiffuseColor.type&&"ColorRGB"!==e.DiffuseColor.type||(i.color=(new r.Color).fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=(new r.Color).fromArray(e.Emissive.value):!e.EmissiveColor||"Color"!==e.EmissiveColor.type&&"ColorRGB"!==e.EmissiveColor.type||(i.emissive=(new r.Color).fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(i.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(i.opacity=parseFloat(e.Opacity.value)),i.opacity<1&&(i.transparent=!0),e.ReflectionFactor&&(i.reflectivity=e.ReflectionFactor.value),e.Shininess&&(i.shininess=e.Shininess.value),e.Specular?i.specular=(new r.Color).fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(i.specular=(new r.Color).fromArray(e.SpecularColor.value)),this);return Ta.get(n).children.forEach((function(e){var n=e.relationship;switch(n){case"Bump":i.bumpMap=a.getTexture(t,e.ID);break;case"Maya|TEX_ao_map":i.aoMap=a.getTexture(t,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=a.getTexture(t,e.ID),void 0!==i.map&&(i.map.encoding=r.sRGBEncoding);break;case"DisplacementColor":i.displacementMap=a.getTexture(t,e.ID);break;case"EmissiveColor":i.emissiveMap=a.getTexture(t,e.ID),void 0!==i.emissiveMap&&(i.emissiveMap.encoding=r.sRGBEncoding);break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=a.getTexture(t,e.ID);break;case"ReflectionColor":i.envMap=a.getTexture(t,e.ID),void 0!==i.envMap&&(i.envMap.mapping=r.EquirectangularReflectionMapping,i.envMap.encoding=r.sRGBEncoding);break;case"SpecularColor":i.specularMap=a.getTexture(t,e.ID),void 0!==i.specularMap&&(i.specularMap.encoding=r.sRGBEncoding);break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=a.getTexture(t,e.ID),i.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",n)}})),i}},{key:"getTexture",value:function(e,t){return"LayeredTexture"in Ea.Objects&&t in Ea.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Ta.get(t).children[0].ID),e.get(t)}},{key:"parseDeformers",value:function(){var e={},t={};if("Deformer"in Ea.Objects){var r,n=Ea.Objects.Deformer;for(r in n){var i,a=n[r],o=Ta.get(parseInt(r));"Skin"===a.attrType?((i=this.parseSkeleton(o,n)).ID=r,1<o.parents.length&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),i.geometryID=o.parents[0].ID,e[r]=i):"BlendShape"===a.attrType&&((i={id:r}).rawTargets=this.parseMorphTargets(o,n),i.id=r,1<o.parents.length&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=i)}}return{skeletons:e,morphTargets:t}}},{key:"parseSkeleton",value:function(e,t){var n=[];return e.children.forEach((function(e){var i=t[e.ID];"Cluster"===i.attrType&&(e={ID:e.ID,indices:[],weights:[],transformLink:(new r.Matrix4).fromArray(i.TransformLink.a)},"Indexes"in i&&(e.indices=i.Indexes.a,e.weights=i.Weights.a),n.push(e))})),{rawBones:n,bones:[]}}},{key:"parseMorphTargets",value:function(e,t){for(var r=[],n=0;n<e.children.length;n++){var i=e.children[n],a=t[i.ID],o={name:a.attrName,initialWeight:a.DeformPercent,id:a.id,fullWeights:a.FullWeights.a};if("BlendShapeChannel"!==a.attrType)return;o.geoID=Ta.get(parseInt(i.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,r.push(o)}return r}},{key:"parseScene",value:function(e,t,n){Da=new r.Group;var i=this.parseModels(e.skeletons,t,n),a=Ea.Objects.Model,o=this;i.forEach((function(e){var t=a[e.ID];o.setLookAtProperties(e,t),Ta.get(e.ID).parents.forEach((function(t){void 0!==(t=i.get(t.ID))&&t.add(e)})),null===e.parent&&Da.add(e)})),this.bindSkeleton(e.skeletons,t,i),this.createAmbientLight(),Da.traverse((function(e){var t;e.userData.transformData&&(e.parent&&(e.userData.transformData.parentMatrix=e.parent.matrix,e.userData.transformData.parentMatrixWorld=e.parent.matrixWorld),t=qa(e.userData.transformData),e.applyMatrix4(t),e.updateWorldMatrix())})),n=(new Na).parse(),1===Da.children.length&&Da.children[0].isGroup&&(Da.children[0].animations=n,Da=Da.children[0]),Da.animations=n}},{key:"parseModels",value:function(e,t,n){var i,a=new Map,o=Ea.Objects.Model;for(i in o){var s=parseInt(i),l=o[i],u=Ta.get(s),c=this.buildSkeleton(u,e,s,l.attrName);if(!c){switch(l.attrType){case"Camera":c=this.createCamera(u);break;case"Light":c=this.createLight(u);break;case"Mesh":c=this.createMesh(u,t,n);break;case"NurbsCurve":c=this.createCurve(u,t);break;case"LimbNode":case"Root":c=new r.Bone;break;default:c=new r.Group}c.name=l.attrName?r.PropertyBinding.sanitizeNodeName(l.attrName):"",c.ID=s}this.getTransformData(c,l),a.set(s,c)}return a}},{key:"buildSkeleton",value:function(e,t,n,i){var a=null;return e.parents.forEach((function(e){for(var o in t)!function(o){var s=t[o];s.rawBones.forEach((function(t,o){var l;t.ID===e.ID&&(l=a,(a=new r.Bone).matrixWorld.copy(t.transformLink),a.name=i?r.PropertyBinding.sanitizeNodeName(i):"",a.ID=n,s.bones[o]=a,null!==l&&a.add(l))}))}(o)})),a}},{key:"createCamera",value:function(e){var t,n;if(e.children.forEach((function(e){void 0!==(e=Ea.Objects.NodeAttribute[e.ID])&&(n=e)})),void 0===n)t=new r.Object3D;else{var i=0,a=(void 0!==n.CameraProjectionType&&1===n.CameraProjectionType.value&&(i=1),1),o=(void 0!==n.NearPlane&&(a=n.NearPlane.value/1e3),1e3),s=(void 0!==n.FarPlane&&(o=n.FarPlane.value/1e3),window.innerWidth),l=window.innerHeight,u=(void 0!==n.AspectWidth&&void 0!==n.AspectHeight&&(s=n.AspectWidth.value,l=n.AspectHeight.value),s/l),c=45,h=(void 0!==n.FieldOfView&&(c=n.FieldOfView.value),n.FocalLength?n.FocalLength.value:null);switch(i){case 0:t=new r.PerspectiveCamera(c,u,a,o),null!==h&&t.setFocalLength(h);break;case 1:t=new r.OrthographicCamera(-s/2,s/2,l/2,-l/2,a,o);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+i+"."),t=new r.Object3D}}return t}},{key:"createLight",value:function(e){var t,n;if(e.children.forEach((function(e){void 0!==(e=Ea.Objects.NodeAttribute[e.ID])&&(n=e)})),void 0===n)t=new r.Object3D;else{e=void 0===n.LightType?0:n.LightType.value;var i=16777215,a=(void 0!==n.Color&&(i=(new r.Color).fromArray(n.Color.value)),void 0===n.Intensity?1:n.Intensity.value/100),o=(void 0!==n.CastLightOnObject&&0===n.CastLightOnObject.value&&(a=0),0);switch(void 0!==n.FarAttenuationEnd&&(o=void 0!==n.EnableFarAttenuation&&0===n.EnableFarAttenuation.value?0:n.FarAttenuationEnd.value),e){case 0:t=new r.PointLight(i,a,o,1);break;case 1:t=new r.DirectionalLight(i,a);break;case 2:var s=Math.PI/3,l=(void 0!==n.InnerAngle&&(s=r.MathUtils.degToRad(n.InnerAngle.value)),0);void 0!==n.OuterAngle&&(l=r.MathUtils.degToRad(n.OuterAngle.value),l=Math.max(l,1)),t=new r.SpotLight(i,a,o,s,l,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),t=new r.PointLight(i,a)}void 0!==n.CastShadows&&1===n.CastShadows.value&&(t.castShadow=!0)}return t}},{key:"createMesh",value:function(e,t,n){var i,a=null,o=null,s=[];return e.children.forEach((function(e){t.has(e.ID)&&(a=t.get(e.ID)),n.has(e.ID)&&s.push(n.get(e.ID))})),1<s.length?o=s:0<s.length?o=s[0]:(o=new r.MeshPhongMaterial({color:13421772}),s.push(o)),"color"in a.attributes&&s.forEach((function(e){e.vertexColors=!0})),a.FBX_Deformer?(i=new r.SkinnedMesh(a,o)).normalizeSkinWeights():i=new r.Mesh(a,o),i}},{key:"createCurve",value:function(e,t){e=e.children.reduce((function(e,r){return t.has(r.ID)?t.get(r.ID):e}),null);var n=new r.LineBasicMaterial({color:3342591,linewidth:1});return new r.Line(e,n)}},{key:"getTransformData",value:function(e,t){var r={};"InheritType"in t&&(r.inheritType=parseInt(t.InheritType.value)),r.eulerOrder="RotationOrder"in t?$a(t.RotationOrder.value):"ZYX","Lcl_Translation"in t&&(r.translation=t.Lcl_Translation.value),"PreRotation"in t&&(r.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(r.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(r.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(r.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(r.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(r.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(r.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(r.rotationPivot=t.RotationPivot.value),e.userData.transformData=r}},{key:"setLookAtProperties",value:function(e,t){"LookAtProperty"in t&&Ta.get(e.ID).children.forEach((function(t){"LookAtProperty"===t.relationship&&"Lcl_Translation"in(t=Ea.Objects.Model[t.ID])&&(t=t.Lcl_Translation.value,void 0!==e.target?(e.target.position.fromArray(t),Da.add(e.target)):e.lookAt((new r.Vector3).fromArray(t)))}))}},{key:"bindSkeleton",value:function(e,t,n){var i,a=this.parsePoseNodes();for(i in e)!function(i){var o=e[i];Ta.get(parseInt(o.ID)).parents.forEach((function(e){t.has(e.ID)&&(e=e.ID,Ta.get(e).parents.forEach((function(e){n.has(e.ID)&&n.get(e.ID).bind(new r.Skeleton(o.bones),a[e.ID])})))}))}(i)}},{key:"parsePoseNodes",value:function(){var e={};if("Pose"in Ea.Objects){var t,n,i=Ea.Objects.Pose;for(t in i)"BindPose"===i[t].attrType&&0<i[t].NbPoseNodes&&(n=i[t].PoseNode,Array.isArray(n)?n.forEach((function(t){e[t.Node]=(new r.Matrix4).fromArray(t.Matrix.a)})):e[n.Node]=(new r.Matrix4).fromArray(n.Matrix.a))}return e}},{key:"createAmbientLight",value:function(){var e,t,n;"GlobalSettings"in Ea&&"AmbientColor"in Ea.GlobalSettings&&(n=(t=Ea.GlobalSettings.AmbientColor.value)[0],e=t[1],t=t[2],0===n&&0===e&&0===t||(n=new r.Color(n,e,t),Da.add(new r.AmbientLight(n,1))))}}]),e}(),ja=function(){function e(){Ra(this,e)}return ka(e,[{key:"parse",value:function(e){var t=new Map;if("Geometry"in Ea.Objects){var r,n=Ea.Objects.Geometry;for(r in n){var i=Ta.get(parseInt(r));i=this.parseGeometry(i,n[r],e),t.set(parseInt(r),i)}}return t}},{key:"parseGeometry",value:function(e,t,r){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,r);case"NurbsCurve":return this.parseNurbsGeometry(t)}}},{key:"parseMeshGeometry",value:function(e,t,r){var n,i=r.skeletons,a=[],o=e.parents.map((function(e){return Ea.Objects.Model[e.ID]}));if(0!==o.length)return n=e.children.reduce((function(e,t){return void 0!==i[t.ID]?i[t.ID]:e}),null),e.children.forEach((function(e){void 0!==r.morphTargets[e.ID]&&a.push(r.morphTargets[e.ID])})),e={},"RotationOrder"in(o=o[0])&&(e.eulerOrder=$a(o.RotationOrder.value)),"InheritType"in o&&(e.inheritType=parseInt(o.InheritType.value)),"GeometricTranslation"in o&&(e.translation=o.GeometricTranslation.value),"GeometricRotation"in o&&(e.rotation=o.GeometricRotation.value),"GeometricScaling"in o&&(e.scale=o.GeometricScaling.value),o=qa(e),this.genGeometry(t,n,a,o)}},{key:"genGeometry",value:function(e,t,n,i){var a,o,s=new r.BufferGeometry,l=(e.attrName&&(s.name=e.attrName),this.parseGeoNode(e,t)),u=this.genBuffers(l),c=new r.Float32BufferAttribute(u.vertex,3);return c.applyMatrix4(i),s.setAttribute("position",c),0<u.colors.length&&s.setAttribute("color",new r.Float32BufferAttribute(u.colors,3)),t&&(s.setAttribute("skinIndex",new r.Uint16BufferAttribute(u.weightsIndices,4)),s.setAttribute("skinWeight",new r.Float32BufferAttribute(u.vertexWeights,4)),s.FBX_Deformer=t),0<u.normal.length&&(c=(new r.Matrix3).getNormalMatrix(i),(t=new r.Float32BufferAttribute(u.normal,3)).applyNormalMatrix(c),s.setAttribute("normal",t)),u.uvs.forEach((function(e,t){var n="uv"+(t+1).toString();s.setAttribute(n=0===t?"uv":n,new r.Float32BufferAttribute(u.uvs[t],2))})),l.material&&"AllSame"!==l.material.mappingType&&(a=u.materialIndex[0],o=0,u.materialIndex.forEach((function(e,t){e!==a&&(s.addGroup(o,t-o,a),a=e,o=t)})),0<s.groups.length&&(t=(c=s.groups[s.groups.length-1]).start+c.count)!==u.materialIndex.length&&s.addGroup(t,u.materialIndex.length-t,a),0===s.groups.length&&s.addGroup(0,u.materialIndex.length,u.materialIndex[0])),this.addMorphTargets(s,e,n,i),s}},{key:"parseGeoNode",value:function(e,t){var r={};if(r.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],r.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(r.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(r.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(r.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){r.uv=[];for(var n=0;e.LayerElementUV[n];)e.LayerElementUV[n].UV&&r.uv.push(this.parseUVs(e.LayerElementUV[n])),n++}return r.weightTable={},null!==t&&(r.skeleton=t).rawBones.forEach((function(e,t){e.indices.forEach((function(n,i){void 0===r.weightTable[n]&&(r.weightTable[n]=[]),r.weightTable[n].push({id:t,weight:e.weights[i]})}))})),r}},{key:"genBuffers",value:function(e){var t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},r=0,n=0,i=!1,a=[],o=[],s=[],l=[],u=[],c=[],h=this;return e.vertexIndices.forEach((function(d,p){var f,m,v,g,y=!1,b=(d<0&&(d^=-1,y=!0),[]),x=[];if(a.push(3*d,3*d+1,3*d+2),e.color&&(g=Xa(p,r,d,e.color),s.push(g[0],g[1],g[2])),e.skeleton){for(void 0!==e.weightTable[d]&&e.weightTable[d].forEach((function(e){x.push(e.weight),b.push(e.id)})),4<x.length&&(i||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),i=!0),m=[0,0,0,0],v=[0,0,0,0],x.forEach((function(e,t){var r=e,n=b[t];v.forEach((function(e,t,i){e<r&&(i[t]=r,r=e,i=m[t],m[t]=n,n=i)}))})),b=m,x=v);x.length<4;)x.push(0),b.push(0);for(var w=0;w<4;++w)u.push(x[w]),c.push(b[w])}e.normal&&(g=Xa(p,r,d,e.normal),o.push(g[0],g[1],g[2])),e.material&&"AllSame"!==e.material.mappingType&&(f=Xa(p,r,d,e.material)[0]),e.uv&&e.uv.forEach((function(e,t){e=Xa(p,r,d,e),void 0===l[t]&&(l[t]=[]),l[t].push(e[0]),l[t].push(e[1])})),n++,y&&(h.genFace(t,e,a,f,o,s,l,u,c,n),r++,n=0,a=[],o=[],s=[],l=[],u=[],c=[])})),t}},{key:"genFace",value:function(e,t,r,n,i,a,o,s,l,u){for(var c=2;c<u;c++)!function(u){e.vertex.push(t.vertexPositions[r[0]]),e.vertex.push(t.vertexPositions[r[1]]),e.vertex.push(t.vertexPositions[r[2]]),e.vertex.push(t.vertexPositions[r[3*(u-1)]]),e.vertex.push(t.vertexPositions[r[3*(u-1)+1]]),e.vertex.push(t.vertexPositions[r[3*(u-1)+2]]),e.vertex.push(t.vertexPositions[r[3*u]]),e.vertex.push(t.vertexPositions[r[3*u+1]]),e.vertex.push(t.vertexPositions[r[3*u+2]]),t.skeleton&&(e.vertexWeights.push(s[0]),e.vertexWeights.push(s[1]),e.vertexWeights.push(s[2]),e.vertexWeights.push(s[3]),e.vertexWeights.push(s[4*(u-1)]),e.vertexWeights.push(s[4*(u-1)+1]),e.vertexWeights.push(s[4*(u-1)+2]),e.vertexWeights.push(s[4*(u-1)+3]),e.vertexWeights.push(s[4*u]),e.vertexWeights.push(s[4*u+1]),e.vertexWeights.push(s[4*u+2]),e.vertexWeights.push(s[4*u+3]),e.weightsIndices.push(l[0]),e.weightsIndices.push(l[1]),e.weightsIndices.push(l[2]),e.weightsIndices.push(l[3]),e.weightsIndices.push(l[4*(u-1)]),e.weightsIndices.push(l[4*(u-1)+1]),e.weightsIndices.push(l[4*(u-1)+2]),e.weightsIndices.push(l[4*(u-1)+3]),e.weightsIndices.push(l[4*u]),e.weightsIndices.push(l[4*u+1]),e.weightsIndices.push(l[4*u+2]),e.weightsIndices.push(l[4*u+3])),t.color&&(e.colors.push(a[0]),e.colors.push(a[1]),e.colors.push(a[2]),e.colors.push(a[3*(u-1)]),e.colors.push(a[3*(u-1)+1]),e.colors.push(a[3*(u-1)+2]),e.colors.push(a[3*u]),e.colors.push(a[3*u+1]),e.colors.push(a[3*u+2])),t.material&&"AllSame"!==t.material.mappingType&&(e.materialIndex.push(n),e.materialIndex.push(n),e.materialIndex.push(n)),t.normal&&(e.normal.push(i[0]),e.normal.push(i[1]),e.normal.push(i[2]),e.normal.push(i[3*(u-1)]),e.normal.push(i[3*(u-1)+1]),e.normal.push(i[3*(u-1)+2]),e.normal.push(i[3*u]),e.normal.push(i[3*u+1]),e.normal.push(i[3*u+2])),t.uv&&t.uv.forEach((function(t,r){void 0===e.uvs[r]&&(e.uvs[r]=[]),e.uvs[r].push(o[r][0]),e.uvs[r].push(o[r][1]),e.uvs[r].push(o[r][2*(u-1)]),e.uvs[r].push(o[r][2*(u-1)+1]),e.uvs[r].push(o[r][2*u]),e.uvs[r].push(o[r][2*u+1])}))}(c)}},{key:"addMorphTargets",value:function(e,t,r,n){var i;0!==r.length&&(e.morphTargetsRelative=!0,e.morphAttributes.position=[],i=this,r.forEach((function(r){r.rawTargets.forEach((function(r){var a=Ea.Objects.Geometry[r.geoID];void 0!==a&&i.genMorphGeometry(e,t,a,n,r.name)}))})))}},{key:"genMorphGeometry",value:function(e,t,n,i,a){t=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[];for(var o=void 0!==n.Vertices?n.Vertices.a:[],s=void 0!==n.Indexes?n.Indexes.a:[],l=3*e.attributes.position.count,u=new Float32Array(l),c=0;c<s.length;c++){var h=3*s[c];u[h]=o[3*c],u[1+h]=o[3*c+1],u[2+h]=o[3*c+2]}l=this.genBuffers({vertexIndices:t,vertexPositions:u}),(t=new r.Float32BufferAttribute(l.vertex,3)).name=a||n.attrName,t.applyMatrix4(i),e.morphAttributes.position.push(t)}},{key:"parseNormals",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=e.Normals.a,i=[];return"IndexToDirect"===r&&("NormalIndex"in e?i=e.NormalIndex.a:"NormalsIndex"in e&&(i=e.NormalsIndex.a)),{dataSize:3,buffer:n,indices:i,mappingType:t,referenceType:r}}},{key:"parseUVs",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=[];return{dataSize:2,buffer:e.UV.a,indices:n="IndexToDirect"===r?e.UVIndex.a:n,mappingType:t,referenceType:r}}},{key:"parseVertexColors",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=[];return{dataSize:4,buffer:e.Colors.a,indices:n="IndexToDirect"===r?e.ColorIndex.a:n,mappingType:t,referenceType:r}}},{key:"parseMaterialIndices",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:r};for(var n=e.Materials.a,i=[],a=0;a<n.length;++a)i.push(a);return{dataSize:1,buffer:n,indices:i,mappingType:t,referenceType:r}}},{key:"parseNurbsGeometry",value:function(e){if(void 0===Pa)return console.error("THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new r.BufferGeometry;var t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new r.BufferGeometry;for(var n=t-1,i=(t=e.KnotVector.a,[]),a=e.Points.a,o=0,s=a.length;o<s;o+=4)i.push((new r.Vector4).fromArray(a,o));if("Closed"===e.Form)i.push(i[0]);else if("Periodic"===e.Form)for(var l=n,u=t.length-1-l,c=0;c<n;++c)i.push(i[c]);return e=new Pa(n,t,i,l,u).getPoints(12*i.length),(new r.BufferGeometry).setFromPoints(e)}}]),e}(),Na=function(){function e(){Ra(this,e)}return ka(e,[{key:"parse",value:function(){var e=[],t=this.parseClips();if(void 0!==t)for(var r in t)r=t[r],r=this.addClip(r),e.push(r);return e}},{key:"parseClips",value:function(){var e;if(void 0!==Ea.Objects.AnimationCurve)return e=this.parseAnimationCurveNodes(),this.parseAnimationCurves(e),e=this.parseAnimationLayers(e),this.parseAnimStacks(e)}},{key:"parseAnimationCurveNodes",value:function(){var e,t=Ea.Objects.AnimationCurveNode,r=new Map;for(e in t){var n=t[e];null!==n.attrName.match(/S|R|T|DeformPercent/)&&(n={id:n.id,attr:n.attrName,curves:{}},r.set(n.id,n))}return r}},{key:"parseAnimationCurves",value:function(e){var t,r=Ea.Objects.AnimationCurve;for(t in r){var n,i={id:r[t].id,times:r[t].KeyTime.a.map(Wa),values:r[t].KeyValueFloat.a},a=Ta.get(i.id);void 0!==a&&(n=a.parents[0].ID,(a=a.parents[0].relationship).match(/X/)?e.get(n).curves.x=i:a.match(/Y/)?e.get(n).curves.y=i:a.match(/Z/)?e.get(n).curves.z=i:a.match(/d|DeformPercent/)&&e.has(n)&&(e.get(n).curves.morph=i))}}},{key:"parseAnimationLayers",value:function(e){var t,n=Ea.Objects.AnimationLayer,i=new Map;for(t in n)!function(t){var n=[],a=Ta.get(parseInt(t));void 0!==a&&(a.children.forEach((function(t,i){if(e.has(t.ID)){var a=e.get(t.ID);if(void 0!==a.curves.x||void 0!==a.curves.y||void 0!==a.curves.z){if(void 0===n[i]){var o=Ta.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID;if(void 0!==o){var s=Ea.Objects.Model[o.toString()];if(void 0===s)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",t);var l={modelName:s.attrName?r.PropertyBinding.sanitizeNodeName(s.attrName):"",ID:s.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};Da.traverse((function(e){e.ID===s.id&&(l.transform=e.matrix,e.userData.transformData&&(l.eulerOrder=e.userData.transformData.eulerOrder))})),l.transform||(l.transform=new r.Matrix4),"PreRotation"in s&&(l.preRotation=s.PreRotation.value),"PostRotation"in s&&(l.postRotation=s.PostRotation.value),n[i]=l}}n[i]&&(n[i][a.attr]=a)}else void 0!==a.curves.morph&&(void 0===n[i]&&(o=Ta.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,t=Ta.get(o).parents[0].ID,t=Ta.get(t).parents[0].ID,t=Ta.get(t).parents[0].ID,t={modelName:(t=Ea.Objects.Model[t]).attrName?r.PropertyBinding.sanitizeNodeName(t.attrName):"",morphName:Ea.Objects.Deformer[o].attrName},n[i]=t),n[i][a.attr]=a)}})),i.set(parseInt(t),n))}(t);return i}},{key:"parseAnimStacks",value:function(e){var t,r=Ea.Objects.AnimationStack,n={};for(t in r){var i=(1<(i=Ta.get(parseInt(t)).children).length&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers."),e.get(i[0].ID));n[t]={name:r[t].attrName,layer:i}}return n}},{key:"addClip",value:function(e){var t=[],n=this;return e.layer.forEach((function(e){t=t.concat(n.generateTracks(e))})),new r.AnimationClip(e.name,-1,t)}},{key:"generateTracks",value:function(e){var t=[],n=new r.Vector3,i=new r.Quaternion,a=new r.Vector3;return e.transform&&e.transform.decompose(n,i,a),n=n.toArray(),i=(new r.Euler).setFromQuaternion(i,e.eulerOrder).toArray(),a=a.toArray(),void 0!==e.T&&0<Object.keys(e.T.curves).length&&void 0!==(n=this.generateVectorTrack(e.modelName,e.T.curves,n,"position"))&&t.push(n),void 0!==e.R&&0<Object.keys(e.R.curves).length&&void 0!==(n=this.generateRotationTrack(e.modelName,e.R.curves,i,e.preRotation,e.postRotation,e.eulerOrder))&&t.push(n),void 0!==e.S&&0<Object.keys(e.S.curves).length&&void 0!==(i=this.generateVectorTrack(e.modelName,e.S.curves,a,"scale"))&&t.push(i),void 0!==e.DeformPercent&&void 0!==(n=this.generateMorphTrack(e))&&t.push(n),t}},{key:"generateVectorTrack",value:function(e,t,n,i){var a=this.getTimesForAllAxes(t);return t=this.getKeyframeTrackValues(a,t,n),new r.VectorKeyframeTrack(e+"."+i,a,t)}},{key:"generateRotationTrack",value:function(e,t,n,i,a,o){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(r.MathUtils.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(r.MathUtils.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(r.MathUtils.degToRad));for(var s=this.getTimesForAllAxes(t),l=this.getKeyframeTrackValues(s,t,n),u=(void 0!==i&&((i=i.map(r.MathUtils.degToRad)).push(o),i=(new r.Euler).fromArray(i),i=(new r.Quaternion).setFromEuler(i)),void 0!==a&&((a=a.map(r.MathUtils.degToRad)).push(o),a=(new r.Euler).fromArray(a),a=(new r.Quaternion).setFromEuler(a).invert()),new r.Quaternion),c=new r.Euler,h=[],d=0;d<l.length;d+=3)c.set(l[d],l[d+1],l[d+2],o),u.setFromEuler(c),void 0!==i&&u.premultiply(i),void 0!==a&&u.multiply(a),u.toArray(h,d/3*4);return new r.QuaternionKeyframeTrack(e+".quaternion",s,h)}},{key:"generateMorphTrack",value:function(e){var t=e.DeformPercent.curves.morph,n=t.values.map((function(e){return e/100})),i=Da.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new r.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+i+"]",t.times,n)}},{key:"getTimesForAllAxes",value:function(e){var t=[];if(void 0!==e.x&&(t=t.concat(e.x.times)),void 0!==e.y&&(t=t.concat(e.y.times)),1<(t=(t=void 0!==e.z?t.concat(e.z.times):t).sort((function(e,t){return e-t}))).length){for(var r=1,n=t[0],i=1;i<t.length;i++){var a=t[i];a!==n&&(n=t[r]=a,r++)}t=t.slice(0,r)}return t}},{key:"getKeyframeTrackValues",value:function(e,t,r){var n=r,i=[],a=-1,o=-1,s=-1;return e.forEach((function(e){t.x&&(a=t.x.times.indexOf(e)),t.y&&(o=t.y.times.indexOf(e)),t.z&&(s=t.z.times.indexOf(e)),-1!==a?(e=t.x.values[a],i.push(e),n[0]=e):i.push(n[0]),-1!==o?(e=t.y.values[o],i.push(e),n[1]=e):i.push(n[1]),-1!==s?(e=t.z.values[s],i.push(e),n[2]=e):i.push(n[2])})),i}},{key:"interpolateRotations",value:function(e){for(var t=1;t<e.values.length;t++){var r=e.values[t-1],n=e.values[t]-r;if(180<=(i=Math.abs(n))){for(var i,a=n/(i/=180),o=r+a,s=(n=e.times[t-1],(e.times[t]-n)/i),l=n+s,u=[],c=[];l<e.times[t];)u.push(l),l+=s,c.push(o),o+=a;e.times=ro(e.times,t,u),e.values=ro(e.values,t,c)}}}}]),e}(),Ha=function(){function e(){Ra(this,e)}return ka(e,[{key:"getPrevNode",value:function(){return this.nodeStack[this.currentIndent-2]}},{key:"getCurrentNode",value:function(){return this.nodeStack[this.currentIndent-1]}},{key:"getCurrentProp",value:function(){return this.currentProp}},{key:"pushStack",value:function(e){this.nodeStack.push(e),this.currentIndent+=1}},{key:"popStack",value:function(){this.nodeStack.pop(),--this.currentIndent}},{key:"setCurrentProp",value:function(e,t){this.currentProp=e,this.currentPropName=t}},{key:"parse",value:function(e){this.currentIndent=0,this.allNodes=new Ja,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var t=this,r=e.split(/[\r\n]+/);return r.forEach((function(e,n){var i,a=e.match(/^[\s\t]*;/),o=e.match(/^[\s\t]*$/);a||o||(a=e.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),o=e.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),i=e.match("^\\t{"+(t.currentIndent-1)+"}}"),a?t.parseNodeBegin(e,a):o?t.parseNodeProperty(e,o,r[++n]):i?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e))})),this.allNodes}},{key:"parseNodeBegin",value:function(e,t){var r=t[1].trim().replace(/^"/,"").replace(/"$/,""),n=(t=t[2].split(",").map((function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")})),{name:r}),i=(t=this.parseNodeAttr(t),this.getCurrentNode());0===this.currentIndent?this.allNodes.add(r,n):r in i?("PoseNode"===r?i.PoseNode.push(n):void 0!==i[r].id&&(i[r]={},i[r][i[r].id]=i[r]),""!==t.id&&(i[r][t.id]=n)):"number"==typeof t.id?(i[r]={},i[r][t.id]=n):"Properties70"!==r&&(i[r]="PoseNode"===r?[n]:n),"number"==typeof t.id&&(n.id=t.id),""!==t.name&&(n.attrName=t.name),""!==t.type&&(n.attrType=t.type),this.pushStack(n)}},{key:"parseNodeAttr",value:function(e){var t=e[0],r=(""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0])),""),n="";return 1<e.length&&(r=e[1].replace(/^(\w+)::/,""),n=e[2]),{id:t,name:r,type:n}}},{key:"parseNodeProperty",value:function(e,t,r){var n=t[1].replace(/^"/,"").replace(/"$/,"").trim();if(t=t[2].replace(/^"/,"").replace(/"$/,"").trim(),"Properties70"===("Content"===n&&","===t&&(t=r.replace(/"/g,"").replace(/,$/,"").trim()),r=this.getCurrentNode()).name)this.parseNodeSpecialProperty(e,n,t);else{if("C"===n){e=t.split(",").slice(1);for(var i=parseInt(e[0]),a=(e=parseInt(e[1]),(a=t.split(",").slice(3)).map((function(e){return e.trim().replace(/^"/,"")}))),o=(n="connections",t=[i,e]),s=a,l=0,u=o.length,c=s.length;l<c;l++,u++)o[u]=s[l];void 0===r[n]&&(r[n]=[])}"Node"===n&&(r.id=t),n in r&&Array.isArray(r[n])?r[n].push(t):"a"!==n?r[n]=t:r.a=t,this.setCurrentProp(r,n),"a"===n&&","!==t.slice(-1)&&(r.a=eo(t))}}},{key:"parseNodePropertyContinued",value:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=eo(t.a))}},{key:"parseNodeSpecialProperty",value:function(e,t,r){r=r.split('",').map((function(e){return e.trim().replace(/^\"/,"").replace(/\s/,"_")}));var n=r[0],i=r[1],a=r[2],o=r[3],s=r[4];switch(i){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":s=parseFloat(s);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":s=eo(s)}this.getPrevNode()[n]={type:i,type2:a,flag:o,value:s},this.setCurrentProp(this.getPrevNode(),n)}}]),e}(),za=function(){function t(){Ra(this,t)}return ka(t,[{key:"parse",value:function(e){var t=new Va(e),r=(t.skip(23),t.getUint32());if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);for(var n=new Ja;!this.endOfContent(t);){var i=this.parseNode(t,r);null!==i&&n.add(i.name,i)}return n}},{key:"endOfContent",value:function(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}},{key:"parseNode",value:function(e,t){var r={},n=7500<=t?e.getUint64():e.getUint32(),i=7500<=t?e.getUint64():e.getUint32(),a=(7500<=t?e.getUint64():e.getUint32(),e.getUint8()),o=e.getString(a);if(0===n)return null;for(var s=[],l=0;l<i;l++)s.push(this.parseProperty(e));a=0<s.length?s[0]:"";var u=1<s.length?s[1]:"",c=2<s.length?s[2]:"";for(r.singleProperty=1===i&&e.getOffset()===n;n>e.getOffset();){var h=this.parseNode(e,t);null!==h&&this.parseSubNode(o,r,h)}return r.propertyList=s,"number"==typeof a&&(r.id=a),""!==u&&(r.attrName=u),""!==c&&(r.attrType=c),""!==o&&(r.name=o),r}},{key:"parseSubNode",value:function(e,t,r){var n,i,a,o,s;!0===r.singleProperty?(i=r.propertyList[0],Array.isArray(i)?(t[r.name]=r).a=i:t[r.name]=i):"Connections"===e&&"C"===r.name?(n=[],r.propertyList.forEach((function(e,t){0!==t&&n.push(e)})),void 0===t.connections&&(t.connections=[]),t.connections.push(n)):"Properties70"===r.name?Object.keys(r).forEach((function(e){t[e]=r[e]})):"Properties70"===e&&"P"===r.name?(i=r.propertyList[0],e=r.propertyList[1],a=r.propertyList[2],o=r.propertyList[3],0===i.indexOf("Lcl ")&&(i=i.replace("Lcl ","Lcl_")),s="Color"===(e=0===e.indexOf("Lcl ")?e.replace("Lcl ","Lcl_"):e)||"ColorRGB"===e||"Vector"===e||"Vector3D"===e||0===e.indexOf("Lcl_")?[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:r.propertyList[4],t[i]={type:e,type2:a,flag:o,value:s}):void 0===t[r.name]?"number"==typeof r.id?(t[r.name]={},t[r.name][r.id]=r):t[r.name]=r:"PoseNode"===r.name?(Array.isArray(t[r.name])||(t[r.name]=[t[r.name]]),t[r.name].push(r)):void 0===t[r.name][r.id]&&(t[r.name][r.id]=r)}},{key:"parseProperty",value:function(t){var r=t.getString(1);switch(r){case"C":return t.getBoolean();case"D":return t.getFloat64();case"F":return t.getFloat32();case"I":return t.getInt32();case"L":return t.getInt64();case"R":return i=t.getUint32(),t.getArrayBuffer(i);case"S":return i=t.getUint32(),t.getString(i);case"Y":return t.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var n=t.getUint32(),i=t.getUint32(),a=t.getUint32();if(0===i)switch(r){case"b":case"c":return t.getBooleanArray(n);case"d":return t.getFloat64Array(n);case"f":return t.getFloat32Array(n);case"i":return t.getInt32Array(n);case"l":return t.getInt64Array(n)}void 0===e&&console.error("THREE.FBXLoader: External library fflate.min.js required."),i=Qi(new Uint8Array(t.getArrayBuffer(a)));var o=new Va(i.buffer);switch(r){case"b":case"c":return o.getBooleanArray(n);case"d":return o.getFloat64Array(n);case"f":return o.getFloat32Array(n);case"i":return o.getInt32Array(n);case"l":return o.getInt64Array(n)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+r)}}}]),t}(),Va=function(){function e(t,r){Ra(this,e),this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===r||r}return ka(e,[{key:"getOffset",value:function(){return this.offset}},{key:"size",value:function(){return this.dv.buffer.byteLength}},{key:"skip",value:function(e){this.offset+=e}},{key:"getBoolean",value:function(){return 1==(1&this.getUint8())}},{key:"getBooleanArray",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getBoolean());return t}},{key:"getUint8",value:function(){var e=this.dv.getUint8(this.offset);return this.offset+=1,e}},{key:"getInt16",value:function(){var e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}},{key:"getInt32",value:function(){var e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getInt32Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getInt32());return t}},{key:"getUint32",value:function(){var e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getInt64",value:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),2147483648&t?(t=4294967295&~t,-(4294967296*(t=4294967295==(e=4294967295&~e)?t+1&4294967295:t)+(e=e+1&4294967295))):4294967296*t+e}},{key:"getInt64Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getInt64());return t}},{key:"getUint64",value:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),4294967296*t+e}},{key:"getFloat32",value:function(){var e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getFloat32Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getFloat32());return t}},{key:"getFloat64",value:function(){var e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}},{key:"getFloat64Array",value:function(e){for(var t=[],r=0;r<e;r++)t.push(this.getFloat64());return t}},{key:"getArrayBuffer",value:function(e){var t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}},{key:"getString",value:function(e){for(var t=[],n=0;n<e;n++)t[n]=this.getUint8();var i=t.indexOf(0);return 0<=i&&(t=t.slice(0,i)),r.LoaderUtils.decodeText(new Uint8Array(t))}}]),e}(),Ja=function(){function e(){Ra(this,e)}return ka(e,[{key:"add",value:function(e,t){this[e]=t}}]),e}();function Ka(e){if(e=e.match(/FBXVersion: (\d+)/))return parseInt(e[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function Wa(e){return e/46186158e3}var Qa=[];function Xa(e,t,r,n){var i;switch(n.mappingType){case"ByPolygonVertex":i=e;break;case"ByPolygon":i=t;break;case"ByVertice":i=r;break;case"AllSame":i=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}for(var a=(i="IndexToDirect"===n.referenceType?n.indices[i]:i)*n.dataSize,o=a+n.dataSize,s=Qa,l=n.buffer,u=o,c=a,h=0;c<u;c++,h++)s[h]=l[c];return s}var Za=new r.Euler,Ya=new r.Vector3;function qa(e){var t=new r.Matrix4,n=new r.Matrix4,i=new r.Matrix4,a=new r.Matrix4,o=new r.Matrix4,s=new r.Matrix4,l=new r.Matrix4,u=new r.Matrix4,c=new r.Matrix4,h=new r.Matrix4,d=new r.Matrix4,p=new r.Matrix4,f=e.inheritType||0,m=(e.translation&&t.setPosition(Ya.fromArray(e.translation)),e.preRotation&&((m=e.preRotation.map(r.MathUtils.degToRad)).push(e.eulerOrder),n.makeRotationFromEuler(Za.fromArray(m))),e.rotation&&((m=e.rotation.map(r.MathUtils.degToRad)).push(e.eulerOrder),i.makeRotationFromEuler(Za.fromArray(m))),e.postRotation&&((m=e.postRotation.map(r.MathUtils.degToRad)).push(e.eulerOrder),a.makeRotationFromEuler(Za.fromArray(m)),a.invert()),e.scale&&o.scale(Ya.fromArray(e.scale)),e.scalingOffset&&l.setPosition(Ya.fromArray(e.scalingOffset)),e.scalingPivot&&s.setPosition(Ya.fromArray(e.scalingPivot)),e.rotationOffset&&u.setPosition(Ya.fromArray(e.rotationOffset)),e.rotationPivot&&c.setPosition(Ya.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(d.copy(e.parentMatrix),h.copy(e.parentMatrixWorld)),n.clone().multiply(i).multiply(a)),v=(((e=new r.Matrix4).extractRotation(h),v=new r.Matrix4).copyPosition(h),v.clone().invert().multiply(h)),g=(v=e.clone().invert().multiply(v),o),y=new r.Matrix4;return(0===f?y.copy(e).multiply(m).multiply(v):1===f?y.copy(e).multiply(v).multiply(m):(f=(new r.Matrix4).scale((new r.Vector3).setFromMatrixScale(d)).clone().invert(),d=v.clone().multiply(f),y.copy(e).multiply(m).multiply(d))).multiply(g),v=c.clone().invert(),f=s.clone().invert(),e=t.clone().multiply(u).multiply(c).multiply(n).multiply(i).multiply(a).multiply(v).multiply(l).multiply(s).multiply(o).multiply(f),m=(new r.Matrix4).copyPosition(e),d=h.clone().multiply(m),p.copyPosition(d),(e=p.clone().multiply(y)).premultiply(h.invert()),e}function $a(e){var t=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return 6===(e=e||0)?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),t[0]):t[e]}function eo(e){return e.split(",").map((function(e){return parseFloat(e)}))}function to(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=e.byteLength),r.LoaderUtils.decodeText(new Uint8Array(e,t,n))}function ro(e,t,r){return e.slice(0,t).concat(r).concat(e.slice(t))}function no(e){return(no="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function io(e,t){return(io=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function ao(e){return(ao=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var oo=/^[og]\s*(.+)?/,so=/^mtllib /,lo=/^usemtl /,uo=/^usemap /,co=/\s+/,ho=new r.Vector3,po=new r.Vector3,fo=new r.Vector3,mo=new r.Vector3,vo=new r.Vector3,go=new r.Color;function yo(){var e={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){var r;this.object&&!1===this.object.fromDeclaration?(this.object.name=e,this.object.fromDeclaration=!1!==t):(r=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0,this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:!1!==t,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(e,t){var r=this._finalize(!1);return r&&(r.inherited||r.groupCount<=0)&&this.materials.splice(r.index,1),e={index:this.materials.length,name:e||"",mtllib:Array.isArray(t)&&0<t.length?t[t.length-1]:"",smooth:(void 0!==r?r:this).smooth,groupStart:void 0!==r?r.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){return(e={index:"number"==typeof e?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1}).clone=this.clone.bind(e),e}},this.materials.push(e),e},currentMaterial:function(){if(0<this.materials.length)return this.materials[this.materials.length-1]},_finalize:function(e){var t=this.currentMaterial();if(t&&-1===t.groupEnd&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&1<this.materials.length)for(var r=this.materials.length-1;0<=r;r--)this.materials[r].groupCount<=0&&this.materials.splice(r,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},r&&r.name&&"function"==typeof r.clone&&((e=r.clone(0)).inherited=!0,this.object.materials.push(e)),this.objects.push(this.object))},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){return 3*(0<=(e=parseInt(e,10))?e-1:e+t/3)},parseNormalIndex:function(e,t){return 3*(0<=(e=parseInt(e,10))?e-1:e+t/3)},parseUVIndex:function(e,t){return 2*(0<=(e=parseInt(e,10))?e-1:e+t/2)},addVertex:function(e,t,r){var n=this.vertices,i=this.object.geometry.vertices;i.push(n[e+0],n[e+1],n[e+2]),i.push(n[t+0],n[t+1],n[t+2]),i.push(n[r+0],n[r+1],n[r+2])},addVertexPoint:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,r){var n=this.normals,i=this.object.geometry.normals;i.push(n[e+0],n[e+1],n[e+2]),i.push(n[t+0],n[t+1],n[t+2]),i.push(n[r+0],n[r+1],n[r+2])},addFaceNormal:function(e,t,r){var n=this.vertices,i=this.object.geometry.normals;ho.fromArray(n,e),po.fromArray(n,t),fo.fromArray(n,r),vo.subVectors(fo,po),mo.subVectors(ho,po),vo.cross(mo),vo.normalize(),i.push(vo.x,vo.y,vo.z),i.push(vo.x,vo.y,vo.z),i.push(vo.x,vo.y,vo.z)},addColor:function(e,t,r){var n=this.colors,i=this.object.geometry.colors;void 0!==n[e]&&i.push(n[e+0],n[e+1],n[e+2]),void 0!==n[t]&&i.push(n[t+0],n[t+1],n[t+2]),void 0!==n[r]&&i.push(n[r+0],n[r+1],n[r+2])},addUV:function(e,t,r){var n=this.uvs,i=this.object.geometry.uvs;i.push(n[e+0],n[e+1]),i.push(n[t+0],n[t+1]),i.push(n[r+0],n[r+1])},addDefaultUV:function(){var e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){var t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,r,n,i,a,o,s,l){var u=this.vertices.length;e=this.parseVertexIndex(e,u),t=this.parseVertexIndex(t,u),r=this.parseVertexIndex(r,u),this.addVertex(e,t,r),this.addColor(e,t,r),void 0!==o&&""!==o?(u=this.normals.length,e=this.parseNormalIndex(o,u),t=this.parseNormalIndex(s,u),r=this.parseNormalIndex(l,u),this.addNormal(e,t,r)):this.addFaceNormal(e,t,r),void 0!==n&&""!==n?(o=this.uvs.length,e=this.parseUVIndex(n,o),t=this.parseUVIndex(i,o),r=this.parseUVIndex(a,o),this.addUV(e,t,r),this.object.geometry.hasUVIndices=!0):this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";for(var t=this.vertices.length,r=0,n=e.length;r<n;r++){var i=this.parseVertexIndex(e[r],t);this.addVertexPoint(i),this.addColor(i)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";for(var r=this.vertices.length,n=this.uvs.length,i=0,a=e.length;i<a;i++)this.addVertexLine(this.parseVertexIndex(e[i],r));for(var o=0,s=t.length;o<s;o++)this.addUVLine(this.parseUVIndex(t[o],n))}};return e.startObject("",!1),e}var bo=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&io(t,e);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ao(e);if(r=t?(r=ao(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===no(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e){if(this instanceof i)return(e=n.call(this,e)).materials=null,e;throw new TypeError("Cannot call a class as a function")}return t=i,(e=[{key:"load",value:function(e,t,n,i){var a=this,o=new r.FileLoader(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(function(r){try{t(a.parse(r))}catch(r){i?i(r):console.error(r),a.manager.itemError(e)}}),n,i)}},{key:"setMaterials",value:function(e){return this.materials=e,this}},{key:"parse",value:function(e){for(var t=new yo,n=(e=-1!==(e=-1!==e.indexOf("\r\n")?e.replace(/\r\n/g,"\n"):e).indexOf("\\\n")?e.replace(/\\\n/g,""):e).split("\n"),i=[],a=0,o=n.length;a<o;a++){var s=n[a].trimStart();if(0!==s.length){var l,u=s.charAt(0);if("#"!==u)if("v"===u){var c=s.split(co);switch(c[0]){case"v":t.vertices.push(parseFloat(c[1]),parseFloat(c[2]),parseFloat(c[3])),7<=c.length?(go.setRGB(parseFloat(c[4]),parseFloat(c[5]),parseFloat(c[6])).convertSRGBToLinear(),t.colors.push(go.r,go.g,go.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(c[1]),parseFloat(c[2]),parseFloat(c[3]));break;case"vt":t.uvs.push(parseFloat(c[1]),parseFloat(c[2]))}}else if("f"===u){for(var h=s.slice(1).trim().split(co),d=[],p=0,f=h.length;p<f;p++){var m=h[p];0<m.length&&(m=m.split("/"),d.push(m))}for(var v=d[0],g=1,y=d.length-1;g<y;g++){var b=d[g],x=d[g+1];t.addFace(v[0],b[0],x[0],v[1],b[1],x[1],v[2],b[2],x[2])}}else if("l"===u){var w=s.substring(1).trim().split(" "),A=[],S=[];if(-1===s.indexOf("/"))A=w;else for(var M=0,B=w.length;M<B;M++){var C=w[M].split("/");""!==C[0]&&A.push(C[0]),""!==C[1]&&S.push(C[1])}t.addLineGeometry(A,S)}else"p"===u?(l=s.slice(1).trim().split(" "),t.addPointGeometry(l)):null!==(i=oo.exec(s))?(l=(" "+i[0].slice(1).trim()).slice(1),t.startObject(l)):lo.test(s)?t.object.startMaterial(s.substring(7).trim(),t.materialLibraries):so.test(s)?t.materialLibraries.push(s.substring(7).trim()):uo.test(s)?console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.'):"s"===u?(1<(i=s.split(" ")).length?(u=i[1].trim().toLowerCase(),t.object.smooth="0"!==u&&"off"!==u):t.object.smooth=!0,(u=t.object.currentMaterial())&&(u.smooth=t.object.smooth)):"\0"!==s&&console.warn('THREE.OBJLoader: Unexpected line: "'+s+'"')}}t.finalize();var _,E=new r.Group;if(1==(E.materialLibraries=[].concat(t.materialLibraries),e=!(1===t.objects.length&&0===t.objects[0].geometry.vertices.length)))for(var T=0,D=t.objects.length;T<D;T++){var P=t.objects[T],O=P.geometry,R=P.materials,I="Line"===O.type,k="Points"===O.type,L=!1;if(0!==O.vertices.length){for(var F=new r.BufferGeometry,U=(F.setAttribute("position",new r.Float32BufferAttribute(O.vertices,3)),0<O.normals.length&&F.setAttribute("normal",new r.Float32BufferAttribute(O.normals,3)),0<O.colors.length&&(L=!0,F.setAttribute("color",new r.Float32BufferAttribute(O.colors,3))),!0===O.hasUVIndices&&F.setAttribute("uv",new r.Float32BufferAttribute(O.uvs,2)),[]),G=0,j=R.length;G<j;G++){var N,H=R[G],z=H.name+"_"+H.smooth+"_"+L,V=t.materials[z];null!==this.materials&&(V=this.materials.create(H.name),!I||!V||V instanceof r.LineBasicMaterial?!k||!V||V instanceof r.PointsMaterial||(N=new r.PointsMaterial({size:10,sizeAttenuation:!1}),r.Material.prototype.copy.call(N,V),N.color.copy(V.color),N.map=V.map,V=N):(N=new r.LineBasicMaterial,r.Material.prototype.copy.call(N,V),N.color.copy(V.color),V=N)),void 0===V&&((V=I?new r.LineBasicMaterial:k?new r.PointsMaterial({size:1,sizeAttenuation:!1}):new r.MeshPhongMaterial).name=H.name,V.flatShading=!H.smooth,V.vertexColors=L,t.materials[z]=V),U.push(V)}if(O=void 0,1<U.length){for(var J=0,K=R.length;J<K;J++){var W=R[J];F.addGroup(W.groupStart,W.groupCount,J)}O=new(I?r.LineSegments:k?r.Points:r.Mesh)(F,U)}else O=new(I?r.LineSegments:k?r.Points:r.Mesh)(F,U[0]);O.name=P.name,E.add(O)}}else 0<t.vertices.length&&(e=new r.PointsMaterial({size:1,sizeAttenuation:!1}),(_=new r.BufferGeometry).setAttribute("position",new r.Float32BufferAttribute(t.vertices,3)),0<t.colors.length&&void 0!==t.colors[0]&&(_.setAttribute("color",new r.Float32BufferAttribute(t.colors,3)),e.vertexColors=!0),_=new r.Points(_,e),E.add(_));return E}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.Loader),xo=function(e,t,r,n){return new(r=r||Promise)((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(o,s)}l((n=n.apply(e,t||[])).next())}))};const wo=t.FBXLoader;class Ao{constructor(e){this.parses={fbx:new wo,obj:new bo,object:new r.ObjectLoader},this.runScene=e}getBack(e){return e.name.substring(e.name.lastIndexOf(".")+1).toLowerCase()}parseFiles(e){return Promise.all(e.map((e=>this.parse(e))))}parse(e){return xo(this,void 0,void 0,(function*(){let t;switch(this.getBack(e).toLowerCase()){case"gltf":case"glb":t=this.glb(e);break;case"fbx":t=this.fbx(e);break;case"obj":t=this.obj(e);break;case"json":t=this.json(e)}return this.runScene.modelEx.beforeLoad(yield t)}))}img(e){console.log(e,"file")}glb(e){return xo(this,void 0,void 0,(function*(){var t=yield(0,$t.toResult)(e,"arrayBuffer");let r="model";return t=yield this.runScene.loaderer.gltf.parse(t,{addToScene:!1,triggerCb:!0,getJSON(e){r=(null==(e=e.asset.ex)?void 0:e.type)||"scene"}}),{type:r,result:t}}))}fbx(e){return xo(this,void 0,void 0,(function*(){var t=e instanceof ArrayBuffer?e:yield(0,$t.toResult)(e,"arrayBuffer");return(t=this.parses.fbx.parse(t,"")).traverse((e=>{e.material&&(e.material=this.runScene.materialEx.create())})),{type:"model",result:this.runScene.sceneEx.cleanUnlessLevel(t)}}))}obj(e){return xo(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,$t.toResult)(e,"text"):e;return(t=this.parses.obj.parse(t)).traverse((e=>{e.material&&(e.material=this.runScene.materialEx.create())})),{type:"model",result:this.runScene.sceneEx.cleanUnlessLevel(t)}}))}json(e){return xo(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,$t.toResult)(e,"text"):e;return{type:"model",result:this.runScene.loaderer.json.parse(t)}}))}}class So extends V{constructor(e){super(e),this._lastRenderMode=null,this.setRenderMode=(()=>{let e=!1;const t=()=>{e||(this.runScene.cb.loaderer.gltf.loaded.add("global-config",(()=>{"controlsChange"===this._lastRenderMode&&this.runScene.render()})),this.runScene.cb.loaderer.gltf.complete.add("global-config",(()=>{"controlsChange"===this._lastRenderMode&&this.runScene.render()})),e=!0)},r=()=>{var{renderer:e,controls:t}=this.runScene.assetsEx,r=this.runScene.render;"tick"===this._lastRenderMode?e.setAnimationLoop(null):"controlsChange"===this._lastRenderMode&&t.removeEventListener("change",r)},n=e=>{var t=this.runScene.render,{renderer:r,controls:n}=this.runScene.assetsEx;"tick"===e?r.setAnimationLoop(t):"controlsChange"===e&&n.addEventListener("change",t)};return e=>{this._lastRenderMode!==e&&(t(),r(),n(e),this._lastRenderMode=e)}})()}setGlow(e){this.runScene.pp.bloomParams.isBloom=e}setRender2(e){this.runScene.assetsEx.setRender2(e)}setRender3(e){this.runScene.assetsEx.setRender3(e)}}class Mo extends A{constructor(e,t){super(e,t),this.transGizmo=this.children[0],this.scaleCoefficient=new r.Vector3,this.beginScale=new r.Vector3,this.posStart=new r.Vector2,this.posEnd=new r.Vector2,this.deleteRedundantParts()}deleteRedundantParts(){this.transGizmo.gizmo.translate.children.splice(1,1),this.transGizmo.gizmo.translate.children.splice(3,1),this.transGizmo.gizmo.translate.children.splice(5,1),this.transGizmo.gizmo.scale.children.splice(0,1),this.transGizmo.gizmo.scale.children.splice(2,1),this.transGizmo.gizmo.scale.children.splice(4,1)}pointerDown(e){void 0===this.object||null===this.axis||this.dragging||0!==e.button||(this.posStart.set(e.x,e.y),this.beginScale.set(this.object.scale.x,this.object.scale.y,this.object.scale.z),super.pointerDown(e))}pointerMove(e){if(super.pointerMove(e),void 0!==this.object&&null!==this.axis&&this.dragging&&-1===e.button&&"scale"===this.mode&&-1!==this.axis.search("XYZ")){this.posEnd.set(e.x,e.y),e=(Math.abs(this.beginScale.x)+Math.abs(this.beginScale.y)+Math.abs(this.beginScale.z))/3;let t=12*this.pointStart.distanceTo(this.pointEnd)/e;this.posEnd.x>this.posStart.x&&(t*=-1),(t=-1.1<t&&t<1.1?1:t)<0&&(t=-1.1/t),this.scaleCoefficient.set(t,t,t),this.object.scale.copy(this._scaleStart).multiply(this.scaleCoefficient)}}}class Bo extends r.Object3D{constructor(e){super(),this.isViewHelper=!0,this.animating=!1,this.controls=null,this.dummy=new r.Object3D,this.turnRate=2*Math.PI,this.targetPosition=new r.Vector3,this.targetQuaternion=new r.Quaternion,this.q1=new r.Quaternion,this.q2=new r.Quaternion,this.radius=0,this.clock=new r.Clock,this.runScene=e,e=this.runScene.assetsEx.get().controls,this.controls=e,this.runScene.cb.render.add("view-helper",(()=>{this.update(this.clock.getDelta())}))}prepareAnimationData(e){var t=this.runScene.assetsEx.get().camera,n=(console.log(e,"type"),this.controls.target);switch(e){case"posX":this.targetPosition.set(1,0,0),this.targetQuaternion.setFromEuler(new r.Euler(0,.5*Math.PI,0));break;case"posY":this.targetPosition.set(0,1,0),this.targetQuaternion.setFromEuler(new r.Euler(.5*-Math.PI,0,0));break;case"posZ":this.targetPosition.set(0,0,1),this.targetQuaternion.setFromEuler(new r.Euler);break;case"negX":this.targetPosition.set(-1,0,0),this.targetQuaternion.setFromEuler(new r.Euler(0,.5*-Math.PI,0));break;case"negY":this.targetPosition.set(0,-1,0),this.targetQuaternion.setFromEuler(new r.Euler(.5*Math.PI,0,0));break;case"negZ":this.targetPosition.set(0,0,-1),this.targetQuaternion.setFromEuler(new r.Euler(0,Math.PI,0));break;default:console.error("ViewHelper: Invalid axis.")}this.radius=t.position.distanceTo(n),this.targetPosition.multiplyScalar(this.radius).add(n),this.dummy.position.copy(n),this.dummy.lookAt(t.position),this.q1.copy(this.dummy.quaternion),this.dummy.lookAt(this.targetPosition),this.q2.copy(this.dummy.quaternion),this.animating=!0}update(e){var t,r;this.animating&&(t=this.runScene.assetsEx.get().camera,e*=this.turnRate,r=this.controls.target,this.q1.rotateTowards(this.q2,e),t.position.set(0,0,1).applyQuaternion(this.q1).multiplyScalar(this.radius).add(r),t.quaternion.rotateTowards(this.targetQuaternion,e),0===this.q1.angleTo(this.q2)&&(this.animating=!1))}}class Co{constructor(e){this.grid=null,this.transContro=null,this.boxHelper=null,this.deepIsHelper=e=>"Scene"===e.type||!this.isHelper(e)&&!!e.parent&&this.deepIsHelper(e.parent),this.getBoxHelper=e=>(e=new r.BoxHelper(e),this.setHelper(e),this.runScene.assetsEx.get().scene.add(e),e),this.runScene=e,"running"!==this.runScene.optionsEx.options.mode&&(this.transContro=new class{constructor(e){this.tansControls=null,this.controlsMode="position",this.isDraggingChange=!1,this.modelNewVal=new dt.Z.Vector3,this.transControlsStatusMap={position:"translate",rotation:"rotate",scale:"scale"},this.multipObj=null,this.draggingChanged=e=>{var t=this.runScene.assetsEx.get().controls,r=this.controlsMode,n=this.runScene.modelEx.select||this.runScene.multipSelector.getLast();n&&(this.runScene.multipSelector.draggingchanged(e),t.enabled?(this.modelNewVal=this.runScene.modelEx.cloneV3(n[r]),this.isDraggingChange=!0):(this.runScene.multipSelector.isEmpty()&&this.runScene.modelEx.setV3({model:n,info:r,newV3:this.runScene.modelEx.cloneV3(n[r]),oldV3:this.modelNewVal},!0,!1),this.isDraggingChange=!1),this.runScene.assetsEx.get().controls.enabled=!e.value)},this.runScene=e}init(){var{camera:e,renderer:t,scene:r}=this.runScene.assetsEx.get();this.tansControls=new Mo(e,t.domElement),this.tansControls.addEventListener("dragging-changed",this.draggingChanged),this.tansControls.addEventListener("change",this.transChangeFn.bind(this)),this.tansControls.name="helper",r.add(this.tansControls),this.tansControls.traverse((e=>e.isHelper=!0))}changeMode(e){this.controlsMode=e,this.tansControls.setMode(this.transControlsStatusMap[e])}transControSize(e){this.tansControls.setSize(e?this.tansControls.size+.1:Math.max(this.tansControls.size-.1,.1))}changeState(e){this.tansControls.enabled=e}addObject(e){this.removeFocus(),this.tansControls.attach(e)}removeFocus(){this.tansControls.detach()}changeSpaceState(){this.tansControls.setSpace("local"===this.tansControls.space?"world":"local"),this.tansControls.detach()}transChangeFn(e){var t=this.runScene.modelEx.select;t&&(this.runScene.lightEx.update(t),this.runScene.helperEx.boxHelper.setFromObject(t)),this.runScene.multipSelector.transChange(),this.runScene.cb.tranControls.changing.cb(t)}close(){this.tansControls.enabled=!1}open(){this.tansControls.enabled=!0}reset(){this.dispose(),this.init()}dispose(){this.tansControls&&(this.tansControls.removeEventListener("dragging-changed",this.draggingChanged),this.tansControls.removeEventListener("change",this.transChangeFn),this.tansControls.dispose(),this.runScene.assetsEx.get().scene.remove(this.tansControls))}}(e),this.viewHelper=new Bo(e),this.grid=this.createGrid(),this.init())}init(){this.transContro.init(),this.runScene.assetsEx.get().scene.add(this.grid)}createGrid(){var e=new dt.Z.GridHelper(20,10);return e.name="helper",e.position.y=0,e.material.opacity=.75,e.material.transparent=!0,e}dispose(){}reset(){"running"!==this.runScene.optionsEx.options.mode&&this.transContro.reset()}isHelper(e){return"GridHelper"===e.type||"CubeCamera"===e.type||e.isTransformControls||e.userData.isHelper}setHelper(e,t=!1,r){return e.userData.isHelper=!0,t&&e.traverse((e=>{e.userData.isHelper=!0,r&&r(e)})),e}focus(e){"running"!==this.runScene.optionsEx.options.mode&&(this.boxHelper||(this.boxHelper=this.getBoxHelper(e)),this.transContro.addObject(e),this.boxHelper.setFromObject(e),this.focusModelId=this.runScene.uniqueEx.getId(e))}unfocus(){var e;"running"!==this.runScene.optionsEx.options.mode&&(this.transContro.removeFocus(),null!=(e=this.boxHelper)&&e.setFromObject(this.runScene.assetsEx.get().scene),this.focusModelId=void 0)}}br=__webpack_require__(4356);var _o=__webpack_require__.n(br),Eo=__webpack_require__(3185),To=__webpack_require__(2510),Do=__webpack_require__(4380),Po=__webpack_require__(7453);class Oo{constructor(e){this.selectors={},this.boxHelperMap={},this.savedV3=new ht.Z,this.tempOldval=new Es.Vector3,this.runScene=e}add(e,t=!1){if("array"===(0,Eo.getType)(e))return e.map((e=>this.add(e)));var r=this.runScene.modelEx.select;if(r&&(this.runScene.modelEx.selectNull(),delete this.selectors[e.uuid],this.add(r)),"BoxHelper"!==e.type){if(this.selectors[e.uuid]){if(this.remove(e),this.removeBoxHelper(e),!t)return;this.add(e)}this.addBoxHelper(e),this.selectors[e.uuid]=e,this.runScene.cb.model.focus.cb({model:e,status:!0,domActive:!0}),this.runScene.helperEx.focus(e)}}setInfo(e,t,r,n,i,a){"position"!==t&&(i=n,a=r);var o=this.getSelectedList("value"),{x:i,y:s,z:l}=i;const u=i-a.x,c=s-a.y,h=l-a.z,d=[new Do.Z({target:e,info:t,oldV3:this.runScene.modelEx.cloneV3(r),newV3:n,runScene:this.runScene}).execute()];o.map((r=>{var n,i,a,o;r!==e&&(({x:o,y:n,z:i}=r[t]),o=o+=u,n=n+=c,i=i+=h,(a=r[t].clone()).x=o,a.y=n,a.z=i,o=new Do.Z({target:r,info:t,oldV3:this.runScene.modelEx.cloneV3(r[t]),newV3:a,runScene:this.runScene}).execute(),d.push(o),this.boxHelperMap[r.uuid].setFromObject(r))})),this.boxHelperMap[e.uuid].setFromObject(e),this.runScene.undoEx.addUndo(d)}draggingchanged(e){var t,r=this.runScene.assetsEx.get().controls;this.isEmpty()?this.runScene.events.mouse.enableUp=!0:this.runScene.events.mouse.enableUp=!1,e.value?this.isEmpty()||(r.enabled=!1,e=this.getLast(),t=this.runScene.helperEx.transContro.controlsMode,this.tempOldval="position"===t?(0,Po.VU)(e,this.runScene.sceneEx.get()):this.runScene.modelEx.cloneV3(e[t]),this.saveV3(t)):r.enabled||this.isEmpty()||(this.runScene.events.mouse.enableUp=!1,this.useV3())}transChange(){if(!this.isEmpty()&&!this.runScene.assetsEx.controls.enabled){var e=this.runScene.helperEx.transContro.controlsMode,t=this.getLast();let r;this.runScene.events.mouse.enableUp=!1,this.runScene.helperEx.boxHelper.setFromObject(this.runScene.assetsEx.get().scene),r="position"===e?(0,Po.VU)(t,this.runScene.sceneEx.get()):this.runScene.modelEx.cloneV3(t[e]),this.getInfo({model:t,type:e,newV3:r,oldV3:this.tempOldval}),this.tempOldval.copy(r)}}saveV3(e){this.getSelectedList("value").map((t=>{var r=(0,kt.K)(t);this.savedV3.set(r,{model:t,type:e,val:this.runScene.modelEx.cloneV3(t[e])})}))}useV3(){var e=this.savedV3.map(((e,{type:t,val:r,model:n})=>new Do.Z({target:n,info:t,newV3:this.runScene.modelEx.cloneV3(n[t]),oldV3:r,runScene:this.runScene})));this.runScene.undoEx.addUndo(e),this.savedV3.clear()}getInfo(e){const{model:t,type:r,newV3:n,oldV3:i}=e;e=this.getSelectedList("value");var{x:a,y:o,z:s}=n;const l=a-i.x,u=o-i.y,c=s-i.z;t[r].copy(n),e.map((e=>{var n,i,a,o;e!==t&&(({x:n,y:i,z:a}=e[r]),n=n+=l,i=i+=u,a=a+=c,(o=e[r].clone()).x=n,o.y=i,o.z=a,e[r].copy(o),this.boxHelperMap[e.uuid].setFromObject(e))})),this.boxHelperMap[t.uuid].setFromObject(t)}getLast(){var e=this.getSelectedList("value");return e[e.length-1]}addBoxHelper(e){var t=this.runScene.helperEx.getBoxHelper(e);this.boxHelperMap[e.uuid]=t}removeBoxHelper(e){this.runScene.assetsEx.get().scene.remove(this.boxHelperMap[e.uuid]),this.boxHelperMap[e.uuid]=null,delete this.selectors[e.uuid]}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));this.runScene.cb.model.unFocus.cb(e),this.selectors[e.uuid]=null,delete this.selectors[e.uuid]}isEmpty(){return 0===this.getSelectedList("key").length}getSelectedList(e){return"key"===e?Object.keys(this.selectors):Object.values(this.selectors)}getSelect(){var e=Object.values(this.selectors);return 0!==e.length?e:void 0}selectedLoop(e){return Object.keys(this.selectors).map((t=>e(t,this.selectors[t])))}delete(){this.setBoxHelperEmpty(),this.setEmpty(),this.runScene.helperEx.unfocus()}setBoxHelperEmpty(){var e=Object.values(this.boxHelperMap);this.runScene.assetsEx.get().scene.remove(...e),this.boxHelperMap={}}setEmpty(){this.isEmpty()||(this.getSelectedList("value").map((e=>{this.runScene.cb.model.unFocus.cb(e)})),this.setBoxHelperEmpty(),this.selectors={},this.runScene.cb.model.multiSelect.setEmpty.cb())}createGroup(){this.runScene.helperEx.unfocus(),this.runScene.modelEx.selectNull();var e=new r.Group,t=new r.Group,n=(this.runScene.modelEx.add(e,void 0,{addUndo:!1}),this.runScene.modelEx.add(t),[...this.getSelectedList("value")]),i=(this.runScene.cb.model.multipDrop.cb({models:this.getSelectedList("value"),dropModel:e}),_o().group.getCenter(e));t.position.copy(i),this.runScene.cb.model.multipDrop.cb({models:n,dropModel:t}),this.runScene.modelEx.remove(e,!1),this.runScene.modelEx.select=t}getSelectorGroup(){var e=this.getSelectedList("value");const t=new r.Group;return e.forEach((e=>t.add(e.clone()))),this.setEmpty(),t}rename(e){const{prefix:t,rmPrefixLength:r,back:n,rmBackLength:i,fullName:a,step:o}=e;0!==(e=this.getSelectedList("value")).length&&(e=e.map(((e,s)=>{let l=e.name;if(0===a.length){if(0!==r){if(r>l.length)return;l=l.substring(r)}if(0!==i){if(i>l.length)return;l=l.substring(0,l.length-i)}0<t.length&&(l=t+l),0<n.length&&(l+=n)}else l=a+(s+1)*o;return new To.Z({target:e,info:"name",newVal:l,oldVal:e.name,runScene:this.runScene}).execute()})),this.runScene.undoEx.addUndo(e))}}function Ro(){var e=0,t=document.createElement("div");function r(e){return t.appendChild(e.dom),e}function n(r){for(var n=0;n<t.children.length;n++)t.children[n].style.display=n===r?"block":"none";e=r}t.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",t.addEventListener("click",(function(r){r.preventDefault(),n(++e%t.children.length)}),!1);var i,a=(performance||Date).now(),o=a,s=0,l=r(new Ro.Panel("FPS","#0ff","#002")),u=r(new Ro.Panel("MS","#0f0","#020"));return self.performance&&self.performance.memory&&(i=r(new Ro.Panel("MB","#f08","#201"))),n(0),{REVISION:16,dom:t,addPanel:r,showPanel:n,begin:function(){a=(performance||Date).now()},end:function(){s++;var e,t=(performance||Date).now();return u.update(t-a,200),o+1e3<=t&&(l.update(1e3*s/(t-o),100),o=t,s=0,i&&(e=performance.memory,i.update(e.usedJSHeapSize/1048576,e.jsHeapSizeLimit/1048576))),t},update:function(){a=this.end()},domElement:t,setMode:n}}Ro.Panel=function(e,t,r){var n=1/0,i=0,a=Math.round,o=a(window.devicePixelRatio||1),s=80*o,l=48*o,u=3*o,c=2*o,h=3*o,d=15*o,p=74*o,f=30*o,m=document.createElement("canvas"),v=(m.width=s,m.height=l,m.style.cssText="width:80px;height:48px",m.getContext("2d"));return v.font="bold "+9*o+"px Helvetica,Arial,sans-serif",v.textBaseline="top",v.fillStyle=r,v.fillRect(0,0,s,l),v.fillStyle=t,v.fillText(e,u,c),v.fillRect(h,d,p,f),v.fillStyle=r,v.globalAlpha=.9,v.fillRect(h,d,p,f),{dom:m,update:function(l,g){n=Math.min(n,l),i=Math.max(i,l),v.fillStyle=r,v.globalAlpha=1,v.fillRect(0,0,s,d),v.fillStyle=t,v.fillText(a(l)+" "+e+" ("+a(n)+"-"+a(i)+")",u,c),v.drawImage(m,h+o,d,p-o,f,h,d,p-o,f),v.fillRect(h+p-o,d,o,f),v.fillStyle=r,v.globalAlpha=.9,v.fillRect(h+p-o,d,o,a((1-l/g)*f))}}};const Io=Ro;class ko{constructor(e){this.options={msg:{show:!1,level:"base"},run:!0,decodePath:"./draco/",showFps:!1,loadInterval:2e3,mode:"running",hideLocal:!1,instanceClone:!0,render2:!1,render3:!1,coverSameId:!1,renderConfig:{mode:"tick",frame:-1,scriptFrame:-1,matrixAutoUpdate:!1},texture:{load:!0,lazyLoad:{open:!1,intervalTime:16.6},quality:1}},this.exporterOptions={compressTexture:!1,notMaterial:!1,outTime:(0,he.getTime)(7)},this.sceneOptions={loaded:!1},this.setLoadInterval=(()=>{let e=null;return t=>{const{inputInterval:r,cb:n}=t;e&&clearTimeout(e),e=setTimeout((()=>{n(),e=null,clearTimeout(e)}),r)}})(),this.runScene=e}init(e){this.options=(0,he.deepMergeObject)(this.options,e||{}),this.options.showFps&&(this.addFps(),this.runScene.cb.render.add("optionx-ex-render",this.render.bind(this)))}addFps(){this.stats=Io(),this.stats.showPanel(0),this.runScene.assetsEx.engineDom.appendChild(this.stats.dom)}render(){var e;null!=(e=this.stats)&&e.update()}log(e,t="detail",r="success"){var n;null!=(n=null==(n=this.options)?void 0:n.msg)&&n.show&&("base"===this.options.msg.level&&"base"===t&&this.runScene.cb.baseLog.cb({msg:e,type:r}),console.log(e))}}var Lo=__webpack_require__(7738);class Fo extends V{constructor(e){super(e),this.map=new ht.Z,this.playLimit=new vt.cM,this.renderName="script-texture-render",this._clock=new r.Clock,this.bindEvent()}parse(e,t){var r=(0,kt.K)(t);0===Object.keys(e).length?this.map.has(r)&&this.map.delete(r):this.map.set(r,{texture:t,uvScript:e})}bindEvent(){this.runScene.cb.texture.setAnima.add("script-texture-set-anima",(({uvScript:e,texture:t})=>this.parse(e,t))),this.runScene.cb.texture.add.add("script-texture-add-texture",(e=>{var t=e.userData.uvScript;t&&this.parse(t,e)}))}_playAll(){this.map.forEach((e=>{var{texture:e,uvScript:t}=e,{moveX:t,moveY:r,rotate:n}=t;t&&(e.offset.x+=t),r&&(e.offset.y+=r),n&&(e.rotation+=n)}))}playAll(){const{scriptFrame:e,mode:t}=this.runScene.optionsEx.options.renderConfig;-1===e&&"tick"===t?this.runScene.cb.render.add(this.renderName,(()=>{this._playAll()})):this.runScene.cb.render.add(this.renderName,(()=>{this.playLimit.update({cb:()=>{this._playAll()},cbRate:1/e,now:this._clock.getDelta()})}))}closeAll(){this.map.forEach((e=>{var{texture:e,uvScript:t}=e,{moveX:t,moveY:r,rotate:n}=t;0!==t&&(e.offset.x=0),0!==r&&(e.offset.y=0),0!==n&&(e.rotation=0)})),this.runScene.cb.render.delete(this.renderName)}}class Uo extends V{constructor(e){super(e),this.runAll=!1,this.texture=new Fo(e)}playAll(){this.runAll||(this.runAll=!0,this.texture.playAll())}closeAll(){this.runAll&&(this.runAll=!1,this.texture.closeAll())}}var Go=__webpack_require__(4298);class jo{constructor(e,t){this.showTransform=!1,this.data=new Proxy({},{set:(e,t,r)=>(e[t]=r,!0)}),this.uuid="",this.getAnimaByModelData=(()=>{const e=(e,t,r,n)=>{const i={},a={};if(e=jo.isNotNow(e)?this.getAllData():e,(0,z.js)(n,((r,n)=>{void 0!==e[r]&&("number"===(n=n.type)?(i[r]=t[r],a[r]=e[r]):"color"===n&&(0,z.js)(e[r],((e,n)=>{var o=r+e;i[o]=t[r][e],a[o]=n})))})),!(0,z.CV)(i))return{begin:i,end:a}};return(t,r,n,i=!1,a)=>{let o=i?n.time:0;var s=Object.keys(t).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t))),l=(0,Go.lastArrayEle)(s),u=i?"0.00":String(n.time);return l!==u&&(t[u]=Object.assign({},l),s.push(u)),s.map((s=>{var l=t[String(s)],u=.001*((u=i?o-s:s-o)<=0?.001:u)*n.speed;o=s;{var c=r,h=l,d=u,p=a;const t={color(e){const{animaData:t,defType:r}=e,n={};(0,z.js)(t,(e=>{var i;-1!==e.indexOf(r)&&(i=e.substring(r.length),["r","g","b"].includes(i)&&(n[i]=t[e]))}));var{r:e,g:i,b:a}=n;if(e&&i&&a)return n}};return()=>{let r;return{promise:new Promise((n=>{var i,a=e(h,c,0,p);return a?(({begin:a,end:i}=a),r=(0,he.anima)(a,i,d,(e=>{(0,z.js)(p,((r,n)=>{n=n.type;var i,a=e[r];"number"===n?c[r]=a:"color"===n&&(a=t.color({animaData:e,defType:r}))&&(({r:n,g:a,b:i}=a),c[r].setRGB(n,a,i))}))}),n)):n(0)})),anima:r}}}}))}})(),this.runScene=t,this.target=e,this.target.userData.isTimeLineUsed=!0,this.uuid=this.getId(e)}toJSON(){var{data:e,type:t}=this;return{data:e,type:t}}addData(e,t,r=!1){return 1e3<Number(e)&&(e="1000.00"),r?this.data[e]=this.getAllData():(this.data[e]||(this.data[e]={}),this.data[e][t]=this.getData(t)),this.data[e]}addTriggerNowData(e){return this.data[e]=this.getAllData(!0)}removeData(e){delete this.data[e]}static isNotNow(e){return"notNow"===Object.values(e)[0]}static getAllDefValByType(e,t,r=!1){const n={};return(0,z.js)(e,(i=>{n[i]=r?"notNow":jo.getValByType(t,i,e)})),n}static getValByType(e,t,r){var n,i;return r=r[t].type,e=e[t],"number"===r?e:"color"===r?(({r:t,g:n,b:i}=e),{r:t,g:n,b:i}):"V3"===r?_o().model.v3ToMap(e):""}static SetTargetByData(e){var t,{baseType:e,data:r,defType:n,target:i}=e;"number"===e?i[n]=r:"color"===e&&(({r:e,g:r,b:t}=r),i[n].setRGB(e,r,t))}getAllData(e=!1){return jo.getAllDefValByType(this.defOptions,this.target,e)}getData(e){return jo.getValByType(this.target,e,this.defOptions)}static getTarget(e,t){}getAnima(e,t){return this.getAnimaByModelData(this.data,this.target,e,t,this.defOptions)}setTargetByBetween(e,t,r){jo.setTargetByBetween(e,t,r,this.defOptions,this.target)}clone(e){var t,{data:r,type:t}=this;return(t=new Ho[t](e)).data=r,t}reset(){(0,z.js)(this.defOptions,((e,t)=>{jo.SetTargetByData({baseType:t.type,data:jo.getValByType(this.beginData,e,this.defOptions),target:this.target,defType:e})}))}remove(){delete this.target.userData.isTimeLineUsed}}jo.setTargetByBetween=(()=>{const e=(e,t,r)=>e!==t?(t-e)*r+e:e;return(t,r,n,i,a)=>{(0,z.js)(i,((i,o)=>{var s,l,u,c,h,d;o=o.type,void 0!==t[i]&&void 0!==r[i]&&jo.SetTargetByData({baseType:o,data:(s=t[i],l=r[i],u=n,"number"===o?e(s,l,u):"color"===o?(({r:o,g:s,b:c}=s),({r:l,g:h,b:d}=l),{r:e(o,l,u),g:e(s,h,u),b:e(c,d,u)}):void 0),defType:i,target:a})}))}})();const No=jo,Ho={model:class extends No{constructor(e,t){super(e,t),this.type="model",this.defOptions={position:{type:"V3"},scale:{type:"V3"},rotation:{type:"V3"}},this.setTargetByBetween=(()=>{const e=(e,t,r)=>{var{x:e,y:n,z:i}=e,{x:t,y:a,z:o}=t;return{x:e!==t?(t-e)*r+e:e,y:n!==a?(a-n)*r+n:n,z:i!==o?(o-i)*r+i:i}};return(t,r,n)=>{var i,{position:t,scale:a,rotation:o}=t,{position:r,scale:s,rotation:l}=r;t&&r&&(({x:t,y:r,z:i}=e(t,r,n)),this.target.position.set(t,r,i)),a&&s&&(({x:t,y:r,z:i}=e(a,s,n)),this.target.scale.set(t,r,i)),o&&l&&(({x:a,y:s,z:t}=e(o,l,n)),this.target.rotation.set(a,s,t))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,r)=>{var{position:t,scale:n,rotation:i}=t,{position:e,scale:a,rotation:o}=No.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},a?{sx:n.x,sy:n.y,sz:n.z}:{},o?{rx:i.x,ry:i.y,rz:i.z}:{}),end:Object.assign({},r.curve?{ease:"none"}:{},e?{px:e.x,py:e.y,pz:e.z}:{},a?{sx:a.x,sy:a.y,sz:a.z}:{},o?{rx:o.x,ry:o.y,rz:o.z}:{})}};return(t,r,n,i=!1)=>{let a=i?n.time:0;var o=Object.keys(t).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t))),s=(0,Go.lastArrayEle)(o),l=i?"0.00":String(n.time)+".00";return s!==l&&(t[l]={position:"notNow",rotation:"notNow",scale:"notNow"},o.push(l)),o.map((o=>{var s,l,u,c,h=t[String(o)],d=.001*((d=i?a-o:o-a)<=0?.001:d)*n.speed;return a=o,s=r,l=h,u=d,c=n,()=>{let t;return{promise:new Promise((r=>{var{begin:n,end:i}=e(l,s,c);return t=(0,he.anima)(n,i,u,(e=>{var{px:e,py:t,pz:r,sx:n,sy:i,sz:a,rx:o,ry:u,rz:c}=e;l.position&&s.position.set(e,t,r),l.scale&&s.scale.set(n,i,a),l.rotation&&s.rotation.set(o,u,c)}),r)})),anima:t}}}))}})(),this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.model.get(e)}isRemoved(){return!(this.target&&this.target.parent)}getAnima(e,t=!1){return this.getAnimaByModelData(this.data,this.target,e,t)}getId(){return this.runScene.uniqueEx.getId(this.target)}reset(){var{position:e,scale:t,rotation:r}=this.beginData;this.target.position.set(e.x,e.y,e.z),this.target.scale.set(t.x,t.y,t.z),this.target.rotation.set(r.x,r.y,r.z)}},camera:class extends No{constructor(e,t){super(e,t),this.type="camera",this.defOptions={position:{type:"V3"},scale:{type:"V3"},rotation:{type:"V3"},target:{type:"V3"}},this.setTargetByBetween=(()=>{const e=(e,t,r)=>{var{x:e,y:n,z:i}=e,{x:t,y:a,z:o}=t;return{x:e!==t?(t-e)*r+e:e,y:n!==a?(a-n)*r+n:n,z:i!==o?(o-i)*r+i:i}};return(t,r,n)=>{var i,{position:t,scale:a,rotation:o,target:s}=t,{position:r,scale:l,rotation:u,target:c}=r;t&&r&&(({x:t,y:r,z:i}=e(t,r,n)),this.target.position.set(t,r,i)),a&&l&&(({x:t,y:r,z:i}=e(a,l,n)),this.target.scale.set(t,r,i)),o&&u&&(({x:a,y:l,z:t}=e(o,u,n)),this.target.rotation.set(a,l,t)),s&&c&&(({x:r,y:i,z:o}=e(s,c,n)),this.controls.target.set(r,i,o))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,r)=>{var{position:t,scale:n,rotation:i}=t,{position:e,scale:a,rotation:o,target:s}=No.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},a?{sx:n.x,sy:n.y,sz:n.z}:{},o?{rx:i.x,ry:i.y,rz:i.z}:{},s?{tx:this.controls.target.x,ty:this.controls.target.y,tz:this.controls.target.z}:{}),end:Object.assign({},r.curve?{ease:"none"}:{},e?{px:e.x,py:e.y,pz:e.z}:{},a?{sx:a.x,sy:a.y,sz:a.z}:{},o?{rx:o.x,ry:o.y,rz:o.z}:{},s?{tx:s.x,ty:s.y,tz:s.z}:{})}},t=(t,r,n,i)=>()=>{let a;return{promise:new Promise((o=>{var{begin:s,end:l}=e(r,t,i);return a=(0,he.anima)(s,l,n,(e=>{var{px:e,py:n,pz:i,sx:a,sy:o,sz:s,rx:l,ry:u,rz:c,tx:h,ty:d,tz:p}=e;r.position&&t.position.set(e,n,i),r.scale&&t.scale.set(a,o,s),r.rotation&&t.rotation.set(l,u,c),r.target&&this.controls.target.set(h,d,p)}),o)})),anima:he.anima}};return(e,r,n,i=!1)=>{let a=i?n.time:0;var o=Object.keys(e).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t))),s=(0,Go.lastArrayEle)(o),l=i?"0.00":String(n.time);return s!==l&&(e[l]=Object.assign({},s),o.push(l)),o.map((o=>{var s=e[String(o)],l=.001*((l=i?a-o:o-a)<=0?.001:l)*n.speed;return a=o,t(r,s,l,n)}))}})(),this.controls=this.runScene.assetsEx.get().controls,this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.model.get(e)}getBeginData(e){return this.getAllData()}isRemoved(){return!this.target}getAllData(e=!1){var{position:t,scale:r,rotation:n}=this.target;return{position:e?"notNow":_o().model.v3ToMap(t),scale:e?"notNow":_o().model.v3ToMap(r),rotation:e?"notNow":_o().model.v3ToMap(n),target:e?"notNow":_o().model.v3ToMap(this.controls.target)}}getData(e){var{position:t,scale:r,rotation:n}=this.target;let i;if("position"===e)i=_o().model.v3ToMap(t);else if("scale"===e)i=_o().model.v3ToMap(r);else if("rotation"===e)i=_o().model.v3ToMap(n);else{if("target"!==e)throw TypeError("输入值不存在");i=_o().model.v3ToMap(this.controls.target)}return i}getAnima(e,t=!1){return this.getAnimaByModelData(this.data,this.target,e,t)}getId(){return this.runScene.uniqueEx.getId(this.target)}reset(){var{position:e,scale:t,rotation:r,target:n}=this.beginData;this.target.position.set(e.x,e.y,e.z),this.target.scale.set(t.x,t.y,t.z),this.target.rotation.set(r.x,r.y,r.z),this.controls.target.set(n.x,n.y,n.z)}},material:class extends No{constructor(e,t){super(e,t),this.type="material",this.defOptions={roughness:{type:"number"},metalness:{type:"number"},opacity:{type:"number"},emissive:{type:"color"},color:{type:"color"}},this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.material.get(e)}isRemoved(){return!0}getId(){return this.runScene.uniqueEx.getId(this.target)}}};var zo=__webpack_require__(6651);class Vo{constructor(e){this.glowModelLength=new Set,this.outlineModelLength=new Set,this.runScene=e,this.initGlow(),this.initOutline()}initGlow(){var{setLayers:e,add:t,remove:r}=this.runScene.cb.model;e.add("pp-set-glow",(e=>{var{model:e,val:t}=e;0===t&&0===this.glowModelLength.size||this[0===t?"glowRemove":"glowAdd"](e)})),t.add("pp-set-glow",(({model:e})=>{1!==e.layers.mask&&this.glowAdd(e)})),r.add("pp-set-glow",(({model:e})=>{1!==e.layers.mask&&this.glowRemove(e)}))}glowAdd(e){this.glowModelLength.add(e.userData.id),0<this.glowModelLength.size&&(this.runScene.cb.pp.glow.setStatus.cb(!0).then(),this.runScene.pp.bloomParams.isBloom=!0)}glowRemove(e){this.glowModelLength.delete(e.userData.id),this.glowModelLength.size<=0&&(this.runScene.cb.pp.glow.setStatus.cb(!1).then(),this.runScene.pp.bloomParams.isBloom=!1)}initOutline(){var{setOutline:e,add:t,remove:r}=this.runScene.cb.model;e.add("pp-set-outline",(e=>{var{model:e,val:t}=e;!t&&0===this.outlineModelLength.size||this[t?"outlineAdd":"outlineRemove"](e)})),t.add("pp-set-outline",(({model:e})=>{1!==e.layers.mask&&this.outlineAdd(e)})),r.add("pp-set-outline",(({model:e})=>{1!==e.layers.mask&&this.outlineRemove(e)}))}outlineAdd(e){this.outlineModelLength.add(e.userData.id),0<this.outlineModelLength.size&&(this.runScene.cb.pp.outline.setStatus.cb(!0).then(),this.runScene.pp.outlineParams.isOutline=!0)}outlineRemove(e){this.outlineModelLength.delete(e.userData.id),this.outlineModelLength.size<=0&&(this.runScene.cb.pp.outline.setStatus.cb(!1).then(),this.runScene.pp.outlineParams.isOutline=!1)}}var Jo={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform float opacity;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tgl_FragColor = texture2D( tDiffuse, vUv );\n\t\t\tgl_FragColor.a *= opacity;\n\n\n\t\t}"},Ko=__webpack_require__(5180),Wo=__webpack_require__(4819),Qo={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new r.Color(0)},defaultOpacity:{value:0}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform vec3 defaultColor;\n\t\tuniform float defaultOpacity;\n\t\tuniform float luminosityThreshold;\n\t\tuniform float smoothWidth;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\n\t\t\tvec3 luma = vec3( 0.299, 0.587, 0.114 );\n\n\t\t\tfloat v = dot( texel.xyz, luma );\n\n\t\t\tvec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );\n\n\t\t\tfloat alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );\n\n\t\t\tgl_FragColor = mix( outputColor, texel, alpha );\n\n\t\t}"};function Xo(e){return(Xo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Zo(e,t){return(Zo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Yo(e){return(Yo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var qo=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Zo(t,e);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Yo(e);if(r=t?(r=Yo(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Xo(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e,t,a,o){var s;if(!(this instanceof i))throw new TypeError("Cannot call a class as a function");(s=n.call(this)).strength=void 0!==t?t:1,s.radius=a,s.threshold=o,s.resolution=void 0!==e?new r.Vector2(e.x,e.y):new r.Vector2(256,256),s.clearColor=new r.Color(0,0,0),s.renderTargetsHorizontal=[],s.renderTargetsVertical=[],s.nMips=5;var l=Math.round(s.resolution.x/2),u=Math.round(s.resolution.y/2);s.renderTargetBright=new r.WebGLRenderTarget(l,u),s.renderTargetBright.texture.name="UnrealBloomPass.bright",s.renderTargetBright.texture.generateMipmaps=!1;for(var c=0;c<s.nMips;c++){var h;((h=new r.WebGLRenderTarget(l,u)).texture.name="UnrealBloomPass.h"+c,h.texture.generateMipmaps=!1,s.renderTargetsHorizontal.push(h),h=new r.WebGLRenderTarget(l,u)).texture.name="UnrealBloomPass.v"+c,h.texture.generateMipmaps=!1,s.renderTargetsVertical.push(h),l=Math.round(l/2),u=Math.round(u/2)}a=Qo;for(var d=(s.highPassUniforms=r.UniformsUtils.clone(a.uniforms),s.highPassUniforms.luminosityThreshold.value=o,s.highPassUniforms.smoothWidth.value=.01,s.materialHighPassFilter=new r.ShaderMaterial({uniforms:s.highPassUniforms,vertexShader:a.vertexShader,fragmentShader:a.fragmentShader,defines:{}}),s.separableBlurMaterials=[],[3,5,7,9,11]),p=(l=Math.round(s.resolution.x/2),u=Math.round(s.resolution.y/2),0);p<s.nMips;p++)s.separableBlurMaterials.push(s.getSeperableBlurMaterial(d[p])),s.separableBlurMaterials[p].uniforms.texSize.value=new r.Vector2(l,u),l=Math.round(l/2),u=Math.round(u/2);return s.compositeMaterial=s.getCompositeMaterial(s.nMips),s.compositeMaterial.uniforms.blurTexture1.value=s.renderTargetsVertical[0].texture,s.compositeMaterial.uniforms.blurTexture2.value=s.renderTargetsVertical[1].texture,s.compositeMaterial.uniforms.blurTexture3.value=s.renderTargetsVertical[2].texture,s.compositeMaterial.uniforms.blurTexture4.value=s.renderTargetsVertical[3].texture,s.compositeMaterial.uniforms.blurTexture5.value=s.renderTargetsVertical[4].texture,s.compositeMaterial.uniforms.bloomStrength.value=t,s.compositeMaterial.uniforms.bloomRadius.value=.1,s.compositeMaterial.needsUpdate=!0,s.compositeMaterial.uniforms.bloomFactors.value=[1,.8,.6,.4,.2],s.bloomTintColors=[new r.Vector3(1,1,1),new r.Vector3(1,1,1),new r.Vector3(1,1,1),new r.Vector3(1,1,1),new r.Vector3(1,1,1)],s.compositeMaterial.uniforms.bloomTintColors.value=s.bloomTintColors,e=Jo,s.copyUniforms=r.UniformsUtils.clone(e.uniforms),s.copyUniforms.opacity.value=1,s.materialCopy=new r.ShaderMaterial({uniforms:s.copyUniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,blending:r.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0}),s.enabled=!0,s.needsSwap=!1,s._oldClearColor=new r.Color,s.oldClearAlpha=1,s.basic=new r.MeshBasicMaterial,s.fsQuad=new Wo.T(null),s}return t=i,(e=[{key:"dispose",value:function(){for(var e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(var t=0;t<this.renderTargetsVertical.length;t++)this.renderTargetsVertical[t].dispose();this.renderTargetBright.dispose()}},{key:"setSize",value:function(e,t){var n=Math.round(e/2),i=Math.round(t/2);this.renderTargetBright.setSize(n,i);for(var a=0;a<this.nMips;a++)this.renderTargetsHorizontal[a].setSize(n,i),this.renderTargetsVertical[a].setSize(n,i),this.separableBlurMaterials[a].uniforms.texSize.value=new r.Vector2(n,i),n=Math.round(n/2),i=Math.round(i/2)}},{key:"render",value:function(e,t,r,n,a){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();for(var o=e.autoClear,s=(e.autoClear=!1,e.setClearColor(this.clearColor,0),a&&e.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=r.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=r.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this.fsQuad.render(e),this.renderTargetBright),l=0;l<this.nMips;l++)this.fsQuad.material=this.separableBlurMaterials[l],this.separableBlurMaterials[l].uniforms.colorTexture.value=s.texture,this.separableBlurMaterials[l].uniforms.direction.value=i.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[l]),e.clear(),this.fsQuad.render(e),this.separableBlurMaterials[l].uniforms.colorTexture.value=this.renderTargetsHorizontal[l].texture,this.separableBlurMaterials[l].uniforms.direction.value=i.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[l]),e.clear(),this.fsQuad.render(e),s=this.renderTargetsVertical[l];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,a&&e.state.buffers.stencil.setTest(!0),this.renderToScreen?e.setRenderTarget(null):e.setRenderTarget(r),this.fsQuad.render(e),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=o}},{key:"getSeperableBlurMaterial",value:function(e){return new r.ShaderMaterial({defines:{KERNEL_RADIUS:e,SIGMA:e},uniforms:{colorTexture:{value:null},texSize:{value:new r.Vector2(.5,.5)},direction:{value:new r.Vector2(.5,.5)}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec2 direction;\n\n\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\n\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n\t\t\t\t}\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tfloat fSigma = float(SIGMA);\n\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, fSigma);\n\t\t\t\t\tvec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum;\n\t\t\t\t\tfor( int i = 1; i < KERNEL_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = float(i);\n\t\t\t\t\t\tfloat w = gaussianPdf(x, fSigma);\n\t\t\t\t\t\tvec2 uvOffset = direction * invSize * x;\n\t\t\t\t\t\tvec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb;\n\t\t\t\t\t\tvec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb;\n\t\t\t\t\t\tdiffuseSum += (sample1 + sample2) * w;\n\t\t\t\t\t\tweightSum += 2.0 * w;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n\t\t\t\t}"})}},{key:"getCompositeMaterial",value:function(e){return new r.ShaderMaterial({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\t\t\t\tuniform sampler2D blurTexture1;\n\t\t\t\tuniform sampler2D blurTexture2;\n\t\t\t\tuniform sampler2D blurTexture3;\n\t\t\t\tuniform sampler2D blurTexture4;\n\t\t\t\tuniform sampler2D blurTexture5;\n\t\t\t\tuniform float bloomStrength;\n\t\t\t\tuniform float bloomRadius;\n\t\t\t\tuniform float bloomFactors[NUM_MIPS];\n\t\t\t\tuniform vec3 bloomTintColors[NUM_MIPS];\n\n\t\t\t\tfloat lerpBloomFactor(const in float factor) {\n\t\t\t\t\tfloat mirrorFactor = 1.2 - factor;\n\t\t\t\t\treturn mix(factor, mirrorFactor, bloomRadius);\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tgl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );\n\t\t\t\t}"})}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(Wo.w);qo.BlurDirectionX=new r.Vector2(1,0),qo.BlurDirectionY=new r.Vector2(0,1);class $o extends Wo.w{constructor(e,t,n){super(),this.baseTextureID=void 0!==t?t:"tDiffuse",this.effectTextureID=void 0!==n?n:"tDiffuse",e instanceof r.ShaderMaterial?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=r.UniformsUtils.clone(e.uniforms),this.material=new r.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new Wo.T(this.material)}render(e,t,r){this.uniforms[this.baseTextureID]&&(this.uniforms[this.baseTextureID].value=t.texture),this.uniforms[this.effectTextureID]&&(this.uniforms[this.effectTextureID].value=r.texture),this.fsQuad.material=this.material,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)),this.fsQuad.render(e)}}class es extends Wo.w{constructor(e,t,n,i,a){super(),this.scene=e,this.camera=t,this.layerIndex=0,this.overrideMaterial=n,this.clearColor=i,this.clearAlpha=void 0!==a?a:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.oldClearColor=new r.Color,this.oldCameraLayer=t.layers.mask}render(e,t,r){var n=e.autoClear;let i,a;e.autoClear=!1,void 0!==this.overrideMaterial&&(a=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this.oldClearColor),i=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.sceneBg&&(this.scene.background=null),e.setRenderTarget(this.renderToScreen?null:r),this.clear&&e.clear(e.autoClearColor,this.clearDepth,e.autoClearStencil),this.camera.layers.set(this.layerIndex),e.render(this.scene,this.camera),this.camera.layers.mask=this.oldCameraLayer,this.scene.background=this.sceneBg,this.clearColor&&e.setClearColor(this.oldClearColor,i),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=a),this.scene.background=this.sceneBg,e.autoClear=n}}const ts={uniforms:{baseTexture:{value:null},bloomTexture:{value:null}},vertexShader:"\n varying vec2 vUv;\n \n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform sampler2D baseTexture;\n uniform sampler2D bloomTexture;\n \n varying vec2 vUv;\n \n void main() {\n vec4 lastColor = texture2D(baseTexture, vUv);\n \n // gl_FragColor = lastColor;\n // gl_FragColor = texture2D(bloomTexture, vUv);\n gl_FragColor = lastColor + texture2D(bloomTexture, vUv);\n }\n "};class rs{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.bloomRenderPass?(this.bloomRenderPass.scene=this.mtuPP.mainScene,this.bloomRenderPass.camera=this.mtuPP.mainCamera):(this.bloomRenderPass=new es(this.mtuPP.mainScene,this.mtuPP.mainCamera),this.bloomRenderPass.layerIndex=this.mtuPP.BLOOM_SCENE,this.bloomRenderPass.clearDepth=!1),this.bloomPass?this.bloomPass.setSize(this.mtuPP.rtSize.x,this.mtuPP.rtSize.y):this.bloomPass=new qo(this.mtuPP.rtSize,1.5,.4,.85),this.bloomPass.radius=this.mtuPP.bloomParams.radius,this.bloomPass.strength=this.mtuPP.bloomParams.strength,this.bloomPass.threshold=this.mtuPP.bloomParams.threshold,this.mixingPass||(this.mixingPass=new $o(ts,"baseTexture","bloomTexture"),this.mixingPass.renderToScreen=!1),this.effectCopy||(this.effectCopy=new Ko.T(Jo),this.effectCopy.clear=!1,this.effectCopy.renderToScreen=!1,this.effectCopy.needsSwap=!1,this.effectCopy.material.depthWrite=!1),this.mtuPP.effectComposer.addPass(this.effectCopy),this.mtuPP.effectComposer.addPass(this.bloomRenderPass),this.mtuPP.effectComposer.addPass(this.bloomPass),this.mtuPP.effectComposer.addPass(this.mixingPass)}setGlowData(e,t){this.bloomPass[e]=t}dispose(){this.bloomRenderPass=null,this.bloomPass&&(this.bloomPass.dispose(),this.bloomPass=null),this.mixingPass=null,this.effectCopy=null}setSceneBg(){this.bloomRenderPass&&(this.bloomRenderPass.sceneBg=this.mtuPP.sceneBackground)}enablePass(e){this.bloomRenderPass&&this.bloomRenderPass.enabled!==e&&(this.bloomRenderPass.enabled=e,this.bloomPass.enabled=e,this.mixingPass.enabled=e,this.effectCopy.enabled=e)}}function ns(e){return(ns="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function is(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function as(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function os(e,t,r){t&&as(e.prototype,t),r&&as(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function ss(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ls(e,t)}function ls(e,t){return(ls=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function us(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=cs(e);if(r=t?(r=cs(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===ns(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function cs(e){return(cs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var hs=function(){ss(t,Wo.w);var e=us(t);function t(r,n){var i;return is(this,t),(i=e.call(this)).scene=r,i.camera=n,i.clear=!0,i.needsSwap=!1,i.inverse=!1,i}return os(t,[{key:"render",value:function(e,t,r){var n,i,a=e.getContext(),o=e.state;o.buffers.color.setMask(!1),o.buffers.depth.setMask(!1),o.buffers.color.setLocked(!0),o.buffers.depth.setLocked(!0),i=this.inverse?(n=0,1):(n=1,0),o.buffers.stencil.setTest(!0),o.buffers.stencil.setOp(a.REPLACE,a.REPLACE,a.REPLACE),o.buffers.stencil.setFunc(a.ALWAYS,n,4294967295),o.buffers.stencil.setClear(i),o.buffers.stencil.setLocked(!0),e.setRenderTarget(r),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),o.buffers.color.setLocked(!1),o.buffers.depth.setLocked(!1),o.buffers.stencil.setLocked(!1),o.buffers.stencil.setFunc(a.EQUAL,1,4294967295),o.buffers.stencil.setOp(a.KEEP,a.KEEP,a.KEEP),o.buffers.stencil.setLocked(!0)}}]),t}(),ds=function(){ss(t,Wo.w);var e=us(t);function t(){var r;return is(this,t),(r=e.call(this)).needsSwap=!1,r}return os(t,[{key:"render",value:function(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}]),t}();function ps(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var fs=function(){function e(t,n){var i;(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.renderer=t,void 0===n?(i=t.getSize(new r.Vector2),this._pixelRatio=t.getPixelRatio(),this._width=i.width,this._height=i.height,(n=new r.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio)).texture.name="EffectComposer.rt1"):(this._pixelRatio=1,this._width=n.width,this._height=n.height),this.renderTarget1=n,this.renderTarget2=n.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],void 0===Ko.T&&console.error("THREE.EffectComposer relies on ShaderPass"),this.copyPass=new Ko.T(Jo),this.clock=new r.Clock}return function(e,t,r){t&&ps(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1})}(e,[{key:"swapBuffers",value:function(){var e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}},{key:"addPass",value:function(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}},{key:"insertPass",value:function(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}},{key:"removePass",value:function(e){-1!==(e=this.passes.indexOf(e))&&this.passes.splice(e,1)}},{key:"isLastEnabledPass",value:function(e){for(var t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}},{key:"render",value:function(e){void 0===e&&(e=this.clock.getDelta());for(var t=this.renderer.getRenderTarget(),r=!1,n=0,i=this.passes.length;n<i;n++){var a,o,s=this.passes[n];!1!==s.enabled&&(s.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(n),s.render(this.renderer,this.writeBuffer,this.readBuffer,e,r),s.needsSwap&&(r&&(a=this.renderer.getContext(),(o=this.renderer.state.buffers.stencil).setFunc(a.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),o.setFunc(a.EQUAL,1,4294967295)),this.swapBuffers()),void 0!==hs&&(s instanceof hs?r=!0:s instanceof ds&&(r=!1)))}this.renderer.setRenderTarget(t)}},{key:"reset",value:function(e){var t;void 0===e&&(t=this.renderer.getSize(new r.Vector2),this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,(e=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)),this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}},{key:"setSize",value:function(e,t){this._width=e,this._height=t;var r=this._width*this._pixelRatio,n=this._height*this._pixelRatio;this.renderTarget1.setSize(r,n),this.renderTarget2.setSize(r,n);for(var i=0;i<this.passes.length;i++)this.passes[i].setSize(r,n)}},{key:"setPixelRatio",value:function(e){this._pixelRatio=e,this.setSize(this._width,this._height)}}]),e}();new r.OrthographicCamera(-1,1,1,-1,0,1),(yr=new r.BufferGeometry).setAttribute("position",new r.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),yr.setAttribute("uv",new r.Float32BufferAttribute([0,2,0,0,2,0],2));const ms="\n varying vec2 vUv;\n \n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",vs="\n uniform sampler2D baseTexture;\n uniform sampler2D bloomTexture;\n \n varying vec2 vUv;\n \n void main() {\n gl_FragColor = (texture2D(baseTexture, vUv) + vec4(1.0) * texture2D(bloomTexture, vUv));\n }\n ";class gs{constructor(e){this.mtuPP=e,this.bloomLayer=new Es.Layers,this.bloomLayer.set(this.mtuPP.BLOOM_SCENE),this.darkMaterial=new Es.MeshBasicMaterial({color:"black"}),this.materials={},(e=this.mtuPP.mainScene).fog&&(this.mtuPP.sceneFogColor||(this.mtuPP.sceneFogColor=new Es.Color),this.mtuPP.sceneFogColor.copy(e.fog.color)),e.background&&(this.mtuPP.sceneBackground=e.background),this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.bloomPass=new qo(this.mtuPP.rtSize,1.5,.4,.85),this.bloomPass.radius=this.mtuPP.bloomParams.radius,this.bloomPass.strength=this.mtuPP.bloomParams.strength,this.bloomPass.threshold=this.mtuPP.bloomParams.threshold,this.mtuPP.effectComposer.addPass(this.bloomPass),this.finalPass=new Ko.T(new Es.ShaderMaterial({uniforms:{baseTexture:{value:null},bloomTexture:{value:this.mtuPP.effectComposer.renderTarget2.texture}},vertexShader:ms,fragmentShader:vs,defines:{}}),"baseTexture"),this.finalPass.needsSwap=!0;var e=new Es.WebGLRenderTarget(this.mtuPP.rtSize.x,this.mtuPP.rtSize.y,{samples:this.mtuPP.ppParams.samples});this.finalComposer=new fs(this.mtuPP.renderer,e),this.finalComposer.addPass(this.mtuPP.renderPass),this.finalComposer.addPass(this.finalPass)}renderBloom(e){var t;this.mtuPP.sceneFogColor&&null!=(t=this.mtuPP.mainScene.fog)&&t.color.copy(this.mtuPP.BLACK_COLOR),this.mtuPP.sceneBackground&&(this.mtuPP.mainScene.background=this.mtuPP.BLACK_COLOR),e?(this.mtuPP.mainScene.traverse((e=>{e.isMesh&&!this.bloomLayer.test(e.layers)&&(this.materials[e.uuid]=e.material,e.material=this.darkMaterial)})),this.mtuPP.effectComposer.render(),this.mtuPP.mainScene.traverse((e=>{this.materials[e.uuid]&&(e.material=this.materials[e.uuid],delete this.materials[e.uuid])}))):(this.mtuPP.mainCamera.layers.set(this.mtuPP.BLOOM_SCENE),this.mtuPP.effectComposer.render(),this.mtuPP.mainCamera.layers.set(this.mtuPP.ENTIRE_SCENE)),this.mtuPP.sceneFogColor&&null!=(t=this.mtuPP.mainScene.fog)&&t.color.copy(this.mtuPP.sceneFogColor),this.mtuPP.sceneBackground&&(this.mtuPP.mainScene.background=this.mtuPP.sceneBackground)}render(){this.renderBloom(!0),this.finalComposer.render()}setGlowData(e,t){this.bloomPass[e]=t}setSize(e,t){this.finalComposer&&this.finalComposer.setSize(e,t)}dispose(){this.bloomPass&&(this.bloomPass.dispose(),this.bloomPass=null),this.finalPass=null,this.finalComposer&&(this.finalComposer.renderTarget1&&(this.finalComposer.renderTarget1.dispose(),this.finalComposer.renderTarget1=null),this.finalComposer.renderTarget2&&(this.finalComposer.renderTarget2.dispose(),this.finalComposer.renderTarget2=null),this.finalComposer=null)}enablePass(e){this.bloomPass&&this.bloomPass.enabled!==e&&(this.bloomPass.enabled=e,this.finalPass.enabled=e)}}function ys(e){return(ys="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function bs(e,t){return(bs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function xs(e){return(xs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ws=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&bs(t,e);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=xs(e);if(r=t?(r=xs(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===ys(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e,t,a,o){var s;if(!(this instanceof i))throw new TypeError("Cannot call a class as a function");return(s=n.call(this)).renderScene=t,s.renderCamera=a,s.selectedObjects=void 0!==o?o:[],s.visibleEdgeColor=new r.Color(1,1,1),s.hiddenEdgeColor=new r.Color(.1,.04,.02),s.edgeGlow=0,s.usePatternTexture=!1,s.edgeThickness=1,s.edgeStrength=3,s.downSampleRatio=2,s.pulsePeriod=0,s._visibilityCache=new Map,s.resolution=void 0!==e?new r.Vector2(e.x,e.y):new r.Vector2(256,256),t=Math.round(s.resolution.x/s.downSampleRatio),a=Math.round(s.resolution.y/s.downSampleRatio),s.renderTargetMaskBuffer=new r.WebGLRenderTarget(s.resolution.x,s.resolution.y),s.renderTargetMaskBuffer.texture.name="OutlinePass.mask",s.renderTargetMaskBuffer.texture.generateMipmaps=!1,s.depthMaterial=new r.MeshDepthMaterial,s.depthMaterial.side=r.DoubleSide,s.depthMaterial.depthPacking=r.RGBADepthPacking,s.depthMaterial.blending=r.NoBlending,s.prepareMaskMaterial=s.getPrepareMaskMaterial(),s.prepareMaskMaterial.side=r.DoubleSide,s.prepareMaskMaterial.fragmentShader=function(e,t){return t=t.isPerspectiveCamera?"perspective":"orthographic",e.replace(/DEPTH_TO_VIEW_Z/g,t+"DepthToViewZ")}(s.prepareMaskMaterial.fragmentShader,s.renderCamera),s.renderTargetDepthBuffer=new r.WebGLRenderTarget(s.resolution.x,s.resolution.y),s.renderTargetDepthBuffer.texture.name="OutlinePass.depth",s.renderTargetDepthBuffer.texture.generateMipmaps=!1,s.renderTargetMaskDownSampleBuffer=new r.WebGLRenderTarget(t,a),s.renderTargetMaskDownSampleBuffer.texture.name="OutlinePass.depthDownSample",s.renderTargetMaskDownSampleBuffer.texture.generateMipmaps=!1,s.renderTargetBlurBuffer1=new r.WebGLRenderTarget(t,a),s.renderTargetBlurBuffer1.texture.name="OutlinePass.blur1",s.renderTargetBlurBuffer1.texture.generateMipmaps=!1,s.renderTargetBlurBuffer2=new r.WebGLRenderTarget(Math.round(t/2),Math.round(a/2)),s.renderTargetBlurBuffer2.texture.name="OutlinePass.blur2",s.renderTargetBlurBuffer2.texture.generateMipmaps=!1,s.edgeDetectionMaterial=s.getEdgeDetectionMaterial(),s.renderTargetEdgeBuffer1=new r.WebGLRenderTarget(t,a),s.renderTargetEdgeBuffer1.texture.name="OutlinePass.edge1",s.renderTargetEdgeBuffer1.texture.generateMipmaps=!1,s.renderTargetEdgeBuffer2=new r.WebGLRenderTarget(Math.round(t/2),Math.round(a/2)),s.renderTargetEdgeBuffer2.texture.name="OutlinePass.edge2",s.renderTargetEdgeBuffer2.texture.generateMipmaps=!1,s.separableBlurMaterial1=s.getSeperableBlurMaterial(4),s.separableBlurMaterial1.uniforms.texSize.value.set(t,a),s.separableBlurMaterial1.uniforms.kernelRadius.value=1,s.separableBlurMaterial2=s.getSeperableBlurMaterial(4),s.separableBlurMaterial2.uniforms.texSize.value.set(Math.round(t/2),Math.round(a/2)),s.separableBlurMaterial2.uniforms.kernelRadius.value=4,s.overlayMaterial=s.getOverlayMaterial(),o=Jo,s.copyUniforms=r.UniformsUtils.clone(o.uniforms),s.copyUniforms.opacity.value=1,s.materialCopy=new r.ShaderMaterial({uniforms:s.copyUniforms,vertexShader:o.vertexShader,fragmentShader:o.fragmentShader,blending:r.NoBlending,depthTest:!1,depthWrite:!1,transparent:!0}),s.enabled=!0,s.needsSwap=!1,s._oldClearColor=new r.Color,s.oldClearAlpha=1,s.fsQuad=new Wo.T(null),s.tempPulseColor1=new r.Color,s.tempPulseColor2=new r.Color,s.textureMatrix=new r.Matrix4,s}return t=i,(e=[{key:"dispose",value:function(){this.renderTargetMaskBuffer.dispose(),this.renderTargetDepthBuffer.dispose(),this.renderTargetMaskDownSampleBuffer.dispose(),this.renderTargetBlurBuffer1.dispose(),this.renderTargetBlurBuffer2.dispose(),this.renderTargetEdgeBuffer1.dispose(),this.renderTargetEdgeBuffer2.dispose()}},{key:"setSize",value:function(e,t){this.renderTargetMaskBuffer.setSize(e,t),this.renderTargetDepthBuffer.setSize(e,t),e=Math.round(e/this.downSampleRatio),t=Math.round(t/this.downSampleRatio),this.renderTargetMaskDownSampleBuffer.setSize(e,t),this.renderTargetBlurBuffer1.setSize(e,t),this.renderTargetEdgeBuffer1.setSize(e,t),this.separableBlurMaterial1.uniforms.texSize.value.set(e,t),e=Math.round(e/2),t=Math.round(t/2),this.renderTargetBlurBuffer2.setSize(e,t),this.renderTargetEdgeBuffer2.setSize(e,t),this.separableBlurMaterial2.uniforms.texSize.value.set(e,t)}},{key:"changeVisibilityOfSelectedObjects",value:function(e){var t=this._visibilityCache;function r(r){r.isMesh&&(!0===e?r.visible=t.get(r):(t.set(r,r.visible),r.visible=e))}for(var n=0;n<this.selectedObjects.length;n++)this.selectedObjects[n].traverse(r)}},{key:"changeVisibilityOfNonSelectedObjects",value:function(e){var t=this._visibilityCache,r=[];function n(e){e.isMesh&&r.push(e)}for(var i=0;i<this.selectedObjects.length;i++)this.selectedObjects[i].traverse(n);this.renderScene.traverse((function(n){if(n.isMesh||n.isSprite){for(var i,a=!1,o=0;o<r.length;o++)if(r[o].id===n.id){a=!0;break}!1===a&&(i=n.visible,!1!==e&&!0!==t.get(n)||(n.visible=e),t.set(n,i))}else(n.isPoints||n.isLine)&&(!0===e?n.visible=t.get(n):(t.set(n,n.visible),n.visible=e))}))}},{key:"updateTextureMatrix",value:function(){this.textureMatrix.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),this.textureMatrix.multiply(this.renderCamera.projectionMatrix),this.textureMatrix.multiply(this.renderCamera.matrixWorldInverse)}},{key:"render",value:function(e,t,r,n,a){var o,s;0<this.selectedObjects.length&&(e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha(),o=e.autoClear,e.autoClear=!1,a&&e.state.buffers.stencil.setTest(!1),e.setClearColor(16777215,1),this.changeVisibilityOfSelectedObjects(!1),s=this.renderScene.background,this.renderScene.background=null,this.renderScene.overrideMaterial=this.depthMaterial,e.setRenderTarget(this.renderTargetDepthBuffer),e.clear(),e.render(this.renderScene,this.renderCamera),this.changeVisibilityOfSelectedObjects(!0),this._visibilityCache.clear(),this.updateTextureMatrix(),this.changeVisibilityOfNonSelectedObjects(!1),this.renderScene.overrideMaterial=this.prepareMaskMaterial,this.prepareMaskMaterial.uniforms.cameraNearFar.value.set(this.renderCamera.near,this.renderCamera.far),this.prepareMaskMaterial.uniforms.depthTexture.value=this.renderTargetDepthBuffer.texture,this.prepareMaskMaterial.uniforms.textureMatrix.value=this.textureMatrix,e.setRenderTarget(this.renderTargetMaskBuffer),e.clear(),e.render(this.renderScene,this.renderCamera),this.renderScene.overrideMaterial=null,this.changeVisibilityOfNonSelectedObjects(!0),this._visibilityCache.clear(),this.renderScene.background=s,this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetMaskBuffer.texture,e.setRenderTarget(this.renderTargetMaskDownSampleBuffer),e.clear(),this.fsQuad.render(e),this.tempPulseColor1.copy(this.visibleEdgeColor),this.tempPulseColor2.copy(this.hiddenEdgeColor),0<this.pulsePeriod&&(s=.625+.75*Math.cos(.01*performance.now()/this.pulsePeriod)/2,this.tempPulseColor1.multiplyScalar(s),this.tempPulseColor2.multiplyScalar(s)),this.fsQuad.material=this.edgeDetectionMaterial,this.edgeDetectionMaterial.uniforms.maskTexture.value=this.renderTargetMaskDownSampleBuffer.texture,this.edgeDetectionMaterial.uniforms.texSize.value.set(this.renderTargetMaskDownSampleBuffer.width,this.renderTargetMaskDownSampleBuffer.height),this.edgeDetectionMaterial.uniforms.visibleEdgeColor.value=this.tempPulseColor1,this.edgeDetectionMaterial.uniforms.hiddenEdgeColor.value=this.tempPulseColor2,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial1,this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=i.BlurDirectionX,this.separableBlurMaterial1.uniforms.kernelRadius.value=this.edgeThickness,e.setRenderTarget(this.renderTargetBlurBuffer1),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetBlurBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=i.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial2,this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial2.uniforms.direction.value=i.BlurDirectionX,e.setRenderTarget(this.renderTargetBlurBuffer2),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetBlurBuffer2.texture,this.separableBlurMaterial2.uniforms.direction.value=i.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer2),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.overlayMaterial,this.overlayMaterial.uniforms.maskTexture.value=this.renderTargetMaskBuffer.texture,this.overlayMaterial.uniforms.edgeTexture1.value=this.renderTargetEdgeBuffer1.texture,this.overlayMaterial.uniforms.edgeTexture2.value=this.renderTargetEdgeBuffer2.texture,this.overlayMaterial.uniforms.patternTexture.value=this.patternTexture,this.overlayMaterial.uniforms.edgeStrength.value=this.edgeStrength,this.overlayMaterial.uniforms.edgeGlow.value=this.edgeGlow,this.overlayMaterial.uniforms.usePatternTexture.value=this.usePatternTexture,a&&e.state.buffers.stencil.setTest(!0),e.setRenderTarget(r),this.fsQuad.render(e),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=o),this.renderToScreen&&(this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=r.texture,e.setRenderTarget(null),this.fsQuad.render(e))}},{key:"getPrepareMaskMaterial",value:function(){return new r.ShaderMaterial({uniforms:{depthTexture:{value:null},cameraNearFar:{value:new r.Vector2(.5,.5)},textureMatrix:{value:null}},vertexShader:"#include <morphtarget_pars_vertex>\n\t\t\t\t#include <skinning_pars_vertex>\n\n\t\t\t\tvarying vec4 projTexCoord;\n\t\t\t\tvarying vec4 vPosition;\n\t\t\t\tuniform mat4 textureMatrix;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\t#include <skinbase_vertex>\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <morphtarget_vertex>\n\t\t\t\t\t#include <skinning_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t\tvPosition = mvPosition;\n\t\t\t\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\t\t\t\t\tprojTexCoord = textureMatrix * worldPosition;\n\n\t\t\t\t}",fragmentShader:"#include <packing>\n\t\t\t\tvarying vec4 vPosition;\n\t\t\t\tvarying vec4 projTexCoord;\n\t\t\t\tuniform sampler2D depthTexture;\n\t\t\t\tuniform vec2 cameraNearFar;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tfloat depth = unpackRGBAToDepth(texture2DProj( depthTexture, projTexCoord ));\n\t\t\t\t\tfloat viewZ = - DEPTH_TO_VIEW_Z( depth, cameraNearFar.x, cameraNearFar.y );\n\t\t\t\t\tfloat depthTest = (-vPosition.z > viewZ) ? 1.0 : 0.0;\n\t\t\t\t\tgl_FragColor = vec4(0.0, depthTest, 1.0, 1.0);\n\n\t\t\t\t}"})}},{key:"getEdgeDetectionMaterial",value:function(){return new r.ShaderMaterial({uniforms:{maskTexture:{value:null},texSize:{value:new r.Vector2(.5,.5)},visibleEdgeColor:{value:new r.Vector3(1,1,1)},hiddenEdgeColor:{value:new r.Vector3(1,1,1)}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\n\t\t\t\tuniform sampler2D maskTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec3 visibleEdgeColor;\n\t\t\t\tuniform vec3 hiddenEdgeColor;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tvec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\n\t\t\t\t\tvec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy);\n\t\t\t\t\tvec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy);\n\t\t\t\t\tvec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw);\n\t\t\t\t\tvec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw);\n\t\t\t\t\tfloat diff1 = (c1.r - c2.r)*0.5;\n\t\t\t\t\tfloat diff2 = (c3.r - c4.r)*0.5;\n\t\t\t\t\tfloat d = length( vec2(diff1, diff2) );\n\t\t\t\t\tfloat a1 = min(c1.g, c2.g);\n\t\t\t\t\tfloat a2 = min(c3.g, c4.g);\n\t\t\t\t\tfloat visibilityFactor = min(a1, a2);\n\t\t\t\t\tvec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;\n\t\t\t\t\tgl_FragColor = vec4(edgeColor, 1.0) * vec4(d);\n\t\t\t\t}"})}},{key:"getSeperableBlurMaterial",value:function(e){return new r.ShaderMaterial({defines:{MAX_RADIUS:e},uniforms:{colorTexture:{value:null},texSize:{value:new r.Vector2(.5,.5)},direction:{value:new r.Vector2(.5,.5)},kernelRadius:{value:1}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec2 direction;\n\t\t\t\tuniform float kernelRadius;\n\n\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\n\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tfloat sigma = kernelRadius/2.0;\n\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, sigma);\n\t\t\t\t\tvec4 diffuseSum = texture2D( colorTexture, vUv) * weightSum;\n\t\t\t\t\tvec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS);\n\t\t\t\t\tvec2 uvOffset = delta;\n\t\t\t\t\tfor( int i = 1; i <= MAX_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = kernelRadius * float(i) / float(MAX_RADIUS);\n\t\t\t\t\t\tfloat w = gaussianPdf(x, sigma);\n\t\t\t\t\t\tvec4 sample1 = texture2D( colorTexture, vUv + uvOffset);\n\t\t\t\t\t\tvec4 sample2 = texture2D( colorTexture, vUv - uvOffset);\n\t\t\t\t\t\tdiffuseSum += ((sample1 + sample2) * w);\n\t\t\t\t\t\tweightSum += (2.0 * w);\n\t\t\t\t\t\tuvOffset += delta;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = diffuseSum/weightSum;\n\t\t\t\t}"})}},{key:"getOverlayMaterial",value:function(){return new r.ShaderMaterial({uniforms:{maskTexture:{value:null},edgeTexture1:{value:null},edgeTexture2:{value:null},patternTexture:{value:null},edgeStrength:{value:1},edgeGlow:{value:1},usePatternTexture:{value:0}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\n\t\t\t\tuniform sampler2D maskTexture;\n\t\t\t\tuniform sampler2D edgeTexture1;\n\t\t\t\tuniform sampler2D edgeTexture2;\n\t\t\t\tuniform sampler2D patternTexture;\n\t\t\t\tuniform float edgeStrength;\n\t\t\t\tuniform float edgeGlow;\n\t\t\t\tuniform bool usePatternTexture;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 edgeValue1 = texture2D(edgeTexture1, vUv);\n\t\t\t\t\tvec4 edgeValue2 = texture2D(edgeTexture2, vUv);\n\t\t\t\t\tvec4 maskColor = texture2D(maskTexture, vUv);\n\t\t\t\t\tvec4 patternColor = texture2D(patternTexture, 6.0 * vUv);\n\t\t\t\t\tfloat visibilityFactor = 1.0 - maskColor.g > 0.0 ? 1.0 : 0.5;\n\t\t\t\t\tvec4 edgeValue = edgeValue1 + edgeValue2 * edgeGlow;\n\t\t\t\t\tvec4 finalColor = edgeStrength * maskColor.r * edgeValue;\n\t\t\t\t\tif(usePatternTexture)\n\t\t\t\t\t\tfinalColor += + visibilityFactor * (1.0 - maskColor.r) * (1.0 - patternColor.r);\n\t\t\t\t\tgl_FragColor = finalColor;\n\t\t\t\t}",blending:r.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0})}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(Wo.w);ws.BlurDirectionX=new r.Vector2(1,0),ws.BlurDirectionY=new r.Vector2(0,1);class As{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.outlinePass||(this.outlinePass=new ws(this.mtuPP.rtSize,this.mtuPP.mainScene,this.mtuPP.mainCamera)),this.mtuPP.effectComposer.addPass(this.outlinePass)}setOutlineData(e,t){this.outlinePass[e]=t}dispose(){this.outlinePass&&(this.outlinePass.dispose(),this.outlinePass=null)}addSelectedObject(e,t=!0){this.outlinePass&&e&&(this.outlinePass.selectedObjects||(this.outlinePass.selectedObjects=[]),t?this.isObjExist(e)||this.outlinePass.selectedObjects.push(e):this.outlinePass.selectedObjects.map(((t,r)=>{t.uuid===e.uuid&&this.outlinePass.selectedObjects.splice(r,1)})))}isObjExist(e){if(!e||!this.outlinePass||!this.outlinePass.selectedObjects)return!1;let t=!1;return this.outlinePass.selectedObjects.forEach((r=>{e.uuid===r.uuid&&(t=!0)})),t}enablePass(e){this.outlinePass&&this.outlinePass.enabled!==e&&(this.outlinePass.enabled=e)}}function Ss(e){return(Ss="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ms(e,t){return(Ms=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Bs(e){return(Bs=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Cs=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ms(t,e);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Bs(e);if(r=t?(r=Bs(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Ss(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e,t,a,o,s){var l;if(this instanceof i)return(l=n.call(this)).scene=e,l.camera=t,l.overrideMaterial=a,l.clearColor=o,l.clearAlpha=void 0!==s?s:0,l.clear=!0,l.clearDepth=!1,l.needsSwap=!1,l._oldClearColor=new r.Color,l;throw new TypeError("Cannot call a class as a function")}return t=i,(e=[{key:"render",value:function(e,t,r){var n,i,a=e.autoClear;e.autoClear=!1,void 0!==this.overrideMaterial&&(i=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this._oldClearColor),n=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:r),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor&&e.setClearColor(this._oldClearColor,n),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=i),e.autoClear=a}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(Wo.w);class _s{constructor(e){this.ppParams={samples:2},this.bloomParams={isBloom:!1,radius:.6,strength:1.5,threshold:0},this.outlineParams={isOutline:!1,edgeStrength:3,edgeGlow:0,edgeThickness:1,pulsePeriod:0,visibleEdgeColor:"#FFFFFF",hiddenEdgeColor:"#190A05"},this.ENTIRE_SCENE=0,this.BLOOM_SCENE=1,this.BLACK_COLOR=new Es.Color(0),this.runScene=e,this.info=new Vo(this.runScene),this.isSafari=-1<navigator.userAgent.indexOf("Safari"),this.isChrome=-1<navigator.userAgent.indexOf("Chrome"),this.rtSize=new Es.Vector2,this.sceneFogColor=null,this.sceneBackground=null,this.isUpdate=!0,this.runScene.exporter.gltf.options.addOption({type:"post-processing",process:e=>this.toJSON(),parse:e=>{e=JSON.parse(e),this.fromJSON(e)}}),this.runScene.cb.setScene.add("post-processing",(({type:e,val:t})=>{"fog"===e&&t&&(this.sceneFogColor?this.sceneFogColor.copy(t.color):this.sceneFogColor=new Es.Color(t.color)),"background"===e&&(this.sceneBackground&&(0,mt.isTexture)(this.sceneBackground)&&this.sceneBackground.dispose(),this.sceneBackground=t,this.isChrome?this.mtuGlow.setSceneBg():this.isSafari)}))}init(){try{var{camera:e,scene:t,renderer:r}=this.runScene.assetsEx.get();this.mainScene=t,this.mainCamera=e,this.renderer=r,this.renderer&&(this.renderer.getSize(this.rtSize),this.postProcessing())}catch(e){console.log("Error: ",e)}this.runScene.cb.loaderer.gltf.loadNode.add("outline-objects",(({node:e,nodeDef:t})=>{t.extras&&t.extras.outline&&this.mtOutline.addSelectedObject(e)}))}postProcessing(){var e=new Es.WebGLRenderTarget(this.rtSize.x,this.rtSize.y,{samples:this.ppParams.samples});e.depthTexture=new Es.DepthTexture(this.rtSize.x,this.rtSize.y),e.depthTexture.type=Es.UnsignedIntType,e.depthTexture.format=Es.DepthFormat,this.effectComposer=new fs(this.renderer,e),this.renderPass=new Cs(this.mainScene,this.mainCamera),this.effectComposer.addPass(this.renderPass),this.ppOutline(),this.ppGlow()}ppOutline(){this.mtOutline=new As(this)}ppGlow(){this.isChrome?(this.effectComposer.renderToScreen=!0,this.mtuGlow=new rs(this)):this.isSafari&&(this.effectComposer.renderToScreen=!1,this.threeGlow=new gs(this))}toJSON(){var e={},{bloomParams:t,outlineParams:r}=this;return e.bloomParams=Object.assign({},t),e.outlineParams=Object.assign({},r),console.log(e,"PP toJSON"),JSON.stringify(e)}fromJSON(e){var t,r,n,i,a,{bloomParams:e,outlineParams:o}=e;e&&(({isBloom:e,radius:t,strength:r,threshold:n}=e),this.bloomParams.isBloom=e,this.bloomParams.radius=t,this.bloomParams.strength=r,this.bloomParams.threshold=n,this.isChrome?(this.mtuGlow.setGlowData("radius",t),this.mtuGlow.setGlowData("strength",r),this.mtuGlow.setGlowData("threshold",n)):this.isSafari&&(this.threeGlow.setGlowData("radius",t),this.threeGlow.setGlowData("strength",r),this.threeGlow.setGlowData("threshold",n)),this.runScene.cb.pp.glow.setData.cb(this.bloomParams).then()),o&&(({isOutline:e,edgeStrength:t,edgeGlow:r,edgeThickness:n,pulsePeriod:o,visibleEdgeColor:i,hiddenEdgeColor:a}=o),this.outlineParams.isOutline=e,this.outlineParams.edgeStrength=t,this.outlineParams.edgeGlow=r,this.outlineParams.edgeThickness=n,this.outlineParams.pulsePeriod=o,this.outlineParams.visibleEdgeColor=i,this.outlineParams.hiddenEdgeColor=a,this.mtOutline.setOutlineData("edgeStrength",t),this.mtOutline.setOutlineData("edgeGlow",r),this.mtOutline.setOutlineData("edgeThickness",n),this.mtOutline.setOutlineData("pulsePeriod",o),this.mtOutline.setOutlineData("visibleEdgeColor",new Es.Color(i)),this.mtOutline.setOutlineData("hiddenEdgeColor",new Es.Color(a)),this.runScene.cb.pp.outline.setData.cb(this.outlineParams).then())}setUpdate(e){this.isUpdate=e}update(){this.isUpdate&&this.mainScene&&this.mainCamera&&this.renderer&&(this.bloomParams.isBloom||this.outlineParams.isOutline?(this.mtOutline.enablePass(this.outlineParams.isOutline),this.isChrome?(this.mtuGlow.enablePass(this.bloomParams.isBloom),this.effectComposer.render()):this.isSafari&&(this.threeGlow.enablePass(this.bloomParams.isBloom),this.threeGlow.render())):this.renderer.render(this.mainScene,this.mainCamera))}setSize(e,t){this.rtSize.x=e,this.rtSize.y=t,this.effectComposer&&this.effectComposer.setSize(e,t),this.isChrome&&this.mtuGlow||this.isSafari&&this.threeGlow&&this.threeGlow.setSize(e,t)}dispose(){this.isChrome&&this.mtuGlow?this.mtuGlow.dispose():this.isSafari&&this.threeGlow&&this.threeGlow.dispose(),this.mtOutline&&this.mtOutline.dispose(),this.renderPass=null,this.effectComposer&&(this.effectComposer.renderTarget1&&(this.effectComposer.renderTarget1.dispose(),this.effectComposer.renderTarget1=null),this.effectComposer.renderTarget2&&(this.effectComposer.renderTarget2.dispose(),this.effectComposer.renderTarget2=null),this.effectComposer=null)}setGlowData(e,t){this.isChrome?this.mtuGlow.setGlowData(e,t):this.isSafari&&this.threeGlow.setGlowData(e,t)}setOutlineData(e,t){this.mtOutline.setOutlineData(e,t)}addOutlineObj(e,t=!0){this.mtOutline.addSelectedObject(e,t)}}const Es=dt.Z,Ts={RunScene:class{constructor(e){this._clock=new r.Clock,this.cb=new Rt,this.script=new Uo(this),this.uniqueEx=new kt.Z(this),this.fileEx=new Ao(this),this.optionsEx=new ko(this),this.undoEx=new zo.ZP(this),this.textureEx=new mt.default(this),this.controlsEx=new Wt,this.assetsEx=new Pt(this),this.renderEx=new Lo.Z(this),this.events=new class{constructor(e){this.key=new Zt(this),this.mouse=new qt(this),this.drag=new Qt(this),this.runScene=e}init(e){this.key.init(e),this.mouse.init(e),window.addEventListener("resize",(()=>this.runScene.cb.resize.cb(this.runScene.renderEx.getDomSize())))}}(this),this.multipSelector=new Oo(this),this.helperEx=null,this.materialEx=new gt.default(this),this.cameraEx=new It.Z(this),this.sceneEx=new yt.ZP(this),this.modelEx=new ft.default(this),this.loaderer=new Ct(this),this.exporter=new un(this),this.lightEx=new tr.ZP(this),this.timeLineEx=new class{constructor(e){this.timerMap={},this.animaMap={},this.groupMap={},this.setModelLocal=(e,t)=>{Object.values(e.data).map((e=>{var r,n,i=((e,t)=>{let r=-1,n=1e3;if(1!==(a=Object.keys(e).sort(((e,t)=>Number(e)-Number(t)))).length&&(a.map(((e,i)=>{e=Number(e),0<(e=t-e)&&e<n&&(n=e,r=i)})),-1!==r)){var i=a[r],a=a[r+1],o=e[i];if(e=e[a],o&&e){var s=Object.values(o)[0],l=Object.values(e)[0];if("notNow"!==s&&"notNow"!==l)return{left:o,right:e,progress:(t-Number(i))/(Number(a)-Number(i))}}}})(e.data,t);i&&(({left:i,right:r,progress:n}=i),e.setTargetByBetween(i,r,n))}))},this.runScene=e}reset(){this.timerMap={},this.animaMap={},this.groupMap={},this.runScene.cb.timeLine.reset.cb("")}closeGroup(e){this.timerMap[e]&&(({setProgressTime:r,awaitRuned:t}=this.timerMap[e]),r&&clearInterval(r),t&&clearInterval(t)),this.groupMap[e].run=!1,this.runScene.cb.timeLine.closeGroup.cb(e);var t,r=this.animaMap[e];r&&r.length&&r.map((e=>{(e=e.controls).clean=!0}))}resetGroup(e){var t=this.groupMap[e];t&&(this.closeGroup(e),this.runScene.cb.timeLine.setProgress.cb(0),Object.values(t.data).map((e=>e.reset())))}getSavedData(){return(0,z.js)(this.groupMap,((e,t)=>{t.run=!1})),this.groupMap}parseSavedGroupMap(e){Object.keys(e).map((t=>{var r=e[t];const n={};(0,z.js)(r.data,((e,t)=>{var{type:t,data:r}=t,i=(t=Ho[t]).getTarget(e,this.runScene);i&&((t=new t(i,this.runScene)).data=r,n[e]=t)})),r.data=n,this.groupMap[t]=r,this.runScene.cb.timeLine.setGroupMap.cb({group:r,groupName:t})}))}playGroup(e){this.runScene.helperEx.unfocus();const t=this.groupMap[e];if(t&&!t.run){t.run=!0;var r=Object.keys(t.data).map((e=>{var r=((e=t.data[e]).data=new Proxy(e.data,{set:(e,t,r)=>(e[t]=r,!0)}),e.getAnima(t));return t.reverse&&(e=e.getAnima(t,!0),r.push(...e)),r}));this.animaMap[e]||(this.animaMap[e]=[]),this.animaMap[e]=r.map((e=>(0,Go.eachTriggerArrGetControls)(e)));const i=t.time*t.speed*(t.reverse?2:1),a=(new Date).valueOf(),o=i;let s;r=setInterval((()=>{var t=((new Date).valueOf()-a)/o;this.runScene.cb.timeLine.playGroup.cb({groupName:e,progress:t})}),16.6);var n=new Promise((e=>s=setTimeout(e,i)));return this.timerMap[e]={setProgressTime:r,awaitRuned:s},n.then((()=>{if(clearInterval(this.timerMap[e].setProgressTime),t.run)return t.run=!1,t.loop?this.playGroup(e):void 0}))}}}(this),this.anima=new Et(this),this.tags=new Ft(this),this.globalConfig=new So(this),this.pp=new _s(this),this._renderLimit=new vt.cM,this._render=()=>{var{render2:e,render3:t}=this.assetsEx,{scene:r,camera:n}=this.assetsEx.get();this.cb.render.cb(""),this.pp.update(),null!=t&&t.render(r,n),null!=e&&e.render(r,n)},this.render=()=>{if(null!=(e=this.optionsEx.options)&&e.run){const r=this._render;var{frame:e,mode:t}=this.optionsEx.options.renderConfig;-1!==e&&"tick"===t?(t=this._clock.getDelta(),this._renderLimit.update({cb(){r()},cbRate:1/e,now:t})):this._render()}};var{rootDom:t,options:n}=e;if(!t)throw TypeError("根节点或路径不可为空");this.optionsEx.init(n),(t=(n||{}).loadInterval)?this.optionsEx.setLoadInterval({inputInterval:t,cb:this.load.bind(this,e)}):this.load(e)}load(e){var{path:e,rootDom:t,loadConfig:r}=e,{camera:t,controls:n}=(this.events.init(t),this.assetsEx.init(t),this.globalConfig.setRenderMode(this.optionsEx.options.renderConfig.mode),this.helperEx=new Co(this),this.assetsEx.get());this.uniqueEx.model.add(t),this.renderEx.setSize(),n.update(),this.pp.init(),this.cb.inited.cb(0),this.cameraEx.reset(t),this.loadScene(e,r)}loadScene(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function a(e){try{s(n.next(e))}catch(e){i(e)}}function o(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(a,o)}s((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){var r=Object.assign(Object.assign({},t),{getJSON:this.cb.load.getJSON.cb,progress:this.cb.load.progress.cb,complete:this.cb.load.complete.cb,triggerCb:!1});if(e instanceof ArrayBuffer)return this.optionsEx.log("正在解析二进制文件","base","info"),this.loaderer.gltf.parse(e,r);this.optionsEx.log("正在拉取场景","base","info");var n=yield N().get(e,{responseType:"arraybuffer",onDownloadProgress:e=>{var{total:e,loaded:t}=e;let r=t/e;1<(r=r<0?0:r)&&(r=1),t=Number(r.toFixed(2)),e=Math.floor(100*t),this.optionsEx.log("下载场景进度:"+e,"detail"),this.cb.load.progress.cb(e)}}).then((e=>e.data)).catch((e=>{this.sceneEx.clean(),this.optionsEx.log("下载场景失败:",e)}));return n?(this.optionsEx.log("拉取场景成功、正在解析","base","success"),this.loaderer.gltf.parse(n,r)):void 0}))}dispose(){this.assetsEx.dispose(),this.sceneEx.clean()}on(e,t){return null!=(e=this.cb.load[e])&&e.add("load-callback"+(0,H.getId)(),t),this}setSize(e,t){var{render2:r,render3:n}=this.assetsEx,i=this.assetsEx.get().renderer;this.cameraEx.setSize(),null!=n&&n.setSize(e,t),null!=r&&r.setSize(e,t),i.setSize(e,t,!0),this.pp.setSize(e,t)}},Utils:he,ModelEx:ft,MaterialEx:gt,TextureEx:mt,Three:Es,ThreeEx:{TransformControls:A},Bus:class{constructor(){this.list={}}on(e,t){this.list[e]=t}emit(...e){if(void 0===this.list[e[0]])throw Error("请先挂载在使用");return this.list[e[0]](...[...e].filter(((e,t)=>0!==t)))}off(e){this.list[e]&&delete this.list[e]}}}})(),__webpack_exports__=__webpack_exports__.default,__webpack_exports__})()));