run-scene-v2 0.0.65 → 0.0.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -1
- 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-three"),require("@allex/md5"),require("js-funcs")):"function"==typeof define&&define.amd?define(["three","axios","uuid1","js-funcs-three","@allex/md5","js-funcs"],t):"object"==typeof exports?exports.RunScene=t(require("three"),require("axios"),require("uuid1"),require("js-funcs-three"),require("@allex/md5"),require("js-funcs")):e.RunScene=t(e.three,e.axios,e.uuid1,e["js-funcs-three"],e["@allex/md5"],e["js-funcs"])}(self,((__WEBPACK_EXTERNAL_MODULE__8881__,__WEBPACK_EXTERNAL_MODULE__3300__,__WEBPACK_EXTERNAL_MODULE__7937__,__WEBPACK_EXTERNAL_MODULE__4356__,__WEBPACK_EXTERNAL_MODULE__1129__,__WEBPACK_EXTERNAL_MODULE__6001__)=>(()=>{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&&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"===p(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 f(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 f(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)?f(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 f(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 p(e){return(p="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 C(e){var t=parseFloat(e);return(t||0===t)&&(e+"").match(et).length<2?t:He(e)?e.trim():e}function B(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=We(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 k(e,t){return(e-t._start)*t._ts+(0<=t._ts?0:t._dirty?t.totalDuration():t._tDur)}function R(e,t){var r;if((t._time||t._initted&&!t._dur)&&(r=k(e.rawTime(),t),(!t._dur||V(0,t.totalDuration(),r)-t._tTime>Ie)&&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=-Ie}}function I(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||R(e,t),e}function L(e,t){(rt.ScrollTrigger||it("scrollTrigger",t))&&rt.ScrollTrigger.create(t,e)}function F(e,t,r,n){return Zt(e,t),e._initted?!r&&e._pt&&(e._dur&&!1!==e.vars.lazy||!e._dur&&e.vars.lazy)&&fe!==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()>=Re?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*(We(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){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,a={},o=(e=0<n&&n<1,isNaN(n)||e),s=t.axis,l=n,u=n;return He(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,f,p,m,v,g,y,b,x=(h||t).length,w=a[x];if(!w){if(!(b="auto"===t.grid?0:(t.grid||[1,Re])[1])){for(g=-Re;g<(g=h[b++].getBoundingClientRect().left)&&b<x;);b--}for(w=a[x]=[],d=o?Math.min(b,x)*l-.5:n%b,f=b===Re?0:o?x*u/b-.5:n/b|0,y=Re,v=g=0;v<x;v++)m=v%b-d,p=f-(v/b|0),w[v]=m=s?Math.abs("y"===s?p:m):Ge(m*m+p*p),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=Bt(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:Bt(r))}}function Z(e,t){var r,n,i=We(e);return!i&&Je(e)&&(r=i=e.radius||Re,e.values?(e=Tt(e.values),(n=!Ve(e[0]))&&(r*=r)):e=K(e.increment)),Ct(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=Re,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+Bt(t)}:K(e))}function W(e,t,r,n){return Ct(We(e)?!t:!0===r?!!(r=0):!n,(function(){return We(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 Ct(r,(function(r){return e[~~t(r)]}))}function Q(e,t,r,n,i){var a=t-e,o=n-r;return Ct(i,(function(t){return r+((t-e)/a*o||0)}))}function Y(e,t,r){var n,i,a,o=e.labels,s=Re;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=Rt(e,t,1))&&u+(t?e[0]+","+e[1]+"%,"+e[2]+"%,"+e[3]:e.join(","))+")"})),r&&(a=It(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,fe,pe,me,ve,ge,ye,be,xe,we,Ae,Se,Me,Ce,Be,_e,Ee,Te,De,Pe,Oe={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},ke={duration:.5,overwrite:!1,delay:0},Re=1e8,Ie=1/Re,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"==p(e)},Ke=function(e){return!1!==e},Ze="function"==typeof ArrayBuffer&&ArrayBuffer.isView||function(){},We=Array.isArray,Xe=/(?:-?\.?\d|\.)+/gi,Qe=/[-+=.]*\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="",ft=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},pt=function(e){return e._gsap||ft(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||Ie)||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},Ct=function(e,t){return e||0===e?t(e):t},Bt=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()?We(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)+W(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,kt={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]},Rt=function(e,t,r){var n,i,a,o,s,l,u,c=e?Ve(e)?[e>>16,e>>8&Ot,e&Ot]:0:kt.black;if(!c){if(","===e.substr(-1)&&(e=e.substr(0,e.length-1)),kt[e])c=kt[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(Qe),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)||kt.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},It=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 kt)t+="|"+e+"\\b";return new RegExp(t+")","gi")}(),Ft=/hsl[a]?\(/,Ut=(we=Date.now,Ae=500,Se=33,Me=we(),Ce=Me,_e=Be=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/Ie,Se=Math.min(t,Ae,0)},fps:function(e){Be=1e3/(e||240),_e=1e3*Te.time+Be},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(C))):jt._CE&&Nt.test(e)?jt._CE("",e):a}(e))||t};function Jt(e){var t,r,n,i=we()-Ce,a=!0===e;if(Ae<i&&(Me+=i-Se),(0<(i=(r=(Ce+=i)-Me)-_e)||a)&&(n=++Te.frame,be=r-1e3*Te.time,Te.time=r/=1e3,_e+=i+(Be<=i?4:Be-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 Zt(e,t){var r,n,i,a,o,s,l,u,c,h,d,f,p,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,C=m.keyframes,B=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,k=e.timeline;if(e._ease=Vt(v=!k||C&&v?v:"none",ke.ease),e._yEase=M?zt(Vt(!0===M?v:M,ke.ease)):0,M&&e._yoyo&&!e._repeat&&(M=e._yEase,e._yEase=e._ease,e._ease=M),e._from=!k&&!!m.runBackwards,!k||C&&!m.stagger){if(f=(u=T[0]?pt(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&&!B&&e._startAt.render(-1,!0),y){if(0<t&&!B&&(e._startAt=0),_&&t<=0)return void(t&&(e._zTime=t))}else!1===B&&(e._startAt=0);else if(S&&_)if(E)B||(e._startAt=0);else if(i=gt({overwrite:!1,data:"isFromStart",lazy:(y=!t&&y)&&Ke(b),immediateRender:y,stagger:0,parent:D},r),f&&(i[u.prop]=f),xt(e._startAt=hr.set(T,i)),t<0&&e._startAt.render(-1,!0),e._zTime=t,y){if(!t)return}else Zt(e._startAt,Ie);for(e._pt=0,b=_&&Ke(b)||b&&!_,n=0;n<T.length;n++){if(l=(o=T[n])._gsap||ft(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,f||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||f)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)),p=!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)&&!p,C&&t<=0&&k.render(Re,!0,!0)}function Wt(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 Qt(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-Ie;return function(e){return((n*V(0,a,e)|0)+i)*r}}},ke.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&&R(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)&&I(this._dp,this,this._start-this._delay)}return(this._tTime!==e||!this._dur&&!t||this._initted&&Math.abs(this._zTime)===Ie||!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===-Ie?0:this._rts;if(this._rts===e)return this;for(var t=this.parent&&this._ts?k(this.parent._time,this):this._tTime,r=(this._rts=+e||0,this._ts=this._ps||e===-Ie?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)!==Ie&&(this._tTime-=Ie)))),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||I(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?k(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?-Ie:0)),this):this._rts<0}},{key:"invalidate",value:function(){return this._initted=this._act=0,this._zTime=-Ie,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)-Ie))}},{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:B;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:-Ie,_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&&I(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 I(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,f=this._time,p=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&&p<v&&0<=e?p:v)!==this._tTime||r||g){if(f!==this._time&&m&&(v+=this._time-f,e+=this._time-f),n=v,c=this._start,s=!(u=this._ts),g&&(m||(f=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===p?(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=!f&&this._tTime&&h!==a?a:h)&&!this._lock){var y=g&&1&h;if(g=y===(g&&1&a),f=(y=a<h?!y:y)?0:m,this._lock=1,this.render(f||(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),f&&f!==this._time||s!=!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(m=this._dur,p=this._tDur,g&&(this._lock=2,this.render(f=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(f),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,f=0),!f&&n&&!t&&(q(this,"onStart"),this._tTime!==v))return this;if(f<=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=-Ie);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?-Ie:Ie);break}}b=i}if(l&&!t&&(this.pause(),l.render(f<=n?0:-Ie)._zTime=f<=n?1:-1,this._ts))return this._start=c,At(this),this.render(e,t,r);this._onUpdate&&!t&&q(this,"onUpdate",!0),!(v===p&&p>=this.totalDuration()||!v&&f)||c!==this._start&&Math.abs(u)===Math.abs(this._ts)||this._lock||(!e&&m||!(v===p&&0<this._ts||!v&&this._ts<0)||xt(this,1),t||e<0&&!f||!v&&!f&&p||(q(this,v===p&&0<=e?"onComplete":"onReverseComplete",!0),!this._prom||v<p&&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(We(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?I(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]:-Re,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,I(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())||Ie,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+Ie)}},{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=Re;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,I(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,k(e,le)),fe=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,Qt,null,i),f=0,p=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(f,c.index),l?l=(l+1)%5:"rgba("===c.substr(-5)&&(l=1),u!==s[p++]&&(h=parseFloat(s[p-1])||0,d._pt={_next:d._pt,p:c||1===p?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},f=qe.lastIndex);return d.c=f<n.length?n.substring(f,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?pr:fr:dr,He(n)&&"="===(n=~n.indexOf("random(")?Pt(n):n).charAt(1)&&(!(u=parseFloat(a)+parseFloat(n.substr(2))*("-"===n.charAt(0)?-1:1)+(Bt(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=Wt(e,i,t,r,n)),!Je(e)||e.style&&e.nodeType||We(e)||Ze(e))return He(e)?Wt(e,i,t,r,n):e;var a,o={};for(a in e)o[a]=Wt(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!==pe))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,f,p,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,C=a.defaults,B=a.scrollTrigger,E=a.yoyoEase,P=(a=n.parent||le,(We(r)||Ze(r)?Ve(r[0]):"length"in n)?[r]:Tt(r));if(o._targets=P.length?ft(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:C||{}})).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(f in A)~ur.indexOf(f)&&((v=v||{})[f]=A[f]);for(u=0;u<d;u++)(c=yt(n,cr)).stagger=0,E&&(c.yoyoEase=E),v&&_(c,v),p=P[u],c.duration=+Wt(y,s(o),u,p,P),c.delay=(+Wt(x,s(o),u,p,P)||0)-o._delay,!A&&1===d&&c.delay&&(o._delay=x=c.delay,o._start+=x,c.delay=0),l.to(p,c,m?m(u,p,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,k,R,F=0;if(We(M))M.forEach((function(e){return l.to(P,e,">")}));else{for(f in c={},M)"ease"!==f&&"easeEach"!==f&&function(e,t,r,n){var i,a,o=t.ease||n||"power1.inOut";if(We(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})}(f,M[f],c,M.easeEach);for(f in c)for(O=c[f].sort((function(e,t){return e.t-t.t})),u=F=0;u<O.length;u++)(R={ease:(k=O[u]).e,duration:(k.t-(u?O[u-1].t:0))/100*y})[f]=k.v,l.to(P,R,F),F+=R.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),I(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=-Ie,o.render(Math.max(0,-x))),B&&L(s(o),B),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-Ie<e&&0<=e?o:e<Ie?0:e;if(s){if(l!==this._tTime||!e||r||!this._initted&&this._tTime||this._startAt&&this._zTime<0!=e<0){if(m=l,p=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)),(f=this._yoyo&&1&g)&&(d=this._yEase,m=s-m),y=O(this._tTime,h),m===a&&!r&&this._initted)return this;g!==y&&(p&&this._yEase&&re(p,f),!this.vars.repeatRefresh||f||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;p&&p.render(e<0?e:!m&&f?-Ie:p._dur*p._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,f=t,p=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||p||h._zTime===Ie||!d&&h._zTime){if(h._initted||!F(h,d,p,f)){for(c=h._zTime,h._zTime=d||(f?Ie:0),f=f||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&&!f&&q(h,"onUpdate"),y&&h._repeat&&!f&&h.parent&&q(h,"onRepeat"),(d>=h._tDur||d<0)&&h.ratio===v&&(v&&xt(h,1),f||(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)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,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]?pt(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);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=(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}),fr=function(e,t,r){return e[t](r)},pr=function(e,t,r,n){return e[t](n.fp,r)},mr=function(e,t){return ze(e[t])?fr: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:ke,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,It(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=pt(e||{}).get,a=r?B:C;return"native"===r&&(r=""),e&&(t?a((lt[t]&<[t].get||i)(e,t,r,n)):function(t,r,n){return a((lt[t]&<[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=pt(e),s=o.harness&&(o.harness.aliases||{})[t]||t,l=a?function(t){var n=new a;pe._pt=0,n.init(e,r?t+r:t,pe,0,[e]),n.render(1,n),pe._pt&&Yt(1,pe)}: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,ke.ease)),E(ke,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]||I(i,e,e._start-e._delay),e=t;return I(le,i,0),i},utils:{wrap:function e(t,r,n){var i=r-t;return We(t)?X(t,e(0,t.length),r):Ct(n,(function(e){return(i+(e-t)%i)%i+t}))},wrapYoyo:function e(t,r,n){var i=r-t,a=2*i;return We(t)?X(t,e(0,t.length-1),r):Ct(n,(function(e){return t+(i<(e=(a+(e-t)%a)%a||0)?a-e:e)}))},distribute:J,random:W,snap:Z,normalize:function(e,t,r){return Q(e,t,0,1,r)},getUnit:Bt,clamp:function(e,t,r){return Ct(r,(function(r){return V(e,t,r)}))},splitColor:Rt,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:Q,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||Bt(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(We(t)&&!We(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=_(We(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 Ct(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:pt,_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),pe=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",Z))||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},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,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()}},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,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 f(){}function p(){}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),p.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",f.prototype=p),l(p,"constructor",f),f.displayName=l(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){return!!(e="function"==typeof e&&e.constructor)&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,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){if(e){if("string"==typeof e)return o(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)?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(6569));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=e.arr,n=e.typeList,i=e.findType;if(e=e.mapType,!r||!n||!i)return r;var o=a(n),s=r.find((function(e){return e[i]===n[0]}));return s?1!==n.length&&s[e]instanceof Array?(o.shift(),(0,t.deepArrByMaps)({arr:s[e],typeList:o,findType:i,mapType:e})):s:r}},7267:(e,t)=>{"use strict";t.d=void 0,t.d=function(e,t){var r=null;return function(){null!==r&&clearTimeout(r),r=setTimeout((function(){e()}),t)}}},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))),a=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,a.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),a="";;)for(var o=e(i),s=i;s--;)if((a+=t[o[s]&n]||"").length===+r)return a}},2801:(e,t,r)=>{"use strict";e.exports=r(6104)},6330:(e,t,r)=>{"use strict";var n,i,a,o=r(3445),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}},9133:(e,t,r)=>{"use strict";var n,i,a=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+=a(7))+a(e),0<n&&(t+=a(n)),t+a(r)}},5239:(e,t,r)=>{"use strict";var n=r(6330),i=r(6339),a=r(4403);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}},6104:(e,t,r)=>{"use strict";var n=r(6330),i=r(9133),a=r(6932),o=r(517)||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},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},1819:(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){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 n.PerspectiveCamera}createOrthographic(){return new n.OrthographicCamera}setMode(e){if(e!==this.mode){this.runScene.helperEx.transContro.reset(),this.mode=e,this.runScene.assetsEx.reset(),this.reset(this.getCamera()),this.setSize();const 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);const t=this.runScene.assetsEx.get().controls;t.target.set(0,0,0),t.update()}get(){return this.runScene.assetsEx.get().camera}setSize(){var{width:e,height:t}=this.runScene.renderEx.getDomSize();const r=this.getCamera();r.aspect=e/t,r.updateProjectionMatrix()}}const a=e=>null==e?void 0:e.isCamera},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()}toArray(e){let t=[];for(const r of this.entries())"key"==e?t.push(r[0]):t.push(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){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)},2959:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});class n{constructor(e){this.runScene=e}}},7042:(e,t,r)=>{"use strict";r.d(t,{Z:()=>i});var n=r(6999);class i extends r(2959).Z{get(){throw new Error("Method not implemented.")}static toJSON(e){const{intensity:t,name:r,type:n,position:i,visible:a,color:o,castShadow:s,shadow:l,rotation:u,target:c}=e;var{mapSize:e,camera:h}=l,{scale:h,near:d,far:f}=h;return{type:n,intensity:t,name:r,visible:a,color:o.getHexString(),castShadow:s,shadow:{mapSize:e.x,camera:{near:d,far:f,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,t){return t=this.runScene.lightEx.get("DirectionalLight",Object.assign(Object.assign({},t),{addUndo:!1})),i.setConfig(t,e),t}static setConfig(e,t){var{intensity:t,name:r,visible:i,color:a,castShadow:o,shadow:s,type:l}=t,{mapSize:s,camera:u}=s,{scale:u,near:c,far:h}=u;e.intensity=t,e.type=l,e.name=r,e.visible=i,e.castShadow=o,e.color=new n.Z.Color("#"+a),e.add(e.target),e.shadow.mapSize.x=s,e.shadow.mapSize.y=s,e.shadow.camera.scale.x=u,e.shadow.camera.scale.y=u,e.shadow.camera.scale.z=u,e.shadow.camera.near=c,e.shadow.camera.far=h,e.shadow.camera.updateProjectionMatrix(),null!=(t=e.cameraHelper)&&t.update()}}},3352:(e,t,r)=>{"use strict";r.d(t,{ZP:()=>M,RQ:()=>C});var n=r(9728),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){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");var a=new i.BufferGeometry,o=(a.setAttribute("position",new i.Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),a.computeBoundingSphere(),new i.LineBasicMaterial({fog:!1}));return((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}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(6999);t=r(2959);class h extends t.Z{get(){}static toJSON(e){const{type:t,intensity:r,name:n,visible:i,color:a}=e;return{type:t,intensity:r,name:n,visible:i,color:a.getHexString()}}parseJSON(e){const t=this.runScene.lightEx.get("AmbientLight",{addUndo:!1});var{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}}var d=r(7042);class f extends t.Z{get(){throw new Error("Method not implemented.")}static toJSON(e){const{type:t,intensity:r,name:n,visible:i,color:a,groundColor:o,position:s}=e;return{name:n,type:t,intensity:r,visible:i,position:{x:s.x,y:s.y,z:s.z},groundColor:o.getHexString(),color:a.getHexString()}}parseJSON(e){const t=this.runScene.lightEx.get("HemisphereLight",{addUndo:!1});var{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 p extends t.Z{get(){throw new Error("Method not implemented.")}static toJSON(e){const{name:t,type:r,intensity:n,distance:i,decay:a,renderOrder:o,color:s,visible:l,castShadow:u,shadow:c,position:h}=e;var{mapSize:e,camera:d,bias:f,radius:p}=c,{scale:d,near:m,far:v}=d;return{name:t,type:r,intensity:n,visible:l,color:s.getHexString(),castShadow:u,distance:i,decay:a,renderOrder:o,shadow:{mapSize:e.x,camera:{near:m,far:v,scale:d.x},radius:p,bias:f},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:a,renderOrder:o,color:s,visible:l,castShadow:u,shadow:h,position:d}=e,{mapSize:h,camera:f,bias:p,radius:m}=h,{scale:f,near:v,far:g}=f;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=p,t.decay=a,t.shadow.radius=m,t.shadow.camera.scale.x=f,t.shadow.camera.scale.y=f,t.shadow.camera.scale.z=f,t.shadow.camera.near=v,t.shadow.camera.far=g,t.shadow.camera.updateProjectionMatrix(),t}}class m{constructor(e){this.runScene=e}static toJSON(e){const{type:t,intensity:r,name:n,visible:i,color:a,position:o}=e;return{name:n,type:t,intensity:r,visible:i,position:{x:o.x,y:o.y,z:o.z},color:a.getHexString()}}parseJSON(e){const t=this.runScene.lightEx.get("RectAreaLight",{addUndo:!1});var{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 v{constructor(e){this.runScene=e}static toJSON(e){const{name:t,type:r,color:n,distance:i,decay:a,intensity:o,angle:s,penumbra:l,visible:u,castShadow:c,shadow:h,renderOrder:d,position:f,target:p}=e;var{bias:e,camera:m,normalBias:v,mapSize:g,radius:y}=h,m=m.near;return{type:r,intensity:o,name:t,visible:u,distance:i,angle:s,decay:a,penumbra:l,renderOrder:d,color:n.getHexString(),castShadow:c,shadow:{bias:e,normalBias:v,mapSize:g.x,camera:{near:m},radius:y},position:{x:f.x,y:f.y,z:f.z},targetPosition:{x:p.position.x,y:p.position.y,z:p.position.z}}}parseJSON(e){const t=this.runScene.lightEx.get("SpotLight",{addUndo:!1});var{name:e,type:r,color:n,distance:i,decay:a,intensity:o,angle:s,penumbra:l,visible:u,castShadow:h,shadow:d,renderOrder:f,position:p,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=f,t.castShadow=h,t.color=new c.Z.Color("#"+n),t.position.set(p.x,p.y,p.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 g=r(6875),y=r(9593),b=r(5860),x=r(986),w=r(5613),A=r(811);const S={DirectionalLight:d.Z,PointLight:p,SpotLight:v,RectAreaLight:m,HemisphereLight:f,AmbientLight:h};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 d.Z(e),PointLight:new p(e),SpotLight:new v(e),RectAreaLight:new m(e),HemisphereLight:new f(e),AmbientLight:new h(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,w.mergeObject)({isClone:!1,id:(0,n.getId)(),addUndo:!0,addToScene:!0},t);let o=new c.Z[e];if(o.position.y=10,o.name=e,o.userData.id=r,this.shadowList.includes(e)&&(o.castShadow=!0),this.setLight(o),a){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 g.Z(Object.assign(Object.assign({},e),{runScene:this.runScene})).execute())),i&&this.runScene.undoEx.addUndo(r),null!=(e=null==o?void 0:o.lightHelper)&&e.update()}else this.runScene.modelEx.add(o,void 0,{addUndo:i});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 x.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 x.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 u(t,16773120);break;case"DirectionalLight":if(n=new c.Z.DirectionalLightHelper(t,1,16711680),t.children[0])t.target=t.children[0];else{let e=new c.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 c.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 c.Z.PointLightHelper(t,1,16711935);break;case"SpotLight":n=new c.Z.SpotLightHelper(t);let 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);const o=new c.Z.CameraHelper(t.shadow.camera);t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(o,!0,(e=>{e.userData.id=r})),o.userData.id=r,t.cameraHelper=o,i.push({model:o,parent:this.runScene.sceneEx.get(),addTree:!1});break;case"HemisphereLight":n=new c.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 b.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 a=new y.Z({target:e,typeList:n,newVal:i,cb:t});return r?a.execute():a})),n&&this.runScene.undoEx.addUndo(i),i;{var{model:i,typeList:e,newVal:a}=e;const o=new y.Z({target:i,typeList:e,newVal:a,cb:t});return n&&this.runScene.undoEx.addUndo(o),r?o.execute():o}}isLight(e){return null==(e=null==e?void 0: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.filter((e=>!(0,A.isHelper)(e))).map((e=>{var t=e.type;return console.log(e,"model"),S[t].toJSON(e)}))}}const C=e=>null==(e=null==e?void 0:e.userData)?void 0:e.isLight},8239:(e,t,r)=>{"use strict";r.r(t),r.d(t,{SpecialMaterial:()=>se,createDefMaterial:()=>W,defAllMaterialMap:()=>K,defBaseMaterialMap:()=>J,default:()=>Z,disposeMaterial:()=>Q,getBaseTextures:()=>$,getMaterialType:()=>le,getTextures:()=>q,getTexturesByMaterial:()=>Y,initMaterial:()=>te,isBaseMaterial:()=>oe,isColor:()=>re,isMaterial:()=>ie,materialIgnore:()=>ue,mergeMaterial:()=>X,setDefMaterialForSameGeo:()=>ae,setMaterialTexture:()=>ee,updateMaterial:()=>ne});var n=r(2081),i=r(9728),a=r(8881),o=r(1643);const s="\n#define STANDARD\nuniform int uvCount;\n ",l="\nattribute vec2 uv2;\nvarying vec2 vUv2;\nuniform mat3 uv2Transform;\n ",u="\nvUv2 = (uv2Transform * vec3(uv2, 1)).xy;\n ",c="\nvarying vec2 vUv2;\n ",h="\n#ifdef USE_MAP\n vec4 sampledDiffuseColor = vec4(0.0);\n if(uvCount > 1) sampledDiffuseColor = texture2D(map, vUv2);\n else sampledDiffuseColor = texture2D(map, vUv);\n \n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n #endif\n diffuseColor *= sampledDiffuseColor;\n#endif\n ",d="\n#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = vec4(0.0);\n if(uvCount > 1) emissiveColor = texture2D(emissiveMap, vUv2);\n else emissiveColor = texture2D(emissiveMap, vUv);\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n ";class f{static create(){this.uvCount=new a.Uniform(1);const e=new a.MeshStandardMaterial;return e.onBeforeCompile=e=>{e.uniforms.uvCount=this.uvCount,e.vertexShader=e.vertexShader.replace(/#include <uv2_pars_vertex>/g,l),e.vertexShader=e.vertexShader.replace(/#include <uv2_vertex>/g,u),e.fragmentShader=e.fragmentShader.replace(/#define STANDARD/g,s),e.fragmentShader=e.fragmentShader.replace(/#include <uv2_pars_fragment>/g,c),e.fragmentShader=e.fragmentShader.replace(/#include <map_fragment>/g,h),e.fragmentShader=e.fragmentShader.replace(/#include <emissivemap_fragment>/g,d)},e}static isDefVal(e){for(const t in this.defVal){const r=this.defVal[t],n=e[t];if(r instanceof a.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 o.zX)if(e[t])return!1;return!0}}f.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 p=r(5105),m=r(2266),v=r(9593);class g{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 a.ShaderMaterial({uniforms:(0,m.d9)(y.uniforms),vertexShader:y.vertexShader,fragmentShader:y.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=>!g.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=>{const t=W(),r=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:this.tools.type,uniforms:{},name:e.name},textures:this.tools.getTextures(e)}),{}),n=e.uniforms,i=y.uniforms;return Object.keys(n).filter((e=>!g.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(){const e=new a.ShaderMaterial({uniforms:(0,m.d9)(y.uniforms),vertexShader:y.vertexShader,fragmentShader:y.fragmentShader});return e.userData.tools=this.tools,e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new v.Z({target:e,typeList:["uniforms",...t],newVal:r}).execute())}}g.TextureNames=["sideWallTex","backWallTex","floorTex","ceilingTex"];const y={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 b{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=X(n,new x(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=>!b.TextureNames.includes(e))).map((e=>{i[e]=r.uniforms[e]})),i.insertFresnelShader(),i.userData.tools=this.tools,i},toNormal:e=>{const t=X(e,W()),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=w.uniforms;return Object.keys(n).filter((e=>!b.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){const t=new x(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 v.Z({target:e,typeList:[...t],newVal:r}).execute())}}b.TextureNames=["envMap","displacementMap"];class x extends a.MeshPhysicalMaterial{constructor(e,t,r){if(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(w.uniforms.fresnelBias.value),this.fresnelScale=new a.Uniform(w.uniforms.fresnelScale.value),this.fresnelPower=new a.Uniform(w.uniforms.fresnelPower.value)),this.clock=new a.Clock,this.isSurge=new a.Uniform(!1),this.deltaTime=new a.Uniform(0),!this.cubeCamera){const e=new a.WebGLCubeRenderTarget(2048);e.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,w.vertexParas),e.vertexShader=e.vertexShader.replace(/#include <begin_vertex>/g,w.vertexShader1),e.vertexShader=e.vertexShader.replace(/vWorldPosition = worldPosition.xyz;/g,w.vertexShader2),e.fragmentShader=e.fragmentShader.replace(/#include <transmission_pars_fragment>/g,w.fragmentParas),e.fragmentShader=e.fragmentShader.replace(/vec3 totalEmissiveRadiance = emissive;/g,w.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 w={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 "};class A{constructor(e){this.tools={type:"Matcap",getTextures(e){const t=[];return A.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},toNormal:e=>{var t=this.tools.getTextures(e);const r=X(e,W()),n=(r.userData=Object.assign(Object.assign({},r.userData),{normal:{type:this.tools.type,uniforms:{},name:e.name},textures:t}),r.name=e.name,{}),i=new a.MeshMatcapMaterial;return Object.keys(e).filter((e=>!A.TextureNames.includes(e))).filter((e=>!A.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=X(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=>!A.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=>!A.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r}},this.runScene=e}create(e){const 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 v.Z({target:t,typeList:[...r],newVal:n,cb:()=>{t.needsUpdate=!0}}).execute())}}A.IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],A.TextureNames=["alphaMap","bumpMap","displacementMap","map","normalMap","matcap"];const S="\nvec3 mod289(vec3 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec2 mod289(vec2 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec3 permute(vec3 x) {\n return mod289(((x*34.0)+1.0)*x);\n}\n\nfloat noise2D(vec2 v) {\n const vec4 C = vec4(0.211324865405187, // (3.0-sqrt(3.0))/6.0\n 0.366025403784439, // 0.5*(sqrt(3.0)-1.0)\n -0.577350269189626, // -1.0 + 2.0 * C.x\n 0.024390243902439); // 1.0 / 41.0\n// First corner\nvec2 i = floor(v + dot(v, C.yy) );\nvec2 x0 = v - i + dot(i, C.xx);\n\n// Other corners\nvec2 i1;\n//i1.x = step( x0.y, x0.x ); // x0.x > x0.y ? 1.0 : 0.0\n//i1.y = 1.0 - i1.x;\ni1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n// x0 = x0 - 0.0 + 0.0 * C.xx ;\n// x1 = x0 - i1 + 1.0 * C.xx ;\n// x2 = x0 - 1.0 + 2.0 * C.xx ;\nvec4 x12 = x0.xyxy + C.xxzz;\nx12.xy -= i1;\n\n// Permutations\ni = mod289(i); // Avoid truncation effects in permutation\nvec3 p = permute( permute( i.y + vec3(0.0, i1.y, 1.0 )) + i.x + vec3(0.0, i1.x, 1.0 ));\n\nvec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0);\nm = m*m ;\nm = m*m ;\n\n// Gradients: 41 points uniformly over a line, mapped onto a diamond.\n// The ring size 17*17 = 289 is close to a multiple of 41 (41*7 = 287)\n\nvec3 x = 2.0 * fract(p * C.www) - 1.0;\nvec3 h = abs(x) - 0.5;\nvec3 ox = floor(x + 0.5);\nvec3 a0 = x - ox;\n\n// Normalise gradients implicitly by scaling m\n// Approximation of: m *= inversesqrt( a0*a0 + h*h );\nm *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h );\n\n// Compute final noise value at P\nvec3 g;\ng.x = a0.x * x0.x + h.x * x0.y;\ng.yz = a0.yz * x12.xz + h.yz * x12.yw;\nreturn 130.0 * dot(m, g);\n}\n ",M="\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 noise3D(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 ",C={defines:{USE_UV:!0,USE_MAP:!0},uniforms:{mapArray:{value:[null,null,null,null,null,null,null,null]},maskArray:{value:[null,null,null,null,null,null,null]},mapUvTransArray:{value:[new a.Matrix3,new a.Matrix3,new a.Matrix3,new a.Matrix3,new a.Matrix3,new a.Matrix3,new a.Matrix3,new a.Matrix3]},maskUvTransArray:{value:[new a.Matrix3,new a.Matrix3,new a.Matrix3,new a.Matrix3,new a.Matrix3,new a.Matrix3,new a.Matrix3]},opacity:{value:1},diffuse:{value:new a.Color(16777215)},uvTransform:{value:new a.Matrix3},shadowShade:{value:.6}},vertexShader:"\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_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\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 <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <envmap_vertex>\n #include <fog_vertex>\n // vUv = (uvTransform * vec3(uv, 1.0)).xy;\n}\n ",fragmentShader:"\nuniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\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 <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\n#define MAX_TEX 8\nuniform mat3 mapUvTransArray[MAX_TEX];\nuniform mat3 maskUvTransArray[MAX_TEX - 1];\nuniform sampler2D mapArray[MAX_TEX];\nuniform sampler2D maskArray[MAX_TEX - 1];\nuniform float shadowShade;\n\n// Insert Noise2D\nfloat sum(vec3 v) {return v.x + v.y + v.z;}\nvec3 textureNoTile(sampler2D tex, vec2 tUv, float offsetScale) {\n // cheap (cache friendly) lookup\n float k = noise2D(0.25 * tUv);\n\n float l = k * 8.0;\n float f = fract(l);\n float ia = floor(l);\n float ib = ia + 1.0;\n\n // can replace with any other hash\n vec2 offa = sin(vec2(3.0, 7.0) * ia);\n vec2 offb = sin(vec2(3.0, 7.0) * ib);\n\n vec2 duvdx = dFdx(tUv);\n vec2 duvdy = dFdy(tUv);\n vec3 cola = textureGrad(tex, tUv + offsetScale * offa, duvdx, duvdy).xyz;\n vec3 colb = textureGrad(tex, tUv + offsetScale * offb, duvdx, duvdy).xyz;\n\n return mix(cola, colb, smoothstep(0.2, 0.8, f - 0.1 * sum(cola-colb)));\n}\nvec4 texSampler(sampler2D tex, vec2 tUv, float offsetScale) {\n return vec4(textureNoTile(tex, tUv, offsetScale), 1.0);\n}\n\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(diffuse, opacity);\n #include <logdepthbuf_fragment>\n\n // Custom UV Start\n vec2 vCustomMapUv[MAX_TEX];\n for (int i = 0; i < MAX_TEX; i++) {\n vCustomMapUv[i] = (mapUvTransArray[i] * vec3(vUv, 1.0)).xy;\n }\n vec2 vCustomMaskUv[MAX_TEX - 1];\n for (int i = 0; i < MAX_TEX - 1; i++) {\n vCustomMaskUv[i] = (maskUvTransArray[i] * vec3(vUv, 1.0)).xy;\n }\n // Custom UV End\n // Custom Texture Start\n float offsetScale = 1.2;\n vec4 maskColor = vec4(1.0);\n vec4 textureColor = vec4(1.0);\n #if MAX_TEX > 0\n textureColor = texSampler(mapArray[0], vCustomMapUv[0], offsetScale);\n #endif\n #if MAX_TEX > 1\n maskColor = texture2D(maskArray[0], vCustomMaskUv[0]);\n textureColor = mix(textureColor, texSampler(mapArray[1], vCustomMapUv[1], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 2\n maskColor = texture2D(maskArray[1], vCustomMaskUv[1]);\n textureColor = mix(textureColor, texSampler(mapArray[2], vCustomMapUv[2], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 3\n maskColor = texture2D(maskArray[2], vCustomMaskUv[2]);\n textureColor = mix(textureColor, texSampler(mapArray[3], vCustomMapUv[3], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 4\n maskColor = texture2D(maskArray[3], vCustomMaskUv[3]);\n textureColor = mix(textureColor, texSampler(mapArray[4], vCustomMapUv[4], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 5\n maskColor = texture2D(maskArray[4], vCustomMaskUv[4]);\n textureColor = mix(textureColor, texSampler(mapArray[5], vCustomMapUv[5], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 6\n maskColor = texture2D(maskArray[5], vCustomMaskUv[5]);\n textureColor = mix(textureColor, texSampler(mapArray[6], vCustomMapUv[6], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 7\n maskColor = texture2D(maskArray[6], vCustomMaskUv[6]);\n textureColor = mix(textureColor, texSampler(mapArray[7], vCustomMapUv[7], offsetScale), maskColor.r);\n #endif\n diffuseColor *= textureColor;\n // Custom Texture End\n\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D(lightMap, vUv2);\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3(1.0);\n #endif\n #include <aomap_fragment>\n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include <envmap_fragment>\n #include <output_fragment>\n gl_FragColor.rgb *= vec3(getShadowMask() * (1.0 - shadowShade) + shadowShade);\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}\n "};class B{constructor(e){this.tools={type:"MixTexture",getTextures(e){const t=[];return B.TextureNames.forEach((r=>{var n=parseInt(r.slice(-1));r.startsWith("terrainMap")?e.uniforms.mapArray.value[n]&&t.push({type:r,texture:e.uniforms.mapArray.value[n]}):r.startsWith("terrainMask")&&e.uniforms.maskArray.value[n]&&t.push({type:r,texture:e.uniforms.maskArray.value[n]})})),t},toNormal:e=>{const t=W(),r=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:this.tools.type,uniforms:{},name:e.name},textures:this.tools.getTextures(e)}),{}),n=e.uniforms,i=C.uniforms;return Object.keys(n).filter((e=>"mapArray"!==e&&"maskArray"!==e&&"mapUvTransArray"!==e&&"maskUvTransArray"!==e)).map((e=>{const t=n[e].value,a=i[e].value;"diffuse"===e?t.getHexString()!==a.getHexString()&&(r[e]=t.getHexString()):"uvTransform"===e?t.equals(a)||(r[e]=t):t!==a&&(r[e]=t)})),t.userData.normal.uniforms=r,t},parseData:e=>{const{textures:t,normal:r}=e,n=new a.ShaderMaterial({uniforms:a.UniformsUtils.merge([a.UniformsLib.lights,C.uniforms]),vertexShader:C.vertexShader,fragmentShader:C.fragmentShader,defines:C.defines,lights:!0});return n.name=r.name,this.insertShader(n),t.forEach((e=>{var t=parseInt(e.type.slice(-1));e.type.startsWith("terrainMap")?(n.uniforms.mapArray.value[t]=e.texture,this.onTexRepeatChange(n,t,!0)):e.type.startsWith("terrainMask")&&(n.uniforms.maskArray.value[t]=e.texture,this.onTexRepeatChange(n,t,!1))})),Object.keys(r.uniforms).filter((e=>!B.TextureNames.includes(e))).map((e=>{var t=r.uniforms[e];"diffuse"===e?n.uniforms[e].value=new a.Color(parseInt(t,16)):"uvTransform"!==e&&(n.uniforms[e].value=t)})),n.userData.tools=this.tools,n},clone:function(e,t){return e}},this.runScene=e}create(){const e=new a.ShaderMaterial({uniforms:a.UniformsUtils.merge([a.UniformsLib.lights,C.uniforms]),vertexShader:C.vertexShader,fragmentShader:C.fragmentShader,defines:C.defines,lights:!0});return this.insertShader(e),e.userData.tools=this.tools,e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new v.Z({target:e,typeList:["uniforms",...t],newVal:r}).execute())}insertShader(e){e&&(e.onBeforeCompile=e=>{e.fragmentShader=e.fragmentShader.replace(/\/\/ Insert Noise2D/g,S)})}onTexRepeatChange(e,t,r){e&&0<=t&&(r?(r=e.uniforms.mapArray.value[t],e.uniforms.mapUvTransArray.value[t].identity(),e.uniforms.mapUvTransArray.value[t].scale(r.repeat.x,r.repeat.y)):(r=e.uniforms.maskArray.value[t],e.uniforms.maskUvTransArray.value[t].identity(),e.uniforms.maskUvTransArray.value[t].scale(r.repeat.x,r.repeat.y)))}}B.TextureNames=["terrainMap0","terrainMap1","terrainMap2","terrainMap3","terrainMap4","terrainMap5","terrainMap6","terrainMap7","terrainMask0","terrainMask1","terrainMask2","terrainMask3","terrainMask4","terrainMask5","terrainMask6"];class _{constructor(e){this.tools={type:"Physical",getTextures(e){const t=[];return _.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},parseData:e=>{const{normal:t,textures:r,material:n}=e,i=X(n,new a.MeshPhysicalMaterial);return i.name=t.name,r.forEach((e=>{i[e.type]=e.texture})),Object.keys(t.uniforms).filter((e=>!_.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=X(e,W()),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=>!_.TextureNames.includes(e))).filter((e=>!_.IgnoredAttributes.includes(e))).filter((e=>void 0===t[e])).map((t=>{const 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){const 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 v.Z({target:e,typeList:[...t],newVal:r}).execute())}}_.IgnoredAttributes=["_listeners","version","userData"],_.TextureNames=["alphaMap","aoMap","bumpMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap","clearcoatMap","clearcoatNormalMap","clearcoatRoughnessMap","sheenRoughnessMap","sheenColorMap","specularIntensityMap","specularColorMap","thicknessMap","transmissionMap"];var E=r(8493);const T={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}"},D={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 P{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=>Y(e),parseData:e=>{const{textures:t,normal:r,models:n,material:i}=e,o=X(i,new O(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=>!P.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=>{const t=X(e,W()),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=k.uniforms;return Object.keys(n).filter((e=>!P.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){const t=e.material;var r=(0,i.getId)();t.userData.id=r,this.materials[r]=e}create(e){const t=new O(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 v.Z({target:e,typeList:[...t],newVal:r}).execute())}dispose(){this.materials={}}}P.TextureNames=["map","normalMap","roughnessMap","metalnessMap","tDiffuse","tDiffuseBlur"];class O extends a.MeshStandardMaterial{constructor(e,t,r){e?super(e):(super(),this.opacity=k.uniforms.opacity.value,this.transparent=k.uniforms.transparent.value,this.roughness=k.uniforms.roughness.value,this.metalness=k.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=k.uniforms.resolution.value,this.blurSize=k.uniforms.blurSize.value,this.mirror=new a.Uniform(k.uniforms.mirror.value),this.mixBlur=new a.Uniform(k.uniforms.mixBlur.value),this.mixStrength=new a.Uniform(k.uniforms.mixStrength.value),this.mixContrast=new a.Uniform(k.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 E.T(T),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 E.T(D),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=k.vertexParas+""+e.vertexShader,e.vertexShader=e.vertexShader.replace("#include <project_vertex>",k.vertexShader),e.fragmentShader=k.fragmentParas+""+e.fragmentShader,e.fragmentShader=e.fragmentShader.replace("#include <emissivemap_fragment>",k.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 k={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 "},R="\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 = noise3D((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 ",I="\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 ";class L{constructor(e){this.tools={type:"TreeLeaf",getTextures(e){const t=[];return L.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},toNormal:e=>{var t=this.tools.getTextures(e);const r=X(e,W()),n=(r.userData=Object.assign(Object.assign({},r.userData),{normal:{type:this.tools.type,uniforms:{},name:e.name},textures:t}),r.name=e.name,{}),i=new U(this.runScene);return Object.keys(e).filter((e=>!L.TextureNames.includes(e))).filter((e=>!L.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=>{const 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=X(n,new U(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=>!L.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)=>e},this.runScene=e}create(e){const t=new U(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 v.Z({target:t,typeList:[...r],newVal:n,cb:()=>{t.needsUpdate=!0}}).execute())}}L.IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines","onBeforeCompile"],L.TextureNames=["alphaMap","aoMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap"];const F=new a.Clock;class U 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=R,e.fragmentShader=I,e.vertexShader=e.vertexShader.replace(/\/\/ Insert Noise3D/g,M)}}update(){this.uniforms.time.value=F.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 G=r(1736),j=r(6214),N=r(5860),H=r(5410),z=r(1994),V=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 J={depthTest:!0,depthWrite:!0,alphaTest:0,side:0,displacementScale:1,visible:!0,normalScale:{x:1,y:1},aoMapIntensity:1,lightMapIntensity:1,envMapIntensity:1},K=["color","emissive","roughness","metalness","normalScale","aoMapIntensity","displacementScale","transparent","lightMapIntensity","envMapIntensity","opacity","alphaTest"];class Z{constructor(e){this.defMaterialMap={BaseMaterial:f,SpriteMaterial:p.Z,FakeInterior:g,Fresnel:b,Matcap:A,MixTexture:B,Physical:_,Reflector:P,TreeLeaf:L},this.defMaterial=W(),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:f,SpriteMaterial:p.Z,FakeInterior:new g(e),Fresnel:new b(e),Matcap:new A(e),MixTexture:new B(e),Physical:new _(e),Reflector:new P(e),TreeLeaf:new L(e)},this.addSetParses((e=>{const{material:t,type:r,newVal:n}=e;"opacity"===r&&n<1&&(t.transparent=!0)}))}add(e,t,r){ue.is(e)||this.runScene.uniqueEx.material.add(e,t,r)}create(){var e=new a.MeshStandardMaterial;return this.add(e),e}toArray(){return(0,n.js)(this.runScene.uniqueEx.material.map,((e,t)=>t.material))}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){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 j.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 j.Z(Object.assign(Object.assign({},e),{runScene:this.runScene})).execute(),t&&this.runScene.undoEx.addUndo(e),e}setTextures(e,t=!0){return V(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,G.setTextureMapping)(e.newVal);var o=i.map((t=>new j.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 V(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,G.setTextureMapping)(e.newVal),new j.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,H.Gm)({addUndo:!0,includeChild:!1},r);if(e&&t){const r=new Set;((0,H.lG)(e,"array")?e:[e]).map((e=>{i?e.traverse((e=>{oe(e.material)&&r.add(e)})):e.material&&r.add(e)}));const a=[];r.forEach((e=>{a.push(new N.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){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)(J,((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,a,o,s;void 0!==J[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&&f.isDefVal(e)}}const W=e=>{const t=new a.MeshStandardMaterial(e);return t.userData.id=(0,i.getId)(),t},X=(e,t)=>(K.map((r=>{const n=e[r];"object"==typeof n&&(t[r]=n.clone()),t[r]=n})),t),Q=e=>{e.dispose();const t=Y(e);0!==t.length&&t.map((e=>{e=e.texture,(0,G.disposeTexture)(e)}))},Y=e=>{var t=e.userData.textures||$(e);return delete e.userData.textures,t},q=e=>{var t;return(null==(t=null==(t=e.userData)?void 0:t.tools)?void 0:t.getTextures(e))||$(e)},$=e=>o.zX.map((t=>({type:t,texture:e[t]}))).filter((e=>e.texture)),ee=e=>{const{material:t,type:r,texture:n}=e;"envMap"===r&&(0,G.setTextureMapping)(n),t[r]=n,t.needsUpdate=!0},te=e=>{e.vertexColors=!1,e.depthWrite=!0,e.needsUpdate=!1},re=e=>null==e?void 0:e.isColor,ne=e=>{e.needsUpdate=!0},ie=e=>null==e?void 0:e.isMaterial,ae=e=>{},oe=e=>null==e?void 0:e.isMeshStandardMaterial,se={Sprite:p.Z},le=e=>{var t;return(null==(t=null==e?void 0:e.userData.tools)?void 0:t.type)||(null==e?void 0:e.type)},ue={set(e,t){t?(0,z.M)(e,"ignore",!0):delete e.userData.ignore},is:e=>!0===(0,z.is)(e,"ignore")}},5105:(e,t,r)=>{"use strict";r.d(t,{Z:()=>s});var n=r(8881),i=r(8239),a=r(811),o=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,o.M)(e,"name",e.name),(0,a.setLayers)(t,1===e.layers.mask?0:1)},toNormal:(e,t)=>{const r=(0,a.createDefModel)("Box");return r.userData.normal={type:"MySpriteMaterial"},r.material=e.material,s.modelTools.merge(e,r),r},parseData:(e,t)=>{const r=(0,a.createDefModel)("Sprite");var 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=>{const{textures:t,material:r}=e,n=(0,i.mergeMaterial)(r,s.create());var{depthWrite:e,depthTest:a,name:o}=r.userData.normal;return void 0!==e&&(n.depthWrite=e),void 0!==a&&(n.depthTest=a),o&&(n.name=o),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:()=>a,t9:()=>i,zf:()=>o});var n=r(1994);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){if(!e||"Scene"===e.type)return!1;var r=e.userData.lock;return t?!!r||o.isLock(e.parent,t):void 0!==r&&r}}},811:(e,t,r)=>{"use strict";r.r(t),r.d(t,{createDefModel:()=>T,createSpecialModel:()=>E,default:()=>_,delClonedModel:()=>z,deletedModel:()=>B.Ju,disposeModel:()=>D,dynamicModel:()=>B.t9,getClonedIdModel:()=>N,getDeepModels:()=>F,getModelSize:()=>Z,hasSkeleton:()=>U,instanceModel:()=>P,isDynamicModel:()=>j,isGLowModel:()=>V,isGroup:()=>K,isHelper:()=>I,isSprite:()=>J,lockModel:()=>B.zf,mergeModel:()=>O,normalModel:()=>X,selectableModel:()=>W,setClonedModel:()=>H,setDynamicModel:()=>G,setHelper:()=>R,setLayers:()=>L,withAnima:()=>k}),t=r(4356);var n=r.n(t),i=r(9716),a=r(2081),o=r(8881),s=r(8409),l=r(1819);const u=["Group","Box","Circle","Cylinder","Dodecahedron","Icosahedron","Lathe","Octahedron","Plane","Ring","Sphere","Sprite","Tetrahedron","Torus","TorusKnot","Tube","Reflector"];var c=r(5259),h=r(2016),d=r(6999),f=r(3352),p=r(5105),m=r(8239),v=r(1994),g=r(6875),y=r(9593),b=r(5860);class x 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 w=x;var A=r(986),S=r(1682),M=r(5244),C=r(5613);var B=r(7263);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,C.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=U(t),s=(e=>{const t={};return(0,C.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",N(l)||l.userData.id),(0,v.is)(t,"isDynamic")&&G(o,!0),(0,C.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)=>{const n=t[e];n&&(n.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,C.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,C.sameArr)([...e.array],[...t.array],20),t=(0,C.sameArr)([...r.array],[...i.array],20),r=(0,C.sameArr)([...n.array],[...a.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,C.validType)(e,"array"))return e.map((e=>this.setGeometryMap(e)));var t=N(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=N(t)||(0,M.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:a,parent:o}=t;this.remove(t,!1);const s=this.runScene.modelEx.clone(e);s.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;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,M.K)(e)],"detail");var{isDomTreeActive:t,isClone:r}=t||{};if(this.runScene.events.key.ctrl&&!r)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&&!k(e)}create(){return n().model.getModelByType("Box")}getById(e){return Array.isArray(e)?e.map((e=>this.runScene.uniqueEx.model.get(e))):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,C.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(T(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,i=[];i.push(new g.Z({model:n,runScene:this.runScene,parent:r||this.runScene.assetsEx.get().scene}).execute()),e instanceof Array?i.push(...e.map((e=>new w({target:e,oldParent:e.parent,newParent:n,runScene:this.runScene}).execute()))):i.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(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 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,i=this.runScene.sceneEx.getClearModels(),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)}))}));var o=a.map((e=>new b.Z({target:e,info:"visible",newVal:!1,runScene:this.runScene,oldVal:e.visible}).execute()));this.runScene.undoEx.addUndo(o),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 b.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 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){let i=new o.Raycaster,a=new o.Vector2,s=(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),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: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,C.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(),a=new o.Vector3,s=new o.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 o.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 o.Vector3;u.subVectors(r.position,s),u.projectOnPlane(new o.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,a.addVectors(s,u.multiplyScalar(l))}else{t.updateMatrixWorld(!0),l=new o.Vector3,e.getWorldPosition(l),s.set(l.x,l.y,l.z);let n=new o.Vector3;n.subVectors(r.position,s),n.projectOnPlane(new o.Vector3(0,1,0)),n.normalize(),a.addVectors(s,n.multiplyScalar(3))}(0,C.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={},r=Array.isArray(e)?e:[e],n=[];r.map((e=>{e.traverse((e=>{var r;e.geometry&&!j(e)&&(r=N(e))&&(n.push(e),t[r]||(t[r]=new Set),t[r].add(e))}))})),(0,a.js)(t,((e,t)=>{e=this.runScene.uniqueEx.model.get(e),t.size<2||!e||(t=P(e,[...t]),this.runScene.modelEx.add(t,void 0,{isClone:!1,select:!1,addUndo:!1}),V(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,C.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 o.Raycaster,l=new o.Vector2;var{engineDom:a,camera:s}=this.runScene.assetsEx.get();l.x=r.offsetX/a.clientWidth*2-1,l.y=-r.offsetY/a.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 E=e=>{},T=e=>{if(u.includes(e)){const t=n().model.getModelByType(e);return"Sprite"===t.type&&(t.material.userData.tools=p.Z.tools),t}throw TypeError("")},D=(e,t)=>{t=(t||{}).remove;const{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)},P=(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},O=(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)},k=e=>0!==e.animations.length,R=e=>{e&&e.userData&&(e.userData.isHelper=!0)},I=e=>null==(e=null==e?void 0:e.userData)?void 0:e.isHelper,L=(e,t)=>{null!=t&&(0===t?e.layers.set(0):e.layers.enable(1),(0,v.M)(e,"layers",t))},F=e=>{const t=[];e.traverse((e=>{t.push(e)}))},U=e=>{let t=!1;if(e)return e.traverse((e=>{e.isSkinnedMesh&&(t=!0)})),t},G=(e,t)=>{t?(0,v.M)(e,"isDynamic",!0):delete e.userData.isDynamic},j=(e,t)=>e&&t?!!e.userData.isDynamic||!!e.parent&&j(e.parent,t):null==(t=null==e?void 0:e.userData)?void 0:t.isDynamic,N=e=>e.userData.cloneId,H=(e,t)=>{(0,v.M)(e,"cloneId",t)},z=e=>{delete e.userData.cloneId},V=e=>1===e.userData.layers,J=e=>e.isSprite,K=e=>{},Z=e=>{var t=new o.Vector3;return(new o.Box3).setFromObject(e).getSize(t),t},W={open(e){delete e.userData.unSelectable},close(e){e.userData.unSelectable=!0},is:e=>void 0===e.userData.unSelectable},X={set(e,t){t?delete e.userData.unNormal:e.userData.unNormal=!0},is:e=>!(0,f.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)}},8266:(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){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 a=(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:()=>p,bv:()=>y,is:()=>g});var n=r(4547),i=r(9716),a=r(8881),o=r(8239),s=r(811),l=r(8266),u=r(1736),c=r(9593),h=r(5860),d=r(986),f=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 p{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){if(e){if(e instanceof Array){const t=[];return e.map((e=>{for(const r in this.removeMap){const{valid:n,remove:a}=this.removeMap[r];if(n(e))return t.push(...(0,i.multiArrToArr)(a(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),this.runScene.helperEx.unfocus()}}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 a.Group;return e.children.filter((e=>!this.runScene.helperEx.isHelper(e)&&!this.runScene.lightEx.isLight(e)&&s.normalModel.is(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 f(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.objects.reset(),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.pp.dispose(),this.runScene.pp.init(),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.pp.dispose(),a.Cache.clear()}render(){}create(){return new a.Scene}setEnv(e){return f(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());const a=this.runScene.assetsEx.get().renderer.domElement,{renderer:o,scene:s,camera:l}=(a.width=e,a.height=t,this.runScene.renderEx.setSize(e,t),this.runScene.assetsEx.get());return o.render(s,l),e=a.toDataURL("image/png",1),t=(0,n.base64ToFile)(e,"screenShot.png"),a.width=r,a.height=i,this.runScene.renderEx.setSize(),o.render(s,l),t}static toJSON(e){const 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=>{const{color:t,far:r,near:n}=e;return{color:t.getHexString(),far:r,near:n}},g=(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:()=>v,disposeTexture:()=>x,getBlobByTexture:()=>A,getCloneIdFromTexture:()=>P,getMimeByTexture:()=>y,getSizeByTexture:()=>E,getTextureGpuMemory:()=>b,getTextureMinFilter:()=>I,getUrlByTexture:()=>B,initTexture:()=>S,isClonedTexture:()=>D,isTexture:()=>T,loadTexture:()=>C,parseImageBitMapByBlob:()=>M,setTextureCloneId:()=>O,setTextureMapping:()=>_,setTextureMinFilter:()=>R,textureNameMap:()=>g,updateTexture:()=>k});var n=r(2081),i=r(9728),a=r(8881),o=r(6999),s=r(6214),l=r(5613),u=r(5244),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 f=r(8239),p=r(1994),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=>{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,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 C(r,t),r)}))}clone(e){const 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,p.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,f.updateMaterial)(r)}}).execute())})),(0,f.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;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=o.Z.RepeatWrapping,e.wrapT=o.Z.RepeatWrapping,e.encoding=3e3,e.version=3,e.flipY=!1,"nearest"!==I(e)&&(e.minFilter=o.Z.LinearMipmapLinearFilter),e.needsUpdate=!0,e),M=(e,t)=>{let r={resizeQuality:"pixelated"};return null!=t&&t.flipY&&(r.imageOrientation="flipY"),createImageBitmap(e,r)},C=(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)})),B=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},k=e=>{e.needsUpdate=!0},R=(e,t)=>{e.minFilter=o.Z["linear"===t?"LinearMipmapLinearFilter":"NearestFilter"],(0,p.M)(e,"minFilter",t),k(e)},I=e=>(0,p.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: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){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:a}=e;r.add(t),n&&a.uniqueEx.model.add(t),n&&a.cb.model.add.cb({model:t,parent:r,isClone:i}),this.cb(t,"add"),a.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:()=>a});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: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},9593:(e,t,r)=>{"use strict";r.d(t,{Z:()=>o});var n=r(9716),i=r(2081);class a 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 o=a},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: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},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},5244:(e,t,r)=>{"use strict";r.d(t,{Z:()=>h,K:()=>d});var n=r(2081),i=r(9728),a=r(8239);class o{constructor(e){this.map={},this.removes=[],this.unique=e}add(e,t,r){if(null!=e&&e.userData&&!a.materialIgnore.is(e)){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 s=r(6001),l=r(7391);class u 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?-1:(e=e.slice(t+1),s.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 a=i.name;if(a=a||i.type,!this.nameMap[a])return o=this.unique.getId(i),(s=r(o))&&delete this.nameMap[s],void(this.nameMap[a]=o);var o,s=this.nameMap[a];return this.unique.model.get(s)!==i?(o=e(a),o=t(a,s=-1===o?0:o),this.nameMap[o]=this.unique.getId(i),i.name=o):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 a=e.userData.id;if(a&&!r||(a=(0,i.getId)(),e.userData.id=a),this.map[a]){if(!(n||(0,l.An)(this.unique.runScene)&&(0,l.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=>{const r=t.toLowerCase();return r===(t=e.toLowerCase())||-1!==r.indexOf(t)}));return t=this.getIdByNames(t),this.getModelsWithIds(t)}}class c{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 h{constructor(e){this.runScene=e,this.model=new u(this),this.material=new o(this),this.texture=new c(this)}getId(e){return e.userData.id}dispose(){this.material.dispose(),this.model.dispose(),this.texture.dispose()}}const d=e=>(null==(e=null==e?void 0:e.userData)?void 0:e.id)||""},5613:(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,getBetweenDomByIdx:()=>l,getCamAnimaData:()=>a.Gm,getClock:()=>a.aM,getCurve:()=>a.kG,getDistance:()=>a.Sp,getEmptyImageData:()=>n.mH,getFilesByDataTransfer:()=>i.xl,getFilesFromFileList:()=>i.kk,getIdxInParent:()=>s,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(7179),i=r(5410),a=r(9960),o=r(7391);const s=e=>[...e.parentElement.children].findIndex((t=>t===e)),l=e=>{var{dom:e,beginIdx:t,endIdx:r}=e;return[...e.children].slice(t,r+1)}},7179:(e,t,r)=>{"use strict";r.d(t,{BW:()=>p,Cm:()=>f,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(6999),i=r(1736),a=r(5410),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=>{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=>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=>{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=>o(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")),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"),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)}))},f=e=>o(void 0,void 0,void 0,(function*(){var{bitmap:t,texture:r}=e;const{ctx:i,canvas:o}=yield(0,a.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=v(s.data[l],s.data[l+1],s.data[l+2]))[0]/100,h=d[1]/100,d=d[2]/100;c=g(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(o)})),p=e=>{for(var t=(e=e.bitmap).width,r=e.height,n=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=>{const 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;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,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));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,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="";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")),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*(){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(""),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=>{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 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){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:()=>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},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,aM:()=>fe,kG:()=>oe,Sp:()=>Y,SI:()=>le,yT:()=>ce,hX:()=>ae,VU:()=>X,hs:()=>ie,vp:()=>ne,xr:()=>Q});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)).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),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 f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e){return(p=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=p(e);if(r=t?(r=p(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 f(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(f(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)}m.prototype.isLineMaterial=!0;var b,x,w,A,S=new n.Vector3,M=new n.Vector3,C=new n.Vector4,B=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,k=new n.Sphere,R=new n.Vector4;function I(e,t,r){return R.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),R.multiplyScalar(1/R.w),R.x=A/r.width,R.y=A/r.height,R.applyMatrix4(e.projectionMatrixInverse),R.multiplyScalar(1/R.w),Math.abs(Math.max(R.x,R.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)).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(),k.copy(o.boundingSphere).applyMatrix4(e),a=r?.5*A:I(i,Math.max(i.near,k.distanceToPoint(b.origin)),s.resolution),k.radius+=a,!1!==b.intersectsSphere(k)&&(null===o.boundingBox&&o.computeBoundingBox(),O.copy(o.boundingBox).applyMatrix4(e),a=r?.5*A:I(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 f=this,p=t,m=(o=i).projectionMatrix,v=f.material.resolution,g=f.matrixWorld,y=(e=f.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 R,L,F,U,G=0,j=y.count;G<j;G++)C.fromBufferAttribute(y,G),B.fromBufferAttribute(S,G),C.w=1,B.w=1,C.applyMatrix4(T),B.applyMatrix4(T),C.z>M&&B.z>M||(C.z>M?(R=C.z-B.z,R=(C.z-M)/R,C.lerp(B,R)):B.z>M&&(R=B.z-C.z,L=(B.z-M)/R,B.lerp(C,L)),C.applyMatrix4(m),B.applyMatrix4(m),C.multiplyScalar(1/C.w),B.multiplyScalar(1/B.w),C.x*=v.x/2,C.y*=v.y/2,B.x*=v.x/2,B.y*=v.y/2,D.start.copy(C),D.start.z=0,D.end.copy(B),D.end.z=0,L=D.closestPointToPointParameter(E,!0),D.at(L,P),F=-1<=(F=n.MathUtils.lerp(C.z,B.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),p.push({point:U,pointOnLine:F,distance:b.origin.distanceTo(U),object:f,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 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)).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 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)}N.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"===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)).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)),Z=r(8235),W=r(6999);const X=(e,t)=>(t.updateMatrixWorld(!0),t=new W.Z.Vector3,e.getWorldPosition(t),t),Q={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 Z.cp(e),$=e=>new K.j(e),ee=e=>new Z.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)},ae=(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)},oe=(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 a=new n.Line(i,e);return a.visible=t,{line:a,curve:r}},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{pointArray:e,material:t,lineWidth:r,colorArray:i}=e;const a=new N,o=(a.setPositions(e),t||new m({transparent:!0,side:n.DoubleSide,linewidth:r||5,vertexColors:!0})),s=(a.setColors(i||[1,1,1]),o.resolution.set(window.innerWidth,window.innerHeight),new J(a,o));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,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}},fe=()=>new W.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__},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 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}())},8493:(e,t,r)=>{"use strict";r.d(t,{T:()=>u});var n=r(8881),i=r(8512);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)},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 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)).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=(c.prototype.isCSS2DObject=!0,new t.Vector3),d=new t.Matrix4,f=new t.Matrix4,p=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 p.setFromMatrixPosition(e.matrixWorld),m.setFromMatrixPosition(t.matrixWorld),p.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),f.multiplyMatrices(t.projectionMatrix,d),function e(t,r,i){var o;t.isCSS2DObject&&(h.setFromMatrixPosition(t.matrixWorld),h.applyMatrix4(f),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,/apple/i.test(navigator.vendor)?o.style.transform="translate(-50%,-50%) translate("+Math.round(h.x*n+n)+"px,"+Math.round(-h.y*a+a)+"px)":o.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,p=t.children.length;d<p;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,p=r.length;o<p;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"}}))},8235:(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 f=new n.Vector3,p=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)).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=(v.prototype.isCSS3DObject=!0,function(){u(t,v);var e=h(t);function t(r){return a(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=(g.prototype.isCSS3DSprite=!0,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(f,p,m),y.setPosition(f),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"}}))},8409:(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,f=0,p=0;p<e.length;++p){var m,v,g=e[p],y=0;if(o!=(null!==g.index))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+p+". 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 "+p+'. 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 "+p+". 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 "+p+". .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 "+p+". .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 "+p+". The geometry must have either an index or a position attribute"),null;b=g.attributes.position.count}d.addGroup(f,b,p),f+=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 C=i(u[t]);if(!C)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+t+" attribute."),null;d.setAttribute(t,C)}for(r in c){var B=c[r][0].length;if(0===B)break;d.morphAttributes=d.morphAttributes||{},d.morphAttributes[r]=[];for(var _=0;_<B;++_){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:()=>Bs});var e={},t=(__webpack_require__.r(e),__webpack_require__.d(e,{AsyncCompress:()=>Si,AsyncDecompress:()=>Ui,AsyncDeflate:()=>mi,AsyncGunzip:()=>_i,AsyncGzip:()=>Si,AsyncInflate:()=>bi,AsyncUnzipInflate:()=>sa,AsyncUnzlib:()=>Ri,AsyncZipDeflate:()=>na,AsyncZlib:()=>Pi,Compress:()=>Ai,DecodeUTF8:()=>Vi,Decompress:()=>Fi,Deflate:()=>pi,EncodeUTF8:()=>Ji,Gunzip:()=>Bi,Gzip:()=>Ai,Inflate:()=>yi,Unzip:()=>la,UnzipInflate:()=>oa,UnzipPassThrough:()=>aa,Unzlib:()=>ki,Zip:()=>ia,ZipDeflate:()=>ra,ZipPassThrough:()=>ta,Zlib:()=>Di,compress:()=>Mi,compressSync:()=>Ci,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]?Ei:8!=(15&e[0])||7<e[0]>>4||(e[0]<<8|e[1])%31?xi:Ii)(e,t,r)},decompressSync:()=>function(e,t){return(31==e[0]&&139==e[1]&&8==e[2]?Ti:8!=(15&e[0])||7<e[0]>>4||(e[0]<<8|e[1])%31?wi:Li)(e,t)},deflate:()=>vi,deflateSync:()=>gi,gunzip:()=>Ei,gunzipSync:()=>Ti,gzip:()=>Mi,gzipSync:()=>Ci,inflate:()=>xi,inflateSync:()=>wi,strFromU8:()=>Zi,strToU8:()=>Ki,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!=ai(e,a);--a)if(!a||65558<e.length-a)return void t("invalid zip file",null);var o=ii(e,a+8);o||t(null,{});var s=o,l=ai(e,a+16),u=4294967295==l;if(u){if(a=ai(e,a-12),101075792!=ai(e,a))return void t("invalid zip file",null);s=o=ai(e,a+32),l=ai(e,a+48)}for(var c=function(a){function s(e,r){e?(n(),t(e,null)):(i[f]=r,--o||t(null,i))}var c=(m=Qi(e,l,u))[0],h=m[1],d=m[2],f=m[3],p=m[4],m=m[5];if(m=Xi(e,m),l=p,c)if(8==c)if(p=e.subarray(m,m+h),h<32e4)try{s(null,wi(p,new en(d)))}catch(a){s(a,null)}else r.push(xi(p,{size:d},s));else s("unknown compression type "+c,null);else s(null,En(e,m,m+h))},h=0;h<s;++h)c();return n},unzipSync:()=>function(e){for(var t={},r=e.length-22;101010256!=ai(e,r);--r)if(!r||65558<e.length-r)throw"invalid zip file";var n=ii(e,r+8);if(!n)return{};var i=ai(e,r+16),a=4294967295==i;if(a){if(r=ai(e,r-12),101075792!=ai(e,r))throw"invalid zip file";n=ai(e,r+32),i=ai(e,r+48)}for(var o=0;o<n;++o){var s=(d=Qi(e,i,a))[0],l=d[1],u=d[2],c=d[3],h=d[4],d=d[5];if(d=Xi(e,d),i=h,s){if(8!=s)throw"unknown compression type "+s;t[c]=wi(e.subarray(d,d+l),new en(u))}else t[c]=En(e,d,d+l)}return t},unzlib:()=>Ii,unzlibSync:()=>Li,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 en(u+22),t=l,n=u-l,i=u=0;i<c;++i){var a=h[i];try{var o=a.c.length,s=($i(e,u,a,a.f,a.u,o),30+a.f.length+qi(a.extra)),d=u+s;e.set(a.c,d),$i(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)}}ea(e,l,h.length,n,t),r(null,e)}var a={},o=(Gi(e,"",a,t),Object.keys(a)),s=o.length,l=0,u=0,c=s,h=new Array(s),d=[];s||i();for(var f=function(e){function t(t,a){t?(n(),r(t,null)):(t=a.length,h[e]=Jn(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],f=a[c],p=f[0],m=f[1],v=Hn(),g=p.length,y=(v.p(p),Ki(c)),b=y.length,x=m.comment,w=x&&Ki(x),A=w&&w.length,S=qi(m.extra),M=0==m.level?0:8;if(65535<b&&t("filename too long",null),M)if(g<16e4)try{t(null,gi(p,m))}catch(f){t(f,null)}else d.push(vi(p,m,t));else t(null,p)},p=0;p<c;++p)f(p);return n},zipSync:()=>function(e,t){var r,n={},i=[],a=(Gi(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=Ki(r)).length,h=s.comment,d=h&&Ki(h),f=d&&d.length,p=qi(s.extra);if(65535<c)throw"filename too long";var m=u?gi(l,s):l,v=m.length,g=Hn();g.p(l),i.push(Jn(s,{size:l.length,crc:g.d(),c:m,f:x,m:d,u:c!=r.length||d&&h.length!=f,o:a,compression:u})),a+=30+c+p+v,o+=76+2*(c+p)+(f||0)+v}for(var y=new en(o+22),b=(e=a,t=o-a,0);b<i.length;++b){var x=i[b],w=($i(y,x.o,x,x.f,x.u,x.c.length),30+x.f.length+qi(x.extra));y.set(x.c,x.o+w),$i(y,a,x,x.f,x.u,x.c.length,x.o,x.m),a+=16+w+(x.m?x.m.length:0)}return ea(y,a,i.length,t,e),y},zlib:()=>function(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return ni(e,t,[Qn,$n,function(){return[Oi]}],(function(e){return ti(Oi(e.data[0],e.data[1]))}),4,r)},zlibSync:()=>Oi}),{}),r=(__webpack_require__.r(t),__webpack_require__.d(t,{FBXLoader:()=>Ba}),__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 f=new r.Raycaster,p=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.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,f=new r.Quaternion,p=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",f),c("cameraPosition",p),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.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&&(f.setFromCamera(e,this.camera),e=S(this._gizmo.picker[this.mode],f),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&&(f.setFromCamera(e,this.camera),(e=S(this._plane,f,!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&&(f.setFromCamera(e,this.camera),(e=S(this._plane,f,!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(p.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(p.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)):(p.copy(this.pointStart),m.copy(this.pointEnd),p.applyQuaternion(this._worldQuaternionInv),m.applyQuaternion(this._worldQuaternionInv),m.divide(p),-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(p.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(p.copy(this.rotationAxis).cross(this.eye))*e):"X"!==t&&"Y"!==t&&"Z"!==t||(this.rotationAxis.copy(g[t]),p.copy(g[t]),"local"===i&&p.applyQuaternion(this.worldQuaternion),this.rotationAngle=this._offset.dot(p.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)).normalize()):(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 f}},{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 M=new r.Euler,C=new r.Vector3(0,1,0),B=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),k=new r.Vector3(0,1,0),R=new r.Vector3(0,0,1),I=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,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 f=(((a=a.clone()).color.setHex(7895160),v=new r.CylinderGeometry(0,.04,.1,12)).translate(0,.05,0),new r.BoxGeometry(.08,.08,.08)),p=(f.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}(p.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(p,o.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new r.Line(p,o.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new r.Line(p,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(p,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(f,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(f,w),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new r.Mesh(f,A),[0,.5,0]],[new r.Mesh(S,A)],[new r.Mesh(f,A),[0,-.5,0],[0,0,Math.PI]]],Z:[[new r.Mesh(f,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(f,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(p,o.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new r.Line(p,o.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new r.Line(p,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(C.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(C.copy(k).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(C.copy(R).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"XYZE"===r.axis&&(v.setFromEuler(M.set(0,Math.PI/2,0)),C.copy(r.rotationAxis),t.quaternion.setFromRotationMatrix(_.lookAt(B,C,k)),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),p.set(1e-10,1e-10,1e-10).add(r.worldPositionStart).sub(r.worldPosition).multiplyScalar(-1),p.applyQuaternion(r.worldQuaternionStart.clone().invert()),t.scale.copy(p),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(C.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(C.copy(k).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Z"===t.name&&.99<Math.abs(C.copy(R).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XY"===t.name&&Math.abs(C.copy(R).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"YZ"===t.name&&Math.abs(C.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(C.copy(k).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1)):"rotate"===r.mode&&(E.copy(n),C.copy(r.eye).applyQuaternion(v.copy(n).invert()),-1!==t.name.search("E")&&t.quaternion.setFromRotationMatrix(_.lookAt(r.eye,B,k)),"X"===t.name&&(v.setFromAxisAngle(O,Math.atan2(-C.y,C.z)),v.multiplyQuaternions(E,v),t.quaternion.copy(v)),"Y"===t.name&&(v.setFromAxisAngle(k,Math.atan2(C.x,C.z)),v.multiplyQuaternions(E,v),t.quaternion.copy(v)),"Z"===t.name&&(v.setFromAxisAngle(R,Math.atan2(C.y,C.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=(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 o(t,[{key:"updateMatrixWorld",value:function(e){var r=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(r="local"),I.copy(O).applyQuaternion("local"===r?this.worldQuaternion:T),L.copy(k).applyQuaternion("local"===r?this.worldQuaternion:T),F.copy(R).applyQuaternion("local"===r?this.worldQuaternion:T),C.copy(L),this.mode){case"translate":case"scale":switch(this.axis){case"X":C.copy(this.eye).cross(I),D.copy(I).cross(C);break;case"Y":C.copy(this.eye).cross(L),D.copy(L).cross(C);break;case"Z":C.copy(this.eye).cross(F),D.copy(F).cross(C);break;case"XY":D.copy(F);break;case"YZ":D.copy(I);break;case"XZ":C.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(p.set(0,0,0),D,C),this.quaternion.setFromRotationMatrix(P)),s(d(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}()),j=(G.prototype.isTransformControlsPlane=!0,__webpack_require__(3300)),N=__webpack_require__.n(j),H=__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,a,o){var s=r.exports.sbrk,l=n+3&-4,u=s(l*i),c=s(a.length),h=new Uint8Array(r.exports.memory.buffer);if(0==(h.set(a,c),e=e(u,n,i,c,a.length))&&o&&o(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 a=0;for(n=0;n<e.length;++n)r[a++]=r[n]<60?t[r[n]]:64*(r[n]-60)+r[++n];return r.buffer.slice(0,a)}(n),{}).then((function(e){(r=e.instance).exports.__wasm_call_ctors()}));var a={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},o={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,o,s){i(r.exports.meshopt_decodeVertexBuffer,e,t,n,o,r.exports[a[s]])},decodeIndexBuffer:function(e,t,n,a){i(r.exports.meshopt_decodeIndexBuffer,e,t,n,a)},decodeIndexSequence:function(e,t,n,a){i(r.exports.meshopt_decodeIndexSequence,e,t,n,a)},decodeGltfBuffer:function(e,t,n,s,l,u){i(r.exports[o[l]],e,t,n,s,r.exports[a[u]])}}}();function Z(e){return(Z="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 W(e,t){return(W=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function X(e){return(X=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Q=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&&W(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=X(e);if(r=t?(r=X(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Z(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(Q.has(e)){if((l=Q.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)})),Q.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":Z(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,f,p,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(),p=(f=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(p),u.GetAttributeDataArrayForAllPoints(c,S,m,p,v),u=new A(M.HEAPF32.buffer,v,f).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),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,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 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 ae=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 a=this,o=q.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){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),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}(),oe=(ae.prototype.isImageBitmapLoader=!0,__webpack_require__(5613));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,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)||ce(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=ce(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,a=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(o)throw i}}}}function ue(e){return function(e){if(Array.isArray(e))return he(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ce(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 ce(e,t){if(e){if("string"==typeof e)return he(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)?he(e,t):void 0}}function he(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 de(e){return(de="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 fe(){return(fe="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=we(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 me(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 ve(e,t,r){return t&&me(e.prototype,t),r&&me(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&&ye(e,t)}function ye(e,t){return(ye=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function be(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=we(e);if(r=t?(r=we(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===de(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return xe(n)}}function xe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function we(e){return(we=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ae=function(){ge(t,r.Loader);var e=be(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 _e(e)})),r.register((function(e){return new ke(e)})),r.register((function(e){return new Re(e)})),r.register((function(e){return new Ee(e)})),r.register((function(e){return new Te(e)})),r.register((function(e){return new De(e)})),r.register((function(e){return new Pe(e)})),r.register((function(e){return new Oe(e)})),r.register((function(e){return new Ce(e)})),r.register((function(e){return new Ie(e)})),r}return ve(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))===Le){try{s[Me.KHR_BINARY_GLTF]=new Fe(e)}catch(e){return void(i&&i(e))}o=s[Me.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 nt(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 f=0;f<u.extensionsUsed.length;++f){var p=u.extensionsUsed[f],m=u.extensionsRequired||[];switch(p){case Me.KHR_MATERIALS_UNLIT:s[p]=new Be;break;case Me.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:s[p]=new Ne;break;case Me.KHR_DRACO_MESH_COMPRESSION:s[p]=new Ue(u,this.dracoLoader);break;case Me.KHR_TEXTURE_TRANSFORM:s[p]=new Ge;break;case Me.KHR_MESH_QUANTIZATION:s[p]=new He;break;default:0<=m.indexOf(p)&&void 0===l[p]&&console.warn('THREE.GLTFLoader: Unknown extension "'+p+'".')}}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 Se(){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 Me={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"},Ce=function(){function e(t){pe(this,e),this.parser=t,this.name=Me.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return ve(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}(),Be=function(){function e(){pe(this,e),this.name=Me.KHR_MATERIALS_UNLIT}return ve(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}(),_e=function(){function e(t){pe(this,e),this.parser=t,this.name=Me.KHR_MATERIALS_CLEARCOAT}return ve(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=Me.KHR_MATERIALS_SHEEN}return ve(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}(),Te=function(){function e(t){pe(this,e),this.parser=t,this.name=Me.KHR_MATERIALS_TRANSMISSION}return ve(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}(),De=function(){function e(t){pe(this,e),this.parser=t,this.name=Me.KHR_MATERIALS_VOLUME}return ve(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}(),Pe=function(){function e(t){pe(this,e),this.parser=t,this.name=Me.KHR_MATERIALS_IOR}return ve(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}(),Oe=function(){function e(t){pe(this,e),this.parser=t,this.name=Me.KHR_MATERIALS_SPECULAR}return ve(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=[],a=(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(a[0],a[1],a[2]),void 0!==e.specularColorTexture&&i.push(n.assignTexture(t,"specularColorMap",e.specularColorTexture).then((function(e){e.encoding=r.sRGBEncoding}))),Promise.all(i)}}]),e}(),ke=function(){function e(t){pe(this,e),this.parser=t,this.name=Me.KHR_TEXTURE_BASISU}return ve(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}(),Re=function(){function e(t){pe(this,e),this.parser=t,this.name=Me.EXT_TEXTURE_WEBP,this.isSupported=null}return ve(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],a=n.images[i.source],o=r.textureLoader;return a.uri&&null!==(i=r.options.manager.getHandler(a.uri))&&(o=i),this.detectSupport().then((function(i){if(i)return r.loadTextureImage(e,a,o);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=Me.EXT_MESHOPT_COMPRESSION,this.parser=t}return ve(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}(),Le="glTF",Fe=ve((function e(t){pe(this,e),this.name=Me.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!==Le)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.")})),Ue=function(){function e(t,r){if(pe(this,e),!r)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Me.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=r,this.dracoLoader.preload()}return ve(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=Qe[r]||r.toLowerCase();l[h]=s[r]}for(n in e.attributes){var d,f,p=Qe[n]||n.toLowerCase();void 0!==s[n]&&(d=i.accessors[e.attributes[n]],f=Ke[d.componentType],c[p]=f,u[p]=!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}(),Ge=function(){function e(){pe(this,e),this.name=Me.KHR_TEXTURE_TRANSFORM}return ve(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(){ge(t,r.MeshStandardMaterial);var e=be(t);function t(n){pe(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(xe(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 ve(t,[{key:"copy",value:function(e){return fe(we(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}(),Ne=function(){function e(){pe(this,e),this.name=Me.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 ve(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}(),He=ve((function e(){pe(this,e),this.name=Me.KHR_MESH_QUANTIZATION})),ze=function(){ge(t,r.Interpolant);var e=be(t);function t(r,n,i,a){return pe(this,t),e.call(this,r,n,i,a)}return ve(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}(),Ve=(ze.prototype.beforeStart_=ze.prototype.copySampleValue_,ze.prototype.afterEnd_=ze.prototype.copySampleValue_,ze.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,f=t-r,p=1-d,m=f-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]=p*g+m*y+d*b+f*x}return i},new r.Quaternion),Je=function(){ge(t,ze);var e=be(t);function t(){return pe(this,t),e.apply(this,arguments)}return ve(t,[{key:"interpolate_",value:function(e,r,n,i){return e=fe(we(t.prototype),"interpolate_",this).call(this,e,r,n,i),Ve.fromArray(e).normalize().toArray(e),e}}]),t}(),Ke={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Ze={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"},Ye={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},qe={CUBICSPLINE:void 0,LINEAR:r.InterpolateLinear,STEP:r.InterpolateDiscrete};function $e(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 et(e,t){void 0!==t.extras&&("object"===de(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function tt(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 rt(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 nt=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 Se,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 ae(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 ve(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(ue(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:{}};$e(i,a,n),et(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=this;if(e.refs[t]<=1)return r;var i=r.clone();return function e(t,r){var i,a=n.associations.get(t),o=(null!=a&&n.associations.set(r,a),le(t.children.entries()));try{for(o.s();!(i=o.n()).done;){var s=se(i.value,2),l=s[0];e(s[1],r.children[l])}}catch(e){o.e(e)}finally{o.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[Me.KHR_BINARY_GLTF].body);var i=this.options;return new Promise((function(e,a){n.load(r.LoaderUtils.resolveURL(t.uri,i.path),e,void 0,(function(){a(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 a,o=e[0],s=Xe[i.type],l=Ke[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,f=h&&h!==u*s?(p=Math.floor(c/h),m="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+p+":"+i.count,(v=t.cache.get(m))||(a=new l(o,p*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 p=Ke[i.sparse.indices.componentType],m=i.sparse.indices.byteOffset||0,v=i.sparse.values.byteOffset||0,g=new p(e[1],m,i.sparse.count*Xe.SCALAR),y=new l(e[2],v,i.sparse.count*s);null!==o&&(f=new r.BufferAttribute(f.array.slice(),f.itemSize,f.normalized));for(var b=0,x=g.length;b<x;b++){var w=g[b];if(f.setX(w,y[b*s]),2<=s&&f.setY(w,y[b*s+1]),3<=s&&f.setZ(w,y[b*s+2]),4<=s&&f.setW(w,y[b*s+3]),5<=s)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return f})))}},{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]?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=Ze[n.magFilter]||r.LinearFilter,t.minFilter=Ze[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: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,oe.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[Me.KHR_TEXTURE_TRANSFORM]&&(a=void 0!==r.extensions?r.extensions[Me.KHR_TEXTURE_TRANSFORM]:void 0)&&(o=n.associations.get(i),i=n.extensions[Me.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||{})[Me.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]?(u=a[Me.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS],t=u.getMaterialType(),l.push(u.extendParams(s,o,n))):i[Me.KHR_MATERIALS_UNLIT]?(u=a[Me.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[Me.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),et(i,o),n.associations.set(i,{materials:e}),o.extensions&&$e(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[Me.KHR_DRACO_MESH_COMPRESSION])?"draco:"+c.bufferView+":"+c.indices+":"+tt(c.attributes):u.indices+":"+tt(u.attributes)+":"+u.mode),c=i[u];c?a.push(c.promise):(c=void 0,c=l.extensions&&l.extensions[Me.KHR_DRACO_MESH_COMPRESSION]?function(e){return n[Me.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(r){return it(r,e,t)}))}(l):it(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],f=o[c],p=void 0,m=s[c];if(4===f.mode||5===f.mode||6===f.mode||void 0===f.mode)!0!==(p=new(!0===a.isSkinnedMesh?r.SkinnedMesh:r.Mesh)(d,m)).isSkinnedMesh||p.geometry.attributes.skinWeight.normalized||p.normalizeSkinWeights(),5===f.mode?p.geometry=at(p.geometry,r.TriangleStripDrawMode):6===f.mode&&(p.geometry=at(p.geometry,r.TriangleFanDrawMode));else if(1===f.mode)p=new r.LineSegments(d,m);else if(3===f.mode)p=new r.Line(d,m);else if(2===f.mode)p=new r.LineLoop(d,m);else{if(0!==f.mode)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+f.mode);p=new r.Points(d,m)}if(0<Object.keys(p.geometry.morphAttributes).length){A=w=x=b=y=v=void 0;var v=p,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.")}}p.name=t.createUniqueName(a.name||"mesh_"+e),et(p,a),f.extensions&&$e(i,p,f),t.assignFinalMaterial(p),u.push(p)}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 C=new r.Group;t.associations.set(C,{meshes:e});for(var B=0,_=u.length;B<_;B++)C.add(u[B]);return C}))}},{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)),et(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,f=void 0!==t.parameters?t.parameters[h.input]:h.input,p=void 0!==t.parameters?t.parameters[h.output]:h.output;n.push(this.getDependency("node",d)),i.push(this.getDependency("accessor",f)),a.push(this.getDependency("accessor",p)),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 f=void 0;switch(Ye[d.path]){case Ye.weights:f=r.NumberKeyframeTrack;break;case Ye.rotation:f=r.QuaternionKeyframeTrack;break;default:f=r.VectorKeyframeTrack}e=t.name||t.uuid;var p=void 0!==h.interpolation?qe[h.interpolation]:r.InterpolateLinear,m=[],v=(Ye[d.path]===Ye.weights?t.traverse((function(e){e.morphTargetInfluences&&m.push(e.name||e.uuid)})):m.push(e),c.array);if(c.normalized){for(var g=rt(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 f(m[w]+"."+Ye[d.path],n.array,v,p);"CUBICSPLINE"===h.interpolation&&(S.createInterpolant=function(e){return new(this instanceof r.QuaternionKeyframeTrack?Je:ze)(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),et(l,o),o.extensions&&$e(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)),et(a,e),e.extensions&&$e(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){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}));var t})).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=ue(s.entries()).sort((function(e,t){return e[0]-t[0]})).map((function(e){return(e=se(e,2))[0],e[1]})),s.clear()))}catch(t){console.log(t,"e")}var h=[];if(u.children)for(var d=u.children,f=new Map,p=0,m=d.length;p<m;p++){var v=d[p];h.push(e({idMap:f,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=le(i.associations);try{for(a.s();!(t=a.n()).done;){var o=se(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 it(e,t,n){var i,a=t.attributes,o=[];for(i in a){var s=Qe[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)),et(e,t);var l=e,u=t,c=n,h=u.attributes,d=new r.Box3;if(void 0!==h.POSITION){var f=(h=c.json.accessors[h.POSITION]).min,p=h.max;if(void 0===f||void 0===p)console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");else{d.set(new r.Vector3(f[0],f[1],f[2]),new r.Vector3(p[0],p[1],p[2])),h.normalized&&(f=rt(Ke[h.componentType]),d.min.multiplyScalar(f),d.max.multiplyScalar(f));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=rt(Ke[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,p=new r.Sphere,d.getCenter(p.center),p.radius=d.min.distanceTo(d.max)/2,l.boundingSphere=p}}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=[],f=[],p=[],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,f.push(g)),l&&(y=void 0!==y.COLOR_0?a.getDependency("accessor",y.COLOR_0):r.attributes.color,p.push(y))}return Promise.all([Promise.all(d),Promise.all(f),Promise.all(p)]).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 at(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__(8409);var ot=__webpack_require__(5259),st=__webpack_require__(6999),lt=__webpack_require__(5105),ut=__webpack_require__(811),ct=__webpack_require__(1736),ht=__webpack_require__(5410),dt=__webpack_require__(8239),ft=__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:a,repeat:o}=r;const s=this.textureIns[t];s&&(s.format=r,e({target:s.repeat,data:o}),e({target:s.center,data:n}),e({target:s.offset,data:a}),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 a=this.runScene.materialEx.getDataByType(r.type,{normal:r,textures:e,models:n,material:i});this.runScene.materialEx.parseNromals(r,a),a&&n.map((e=>e.material=a))};return r=>{(0,z.js)(r,((r,n)=>{if(r=this.materialIns[r]){const{material:i,models:a}=r;i&&(({normal:r,textures:n}=n),(r.type?t:e)({textures:n,models:a,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,dt.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:a,type:o,material:s}=i;this.runScene.uniqueEx.texture.addMaterial(a,{material:s,type:o}),(0,dt.setMaterialTexture)({material:s,type:o,texture:a}),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 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){const{textureDef:t,texture:r}=e;var{md5:e,format:n,size:i,uvScript:a,id:o,cloneSourceId:s,minFilter:l}=t;r.userData.md5=e,n&&(r.format=n,r.userData.format=n),a&&(r.userData.uvScript=a),s&&((0,ct.setTextureCloneId)(r,s),this.clonedTextures.push(r)),"nearest"===l&&((0,ct.setTextureMinFilter)(r,"nearest"),(0,ft.M)(r,"minFilter",l)),r.userData.id=o,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,dt.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,ct.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,ct.bindTextureBaseData)(e)):(this.runScene.textureEx.delete(e),(0,ft.bv)(e,"cloneSourceId"),(0,ct.disposeTexture)(e))}))}}class mt{constructor(e,t){this.runScene=e,this.loadConfig=t}setTextureLoader(e){this.textureLoader=e,this.initTextureLoader(e)}initTextureLoader(e){e instanceof ae&&e.setOptions({reverseTexture:this.loadConfig.reverseTexture,textureQuality:this.runScene.optionsEx.options.texture.quality})}}class vt{constructor(e,t){this.runScene=e,this.loadConfig=t}done(e){var t,r,n,i,a;e.asset.ex&&(({camera:e,lights:t,options:r,controls:n,tags:i,objects:a}=e.asset.ex),this.runScene.tags.parseJSON(i||{}),this.camera(e),this.controls(n),this.lights(t),this.options(r),a&&this.runScene.objects.parseJSON(a))}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);const 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;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:lt.Z},this.runScene=e,this.loadConfig=t,this.material=new pt(e,t),this.scene=new vt(e,t),this.options=new mt(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,ht.Ne)(e))&&(e=Number(e),!isNaN(e)&&(new Date).getTime()<e)}processNode(e){this.runScene.cb.loaderer.gltf.loadNode.cb(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:a,normal:o,local:s,cloneId:l,id:u,animations:c,isDynamic:h}=r.extras;var n,i;if(e=(0,ut.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=At.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)),a&&(t.layers.enable(1),this.runScene.cb.model.setLayers.cb({model:t,val:1})),r.extras.isHelper&&this.helperModels.push(t),o&&(e=this.nodeType[null==o?void 0:o.type].modelTools.parseData(t,o),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,ut.isDynamicModel)(n,!0)||(r=(0,ut.instanceModel)(n,[...t]),this.runScene.modelEx.add(r,void 0,{isClone:!1,select:!1,addUndo:!1}),(0,ut.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:a,fog:o}=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,ct.setTextureMapping)(n))}a&&(t.background=new r.Color("#"+a)),o&&(({color:n,far:e,near:i}=o),a=new r.Fog("#"+n,i,e),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 yt{constructor(e){this.dracoPath="./draco/",this._gltf=new Ae,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 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,oe.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: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?u=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){const[t]=e,r=[];return t.material?(this.runScene.materialEx.add(t.material),r.push(t.material)):t.children.map((e=>{e.material&&(r.push(e.material),this.runScene.materialEx.add(e.material))})),r}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 bt{constructor(e){this._objectLoader=new r.ObjectLoader,this.runScene=e,this._parser=new xt(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 xt{constructor(e){this.runScene=e}parseModel(e){e.material&&this.parseMaterial(e)}parseMaterial(e){var t=e.material;"SpriteMaterial"===t.type&&(0,ft.M)(t,"tools",lt.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 wt{constructor(e){this.imgBitMap=new r.ImageBitmapLoader,this.object=new r.ObjectLoader,this.runScene=e,this.gltf=new yt(e),this.json=new bt(e)}}const At=new class{constructor(){this.load=new r.AnimationLoader}parse(e){return this.load.parse(e)}};class St 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,ut.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 a=e.animations.length?e.animations:At.parse(t),o=new r.AnimationMixer(e);for(const t of a){var n=(0,H.getId)(),i=(t.id=n,o.clipAction(t));const r={finished:()=>{},loop:()=>{}};o.addEventListener("finished",(()=>r.finished())),o.addEventListener("loop",(()=>r.loop())),this.map[n]={mixer:o,action:i,model:e,time:0,runState:"close",clip:t,eventMap:r}}a.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,oe.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:f}=(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 p=!(n.runState="play");this.setUpdates(e,(()=>{var e=(0,oe.getProgress)(h.time,d.duration,!0);99<=e&&!p&&(a(),p=!0),i(e)})),u?(h.loop=st.Z.LoopRepeat,f.loop=o):(l&&(h.clampWhenFinished=!0),h.loop=st.Z.LoopOnce,f.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,oe.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 a=this.map[e];a&&(t=this.findId(r,n),(e=this.map[t])&&a.action.crossFadeTo(e.action,i,!0))}resetTime(e,t){const r=this.getItem(e,t);r&&(r.action.time=0)}}var Mt=__webpack_require__(8235),Ct=__webpack_require__(2430);class Bt{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 Mt.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 Ct.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 _t{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.data.fn=t,!0)}remove(e){this.reset(e,null)}delete(e){e=(this.get(e)||{}).index,this.cbs.splice(e,1)}}class Et{constructor(){this.resize=new _t,this.setSelectMaterial=new _t,this.setScene=new _t,this.reset=new _t,this.render=new _t,this.tick=new _t,this.baseLog=new _t,this.inited=new _t,this.texture={add:new _t,remove:new _t,setAnima:new _t},this.model={multiSelect:{setEmpty:new _t},change:new _t,setSelect:new _t,click:new _t,add:new _t,remove:new _t,multipDrop:new _t,focus:new _t,unFocus:new _t,changeName:new _t,setOpen:new _t,setMainStatue:new _t,setVisible:new _t,setParent:new _t,setLayers:new _t,setOutline:new _t,clone:new _t,dispose:new _t},this.material={add:new _t,dispose:new _t,setName:new _t},this.unique={material:{add:new _t}},this.tranControls={changing:new _t},this.undo={addUndos:new _t,addRedus:new _t,removeUndos:new _t,undoByIndex:new _t,reset:new _t},this.scene={save:new _t,saveNet:new _t},this.timeLine={setProgress:new _t,playGroup:new _t,setGroupMap:new _t,reset:new _t,closeGroup:new _t},this.events={key:{down:new _t,up:new _t},mouse:{move:new _t,down:new _t,up:new _t},pointer:{rightTrigger:new _t,down:new _t,up:new _t,move:new _t,trigger:new _t}},this.pp={glow:{setData:new _t,setStatus:new _t},outline:{setData:new _t,setStatus:new _t}},this.load={getJSON:new _t,progress:new _t,complete:new _t},this.exporter={gltf:{before:new _t}},this.loaderer={gltf:{loadNode:new _t,lazyLoadedTexture:new _t,loaded:new _t,modelLoaded:new _t,progress:new _t,getJSON:new _t,getArrayBuffer:new _t,complete:new _t}},this.custom=new Proxy({},{get:(e,t)=>(e[t]||(e[t]=new _t),e[t])}),this.tags={parseJSON:new _t,clear:new _t}}}var Tt=__webpack_require__(1819);function Dt(e){this.object=e,this.target=new st.Z.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.25;var t,r,n,i,a,o,s,l,u,c,h,d,f=this,p=0,m=0,v=0,g=0,y=1,b=new st.Z.Vector3,x=!1;this.getPolarAngle=function(){return m},this.getAzimuthalAngle=function(){return p},this.setPolarAngle=function(e){m=e,this.forceUpdate()},this.setAzimuthalAngle=function(e){p=e,this.forceUpdate()},this.rotateLeft=function(e){g-=e},this.rotateUp=function(e){v-=e},this.panLeft=(t=new st.Z.Vector3,function(e){var r=this.object.matrix.elements;t.set(r[0],r[1],r[2]),t.multiplyScalar(-e),b.add(t)}),this.panUp=(r=new st.Z.Vector3,function(e){var t=this.object.matrix.elements;r.set(t[4],t[5],t[6]),r.multiplyScalar(e),b.add(r)}),this.pan=function(e,t,r,n){var i;f.object instanceof st.Z.PerspectiveCamera?(i=f.object.position.clone().sub(f.target).length(),i*=Math.tan(f.object.fov/2*Math.PI/180),f.panLeft(2*e*i/n),f.panUp(2*t*i/n)):f.object instanceof st.Z.OrthographicCamera?(f.panLeft(e*(f.object.right-f.object.left)/r),f.panUp(t*(f.object.top-f.object.bottom)/n)):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.")},this.dollyIn=function(e){f.object instanceof st.Z.PerspectiveCamera?y/=e:f.object instanceof st.Z.OrthographicCamera?(f.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom*e)),f.object.updateProjectionMatrix(),x=!0):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.")},this.dollyOut=function(e){f.object instanceof st.Z.PerspectiveCamera?y*=e:f.object instanceof st.Z.OrthographicCamera?(f.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/e)),f.object.updateProjectionMatrix(),x=!0):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.")},this.forceUpdate=(n=new st.Z.Vector3,i=(new st.Z.Quaternion).setFromUnitVectors(e.up,new st.Z.Vector3(0,1,0)),a=i.clone().invert(),o=new st.Z.Vector3,s=new st.Z.Quaternion,function(){var e=this.object.position,t=(n.copy(e).sub(this.target),n.applyQuaternion(i),p=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,p)),m=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,m)),m=Math.max(1e-6,Math.min(Math.PI-1e-6,m)),n.length()*y);return t=Math.max(this.minDistance,Math.min(this.maxDistance,t)),this.target.add(b),n.x=t*Math.sin(m)*Math.sin(p),n.y=t*Math.cos(m),n.z=t*Math.sin(m)*Math.cos(p),n.applyQuaternion(a),e.copy(this.target).add(n),this.object.lookAt(this.target),!0===this.enableDamping?(g*=1-this.dampingFactor,v*=1-this.dampingFactor):v=g=0,y=1,b.set(0,0,0),!(!(x||1e-6<o.distanceToSquared(this.object.position)||1e-6<8*(1-s.dot(this.object.quaternion)))||(o.copy(this.object.position),s.copy(this.object.quaternion),x=!1))}),this.update=(l=new st.Z.Vector3,u=(new st.Z.Quaternion).setFromUnitVectors(e.up,new st.Z.Vector3(0,1,0)),c=u.clone().invert(),h=new st.Z.Vector3,d=new st.Z.Quaternion,function(){var e=this.object.position,t=(l.copy(e).sub(this.target),l.applyQuaternion(u),p=Math.atan2(l.x,l.z),m=Math.atan2(Math.sqrt(l.x*l.x+l.z*l.z),l.y),p+=g,m+=v,p=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,p)),m=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,m)),m=Math.max(1e-6,Math.min(Math.PI-1e-6,m)),l.length()*y);return t=Math.max(this.minDistance,Math.min(this.maxDistance,t)),this.target.add(b),l.x=t*Math.sin(m)*Math.sin(p),l.y=t*Math.cos(m),l.z=t*Math.sin(m)*Math.cos(p),l.applyQuaternion(c),e.copy(this.target).add(l),this.object.lookAt(this.target),!0===this.enableDamping?(g*=1-this.dampingFactor,v*=1-this.dampingFactor):v=g=0,y=1,b.set(0,0,0),!(!(x||1e-6<h.distanceToSquared(this.object.position)||1e-6<8*(1-d.dot(this.object.quaternion)))||(h.copy(this.object.position),d.copy(this.object.quaternion),x=!1))})}function Pt(e,t){var r=new Dt(e),n=(this.domElement=void 0!==t?t:document,Object.defineProperty(this,"constraint",{get:function(){return r}}),this.getPolarAngle=function(){return r.getPolarAngle()},this.getAzimuthalAngle=function(){return r.getAzimuthalAngle()},this.setPolarAngle=function(e){return r.setPolarAngle(e)},this.setAzimuthalAngle=function(e){return r.setAzimuthalAngle(e)},this.enabled=!0,this.center=this.target,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={ORBIT:st.Z.MOUSE.LEFT,ZOOM:st.Z.MOUSE.MIDDLE,PAN:st.Z.MOUSE.RIGHT},this),i=new st.Z.Vector2,a=new st.Z.Vector2,o=new st.Z.Vector2,s=new st.Z.Vector2,l=new st.Z.Vector2,u=new st.Z.Vector2,c=new st.Z.Vector2,h=new st.Z.Vector2,d=new st.Z.Vector2,f=-1,p=f,m=(this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,{type:"change"}),v={type:"start"},g={type:"end"};function y(e,t){var i=n.domElement===document?n.domElement.body:n.domElement;r.pan(e,t,i.clientWidth,i.clientHeight)}function b(){return Math.pow(.95,n.zoomSpeed)}function x(e){if(!1!==n.enabled){if(e.preventDefault(),e.button===n.mouseButtons.ORBIT){if(!1===n.enableRotate)return;p=0,i.set(e.clientX,e.clientY)}else if(e.button===n.mouseButtons.ZOOM){if(!1===n.enableZoom)return;p=1,c.set(e.clientX,e.clientY)}else if(e.button===n.mouseButtons.PAN){if(!1===n.enablePan)return;p=2,s.set(e.clientX,e.clientY)}p!==f&&(document.addEventListener("mousemove",w,!1),document.addEventListener("mouseup",A,!1),n.dispatchEvent(v))}}function w(e){if(null!=e&&null!=(t=e.preventDefault)&&t.call(e),!1!==n.enabled){var t=n.domElement===document?n.domElement.body:n.domElement;if(0===p){if(!1===n.enableRotate)return;a.set(e.clientX,e.clientY),o.subVectors(a,i),r.rotateLeft(2*Math.PI*o.x/t.clientWidth*n.rotateSpeed),r.rotateUp(2*Math.PI*o.y/t.clientHeight*n.rotateSpeed),i.copy(a)}else if(1===p){if(!1===n.enableZoom)return;h.set(e.clientX,e.clientY),d.subVectors(h,c),0<d.y?r.dollyIn(b()):d.y<0&&r.dollyOut(b()),c.copy(h)}else if(2===p){if(!1===n.enablePan)return;l.set(e.clientX,e.clientY),u.subVectors(l,s),y(u.x,u.y),s.copy(l)}p!==f&&n.update()}}function A(){!1!==n.enabled&&(document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",A),n.dispatchEvent(g),p=f)}function S(e){var t;!1!==n.enabled&&!1!==n.enableZoom&&p===f&&(e.stopPropagation(),void(t=0)!==e.wheelDelta?t=e.wheelDelta:void 0!==e.detail&&(t=-e.detail),0<t?r.dollyOut(b()):t<0&&r.dollyIn(b()),n.update(),n.dispatchEvent(v),n.dispatchEvent(g))}function M(e){if(!1!==n.enabled&&!1!==n.enableKeys&&!1!==n.enablePan)switch(e.keyCode){case n.keys.UP:y(0,n.keyPanSpeed),n.update();break;case n.keys.BOTTOM:y(0,-n.keyPanSpeed),n.update();break;case n.keys.LEFT:y(n.keyPanSpeed,0),n.update();break;case n.keys.RIGHT:y(-n.keyPanSpeed,0),n.update()}}function C(e){if(!1!==n.enabled){switch(e.touches.length){case 1:if(!1===n.enableRotate)return;p=3,i.set(e.touches[0].pageX,e.touches[0].pageY);break;case 2:if(!1===n.enableZoom)return;p=4;var t=e.touches[0].pageX-e.touches[1].pageX,r=e.touches[0].pageY-e.touches[1].pageY;t=Math.sqrt(t*t+r*r),c.set(0,t);break;case 3:if(!1===n.enablePan)return;p=5,s.set(e.touches[0].pageX,e.touches[0].pageY);break;default:p=f}p!==f&&n.dispatchEvent(v)}}function B(e){if(e.stopPropagation(),!1!==n.enabled){var t=n.domElement===document?n.domElement.body:n.domElement;switch(e.touches.length){case 1:if(!1===n.enableRotate)return;if(3!==p)return;a.set(e.touches[0].pageX,e.touches[0].pageY),o.subVectors(a,i),r.rotateLeft(2*Math.PI*o.x/t.clientWidth*n.rotateSpeed),r.rotateUp(2*Math.PI*o.y/t.clientHeight*n.rotateSpeed),i.copy(a),n.update();break;case 2:if(!1===n.enableZoom)return;if(4!==p)return;var m=e.touches[0].pageX-e.touches[1].pageX,v=e.touches[0].pageY-e.touches[1].pageY;m=Math.sqrt(m*m+v*v),h.set(0,m),d.subVectors(h,c),0<d.y?r.dollyOut(b()):d.y<0&&r.dollyIn(b()),c.copy(h),n.update();break;case 3:if(!1===n.enablePan)return;if(5!==p)return;l.set(e.touches[0].pageX,e.touches[0].pageY),u.subVectors(l,s),y(u.x,u.y),s.copy(l),n.update();break;default:p=f}}}function _(){!1!==n.enabled&&(n.dispatchEvent(g),p=f)}function E(e){e.preventDefault()}this.update=function(){this.autoRotate&&p===f&&r.rotateLeft(2*Math.PI/60/60*n.autoRotateSpeed),!0===r.update()&&this.dispatchEvent(m)},this.reset=function(){p=f,this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(m),this.update()},this.dispose=function(){this.domElement.removeEventListener("contextmenu",E,!1),this.domElement.removeEventListener("mousedown",x,!1),this.domElement.removeEventListener("mousewheel",S,!1),this.domElement.removeEventListener("MozMousePixelScroll",S,!1),this.domElement.removeEventListener("touchstart",C,!1),this.domElement.removeEventListener("touchend",_,!1),this.domElement.removeEventListener("touchmove",B,!1),document.removeEventListener("mousemove",w,!1),document.removeEventListener("mouseup",A,!1),window.removeEventListener("keydown",M,!1)},this.domElement.addEventListener("contextmenu",E,!1),this.domElement.addEventListener("mousedown",x,!1),this.domElement.addEventListener("mousewheel",S,{passive:!0}),this.domElement.addEventListener("MozMousePixelScroll",S,!1),this.domElement.addEventListener("touchstart",C,{passive:!0}),this.domElement.addEventListener("touchend",_,!1),this.domElement.addEventListener("touchmove",B,{passive:!0}),window.addEventListener("keydown",M,!1),this.update()}st.Z.MOUSE,(Pt.prototype=Object.create(st.Z.EventDispatcher.prototype)).constructor=Pt,Object.defineProperties(Pt.prototype,{object:{get:function(){return this.constraint.object}},target:{get:function(){return this.constraint.target},set:function(e){console.warn("Three.OrbitControls: target is now immutable. Use target.set() instead."),this.constraint.target.copy(e)}},minDistance:{get:function(){return this.constraint.minDistance},set:function(e){this.constraint.minDistance=e}},maxDistance:{get:function(){return this.constraint.maxDistance},set:function(e){this.constraint.maxDistance=e}},minZoom:{get:function(){return this.constraint.minZoom},set:function(e){this.constraint.minZoom=e}},maxZoom:{get:function(){return this.constraint.maxZoom},set:function(e){this.constraint.maxZoom=e}},minPolarAngle:{get:function(){return this.constraint.minPolarAngle},set:function(e){this.constraint.minPolarAngle=e}},maxPolarAngle:{get:function(){return this.constraint.maxPolarAngle},set:function(e){this.constraint.maxPolarAngle=e}},minAzimuthAngle:{get:function(){return this.constraint.minAzimuthAngle},set:function(e){this.constraint.minAzimuthAngle=e}},maxAzimuthAngle:{get:function(){return this.constraint.maxAzimuthAngle},set:function(e){this.constraint.maxAzimuthAngle=e}},enableDamping:{get:function(){return this.constraint.enableDamping},set:function(e){this.constraint.enableDamping=e}},dampingFactor:{get:function(){return this.constraint.dampingFactor},set:function(e){this.constraint.dampingFactor=e}},noZoom:{get:function(){return console.warn("Three.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),!this.enableZoom},set:function(e){console.warn("Three.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),this.enableZoom=!e}},noRotate:{get:function(){return console.warn("Three.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),!this.enableRotate},set:function(e){console.warn("Three.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),this.enableRotate=!e}},noPan:{get:function(){return console.warn("Three.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),!this.enablePan},set:function(e){console.warn("Three.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),this.enablePan=!e}},noKeys:{get:function(){return console.warn("Three.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),!this.enableKeys},set:function(e){console.warn("Three.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),this.enableKeys=!e}},staticMoving:{get:function(){return console.warn("Three.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),!this.constraint.enableDamping},set:function(e){console.warn("Three.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),this.constraint.enableDamping=!e}},dynamicDampingFactor:{get:function(){return console.warn("Three.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.constraint.dampingFactor},set:function(e){console.warn("Three.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.constraint.dampingFactor=e}}});const Ot=Pt;class kt{create(e,t){return new Ot(e,t)}static toJSON(e){return e.target}}class Rt{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 It=__webpack_require__(7267),Lt=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 Ft{constructor(e){this.alt=!1,this.ctrl=!1,this.shift=!1,this.unExec=new ot.Z,this.specialKeyDebounce=(0,It.d)((()=>{this.ctrl=!1,this.shift=!1,this.alt=!1}),1e3),this.allFn={s_saveScene:()=>Lt(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 Lt(this,void 0,void 0,(function*(){if("INPUT"!==document.activeElement.nodeName){var t=e.key.toLowerCase();if(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,this.specialKeyDebounce();break;case"control":case"ctrl":this.ctrl=!0,this.specialKeyDebounce();break;case"shift":this.shift=!0,this.specialKeyDebounce();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){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":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 Ut=__webpack_require__(7263);class Gt{constructor(e){this.downPosition={0:{x:0,y:0},2:{x:0,y:0}},this.enableUp=!0,this.isMove=!1,this.moveEvent=new MouseEvent("move"),this.down=e=>{0!==e.button&&2!==e.button||(this.downPosition[e.button]={x:e.offsetX,y:e.offsetY}),this.isMove=!0},this.up=e=>{var t,r,n,i;this.isMove=!1,1===e.button||null!=(t=this.events.runScene.helperEx.transContro)&&t.isDraggingChange||(t=e.offsetX,r=e.offsetY,({x:n,y:i}=this.downPosition[e.button]),t===n&&r===i&&(0===e.button?this.trigger(e):this.events.runScene.cb.events.pointer.rightTrigger.cb(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){const t=new r.Raycaster,n=new r.Vector2,{engineDom:i,camera:a,scene:o}=this.events.runScene.assetsEx.get();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}));const s=t.intersectObjects(e,!0);return this.events.runScene.cb.events.pointer.trigger.cb(s),s.map((e=>e.object))}removeHideOrLockModel(e){return e.find((e=>this.events.runScene.modelEx.deepIsVisible(e)&&!Ut.zf.isLock(e,!0)&&ut.selectableModel.is(e)))}trigger(e){let t=this.removeHideOrLockModel(this.getTriggerModels(e));if(this.selectable){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 jt=__webpack_require__(4547),Nt=__webpack_require__(1643),Ht=__webpack_require__(3352);class zt{constructor(e){this.materialMap={},this.textureMap={},this.modelType={Sprite:lt.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,ht.Ni)(String(i)),lights:Ht.ZP.toJSON(this.runScene.lightEx.getLightsByScene()),camera:n.toJSON(),sceneEx:Object.assign(Object.assign({},ft.ZP.toJSON(t)),this._bindSceneTextures(e)),timeLine:this.runScene.timeLineEx.getSavedData(),controls:kt.toJSON(r),objects:this.runScene.objects.toJSON(),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,ct.isTexture)(t.background)||(0,ct.isTexture)(t.environment)){this.runScene.pp.setUpdate(!1);const{background:n,environment:i}=t,a=(this.runScene.pp.setUpdate(!0),(0,ut.createDefModel)("Box")),o=(0,dt.createDefMaterial)();a.material=o,e.add(a),t=o.userData.id,r.materialId=t,this.materialMap[t]={normalMaterial:o,models:[]},(0,ct.isTexture)(n)&&(n.userData.notCompress=!0,303===(o.map=n).mapping&&(r.backgroundMapping=303)),(0,ct.isTexture)(i)&&(i.userData.notCompress=!0,o.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,ut.withAnima)(e)&&(t=e.animations.map((e=>e.toJSON())),(0,ft.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,dt.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,dt.getTexturesByMaterial)(t),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,ct.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,ct.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;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:a,center:o,rotation:s,offset:l}=n;const e={format:r};this.runScene.modelEx.isNavieV2(a,1)||(({x:r,y:i}=a),e.repeat=r===i?r:a),this.runScene.modelEx.isNavieV2(o,0)||(({x:i,y:r}=o),e.center=i===r?i:o),this.runScene.modelEx.isNavieV2(l,0)||(({x:a,y:r}=l),e.offset=a===r?a: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,dt.createDefMaterial)();r.material=n,e.add(r);for(const e of Nt.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,dt.createDefMaterial)()),this.geoDefMaterialMap.get(e)):this.runScene.materialEx.defMaterial}}var Vt=__webpack_require__(5244);class Jt 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,Vt.K)(e);e.material&&e.geometry&&((t=this.getSameNode(e))&&(0,ut.setClonedModel)(e,t.id),this.savedMap.set(r,{id:r,geometryUuid:e.geometry.uuid,materialUuid:e.material.uuid}))}parseClonedModel(e){var t=(0,ut.getClonedIdModel)(e),r=(0,Vt.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,Vt.K)(e),n.newId=t),n.newId&&(n.newId!==r?(0,ut.setClonedModel)(e,n.newId):(0,ut.delClonedModel)(e)))}parseNode(e){(0,ut.getClonedIdModel)(e)?this.parseClonedModel(e):this.parseUnClonedModel(e)}}class Kt{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: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,ht.F1)([...r.array],[...a.array],20),o=(0,ht.F1)([...n.array],[...o.array],20),s=(0,ht.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;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 Zt{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 Wt{constructor(e){this.helperModels=[],this.mergeSameGeo=new Kt;var{type:e,runScene:t,model:r}=e;this.runScene=t,this.type=e,this.bindClondId=new Jt(t),this.ex={materialMap:{},textureMap:{},type:e},this.before=new zt({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,ct.isClonedTexture)(t)&&(r.cloneSourceId=(0,ct.getCloneIdFromTexture)(t)),r.format=t.userData.format,(0,ct.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 Xt(){Xt=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=(f="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",i=f.asyncIterator||"@@asyncIterator",a=f.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 f,p,m=(o(f={},n,(function(){return this})),(p=(p=Object.getPrototypeOf)&&p(p(w([]))))&&p!==t&&r.call(p,n)&&(f=p),d.prototype=c.prototype=Object.create(f));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"==Yt(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 Qt(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 Yt(e){return(Yt="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 qt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $t(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 er(e,t,r){t&&$t(e.prototype,t),r&&$t(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var tr=function(){function e(){qt(this,e),this.pluginCallbacks=[],this.register((function(e){return new br(e)})),this.register((function(e){return new xr(e)})),this.register((function(e){return new wr(e)})),this.register((function(e){return new Sr(e)})),this.register((function(e){return new Mr(e)})),this.register((function(e){return new Ar(e)}))}return er(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"===Yt(r)&&(console.warn("THREE.GLTFExporter: parse() expects options as the fourth argument now."),n=r);for(var i=new yr,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}(),rr=5121,nr=5123,ir=(j=9728,9729),ar=9984,or=9985,sr=9986,lr=9987,ur=33071,cr=33648,hr=10497,dr={},fr=(dr[r.NearestFilter]=j,dr[r.NearestMipmapNearestFilter]=ar,dr[r.NearestMipmapLinearFilter]=sr,dr[r.LinearFilter]=ir,dr[r.LinearMipmapNearestFilter]=or,dr[r.LinearMipmapLinearFilter]=lr,dr[r.ClampToEdgeWrapping]=ur,dr[r.RepeatWrapping]=hr,dr[r.MirroredRepeatWrapping]=cr,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"});function pr(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function mr(e){return 4*Math.ceil(e/4)}function vr(e,t){var r=1<arguments.length&&void 0!==t?t:0,n=mr(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 gr=null,yr=function(){function e(){qt(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 er(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=Xt().mark((function e(t,r,n){var i,a,o,s,l,u,c;return Xt().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=vr(u.result),t=new DataView(new ArrayBuffer(8)),n=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),vr(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){Qt(a,n,i,o,s,"next",e)}function s(e){Qt(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 f=s.getImageData(0,0,e,a).data,p=2;p<f.length;p+=4)l.data[p]=f[p]}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===rr?1:t===nr?2:4,mr(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===nr?l.setUint16(u,d,!0):t===rr&&l.setUint8(u,d),u+=a}var f={buffer:this.processBuffer(l.buffer),byteOffset:this.byteOffset,byteLength:s};return void 0!==i&&(f.target=i),34962===i&&(f.byteStride=e.itemSize*a),this.byteOffset+=s,o.bufferViews.push(f),{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=vr(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=this.options,o=this.json;if(e.array.constructor===Float32Array)i=5126;else if(e.array.constructor===Uint32Array)i=5125;else if(e.array.constructor===Uint16Array)i=nr;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");i=rr}if(void 0===r&&(r=0),void 0===n&&(n=e.count),a.truncateDrawRange&&void 0!==t&&null===t.index&&(a=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(a,l)-r)<0&&(n=0)),0===n)return null;a=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);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:a.max,min:a.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]},!0===e.normalized&&(t.normalized=!0),o.accessors||(o.accessors=[]),o.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!=(f=i.userData)&&f.blob&&(null==i||null==(f=i.userData)?void 0:f.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=gr=gr||document.createElement("canvas"),f=(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)f.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 p=new Uint8ClampedArray(e.height*e.width*4),m=0;m<p.length;m+=4)p[m+0]=e.data[m+0],p[m+1]=e.data[m+1],p[m+2]=e.data[m+2],p[m+3]=e.data[m+3];f.putImageData(new ImageData(p,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:dr[e.magFilter],minFilter:dr[e.minFilter],wrapS:dr[e.wrapS],wrapT:dr[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=(pr((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,f={},p={},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))?p[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))&&(p[h]=d,t.attributes.set(this.getUID(c),d))));if(void 0!==y&&l.setAttribute("normal",y),0===Object.keys(p).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 C,B={},_=!1;for(C in l.morphAttributes)if("position"!==C&&"normal"!==C)_||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),_=!0);else{var E=l.morphAttributes[C][M],T=C.toUpperCase(),D=l.attributes[C];if(t.attributes.has(this.getUID(E)))B[T]=t.attributes.get(this.getUID(E));else{var P=E.clone();if(!l.morphTargetsRelative)for(var O=0,k=E.count;O<k;O++)P.setXYZ(O,E.getX(O)-D.getX(O),E.getY(O)-D.getY(O),E.getZ(O)-D.getZ(O));B[T]=this.processAccessor(P,l),t.attributes.set(this.getUID(D),B[T])}}v.push(B),x.push(e.morphTargetInfluences[M]),void 0!==e.morphTargetDictionary&&w.push(A[M])}f.weights=x,0<w.length&&(f.extras={},f.extras.targetNames=w)}if((y=Array.isArray(e.material))&&0===l.groups.length)return null;for(var R=y?e.material:[e.material],I=y?l.groups:[{materialIndex:0,start:void 0,count:void 0}],L=0,F=I.length;L<F;L++){var U={mode:u,attributes:p},G=(this.serializeUserData(l,U),0<v.length&&(U.targets=v),null!==l.index&&(G=this.getUID(l.index),void 0===I[L].start&&void 0===I[L].count||(G+=":"+I[L].start+":"+I[L].count),t.attributes.has(G)?U.indices=t.attributes.get(G):(U.indices=this.processAccessor(l.index,l,I[L].start,I[L].count),t.attributes.set(G,U.indices)),null===U.indices&&delete U.indices),this.processMaterial(R[I[L].materialIndex]));null!==G&&(U.material=G),m.push(U)}return f.primitives=m,n.meshes||(n.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,f)})),y=n.meshes.push(f)-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=tr.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=fr[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 f=void(d===fr.morphTargetInfluences&&(c/=h.morphTargetInfluences.length));!0===u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(f="CUBICSPLINE",c/=3):f=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:f}),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(),pr(r,[0,0,0,1])||(o.rotation=r),pr(d,[0,0,0])||(o.translation=d),pr(t,[1,1,1])||(o.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===pr(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}(),br=function(){function e(t){qt(this,e),this.writer=t,this.name="KHR_lights_punctual"}return er(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}(),xr=function(){function e(t){qt(this,e),this.writer=t,this.name="KHR_materials_unlit"}return er(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}(),wr=function(){function e(t){qt(this,e),this.writer=t,this.name="KHR_materials_pbrSpecularGlossiness"}return er(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}(),Ar=function(){function e(t){qt(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return er(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}(),Sr=function(){function e(t){qt(this,e),this.writer=t,this.name="KHR_materials_transmission"}return er(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}(),Mr=function(){function e(t){qt(this,e),this.writer=t,this.name="KHR_materials_volume"}return er(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 Cr(){Cr=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=(f="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",i=f.asyncIterator||"@@asyncIterator",a=f.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 f,p,m=(o(f={},n,(function(){return this})),(p=(p=Object.getPrototypeOf)&&p(p(w([]))))&&p!==t&&r.call(p,n)&&(f=p),d.prototype=c.prototype=Object.create(f));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"==_r(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 Br(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 _r(e){return(_r="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 Er(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Tr(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&&Tr(e.prototype,t),r&&Tr(e,r),Object.defineProperty(e,"prototype",{writable:!1})}tr.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 f=new((d=s.clone()).ValueBufferType)(c*d.times.length),p=0;p<d.times.length;p++)f[p*c+h]=d.values[p];d.name=(l.nodeName||"")+".morphTargetInfluences",d.values=f,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 Pr=function(){function e(){Er(this,e),this.pluginCallbacks=[],this.register((function(e){return new Hr(e)})),this.register((function(e){return new zr(e)})),this.register((function(e){return new Vr(e)})),this.register((function(e){return new Kr(e)})),this.register((function(e){return new Zr(e)})),this.register((function(e){return new Jr(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"===_r(r)&&(console.warn("THREE.GLTFExporter: parse() expects options as the fourth argument now."),n=r);for(var i=new Nr,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}(),Or=5121,kr=5123,Rr=(j=9728,ar=9729,sr=9984,ir=9985,or=9986,lr=9987,ur=33071,hr=33648,cr=10497,{}),Ir=(Rr[r.NearestFilter]=j,Rr[r.NearestMipmapNearestFilter]=sr,Rr[r.NearestMipmapLinearFilter]=or,Rr[r.LinearFilter]=ar,Rr[r.LinearMipmapNearestFilter]=ir,Rr[r.LinearMipmapLinearFilter]=lr,Rr[r.ClampToEdgeWrapping]=ur,Rr[r.RepeatWrapping]=cr,Rr[r.MirroredRepeatWrapping]=hr,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"});function Lr(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function Fr(e){return 4*Math.ceil(e/4)}function Ur(e,t){var r=1<arguments.length&&void 0!==t?t:0,n=Fr(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 Gr=null;function jr(){return Gr=Gr||("undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"))}var Nr=function(){function e(){Er(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=Cr().mark((function e(t,r,n){var i,a,o,s,l;return Cr().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=Ur(s.result),t=new DataView(new ArrayBuffer(8)),n=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),Ur((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){Br(a,n,i,o,s,"next",e)}function s(e){Br(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=jr(),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,f=1;f<d.length;f+=4)u.data[f]=d[f]}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===Or?1:t===kr?2:4,Fr(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===kr?l.setUint16(u,d,!0):t===Or&&l.setUint8(u,d),u+=a}var f={buffer:this.processBuffer(l.buffer),byteOffset:this.byteOffset,byteLength:s};return void 0!==i&&(f.target=i),34962===i&&(f.byteStride=e.itemSize*a),this.byteOffset+=s,o.bufferViews.push(f),{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=Ur(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=this.options,o=this.json;if(e.array.constructor===Float32Array)i=5126;else if(e.array.constructor===Uint32Array)i=5125;else if(e.array.constructor===Uint16Array)i=kr;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");i=Or}if(void 0===r&&(r=0),void 0===n&&(n=e.count),a.truncateDrawRange&&void 0!==t&&null===t.index&&(a=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(a,l)-r)<0&&(n=0)),0===n)return null;a=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);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:a.max,min:a.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]},!0===e.normalized&&(t.normalized=!0),o.accessors||(o.accessors=[]),o.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=jr(),f=(d.width=Math.min(e.width,l.maxTextureSize),d.height=Math.min(e.height,l.maxTextureSize),d.getContext("2d"));if(!0===n&&(f.translate(0,d.height),f.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 p=new Uint8ClampedArray(e.height*e.width*4),m=0;m<p.length;m+=4)p[m+0]=e.data[m+0],p[m+1]=e.data[m+1],p[m+2]=e.data[m+2],p[m+3]=e.data[m+3];f.putImageData(new ImageData(p,e.width,e.height),0,0)}else f.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:Rr[e.magFilter],minFilter:Rr[e.minFilter],wrapS:Rr[e.wrapS],wrapT:Rr[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=(Lr(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,f={},p={},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))?p[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))&&(p[h]=d,t.attributes.set(this.getUID(c),d))));if(void 0!==y&&l.setAttribute("normal",y),0===Object.keys(p).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 C,B={},_=!1;for(C in l.morphAttributes)if("position"!==C&&"normal"!==C)_||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),_=!0);else{var E=l.morphAttributes[C][M],T=C.toUpperCase(),D=l.attributes[C];if(t.attributes.has(this.getUID(E)))B[T]=t.attributes.get(this.getUID(E));else{var P=E.clone();if(!l.morphTargetsRelative)for(var O=0,k=E.count;O<k;O++)P.setXYZ(O,E.getX(O)-D.getX(O),E.getY(O)-D.getY(O),E.getZ(O)-D.getZ(O));B[T]=this.processAccessor(P,l),t.attributes.set(this.getUID(D),B[T])}}v.push(B),x.push(e.morphTargetInfluences[M]),void 0!==e.morphTargetDictionary&&w.push(A[M])}f.weights=x,0<w.length&&(f.extras={},f.extras.targetNames=w)}if((y=Array.isArray(e.material))&&0===l.groups.length)return null;for(var R=y?e.material:[e.material],I=y?l.groups:[{materialIndex:0,start:void 0,count:void 0}],L=0,F=I.length;L<F;L++){var U={mode:u,attributes:p},G=(this.serializeUserData(l,U),0<v.length&&(U.targets=v),null!==l.index&&(G=this.getUID(l.index),void 0===I[L].start&&void 0===I[L].count||(G+=":"+I[L].start+":"+I[L].count),t.attributes.has(G)?U.indices=t.attributes.get(G):(U.indices=this.processAccessor(l.index,l,I[L].start,I[L].count),t.attributes.set(G,U.indices)),null===U.indices&&delete U.indices),this.processMaterial(R[I[L].materialIndex]));null!==G&&(U.material=G),m.push(U)}return f.primitives=m,n.meshes||(n.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,f)})),y=n.meshes.push(f)-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=Ir[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 f=void(d===Ir.morphTargetInfluences&&(c/=h.morphTargetInfluences.length));!0===u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(f="CUBICSPLINE",c/=3):f=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:f}),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(),Lr(r,[0,0,0,1])||(o.rotation=r),Lr(h,[0,0,0])||(o.translation=h),Lr(t,[1,1,1])||(o.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===Lr(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}(),Hr=function(){function e(t){Er(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}(),zr=function(){function e(t){Er(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}(),Vr=function(){function e(t){Er(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}(),Jr=function(){function e(t){Er(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){Er(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}(),Zr=function(){function e(t){Er(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}(),Wr=(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 f=new((d=s.clone()).ValueBufferType)(c*d.times.length),p=0;p<d.times.length;p++)f[p*c+h]=d.values[p];d.name=(l.nodeName||"")+".morphTargetInfluences",d.values=f,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 Xr extends V{constructor(){super(...arguments),this._gltf=new tr,this._originGltf=new Pr,this.options=new Zt}getArrayBuffer(e=this.runScene.sceneEx.getClear(),t="scene"){return Wr(this,void 0,void 0,(function*(){const r=new Wt({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 Wr(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 Wr(this,void 0,void 0,(function*(){var t=yield this.getArrayBuffer(e);(0,jt.downloadFile)(new Blob([t]),"scene.glb")}))}model(e){return Wr(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,jt.downloadFile)(new Blob([r]),t+".glb"))}))}material(e){var t;return Wr(this,void 0,void 0,(function*(){if(r=e||(null==(t=this.runScene.modelEx.select)?void 0:t.material)){const e=(0,ut.createDefModel)("Group");let t=r;(t=r instanceof Array?t:[r]).map((t=>{const r=(0,ut.createDefModel)("Box");r.material=t,e.add(r)}));var r=r.name||"material",n=yield this.getArrayBuffer(e,"material");(0,jt.downloadFile)(new Blob([n]),r+".glb")}}))}scene(e=!0){return Wr(this,void 0,void 0,(function*(){this.runScene.cb.exporter.gltf.before.cb(null);var t=yield this.getArrayBuffer();return e&&(0,jt.downloadFile)(new Blob([t]),"scene.glb"),t}))}originModel(e){return Wr(this,void 0,void 0,(function*(){var t,r;e&&(t=e.name||e.type,r=yield this.getOriginArrayBuffer(e),(0,jt.downloadFile)(new Blob([r]),t+".glb"))}))}}class Qr extends V{constructor(e){super(e),this.gltf=new Xr(e)}}var Yr={},qr=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},$r=function(e){return new Worker(e)};try{URL.revokeObjectURL(qr(""))}catch(dn){qr=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)},$r=function(e){return new Worker(e,{type:"module"})}}for(var en=Uint8Array,tn=Uint16Array,rn=Uint32Array,nn=new en([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]),an=new en([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]),on=new en([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),sn=(j=function(e,t){for(var r=new tn(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];var i=new rn(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]},(sr=j(nn,2))[0]),ln=sr[1],un=(sn[28]=258,ln[258]=28,or=j(an,0))[0],cn=or[1],hn=new tn(32768),dn=0;dn<32768;++dn){var fn=(43690&dn)>>>1|(21845&dn)<<1;hn[dn]=((65280&(fn=(61680&(fn=(52428&fn)>>>2|(13107&fn)<<2))>>>4|(3855&fn)<<4))>>>8|(255&fn)<<8)>>>1}var pn=function(e,t,r){for(var n=e.length,i=0,a=new tn(t);i<n;++i)++a[e[i]-1];var o=new tn(t);for(i=0;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;if(r){var s=new tn(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[hn[h]>>>l]=u}else for(s=new tn(n),i=0;i<n;++i)e[i]&&(s[i]=hn[o[e[i]-1]++]>>>15-e[i]);return s},mn=new en(288);for(dn=0;dn<144;++dn)mn[dn]=8;for(dn=144;dn<256;++dn)mn[dn]=9;for(dn=256;dn<280;++dn)mn[dn]=7;for(dn=280;dn<288;++dn)mn[dn]=8;var vn=new en(32);for(dn=0;dn<32;++dn)vn[dn]=5;function gn(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 yn(e,t,r,n,i){var a,o=Wn(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 bn(e,t){return ai(e,t)+4294967296*ai(e,t+4)}var xn=pn(mn,9,0),wn=pn(mn,9,1),An=pn(vn,5,0),Sn=pn(vn,5,1),Mn=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},Cn=function(e,t,r){var n=t/8|0;return(e[n]|e[1+n]<<8)>>(7&t)&r},Bn=function(e,t){var r=t/8|0;return(e[r]|e[1+r]<<8|e[2+r]<<16)>>(7&t)},_n=function(e){return(e/8|0)+(7&e&&1)},En=function(e,t,r){(null==t||t<0)&&(t=0),(null==r||r>e.length)&&(r=e.length);var n=new(e instanceof tn?tn:e instanceof rn?rn:en)(r-t);return n.set(e.subarray(t,r)),n},Tn=function(e,t,r){var n=e.length;if(!n||r&&!r.l&&n<5)return t||new en(0);function i(e){var r=t.length;r<e&&((r=new en(Math.max(2*r,e))).set(t),t=r)}var a=!t||r,o=!r||r.i,s=(r=r||{},t=t||new en(3*n),r.f||0),l=r.p||0,u=r.b||0,c=r.l,h=r.d,d=r.m,f=r.n,p=8*n;do{if(!c){r.f=s=Cn(e,l,1);var m=Cn(e,l+1,3);if(l+=3,!m){var v=e[(C=_n(l)+4)-4]|e[C-3]<<8;if(n<(A=C+v)){if(o)throw"unexpected EOF";break}a&&i(u+v),t.set(e.subarray(C,A),u),r.b=u+=v,r.p=l=8*A;continue}if(1==m)c=wn,h=Sn,d=9,f=5;else{if(2!=m)throw"invalid block type";v=Cn(e,l,31)+257;for(var g=Cn(e,l+10,15)+4,y=v+Cn(e,l+5,31)+1,b=(l+=14,new en(y)),x=new en(19),w=0;w<g;++w)x[on[w]]=Cn(e,l+3*w,7);l+=3*g;var A,S=(1<<(A=Mn(x)))-1,M=pn(x,A,1);for(w=0;w<y;){var C,B=M[Cn(e,l,S)];if(l+=15&B,(C=B>>>4)<16)b[w++]=C;else{var _=0,E=0;for(16==C?(E=3+Cn(e,l,3),l+=2,_=b[w-1]):17==C?(E=3+Cn(e,l,7),l+=3):18==C&&(E=11+Cn(e,l,127),l+=7);E--;)b[w++]=_}}m=b.subarray(0,v);var T=b.subarray(v);d=Mn(m),f=Mn(T),c=pn(m,d,1),h=pn(T,f,1)}if(p<l){if(o)throw"unexpected EOF";break}}a&&i(u+131072);for(var D=(1<<d)-1,P=(1<<f)-1,O=l;;O=l){var k=(_=c[Bn(e,l)&D])>>>4;if(p<(l+=15&_)){if(o)throw"unexpected EOF";break}if(!_)throw"invalid length/literal";if(k<256)t[u++]=k;else{if(256==k){O=l,c=null;break}var R,I=k-254,L=(264<k&&(R=nn[w=k-257],I=Cn(e,l,(1<<R)-1)+sn[w],l+=R),(k=h[Bn(e,l)&P])>>>4);if(!k)throw"invalid distance";if(l+=15&k,T=un[L],3<L&&(R=an[L],T+=Bn(e,l)&(1<<R)-1,l+=R),p<l){if(o)throw"unexpected EOF";break}a&&i(u+131072);for(var F=u+I;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=f)}while(!s);return u==t.length?t:En(t,0,u)},Dn=function(e,t,r){var n=t/8|0;e[n]|=r<<=7&t,e[1+n]|=r>>>8},Pn=function(e,t,r){var n=t/8|0;e[n]|=r<<=7&t,e[1+n]|=r>>>8,e[2+n]|=r>>>16},On=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[Gn,0];if(1==i)return(m=new en(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 tn(h+1),f=kn(r[u-1],d,0);if(t<f){n=0;var p=0,m=f-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;p+=v-(1<<f-d[g]),d[g]=t}for(p>>>=m;0<p;){var y=a[n].s;d[y]<t?p-=1<<t-d[y]++-1:++n}for(;0<=n&&p;--n){var b=a[n].s;d[b]==t&&(--d[b],++p)}f=t}return[new en(d),f]},kn=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},Rn=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new tn(++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]},In=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},Ln=function(e,t,r){var n=r.length,i=_n(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)},Fn=function(e,t,r,n,i,a,o,s,l,u,c){Dn(t,c++,r),++i[256];for(var h=(r=On(i,15))[0],d=(r=r[1],(f=On(a,15))[0]),f=f[1],p=(m=Rn(h))[0],m=m[1],v=(g=Rn(d))[0],g=g[1],y=new tn(19),b=0;b<p.length;++b)y[31&p[b]]++;for(b=0;b<v.length;++b)y[31&v[b]]++;for(var x=(w=On(y,7))[0],w=w[1],A=19;4<A&&!x[on[A-1]];--A);var S,M=u+5<<3,C=In(i,mn)+In(a,vn)+o;if(i=In(i,h)+In(a,d)+o+14+3*A+In(y,x)+(2*y[16]+3*y[17]+7*y[18]),M<=C&&M<=i)return Ln(t,c,e.subarray(l,l+u));if(Dn(t,c,1+(i<C)),c+=2,i<C){var B=pn(h,r,0),_=h,E=pn(d,f,0),T=d,D=pn(x,w,0);for(Dn(t,c,m-257),Dn(t,c+5,g-1),Dn(t,c+10,A-4),c+=14,b=0;b<A;++b)Dn(t,c+3*b,x[on[b]]);c+=3*A;for(var P=[p,v],O=0;O<2;++O){var k=P[O];for(b=0;b<k.length;++b){var R=31&k[b];Dn(t,c,D[R]),c+=x[R],15<R&&(Dn(t,c,k[b]>>>5&127),c+=k[b]>>>12)}}}else B=xn,_=mn,E=An,T=vn;for(b=0;b<s;++b)255<n[b]?(R=n[b]>>>18&31,Pn(t,c,B[R+257]),c+=_[R+257],7<R&&(Dn(t,c,n[b]>>>23&31),c+=nn[R]),S=31&n[b],Pn(t,c,E[S]),c+=T[S],3<S&&(Pn(t,c,n[b]>>>5&8191),c+=an[S])):(Pn(t,c,B[n[b]]),c+=_[n[b]]);return Pn(t,c,B[256]),c+_[256]},Un=new rn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Gn=new en(0),jn=function(e,t,r,n,i,a){var o=e.length,s=new en(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?Ln(l,u,e.subarray(c,h)):(l[c]=a,Ln(l,u,e.subarray(c,o)))}else{for(var d=(t=Un[t-1])>>>13,f=8191&t,p=(1<<r)-1,m=new tn(32768),v=new tn(1+p),g=Math.ceil(r/3),y=2*g,b=function(t){return(e[t]^e[t+1]<<g^e[t+2]<<y)&p},x=new rn(25e3),w=new tn(288),A=new tn(32),S=0,M=0,C=(c=0,0),B=0,_=0;c<o;++c){var E=b(c),T=32767&c,D=v[E];if(m[T]=D,v[E]=T,B<=c){var P=o-c;if((7e3<S||24576<C)&&423<P){u=Fn(e,l,0,x,w,A,M,C,_,c-_,u),C=S=M=0,_=c;for(var O=0;O<286;++O)w[O]=0;for(O=0;O<30;++O)A[O]=0}var k=2,R=0,I=f,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&&--I&&T!=D;){if(e[c+k]==e[c+k-L]){for(var j=0;j<G&&e[c+j]==e[c+j-L];++j);if(k<j){if(R=L,F<(k=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}R?(x[C++]=268435456|ln[k]<<18|cn[R],E=31&ln[k],P=31&cn[R],M+=nn[E]+an[P],++w[257+E],++A[P],B=c+k,++S):(x[C++]=e[c],++w[e[c]])}}u=Fn(e,l,a,x,w,A,M,C,_,c-_,u),!a&&7&u&&(u=Ln(l,u+1,Gn))}return En(s,0,n+_n(u)+i)},Nn=function(){for(var e=new rn(256),t=0;t<256;++t){for(var r=t,n=9;--n;)r=(1&r&&3988292384)^r>>>1;e[t]=r}return e}(),Hn=function(){var e=-1;return{p:function(t){for(var r=e,n=0;n<t.length;++n)r=Nn[255&r^t[n]]^r>>>8;e=r},d:function(){return~e}}},zn=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}}},Vn=function(e,t,r,n,i){return jn(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)},Jn=function(e,t){var r,n={};for(r in e)n[r]=e[r];for(r in t)n[r]=t[r];return n},Kn=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]},Zn=[],Wn=function(e,t,r,n){var i;if(!Zn[r]){for(var a="",o={},s=e.length-1,l=0;l<s;++l)a=(i=Kn(e[l],a,o))[0],o=i[1];Zn[r]=Kn(e[s],a,o)}var u=Jn({},Zn[r][1]);return function(e,t,r,n,i){return(t=$r(Yr[t]||(Yr[t]=qr(e)))).onerror=function(e){return i(e.error,null)},t.onmessage=function(e){return i(null,e.data)},t.postMessage(r,n),t}(Zn[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 en||e[t]instanceof tn||e[t]instanceof rn)&&r.push((e[t]=new e[t].constructor(e[t])).buffer);return r}(u),n)},Xn=function(){return[en,tn,rn,nn,an,on,sn,un,wn,Sn,hn,pn,Mn,Cn,Bn,_n,En,Tn,wi,ti,ri]},Qn=function(){return[en,tn,rn,nn,an,on,ln,cn,xn,mn,An,vn,hn,Un,Gn,pn,Dn,Pn,On,kn,Rn,In,Ln,Fn,_n,En,jn,Vn,gi,ti]},Yn=function(){return[si,ci,oi,Hn,Nn]},qn=function(){return[li,ui]},$n=function(){return[hi,oi,zn]},ei=function(){return[di]},ti=function(e){return postMessage(e,[e.buffer])},ri=function(e){return e&&e.size&&new en(e.size)},ni=function(e,t,r,n,i,a){var o=Wn(r,n,i,(function(e,t){o.terminate(),a(e,t)}));return o.postMessage([e,t],t.consume?[e.buffer]:[]),function(){o.terminate()}},ii=function(e,t){return e[t]|e[t+1]<<8},ai=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},oi=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},si=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&&oi(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)}},li=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)},ui=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},ci=function(e){return 10+(e.filename&&e.filename.length+1||0)},hi=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)},di=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 fi(e,t){return t||"function"!=typeof e||(t=e,e={}),this.ondata=t,e}var pi=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(Vn(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}(),mi=function(e,t){yn([Qn,function(){return[gn,pi]}],this,fi.call(this,e,t),(function(e){e=new pi(e.data),onmessage=gn(e)}),6)};function vi(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return ni(e,t,[Qn],(function(e){return ti(gi(e.data[0],e.data[1]))}),0,r)}function gi(e,t){return Vn(e,t||{},0,0)}var yi=function(){function e(e){this.s={},this.p=new en(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 en(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=Tn(this.p,this.o,this.s);this.ondata(En(t,e,this.s.b),this.d),this.o=En(t,this.s.b-32768),this.s.b=this.o.length,this.p=En(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),bi=function(e){this.ondata=e,yn([Xn,function(){return[gn,yi]}],this,0,(function(){var e=new yi;onmessage=gn(e)}),7)};function xi(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return ni(e,t,[Xn],(function(e){return ti(wi(e.data[0],ri(e.data[1])))}),1,r)}function wi(e,t){return Tn(e,t)}var Ai=function(){function e(e,t){this.c=Hn(),this.l=0,this.v=1,pi.call(this,e,t)}return e.prototype.push=function(e,t){pi.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),this.l+=e.length,e=Vn(e,this.o,this.v&&ci(this.o),t&&8,!t),this.v&&(si(e,this.o),this.v=0),t&&(oi(e,e.length-8,this.c.d()),oi(e,e.length-4,this.l)),this.ondata(e,t)},e}(),Si=function(e,t){yn([Qn,Yn,function(){return[gn,pi,Ai]}],this,fi.call(this,e,t),(function(e){e=new Ai(e.data),onmessage=gn(e)}),8)};function Mi(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return ni(e,t,[Qn,Yn,function(){return[Ci]}],(function(e){return ti(Ci(e.data[0],e.data[1]))}),2,r)}function Ci(e,t){t=t||{};var r=Hn(),n=e.length,i=(r.p(e),e=Vn(e,t,ci(t),8)).length;return si(e,t),oi(e,i-8,r.d()),oi(e,i-4,n),e}var Bi=function(){function e(e){this.v=1,yi.call(this,e)}return e.prototype.push=function(e,t){if(yi.prototype.e.call(this,e),this.v){if((e=3<this.p.length?li(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)}yi.prototype.c.call(this,t)},e}(),_i=function(e){this.ondata=e,yn([Xn,qn,function(){return[gn,yi,Bi]}],this,0,(function(){var e=new Bi;onmessage=gn(e)}),9)};function Ei(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return ni(e,t,[Xn,qn,function(){return[Ti]}],(function(e){return ti(Ti(e.data[0]))}),3,r)}function Ti(e,t){return Tn(e.subarray(li(e),-8),t||new en(ui(e)))}var Di=function(){function e(e,t){this.c=zn(),this.v=1,pi.call(this,e,t)}return e.prototype.push=function(e,t){pi.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),e=Vn(e,this.o,this.v&&2,t&&4,!t),this.v&&(hi(e,this.o),this.v=0),t&&oi(e,e.length-4,this.c.d()),this.ondata(e,t)},e}(),Pi=function(e,t){yn([Qn,$n,function(){return[gn,pi,Di]}],this,fi.call(this,e,t),(function(e){e=new Di(e.data),onmessage=gn(e)}),10)};function Oi(e,t){t=t||{};var r=zn();return r.p(e),e=Vn(e,t,2,4),hi(e,t),oi(e,e.length-4,r.d()),e}var ki=function(){function e(e){this.v=1,yi.call(this,e)}return e.prototype.push=function(e,t){if(yi.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)}yi.prototype.c.call(this,t)},e}(),Ri=function(e){this.ondata=e,yn([Xn,ei,function(){return[gn,yi,ki]}],this,0,(function(){var e=new ki;onmessage=gn(e)}),11)};function Ii(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return ni(e,t,[Xn,ei,function(){return[Li]}],(function(e){return ti(Li(e.data[0],ri(e.data[1])))}),5,r)}function Li(e,t){return Tn((di(e),e.subarray(2,-4)),t)}var Fi=function(){function e(e){this.G=Bi,this.I=yi,this.Z=ki,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 en(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}(),Ui=function(){function e(e){this.G=_i,this.I=bi,this.Z=Ri,this.ondata=e}return e.prototype.push=function(e,t){Fi.prototype.push.call(this,e,t)},e}(),Gi=function e(t,r,n,i){for(var a in t){var o=t[a];a=r+a,o instanceof en?n[a]=[o,i]:Array.isArray(o)?n[a]=[o[0],Jn(i,o[1])]:e(o,a+"/",n,i)}},ji="undefined"!=typeof TextEncoder&&new TextEncoder,Ni="undefined"!=typeof TextDecoder&&new TextDecoder,Hi=0;try{Ni.decode(Gn,{stream:!0}),Hi=1}catch(dn){}var zi=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,En(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)}},Vi=function(){function e(e){this.ondata=e,Hi?this.t=new TextDecoder:this.p=Gn}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 en(this.p.length+e.length)).set(this.p),r.set(e,this.p.length),e=zi(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}(),Ji=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(Ki(e),this.d=t||!1)},e}();function Ki(e,t){if(t){for(var r=new en(e.length),n=0;n<e.length;++n)r[n]=e.charCodeAt(n);return r}if(ji)return ji.encode(e);var i=e.length,a=new en(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 en(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 En(a,0,o)}function Zi(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(Ni)return Ni.decode(e);var i=(t=zi(e))[0];if(t[1].length)throw"invalid utf-8 data";return i}function Wi(e){return 1==e?3:e<6?2:9==e?1:0}var Xi=function(e,t){return t+30+ii(e,t+26)+ii(e,t+28)},Qi=function(e,t,r){var n=ii(e,t+28),i=Zi(e.subarray(t+46,t+46+n),!(2048&ii(e,t+8))),a=(n=t+46+n,ai(e,t+20)),o=(a=(r=r&&4294967295==a?Yi(e,n):[a,ai(e,t+24),ai(e,t+42)])[0],r[1]);return r=r[2],[ii(e,t+10),a,o,i,n+ii(e,t+30)+ii(e,t+32),r]},Yi=function(e,t){for(;1!=ii(e,t);t+=4+ii(e,t+2));return[bn(e,t+12),bn(e,t+4),bn(e,t+20)]},qi=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},$i=function(e,t,r,n,i,a,o,s){var l=n.length,u=r.extra,c=s&&s.length,h=qi(u),d=(oi(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(oi(e,t,d<<25|i.getMonth()+1<<21|i.getDate()<<16|i.getHours()<<11|i.getMinutes()<<5|i.getSeconds()>>>1),t+=4,null!=a&&(oi(e,t,r.crc),oi(e,t+4,a),oi(e,t+8,r.size)),oi(e,t+12,l),oi(e,t+14,h),t+=16,null!=o&&(oi(e,t,c),oi(e,t+6,r.attrs),oi(e,t+10,o),t+=14),e.set(n,t),t+=l,h)for(var f in u){var p=u[f],m=p.length;oi(e,t,+f),oi(e,t+2,m),e.set(p,t+4),t+=4+m}return c&&(e.set(s,t),t+=c),t},ea=function(e,t,r,n,i){oi(e,t,101010256),oi(e,t+8,r),oi(e,t+10,r),oi(e,t+12,n),oi(e,t+16,i)},ta=function(){function e(e){this.filename=e,this.c=Hn(),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}(),ra=function(){function e(e,t){var r=this;t=t||{},ta.call(this,e),this.d=new pi(t,(function(e,t){r.ondata(null,e,t)})),this.compression=8,this.flag=Wi(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){ta.prototype.push.call(this,e,t)},e}(),na=function(){function e(e,t){var r=this;t=t||{},ta.call(this,e),this.d=new mi(t,(function(e,t,n){r.ondata(e,t,n)})),this.compression=8,this.flag=Wi(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){ta.prototype.push.call(this,e,t)},e}(),ia=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=Ki(e.filename),n=r.length,i=(a=e.comment)&&Ki(a),a=n!=e.filename.length||i&&a.length!=i.length,o=n+qi(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 en(o);var l=($i(n,0,e,r,a),[n]),u=this.d,c=(this.d=0,this.u.length),h=Jn(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 en(16),oi(r,0,134695760),oi(r,4,e.crc),oi(r,8,d),oi(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+qi(l.extra)+(l.o?l.o.length:0);for(var a=new en(r+22),o=0,s=this.u;o<s.length;o++){var l=s[o];$i(a,e,l,l.f,l.u,l.c,t,l.o),e+=46+l.f.length+qi(l.extra)+(l.o?l.o.length:0),t+=l.b}ea(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}(),aa=function(){function e(){}return e.prototype.push=function(e,t){this.ondata(null,e,t)},e.compression=0,e}(),oa=function(){function e(){var e=this;this.i=new yi((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}(),sa=function(){function e(e,t){var r=this;t<32e4?this.i=new yi((function(e,t){r.ondata(null,e,t)})):(this.i=new bi((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=En(e,0)),this.i.push(e,t)},e.compression=8,e}(),la=function(){function e(e){this.onfile=e,this.k=[],this.o={0:aa},this.p=Gn}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 en(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,f,p,m,v,g,y,b=ai(l,o);return 67324752==b?(a=1,s=o,h.d=null,h.c=0,n=ii(l,o+6),e=ii(l,o+8),t=2048&n,n&=8,i=ii(l,o+26),d=ii(l,o+28),o+30+i+d<u&&(h.k.unshift(f=[]),a=2,p=ai(l,o+18),m=ai(l,o+22),v=Zi(l.subarray(o+30,o+=30+i),!t),4294967295==p?(i=n?[-2]:Yi(l,o),p=i[0],m=i[1]):n&&(p=-1),o+=d,h.c=p,y={name:v,compression:e,start:function(){if(!y.ondata)throw"no callback";if(p){var t=r.o[e];if(!t)throw"unknown compression type "+e;(g=p<0?new t(v):new t(v,p,m)).ondata=function(e,t,r){y.ondata(e,t,r)};for(var n=0,i=f;n<i.length;n++)g.push(i[n],!1);r.k[0]==f&&r.c?r.d=g:g.push(Gn,!0)}else y.ondata(null,Gn,!0)},terminate:function(){g&&g.terminate&&g.terminate()}},0<=p&&(y.size=p,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=Gn,c<0&&(n=a?l.subarray(0,s-12-(-2==c&&8)-(134695760==ai(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 ua(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 ca(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 ha(e,t,n,i,a){for(var o=a<e?a:e,s=[],l=ua(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),f=1;f<=r;++f){h[f]=t-i[e+1-f],d[f]=i[e+f]-t;for(var p=0,m=0;m<f;++m){var v=d[m+1],g=h[f-m],y=(u[f][m]=v+g,u[m][f-1]/u[f][m]);u[m][f]=p+v*y,p=g*y}u[f][f]=p}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 C=S[0][0]=1;C<=n;++C){var B=0,_=x-C,E=r-C;C<=x&&(S[A][0]=S[w][0]/u[1+E][_],B=S[A][0]*u[_][E]);for(var T=x-1<=E?C-1:r-x,D=-1<=_?1:-_;D<=T;++D)S[A][D]=(S[w][D]-S[w][D-1])/u[1+E][_+D],B+=S[A][D]*u[_+D][E];x<=E&&(S[A][C]=-S[w][C-1]/u[1+E][x],B+=S[A][C]*u[x][E]),s[C][x]=B;var P=w;w=A,A=P}}for(var O=r,k=1;k<=n;++k){for(var R=0;R<=r;++R)s[k][R]*=O;O*=r-k}return s}(l,i,e,o,t),c=[],h=0;h<n.length;++h){var d=n[h].clone(),f=d.w;d.x*=f,d.y*=f,d.z*=f,c[h]=d}for(var p=0;p<=o;++p){for(var m=c[l-e].clone().multiplyScalar(u[p][0]),v=1;v<=e;++v)m.add(c[l-e+v].clone().multiplyScalar(u[p][v]));s[p]=m}for(var g=o+1;g<=a+1;++g)s[g]=new r.Vector4(0,0,0);return s}function da(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 fa(e){return(fa="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 pa(e,t){return(pa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function ma(e){return(ma=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var va,ga,ya,ba=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&&pa(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=ma(e);if(r=t?(r=ma(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===fa(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=ua(e,i,t),o=ca(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]),da(ha(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 xa(e){return(xa="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 wa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Aa(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 Sa(e,t,r){t&&Aa(e.prototype,t),r&&Aa(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function Ma(e,t){return(Ma=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Ca(e){return(Ca=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ba=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&&Ma(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=Ca(e);if(r=t?(r=Ca(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===xa(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 wa(this,i),n.call(this,e)}return Sa(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===za(n,0,i.length))va=(new Pa).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=za(e)))throw new Error("THREE.FBXLoader: Unknown format.");if(Ra(n)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Ra(n));va=(new Da).parse(n)}var n,i=new r.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new _a(i,this.manager).parse(va)}}]),i}(r.Loader),_a=function(){function e(t,r){wa(this,e),this.textureLoader=t,this.manager=r}return Sa(e,[{key:"parse",value:function(){ga=this.parseConnections();var e=this.parseImages(),t=(e=this.parseTextures(e),e=this.parseMaterials(e),this.parseDeformers()),r=(new Ea).parse(t);return this.parseScene(t,r,e),ya}},{key:"parseConnections",value:function(){var e=new Map;return"Connections"in va&&va.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 va.Objects){var n,i=va.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];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 va.Objects){var r,n=va.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=ga.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 va.Objects){var r,n=va.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"===xa(o)&&(o=o.value),!ga.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 ga.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 va.Objects&&t in va.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=ga.get(t).children[0].ID),e.get(t)}},{key:"parseDeformers",value:function(){var e={},t={};if("Deformer"in va.Objects){var r,n=va.Objects.Deformer;for(r in n){var i,a=n[r],o=ga.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=ga.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){ya=new r.Group;var i=this.parseModels(e.skeletons,t,n),a=va.Objects.Model,o=this;i.forEach((function(e){var t=a[e.ID];o.setLookAtProperties(e,t),ga.get(e.ID).parents.forEach((function(t){void 0!==(t=i.get(t.ID))&&t.add(e)})),null===e.parent&&ya.add(e)})),this.bindSkeleton(e.skeletons,t,i),this.createAmbientLight(),ya.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=ja(e.userData.transformData),e.applyMatrix4(t),e.updateWorldMatrix())})),n=(new Ta).parse(),1===ya.children.length&&ya.children[0].isGroup&&(ya.children[0].animations=n,ya=ya.children[0]),ya.animations=n}},{key:"parseModels",value:function(e,t,n){var i,a=new Map,o=va.Objects.Model;for(i in o){var s=parseInt(i),l=o[i],u=ga.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=va.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=va.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?Na(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&&ga.get(e.ID).children.forEach((function(t){"LookAtProperty"===t.relationship&&"Lcl_Translation"in(t=va.Objects.Model[t.ID])&&(t=t.Lcl_Translation.value,void 0!==e.target?(e.target.position.fromArray(t),ya.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];ga.get(parseInt(o.ID)).parents.forEach((function(e){t.has(e.ID)&&(e=e.ID,ga.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 va.Objects){var t,n,i=va.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 va&&"AmbientColor"in va.GlobalSettings&&(n=(t=va.GlobalSettings.AmbientColor.value)[0],e=t[1],t=t[2],0===n&&0===e&&0===t||(n=new r.Color(n,e,t),ya.add(new r.AmbientLight(n,1))))}}]),e}(),Ea=function(){function e(){wa(this,e)}return Sa(e,[{key:"parse",value:function(e){var t=new Map;if("Geometry"in va.Objects){var r,n=va.Objects.Geometry;for(r in n){var i=ga.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 va.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=o[0],o={},"RotationOrder"in e&&(o.eulerOrder=Na(e.RotationOrder.value)),"InheritType"in e&&(o.inheritType=parseInt(e.InheritType.value)),"GeometricTranslation"in e&&(o.translation=e.GeometricTranslation.value),"GeometricRotation"in e&&(o.rotation=e.GeometricRotation.value),"GeometricScaling"in e&&(o.scale=e.GeometricScaling.value),e=ja(o),this.genGeometry(t,n,a,e)}},{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,f){var p,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=Fa(f,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=Fa(f,r,d,e.normal),o.push(g[0],g[1],g[2])),e.material&&"AllSame"!==e.material.mappingType&&(p=Fa(f,r,d,e.material)[0]),e.uv&&e.uv.forEach((function(e,t){e=Fa(f,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,p,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=va.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===ba)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 ba(n,t,i,l,u).getPoints(12*i.length),(new r.BufferGeometry).setFromPoints(e)}}]),e}(),Ta=function(){function e(){wa(this,e)}return Sa(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!==va.Objects.AnimationCurve)return e=this.parseAnimationCurveNodes(),this.parseAnimationCurves(e),e=this.parseAnimationLayers(e),this.parseAnimStacks(e)}},{key:"parseAnimationCurveNodes",value:function(){var e,t=va.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=va.Objects.AnimationCurve;for(t in r){var n,i={id:r[t].id,times:r[t].KeyTime.a.map(Ia),values:r[t].KeyValueFloat.a},a=ga.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=va.Objects.AnimationLayer,i=new Map;for(t in n)!function(t){var n=[],a=ga.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=ga.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID;if(void 0!==o){var s=va.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]};ya.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=ga.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,t=ga.get(o).parents[0].ID,t=ga.get(t).parents[0].ID,t=ga.get(t).parents[0].ID,t={modelName:(t=va.Objects.Model[t]).attrName?r.PropertyBinding.sanitizeNodeName(t.attrName):"",morphName:va.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=va.Objects.AnimationStack,n={};for(t in r){var i=(1<(i=ga.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=ya.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=Va(e.times,t,u),e.values=Va(e.values,t,c)}}}}]),e}(),Da=function(){function e(){wa(this,e)}return Sa(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,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=Ha(t))}}},{key:"parseNodePropertyContinued",value:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=Ha(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=Ha(s)}this.getPrevNode()[n]={type:i,type2:a,flag:o,value:s},this.setCurrentProp(this.getPrevNode(),n)}}]),e}(),Pa=function(){function t(){wa(this,t)}return Sa(t,[{key:"parse",value:function(e){var t=new Oa(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(),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=Li(new Uint8Array(t.getArrayBuffer(a)));var o=new Oa(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)}default:throw new Error("THREE.FBXLoader: Unknown property type "+r)}}}]),t}(),Oa=function(){function e(t,r){wa(this,e),this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===r||r}return Sa(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(){wa(this,e)}return Sa(e,[{key:"add",value:function(e,t){this[e]=t}}]),e}();function Ra(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 Ia(e){return e/46186158e3}var La=[];function Fa(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=La,l=n.buffer,u=o,c=a,h=0;c<u;c++,h++)s[h]=l[c];return s}var Ua=new r.Euler,Ga=new r.Vector3;function ja(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,f=new r.Matrix4,p=e.inheritType||0,m=(e.translation&&t.setPosition(Ga.fromArray(e.translation)),e.preRotation&&((m=e.preRotation.map(r.MathUtils.degToRad)).push(e.eulerOrder),n.makeRotationFromEuler(Ua.fromArray(m))),e.rotation&&((m=e.rotation.map(r.MathUtils.degToRad)).push(e.eulerOrder),i.makeRotationFromEuler(Ua.fromArray(m))),e.postRotation&&((m=e.postRotation.map(r.MathUtils.degToRad)).push(e.eulerOrder),a.makeRotationFromEuler(Ua.fromArray(m)),a.invert()),e.scale&&o.scale(Ga.fromArray(e.scale)),e.scalingOffset&&l.setPosition(Ga.fromArray(e.scalingOffset)),e.scalingPivot&&s.setPosition(Ga.fromArray(e.scalingPivot)),e.rotationOffset&&u.setPosition(Ga.fromArray(e.rotationOffset)),e.rotationPivot&&c.setPosition(Ga.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===p?y.copy(e).multiply(m).multiply(v).multiply(g):1===p?y.copy(e).multiply(v).multiply(m).multiply(g):(p=(new r.Matrix4).scale((new r.Vector3).setFromMatrixScale(d)).clone().invert(),d=v.clone().multiply(p),y.copy(e).multiply(m).multiply(d).multiply(g)),v=c.clone().invert(),p=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(p),m=(new r.Matrix4).copyPosition(e),d=h.clone().multiply(m),f.copyPosition(d),(e=f.clone().multiply(y)).premultiply(h.invert()),e}function Na(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 Ha(e){return e.split(",").map((function(e){return parseFloat(e)}))}function za(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=e.byteLength),r.LoaderUtils.decodeText(new Uint8Array(e,t,n))}function Va(e,t,r){return e.slice(0,t).concat(r).concat(e.slice(t))}function Ja(e){return(Ja="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 Ka(e,t){return(Ka=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Za(e){return(Za=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Wa=/^[og]\s*(.+)?/,Xa=/^mtllib /,Qa=/^usemtl /,Ya=/^usemap /,qa=new r.Vector3,$a=new r.Vector3,eo=new r.Vector3,to=new r.Vector3,ro=new r.Vector3,no=new r.Color;function io(){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;qa.fromArray(n,e),$a.fromArray(n,t),eo.fromArray(n,r),ro.subVectors(eo,$a),to.subVectors(qa,$a),ro.cross(to),ro.normalize(),i.push(ro.x,ro.y,ro.z),i.push(ro.x,ro.y,ro.z),i.push(ro.x,ro.y,ro.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 ao=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&&Ka(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=Za(e);if(r=t?(r=Za(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Ja(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,n,i,a=new io,o=(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=o.length;c<h;c++)if(s=o[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":a.vertices.push(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3])),7<=d.length?(no.setRGB(parseFloat(d[4]),parseFloat(d[5]),parseFloat(d[6])).convertSRGBToLinear(),a.colors.push(no.r,no.g,no.b)):a.colors.push(void 0,void 0,void 0);break;case"vn":a.normals.push(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3]));break;case"vt":a.uvs.push(parseFloat(d[1]),parseFloat(d[2]))}}else if("f"===t){for(var f=s.slice(1).trim().split(/\s+/),p=[],m=0,v=f.length;m<v;m++){var g=f[m];0<g.length&&(g=g.split("/"),p.push(g))}for(var y=p[0],b=1,x=p.length-1;b<x;b++){var w=p[b],A=p[b+1];a.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(" "),M=[],C=[];if(-1===s.indexOf("/"))M=S;else for(var B=0,_=S.length;B<_;B++){var E=S[B].split("/");""!==E[0]&&M.push(E[0]),""!==E[1]&&C.push(E[1])}a.addLineGeometry(M,C)}else"p"===t?(n=s.slice(1).trim().split(" "),a.addPointGeometry(n)):null!==(l=Wa.exec(s))?(n=(" "+l[0].slice(1).trim()).slice(1),a.startObject(n)):Qa.test(s)?a.object.startMaterial(s.substring(7).trim(),a.materialLibraries):Xa.test(s)?a.materialLibraries.push(s.substring(7).trim()):Ya.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(),a.object.smooth="0"!==i&&"off"!==i):a.object.smooth=!0,(i=a.object.currentMaterial())&&(i.smooth=a.object.smooth)):"\0"!==s&&console.warn('THREE.OBJLoader: Unexpected line: "'+s+'"');a.finalize();var T,D=new r.Group;if(1==(D.materialLibraries=[].concat(a.materialLibraries),e=!(1===a.objects.length&&0===a.objects[0].geometry.vertices.length)))for(var P=0,O=a.objects.length;P<O;P++){var k=a.objects[P],R=k.geometry,I=k.materials,L="Line"===R.type,F="Points"===R.type,U=!1;if(0!==R.vertices.length){for(var G=new r.BufferGeometry,j=(G.setAttribute("position",new r.Float32BufferAttribute(R.vertices,3)),0<R.normals.length&&G.setAttribute("normal",new r.Float32BufferAttribute(R.normals,3)),0<R.colors.length&&(U=!0,G.setAttribute("color",new r.Float32BufferAttribute(R.colors,3))),!0===R.hasUVIndices&&G.setAttribute("uv",new r.Float32BufferAttribute(R.uvs,2)),[]),N=0,H=I.length;N<H;N++){var z,V=I[N],J=V.name+"_"+V.smooth+"_"+U,K=a.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,a.materials[J]=K),j.push(K)}if(R=void 0,1<j.length){for(var Z=0,W=I.length;Z<W;Z++){var X=I[Z];G.addGroup(X.groupStart,X.groupCount,Z)}R=new(L?r.LineSegments:F?r.Points:r.Mesh)(G,j)}else R=new(L?r.LineSegments:F?r.Points:r.Mesh)(G,j[0]);R.name=k.name,D.add(R)}}else 0<a.vertices.length&&(e=new r.PointsMaterial({size:1,sizeAttenuation:!1}),(T=new r.BufferGeometry).setAttribute("position",new r.Float32BufferAttribute(a.vertices,3)),0<a.colors.length&&void 0!==a.colors[0]&&(T.setAttribute("color",new r.Float32BufferAttribute(a.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),oo=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 so=t.FBXLoader;class lo{constructor(e){this.parses={fbx:new so,obj:new ao,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 oo(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 oo(this,void 0,void 0,(function*(){var t=yield(0,jt.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 oo(this,void 0,void 0,(function*(){var t=e instanceof ArrayBuffer?e:yield(0,jt.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 oo(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,jt.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 oo(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,jt.toResult)(e,"text"):e;return{type:"model",result:this.runScene.loaderer.json.parse(t)}}))}}class uo 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.pp.bloomParams.isBloom=e}setRender2(e){this.runScene.assetsEx.setRender2(e)}setRender3(e){this.runScene.assetsEx.setRender3(e)}}class co 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 ho 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){const t=this.runScene.assetsEx.get().camera;var n=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){if(this.animating){const r=this.runScene.assetsEx.get().camera;e*=this.turnRate;var t=this.controls.target;this.q1.rotateTowards(this.q2,e),r.position.set(0,0,1).applyQuaternion(this.q1).multiplyScalar(this.radius).add(t),r.quaternion.rotateTowards(this.targetQuaternion,e),0===this.q1.angleTo(this.q2)&&(this.animating=!1)}}}class fo{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 st.Z.Vector3,this.transControlsStatusMap={position:"translate",rotation:"rotate",scale:"scale"},this.multipObj=null,this.speaceType="world",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.get();this.tansControls=new co(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()}setSpeace(e){e=e||("world"===this.speaceType?"local":"world"),this.speaceType=e,this.tansControls.setSpace(e),this.addObject(this.runScene.modelEx.select)}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 ho(e),this.grid=this.createGrid(),this.init())}init(){this.transContro.init(),this.runScene.assetsEx.get().scene.add(this.grid)}createGrid(){const e=new st.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.boxHelper.visible=!0,this.transContro.addObject(e),this.boxHelper.setFromObject(e),this.focusModelId=this.runScene.uniqueEx.getId(e))}unfocus(){"running"!==this.runScene.optionsEx.options.mode&&(this.transContro.removeFocus(),this.boxHelper&&(this.boxHelper.visible=!1),this.focusModelId=void 0)}}ar=__webpack_require__(4356);var po=__webpack_require__.n(ar),mo=__webpack_require__(6569),vo=__webpack_require__(5860),go=__webpack_require__(1682),yo=__webpack_require__(9960);class bo{constructor(e){this.selectors={},this.boxHelperMap={},this.savedV3=new ot.Z,this.tempOldval=new Cs.Vector3,this.runScene=e}add(e,t=!1){if("array"===(0,mo.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);const o=this.getSelectedList("value");var{x:i,y:s,z:l}=i;const u=i-a.x,c=s-a.y,h=l-a.z,d=[new go.Z({target:e,info:t,oldV3:this.runScene.modelEx.cloneV3(r),newV3:n,runScene:this.runScene}).execute()];o.map((r=>{if(r!==e){var{x:n,y:i,z:a}=r[t],n=n+=u,i=i+=c,a=a+=h;let e=r[t].clone();e.x=n,e.y=i,e.z=a,n=new go.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,yo.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,yo.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,Vt.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 go.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,a=this.getSelectedList("value");var{x:e,y:o,z:s}=n;const l=e-i.x,u=o-i.y,c=s-i.z;t[r].copy(n),a.map((e=>{if(e!==t){var{x:n,y:i,z:a}=e[r],n=n+=l,i=i+=u,a=a+=c;let t=e[r].clone();t.x=n,t.y=i,t.z=a,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}),po().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:a,step:o}=e,s=this.getSelectedList("value");0!==s.length&&(e=s.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 vo.Z({target:e,info:"name",newVal:l,oldVal:e.name,runScene:this.runScene}).execute()})),this.runScene.undoEx.addUndo(e))}align(e){const t=this.getSelectedList("value");if(0!==t.length){const[n]=t;var r=t.map((t=>{var r=t.position.clone();const i=("all"===e?n:t).position.clone();return"all"!==e&&(i[e]=n.position[e]),new go.Z({target:t,info:"position",oldV3:r,newV3:i,runScene:this.runScene}).execute()}));this.runScene.multipSelector.add(t,!0),this.runScene.undoEx.addUndo(r)}}}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 wo(e,t){return(wo=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 So=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&&wo(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"===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(){if(!(this instanceof i))throw new TypeError("Cannot call a class as a function");var e=i.SkyShader;return e=new r.ShaderMaterial({name:"SkyShader",fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:r.UniformsUtils.clone(e.uniforms),side:r.BackSide,depthWrite:!1}),n.call(this,new r.BoxGeometry(1,1,1),e)}return t=i,Object.defineProperty(t,"prototype",{writable:!1}),t}(r.Mesh),Mo=(So.prototype.isSky=!0,So.SkyShader={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new r.Vector3},up:{value:new r.Vector3(0,1,0)}},vertexShader:"\n\t\tuniform vec3 sunPosition;\n\t\tuniform float rayleigh;\n\t\tuniform float turbidity;\n\t\tuniform float mieCoefficient;\n\t\tuniform vec3 up;\n\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\t// constants for atmospheric scattering\n\t\tconst float e = 2.71828182845904523536028747135266249775724709369995957;\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\t// wavelength of used primaries, according to preetham\n\t\tconst vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );\n\t\t// this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:\n\t\t// (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))\n\t\tconst vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );\n\n\t\t// mie stuff\n\t\t// K coefficient for the primaries\n\t\tconst float v = 4.0;\n\t\tconst vec3 K = vec3( 0.686, 0.678, 0.666 );\n\t\t// MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K\n\t\tconst vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );\n\n\t\t// earth shadow hack\n\t\t// cutoffAngle = pi / 1.95;\n\t\tconst float cutoffAngle = 1.6110731556870734;\n\t\tconst float steepness = 1.5;\n\t\tconst float EE = 1000.0;\n\n\t\tfloat sunIntensity( float zenithAngleCos ) {\n\t\t\tzenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );\n\t\t\treturn EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );\n\t\t}\n\n\t\tvec3 totalMie( float T ) {\n\t\t\tfloat c = ( 0.2 * T ) * 10E-18;\n\t\t\treturn 0.434 * c * MieConst;\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\t\t\tvWorldPosition = worldPosition.xyz;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\tgl_Position.z = gl_Position.w; // set z to camera.far\n\n\t\t\tvSunDirection = normalize( sunPosition );\n\n\t\t\tvSunE = sunIntensity( dot( vSunDirection, up ) );\n\n\t\t\tvSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );\n\n\t\t\tfloat rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );\n\n\t\t\t// extinction (absorbtion + out scattering)\n\t\t\t// rayleigh coefficients\n\t\t\tvBetaR = totalRayleigh * rayleighCoefficient;\n\n\t\t\t// mie coefficients\n\t\t\tvBetaM = totalMie( turbidity ) * mieCoefficient;\n\n\t\t}",fragmentShader:"\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\tuniform float mieDirectionalG;\n\t\tuniform vec3 up;\n\n\t\tconst vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );\n\n\t\t// constants for atmospheric scattering\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\tconst float n = 1.0003; // refractive index of air\n\t\tconst float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius)\n\n\t\t// optical length at zenith for molecules\n\t\tconst float rayleighZenithLength = 8.4E3;\n\t\tconst float mieZenithLength = 1.25E3;\n\t\t// 66 arc seconds -> degrees, and the cosine of that\n\t\tconst float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;\n\n\t\t// 3.0 / ( 16.0 * pi )\n\t\tconst float THREE_OVER_SIXTEENPI = 0.05968310365946075;\n\t\t// 1.0 / ( 4.0 * pi )\n\t\tconst float ONE_OVER_FOURPI = 0.07957747154594767;\n\n\t\tfloat rayleighPhase( float cosTheta ) {\n\t\t\treturn THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );\n\t\t}\n\n\t\tfloat hgPhase( float cosTheta, float g ) {\n\t\t\tfloat g2 = pow( g, 2.0 );\n\t\t\tfloat inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );\n\t\t\treturn ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec3 direction = normalize( vWorldPosition - cameraPos );\n\n\t\t\t// optical length\n\t\t\t// cutoff angle at 90 to avoid singularity in next formula.\n\t\t\tfloat zenithAngle = acos( max( 0.0, dot( up, direction ) ) );\n\t\t\tfloat inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );\n\t\t\tfloat sR = rayleighZenithLength * inverse;\n\t\t\tfloat sM = mieZenithLength * inverse;\n\n\t\t\t// combined extinction factor\n\t\t\tvec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );\n\n\t\t\t// in scattering\n\t\t\tfloat cosTheta = dot( direction, vSunDirection );\n\n\t\t\tfloat rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );\n\t\t\tvec3 betaRTheta = vBetaR * rPhase;\n\n\t\t\tfloat mPhase = hgPhase( cosTheta, mieDirectionalG );\n\t\t\tvec3 betaMTheta = vBetaM * mPhase;\n\n\t\t\tvec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );\n\t\t\tLin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );\n\n\t\t\t// nightsky\n\t\t\tfloat theta = acos( direction.y ); // elevation --\x3e y-axis, [-pi/2, pi/2]\n\t\t\tfloat phi = atan( direction.z, direction.x ); // azimuth --\x3e x-axis [-pi/2, pi/2]\n\t\t\tvec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );\n\t\t\tvec3 L0 = vec3( 0.1 ) * Fex;\n\n\t\t\t// composition + solar disc\n\t\t\tfloat sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );\n\t\t\tL0 += ( vSunE * 19000.0 * Fex ) * sundisk;\n\n\t\t\tvec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );\n\n\t\t\tvec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );\n\n\t\t\tgl_FragColor = vec4( retColor, 1.0 );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\n\t\t}"},__webpack_require__(7042)),Co=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 Bo extends V{constructor(){super(...arguments),this.sun=new Cs.Vector3,this.sky=new So,this.directionalLight=new Cs.DirectionalLight,this.skyData={isShow:!1,size:450,effectController:{morning:{turbidity:1,rayleigh:1,mieCoefficient:.005,mieDirectionalG:.7,elevation:2,azimuth:180,exposure:1,lightConfig:this.cloneLightConfig(Mo.Z.toJSON(this.directionalLight)),time:2},noon:{lightConfig:this.cloneLightConfig(Mo.Z.toJSON(this.directionalLight)),turbidity:1,rayleigh:1,mieCoefficient:.005,mieDirectionalG:.7,elevation:90,azimuth:180,exposure:1,time:2},evening:{turbidity:2.1,rayleigh:1.837,mieCoefficient:.007,mieDirectionalG:.7,elevation:0,azimuth:0,exposure:0,lightConfig:this.cloneLightConfig(Mo.Z.toJSON(this.directionalLight)),time:2},night:{turbidity:1,rayleigh:1,mieCoefficient:.005,mieDirectionalG:.7,elevation:2,azimuth:180,exposure:.5,lightConfig:this.cloneLightConfig(Mo.Z.toJSON(this.directionalLight)),time:2},midnight:{turbidity:.3,rayleigh:1.148,mieCoefficient:.015,mieDirectionalG:.83,elevation:90,azimuth:0,exposure:.1,lightConfig:this.cloneLightConfig(Mo.Z.toJSON(this.directionalLight)),time:2}},currentState:"morning",light:this.directionalLight},this.skipStepMap={"morning-evening":["noon","evening"],"morning-night":["noon","evening","night"],"morning-midnight":["noon","evening","night","midnight"],"noon-night":["evening","night"],"noon-midnight":["evening","night","midnight"],"evening-midnight":["night","midnight"],"evening-morning":["night","midnight","morning"],"night-morning":["midnight","morning"],"night-noon":["midnight","morning","noon"],"midnight-noon":["morning","noon"],"midnight-evening":["morning","noon","evening"],"midnight-night":["morning","noon","evening","night"]},this.lastEffectController={turbidity:1,rayleigh:1,mieCoefficient:.005,mieDirectionalG:.7,elevation:2,azimuth:180,exposure:.5},this.effectController={turbidity:1,rayleigh:1,mieCoefficient:.005,mieDirectionalG:.7,elevation:2,azimuth:180,exposure:.5},this.lastTime={index:0,name:"morning"},this.skyChangeArr=[],this.lightChangeArr=[],this.animaArr=["lightAnima","skyAnima"],this.uniforms=null,this.inied=!1,this.currentLightConfig={}}init(){this.addToGroup(),this.addScene()}addScene(){dt.materialIgnore.set(this.sky.material,!0),(0,ut.setHelper)(this.sky),ut.selectableModel.close(this.sky),(0,ut.setHelper)(this.directionalLight),this.runScene.modelEx.add(this.sky,void 0,{addToTree:!1}),this.runScene.modelEx.add(this.directionalLight,void 0,{addToTree:!1})}open(){this.sky.visible||(this.runScene.assetsEx.get().renderer.toneMapping=4,this.directionalLight.visible=!0,this.sky.visible=!0)}close(){this.sky.visible&&(this.runScene.assetsEx.get().renderer.toneMapping=0,this.directionalLight.visible=!1,this.sky.visible=!1)}toJSON(){var e=Object.assign(Object.assign({},this.skyData),{light:Mo.Z.toJSON(this.directionalLight)});return console.log("导出数据data:",e),e}parseJSON(e){}beforeRecoverySky(e){var{light:e,isShow:t,effectController:r,currentState:n}=e;e=new Mo.Z(this.runScene).parseJSON(e,{addToScene:!0}),this.skyData.light=e,this.directionalLight=e,this.skyData.isShow=t,this.skyData.effectController=r,this.skyData.currentState=n,this.sky.visible=t}recoverySkyState(e,t){this.setSkyConfig(e),this.setSkyScale(t)}recoveryLightState(e){this.lightAnimaFn(e)}setState(e,t){var r=this.skyData.currentState;this.setSkyAndLightState({state:e,index:t}),this.saveLastTimeState({oldState:r,state:e,index:t})}setSkyAndLightState(e){var{state:e,index:t}=e,r=this.skyData.currentState+"-"+e,n="midnight-morning"==r;Math.abs(this.lastTime.index-t)<2||n?(this.skyAnima(e),this.lightAnimaFn(e)):(this.passThroughSky(r),this.passThroughLight(r))}saveLastTimeState(e){var{oldState:e,state:t,index:r}=e;this.lastTime.name=e,this.lastTime.index=r,this.skyData.currentState=t}getLightDataByState(e){let t=new Cs.Vector3,r=new Cs.Vector3;switch(e){case"morning":t.x=0,t.y=0,t.z=-this.skyData.size,r.x=0,r.y=this.skyData.size/2*-1,r.z=this.skyData.size/2;break;case"noon":t.x=0,t.y=this.skyData.size/2,t.z=0,r.x=0,r.y=-1*this.skyData.size,r.z=0;break;case"evening":case"night":case"midnight":t.x=0,t.y=0,t.z=this.skyData.size,r.x=0,r.y=this.skyData.size/2*-1,r.z=this.skyData.size/2*-1}return{position:t,targetPosition:r}}setLightConfigByState(e){e=this.getLightConfigByState(e),Mo.Z.setConfig(this.directionalLight,e),this.directionalLight.visible=e.visible}lightAnimaFn(e){const t=this.skyData.effectController[e].time,{position:r,targetPosition:n}=this.getLightDataByState(e);return this.setLightConfigByState(e),this.animaArr.map((e=>null==(e=this.animaArr[e])?void 0:e.kill())),new Promise((e=>{this.animaArr.lightAnima=oe.anima({x:this.directionalLight.position.x,y:this.directionalLight.position.y,z:this.directionalLight.position.z,tx:this.directionalLight.target.position.x,ty:this.directionalLight.target.position.y,tz:this.directionalLight.target.position.z},{x:r.x,y:r.y,z:r.z,tx:n.x,ty:n.y,tz:n.z},t,(e=>{this.directionalLight.position.set(e.x,e.y,e.z),this.directionalLight.target.position.set(e.tx,e.ty,e.tz),this.skyData.light.position.set(e.x,e.y,e.z),this.skyData.light.target.position.set(e.tx,e.ty,e.tz)}),(()=>{e(0)}))}))}passThroughLight(e){const t=this.skipStepMap[e];1<=this.lightChangeArr.length&&(this.lightChangeArr=[]);let r=t.map((e=>()=>this.lightAnimaFn(e)));this.lightChangeArr=[...r],this.deepLightAnima(this.lightChangeArr,(()=>r=[]))}deepLightAnima(e,t){return Co(this,void 0,void 0,(function*(){const r=e.shift();r?(yield r(),this.deepLightAnima(e,t)):t()}))}getLightJSON(e){var t=Mo.Z.toJSON(this.directionalLight);e&&(this.skyData.effectController[e].lightConfig=t)}saveCurrentLightConfig(){this.skyData.effectController[this.skyData.currentState].lightConfig=Mo.Z.toJSON(this.skyData.light)}getLightConfigByState(e){let t=this.skyData.effectController[e].lightConfig;return t||(t=Mo.Z.toJSON(this.directionalLight),this.skyData.effectController[e].lightConfig=t),t}skyAnima(e){const{renderer:t,scene:r,camera:n}=this.runScene.assetsEx.get(),i=this.skyData.effectController[e].time;return new Promise((a=>{this.effectController=this.skyData.effectController[e],oe.anima(Object.assign({},this.lastEffectController),Object.assign({},this.effectController),i||1,(e=>{this.sky.material.uniforms.turbidity.value=e.turbidity,this.sky.material.uniforms.mieCoefficient.value=e.mieCoefficient,this.sky.material.uniforms.mieDirectionalG.value=e.mieDirectionalG,t.toneMappingExposure=e.exposure,t.render(r,n),e=Cs.MathUtils.degToRad(90-e.elevation);var i=Cs.MathUtils.degToRad(this.effectController.azimuth);this.sun.setFromSphericalCoords(1,e,i),this.sky.material.uniforms.sunPosition.value.copy(this.sun)}),(()=>{this.lastEffectController=this.effectController,a(0),console.log(e,"当前时间点~~~")}))}))}deepSkyAnima(e,t){return Co(this,void 0,void 0,(function*(){const r=e.shift();r?(yield r(),this.deepSkyAnima(e,t)):t()}))}passThroughSky(e){return Co(this,void 0,void 0,(function*(){const t=this.skipStepMap[e];1<=this.skyChangeArr.length&&(this.skyChangeArr=[]);let r=t.map((e=>()=>this.skyAnima(e)));this.skyChangeArr=[...r],this.deepSkyAnima(this.skyChangeArr,(()=>r=[]))}))}setSkyConfig(e){const{renderer:t,scene:r,camera:n}=this.runScene.assetsEx.get();this.sky.material.uniforms.turbidity.value=this.skyData.effectController[e].turbidity,this.sky.material.uniforms.mieCoefficient.value=this.skyData.effectController[e].mieCoefficient,this.sky.material.uniforms.mieDirectionalG.value=this.skyData.effectController[e].mieDirectionalG,t.toneMappingExposure=this.skyData.effectController[e].exposure,t.render(r,n);var i=Cs.MathUtils.degToRad(90-this.skyData.effectController[e].elevation);e=Cs.MathUtils.degToRad(this.skyData.effectController[e].azimuth),this.sun.setFromSphericalCoords(1,i,e),this.sky.material.uniforms.sunPosition.value.copy(this.sun)}setSkyScale(e){this.sky.scale.setScalar(e),this.skyData.size=e}isShowSky(e){this.runScene.modelEx[e?"add":"remove"](this.directionalLight),e?this.open():this.close(),this.skyData.isShow=e,this.sky.visible=e}addToGroup(){this.directionalLight.name="定向灯光",this.sky.name="定向天空"}setEffectController(e){var{time:e,type:t,val:r,params:n}=e;this.skyData.effectController[e][t]=r,n&&this.setSkyConfig(n),console.log(this.skyData.effectController,"天空盒修改")}setCurrentTime(e){this.skyData.currentState=e}setImplementTime(e){var{info:e,time:t}=e;this.skyData.effectController[e].time=t}reset(){this.close()}cloneLightConfig(e){if(null===e)return null;if("object"!==e.constructor)return e;if(e.constructor===Date)return new Date(e);if(e.constructor===RegExp)return new RegExp(e);var t,r,n=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(r=e[t],n[t]="object"==typeof r?arguments.callee(r):r);return n}}class _o extends V{constructor(){super(...arguments),this.sky=new Bo(this.runScene)}init(){}toJSON(){return console.log("导出---"),{sky:this.sky.toJSON()}}parseJSON(e){console.log("加载----"),this.sky.parseJSON(e.sky)}reset(){this.sky.reset()}}function Eo(){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 Eo.Panel("FPS","#0ff","#002")),u=r(new Eo.Panel("MS","#0f0","#020"));return self.performance&&self.performance.memory&&(i=r(new Eo.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}}Eo.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,f=74*o,p=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,f,p),v.fillStyle=r,v.globalAlpha=.9,v.fillRect(h,d,f,p),{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,f-o,p,h,d,f-o,p),v.fillRect(h+f-o,d,o,p),v.fillStyle=r,v.globalAlpha=.9,v.fillRect(h+f-o,d,o,a((1-l/g)*p))}}};const To=Eo;class Do{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,oe.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,t){this.options=(0,oe.deepMergeObject)(this.options,e||{}),this.options.showFps&&(this.addFps(t),this.runScene.cb.render.add("optionx-ex-render",this.render.bind(this)))}addFps(e){this.stats=To(),this.stats.showPanel(0),e.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))}}class Po{constructor(e){this.glowModelLength=new Set,this.outlineModelLength=new Set,this.runScene=e,this.initGlow(),this.initOutline()}initGlow(){const{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(){const{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})=>{e.userData.outline&&this.outlineAdd(e)})),r.add("pp-set-outline",(({model:e})=>{e.userData.outline&&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 Oo={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__(8493),Ro=__webpack_require__(8512),Io={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 Lo(e){return(Lo="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 Fo(e,t){return(Fo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Uo(e){return(Uo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Go=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&&Fo(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=Uo(e);if(r=t?(r=Uo(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Lo(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=Io;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]),f=(l=Math.round(s.resolution.x/2),u=Math.round(s.resolution.y/2),0);f<s.nMips;f++)s.separableBlurMaterials.push(s.getSeperableBlurMaterial(d[f])),s.separableBlurMaterials[f].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=Oo,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 Ro.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}(Ro.w);Go.BlurDirectionX=new r.Vector2(1,0),Go.BlurDirectionY=new r.Vector2(0,1);class jo extends Ro.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 Ro.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 No extends Ro.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 Ho={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 zo{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 No(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 Go(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 jo(Ho,"baseTexture","bloomTexture"),this.mixingPass.renderToScreen=!1),this.effectCopy||(this.effectCopy=new ko.T(Oo),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 Vo(e){return(Vo="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 Jo(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ko(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 Zo(e,t,r){t&&Ko(e.prototype,t),r&&Ko(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function Wo(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&&Xo(e,t)}function Xo(e,t){return(Xo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Qo(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"===Vo(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 Yo(e){return(Yo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var qo=function(){Wo(t,Ro.w);var e=Qo(t);function t(r,n){var i;return Jo(this,t),(i=e.call(this)).scene=r,i.camera=n,i.clear=!0,i.needsSwap=!1,i.inverse=!1,i}return Zo(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}(),$o=function(){Wo(t,Ro.w);var e=Qo(t);function t(){var r;return Jo(this,t),(r=e.call(this)).needsSwap=!1,r}return Zo(t,[{key:"render",value:function(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}]),t}();function es(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 ts=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(Oo),this.clock=new r.Clock}return function(e,t,r){t&&es(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!==qo&&(s instanceof qo?r=!0:s instanceof $o&&(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),(ir=new r.BufferGeometry).setAttribute("position",new r.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),ir.setAttribute("uv",new r.Float32BufferAttribute([0,2,0,0,2,0],2));const rs="\n varying vec2 vUv;\n \n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",ns="\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 is{constructor(e){this.mtuPP=e,this.bloomLayer=new Cs.Layers,this.bloomLayer.set(this.mtuPP.BLOOM_SCENE),this.darkMaterial=new Cs.MeshBasicMaterial({color:"black"}),this.materials={},(e=this.mtuPP.mainScene).fog&&(this.mtuPP.sceneFogColor||(this.mtuPP.sceneFogColor=new Cs.Color),this.mtuPP.sceneFogColor.copy(e.fog.color)),e.background&&(this.mtuPP.sceneBackground=e.background),this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.bloomPass=new Go(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 Cs.ShaderMaterial({uniforms:{baseTexture:{value:null},bloomTexture:{value:this.mtuPP.effectComposer.renderTarget2.texture}},vertexShader:rs,fragmentShader:ns,defines:{}}),"baseTexture"),this.finalPass.needsSwap=!0;var e=new Cs.WebGLRenderTarget(this.mtuPP.rtSize.x,this.mtuPP.rtSize.y,{samples:this.mtuPP.ppParams.samples});this.finalComposer=new ts(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 as(e){return(as="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 ss(e){return(ss=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ls=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=ss(e);if(r=t?(r=ss(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===as(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=Oo,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 Ro.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 weightSum = gaussianPdf(0.0, kernelRadius);\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 w = gaussianPdf(uvOffset.x, kernelRadius);\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}(Ro.w);ls.BlurDirectionX=new r.Vector2(1,0),ls.BlurDirectionY=new r.Vector2(0,1);class us{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.outlinePass||(this.outlinePass=new ls(this.mtuPP.rtSize,this.mtuPP.mainScene,this.mtuPP.mainCamera)),this.mtuPP.effectComposer.addPass(this.outlinePass)}setOutlineData(e,t){this.outlinePass[e]="visibleEdgeColor"===e||"hiddenEdgeColor"===e?new Cs.Color(t):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)||(e.userData.outline=!0,this.outlinePass.selectedObjects.push(e)):this.outlinePass.selectedObjects.map(((t,r)=>{t.uuid===e.uuid&&(e.userData.outline=!1,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 cs(e){return(cs="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 hs(e,t){return(hs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function ds(e){return(ds=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var fs=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&&hs(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=ds(e);if(r=t?(r=ds(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===cs(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}(Ro.w);class ps{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 Cs.Color(0),this.runScene=e,this.info=new Po(this.runScene),this.isSafari=-1<navigator.userAgent.indexOf("Safari"),this.isChrome=-1<navigator.userAgent.indexOf("Chrome"),this.rtSize=new Cs.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 Cs.Color(t.color)),"background"===e&&(this.sceneBackground&&(0,ct.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(){this.effectComposer=new ts(this.renderer,this.getNewRenderTarget(this.ppParams.samples)),this.renderPass=new fs(this.mainScene,this.mainCamera),this.effectComposer.addPass(this.renderPass),this.ppOutline(),this.ppGlow()}getNewRenderTarget(e){const t=new Cs.WebGLRenderTarget(this.rtSize.x,this.rtSize.y,{samples:e});return t.depthTexture=new Cs.DepthTexture(this.rtSize.x,this.rtSize.y),t.depthTexture.type=Cs.UnsignedIntType,t.depthTexture.format=Cs.DepthFormat,t}ppOutline(){this.mtOutline=new us(this)}ppGlow(){this.isChrome?(this.effectComposer.renderToScreen=!0,this.mtuGlow=new zo(this)):this.isSafari&&(this.effectComposer.renderToScreen=!1,this.threeGlow=new is(this))}toJSON(){const e={};var{ppParams:t,bloomParams:r,outlineParams:n}=this;return e.ppParams=Object.assign({},t),e.bloomParams=Object.assign({},r),e.outlineParams=Object.assign({},n),JSON.stringify(e)}fromJSON(e){var t,r,n,i,{ppParams:e,bloomParams:a,outlineParams:o}=e;e&&(e=e.samples,this.ppParams.samples=e,this.effectComposer&&this.effectComposer.reset(this.getNewRenderTarget(this.ppParams.samples))),a&&(({isBloom:e,radius:a,strength:t,threshold:r}=a),this.bloomParams.isBloom=e,this.bloomParams.radius=a,this.bloomParams.strength=t,this.bloomParams.threshold=r,this.isChrome?(this.mtuGlow.setGlowData("radius",a),this.mtuGlow.setGlowData("strength",t),this.mtuGlow.setGlowData("threshold",r)):this.isSafari&&(this.threeGlow.setGlowData("radius",a),this.threeGlow.setGlowData("strength",t),this.threeGlow.setGlowData("threshold",r)),this.runScene.cb.pp.glow.setData.cb(this.bloomParams).then()),o&&(({isOutline:e,edgeStrength:a,edgeGlow:t,edgeThickness:r,pulsePeriod:o,visibleEdgeColor:n,hiddenEdgeColor:i}=o),this.outlineParams.isOutline=e,this.outlineParams.edgeStrength=a,this.outlineParams.edgeGlow=t,this.outlineParams.edgeThickness=r,this.outlineParams.pulsePeriod=o,this.outlineParams.visibleEdgeColor=n,this.outlineParams.hiddenEdgeColor=i,this.mtOutline.setOutlineData("edgeStrength",a),this.mtOutline.setOutlineData("edgeGlow",t),this.mtOutline.setOutlineData("edgeThickness",r),this.mtOutline.setOutlineData("pulsePeriod",o),this.mtOutline.setOutlineData("visibleEdgeColor",n),this.mtOutline.setOutlineData("hiddenEdgeColor",i),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)}setPPData(e,t){this.ppParams[e]=t,"samples"===e&&this.effectComposer&&this.effectComposer.reset(this.getNewRenderTarget(this.ppParams.samples))}setGlowData(e,t){this.bloomParams[e]=t,this.isChrome?this.mtuGlow.setGlowData(e,t):this.isSafari&&this.threeGlow.setGlowData(e,t)}setOutlineData(e,t){this.outlineParams[e]=t,this.mtOutline.setOutlineData(e,t)}addOutlineObj(e,t=!0){this.mtOutline.addSelectedObject(e,t)}}var ms=__webpack_require__(8266);class vs extends V{constructor(e){super(e),this.map=new ot.Z,this.playLimit=new ht.cM,this.renderName="script-texture-render",this._clock=new r.Clock,this.bindEvent()}parse(e,t){var r=(0,Vt.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 gs extends V{constructor(e){super(e),this.runAll=!1,this.texture=new vs(e)}playAll(){this.runAll||(this.runAll=!0,this.texture.playAll())}closeAll(){this.runAll&&(this.runAll=!1,this.texture.closeAll())}}var ys=__webpack_require__(2016);class bs{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 ys.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,ht.lG)(t,"array"))return t.map((t=>{this.addModel(e,t)}));this.map.get(e).add((0,Vt.K)(t))}removeModel(e,t){if(this.map.has(e))return(0,ht.lG)(t,"array")?t.map((t=>{this.removeModel(e,t)})):void this.map.get(e).remove((0,Vt.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 ys.Z(r)})),this.map=ot.Z.formJSON(t),this.runScene.cb.tags.parseJSON.cb(e)}}var xs=__webpack_require__(9716);class ws{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=ws.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;const s=Object.keys(t).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t)));var l=(0,xs.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,f=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;if(!(i=e(h,c,0,f)))return n(0);var{begin:i,end:a}=i;return r=(0,oe.anima)(i,a,d,(e=>{(0,z.js)(f,((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)})),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":ws.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?po().model.v3ToMap(e):""}static SetTargetByData(e){const{baseType:t,data:r,defType:n,target:i}=e;var a,o;"number"===t?i[n]=r:"color"===t&&(({r:e,g:a,b:o}=r),i[n].setRGB(e,a,o))}getAllData(e=!1){return ws.getAllDefValByType(this.defOptions,this.target,e)}getData(e){return ws.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){ws.setTargetByBetween(e,t,r,this.defOptions,this.target)}clone(e){var{data:t,type:r}=this;const n=new(0,Ss[r])(e);return n.data=t,n}reset(){(0,z.js)(this.defOptions,((e,t)=>{ws.SetTargetByData({baseType:t.type,data:ws.getValByType(this.beginData,e,this.defOptions),target:this.target,defType:e})}))}remove(){delete this.target.userData.isTimeLineUsed}}ws.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]&&ws.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 As=ws,Ss={model:class extends As{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}=As.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;const o=Object.keys(t).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t)));var s=(0,xs.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,oe.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 As{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}=As.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,oe.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:f}=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,f)}),o)})),anima:oe.anima}};return(e,r,n,i=!1)=>{let a=i?n.time:0;const o=Object.keys(e).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t)));var s=(0,xs.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":po().model.v3ToMap(t),scale:e?"notNow":po().model.v3ToMap(r),rotation:e?"notNow":po().model.v3ToMap(n),target:e?"notNow":po().model.v3ToMap(this.controls.target)}}getData(e){var{position:t,scale:r,rotation:n}=this.target;let i;if("position"===e)i=po().model.v3ToMap(t);else if("scale"===e)i=po().model.v3ToMap(r);else if("rotation"===e)i=po().model.v3ToMap(n);else{if("target"!==e)throw TypeError("输入值不存在");i=po().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 As{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 Ms=__webpack_require__(2266);const Cs=st.Z,Bs={RunScene:class{constructor(e){this._clock=new r.Clock,this.cb=new Et,this.script=new gs(this),this.uniqueEx=new Vt.Z(this),this.fileEx=new lo(this),this.optionsEx=new Do(this),this.undoEx=new Ms.ZP(this),this.textureEx=new ct.default(this),this.controlsEx=new kt,this.assetsEx=new Bt(this),this.renderEx=new ms.Z(this),this.events=new class{constructor(e){this.key=new Ft(this),this.mouse=new Gt(this),this.drag=new Rt(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 bo(this),this.helperEx=null,this.materialEx=new dt.default(this),this.cameraEx=new Tt.Z(this),this.sceneEx=new ft.ZP(this),this.modelEx=new ut.default(this),this.loaderer=new wt(this),this.exporter=new Qr(this),this.lightEx=new Ht.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;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 a=i[r],o=i[r+1],s=e[a];if(e=e[o],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(a))/(Number(o)-Number(a))}}}})(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=Ss[t];if(t=i.getTarget(e,this.runScene)){const a=new i(t,this.runScene);a.data=r,n[e]=a}})),r.data=n,this.groupMap[t]=r,this.runScene.cb.timeLine.setGroupMap.cb({group:r,groupName:t})}))}playGroup(e,t){const r=(0,ht.Gm)({onlyReverse:!1},t).onlyReverse,n=(this.runScene.helperEx.unfocus(),this.groupMap[e]);if(n&&!n.run){n.run=!0;const i=Object.keys(n.data).map((e=>{const t=n.data[e];if(t.data=new Proxy(t.data,{set:(e,t,r)=>(e[t]=r,!0)}),r)return t.getAnima(n,!0);const i=t.getAnima(n);return n.reverse&&(e=t.getAnima(n,!0),i.push(...e)),i}));this.animaMap[e]||(this.animaMap[e]=[]),this.animaMap[e]=i.map((e=>(0,xs.eachTriggerArrGetControls)(e)));let a=0;a=r?n.time*n.speed:n.time*n.speed*(n.reverse?2:1);const o=(new Date).valueOf(),s=a;let l;t=setInterval((()=>{var t=((new Date).valueOf()-o)/s;this.runScene.cb.timeLine.playGroup.cb({groupName:e,progress:t})}),16.6);const u=new Promise((e=>l=setTimeout(e,a)));return this.timerMap[e]={setProgressTime:t,awaitRuned:l},u.then((()=>{if(clearInterval(this.timerMap[e].setProgressTime),n.run)return n.run=!1,n.loop?this.playGroup(e):void 0}))}}}(this),this.anima=new St(this),this.tags=new bs(this),this.globalConfig=new uo(this),this.pp=new ps(this),this.objects=new _o(this),this._renderLimit=new ht.cM,this._render=()=>{const{render2:e,render3:t}=this.assetsEx;var{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),(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 fo(this);const{camera:n,controls:i}=this.assetsEx.get();this.uniqueEx.model.add(n),this.renderEx.setSize(),i.update(),this.pp.init(),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 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){const{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:oe,ModelEx:ut,MaterialEx:dt,TextureEx:ct,Three:Cs,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-three"),require("@allex/md5"),require("js-funcs")):"function"==typeof define&&define.amd?define(["three","axios","uuid1","js-funcs-three","@allex/md5","js-funcs"],t):"object"==typeof exports?exports.RunScene=t(require("three"),require("axios"),require("uuid1"),require("js-funcs-three"),require("@allex/md5"),require("js-funcs")):e.RunScene=t(e.three,e.axios,e.uuid1,e["js-funcs-three"],e["@allex/md5"],e["js-funcs"])}(self,((__WEBPACK_EXTERNAL_MODULE__8881__,__WEBPACK_EXTERNAL_MODULE__3300__,__WEBPACK_EXTERNAL_MODULE__7937__,__WEBPACK_EXTERNAL_MODULE__4356__,__WEBPACK_EXTERNAL_MODULE__1129__,__WEBPACK_EXTERNAL_MODULE__6001__)=>(()=>{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&&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"===p(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 f(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 f(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)?f(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 f(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 p(e){return(p="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 C(e){var t=parseFloat(e);return(t||0===t)&&(e+"").match(et).length<2?t:He(e)?e.trim():e}function B(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=We(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 k(e,t){return(e-t._start)*t._ts+(0<=t._ts?0:t._dirty?t.totalDuration():t._tDur)}function R(e,t){var r;if((t._time||t._initted&&!t._dur)&&(r=k(e.rawTime(),t),(!t._dur||V(0,t.totalDuration(),r)-t._tTime>Ie)&&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=-Ie}}function I(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||R(e,t),e}function L(e,t){(rt.ScrollTrigger||it("scrollTrigger",t))&&rt.ScrollTrigger.create(t,e)}function F(e,t,r,n){return Zt(e,t),e._initted?!r&&e._pt&&(e._dur&&!1!==e.vars.lazy||!e._dur&&e.vars.lazy)&&fe!==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()>=Re?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*(We(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){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,a={},o=(e=0<n&&n<1,isNaN(n)||e),s=t.axis,l=n,u=n;return He(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,f,p,m,v,g,y,b,x=(h||t).length,w=a[x];if(!w){if(!(b="auto"===t.grid?0:(t.grid||[1,Re])[1])){for(g=-Re;g<(g=h[b++].getBoundingClientRect().left)&&b<x;);b--}for(w=a[x]=[],d=o?Math.min(b,x)*l-.5:n%b,f=b===Re?0:o?x*u/b-.5:n/b|0,y=Re,v=g=0;v<x;v++)m=v%b-d,p=f-(v/b|0),w[v]=m=s?Math.abs("y"===s?p:m):Ge(m*m+p*p),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=Bt(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:Bt(r))}}function Z(e,t){var r,n,i=We(e);return!i&&Je(e)&&(r=i=e.radius||Re,e.values?(e=Tt(e.values),(n=!Ve(e[0]))&&(r*=r)):e=K(e.increment)),Ct(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=Re,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+Bt(t)}:K(e))}function W(e,t,r,n){return Ct(We(e)?!t:!0===r?!!(r=0):!n,(function(){return We(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 Ct(r,(function(r){return e[~~t(r)]}))}function Q(e,t,r,n,i){var a=t-e,o=n-r;return Ct(i,(function(t){return r+((t-e)/a*o||0)}))}function Y(e,t,r){var n,i,a,o=e.labels,s=Re;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=Rt(e,t,1))&&u+(t?e[0]+","+e[1]+"%,"+e[2]+"%,"+e[3]:e.join(","))+")"})),r&&(a=It(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,fe,pe,me,ve,ge,ye,be,xe,we,Ae,Se,Me,Ce,Be,_e,Ee,Te,De,Pe,Oe={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},ke={duration:.5,overwrite:!1,delay:0},Re=1e8,Ie=1/Re,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"==p(e)},Ke=function(e){return!1!==e},Ze="function"==typeof ArrayBuffer&&ArrayBuffer.isView||function(){},We=Array.isArray,Xe=/(?:-?\.?\d|\.)+/gi,Qe=/[-+=.]*\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="",ft=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},pt=function(e){return e._gsap||ft(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||Ie)||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},Ct=function(e,t){return e||0===e?t(e):t},Bt=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()?We(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)+W(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,kt={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]},Rt=function(e,t,r){var n,i,a,o,s,l,u,c=e?Ve(e)?[e>>16,e>>8&Ot,e&Ot]:0:kt.black;if(!c){if(","===e.substr(-1)&&(e=e.substr(0,e.length-1)),kt[e])c=kt[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(Qe),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)||kt.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},It=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 kt)t+="|"+e+"\\b";return new RegExp(t+")","gi")}(),Ft=/hsl[a]?\(/,Ut=(we=Date.now,Ae=500,Se=33,Me=we(),Ce=Me,_e=Be=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/Ie,Se=Math.min(t,Ae,0)},fps:function(e){Be=1e3/(e||240),_e=1e3*Te.time+Be},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(C))):jt._CE&&Nt.test(e)?jt._CE("",e):a}(e))||t};function Jt(e){var t,r,n,i=we()-Ce,a=!0===e;if(Ae<i&&(Me+=i-Se),(0<(i=(r=(Ce+=i)-Me)-_e)||a)&&(n=++Te.frame,be=r-1e3*Te.time,Te.time=r/=1e3,_e+=i+(Be<=i?4:Be-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 Zt(e,t){var r,n,i,a,o,s,l,u,c,h,d,f,p,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,C=m.keyframes,B=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,k=e.timeline;if(e._ease=Vt(v=!k||C&&v?v:"none",ke.ease),e._yEase=M?zt(Vt(!0===M?v:M,ke.ease)):0,M&&e._yoyo&&!e._repeat&&(M=e._yEase,e._yEase=e._ease,e._ease=M),e._from=!k&&!!m.runBackwards,!k||C&&!m.stagger){if(f=(u=T[0]?pt(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&&!B&&e._startAt.render(-1,!0),y){if(0<t&&!B&&(e._startAt=0),_&&t<=0)return void(t&&(e._zTime=t))}else!1===B&&(e._startAt=0);else if(S&&_)if(E)B||(e._startAt=0);else if(i=gt({overwrite:!1,data:"isFromStart",lazy:(y=!t&&y)&&Ke(b),immediateRender:y,stagger:0,parent:D},r),f&&(i[u.prop]=f),xt(e._startAt=hr.set(T,i)),t<0&&e._startAt.render(-1,!0),e._zTime=t,y){if(!t)return}else Zt(e._startAt,Ie);for(e._pt=0,b=_&&Ke(b)||b&&!_,n=0;n<T.length;n++){if(l=(o=T[n])._gsap||ft(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,f||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||f)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)),p=!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)&&!p,C&&t<=0&&k.render(Re,!0,!0)}function Wt(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 Qt(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-Ie;return function(e){return((n*V(0,a,e)|0)+i)*r}}},ke.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&&R(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)&&I(this._dp,this,this._start-this._delay)}return(this._tTime!==e||!this._dur&&!t||this._initted&&Math.abs(this._zTime)===Ie||!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===-Ie?0:this._rts;if(this._rts===e)return this;for(var t=this.parent&&this._ts?k(this.parent._time,this):this._tTime,r=(this._rts=+e||0,this._ts=this._ps||e===-Ie?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)!==Ie&&(this._tTime-=Ie)))),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||I(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?k(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?-Ie:0)),this):this._rts<0}},{key:"invalidate",value:function(){return this._initted=this._act=0,this._zTime=-Ie,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)-Ie))}},{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:B;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:-Ie,_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&&I(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 I(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,f=this._time,p=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&&p<v&&0<=e?p:v)!==this._tTime||r||g){if(f!==this._time&&m&&(v+=this._time-f,e+=this._time-f),n=v,c=this._start,s=!(u=this._ts),g&&(m||(f=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===p?(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=!f&&this._tTime&&h!==a?a:h)&&!this._lock){var y=g&&1&h;if(g=y===(g&&1&a),f=(y=a<h?!y:y)?0:m,this._lock=1,this.render(f||(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),f&&f!==this._time||s!=!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(m=this._dur,p=this._tDur,g&&(this._lock=2,this.render(f=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(f),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,f=0),!f&&n&&!t&&(q(this,"onStart"),this._tTime!==v))return this;if(f<=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=-Ie);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?-Ie:Ie);break}}b=i}if(l&&!t&&(this.pause(),l.render(f<=n?0:-Ie)._zTime=f<=n?1:-1,this._ts))return this._start=c,At(this),this.render(e,t,r);this._onUpdate&&!t&&q(this,"onUpdate",!0),!(v===p&&p>=this.totalDuration()||!v&&f)||c!==this._start&&Math.abs(u)===Math.abs(this._ts)||this._lock||(!e&&m||!(v===p&&0<this._ts||!v&&this._ts<0)||xt(this,1),t||e<0&&!f||!v&&!f&&p||(q(this,v===p&&0<=e?"onComplete":"onReverseComplete",!0),!this._prom||v<p&&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(We(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?I(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]:-Re,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,I(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())||Ie,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+Ie)}},{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=Re;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,I(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,k(e,le)),fe=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,Qt,null,i),f=0,p=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(f,c.index),l?l=(l+1)%5:"rgba("===c.substr(-5)&&(l=1),u!==s[p++]&&(h=parseFloat(s[p-1])||0,d._pt={_next:d._pt,p:c||1===p?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},f=qe.lastIndex);return d.c=f<n.length?n.substring(f,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?pr:fr:dr,He(n)&&"="===(n=~n.indexOf("random(")?Pt(n):n).charAt(1)&&(!(u=parseFloat(a)+parseFloat(n.substr(2))*("-"===n.charAt(0)?-1:1)+(Bt(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=Wt(e,i,t,r,n)),!Je(e)||e.style&&e.nodeType||We(e)||Ze(e))return He(e)?Wt(e,i,t,r,n):e;var a,o={};for(a in e)o[a]=Wt(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!==pe))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,f,p,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,C=a.defaults,B=a.scrollTrigger,E=a.yoyoEase,P=(a=n.parent||le,(We(r)||Ze(r)?Ve(r[0]):"length"in n)?[r]:Tt(r));if(o._targets=P.length?ft(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:C||{}})).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(f in A)~ur.indexOf(f)&&((v=v||{})[f]=A[f]);for(u=0;u<d;u++)(c=yt(n,cr)).stagger=0,E&&(c.yoyoEase=E),v&&_(c,v),p=P[u],c.duration=+Wt(y,s(o),u,p,P),c.delay=(+Wt(x,s(o),u,p,P)||0)-o._delay,!A&&1===d&&c.delay&&(o._delay=x=c.delay,o._start+=x,c.delay=0),l.to(p,c,m?m(u,p,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,k,R,F=0;if(We(M))M.forEach((function(e){return l.to(P,e,">")}));else{for(f in c={},M)"ease"!==f&&"easeEach"!==f&&function(e,t,r,n){var i,a,o=t.ease||n||"power1.inOut";if(We(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})}(f,M[f],c,M.easeEach);for(f in c)for(O=c[f].sort((function(e,t){return e.t-t.t})),u=F=0;u<O.length;u++)(R={ease:(k=O[u]).e,duration:(k.t-(u?O[u-1].t:0))/100*y})[f]=k.v,l.to(P,R,F),F+=R.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),I(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=-Ie,o.render(Math.max(0,-x))),B&&L(s(o),B),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-Ie<e&&0<=e?o:e<Ie?0:e;if(s){if(l!==this._tTime||!e||r||!this._initted&&this._tTime||this._startAt&&this._zTime<0!=e<0){if(m=l,p=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)),(f=this._yoyo&&1&g)&&(d=this._yEase,m=s-m),y=O(this._tTime,h),m===a&&!r&&this._initted)return this;g!==y&&(p&&this._yEase&&re(p,f),!this.vars.repeatRefresh||f||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;p&&p.render(e<0?e:!m&&f?-Ie:p._dur*p._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,f=t,p=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||p||h._zTime===Ie||!d&&h._zTime){if(h._initted||!F(h,d,p,f)){for(c=h._zTime,h._zTime=d||(f?Ie:0),f=f||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&&!f&&q(h,"onUpdate"),y&&h._repeat&&!f&&h.parent&&q(h,"onRepeat"),(d>=h._tDur||d<0)&&h.ratio===v&&(v&&xt(h,1),f||(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)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,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]?pt(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);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=(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}),fr=function(e,t,r){return e[t](r)},pr=function(e,t,r,n){return e[t](n.fp,r)},mr=function(e,t){return ze(e[t])?fr: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:ke,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,It(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=pt(e||{}).get,a=r?B:C;return"native"===r&&(r=""),e&&(t?a((lt[t]&<[t].get||i)(e,t,r,n)):function(t,r,n){return a((lt[t]&<[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=pt(e),s=o.harness&&(o.harness.aliases||{})[t]||t,l=a?function(t){var n=new a;pe._pt=0,n.init(e,r?t+r:t,pe,0,[e]),n.render(1,n),pe._pt&&Yt(1,pe)}: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,ke.ease)),E(ke,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]||I(i,e,e._start-e._delay),e=t;return I(le,i,0),i},utils:{wrap:function e(t,r,n){var i=r-t;return We(t)?X(t,e(0,t.length),r):Ct(n,(function(e){return(i+(e-t)%i)%i+t}))},wrapYoyo:function e(t,r,n){var i=r-t,a=2*i;return We(t)?X(t,e(0,t.length-1),r):Ct(n,(function(e){return t+(i<(e=(a+(e-t)%a)%a||0)?a-e:e)}))},distribute:J,random:W,snap:Z,normalize:function(e,t,r){return Q(e,t,0,1,r)},getUnit:Bt,clamp:function(e,t,r){return Ct(r,(function(r){return V(e,t,r)}))},splitColor:Rt,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:Q,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||Bt(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(We(t)&&!We(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=_(We(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 Ct(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:pt,_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),pe=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",Z))||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},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,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()}},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,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 f(){}function p(){}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),p.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",f.prototype=p),l(p,"constructor",f),f.displayName=l(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){return!!(e="function"==typeof e&&e.constructor)&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,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){if(e){if("string"==typeof e)return o(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)?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(6569));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=e.arr,n=e.typeList,i=e.findType;if(e=e.mapType,!r||!n||!i)return r;var o=a(n),s=r.find((function(e){return e[i]===n[0]}));return s?1!==n.length&&s[e]instanceof Array?(o.shift(),(0,t.deepArrByMaps)({arr:s[e],typeList:o,findType:i,mapType:e})):s:r}},7267:(e,t)=>{"use strict";t.d=void 0,t.d=function(e,t){var r=null;return function(){null!==r&&clearTimeout(r),r=setTimeout((function(){e()}),t)}}},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))),a=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,a.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),a="";;)for(var o=e(i),s=i;s--;)if((a+=t[o[s]&n]||"").length===+r)return a}},2801:(e,t,r)=>{"use strict";e.exports=r(6104)},6330:(e,t,r)=>{"use strict";var n,i,a,o=r(3445),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}},9133:(e,t,r)=>{"use strict";var n,i,a=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+=a(7))+a(e),0<n&&(t+=a(n)),t+a(r)}},5239:(e,t,r)=>{"use strict";var n=r(6330),i=r(6339),a=r(4403);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}},6104:(e,t,r)=>{"use strict";var n=r(6330),i=r(9133),a=r(6932),o=r(517)||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},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},1819:(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){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 n.PerspectiveCamera}createOrthographic(){return new n.OrthographicCamera}setMode(e){if(e!==this.mode){this.runScene.helperEx.transContro.reset(),this.mode=e,this.runScene.assetsEx.reset(),this.reset(this.getCamera()),this.setSize();const 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);const t=this.runScene.assetsEx.get().controls;t.target.set(0,0,0),t.update()}get(){return this.runScene.assetsEx.get().camera}setSize(){var{width:e,height:t}=this.runScene.renderEx.getDomSize();const r=this.getCamera();r.aspect=e/t,r.updateProjectionMatrix()}}const a=e=>null==e?void 0:e.isCamera},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()}toArray(e){let t=[];for(const r of this.entries())"key"==e?t.push(r[0]):t.push(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){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)},2959:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});class n{constructor(e){this.runScene=e}}},7042:(e,t,r)=>{"use strict";r.d(t,{Z:()=>i});var n=r(6999);class i extends r(2959).Z{get(){throw new Error("Method not implemented.")}static toJSON(e){const{intensity:t,name:r,type:n,position:i,visible:a,color:o,castShadow:s,shadow:l,rotation:u,target:c}=e;var{mapSize:e,camera:h}=l,{scale:h,near:d,far:f}=h;return{type:n,intensity:t,name:r,visible:a,color:o.getHexString(),castShadow:s,shadow:{mapSize:e.x,camera:{near:d,far:f,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,t){return t=this.runScene.lightEx.get("DirectionalLight",Object.assign(Object.assign({},t),{addUndo:!1})),i.setConfig(t,e),t}static setConfig(e,t){var{intensity:t,name:r,visible:i,color:a,castShadow:o,shadow:s,type:l}=t,{mapSize:s,camera:u}=s,{scale:u,near:c,far:h}=u;e.intensity=t,e.type=l,e.name=r,e.visible=i,e.castShadow=o,e.color=new n.Z.Color("#"+a),e.add(e.target),e.shadow.mapSize.x=s,e.shadow.mapSize.y=s,e.shadow.camera.scale.x=u,e.shadow.camera.scale.y=u,e.shadow.camera.scale.z=u,e.shadow.camera.near=c,e.shadow.camera.far=h,e.shadow.camera.updateProjectionMatrix(),null!=(t=e.cameraHelper)&&t.update()}}},3352:(e,t,r)=>{"use strict";r.d(t,{ZP:()=>M,RQ:()=>C});var n=r(9728),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){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");var a=new i.BufferGeometry,o=(a.setAttribute("position",new i.Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),a.computeBoundingSphere(),new i.LineBasicMaterial({fog:!1}));return((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}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(6999);t=r(2959);class h extends t.Z{get(){}static toJSON(e){const{type:t,intensity:r,name:n,visible:i,color:a}=e;return{type:t,intensity:r,name:n,visible:i,color:a.getHexString()}}parseJSON(e){const t=this.runScene.lightEx.get("AmbientLight",{addUndo:!1});var{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}}var d=r(7042);class f extends t.Z{get(){throw new Error("Method not implemented.")}static toJSON(e){const{type:t,intensity:r,name:n,visible:i,color:a,groundColor:o,position:s}=e;return{name:n,type:t,intensity:r,visible:i,position:{x:s.x,y:s.y,z:s.z},groundColor:o.getHexString(),color:a.getHexString()}}parseJSON(e){const t=this.runScene.lightEx.get("HemisphereLight",{addUndo:!1});var{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 p extends t.Z{get(){throw new Error("Method not implemented.")}static toJSON(e){const{name:t,type:r,intensity:n,distance:i,decay:a,renderOrder:o,color:s,visible:l,castShadow:u,shadow:c,position:h}=e;var{mapSize:e,camera:d,bias:f,radius:p}=c,{scale:d,near:m,far:v}=d;return{name:t,type:r,intensity:n,visible:l,color:s.getHexString(),castShadow:u,distance:i,decay:a,renderOrder:o,shadow:{mapSize:e.x,camera:{near:m,far:v,scale:d.x},radius:p,bias:f},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:a,renderOrder:o,color:s,visible:l,castShadow:u,shadow:h,position:d}=e,{mapSize:h,camera:f,bias:p,radius:m}=h,{scale:f,near:v,far:g}=f;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=p,t.decay=a,t.shadow.radius=m,t.shadow.camera.scale.x=f,t.shadow.camera.scale.y=f,t.shadow.camera.scale.z=f,t.shadow.camera.near=v,t.shadow.camera.far=g,t.shadow.camera.updateProjectionMatrix(),t}}class m{constructor(e){this.runScene=e}static toJSON(e){const{type:t,intensity:r,name:n,visible:i,color:a,position:o}=e;return{name:n,type:t,intensity:r,visible:i,position:{x:o.x,y:o.y,z:o.z},color:a.getHexString()}}parseJSON(e){const t=this.runScene.lightEx.get("RectAreaLight",{addUndo:!1});var{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 v{constructor(e){this.runScene=e}static toJSON(e){const{name:t,type:r,color:n,distance:i,decay:a,intensity:o,angle:s,penumbra:l,visible:u,castShadow:c,shadow:h,renderOrder:d,position:f,target:p}=e;var{bias:e,camera:m,normalBias:v,mapSize:g,radius:y}=h,m=m.near;return{type:r,intensity:o,name:t,visible:u,distance:i,angle:s,decay:a,penumbra:l,renderOrder:d,color:n.getHexString(),castShadow:c,shadow:{bias:e,normalBias:v,mapSize:g.x,camera:{near:m},radius:y},position:{x:f.x,y:f.y,z:f.z},targetPosition:{x:p.position.x,y:p.position.y,z:p.position.z}}}parseJSON(e){const t=this.runScene.lightEx.get("SpotLight",{addUndo:!1});var{name:e,type:r,color:n,distance:i,decay:a,intensity:o,angle:s,penumbra:l,visible:u,castShadow:h,shadow:d,renderOrder:f,position:p,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=f,t.castShadow=h,t.color=new c.Z.Color("#"+n),t.position.set(p.x,p.y,p.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 g=r(6875),y=r(9593),b=r(5860),x=r(986),w=r(5613),A=r(811);const S={DirectionalLight:d.Z,PointLight:p,SpotLight:v,RectAreaLight:m,HemisphereLight:f,AmbientLight:h};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 d.Z(e),PointLight:new p(e),SpotLight:new v(e),RectAreaLight:new m(e),HemisphereLight:new f(e),AmbientLight:new h(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,w.mergeObject)({isClone:!1,id:(0,n.getId)(),addUndo:!0,addToScene:!0},t);let o=new c.Z[e];if(o.position.y=10,o.name=e,o.userData.id=r,this.shadowList.includes(e)&&(o.castShadow=!0),this.setLight(o),a){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 g.Z(Object.assign(Object.assign({},e),{runScene:this.runScene})).execute())),i&&this.runScene.undoEx.addUndo(r),null!=(e=null==o?void 0:o.lightHelper)&&e.update()}else this.runScene.modelEx.add(o,void 0,{addUndo:i});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 x.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 x.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 u(t,16773120);break;case"DirectionalLight":if(n=new c.Z.DirectionalLightHelper(t,1,16711680),t.children[0])t.target=t.children[0];else{let e=new c.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 c.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 c.Z.PointLightHelper(t,1,16711935);break;case"SpotLight":n=new c.Z.SpotLightHelper(t);let 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);const o=new c.Z.CameraHelper(t.shadow.camera);t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(o,!0,(e=>{e.userData.id=r})),o.userData.id=r,t.cameraHelper=o,i.push({model:o,parent:this.runScene.sceneEx.get(),addTree:!1});break;case"HemisphereLight":n=new c.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 b.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 a=new y.Z({target:e,typeList:n,newVal:i,cb:t});return r?a.execute():a})),n&&this.runScene.undoEx.addUndo(i),i;{var{model:i,typeList:e,newVal:a}=e;const o=new y.Z({target:i,typeList:e,newVal:a,cb:t});return n&&this.runScene.undoEx.addUndo(o),r?o.execute():o}}isLight(e){return null==(e=null==e?void 0: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.filter((e=>!(0,A.isHelper)(e))).map((e=>{var t=e.type;return S[t].toJSON(e)}))}}const C=e=>null==(e=null==e?void 0:e.userData)?void 0:e.isLight},8239:(e,t,r)=>{"use strict";r.r(t),r.d(t,{SpecialMaterial:()=>se,createDefMaterial:()=>W,defAllMaterialMap:()=>K,defBaseMaterialMap:()=>J,default:()=>Z,disposeMaterial:()=>Q,getBaseTextures:()=>$,getMaterialType:()=>le,getTextures:()=>q,getTexturesByMaterial:()=>Y,initMaterial:()=>te,isBaseMaterial:()=>oe,isColor:()=>re,isMaterial:()=>ie,materialIgnore:()=>ue,mergeMaterial:()=>X,setDefMaterialForSameGeo:()=>ae,setMaterialTexture:()=>ee,updateMaterial:()=>ne});var n=r(2081),i=r(9728),a=r(8881),o=r(1643);const s="\n#define STANDARD\nuniform int uvCount;\n ",l="\nattribute vec2 uv2;\nvarying vec2 vUv2;\nuniform mat3 uv2Transform;\n ",u="\nvUv2 = (uv2Transform * vec3(uv2, 1)).xy;\n ",c="\nvarying vec2 vUv2;\n ",h="\n#ifdef USE_MAP\n vec4 sampledDiffuseColor = vec4(0.0);\n if(uvCount > 1) sampledDiffuseColor = texture2D(map, vUv2);\n else sampledDiffuseColor = texture2D(map, vUv);\n \n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n #endif\n diffuseColor *= sampledDiffuseColor;\n#endif\n ",d="\n#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = vec4(0.0);\n if(uvCount > 1) emissiveColor = texture2D(emissiveMap, vUv2);\n else emissiveColor = texture2D(emissiveMap, vUv);\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif\n ";class f{static create(){this.uvCount=new a.Uniform(1);const e=new a.MeshStandardMaterial;return e.onBeforeCompile=e=>{e.uniforms.uvCount=this.uvCount,e.vertexShader=e.vertexShader.replace(/#include <uv2_pars_vertex>/g,l),e.vertexShader=e.vertexShader.replace(/#include <uv2_vertex>/g,u),e.fragmentShader=e.fragmentShader.replace(/#define STANDARD/g,s),e.fragmentShader=e.fragmentShader.replace(/#include <uv2_pars_fragment>/g,c),e.fragmentShader=e.fragmentShader.replace(/#include <map_fragment>/g,h),e.fragmentShader=e.fragmentShader.replace(/#include <emissivemap_fragment>/g,d)},e}static isDefVal(e){for(const t in this.defVal){const r=this.defVal[t],n=e[t];if(r instanceof a.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 o.zX)if(e[t])return!1;return!0}}f.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 p=r(5105),m=r(2266),v=r(9593);class g{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 a.ShaderMaterial({uniforms:(0,m.d9)(y.uniforms),vertexShader:y.vertexShader,fragmentShader:y.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=>!g.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=>{const t=W(),r=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:this.tools.type,uniforms:{},name:e.name},textures:this.tools.getTextures(e)}),{}),n=e.uniforms,i=y.uniforms;return Object.keys(n).filter((e=>!g.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(){const e=new a.ShaderMaterial({uniforms:(0,m.d9)(y.uniforms),vertexShader:y.vertexShader,fragmentShader:y.fragmentShader});return e.userData.tools=this.tools,e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new v.Z({target:e,typeList:["uniforms",...t],newVal:r}).execute())}}g.TextureNames=["sideWallTex","backWallTex","floorTex","ceilingTex"];const y={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 b{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=X(n,new x(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=>!b.TextureNames.includes(e))).map((e=>{i[e]=r.uniforms[e]})),i.insertFresnelShader(),i.userData.tools=this.tools,i},toNormal:e=>{const t=X(e,W()),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=w.uniforms;return Object.keys(n).filter((e=>!b.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){const t=new x(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 v.Z({target:e,typeList:[...t],newVal:r}).execute())}}b.TextureNames=["envMap","displacementMap"];class x extends a.MeshPhysicalMaterial{constructor(e,t,r){if(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(w.uniforms.fresnelBias.value),this.fresnelScale=new a.Uniform(w.uniforms.fresnelScale.value),this.fresnelPower=new a.Uniform(w.uniforms.fresnelPower.value)),this.clock=new a.Clock,this.isSurge=new a.Uniform(!1),this.deltaTime=new a.Uniform(0),!this.cubeCamera){const e=new a.WebGLCubeRenderTarget(2048);e.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,w.vertexParas),e.vertexShader=e.vertexShader.replace(/#include <begin_vertex>/g,w.vertexShader1),e.vertexShader=e.vertexShader.replace(/vWorldPosition = worldPosition.xyz;/g,w.vertexShader2),e.fragmentShader=e.fragmentShader.replace(/#include <transmission_pars_fragment>/g,w.fragmentParas),e.fragmentShader=e.fragmentShader.replace(/vec3 totalEmissiveRadiance = emissive;/g,w.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 w={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 "};class A{constructor(e){this.tools={type:"Matcap",getTextures(e){const t=[];return A.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},toNormal:e=>{var t=this.tools.getTextures(e);const r=X(e,W()),n=(r.userData=Object.assign(Object.assign({},r.userData),{normal:{type:this.tools.type,uniforms:{},name:e.name},textures:t}),r.name=e.name,{}),i=new a.MeshMatcapMaterial;return Object.keys(e).filter((e=>!A.TextureNames.includes(e))).filter((e=>!A.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=X(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=>!A.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=>!A.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r}},this.runScene=e}create(e){const 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 v.Z({target:t,typeList:[...r],newVal:n,cb:()=>{t.needsUpdate=!0}}).execute())}}A.IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],A.TextureNames=["alphaMap","bumpMap","displacementMap","map","normalMap","matcap"];const S="\nvec3 mod289(vec3 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec2 mod289(vec2 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\n\nvec3 permute(vec3 x) {\n return mod289(((x*34.0)+1.0)*x);\n}\n\nfloat noise2D(vec2 v) {\n const vec4 C = vec4(0.211324865405187, // (3.0-sqrt(3.0))/6.0\n 0.366025403784439, // 0.5*(sqrt(3.0)-1.0)\n -0.577350269189626, // -1.0 + 2.0 * C.x\n 0.024390243902439); // 1.0 / 41.0\n// First corner\nvec2 i = floor(v + dot(v, C.yy) );\nvec2 x0 = v - i + dot(i, C.xx);\n\n// Other corners\nvec2 i1;\n//i1.x = step( x0.y, x0.x ); // x0.x > x0.y ? 1.0 : 0.0\n//i1.y = 1.0 - i1.x;\ni1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n// x0 = x0 - 0.0 + 0.0 * C.xx ;\n// x1 = x0 - i1 + 1.0 * C.xx ;\n// x2 = x0 - 1.0 + 2.0 * C.xx ;\nvec4 x12 = x0.xyxy + C.xxzz;\nx12.xy -= i1;\n\n// Permutations\ni = mod289(i); // Avoid truncation effects in permutation\nvec3 p = permute( permute( i.y + vec3(0.0, i1.y, 1.0 )) + i.x + vec3(0.0, i1.x, 1.0 ));\n\nvec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0);\nm = m*m ;\nm = m*m ;\n\n// Gradients: 41 points uniformly over a line, mapped onto a diamond.\n// The ring size 17*17 = 289 is close to a multiple of 41 (41*7 = 287)\n\nvec3 x = 2.0 * fract(p * C.www) - 1.0;\nvec3 h = abs(x) - 0.5;\nvec3 ox = floor(x + 0.5);\nvec3 a0 = x - ox;\n\n// Normalise gradients implicitly by scaling m\n// Approximation of: m *= inversesqrt( a0*a0 + h*h );\nm *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h );\n\n// Compute final noise value at P\nvec3 g;\ng.x = a0.x * x0.x + h.x * x0.y;\ng.yz = a0.yz * x12.xz + h.yz * x12.yw;\nreturn 130.0 * dot(m, g);\n}\n ",M="\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 noise3D(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 ",C={defines:{USE_UV:!0,USE_MAP:!0},uniforms:{mapArray:{value:[null,null,null,null,null,null,null,null]},maskArray:{value:[null,null,null,null,null,null,null]},mapUvTransArray:{value:[new a.Matrix3,new a.Matrix3,new a.Matrix3,new a.Matrix3,new a.Matrix3,new a.Matrix3,new a.Matrix3,new a.Matrix3]},maskUvTransArray:{value:[new a.Matrix3,new a.Matrix3,new a.Matrix3,new a.Matrix3,new a.Matrix3,new a.Matrix3,new a.Matrix3]},opacity:{value:1},diffuse:{value:new a.Color(16777215)},uvTransform:{value:new a.Matrix3},shadowShade:{value:.6}},vertexShader:"\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_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\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 <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <envmap_vertex>\n #include <fog_vertex>\n // vUv = (uvTransform * vec3(uv, 1.0)).xy;\n}\n ",fragmentShader:"\nuniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\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 <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\n#define MAX_TEX 8\nuniform mat3 mapUvTransArray[MAX_TEX];\nuniform mat3 maskUvTransArray[MAX_TEX - 1];\nuniform sampler2D mapArray[MAX_TEX];\nuniform sampler2D maskArray[MAX_TEX - 1];\nuniform float shadowShade;\n\n// Insert Noise2D\nfloat sum(vec3 v) {return v.x + v.y + v.z;}\nvec3 textureNoTile(sampler2D tex, vec2 tUv, float offsetScale) {\n // cheap (cache friendly) lookup\n float k = noise2D(0.25 * tUv);\n\n float l = k * 8.0;\n float f = fract(l);\n float ia = floor(l);\n float ib = ia + 1.0;\n\n // can replace with any other hash\n vec2 offa = sin(vec2(3.0, 7.0) * ia);\n vec2 offb = sin(vec2(3.0, 7.0) * ib);\n\n vec2 duvdx = dFdx(tUv);\n vec2 duvdy = dFdy(tUv);\n vec3 cola = textureGrad(tex, tUv + offsetScale * offa, duvdx, duvdy).xyz;\n vec3 colb = textureGrad(tex, tUv + offsetScale * offb, duvdx, duvdy).xyz;\n\n return mix(cola, colb, smoothstep(0.2, 0.8, f - 0.1 * sum(cola-colb)));\n}\nvec4 texSampler(sampler2D tex, vec2 tUv, float offsetScale) {\n return vec4(textureNoTile(tex, tUv, offsetScale), 1.0);\n}\n\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(diffuse, opacity);\n #include <logdepthbuf_fragment>\n\n // Custom UV Start\n vec2 vCustomMapUv[MAX_TEX];\n for (int i = 0; i < MAX_TEX; i++) {\n vCustomMapUv[i] = (mapUvTransArray[i] * vec3(vUv, 1.0)).xy;\n }\n vec2 vCustomMaskUv[MAX_TEX - 1];\n for (int i = 0; i < MAX_TEX - 1; i++) {\n vCustomMaskUv[i] = (maskUvTransArray[i] * vec3(vUv, 1.0)).xy;\n }\n // Custom UV End\n // Custom Texture Start\n float offsetScale = 1.2;\n vec4 maskColor = vec4(1.0);\n vec4 textureColor = vec4(1.0);\n #if MAX_TEX > 0\n textureColor = texSampler(mapArray[0], vCustomMapUv[0], offsetScale);\n #endif\n #if MAX_TEX > 1\n maskColor = texture2D(maskArray[0], vCustomMaskUv[0]);\n textureColor = mix(textureColor, texSampler(mapArray[1], vCustomMapUv[1], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 2\n maskColor = texture2D(maskArray[1], vCustomMaskUv[1]);\n textureColor = mix(textureColor, texSampler(mapArray[2], vCustomMapUv[2], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 3\n maskColor = texture2D(maskArray[2], vCustomMaskUv[2]);\n textureColor = mix(textureColor, texSampler(mapArray[3], vCustomMapUv[3], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 4\n maskColor = texture2D(maskArray[3], vCustomMaskUv[3]);\n textureColor = mix(textureColor, texSampler(mapArray[4], vCustomMapUv[4], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 5\n maskColor = texture2D(maskArray[4], vCustomMaskUv[4]);\n textureColor = mix(textureColor, texSampler(mapArray[5], vCustomMapUv[5], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 6\n maskColor = texture2D(maskArray[5], vCustomMaskUv[5]);\n textureColor = mix(textureColor, texSampler(mapArray[6], vCustomMapUv[6], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 7\n maskColor = texture2D(maskArray[6], vCustomMaskUv[6]);\n textureColor = mix(textureColor, texSampler(mapArray[7], vCustomMapUv[7], offsetScale), maskColor.r);\n #endif\n diffuseColor *= textureColor;\n // Custom Texture End\n\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D(lightMap, vUv2);\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3(1.0);\n #endif\n #include <aomap_fragment>\n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include <envmap_fragment>\n #include <output_fragment>\n gl_FragColor.rgb *= vec3(getShadowMask() * (1.0 - shadowShade) + shadowShade);\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}\n "};class B{constructor(e){this.tools={type:"MixTexture",getTextures(e){const t=[];return B.TextureNames.forEach((r=>{var n=parseInt(r.slice(-1));r.startsWith("terrainMap")?e.uniforms.mapArray.value[n]&&t.push({type:r,texture:e.uniforms.mapArray.value[n]}):r.startsWith("terrainMask")&&e.uniforms.maskArray.value[n]&&t.push({type:r,texture:e.uniforms.maskArray.value[n]})})),t},toNormal:e=>{const t=W(),r=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:this.tools.type,uniforms:{},name:e.name},textures:this.tools.getTextures(e)}),{}),n=e.uniforms,i=C.uniforms;return Object.keys(n).filter((e=>"mapArray"!==e&&"maskArray"!==e&&"mapUvTransArray"!==e&&"maskUvTransArray"!==e)).map((e=>{const t=n[e].value,a=i[e].value;"diffuse"===e?t.getHexString()!==a.getHexString()&&(r[e]=t.getHexString()):"uvTransform"===e?t.equals(a)||(r[e]=t):t!==a&&(r[e]=t)})),t.userData.normal.uniforms=r,t},parseData:e=>{const{textures:t,normal:r}=e,n=new a.ShaderMaterial({uniforms:a.UniformsUtils.merge([a.UniformsLib.lights,C.uniforms]),vertexShader:C.vertexShader,fragmentShader:C.fragmentShader,defines:C.defines,lights:!0});return n.name=r.name,this.insertShader(n),t.forEach((e=>{var t=parseInt(e.type.slice(-1));e.type.startsWith("terrainMap")?(n.uniforms.mapArray.value[t]=e.texture,this.onTexRepeatChange(n,t,!0)):e.type.startsWith("terrainMask")&&(n.uniforms.maskArray.value[t]=e.texture,this.onTexRepeatChange(n,t,!1))})),Object.keys(r.uniforms).filter((e=>!B.TextureNames.includes(e))).map((e=>{var t=r.uniforms[e];"diffuse"===e?n.uniforms[e].value=new a.Color(parseInt(t,16)):"uvTransform"!==e&&(n.uniforms[e].value=t)})),n.userData.tools=this.tools,n},clone:function(e,t){return e}},this.runScene=e}create(){const e=new a.ShaderMaterial({uniforms:a.UniformsUtils.merge([a.UniformsLib.lights,C.uniforms]),vertexShader:C.vertexShader,fragmentShader:C.fragmentShader,defines:C.defines,lights:!0});return this.insertShader(e),e.userData.tools=this.tools,e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new v.Z({target:e,typeList:["uniforms",...t],newVal:r}).execute())}insertShader(e){e&&(e.onBeforeCompile=e=>{e.fragmentShader=e.fragmentShader.replace(/\/\/ Insert Noise2D/g,S)})}onTexRepeatChange(e,t,r){e&&0<=t&&(r?(r=e.uniforms.mapArray.value[t],e.uniforms.mapUvTransArray.value[t].identity(),e.uniforms.mapUvTransArray.value[t].scale(r.repeat.x,r.repeat.y)):(r=e.uniforms.maskArray.value[t],e.uniforms.maskUvTransArray.value[t].identity(),e.uniforms.maskUvTransArray.value[t].scale(r.repeat.x,r.repeat.y)))}}B.TextureNames=["terrainMap0","terrainMap1","terrainMap2","terrainMap3","terrainMap4","terrainMap5","terrainMap6","terrainMap7","terrainMask0","terrainMask1","terrainMask2","terrainMask3","terrainMask4","terrainMask5","terrainMask6"];class _{constructor(e){this.tools={type:"Physical",getTextures(e){const t=[];return _.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},parseData:e=>{const{normal:t,textures:r,material:n}=e,i=X(n,new a.MeshPhysicalMaterial);return i.name=t.name,r.forEach((e=>{i[e.type]=e.texture})),Object.keys(t.uniforms).filter((e=>!_.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=X(e,W()),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=>!_.TextureNames.includes(e))).filter((e=>!_.IgnoredAttributes.includes(e))).filter((e=>void 0===t[e])).map((t=>{const 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){const 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 v.Z({target:e,typeList:[...t],newVal:r}).execute())}}_.IgnoredAttributes=["_listeners","version","userData"],_.TextureNames=["alphaMap","aoMap","bumpMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap","clearcoatMap","clearcoatNormalMap","clearcoatRoughnessMap","sheenRoughnessMap","sheenColorMap","specularIntensityMap","specularColorMap","thicknessMap","transmissionMap"];var E=r(8493);const T={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}"},D={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 P{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=>Y(e),parseData:e=>{const{textures:t,normal:r,models:n,material:i}=e,o=X(i,new O(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=>!P.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=>{const t=X(e,W()),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=k.uniforms;return Object.keys(n).filter((e=>!P.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){const t=e.material;var r=(0,i.getId)();t.userData.id=r,this.materials[r]=e}create(e){const t=new O(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 v.Z({target:e,typeList:[...t],newVal:r}).execute())}dispose(){this.materials={}}}P.TextureNames=["map","normalMap","roughnessMap","metalnessMap","tDiffuse","tDiffuseBlur"];class O extends a.MeshStandardMaterial{constructor(e,t,r){e?super(e):(super(),this.opacity=k.uniforms.opacity.value,this.transparent=k.uniforms.transparent.value,this.roughness=k.uniforms.roughness.value,this.metalness=k.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=k.uniforms.resolution.value,this.blurSize=k.uniforms.blurSize.value,this.mirror=new a.Uniform(k.uniforms.mirror.value),this.mixBlur=new a.Uniform(k.uniforms.mixBlur.value),this.mixStrength=new a.Uniform(k.uniforms.mixStrength.value),this.mixContrast=new a.Uniform(k.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 E.T(T),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 E.T(D),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=k.vertexParas+""+e.vertexShader,e.vertexShader=e.vertexShader.replace("#include <project_vertex>",k.vertexShader),e.fragmentShader=k.fragmentParas+""+e.fragmentShader,e.fragmentShader=e.fragmentShader.replace("#include <emissivemap_fragment>",k.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 k={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 "},R="\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 = noise3D((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 ",I="\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 ";class L{constructor(e){this.tools={type:"TreeLeaf",getTextures(e){const t=[];return L.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},toNormal:e=>{var t=this.tools.getTextures(e);const r=X(e,W()),n=(r.userData=Object.assign(Object.assign({},r.userData),{normal:{type:this.tools.type,uniforms:{},name:e.name},textures:t}),r.name=e.name,{}),i=new U(this.runScene);return Object.keys(e).filter((e=>!L.TextureNames.includes(e))).filter((e=>!L.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=>{const 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=X(n,new U(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=>!L.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,o},clone:(e,t)=>e},this.runScene=e}create(e){const t=new U(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 v.Z({target:t,typeList:[...r],newVal:n,cb:()=>{t.needsUpdate=!0}}).execute())}}L.IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines","onBeforeCompile"],L.TextureNames=["alphaMap","aoMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap"];const F=new a.Clock;class U 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=R,e.fragmentShader=I,e.vertexShader=e.vertexShader.replace(/\/\/ Insert Noise3D/g,M)}}update(){this.uniforms.time.value=F.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 G=r(1736),j=r(6214),N=r(5860),H=r(5410),z=r(1994),V=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 J={depthTest:!0,depthWrite:!0,alphaTest:0,side:0,displacementScale:1,visible:!0,normalScale:{x:1,y:1},aoMapIntensity:1,lightMapIntensity:1,envMapIntensity:1},K=["color","emissive","roughness","metalness","normalScale","aoMapIntensity","displacementScale","transparent","lightMapIntensity","envMapIntensity","opacity","alphaTest"];class Z{constructor(e){this.defMaterialMap={BaseMaterial:f,SpriteMaterial:p.Z,FakeInterior:g,Fresnel:b,Matcap:A,MixTexture:B,Physical:_,Reflector:P,TreeLeaf:L},this.defMaterial=W(),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:f,SpriteMaterial:p.Z,FakeInterior:new g(e),Fresnel:new b(e),Matcap:new A(e),MixTexture:new B(e),Physical:new _(e),Reflector:new P(e),TreeLeaf:new L(e)},this.addSetParses((e=>{const{material:t,type:r,newVal:n}=e;"opacity"===r&&n<1&&(t.transparent=!0)}))}add(e,t,r){ue.is(e)||this.runScene.uniqueEx.material.add(e,t,r)}create(){var e=new a.MeshStandardMaterial;return this.add(e),e}toArray(){return(0,n.js)(this.runScene.uniqueEx.material.map,((e,t)=>t.material))}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){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 j.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 j.Z(Object.assign(Object.assign({},e),{runScene:this.runScene})).execute(),t&&this.runScene.undoEx.addUndo(e),e}setTextures(e,t=!0){return V(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,G.setTextureMapping)(e.newVal);var o=i.map((t=>new j.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 V(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,G.setTextureMapping)(e.newVal),new j.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,H.Gm)({addUndo:!0,includeChild:!1},r);if(e&&t){const r=new Set;((0,H.lG)(e,"array")?e:[e]).map((e=>{i?e.traverse((e=>{oe(e.material)&&r.add(e)})):e.material&&r.add(e)}));const a=[];r.forEach((e=>{a.push(new N.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){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)(J,((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,a,o,s;void 0!==J[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&&f.isDefVal(e)}}const W=e=>{const t=new a.MeshStandardMaterial(e);return t.userData.id=(0,i.getId)(),t},X=(e,t)=>(K.map((r=>{const n=e[r];"object"==typeof n&&(t[r]=n.clone()),t[r]=n})),t),Q=e=>{e.dispose();const t=Y(e);0!==t.length&&t.map((e=>{e=e.texture,(0,G.disposeTexture)(e)}))},Y=e=>{var t=e.userData.textures||$(e);return delete e.userData.textures,t},q=e=>{var t;return(null==(t=null==(t=e.userData)?void 0:t.tools)?void 0:t.getTextures(e))||$(e)},$=e=>o.zX.map((t=>({type:t,texture:e[t]}))).filter((e=>e.texture)),ee=e=>{const{material:t,type:r,texture:n}=e;"envMap"===r&&(0,G.setTextureMapping)(n),t[r]=n,t.needsUpdate=!0},te=e=>{e.vertexColors=!1,e.depthWrite=!0,e.needsUpdate=!1},re=e=>null==e?void 0:e.isColor,ne=e=>{e.needsUpdate=!0},ie=e=>null==e?void 0:e.isMaterial,ae=e=>{},oe=e=>null==e?void 0:e.isMeshStandardMaterial,se={Sprite:p.Z},le=e=>{var t;return(null==(t=null==e?void 0:e.userData.tools)?void 0:t.type)||(null==e?void 0:e.type)},ue={set(e,t){t?(0,z.M)(e,"ignore",!0):delete e.userData.ignore},is:e=>!0===(0,z.is)(e,"ignore")}},5105:(e,t,r)=>{"use strict";r.d(t,{Z:()=>s});var n=r(8881),i=r(8239),a=r(811),o=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,o.M)(e,"name",e.name),(0,a.setLayers)(t,1===e.layers.mask?0:1)},toNormal:(e,t)=>{const r=(0,a.createDefModel)("Box");return r.userData.normal={type:"MySpriteMaterial"},r.material=e.material,s.modelTools.merge(e,r),r},parseData:(e,t)=>{const r=(0,a.createDefModel)("Sprite");var 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=>{const{textures:t,material:r}=e,n=(0,i.mergeMaterial)(r,s.create());var{depthWrite:e,depthTest:a,name:o}=r.userData.normal;return void 0!==e&&(n.depthWrite=e),void 0!==a&&(n.depthTest=a),o&&(n.name=o),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:()=>a,t9:()=>i,zf:()=>o});var n=r(1994);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){if(!e||"Scene"===e.type)return!1;var r=e.userData.lock;return t?!!r||o.isLock(e.parent,t):void 0!==r&&r}}},811:(e,t,r)=>{"use strict";r.r(t),r.d(t,{createDefModel:()=>T,createSpecialModel:()=>E,default:()=>_,delClonedModel:()=>z,deletedModel:()=>B.Ju,disposeModel:()=>D,dynamicModel:()=>B.t9,getClonedIdModel:()=>N,getDeepModels:()=>F,getModelSize:()=>Z,hasSkeleton:()=>U,instanceModel:()=>P,isDynamicModel:()=>j,isGLowModel:()=>V,isGroup:()=>K,isHelper:()=>I,isSprite:()=>J,lockModel:()=>B.zf,mergeModel:()=>O,normalModel:()=>X,selectableModel:()=>W,setClonedModel:()=>H,setDynamicModel:()=>G,setHelper:()=>R,setLayers:()=>L,withAnima:()=>k}),t=r(4356);var n=r.n(t),i=r(9716),a=r(2081),o=r(8881),s=r(8409),l=r(1819);const u=["Group","Box","Circle","Cylinder","Dodecahedron","Icosahedron","Lathe","Octahedron","Plane","Ring","Sphere","Sprite","Tetrahedron","Torus","TorusKnot","Tube","Reflector"];var c=r(5259),h=r(2016),d=r(6999),f=r(3352),p=r(5105),m=r(8239),v=r(1994),g=r(6875),y=r(9593),b=r(5860);class x 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 w=x;var A=r(986),S=r(1682),M=r(5244),C=r(5613);var B=r(7263);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,C.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=U(t),s=(e=>{const t={};return(0,C.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",N(l)||l.userData.id),(0,v.is)(t,"isDynamic")&&G(o,!0),(0,C.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)=>{const n=t[e];n&&(n.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,C.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,C.sameArr)([...e.array],[...t.array],20),t=(0,C.sameArr)([...r.array],[...i.array],20),r=(0,C.sameArr)([...n.array],[...a.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,C.validType)(e,"array"))return e.map((e=>this.setGeometryMap(e)));var t=N(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=N(t)||(0,M.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:a,parent:o}=t;this.remove(t,!1);const s=this.runScene.modelEx.clone(e);s.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;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,M.K)(e)],"detail");var{isDomTreeActive:t,isClone:r}=t||{};if(this.runScene.events.key.ctrl&&!r)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&&!k(e)}create(){return n().model.getModelByType("Box")}getById(e){return Array.isArray(e)?e.map((e=>this.runScene.uniqueEx.model.get(e))):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,C.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(T(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,i=[];i.push(new g.Z({model:n,runScene:this.runScene,parent:r||this.runScene.assetsEx.get().scene}).execute()),e instanceof Array?i.push(...e.map((e=>new w({target:e,oldParent:e.parent,newParent:n,runScene:this.runScene}).execute()))):i.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(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 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,i=this.runScene.sceneEx.getClearModels(),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)}))}));var o=a.map((e=>new b.Z({target:e,info:"visible",newVal:!1,runScene:this.runScene,oldVal:e.visible}).execute()));this.runScene.undoEx.addUndo(o),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 b.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 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){let i=new o.Raycaster,a=new o.Vector2,s=(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),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: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,C.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(),a=new o.Vector3,s=new o.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 o.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 o.Vector3;u.subVectors(r.position,s),u.projectOnPlane(new o.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,a.addVectors(s,u.multiplyScalar(l))}else{t.updateMatrixWorld(!0),l=new o.Vector3,e.getWorldPosition(l),s.set(l.x,l.y,l.z);let n=new o.Vector3;n.subVectors(r.position,s),n.projectOnPlane(new o.Vector3(0,1,0)),n.normalize(),a.addVectors(s,n.multiplyScalar(3))}(0,C.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={},r=Array.isArray(e)?e:[e],n=[];r.map((e=>{e.traverse((e=>{var r;e.geometry&&!j(e)&&(r=N(e))&&(n.push(e),t[r]||(t[r]=new Set),t[r].add(e))}))})),(0,a.js)(t,((e,t)=>{e=this.runScene.uniqueEx.model.get(e),t.size<2||!e||(t=P(e,[...t]),this.runScene.modelEx.add(t,void 0,{isClone:!1,select:!1,addUndo:!1}),V(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,C.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 o.Raycaster,l=new o.Vector2;var{engineDom:a,camera:s}=this.runScene.assetsEx.get();l.x=r.offsetX/a.clientWidth*2-1,l.y=-r.offsetY/a.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 E=e=>{},T=e=>{if(u.includes(e)){const t=n().model.getModelByType(e);return"Sprite"===t.type&&(t.material.userData.tools=p.Z.tools),t}throw TypeError("")},D=(e,t)=>{t=(t||{}).remove;const{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)},P=(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},O=(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)},k=e=>0!==e.animations.length,R=e=>{e&&e.userData&&(e.userData.isHelper=!0)},I=e=>null==(e=null==e?void 0:e.userData)?void 0:e.isHelper,L=(e,t)=>{null!=t&&(0===t?e.layers.set(0):e.layers.enable(1),(0,v.M)(e,"layers",t))},F=e=>{const t=[];e.traverse((e=>{t.push(e)}))},U=e=>{let t=!1;if(e)return e.traverse((e=>{e.isSkinnedMesh&&(t=!0)})),t},G=(e,t)=>{t?(0,v.M)(e,"isDynamic",!0):delete e.userData.isDynamic},j=(e,t)=>e&&t?!!e.userData.isDynamic||!!e.parent&&j(e.parent,t):null==(t=null==e?void 0:e.userData)?void 0:t.isDynamic,N=e=>e.userData.cloneId,H=(e,t)=>{(0,v.M)(e,"cloneId",t)},z=e=>{delete e.userData.cloneId},V=e=>1===e.userData.layers,J=e=>e.isSprite,K=e=>{},Z=e=>{var t=new o.Vector3;return(new o.Box3).setFromObject(e).getSize(t),t},W={open(e){delete e.userData.unSelectable},close(e){e.userData.unSelectable=!0},is:e=>void 0===e.userData.unSelectable},X={set(e,t){t?delete e.userData.unNormal:e.userData.unNormal=!0},is:e=>!(0,f.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)}},8266:(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){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 a=(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:()=>p,bv:()=>y,is:()=>g});var n=r(4547),i=r(9716),a=r(8881),o=r(8239),s=r(811),l=r(8266),u=r(1736),c=r(9593),h=r(5860),d=r(986),f=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 p{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){if(e){if(e instanceof Array){const t=[];return e.map((e=>{for(const r in this.removeMap){const{valid:n,remove:a}=this.removeMap[r];if(n(e))return t.push(...(0,i.multiArrToArr)(a(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),this.runScene.helperEx.unfocus()}}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 a.Group;return e.children.filter((e=>!this.runScene.helperEx.isHelper(e)&&!this.runScene.lightEx.isLight(e)&&s.normalModel.is(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 f(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.objects.reset(),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.pp.dispose(),this.runScene.pp.init(),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.pp.dispose(),a.Cache.clear()}render(){}create(){return new a.Scene}setEnv(e){return f(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());const a=this.runScene.assetsEx.get().renderer.domElement,{renderer:o,scene:s,camera:l}=(a.width=e,a.height=t,this.runScene.renderEx.setSize(e,t),this.runScene.assetsEx.get());return o.render(s,l),e=a.toDataURL("image/png",1),t=(0,n.base64ToFile)(e,"screenShot.png"),a.width=r,a.height=i,this.runScene.renderEx.setSize(),o.render(s,l),t}static toJSON(e){const 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=>{const{color:t,far:r,near:n}=e;return{color:t.getHexString(),far:r,near:n}},g=(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:()=>v,disposeTexture:()=>x,getBlobByTexture:()=>A,getCloneIdFromTexture:()=>P,getMimeByTexture:()=>y,getSizeByTexture:()=>E,getTextureGpuMemory:()=>b,getTextureMinFilter:()=>I,getUrlByTexture:()=>B,initTexture:()=>S,isClonedTexture:()=>D,isTexture:()=>T,loadTexture:()=>C,parseImageBitMapByBlob:()=>M,setTextureCloneId:()=>O,setTextureMapping:()=>_,setTextureMinFilter:()=>R,textureNameMap:()=>g,updateTexture:()=>k});var n=r(2081),i=r(9728),a=r(8881),o=r(6999),s=r(6214),l=r(5613),u=r(5244),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 f=r(8239),p=r(1994),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=>{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,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 C(r,t),r)}))}clone(e){const 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,p.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,f.updateMaterial)(r)}}).execute())})),(0,f.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;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=o.Z.RepeatWrapping,e.wrapT=o.Z.RepeatWrapping,e.encoding=3e3,e.version=3,e.flipY=!1,"nearest"!==I(e)&&(e.minFilter=o.Z.LinearMipmapLinearFilter),e.needsUpdate=!0,e),M=(e,t)=>{let r={resizeQuality:"pixelated"};return null!=t&&t.flipY&&(r.imageOrientation="flipY"),createImageBitmap(e,r)},C=(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)})),B=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},k=e=>{e.needsUpdate=!0},R=(e,t)=>{e.minFilter=o.Z["linear"===t?"LinearMipmapLinearFilter":"NearestFilter"],(0,p.M)(e,"minFilter",t),k(e)},I=e=>(0,p.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: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){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:a}=e;r.add(t),n&&a.uniqueEx.model.add(t),n&&a.cb.model.add.cb({model:t,parent:r,isClone:i}),this.cb(t,"add"),a.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:()=>a});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: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},9593:(e,t,r)=>{"use strict";r.d(t,{Z:()=>o});var n=r(9716),i=r(2081);class a 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 o=a},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: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},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},5244:(e,t,r)=>{"use strict";r.d(t,{Z:()=>h,K:()=>d});var n=r(2081),i=r(9728),a=r(8239);class o{constructor(e){this.map={},this.removes=[],this.unique=e}add(e,t,r){if(null!=e&&e.userData&&!a.materialIgnore.is(e)){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 s=r(6001),l=r(7391);class u 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?-1:(e=e.slice(t+1),s.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 a=i.name;if(a=a||i.type,!this.nameMap[a])return o=this.unique.getId(i),(s=r(o))&&delete this.nameMap[s],void(this.nameMap[a]=o);var o,s=this.nameMap[a];return this.unique.model.get(s)!==i?(o=e(a),o=t(a,s=-1===o?0:o),this.nameMap[o]=this.unique.getId(i),i.name=o):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 a=e.userData.id;if(a&&!r||(a=(0,i.getId)(),e.userData.id=a),this.map[a]){if(!(n||(0,l.An)(this.unique.runScene)&&(0,l.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=>{const r=t.toLowerCase();return r===(t=e.toLowerCase())||-1!==r.indexOf(t)}));return t=this.getIdByNames(t),this.getModelsWithIds(t)}}class c{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 h{constructor(e){this.runScene=e,this.model=new u(this),this.material=new o(this),this.texture=new c(this)}getId(e){return e.userData.id}dispose(){this.material.dispose(),this.model.dispose(),this.texture.dispose()}}const d=e=>(null==(e=null==e?void 0:e.userData)?void 0:e.id)||""},5613:(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,getBetweenDomByIdx:()=>l,getCamAnimaData:()=>a.Gm,getClock:()=>a.aM,getCurve:()=>a.kG,getDistance:()=>a.Sp,getEmptyImageData:()=>n.mH,getFilesByDataTransfer:()=>i.xl,getFilesFromFileList:()=>i.kk,getIdxInParent:()=>s,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(7179),i=r(5410),a=r(9960),o=r(7391);const s=e=>[...e.parentElement.children].findIndex((t=>t===e)),l=e=>{var{dom:e,beginIdx:t,endIdx:r}=e;return[...e.children].slice(t,r+1)}},7179:(e,t,r)=>{"use strict";r.d(t,{BW:()=>p,Cm:()=>f,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(6999),i=r(1736),a=r(5410),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=>{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=>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=>{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=>o(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")),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"),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)}))},f=e=>o(void 0,void 0,void 0,(function*(){var{bitmap:t,texture:r}=e;const{ctx:i,canvas:o}=yield(0,a.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=v(s.data[l],s.data[l+1],s.data[l+2]))[0]/100,h=d[1]/100,d=d[2]/100;c=g(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(o)})),p=e=>{for(var t=(e=e.bitmap).width,r=e.height,n=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=>{const 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;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,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));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,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="";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")),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*(){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(""),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=>{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 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){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:()=>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},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,aM:()=>fe,kG:()=>oe,Sp:()=>Y,SI:()=>le,yT:()=>ce,hX:()=>ae,VU:()=>X,hs:()=>ie,vp:()=>ne,xr:()=>Q});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)).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),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 f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e){return(p=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=p(e);if(r=t?(r=p(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 f(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(f(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)}m.prototype.isLineMaterial=!0;var b,x,w,A,S=new n.Vector3,M=new n.Vector3,C=new n.Vector4,B=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,k=new n.Sphere,R=new n.Vector4;function I(e,t,r){return R.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),R.multiplyScalar(1/R.w),R.x=A/r.width,R.y=A/r.height,R.applyMatrix4(e.projectionMatrixInverse),R.multiplyScalar(1/R.w),Math.abs(Math.max(R.x,R.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)).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(),k.copy(o.boundingSphere).applyMatrix4(e),a=r?.5*A:I(i,Math.max(i.near,k.distanceToPoint(b.origin)),s.resolution),k.radius+=a,!1!==b.intersectsSphere(k)&&(null===o.boundingBox&&o.computeBoundingBox(),O.copy(o.boundingBox).applyMatrix4(e),a=r?.5*A:I(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 f=this,p=t,m=(o=i).projectionMatrix,v=f.material.resolution,g=f.matrixWorld,y=(e=f.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 R,L,F,U,G=0,j=y.count;G<j;G++)C.fromBufferAttribute(y,G),B.fromBufferAttribute(S,G),C.w=1,B.w=1,C.applyMatrix4(T),B.applyMatrix4(T),C.z>M&&B.z>M||(C.z>M?(R=C.z-B.z,R=(C.z-M)/R,C.lerp(B,R)):B.z>M&&(R=B.z-C.z,L=(B.z-M)/R,B.lerp(C,L)),C.applyMatrix4(m),B.applyMatrix4(m),C.multiplyScalar(1/C.w),B.multiplyScalar(1/B.w),C.x*=v.x/2,C.y*=v.y/2,B.x*=v.x/2,B.y*=v.y/2,D.start.copy(C),D.start.z=0,D.end.copy(B),D.end.z=0,L=D.closestPointToPointParameter(E,!0),D.at(L,P),F=-1<=(F=n.MathUtils.lerp(C.z,B.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),p.push({point:U,pointOnLine:F,distance:b.origin.distanceTo(U),object:f,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 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)).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 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)}N.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"===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)).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)),Z=r(8235),W=r(6999);const X=(e,t)=>(t.updateMatrixWorld(!0),t=new W.Z.Vector3,e.getWorldPosition(t),t),Q={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 Z.cp(e),$=e=>new K.j(e),ee=e=>new Z.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)},ae=(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)},oe=(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 a=new n.Line(i,e);return a.visible=t,{line:a,curve:r}},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{pointArray:e,material:t,lineWidth:r,colorArray:i}=e;const a=new N,o=(a.setPositions(e),t||new m({transparent:!0,side:n.DoubleSide,linewidth:r||5,vertexColors:!0})),s=(a.setColors(i||[1,1,1]),o.resolution.set(window.innerWidth,window.innerHeight),new J(a,o));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,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}},fe=()=>new W.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__},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 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}())},8493:(e,t,r)=>{"use strict";r.d(t,{T:()=>u});var n=r(8881),i=r(8512);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)},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 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)).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=(c.prototype.isCSS2DObject=!0,new t.Vector3),d=new t.Matrix4,f=new t.Matrix4,p=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 p.setFromMatrixPosition(e.matrixWorld),m.setFromMatrixPosition(t.matrixWorld),p.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),f.multiplyMatrices(t.projectionMatrix,d),function e(t,r,i){var o;t.isCSS2DObject&&(h.setFromMatrixPosition(t.matrixWorld),h.applyMatrix4(f),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,/apple/i.test(navigator.vendor)?o.style.transform="translate(-50%,-50%) translate("+Math.round(h.x*n+n)+"px,"+Math.round(-h.y*a+a)+"px)":o.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,p=t.children.length;d<p;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,p=r.length;o<p;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"}}))},8235:(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 f=new n.Vector3,p=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)).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=(v.prototype.isCSS3DObject=!0,function(){u(t,v);var e=h(t);function t(r){return a(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=(g.prototype.isCSS3DSprite=!0,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(f,p,m),y.setPosition(f),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"}}))},8409:(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,f=0,p=0;p<e.length;++p){var m,v,g=e[p],y=0;if(o!=(null!==g.index))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+p+". 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 "+p+'. 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 "+p+". 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 "+p+". .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 "+p+". .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 "+p+". The geometry must have either an index or a position attribute"),null;b=g.attributes.position.count}d.addGroup(f,b,p),f+=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 C=i(u[t]);if(!C)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+t+" attribute."),null;d.setAttribute(t,C)}for(r in c){var B=c[r][0].length;if(0===B)break;d.morphAttributes=d.morphAttributes||{},d.morphAttributes[r]=[];for(var _=0;_<B;++_){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:()=>Bs});var e={},t=(__webpack_require__.r(e),__webpack_require__.d(e,{AsyncCompress:()=>Si,AsyncDecompress:()=>Ui,AsyncDeflate:()=>mi,AsyncGunzip:()=>_i,AsyncGzip:()=>Si,AsyncInflate:()=>bi,AsyncUnzipInflate:()=>sa,AsyncUnzlib:()=>Ri,AsyncZipDeflate:()=>na,AsyncZlib:()=>Pi,Compress:()=>Ai,DecodeUTF8:()=>Vi,Decompress:()=>Fi,Deflate:()=>pi,EncodeUTF8:()=>Ji,Gunzip:()=>Bi,Gzip:()=>Ai,Inflate:()=>yi,Unzip:()=>la,UnzipInflate:()=>oa,UnzipPassThrough:()=>aa,Unzlib:()=>ki,Zip:()=>ia,ZipDeflate:()=>ra,ZipPassThrough:()=>ta,Zlib:()=>Di,compress:()=>Mi,compressSync:()=>Ci,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]?Ei:8!=(15&e[0])||7<e[0]>>4||(e[0]<<8|e[1])%31?xi:Ii)(e,t,r)},decompressSync:()=>function(e,t){return(31==e[0]&&139==e[1]&&8==e[2]?Ti:8!=(15&e[0])||7<e[0]>>4||(e[0]<<8|e[1])%31?wi:Li)(e,t)},deflate:()=>vi,deflateSync:()=>gi,gunzip:()=>Ei,gunzipSync:()=>Ti,gzip:()=>Mi,gzipSync:()=>Ci,inflate:()=>xi,inflateSync:()=>wi,strFromU8:()=>Zi,strToU8:()=>Ki,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!=ai(e,a);--a)if(!a||65558<e.length-a)return void t("invalid zip file",null);var o=ii(e,a+8);o||t(null,{});var s=o,l=ai(e,a+16),u=4294967295==l;if(u){if(a=ai(e,a-12),101075792!=ai(e,a))return void t("invalid zip file",null);s=o=ai(e,a+32),l=ai(e,a+48)}for(var c=function(a){function s(e,r){e?(n(),t(e,null)):(i[f]=r,--o||t(null,i))}var c=(m=Qi(e,l,u))[0],h=m[1],d=m[2],f=m[3],p=m[4],m=m[5];if(m=Xi(e,m),l=p,c)if(8==c)if(p=e.subarray(m,m+h),h<32e4)try{s(null,wi(p,new en(d)))}catch(a){s(a,null)}else r.push(xi(p,{size:d},s));else s("unknown compression type "+c,null);else s(null,En(e,m,m+h))},h=0;h<s;++h)c();return n},unzipSync:()=>function(e){for(var t={},r=e.length-22;101010256!=ai(e,r);--r)if(!r||65558<e.length-r)throw"invalid zip file";var n=ii(e,r+8);if(!n)return{};var i=ai(e,r+16),a=4294967295==i;if(a){if(r=ai(e,r-12),101075792!=ai(e,r))throw"invalid zip file";n=ai(e,r+32),i=ai(e,r+48)}for(var o=0;o<n;++o){var s=(d=Qi(e,i,a))[0],l=d[1],u=d[2],c=d[3],h=d[4],d=d[5];if(d=Xi(e,d),i=h,s){if(8!=s)throw"unknown compression type "+s;t[c]=wi(e.subarray(d,d+l),new en(u))}else t[c]=En(e,d,d+l)}return t},unzlib:()=>Ii,unzlibSync:()=>Li,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 en(u+22),t=l,n=u-l,i=u=0;i<c;++i){var a=h[i];try{var o=a.c.length,s=($i(e,u,a,a.f,a.u,o),30+a.f.length+qi(a.extra)),d=u+s;e.set(a.c,d),$i(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)}}ea(e,l,h.length,n,t),r(null,e)}var a={},o=(Gi(e,"",a,t),Object.keys(a)),s=o.length,l=0,u=0,c=s,h=new Array(s),d=[];s||i();for(var f=function(e){function t(t,a){t?(n(),r(t,null)):(t=a.length,h[e]=Jn(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],f=a[c],p=f[0],m=f[1],v=Hn(),g=p.length,y=(v.p(p),Ki(c)),b=y.length,x=m.comment,w=x&&Ki(x),A=w&&w.length,S=qi(m.extra),M=0==m.level?0:8;if(65535<b&&t("filename too long",null),M)if(g<16e4)try{t(null,gi(p,m))}catch(f){t(f,null)}else d.push(vi(p,m,t));else t(null,p)},p=0;p<c;++p)f(p);return n},zipSync:()=>function(e,t){var r,n={},i=[],a=(Gi(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=Ki(r)).length,h=s.comment,d=h&&Ki(h),f=d&&d.length,p=qi(s.extra);if(65535<c)throw"filename too long";var m=u?gi(l,s):l,v=m.length,g=Hn();g.p(l),i.push(Jn(s,{size:l.length,crc:g.d(),c:m,f:x,m:d,u:c!=r.length||d&&h.length!=f,o:a,compression:u})),a+=30+c+p+v,o+=76+2*(c+p)+(f||0)+v}for(var y=new en(o+22),b=(e=a,t=o-a,0);b<i.length;++b){var x=i[b],w=($i(y,x.o,x,x.f,x.u,x.c.length),30+x.f.length+qi(x.extra));y.set(x.c,x.o+w),$i(y,a,x,x.f,x.u,x.c.length,x.o,x.m),a+=16+w+(x.m?x.m.length:0)}return ea(y,a,i.length,t,e),y},zlib:()=>function(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return ni(e,t,[Qn,$n,function(){return[Oi]}],(function(e){return ti(Oi(e.data[0],e.data[1]))}),4,r)},zlibSync:()=>Oi}),{}),r=(__webpack_require__.r(t),__webpack_require__.d(t,{FBXLoader:()=>Ba}),__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 f=new r.Raycaster,p=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.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,f=new r.Quaternion,p=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",f),c("cameraPosition",p),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.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&&(f.setFromCamera(e,this.camera),e=S(this._gizmo.picker[this.mode],f),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&&(f.setFromCamera(e,this.camera),(e=S(this._plane,f,!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&&(f.setFromCamera(e,this.camera),(e=S(this._plane,f,!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(p.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(p.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)):(p.copy(this.pointStart),m.copy(this.pointEnd),p.applyQuaternion(this._worldQuaternionInv),m.applyQuaternion(this._worldQuaternionInv),m.divide(p),-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(p.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(p.copy(this.rotationAxis).cross(this.eye))*e):"X"!==t&&"Y"!==t&&"Z"!==t||(this.rotationAxis.copy(g[t]),p.copy(g[t]),"local"===i&&p.applyQuaternion(this.worldQuaternion),this.rotationAngle=this._offset.dot(p.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)).normalize()):(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 f}},{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 M=new r.Euler,C=new r.Vector3(0,1,0),B=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),k=new r.Vector3(0,1,0),R=new r.Vector3(0,0,1),I=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,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 f=(((a=a.clone()).color.setHex(7895160),v=new r.CylinderGeometry(0,.04,.1,12)).translate(0,.05,0),new r.BoxGeometry(.08,.08,.08)),p=(f.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}(p.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(p,o.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new r.Line(p,o.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new r.Line(p,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(p,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(f,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(f,w),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new r.Mesh(f,A),[0,.5,0]],[new r.Mesh(S,A)],[new r.Mesh(f,A),[0,-.5,0],[0,0,Math.PI]]],Z:[[new r.Mesh(f,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(f,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(p,o.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new r.Line(p,o.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new r.Line(p,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(C.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(C.copy(k).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(C.copy(R).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"XYZE"===r.axis&&(v.setFromEuler(M.set(0,Math.PI/2,0)),C.copy(r.rotationAxis),t.quaternion.setFromRotationMatrix(_.lookAt(B,C,k)),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),p.set(1e-10,1e-10,1e-10).add(r.worldPositionStart).sub(r.worldPosition).multiplyScalar(-1),p.applyQuaternion(r.worldQuaternionStart.clone().invert()),t.scale.copy(p),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(C.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(C.copy(k).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Z"===t.name&&.99<Math.abs(C.copy(R).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XY"===t.name&&Math.abs(C.copy(R).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"YZ"===t.name&&Math.abs(C.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(C.copy(k).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1)):"rotate"===r.mode&&(E.copy(n),C.copy(r.eye).applyQuaternion(v.copy(n).invert()),-1!==t.name.search("E")&&t.quaternion.setFromRotationMatrix(_.lookAt(r.eye,B,k)),"X"===t.name&&(v.setFromAxisAngle(O,Math.atan2(-C.y,C.z)),v.multiplyQuaternions(E,v),t.quaternion.copy(v)),"Y"===t.name&&(v.setFromAxisAngle(k,Math.atan2(C.x,C.z)),v.multiplyQuaternions(E,v),t.quaternion.copy(v)),"Z"===t.name&&(v.setFromAxisAngle(R,Math.atan2(C.y,C.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=(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 o(t,[{key:"updateMatrixWorld",value:function(e){var r=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(r="local"),I.copy(O).applyQuaternion("local"===r?this.worldQuaternion:T),L.copy(k).applyQuaternion("local"===r?this.worldQuaternion:T),F.copy(R).applyQuaternion("local"===r?this.worldQuaternion:T),C.copy(L),this.mode){case"translate":case"scale":switch(this.axis){case"X":C.copy(this.eye).cross(I),D.copy(I).cross(C);break;case"Y":C.copy(this.eye).cross(L),D.copy(L).cross(C);break;case"Z":C.copy(this.eye).cross(F),D.copy(F).cross(C);break;case"XY":D.copy(F);break;case"YZ":D.copy(I);break;case"XZ":C.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(p.set(0,0,0),D,C),this.quaternion.setFromRotationMatrix(P)),s(d(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}()),j=(G.prototype.isTransformControlsPlane=!0,__webpack_require__(3300)),N=__webpack_require__.n(j),H=__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,a,o){var s=r.exports.sbrk,l=n+3&-4,u=s(l*i),c=s(a.length),h=new Uint8Array(r.exports.memory.buffer);if(0==(h.set(a,c),e=e(u,n,i,c,a.length))&&o&&o(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 a=0;for(n=0;n<e.length;++n)r[a++]=r[n]<60?t[r[n]]:64*(r[n]-60)+r[++n];return r.buffer.slice(0,a)}(n),{}).then((function(e){(r=e.instance).exports.__wasm_call_ctors()}));var a={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},o={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,o,s){i(r.exports.meshopt_decodeVertexBuffer,e,t,n,o,r.exports[a[s]])},decodeIndexBuffer:function(e,t,n,a){i(r.exports.meshopt_decodeIndexBuffer,e,t,n,a)},decodeIndexSequence:function(e,t,n,a){i(r.exports.meshopt_decodeIndexSequence,e,t,n,a)},decodeGltfBuffer:function(e,t,n,s,l,u){i(r.exports[o[l]],e,t,n,s,r.exports[a[u]])}}}();function Z(e){return(Z="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 W(e,t){return(W=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function X(e){return(X=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Q=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&&W(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=X(e);if(r=t?(r=X(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Z(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(Q.has(e)){if((l=Q.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)})),Q.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":Z(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,f,p,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(),p=(f=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(p),u.GetAttributeDataArrayForAllPoints(c,S,m,p,v),u=new A(M.HEAPF32.buffer,v,f).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),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,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 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 ae=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 a=this,o=q.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){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),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}(),oe=(ae.prototype.isImageBitmapLoader=!0,__webpack_require__(5613));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,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)||ce(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=ce(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,a=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(o)throw i}}}}function ue(e){return function(e){if(Array.isArray(e))return he(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||ce(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 ce(e,t){if(e){if("string"==typeof e)return he(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)?he(e,t):void 0}}function he(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 de(e){return(de="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 fe(){return(fe="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=we(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 me(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 ve(e,t,r){return t&&me(e.prototype,t),r&&me(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&&ye(e,t)}function ye(e,t){return(ye=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function be(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=we(e);if(r=t?(r=we(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===de(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return xe(n)}}function xe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function we(e){return(we=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ae=function(){ge(t,r.Loader);var e=be(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 _e(e)})),r.register((function(e){return new ke(e)})),r.register((function(e){return new Re(e)})),r.register((function(e){return new Ee(e)})),r.register((function(e){return new Te(e)})),r.register((function(e){return new De(e)})),r.register((function(e){return new Pe(e)})),r.register((function(e){return new Oe(e)})),r.register((function(e){return new Ce(e)})),r.register((function(e){return new Ie(e)})),r}return ve(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))===Le){try{s[Me.KHR_BINARY_GLTF]=new Fe(e)}catch(e){return void(i&&i(e))}o=s[Me.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 nt(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 f=0;f<u.extensionsUsed.length;++f){var p=u.extensionsUsed[f],m=u.extensionsRequired||[];switch(p){case Me.KHR_MATERIALS_UNLIT:s[p]=new Be;break;case Me.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:s[p]=new Ne;break;case Me.KHR_DRACO_MESH_COMPRESSION:s[p]=new Ue(u,this.dracoLoader);break;case Me.KHR_TEXTURE_TRANSFORM:s[p]=new Ge;break;case Me.KHR_MESH_QUANTIZATION:s[p]=new He;break;default:0<=m.indexOf(p)&&void 0===l[p]&&console.warn('THREE.GLTFLoader: Unknown extension "'+p+'".')}}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 Se(){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 Me={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"},Ce=function(){function e(t){pe(this,e),this.parser=t,this.name=Me.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return ve(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}(),Be=function(){function e(){pe(this,e),this.name=Me.KHR_MATERIALS_UNLIT}return ve(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}(),_e=function(){function e(t){pe(this,e),this.parser=t,this.name=Me.KHR_MATERIALS_CLEARCOAT}return ve(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=Me.KHR_MATERIALS_SHEEN}return ve(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}(),Te=function(){function e(t){pe(this,e),this.parser=t,this.name=Me.KHR_MATERIALS_TRANSMISSION}return ve(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}(),De=function(){function e(t){pe(this,e),this.parser=t,this.name=Me.KHR_MATERIALS_VOLUME}return ve(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}(),Pe=function(){function e(t){pe(this,e),this.parser=t,this.name=Me.KHR_MATERIALS_IOR}return ve(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}(),Oe=function(){function e(t){pe(this,e),this.parser=t,this.name=Me.KHR_MATERIALS_SPECULAR}return ve(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=[],a=(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(a[0],a[1],a[2]),void 0!==e.specularColorTexture&&i.push(n.assignTexture(t,"specularColorMap",e.specularColorTexture).then((function(e){e.encoding=r.sRGBEncoding}))),Promise.all(i)}}]),e}(),ke=function(){function e(t){pe(this,e),this.parser=t,this.name=Me.KHR_TEXTURE_BASISU}return ve(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}(),Re=function(){function e(t){pe(this,e),this.parser=t,this.name=Me.EXT_TEXTURE_WEBP,this.isSupported=null}return ve(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],a=n.images[i.source],o=r.textureLoader;return a.uri&&null!==(i=r.options.manager.getHandler(a.uri))&&(o=i),this.detectSupport().then((function(i){if(i)return r.loadTextureImage(e,a,o);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=Me.EXT_MESHOPT_COMPRESSION,this.parser=t}return ve(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}(),Le="glTF",Fe=ve((function e(t){pe(this,e),this.name=Me.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!==Le)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.")})),Ue=function(){function e(t,r){if(pe(this,e),!r)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Me.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=r,this.dracoLoader.preload()}return ve(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=Qe[r]||r.toLowerCase();l[h]=s[r]}for(n in e.attributes){var d,f,p=Qe[n]||n.toLowerCase();void 0!==s[n]&&(d=i.accessors[e.attributes[n]],f=Ke[d.componentType],c[p]=f,u[p]=!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}(),Ge=function(){function e(){pe(this,e),this.name=Me.KHR_TEXTURE_TRANSFORM}return ve(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(){ge(t,r.MeshStandardMaterial);var e=be(t);function t(n){pe(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(xe(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 ve(t,[{key:"copy",value:function(e){return fe(we(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}(),Ne=function(){function e(){pe(this,e),this.name=Me.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 ve(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}(),He=ve((function e(){pe(this,e),this.name=Me.KHR_MESH_QUANTIZATION})),ze=function(){ge(t,r.Interpolant);var e=be(t);function t(r,n,i,a){return pe(this,t),e.call(this,r,n,i,a)}return ve(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}(),Ve=(ze.prototype.beforeStart_=ze.prototype.copySampleValue_,ze.prototype.afterEnd_=ze.prototype.copySampleValue_,ze.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,f=t-r,p=1-d,m=f-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]=p*g+m*y+d*b+f*x}return i},new r.Quaternion),Je=function(){ge(t,ze);var e=be(t);function t(){return pe(this,t),e.apply(this,arguments)}return ve(t,[{key:"interpolate_",value:function(e,r,n,i){return e=fe(we(t.prototype),"interpolate_",this).call(this,e,r,n,i),Ve.fromArray(e).normalize().toArray(e),e}}]),t}(),Ke={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Ze={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"},Ye={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},qe={CUBICSPLINE:void 0,LINEAR:r.InterpolateLinear,STEP:r.InterpolateDiscrete};function $e(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 et(e,t){void 0!==t.extras&&("object"===de(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function tt(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 rt(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 nt=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 Se,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 ae(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 ve(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(ue(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:{}};$e(i,a,n),et(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=this;if(e.refs[t]<=1)return r;var i=r.clone();return function e(t,r){var i,a=n.associations.get(t),o=(null!=a&&n.associations.set(r,a),le(t.children.entries()));try{for(o.s();!(i=o.n()).done;){var s=se(i.value,2),l=s[0];e(s[1],r.children[l])}}catch(e){o.e(e)}finally{o.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[Me.KHR_BINARY_GLTF].body);var i=this.options;return new Promise((function(e,a){n.load(r.LoaderUtils.resolveURL(t.uri,i.path),e,void 0,(function(){a(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 a,o=e[0],s=Xe[i.type],l=Ke[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,f=h&&h!==u*s?(p=Math.floor(c/h),m="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+p+":"+i.count,(v=t.cache.get(m))||(a=new l(o,p*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 p=Ke[i.sparse.indices.componentType],m=i.sparse.indices.byteOffset||0,v=i.sparse.values.byteOffset||0,g=new p(e[1],m,i.sparse.count*Xe.SCALAR),y=new l(e[2],v,i.sparse.count*s);null!==o&&(f=new r.BufferAttribute(f.array.slice(),f.itemSize,f.normalized));for(var b=0,x=g.length;b<x;b++){var w=g[b];if(f.setX(w,y[b*s]),2<=s&&f.setY(w,y[b*s+1]),3<=s&&f.setZ(w,y[b*s+2]),4<=s&&f.setW(w,y[b*s+3]),5<=s)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return f})))}},{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]?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=Ze[n.magFilter]||r.LinearFilter,t.minFilter=Ze[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: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,oe.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[Me.KHR_TEXTURE_TRANSFORM]&&(a=void 0!==r.extensions?r.extensions[Me.KHR_TEXTURE_TRANSFORM]:void 0)&&(o=n.associations.get(i),i=n.extensions[Me.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||{})[Me.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]?(u=a[Me.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS],t=u.getMaterialType(),l.push(u.extendParams(s,o,n))):i[Me.KHR_MATERIALS_UNLIT]?(u=a[Me.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[Me.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),et(i,o),n.associations.set(i,{materials:e}),o.extensions&&$e(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[Me.KHR_DRACO_MESH_COMPRESSION])?"draco:"+c.bufferView+":"+c.indices+":"+tt(c.attributes):u.indices+":"+tt(u.attributes)+":"+u.mode),c=i[u];c?a.push(c.promise):(c=void 0,c=l.extensions&&l.extensions[Me.KHR_DRACO_MESH_COMPRESSION]?function(e){return n[Me.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(r){return it(r,e,t)}))}(l):it(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],f=o[c],p=void 0,m=s[c];if(4===f.mode||5===f.mode||6===f.mode||void 0===f.mode)!0!==(p=new(!0===a.isSkinnedMesh?r.SkinnedMesh:r.Mesh)(d,m)).isSkinnedMesh||p.geometry.attributes.skinWeight.normalized||p.normalizeSkinWeights(),5===f.mode?p.geometry=at(p.geometry,r.TriangleStripDrawMode):6===f.mode&&(p.geometry=at(p.geometry,r.TriangleFanDrawMode));else if(1===f.mode)p=new r.LineSegments(d,m);else if(3===f.mode)p=new r.Line(d,m);else if(2===f.mode)p=new r.LineLoop(d,m);else{if(0!==f.mode)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+f.mode);p=new r.Points(d,m)}if(0<Object.keys(p.geometry.morphAttributes).length){A=w=x=b=y=v=void 0;var v=p,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.")}}p.name=t.createUniqueName(a.name||"mesh_"+e),et(p,a),f.extensions&&$e(i,p,f),t.assignFinalMaterial(p),u.push(p)}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 C=new r.Group;t.associations.set(C,{meshes:e});for(var B=0,_=u.length;B<_;B++)C.add(u[B]);return C}))}},{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)),et(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,f=void 0!==t.parameters?t.parameters[h.input]:h.input,p=void 0!==t.parameters?t.parameters[h.output]:h.output;n.push(this.getDependency("node",d)),i.push(this.getDependency("accessor",f)),a.push(this.getDependency("accessor",p)),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 f=void 0;switch(Ye[d.path]){case Ye.weights:f=r.NumberKeyframeTrack;break;case Ye.rotation:f=r.QuaternionKeyframeTrack;break;default:f=r.VectorKeyframeTrack}e=t.name||t.uuid;var p=void 0!==h.interpolation?qe[h.interpolation]:r.InterpolateLinear,m=[],v=(Ye[d.path]===Ye.weights?t.traverse((function(e){e.morphTargetInfluences&&m.push(e.name||e.uuid)})):m.push(e),c.array);if(c.normalized){for(var g=rt(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 f(m[w]+"."+Ye[d.path],n.array,v,p);"CUBICSPLINE"===h.interpolation&&(S.createInterpolant=function(e){return new(this instanceof r.QuaternionKeyframeTrack?Je:ze)(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),et(l,o),o.extensions&&$e(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)),et(a,e),e.extensions&&$e(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){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}));var t})).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=ue(s.entries()).sort((function(e,t){return e[0]-t[0]})).map((function(e){return(e=se(e,2))[0],e[1]})),s.clear()))}catch(t){console.log(t,"e")}var h=[];if(u.children)for(var d=u.children,f=new Map,p=0,m=d.length;p<m;p++){var v=d[p];h.push(e({idMap:f,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=le(i.associations);try{for(a.s();!(t=a.n()).done;){var o=se(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 it(e,t,n){var i,a=t.attributes,o=[];for(i in a){var s=Qe[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)),et(e,t);var l=e,u=t,c=n,h=u.attributes,d=new r.Box3;if(void 0!==h.POSITION){var f=(h=c.json.accessors[h.POSITION]).min,p=h.max;if(void 0===f||void 0===p)console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");else{d.set(new r.Vector3(f[0],f[1],f[2]),new r.Vector3(p[0],p[1],p[2])),h.normalized&&(f=rt(Ke[h.componentType]),d.min.multiplyScalar(f),d.max.multiplyScalar(f));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=rt(Ke[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,p=new r.Sphere,d.getCenter(p.center),p.radius=d.min.distanceTo(d.max)/2,l.boundingSphere=p}}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=[],f=[],p=[],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,f.push(g)),l&&(y=void 0!==y.COLOR_0?a.getDependency("accessor",y.COLOR_0):r.attributes.color,p.push(y))}return Promise.all([Promise.all(d),Promise.all(f),Promise.all(p)]).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 at(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__(8409);var ot=__webpack_require__(5259),st=__webpack_require__(6999),lt=__webpack_require__(5105),ut=__webpack_require__(811),ct=__webpack_require__(1736),ht=__webpack_require__(5410),dt=__webpack_require__(8239),ft=__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:a,repeat:o}=r;const s=this.textureIns[t];s&&(s.format=r,e({target:s.repeat,data:o}),e({target:s.center,data:n}),e({target:s.offset,data:a}),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 a=this.runScene.materialEx.getDataByType(r.type,{normal:r,textures:e,models:n,material:i});this.runScene.materialEx.parseNromals(r,a),a&&n.map((e=>e.material=a))};return r=>{(0,z.js)(r,((r,n)=>{if(r=this.materialIns[r]){const{material:i,models:a}=r;i&&(({normal:r,textures:n}=n),(r.type?t:e)({textures:n,models:a,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,dt.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:a,type:o,material:s}=i;this.runScene.uniqueEx.texture.addMaterial(a,{material:s,type:o}),(0,dt.setMaterialTexture)({material:s,type:o,texture:a}),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 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){const{textureDef:t,texture:r}=e;var{md5:e,format:n,size:i,uvScript:a,id:o,cloneSourceId:s,minFilter:l}=t;r.userData.md5=e,n&&(r.format=n,r.userData.format=n),a&&(r.userData.uvScript=a),s&&((0,ct.setTextureCloneId)(r,s),this.clonedTextures.push(r)),"nearest"===l&&((0,ct.setTextureMinFilter)(r,"nearest"),(0,ft.M)(r,"minFilter",l)),r.userData.id=o,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,dt.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,ct.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,ct.bindTextureBaseData)(e)):(this.runScene.textureEx.delete(e),(0,ft.bv)(e,"cloneSourceId"),(0,ct.disposeTexture)(e))}))}}class mt{constructor(e,t){this.runScene=e,this.loadConfig=t}setTextureLoader(e){this.textureLoader=e,this.initTextureLoader(e)}initTextureLoader(e){e instanceof ae&&e.setOptions({reverseTexture:this.loadConfig.reverseTexture,textureQuality:this.runScene.optionsEx.options.texture.quality})}}class vt{constructor(e,t){this.runScene=e,this.loadConfig=t}done(e){var t,r,n,i,a;e.asset.ex&&(({camera:e,lights:t,options:r,controls:n,tags:i,objects:a}=e.asset.ex),this.runScene.tags.parseJSON(i||{}),this.camera(e),this.controls(n),this.lights(t),this.options(r),a&&this.runScene.objects.parseJSON(a))}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);const 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;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:lt.Z},this.runScene=e,this.loadConfig=t,this.material=new pt(e,t),this.scene=new vt(e,t),this.options=new mt(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,ht.Ne)(e))&&(e=Number(e),!isNaN(e)&&(new Date).getTime()<e)}processNode(e){this.runScene.cb.loaderer.gltf.loadNode.cb(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:a,normal:o,local:s,cloneId:l,id:u,animations:c,isDynamic:h}=r.extras;var n,i;if(e=(0,ut.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=At.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)),a&&(t.layers.enable(1),this.runScene.cb.model.setLayers.cb({model:t,val:1})),r.extras.isHelper&&this.helperModels.push(t),o&&(e=this.nodeType[null==o?void 0:o.type].modelTools.parseData(t,o),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,ut.isDynamicModel)(n,!0)||(r=(0,ut.instanceModel)(n,[...t]),this.runScene.modelEx.add(r,void 0,{isClone:!1,select:!1,addUndo:!1}),(0,ut.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:a,fog:o}=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,ct.setTextureMapping)(n))}a&&(t.background=new r.Color("#"+a)),o&&(({color:n,far:e,near:i}=o),a=new r.Fog("#"+n,i,e),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 yt{constructor(e){this.dracoPath="./draco/",this._gltf=new Ae,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 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,oe.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: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?u=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){const[t]=e,r=[];return t.material?(this.runScene.materialEx.add(t.material),r.push(t.material)):t.children.map((e=>{e.material&&(r.push(e.material),this.runScene.materialEx.add(e.material))})),r}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 bt{constructor(e){this._objectLoader=new r.ObjectLoader,this.runScene=e,this._parser=new xt(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 xt{constructor(e){this.runScene=e}parseModel(e){e.material&&this.parseMaterial(e)}parseMaterial(e){var t=e.material;"SpriteMaterial"===t.type&&(0,ft.M)(t,"tools",lt.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 wt{constructor(e){this.imgBitMap=new r.ImageBitmapLoader,this.object=new r.ObjectLoader,this.runScene=e,this.gltf=new yt(e),this.json=new bt(e)}}const At=new class{constructor(){this.load=new r.AnimationLoader}parse(e){return this.load.parse(e)}};class St 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,ut.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 a=e.animations.length?e.animations:At.parse(t),o=new r.AnimationMixer(e);for(const t of a){var n=(0,H.getId)(),i=(t.id=n,o.clipAction(t));const r={finished:()=>{},loop:()=>{}};o.addEventListener("finished",(()=>r.finished())),o.addEventListener("loop",(()=>r.loop())),this.map[n]={mixer:o,action:i,model:e,time:0,runState:"close",clip:t,eventMap:r}}a.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,oe.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:f}=(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 p=!(n.runState="play");this.setUpdates(e,(()=>{var e=(0,oe.getProgress)(h.time,d.duration,!0);99<=e&&!p&&(a(),p=!0),i(e)})),u?(h.loop=st.Z.LoopRepeat,f.loop=o):(l&&(h.clampWhenFinished=!0),h.loop=st.Z.LoopOnce,f.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,oe.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 a=this.map[e];a&&(t=this.findId(r,n),(e=this.map[t])&&a.action.crossFadeTo(e.action,i,!0))}resetTime(e,t){const r=this.getItem(e,t);r&&(r.action.time=0)}}var Mt=__webpack_require__(8235),Ct=__webpack_require__(2430);class Bt{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 Mt.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 Ct.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 _t{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.data.fn=t,!0)}remove(e){this.reset(e,null)}delete(e){e=(this.get(e)||{}).index,this.cbs.splice(e,1)}}class Et{constructor(){this.resize=new _t,this.setSelectMaterial=new _t,this.setScene=new _t,this.reset=new _t,this.render=new _t,this.tick=new _t,this.baseLog=new _t,this.inited=new _t,this.texture={add:new _t,remove:new _t,setAnima:new _t},this.model={multiSelect:{setEmpty:new _t},change:new _t,setSelect:new _t,click:new _t,add:new _t,remove:new _t,multipDrop:new _t,focus:new _t,unFocus:new _t,changeName:new _t,setOpen:new _t,setMainStatue:new _t,setVisible:new _t,setParent:new _t,setLayers:new _t,setOutline:new _t,clone:new _t,dispose:new _t},this.material={add:new _t,dispose:new _t,setName:new _t},this.unique={material:{add:new _t}},this.tranControls={changing:new _t},this.undo={addUndos:new _t,addRedus:new _t,removeUndos:new _t,undoByIndex:new _t,reset:new _t},this.scene={save:new _t,saveNet:new _t},this.timeLine={setProgress:new _t,playGroup:new _t,setGroupMap:new _t,reset:new _t,closeGroup:new _t},this.events={key:{down:new _t,up:new _t},mouse:{move:new _t,down:new _t,up:new _t},pointer:{rightTrigger:new _t,down:new _t,up:new _t,move:new _t,trigger:new _t}},this.pp={glow:{setData:new _t,setStatus:new _t},outline:{setData:new _t,setStatus:new _t}},this.load={getJSON:new _t,progress:new _t,complete:new _t},this.exporter={gltf:{before:new _t}},this.loaderer={gltf:{loadNode:new _t,lazyLoadedTexture:new _t,loaded:new _t,modelLoaded:new _t,progress:new _t,getJSON:new _t,getArrayBuffer:new _t,complete:new _t}},this.custom=new Proxy({},{get:(e,t)=>(e[t]||(e[t]=new _t),e[t])}),this.tags={parseJSON:new _t,clear:new _t}}}var Tt=__webpack_require__(1819);function Dt(e,t){this.orbit=t,this.object=e,this.target=new st.Z.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.25;var r,n,i,a,o,s,l,u,c,h,d,f,p=this,m=0,v=0,g=0,y=0,b=1,x=new st.Z.Vector3,w=!1;this.getPolarAngle=function(){return v},this.getAzimuthalAngle=function(){return m},this.setPolarAngle=function(e){v=e,this.forceUpdate()},this.setAzimuthalAngle=function(e){m=e,this.forceUpdate()},this.rotateLeft=function(e){y-=e},this.rotateUp=function(e){g-=e},this.panLeft=(r=new st.Z.Vector3,function(e){var t=this.object.matrix.elements;r.set(t[0],t[1],t[2]),r.multiplyScalar(-e),x.add(r)}),this.panUp=(n=new st.Z.Vector3,function(e,r){t.screenSpacePanning?n.setFromMatrixColumn(r,1):(n.setFromMatrixColumn(r,0),n.crossVectors(p.object.up,n)),n.multiplyScalar(e),x.add(n)}),this.pan=function(e,t,r,n){var i;p.object instanceof st.Z.PerspectiveCamera?(i=p.object.position.clone().sub(p.target).length(),i*=Math.tan(p.object.fov/2*Math.PI/180),p.panLeft(2*e*i/n),p.panUp(2*t*i/n,p.object.matrix)):p.object instanceof st.Z.OrthographicCamera?(p.panLeft(e*(p.object.right-p.object.left)/r),p.panUp(t*(p.object.top-p.object.bottom)/n)):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.")},this.dollyIn=function(e){p.object instanceof st.Z.PerspectiveCamera?b/=e:p.object instanceof st.Z.OrthographicCamera?(p.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom*e)),p.object.updateProjectionMatrix(),w=!0):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.")},this.dollyOut=function(e){p.object instanceof st.Z.PerspectiveCamera?b*=e:p.object instanceof st.Z.OrthographicCamera?(p.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/e)),p.object.updateProjectionMatrix(),w=!0):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.")},this.forceUpdate=(i=new st.Z.Vector3,a=(new st.Z.Quaternion).setFromUnitVectors(e.up,new st.Z.Vector3(0,1,0)),o=a.clone().invert(),s=new st.Z.Vector3,l=new st.Z.Quaternion,function(){var e=this.object.position,t=(i.copy(e).sub(this.target),i.applyQuaternion(a),m=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,m)),v=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,v)),v=Math.max(1e-6,Math.min(Math.PI-1e-6,v)),i.length()*b);return t=Math.max(this.minDistance,Math.min(this.maxDistance,t)),this.target.add(x),i.x=t*Math.sin(v)*Math.sin(m),i.y=t*Math.cos(v),i.z=t*Math.sin(v)*Math.cos(m),i.applyQuaternion(o),e.copy(this.target).add(i),this.object.lookAt(this.target),!0===this.enableDamping?(y*=1-this.dampingFactor,g*=1-this.dampingFactor):g=y=0,b=1,x.set(0,0,0),!(!(w||1e-6<s.distanceToSquared(this.object.position)||1e-6<8*(1-l.dot(this.object.quaternion)))||(s.copy(this.object.position),l.copy(this.object.quaternion),w=!1))}),this.update=(u=new st.Z.Vector3,c=(new st.Z.Quaternion).setFromUnitVectors(e.up,new st.Z.Vector3(0,1,0)),h=c.clone().invert(),d=new st.Z.Vector3,f=new st.Z.Quaternion,function(){var e=this.object.position,t=(u.copy(e).sub(this.target),u.applyQuaternion(c),m=Math.atan2(u.x,u.z),v=Math.atan2(Math.sqrt(u.x*u.x+u.z*u.z),u.y),m+=y,v+=g,m=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,m)),v=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,v)),v=Math.max(1e-6,Math.min(Math.PI-1e-6,v)),u.length()*b);return t=Math.max(this.minDistance,Math.min(this.maxDistance,t)),this.target.add(x),u.x=t*Math.sin(v)*Math.sin(m),u.y=t*Math.cos(v),u.z=t*Math.sin(v)*Math.cos(m),u.applyQuaternion(h),e.copy(this.target).add(u),this.object.lookAt(this.target),!0===this.enableDamping?(y*=1-this.dampingFactor,g*=1-this.dampingFactor):g=y=0,b=1,x.set(0,0,0),!(!(w||1e-6<d.distanceToSquared(this.object.position)||1e-6<8*(1-f.dot(this.object.quaternion)))||(d.copy(this.object.position),f.copy(this.object.quaternion),w=!1))})}function Pt(e,t){var r=new Dt(e,this),n=(this.domElement=void 0!==t?t:document,Object.defineProperty(this,"constraint",{get:function(){return r}}),this.getPolarAngle=function(){return r.getPolarAngle()},this.getAzimuthalAngle=function(){return r.getAzimuthalAngle()},this.setPolarAngle=function(e){return r.setPolarAngle(e)},this.setAzimuthalAngle=function(e){return r.setAzimuthalAngle(e)},this.enabled=!0,this.center=this.target,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.screenSpacePanning=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={ORBIT:st.Z.MOUSE.LEFT,ZOOM:st.Z.MOUSE.MIDDLE,PAN:st.Z.MOUSE.RIGHT},this),i=new st.Z.Vector2,a=new st.Z.Vector2,o=new st.Z.Vector2,s=new st.Z.Vector2,l=new st.Z.Vector2,u=new st.Z.Vector2,c=new st.Z.Vector2,h=new st.Z.Vector2,d=new st.Z.Vector2,f=-1,p=f,m=(this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,{type:"change"}),v={type:"start"},g={type:"end"};function y(e,t){var i=n.domElement===document?n.domElement.body:n.domElement;r.pan(e,t,i.clientWidth,i.clientHeight)}function b(){return Math.pow(.95,n.zoomSpeed)}function x(e){if(!1!==n.enabled){if(e.preventDefault(),e.button===n.mouseButtons.ORBIT){if(!1===n.enableRotate)return;p=0,i.set(e.clientX,e.clientY)}else if(e.button===n.mouseButtons.ZOOM){if(!1===n.enableZoom)return;p=1,c.set(e.clientX,e.clientY)}else if(e.button===n.mouseButtons.PAN){if(!1===n.enablePan)return;p=2,s.set(e.clientX,e.clientY)}p!==f&&(document.addEventListener("mousemove",w,!1),document.addEventListener("mouseup",A,!1),n.dispatchEvent(v))}}function w(e){if(null!=e&&null!=(t=e.preventDefault)&&t.call(e),!1!==n.enabled){var t=n.domElement===document?n.domElement.body:n.domElement;if(0===p){if(!1===n.enableRotate)return;a.set(e.clientX,e.clientY),o.subVectors(a,i),r.rotateLeft(2*Math.PI*o.x/t.clientWidth*n.rotateSpeed),r.rotateUp(2*Math.PI*o.y/t.clientHeight*n.rotateSpeed),i.copy(a)}else if(1===p){if(!1===n.enableZoom)return;h.set(e.clientX,e.clientY),d.subVectors(h,c),0<d.y?r.dollyIn(b()):d.y<0&&r.dollyOut(b()),c.copy(h)}else if(2===p){if(!1===n.enablePan)return;l.set(e.clientX,e.clientY),u.subVectors(l,s),y(u.x,u.y),s.copy(l)}p!==f&&n.update()}}function A(){!1!==n.enabled&&(document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",A),n.dispatchEvent(g),p=f)}function S(e){var t;!1!==n.enabled&&!1!==n.enableZoom&&p===f&&(e.stopPropagation(),void(t=0)!==e.wheelDelta?t=e.wheelDelta:void 0!==e.detail&&(t=-e.detail),0<t?r.dollyOut(b()):t<0&&r.dollyIn(b()),n.update(),n.dispatchEvent(v),n.dispatchEvent(g))}function M(e){if(!1!==n.enabled&&!1!==n.enableKeys&&!1!==n.enablePan)switch(e.keyCode){case n.keys.UP:y(0,n.keyPanSpeed),n.update();break;case n.keys.BOTTOM:y(0,-n.keyPanSpeed),n.update();break;case n.keys.LEFT:y(n.keyPanSpeed,0),n.update();break;case n.keys.RIGHT:y(-n.keyPanSpeed,0),n.update()}}function C(e){if(!1!==n.enabled){switch(e.touches.length){case 1:if(!1===n.enableRotate)return;p=3,i.set(e.touches[0].pageX,e.touches[0].pageY);break;case 2:if(!1===n.enableZoom)return;p=4;var t=e.touches[0].pageX-e.touches[1].pageX,r=e.touches[0].pageY-e.touches[1].pageY;t=Math.sqrt(t*t+r*r),c.set(0,t);break;case 3:if(!1===n.enablePan)return;p=5,s.set(e.touches[0].pageX,e.touches[0].pageY);break;default:p=f}p!==f&&n.dispatchEvent(v)}}function B(e){if(e.stopPropagation(),!1!==n.enabled){var t=n.domElement===document?n.domElement.body:n.domElement;switch(e.touches.length){case 1:if(!1===n.enableRotate)return;if(3!==p)return;a.set(e.touches[0].pageX,e.touches[0].pageY),o.subVectors(a,i),r.rotateLeft(2*Math.PI*o.x/t.clientWidth*n.rotateSpeed),r.rotateUp(2*Math.PI*o.y/t.clientHeight*n.rotateSpeed),i.copy(a),n.update();break;case 2:if(!1===n.enableZoom)return;if(4!==p)return;var m=e.touches[0].pageX-e.touches[1].pageX,v=e.touches[0].pageY-e.touches[1].pageY;m=Math.sqrt(m*m+v*v),h.set(0,m),d.subVectors(h,c),0<d.y?r.dollyOut(b()):d.y<0&&r.dollyIn(b()),c.copy(h),n.update();break;case 3:if(!1===n.enablePan)return;if(5!==p)return;l.set(e.touches[0].pageX,e.touches[0].pageY),u.subVectors(l,s),y(u.x,u.y),s.copy(l),n.update();break;default:p=f}}}function _(){!1!==n.enabled&&(n.dispatchEvent(g),p=f)}function E(e){e.preventDefault()}this.update=function(){this.autoRotate&&p===f&&r.rotateLeft(2*Math.PI/60/60*n.autoRotateSpeed),!0===r.update()&&this.dispatchEvent(m)},this.reset=function(){p=f,this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(m),this.update()},this.dispose=function(){this.domElement.removeEventListener("contextmenu",E,!1),this.domElement.removeEventListener("mousedown",x,!1),this.domElement.removeEventListener("mousewheel",S,!1),this.domElement.removeEventListener("MozMousePixelScroll",S,!1),this.domElement.removeEventListener("touchstart",C,!1),this.domElement.removeEventListener("touchend",_,!1),this.domElement.removeEventListener("touchmove",B,!1),document.removeEventListener("mousemove",w,!1),document.removeEventListener("mouseup",A,!1),window.removeEventListener("keydown",M,!1)},this.domElement.addEventListener("contextmenu",E,!1),this.domElement.addEventListener("mousedown",x,!1),this.domElement.addEventListener("mousewheel",S,{passive:!0}),this.domElement.addEventListener("MozMousePixelScroll",S,!1),this.domElement.addEventListener("touchstart",C,{passive:!0}),this.domElement.addEventListener("touchend",_,!1),this.domElement.addEventListener("touchmove",B,{passive:!0}),window.addEventListener("keydown",M,!1),this.update()}st.Z.MOUSE,(Pt.prototype=Object.create(st.Z.EventDispatcher.prototype)).constructor=Pt,Object.defineProperties(Pt.prototype,{object:{get:function(){return this.constraint.object}},target:{get:function(){return this.constraint.target},set:function(e){console.warn("Three.OrbitControls: target is now immutable. Use target.set() instead."),this.constraint.target.copy(e)}},minDistance:{get:function(){return this.constraint.minDistance},set:function(e){this.constraint.minDistance=e}},maxDistance:{get:function(){return this.constraint.maxDistance},set:function(e){this.constraint.maxDistance=e}},minZoom:{get:function(){return this.constraint.minZoom},set:function(e){this.constraint.minZoom=e}},maxZoom:{get:function(){return this.constraint.maxZoom},set:function(e){this.constraint.maxZoom=e}},minPolarAngle:{get:function(){return this.constraint.minPolarAngle},set:function(e){this.constraint.minPolarAngle=e}},maxPolarAngle:{get:function(){return this.constraint.maxPolarAngle},set:function(e){this.constraint.maxPolarAngle=e}},minAzimuthAngle:{get:function(){return this.constraint.minAzimuthAngle},set:function(e){this.constraint.minAzimuthAngle=e}},maxAzimuthAngle:{get:function(){return this.constraint.maxAzimuthAngle},set:function(e){this.constraint.maxAzimuthAngle=e}},enableDamping:{get:function(){return this.constraint.enableDamping},set:function(e){this.constraint.enableDamping=e}},dampingFactor:{get:function(){return this.constraint.dampingFactor},set:function(e){this.constraint.dampingFactor=e}},noZoom:{get:function(){return console.warn("Three.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),!this.enableZoom},set:function(e){console.warn("Three.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),this.enableZoom=!e}},noRotate:{get:function(){return console.warn("Three.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),!this.enableRotate},set:function(e){console.warn("Three.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),this.enableRotate=!e}},noPan:{get:function(){return console.warn("Three.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),!this.enablePan},set:function(e){console.warn("Three.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),this.enablePan=!e}},noKeys:{get:function(){return console.warn("Three.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),!this.enableKeys},set:function(e){console.warn("Three.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),this.enableKeys=!e}},staticMoving:{get:function(){return console.warn("Three.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),!this.constraint.enableDamping},set:function(e){console.warn("Three.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),this.constraint.enableDamping=!e}},dynamicDampingFactor:{get:function(){return console.warn("Three.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.constraint.dampingFactor},set:function(e){console.warn("Three.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.constraint.dampingFactor=e}}});const Ot=Pt;class kt{create(e,t){return new Ot(e,t)}static toJSON(e){return e.target}}class Rt{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 It=__webpack_require__(7267),Lt=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 Ft{constructor(e){this.alt=!1,this.ctrl=!1,this.shift=!1,this.unExec=new ot.Z,this.specialKeyDebounce=(0,It.d)((()=>{this.ctrl=!1,this.shift=!1,this.alt=!1}),1e3),this.allFn={s_saveScene:()=>Lt(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 Lt(this,void 0,void 0,(function*(){if("INPUT"!==document.activeElement.nodeName){var t=e.key.toLowerCase();if(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,this.specialKeyDebounce();break;case"control":case"ctrl":this.ctrl=!0,this.specialKeyDebounce();break;case"shift":this.shift=!0,this.specialKeyDebounce();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){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":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 Ut=__webpack_require__(7263);class Gt{constructor(e){this.downPosition={0:{x:0,y:0},2:{x:0,y:0}},this.enableUp=!0,this.isMove=!1,this.moveEvent=new MouseEvent("move"),this.down=e=>{0!==e.button&&2!==e.button||(this.downPosition[e.button]={x:e.offsetX,y:e.offsetY}),this.isMove=!0},this.up=e=>{var t,r,n,i;this.isMove=!1,1===e.button||null!=(t=this.events.runScene.helperEx.transContro)&&t.isDraggingChange||(t=e.offsetX,r=e.offsetY,({x:n,y:i}=this.downPosition[e.button]),t===n&&r===i&&(0===e.button?this.trigger(e):this.events.runScene.cb.events.pointer.rightTrigger.cb(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){const t=new r.Raycaster,n=new r.Vector2,{engineDom:i,camera:a,scene:o}=this.events.runScene.assetsEx.get();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}));const s=t.intersectObjects(e,!0);return this.events.runScene.cb.events.pointer.trigger.cb(s),s.map((e=>e.object))}removeHideOrLockModel(e){return e.find((e=>this.events.runScene.modelEx.deepIsVisible(e)&&!Ut.zf.isLock(e,!0)&&ut.selectableModel.is(e)))}trigger(e){let t=this.removeHideOrLockModel(this.getTriggerModels(e));if(this.selectable){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 jt=__webpack_require__(4547),Nt=__webpack_require__(1643),Ht=__webpack_require__(3352);class zt{constructor(e){this.materialMap={},this.textureMap={},this.modelType={Sprite:lt.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,ht.Ni)(String(i)),lights:Ht.ZP.toJSON(this.runScene.lightEx.getLightsByScene()),camera:n.toJSON(),sceneEx:Object.assign(Object.assign({},ft.ZP.toJSON(t)),this._bindSceneTextures(e)),timeLine:this.runScene.timeLineEx.getSavedData(),controls:kt.toJSON(r),objects:this.runScene.objects.toJSON(),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,ct.isTexture)(t.background)||(0,ct.isTexture)(t.environment)){this.runScene.pp.setUpdate(!1);const{background:n,environment:i}=t,a=(this.runScene.pp.setUpdate(!0),(0,ut.createDefModel)("Box")),o=(0,dt.createDefMaterial)();a.material=o,e.add(a),t=o.userData.id,r.materialId=t,this.materialMap[t]={normalMaterial:o,models:[]},(0,ct.isTexture)(n)&&(n.userData.notCompress=!0,303===(o.map=n).mapping&&(r.backgroundMapping=303)),(0,ct.isTexture)(i)&&(i.userData.notCompress=!0,o.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,ut.withAnima)(e)&&(t=e.animations.map((e=>e.toJSON())),(0,ft.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,dt.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,dt.getTexturesByMaterial)(t),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,ct.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,ct.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;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:a,center:o,rotation:s,offset:l}=n;const e={format:r};this.runScene.modelEx.isNavieV2(a,1)||(({x:r,y:i}=a),e.repeat=r===i?r:a),this.runScene.modelEx.isNavieV2(o,0)||(({x:i,y:r}=o),e.center=i===r?i:o),this.runScene.modelEx.isNavieV2(l,0)||(({x:a,y:r}=l),e.offset=a===r?a: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,dt.createDefMaterial)();r.material=n,e.add(r);for(const e of Nt.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,dt.createDefMaterial)()),this.geoDefMaterialMap.get(e)):this.runScene.materialEx.defMaterial}}var Vt=__webpack_require__(5244);class Jt 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,Vt.K)(e);e.material&&e.geometry&&((t=this.getSameNode(e))&&(0,ut.setClonedModel)(e,t.id),this.savedMap.set(r,{id:r,geometryUuid:e.geometry.uuid,materialUuid:e.material.uuid}))}parseClonedModel(e){var t=(0,ut.getClonedIdModel)(e),r=(0,Vt.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,Vt.K)(e),n.newId=t),n.newId&&(n.newId!==r?(0,ut.setClonedModel)(e,n.newId):(0,ut.delClonedModel)(e)))}parseNode(e){(0,ut.getClonedIdModel)(e)?this.parseClonedModel(e):this.parseUnClonedModel(e)}}class Kt{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: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,ht.F1)([...r.array],[...a.array],20),o=(0,ht.F1)([...n.array],[...o.array],20),s=(0,ht.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;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 Zt{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 Wt{constructor(e){this.helperModels=[],this.mergeSameGeo=new Kt;var{type:e,runScene:t,model:r}=e;this.runScene=t,this.type=e,this.bindClondId=new Jt(t),this.ex={materialMap:{},textureMap:{},type:e},this.before=new zt({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,ct.isClonedTexture)(t)&&(r.cloneSourceId=(0,ct.getCloneIdFromTexture)(t)),r.format=t.userData.format,(0,ct.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 Xt(){Xt=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=(f="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",i=f.asyncIterator||"@@asyncIterator",a=f.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 f,p,m=(o(f={},n,(function(){return this})),(p=(p=Object.getPrototypeOf)&&p(p(w([]))))&&p!==t&&r.call(p,n)&&(f=p),d.prototype=c.prototype=Object.create(f));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"==Yt(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 Qt(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 Yt(e){return(Yt="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 qt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $t(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 er(e,t,r){t&&$t(e.prototype,t),r&&$t(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var tr=function(){function e(){qt(this,e),this.pluginCallbacks=[],this.register((function(e){return new br(e)})),this.register((function(e){return new xr(e)})),this.register((function(e){return new wr(e)})),this.register((function(e){return new Sr(e)})),this.register((function(e){return new Mr(e)})),this.register((function(e){return new Ar(e)}))}return er(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"===Yt(r)&&(console.warn("THREE.GLTFExporter: parse() expects options as the fourth argument now."),n=r);for(var i=new yr,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}(),rr=5121,nr=5123,ir=(j=9728,9729),ar=9984,or=9985,sr=9986,lr=9987,ur=33071,cr=33648,hr=10497,dr={},fr=(dr[r.NearestFilter]=j,dr[r.NearestMipmapNearestFilter]=ar,dr[r.NearestMipmapLinearFilter]=sr,dr[r.LinearFilter]=ir,dr[r.LinearMipmapNearestFilter]=or,dr[r.LinearMipmapLinearFilter]=lr,dr[r.ClampToEdgeWrapping]=ur,dr[r.RepeatWrapping]=hr,dr[r.MirroredRepeatWrapping]=cr,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"});function pr(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function mr(e){return 4*Math.ceil(e/4)}function vr(e,t){var r=1<arguments.length&&void 0!==t?t:0,n=mr(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 gr=null,yr=function(){function e(){qt(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 er(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=Xt().mark((function e(t,r,n){var i,a,o,s,l,u,c;return Xt().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=vr(u.result),t=new DataView(new ArrayBuffer(8)),n=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),vr(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){Qt(a,n,i,o,s,"next",e)}function s(e){Qt(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 f=s.getImageData(0,0,e,a).data,p=2;p<f.length;p+=4)l.data[p]=f[p]}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===rr?1:t===nr?2:4,mr(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===nr?l.setUint16(u,d,!0):t===rr&&l.setUint8(u,d),u+=a}var f={buffer:this.processBuffer(l.buffer),byteOffset:this.byteOffset,byteLength:s};return void 0!==i&&(f.target=i),34962===i&&(f.byteStride=e.itemSize*a),this.byteOffset+=s,o.bufferViews.push(f),{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=vr(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=this.options,o=this.json;if(e.array.constructor===Float32Array)i=5126;else if(e.array.constructor===Uint32Array)i=5125;else if(e.array.constructor===Uint16Array)i=nr;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");i=rr}if(void 0===r&&(r=0),void 0===n&&(n=e.count),a.truncateDrawRange&&void 0!==t&&null===t.index&&(a=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(a,l)-r)<0&&(n=0)),0===n)return null;a=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);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:a.max,min:a.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]},!0===e.normalized&&(t.normalized=!0),o.accessors||(o.accessors=[]),o.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!=(f=i.userData)&&f.blob&&(null==i||null==(f=i.userData)?void 0:f.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=gr=gr||document.createElement("canvas"),f=(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)f.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 p=new Uint8ClampedArray(e.height*e.width*4),m=0;m<p.length;m+=4)p[m+0]=e.data[m+0],p[m+1]=e.data[m+1],p[m+2]=e.data[m+2],p[m+3]=e.data[m+3];f.putImageData(new ImageData(p,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:dr[e.magFilter],minFilter:dr[e.minFilter],wrapS:dr[e.wrapS],wrapT:dr[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=(pr((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,f={},p={},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))?p[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))&&(p[h]=d,t.attributes.set(this.getUID(c),d))));if(void 0!==y&&l.setAttribute("normal",y),0===Object.keys(p).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 C,B={},_=!1;for(C in l.morphAttributes)if("position"!==C&&"normal"!==C)_||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),_=!0);else{var E=l.morphAttributes[C][M],T=C.toUpperCase(),D=l.attributes[C];if(t.attributes.has(this.getUID(E)))B[T]=t.attributes.get(this.getUID(E));else{var P=E.clone();if(!l.morphTargetsRelative)for(var O=0,k=E.count;O<k;O++)P.setXYZ(O,E.getX(O)-D.getX(O),E.getY(O)-D.getY(O),E.getZ(O)-D.getZ(O));B[T]=this.processAccessor(P,l),t.attributes.set(this.getUID(D),B[T])}}v.push(B),x.push(e.morphTargetInfluences[M]),void 0!==e.morphTargetDictionary&&w.push(A[M])}f.weights=x,0<w.length&&(f.extras={},f.extras.targetNames=w)}if((y=Array.isArray(e.material))&&0===l.groups.length)return null;for(var R=y?e.material:[e.material],I=y?l.groups:[{materialIndex:0,start:void 0,count:void 0}],L=0,F=I.length;L<F;L++){var U={mode:u,attributes:p},G=(this.serializeUserData(l,U),0<v.length&&(U.targets=v),null!==l.index&&(G=this.getUID(l.index),void 0===I[L].start&&void 0===I[L].count||(G+=":"+I[L].start+":"+I[L].count),t.attributes.has(G)?U.indices=t.attributes.get(G):(U.indices=this.processAccessor(l.index,l,I[L].start,I[L].count),t.attributes.set(G,U.indices)),null===U.indices&&delete U.indices),this.processMaterial(R[I[L].materialIndex]));null!==G&&(U.material=G),m.push(U)}return f.primitives=m,n.meshes||(n.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,f)})),y=n.meshes.push(f)-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=tr.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=fr[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 f=void(d===fr.morphTargetInfluences&&(c/=h.morphTargetInfluences.length));!0===u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(f="CUBICSPLINE",c/=3):f=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:f}),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(),pr(r,[0,0,0,1])||(o.rotation=r),pr(d,[0,0,0])||(o.translation=d),pr(t,[1,1,1])||(o.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===pr(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}(),br=function(){function e(t){qt(this,e),this.writer=t,this.name="KHR_lights_punctual"}return er(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}(),xr=function(){function e(t){qt(this,e),this.writer=t,this.name="KHR_materials_unlit"}return er(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}(),wr=function(){function e(t){qt(this,e),this.writer=t,this.name="KHR_materials_pbrSpecularGlossiness"}return er(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}(),Ar=function(){function e(t){qt(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return er(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}(),Sr=function(){function e(t){qt(this,e),this.writer=t,this.name="KHR_materials_transmission"}return er(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}(),Mr=function(){function e(t){qt(this,e),this.writer=t,this.name="KHR_materials_volume"}return er(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 Cr(){Cr=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=(f="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",i=f.asyncIterator||"@@asyncIterator",a=f.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 f,p,m=(o(f={},n,(function(){return this})),(p=(p=Object.getPrototypeOf)&&p(p(w([]))))&&p!==t&&r.call(p,n)&&(f=p),d.prototype=c.prototype=Object.create(f));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"==_r(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 Br(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 _r(e){return(_r="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 Er(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Tr(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&&Tr(e.prototype,t),r&&Tr(e,r),Object.defineProperty(e,"prototype",{writable:!1})}tr.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 f=new((d=s.clone()).ValueBufferType)(c*d.times.length),p=0;p<d.times.length;p++)f[p*c+h]=d.values[p];d.name=(l.nodeName||"")+".morphTargetInfluences",d.values=f,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 Pr=function(){function e(){Er(this,e),this.pluginCallbacks=[],this.register((function(e){return new Hr(e)})),this.register((function(e){return new zr(e)})),this.register((function(e){return new Vr(e)})),this.register((function(e){return new Kr(e)})),this.register((function(e){return new Zr(e)})),this.register((function(e){return new Jr(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"===_r(r)&&(console.warn("THREE.GLTFExporter: parse() expects options as the fourth argument now."),n=r);for(var i=new Nr,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}(),Or=5121,kr=5123,Rr=(j=9728,ar=9729,sr=9984,ir=9985,or=9986,lr=9987,ur=33071,hr=33648,cr=10497,{}),Ir=(Rr[r.NearestFilter]=j,Rr[r.NearestMipmapNearestFilter]=sr,Rr[r.NearestMipmapLinearFilter]=or,Rr[r.LinearFilter]=ar,Rr[r.LinearMipmapNearestFilter]=ir,Rr[r.LinearMipmapLinearFilter]=lr,Rr[r.ClampToEdgeWrapping]=ur,Rr[r.RepeatWrapping]=cr,Rr[r.MirroredRepeatWrapping]=hr,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"});function Lr(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function Fr(e){return 4*Math.ceil(e/4)}function Ur(e,t){var r=1<arguments.length&&void 0!==t?t:0,n=Fr(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 Gr=null;function jr(){return Gr=Gr||("undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"))}var Nr=function(){function e(){Er(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=Cr().mark((function e(t,r,n){var i,a,o,s,l;return Cr().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=Ur(s.result),t=new DataView(new ArrayBuffer(8)),n=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),Ur((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){Br(a,n,i,o,s,"next",e)}function s(e){Br(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=jr(),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,f=1;f<d.length;f+=4)u.data[f]=d[f]}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===Or?1:t===kr?2:4,Fr(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===kr?l.setUint16(u,d,!0):t===Or&&l.setUint8(u,d),u+=a}var f={buffer:this.processBuffer(l.buffer),byteOffset:this.byteOffset,byteLength:s};return void 0!==i&&(f.target=i),34962===i&&(f.byteStride=e.itemSize*a),this.byteOffset+=s,o.bufferViews.push(f),{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=Ur(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=this.options,o=this.json;if(e.array.constructor===Float32Array)i=5126;else if(e.array.constructor===Uint32Array)i=5125;else if(e.array.constructor===Uint16Array)i=kr;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");i=Or}if(void 0===r&&(r=0),void 0===n&&(n=e.count),a.truncateDrawRange&&void 0!==t&&null===t.index&&(a=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(a,l)-r)<0&&(n=0)),0===n)return null;a=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);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:a.max,min:a.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]},!0===e.normalized&&(t.normalized=!0),o.accessors||(o.accessors=[]),o.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=jr(),f=(d.width=Math.min(e.width,l.maxTextureSize),d.height=Math.min(e.height,l.maxTextureSize),d.getContext("2d"));if(!0===n&&(f.translate(0,d.height),f.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 p=new Uint8ClampedArray(e.height*e.width*4),m=0;m<p.length;m+=4)p[m+0]=e.data[m+0],p[m+1]=e.data[m+1],p[m+2]=e.data[m+2],p[m+3]=e.data[m+3];f.putImageData(new ImageData(p,e.width,e.height),0,0)}else f.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:Rr[e.magFilter],minFilter:Rr[e.minFilter],wrapS:Rr[e.wrapS],wrapT:Rr[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=(Lr(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,f={},p={},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))?p[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))&&(p[h]=d,t.attributes.set(this.getUID(c),d))));if(void 0!==y&&l.setAttribute("normal",y),0===Object.keys(p).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 C,B={},_=!1;for(C in l.morphAttributes)if("position"!==C&&"normal"!==C)_||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),_=!0);else{var E=l.morphAttributes[C][M],T=C.toUpperCase(),D=l.attributes[C];if(t.attributes.has(this.getUID(E)))B[T]=t.attributes.get(this.getUID(E));else{var P=E.clone();if(!l.morphTargetsRelative)for(var O=0,k=E.count;O<k;O++)P.setXYZ(O,E.getX(O)-D.getX(O),E.getY(O)-D.getY(O),E.getZ(O)-D.getZ(O));B[T]=this.processAccessor(P,l),t.attributes.set(this.getUID(D),B[T])}}v.push(B),x.push(e.morphTargetInfluences[M]),void 0!==e.morphTargetDictionary&&w.push(A[M])}f.weights=x,0<w.length&&(f.extras={},f.extras.targetNames=w)}if((y=Array.isArray(e.material))&&0===l.groups.length)return null;for(var R=y?e.material:[e.material],I=y?l.groups:[{materialIndex:0,start:void 0,count:void 0}],L=0,F=I.length;L<F;L++){var U={mode:u,attributes:p},G=(this.serializeUserData(l,U),0<v.length&&(U.targets=v),null!==l.index&&(G=this.getUID(l.index),void 0===I[L].start&&void 0===I[L].count||(G+=":"+I[L].start+":"+I[L].count),t.attributes.has(G)?U.indices=t.attributes.get(G):(U.indices=this.processAccessor(l.index,l,I[L].start,I[L].count),t.attributes.set(G,U.indices)),null===U.indices&&delete U.indices),this.processMaterial(R[I[L].materialIndex]));null!==G&&(U.material=G),m.push(U)}return f.primitives=m,n.meshes||(n.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,f)})),y=n.meshes.push(f)-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=Ir[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 f=void(d===Ir.morphTargetInfluences&&(c/=h.morphTargetInfluences.length));!0===u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(f="CUBICSPLINE",c/=3):f=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:f}),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(),Lr(r,[0,0,0,1])||(o.rotation=r),Lr(h,[0,0,0])||(o.translation=h),Lr(t,[1,1,1])||(o.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===Lr(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}(),Hr=function(){function e(t){Er(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}(),zr=function(){function e(t){Er(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}(),Vr=function(){function e(t){Er(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}(),Jr=function(){function e(t){Er(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){Er(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}(),Zr=function(){function e(t){Er(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}(),Wr=(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 f=new((d=s.clone()).ValueBufferType)(c*d.times.length),p=0;p<d.times.length;p++)f[p*c+h]=d.values[p];d.name=(l.nodeName||"")+".morphTargetInfluences",d.values=f,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 Xr extends V{constructor(){super(...arguments),this._gltf=new tr,this._originGltf=new Pr,this.options=new Zt}getArrayBuffer(e=this.runScene.sceneEx.getClear(),t="scene"){return Wr(this,void 0,void 0,(function*(){const r=new Wt({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 Wr(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 Wr(this,void 0,void 0,(function*(){var t=yield this.getArrayBuffer(e);(0,jt.downloadFile)(new Blob([t]),"scene.glb")}))}model(e){return Wr(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,jt.downloadFile)(new Blob([r]),t+".glb"))}))}material(e){var t;return Wr(this,void 0,void 0,(function*(){if(r=e||(null==(t=this.runScene.modelEx.select)?void 0:t.material)){const e=(0,ut.createDefModel)("Group");let t=r;(t=r instanceof Array?t:[r]).map((t=>{const r=(0,ut.createDefModel)("Box");r.material=t,e.add(r)}));var r=r.name||"material",n=yield this.getArrayBuffer(e,"material");(0,jt.downloadFile)(new Blob([n]),r+".glb")}}))}scene(e=!0){return Wr(this,void 0,void 0,(function*(){this.runScene.cb.exporter.gltf.before.cb(null);var t=yield this.getArrayBuffer();return e&&(0,jt.downloadFile)(new Blob([t]),"scene.glb"),t}))}originModel(e){return Wr(this,void 0,void 0,(function*(){var t,r;e&&(t=e.name||e.type,r=yield this.getOriginArrayBuffer(e),(0,jt.downloadFile)(new Blob([r]),t+".glb"))}))}}class Qr extends V{constructor(e){super(e),this.gltf=new Xr(e)}}var Yr={},qr=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},$r=function(e){return new Worker(e)};try{URL.revokeObjectURL(qr(""))}catch(dn){qr=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)},$r=function(e){return new Worker(e,{type:"module"})}}for(var en=Uint8Array,tn=Uint16Array,rn=Uint32Array,nn=new en([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]),an=new en([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]),on=new en([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),sn=(j=function(e,t){for(var r=new tn(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];var i=new rn(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]},(sr=j(nn,2))[0]),ln=sr[1],un=(sn[28]=258,ln[258]=28,or=j(an,0))[0],cn=or[1],hn=new tn(32768),dn=0;dn<32768;++dn){var fn=(43690&dn)>>>1|(21845&dn)<<1;hn[dn]=((65280&(fn=(61680&(fn=(52428&fn)>>>2|(13107&fn)<<2))>>>4|(3855&fn)<<4))>>>8|(255&fn)<<8)>>>1}var pn=function(e,t,r){for(var n=e.length,i=0,a=new tn(t);i<n;++i)++a[e[i]-1];var o=new tn(t);for(i=0;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;if(r){var s=new tn(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[hn[h]>>>l]=u}else for(s=new tn(n),i=0;i<n;++i)e[i]&&(s[i]=hn[o[e[i]-1]++]>>>15-e[i]);return s},mn=new en(288);for(dn=0;dn<144;++dn)mn[dn]=8;for(dn=144;dn<256;++dn)mn[dn]=9;for(dn=256;dn<280;++dn)mn[dn]=7;for(dn=280;dn<288;++dn)mn[dn]=8;var vn=new en(32);for(dn=0;dn<32;++dn)vn[dn]=5;function gn(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 yn(e,t,r,n,i){var a,o=Wn(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 bn(e,t){return ai(e,t)+4294967296*ai(e,t+4)}var xn=pn(mn,9,0),wn=pn(mn,9,1),An=pn(vn,5,0),Sn=pn(vn,5,1),Mn=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},Cn=function(e,t,r){var n=t/8|0;return(e[n]|e[1+n]<<8)>>(7&t)&r},Bn=function(e,t){var r=t/8|0;return(e[r]|e[1+r]<<8|e[2+r]<<16)>>(7&t)},_n=function(e){return(e/8|0)+(7&e&&1)},En=function(e,t,r){(null==t||t<0)&&(t=0),(null==r||r>e.length)&&(r=e.length);var n=new(e instanceof tn?tn:e instanceof rn?rn:en)(r-t);return n.set(e.subarray(t,r)),n},Tn=function(e,t,r){var n=e.length;if(!n||r&&!r.l&&n<5)return t||new en(0);function i(e){var r=t.length;r<e&&((r=new en(Math.max(2*r,e))).set(t),t=r)}var a=!t||r,o=!r||r.i,s=(r=r||{},t=t||new en(3*n),r.f||0),l=r.p||0,u=r.b||0,c=r.l,h=r.d,d=r.m,f=r.n,p=8*n;do{if(!c){r.f=s=Cn(e,l,1);var m=Cn(e,l+1,3);if(l+=3,!m){var v=e[(C=_n(l)+4)-4]|e[C-3]<<8;if(n<(A=C+v)){if(o)throw"unexpected EOF";break}a&&i(u+v),t.set(e.subarray(C,A),u),r.b=u+=v,r.p=l=8*A;continue}if(1==m)c=wn,h=Sn,d=9,f=5;else{if(2!=m)throw"invalid block type";v=Cn(e,l,31)+257;for(var g=Cn(e,l+10,15)+4,y=v+Cn(e,l+5,31)+1,b=(l+=14,new en(y)),x=new en(19),w=0;w<g;++w)x[on[w]]=Cn(e,l+3*w,7);l+=3*g;var A,S=(1<<(A=Mn(x)))-1,M=pn(x,A,1);for(w=0;w<y;){var C,B=M[Cn(e,l,S)];if(l+=15&B,(C=B>>>4)<16)b[w++]=C;else{var _=0,E=0;for(16==C?(E=3+Cn(e,l,3),l+=2,_=b[w-1]):17==C?(E=3+Cn(e,l,7),l+=3):18==C&&(E=11+Cn(e,l,127),l+=7);E--;)b[w++]=_}}m=b.subarray(0,v);var T=b.subarray(v);d=Mn(m),f=Mn(T),c=pn(m,d,1),h=pn(T,f,1)}if(p<l){if(o)throw"unexpected EOF";break}}a&&i(u+131072);for(var D=(1<<d)-1,P=(1<<f)-1,O=l;;O=l){var k=(_=c[Bn(e,l)&D])>>>4;if(p<(l+=15&_)){if(o)throw"unexpected EOF";break}if(!_)throw"invalid length/literal";if(k<256)t[u++]=k;else{if(256==k){O=l,c=null;break}var R,I=k-254,L=(264<k&&(R=nn[w=k-257],I=Cn(e,l,(1<<R)-1)+sn[w],l+=R),(k=h[Bn(e,l)&P])>>>4);if(!k)throw"invalid distance";if(l+=15&k,T=un[L],3<L&&(R=an[L],T+=Bn(e,l)&(1<<R)-1,l+=R),p<l){if(o)throw"unexpected EOF";break}a&&i(u+131072);for(var F=u+I;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=f)}while(!s);return u==t.length?t:En(t,0,u)},Dn=function(e,t,r){var n=t/8|0;e[n]|=r<<=7&t,e[1+n]|=r>>>8},Pn=function(e,t,r){var n=t/8|0;e[n]|=r<<=7&t,e[1+n]|=r>>>8,e[2+n]|=r>>>16},On=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[Gn,0];if(1==i)return(m=new en(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 tn(h+1),f=kn(r[u-1],d,0);if(t<f){n=0;var p=0,m=f-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;p+=v-(1<<f-d[g]),d[g]=t}for(p>>>=m;0<p;){var y=a[n].s;d[y]<t?p-=1<<t-d[y]++-1:++n}for(;0<=n&&p;--n){var b=a[n].s;d[b]==t&&(--d[b],++p)}f=t}return[new en(d),f]},kn=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},Rn=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new tn(++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]},In=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},Ln=function(e,t,r){var n=r.length,i=_n(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)},Fn=function(e,t,r,n,i,a,o,s,l,u,c){Dn(t,c++,r),++i[256];for(var h=(r=On(i,15))[0],d=(r=r[1],(f=On(a,15))[0]),f=f[1],p=(m=Rn(h))[0],m=m[1],v=(g=Rn(d))[0],g=g[1],y=new tn(19),b=0;b<p.length;++b)y[31&p[b]]++;for(b=0;b<v.length;++b)y[31&v[b]]++;for(var x=(w=On(y,7))[0],w=w[1],A=19;4<A&&!x[on[A-1]];--A);var S,M=u+5<<3,C=In(i,mn)+In(a,vn)+o;if(i=In(i,h)+In(a,d)+o+14+3*A+In(y,x)+(2*y[16]+3*y[17]+7*y[18]),M<=C&&M<=i)return Ln(t,c,e.subarray(l,l+u));if(Dn(t,c,1+(i<C)),c+=2,i<C){var B=pn(h,r,0),_=h,E=pn(d,f,0),T=d,D=pn(x,w,0);for(Dn(t,c,m-257),Dn(t,c+5,g-1),Dn(t,c+10,A-4),c+=14,b=0;b<A;++b)Dn(t,c+3*b,x[on[b]]);c+=3*A;for(var P=[p,v],O=0;O<2;++O){var k=P[O];for(b=0;b<k.length;++b){var R=31&k[b];Dn(t,c,D[R]),c+=x[R],15<R&&(Dn(t,c,k[b]>>>5&127),c+=k[b]>>>12)}}}else B=xn,_=mn,E=An,T=vn;for(b=0;b<s;++b)255<n[b]?(R=n[b]>>>18&31,Pn(t,c,B[R+257]),c+=_[R+257],7<R&&(Dn(t,c,n[b]>>>23&31),c+=nn[R]),S=31&n[b],Pn(t,c,E[S]),c+=T[S],3<S&&(Pn(t,c,n[b]>>>5&8191),c+=an[S])):(Pn(t,c,B[n[b]]),c+=_[n[b]]);return Pn(t,c,B[256]),c+_[256]},Un=new rn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Gn=new en(0),jn=function(e,t,r,n,i,a){var o=e.length,s=new en(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?Ln(l,u,e.subarray(c,h)):(l[c]=a,Ln(l,u,e.subarray(c,o)))}else{for(var d=(t=Un[t-1])>>>13,f=8191&t,p=(1<<r)-1,m=new tn(32768),v=new tn(1+p),g=Math.ceil(r/3),y=2*g,b=function(t){return(e[t]^e[t+1]<<g^e[t+2]<<y)&p},x=new rn(25e3),w=new tn(288),A=new tn(32),S=0,M=0,C=(c=0,0),B=0,_=0;c<o;++c){var E=b(c),T=32767&c,D=v[E];if(m[T]=D,v[E]=T,B<=c){var P=o-c;if((7e3<S||24576<C)&&423<P){u=Fn(e,l,0,x,w,A,M,C,_,c-_,u),C=S=M=0,_=c;for(var O=0;O<286;++O)w[O]=0;for(O=0;O<30;++O)A[O]=0}var k=2,R=0,I=f,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&&--I&&T!=D;){if(e[c+k]==e[c+k-L]){for(var j=0;j<G&&e[c+j]==e[c+j-L];++j);if(k<j){if(R=L,F<(k=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}R?(x[C++]=268435456|ln[k]<<18|cn[R],E=31&ln[k],P=31&cn[R],M+=nn[E]+an[P],++w[257+E],++A[P],B=c+k,++S):(x[C++]=e[c],++w[e[c]])}}u=Fn(e,l,a,x,w,A,M,C,_,c-_,u),!a&&7&u&&(u=Ln(l,u+1,Gn))}return En(s,0,n+_n(u)+i)},Nn=function(){for(var e=new rn(256),t=0;t<256;++t){for(var r=t,n=9;--n;)r=(1&r&&3988292384)^r>>>1;e[t]=r}return e}(),Hn=function(){var e=-1;return{p:function(t){for(var r=e,n=0;n<t.length;++n)r=Nn[255&r^t[n]]^r>>>8;e=r},d:function(){return~e}}},zn=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}}},Vn=function(e,t,r,n,i){return jn(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)},Jn=function(e,t){var r,n={};for(r in e)n[r]=e[r];for(r in t)n[r]=t[r];return n},Kn=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]},Zn=[],Wn=function(e,t,r,n){var i;if(!Zn[r]){for(var a="",o={},s=e.length-1,l=0;l<s;++l)a=(i=Kn(e[l],a,o))[0],o=i[1];Zn[r]=Kn(e[s],a,o)}var u=Jn({},Zn[r][1]);return function(e,t,r,n,i){return(t=$r(Yr[t]||(Yr[t]=qr(e)))).onerror=function(e){return i(e.error,null)},t.onmessage=function(e){return i(null,e.data)},t.postMessage(r,n),t}(Zn[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 en||e[t]instanceof tn||e[t]instanceof rn)&&r.push((e[t]=new e[t].constructor(e[t])).buffer);return r}(u),n)},Xn=function(){return[en,tn,rn,nn,an,on,sn,un,wn,Sn,hn,pn,Mn,Cn,Bn,_n,En,Tn,wi,ti,ri]},Qn=function(){return[en,tn,rn,nn,an,on,ln,cn,xn,mn,An,vn,hn,Un,Gn,pn,Dn,Pn,On,kn,Rn,In,Ln,Fn,_n,En,jn,Vn,gi,ti]},Yn=function(){return[si,ci,oi,Hn,Nn]},qn=function(){return[li,ui]},$n=function(){return[hi,oi,zn]},ei=function(){return[di]},ti=function(e){return postMessage(e,[e.buffer])},ri=function(e){return e&&e.size&&new en(e.size)},ni=function(e,t,r,n,i,a){var o=Wn(r,n,i,(function(e,t){o.terminate(),a(e,t)}));return o.postMessage([e,t],t.consume?[e.buffer]:[]),function(){o.terminate()}},ii=function(e,t){return e[t]|e[t+1]<<8},ai=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},oi=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},si=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&&oi(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)}},li=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)},ui=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},ci=function(e){return 10+(e.filename&&e.filename.length+1||0)},hi=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)},di=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 fi(e,t){return t||"function"!=typeof e||(t=e,e={}),this.ondata=t,e}var pi=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(Vn(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}(),mi=function(e,t){yn([Qn,function(){return[gn,pi]}],this,fi.call(this,e,t),(function(e){e=new pi(e.data),onmessage=gn(e)}),6)};function vi(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return ni(e,t,[Qn],(function(e){return ti(gi(e.data[0],e.data[1]))}),0,r)}function gi(e,t){return Vn(e,t||{},0,0)}var yi=function(){function e(e){this.s={},this.p=new en(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 en(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=Tn(this.p,this.o,this.s);this.ondata(En(t,e,this.s.b),this.d),this.o=En(t,this.s.b-32768),this.s.b=this.o.length,this.p=En(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),bi=function(e){this.ondata=e,yn([Xn,function(){return[gn,yi]}],this,0,(function(){var e=new yi;onmessage=gn(e)}),7)};function xi(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return ni(e,t,[Xn],(function(e){return ti(wi(e.data[0],ri(e.data[1])))}),1,r)}function wi(e,t){return Tn(e,t)}var Ai=function(){function e(e,t){this.c=Hn(),this.l=0,this.v=1,pi.call(this,e,t)}return e.prototype.push=function(e,t){pi.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),this.l+=e.length,e=Vn(e,this.o,this.v&&ci(this.o),t&&8,!t),this.v&&(si(e,this.o),this.v=0),t&&(oi(e,e.length-8,this.c.d()),oi(e,e.length-4,this.l)),this.ondata(e,t)},e}(),Si=function(e,t){yn([Qn,Yn,function(){return[gn,pi,Ai]}],this,fi.call(this,e,t),(function(e){e=new Ai(e.data),onmessage=gn(e)}),8)};function Mi(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return ni(e,t,[Qn,Yn,function(){return[Ci]}],(function(e){return ti(Ci(e.data[0],e.data[1]))}),2,r)}function Ci(e,t){t=t||{};var r=Hn(),n=e.length,i=(r.p(e),e=Vn(e,t,ci(t),8)).length;return si(e,t),oi(e,i-8,r.d()),oi(e,i-4,n),e}var Bi=function(){function e(e){this.v=1,yi.call(this,e)}return e.prototype.push=function(e,t){if(yi.prototype.e.call(this,e),this.v){if((e=3<this.p.length?li(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)}yi.prototype.c.call(this,t)},e}(),_i=function(e){this.ondata=e,yn([Xn,qn,function(){return[gn,yi,Bi]}],this,0,(function(){var e=new Bi;onmessage=gn(e)}),9)};function Ei(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return ni(e,t,[Xn,qn,function(){return[Ti]}],(function(e){return ti(Ti(e.data[0]))}),3,r)}function Ti(e,t){return Tn(e.subarray(li(e),-8),t||new en(ui(e)))}var Di=function(){function e(e,t){this.c=zn(),this.v=1,pi.call(this,e,t)}return e.prototype.push=function(e,t){pi.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),e=Vn(e,this.o,this.v&&2,t&&4,!t),this.v&&(hi(e,this.o),this.v=0),t&&oi(e,e.length-4,this.c.d()),this.ondata(e,t)},e}(),Pi=function(e,t){yn([Qn,$n,function(){return[gn,pi,Di]}],this,fi.call(this,e,t),(function(e){e=new Di(e.data),onmessage=gn(e)}),10)};function Oi(e,t){t=t||{};var r=zn();return r.p(e),e=Vn(e,t,2,4),hi(e,t),oi(e,e.length-4,r.d()),e}var ki=function(){function e(e){this.v=1,yi.call(this,e)}return e.prototype.push=function(e,t){if(yi.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)}yi.prototype.c.call(this,t)},e}(),Ri=function(e){this.ondata=e,yn([Xn,ei,function(){return[gn,yi,ki]}],this,0,(function(){var e=new ki;onmessage=gn(e)}),11)};function Ii(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return ni(e,t,[Xn,ei,function(){return[Li]}],(function(e){return ti(Li(e.data[0],ri(e.data[1])))}),5,r)}function Li(e,t){return Tn((di(e),e.subarray(2,-4)),t)}var Fi=function(){function e(e){this.G=Bi,this.I=yi,this.Z=ki,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 en(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}(),Ui=function(){function e(e){this.G=_i,this.I=bi,this.Z=Ri,this.ondata=e}return e.prototype.push=function(e,t){Fi.prototype.push.call(this,e,t)},e}(),Gi=function e(t,r,n,i){for(var a in t){var o=t[a];a=r+a,o instanceof en?n[a]=[o,i]:Array.isArray(o)?n[a]=[o[0],Jn(i,o[1])]:e(o,a+"/",n,i)}},ji="undefined"!=typeof TextEncoder&&new TextEncoder,Ni="undefined"!=typeof TextDecoder&&new TextDecoder,Hi=0;try{Ni.decode(Gn,{stream:!0}),Hi=1}catch(dn){}var zi=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,En(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)}},Vi=function(){function e(e){this.ondata=e,Hi?this.t=new TextDecoder:this.p=Gn}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 en(this.p.length+e.length)).set(this.p),r.set(e,this.p.length),e=zi(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}(),Ji=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(Ki(e),this.d=t||!1)},e}();function Ki(e,t){if(t){for(var r=new en(e.length),n=0;n<e.length;++n)r[n]=e.charCodeAt(n);return r}if(ji)return ji.encode(e);var i=e.length,a=new en(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 en(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 En(a,0,o)}function Zi(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(Ni)return Ni.decode(e);var i=(t=zi(e))[0];if(t[1].length)throw"invalid utf-8 data";return i}function Wi(e){return 1==e?3:e<6?2:9==e?1:0}var Xi=function(e,t){return t+30+ii(e,t+26)+ii(e,t+28)},Qi=function(e,t,r){var n=ii(e,t+28),i=Zi(e.subarray(t+46,t+46+n),!(2048&ii(e,t+8))),a=(n=t+46+n,ai(e,t+20)),o=(a=(r=r&&4294967295==a?Yi(e,n):[a,ai(e,t+24),ai(e,t+42)])[0],r[1]);return r=r[2],[ii(e,t+10),a,o,i,n+ii(e,t+30)+ii(e,t+32),r]},Yi=function(e,t){for(;1!=ii(e,t);t+=4+ii(e,t+2));return[bn(e,t+12),bn(e,t+4),bn(e,t+20)]},qi=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},$i=function(e,t,r,n,i,a,o,s){var l=n.length,u=r.extra,c=s&&s.length,h=qi(u),d=(oi(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(oi(e,t,d<<25|i.getMonth()+1<<21|i.getDate()<<16|i.getHours()<<11|i.getMinutes()<<5|i.getSeconds()>>>1),t+=4,null!=a&&(oi(e,t,r.crc),oi(e,t+4,a),oi(e,t+8,r.size)),oi(e,t+12,l),oi(e,t+14,h),t+=16,null!=o&&(oi(e,t,c),oi(e,t+6,r.attrs),oi(e,t+10,o),t+=14),e.set(n,t),t+=l,h)for(var f in u){var p=u[f],m=p.length;oi(e,t,+f),oi(e,t+2,m),e.set(p,t+4),t+=4+m}return c&&(e.set(s,t),t+=c),t},ea=function(e,t,r,n,i){oi(e,t,101010256),oi(e,t+8,r),oi(e,t+10,r),oi(e,t+12,n),oi(e,t+16,i)},ta=function(){function e(e){this.filename=e,this.c=Hn(),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}(),ra=function(){function e(e,t){var r=this;t=t||{},ta.call(this,e),this.d=new pi(t,(function(e,t){r.ondata(null,e,t)})),this.compression=8,this.flag=Wi(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){ta.prototype.push.call(this,e,t)},e}(),na=function(){function e(e,t){var r=this;t=t||{},ta.call(this,e),this.d=new mi(t,(function(e,t,n){r.ondata(e,t,n)})),this.compression=8,this.flag=Wi(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){ta.prototype.push.call(this,e,t)},e}(),ia=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=Ki(e.filename),n=r.length,i=(a=e.comment)&&Ki(a),a=n!=e.filename.length||i&&a.length!=i.length,o=n+qi(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 en(o);var l=($i(n,0,e,r,a),[n]),u=this.d,c=(this.d=0,this.u.length),h=Jn(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 en(16),oi(r,0,134695760),oi(r,4,e.crc),oi(r,8,d),oi(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+qi(l.extra)+(l.o?l.o.length:0);for(var a=new en(r+22),o=0,s=this.u;o<s.length;o++){var l=s[o];$i(a,e,l,l.f,l.u,l.c,t,l.o),e+=46+l.f.length+qi(l.extra)+(l.o?l.o.length:0),t+=l.b}ea(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}(),aa=function(){function e(){}return e.prototype.push=function(e,t){this.ondata(null,e,t)},e.compression=0,e}(),oa=function(){function e(){var e=this;this.i=new yi((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}(),sa=function(){function e(e,t){var r=this;t<32e4?this.i=new yi((function(e,t){r.ondata(null,e,t)})):(this.i=new bi((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=En(e,0)),this.i.push(e,t)},e.compression=8,e}(),la=function(){function e(e){this.onfile=e,this.k=[],this.o={0:aa},this.p=Gn}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 en(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,f,p,m,v,g,y,b=ai(l,o);return 67324752==b?(a=1,s=o,h.d=null,h.c=0,n=ii(l,o+6),e=ii(l,o+8),t=2048&n,n&=8,i=ii(l,o+26),d=ii(l,o+28),o+30+i+d<u&&(h.k.unshift(f=[]),a=2,p=ai(l,o+18),m=ai(l,o+22),v=Zi(l.subarray(o+30,o+=30+i),!t),4294967295==p?(i=n?[-2]:Yi(l,o),p=i[0],m=i[1]):n&&(p=-1),o+=d,h.c=p,y={name:v,compression:e,start:function(){if(!y.ondata)throw"no callback";if(p){var t=r.o[e];if(!t)throw"unknown compression type "+e;(g=p<0?new t(v):new t(v,p,m)).ondata=function(e,t,r){y.ondata(e,t,r)};for(var n=0,i=f;n<i.length;n++)g.push(i[n],!1);r.k[0]==f&&r.c?r.d=g:g.push(Gn,!0)}else y.ondata(null,Gn,!0)},terminate:function(){g&&g.terminate&&g.terminate()}},0<=p&&(y.size=p,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=Gn,c<0&&(n=a?l.subarray(0,s-12-(-2==c&&8)-(134695760==ai(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 ua(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 ca(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 ha(e,t,n,i,a){for(var o=a<e?a:e,s=[],l=ua(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),f=1;f<=r;++f){h[f]=t-i[e+1-f],d[f]=i[e+f]-t;for(var p=0,m=0;m<f;++m){var v=d[m+1],g=h[f-m],y=(u[f][m]=v+g,u[m][f-1]/u[f][m]);u[m][f]=p+v*y,p=g*y}u[f][f]=p}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 C=S[0][0]=1;C<=n;++C){var B=0,_=x-C,E=r-C;C<=x&&(S[A][0]=S[w][0]/u[1+E][_],B=S[A][0]*u[_][E]);for(var T=x-1<=E?C-1:r-x,D=-1<=_?1:-_;D<=T;++D)S[A][D]=(S[w][D]-S[w][D-1])/u[1+E][_+D],B+=S[A][D]*u[_+D][E];x<=E&&(S[A][C]=-S[w][C-1]/u[1+E][x],B+=S[A][C]*u[x][E]),s[C][x]=B;var P=w;w=A,A=P}}for(var O=r,k=1;k<=n;++k){for(var R=0;R<=r;++R)s[k][R]*=O;O*=r-k}return s}(l,i,e,o,t),c=[],h=0;h<n.length;++h){var d=n[h].clone(),f=d.w;d.x*=f,d.y*=f,d.z*=f,c[h]=d}for(var p=0;p<=o;++p){for(var m=c[l-e].clone().multiplyScalar(u[p][0]),v=1;v<=e;++v)m.add(c[l-e+v].clone().multiplyScalar(u[p][v]));s[p]=m}for(var g=o+1;g<=a+1;++g)s[g]=new r.Vector4(0,0,0);return s}function da(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 fa(e){return(fa="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 pa(e,t){return(pa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function ma(e){return(ma=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var va,ga,ya,ba=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&&pa(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=ma(e);if(r=t?(r=ma(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===fa(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=ua(e,i,t),o=ca(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]),da(ha(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 xa(e){return(xa="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 wa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Aa(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 Sa(e,t,r){t&&Aa(e.prototype,t),r&&Aa(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function Ma(e,t){return(Ma=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Ca(e){return(Ca=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ba=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&&Ma(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=Ca(e);if(r=t?(r=Ca(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===xa(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 wa(this,i),n.call(this,e)}return Sa(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===za(n,0,i.length))va=(new Pa).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=za(e)))throw new Error("THREE.FBXLoader: Unknown format.");if(Ra(n)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Ra(n));va=(new Da).parse(n)}var n,i=new r.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new _a(i,this.manager).parse(va)}}]),i}(r.Loader),_a=function(){function e(t,r){wa(this,e),this.textureLoader=t,this.manager=r}return Sa(e,[{key:"parse",value:function(){ga=this.parseConnections();var e=this.parseImages(),t=(e=this.parseTextures(e),e=this.parseMaterials(e),this.parseDeformers()),r=(new Ea).parse(t);return this.parseScene(t,r,e),ya}},{key:"parseConnections",value:function(){var e=new Map;return"Connections"in va&&va.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 va.Objects){var n,i=va.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];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 va.Objects){var r,n=va.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=ga.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 va.Objects){var r,n=va.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"===xa(o)&&(o=o.value),!ga.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 ga.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 va.Objects&&t in va.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=ga.get(t).children[0].ID),e.get(t)}},{key:"parseDeformers",value:function(){var e={},t={};if("Deformer"in va.Objects){var r,n=va.Objects.Deformer;for(r in n){var i,a=n[r],o=ga.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=ga.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){ya=new r.Group;var i=this.parseModels(e.skeletons,t,n),a=va.Objects.Model,o=this;i.forEach((function(e){var t=a[e.ID];o.setLookAtProperties(e,t),ga.get(e.ID).parents.forEach((function(t){void 0!==(t=i.get(t.ID))&&t.add(e)})),null===e.parent&&ya.add(e)})),this.bindSkeleton(e.skeletons,t,i),this.createAmbientLight(),ya.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=ja(e.userData.transformData),e.applyMatrix4(t),e.updateWorldMatrix())})),n=(new Ta).parse(),1===ya.children.length&&ya.children[0].isGroup&&(ya.children[0].animations=n,ya=ya.children[0]),ya.animations=n}},{key:"parseModels",value:function(e,t,n){var i,a=new Map,o=va.Objects.Model;for(i in o){var s=parseInt(i),l=o[i],u=ga.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=va.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=va.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?Na(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&&ga.get(e.ID).children.forEach((function(t){"LookAtProperty"===t.relationship&&"Lcl_Translation"in(t=va.Objects.Model[t.ID])&&(t=t.Lcl_Translation.value,void 0!==e.target?(e.target.position.fromArray(t),ya.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];ga.get(parseInt(o.ID)).parents.forEach((function(e){t.has(e.ID)&&(e=e.ID,ga.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 va.Objects){var t,n,i=va.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 va&&"AmbientColor"in va.GlobalSettings&&(n=(t=va.GlobalSettings.AmbientColor.value)[0],e=t[1],t=t[2],0===n&&0===e&&0===t||(n=new r.Color(n,e,t),ya.add(new r.AmbientLight(n,1))))}}]),e}(),Ea=function(){function e(){wa(this,e)}return Sa(e,[{key:"parse",value:function(e){var t=new Map;if("Geometry"in va.Objects){var r,n=va.Objects.Geometry;for(r in n){var i=ga.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 va.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=o[0],o={},"RotationOrder"in e&&(o.eulerOrder=Na(e.RotationOrder.value)),"InheritType"in e&&(o.inheritType=parseInt(e.InheritType.value)),"GeometricTranslation"in e&&(o.translation=e.GeometricTranslation.value),"GeometricRotation"in e&&(o.rotation=e.GeometricRotation.value),"GeometricScaling"in e&&(o.scale=e.GeometricScaling.value),e=ja(o),this.genGeometry(t,n,a,e)}},{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,f){var p,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=Fa(f,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=Fa(f,r,d,e.normal),o.push(g[0],g[1],g[2])),e.material&&"AllSame"!==e.material.mappingType&&(p=Fa(f,r,d,e.material)[0]),e.uv&&e.uv.forEach((function(e,t){e=Fa(f,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,p,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=va.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===ba)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 ba(n,t,i,l,u).getPoints(12*i.length),(new r.BufferGeometry).setFromPoints(e)}}]),e}(),Ta=function(){function e(){wa(this,e)}return Sa(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!==va.Objects.AnimationCurve)return e=this.parseAnimationCurveNodes(),this.parseAnimationCurves(e),e=this.parseAnimationLayers(e),this.parseAnimStacks(e)}},{key:"parseAnimationCurveNodes",value:function(){var e,t=va.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=va.Objects.AnimationCurve;for(t in r){var n,i={id:r[t].id,times:r[t].KeyTime.a.map(Ia),values:r[t].KeyValueFloat.a},a=ga.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=va.Objects.AnimationLayer,i=new Map;for(t in n)!function(t){var n=[],a=ga.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=ga.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID;if(void 0!==o){var s=va.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]};ya.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=ga.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,t=ga.get(o).parents[0].ID,t=ga.get(t).parents[0].ID,t=ga.get(t).parents[0].ID,t={modelName:(t=va.Objects.Model[t]).attrName?r.PropertyBinding.sanitizeNodeName(t.attrName):"",morphName:va.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=va.Objects.AnimationStack,n={};for(t in r){var i=(1<(i=ga.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=ya.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=Va(e.times,t,u),e.values=Va(e.values,t,c)}}}}]),e}(),Da=function(){function e(){wa(this,e)}return Sa(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,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=Ha(t))}}},{key:"parseNodePropertyContinued",value:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=Ha(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=Ha(s)}this.getPrevNode()[n]={type:i,type2:a,flag:o,value:s},this.setCurrentProp(this.getPrevNode(),n)}}]),e}(),Pa=function(){function t(){wa(this,t)}return Sa(t,[{key:"parse",value:function(e){var t=new Oa(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(),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=Li(new Uint8Array(t.getArrayBuffer(a)));var o=new Oa(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)}default:throw new Error("THREE.FBXLoader: Unknown property type "+r)}}}]),t}(),Oa=function(){function e(t,r){wa(this,e),this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===r||r}return Sa(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(){wa(this,e)}return Sa(e,[{key:"add",value:function(e,t){this[e]=t}}]),e}();function Ra(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 Ia(e){return e/46186158e3}var La=[];function Fa(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=La,l=n.buffer,u=o,c=a,h=0;c<u;c++,h++)s[h]=l[c];return s}var Ua=new r.Euler,Ga=new r.Vector3;function ja(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,f=new r.Matrix4,p=e.inheritType||0,m=(e.translation&&t.setPosition(Ga.fromArray(e.translation)),e.preRotation&&((m=e.preRotation.map(r.MathUtils.degToRad)).push(e.eulerOrder),n.makeRotationFromEuler(Ua.fromArray(m))),e.rotation&&((m=e.rotation.map(r.MathUtils.degToRad)).push(e.eulerOrder),i.makeRotationFromEuler(Ua.fromArray(m))),e.postRotation&&((m=e.postRotation.map(r.MathUtils.degToRad)).push(e.eulerOrder),a.makeRotationFromEuler(Ua.fromArray(m)),a.invert()),e.scale&&o.scale(Ga.fromArray(e.scale)),e.scalingOffset&&l.setPosition(Ga.fromArray(e.scalingOffset)),e.scalingPivot&&s.setPosition(Ga.fromArray(e.scalingPivot)),e.rotationOffset&&u.setPosition(Ga.fromArray(e.rotationOffset)),e.rotationPivot&&c.setPosition(Ga.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===p?y.copy(e).multiply(m).multiply(v).multiply(g):1===p?y.copy(e).multiply(v).multiply(m).multiply(g):(p=(new r.Matrix4).scale((new r.Vector3).setFromMatrixScale(d)).clone().invert(),d=v.clone().multiply(p),y.copy(e).multiply(m).multiply(d).multiply(g)),v=c.clone().invert(),p=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(p),m=(new r.Matrix4).copyPosition(e),d=h.clone().multiply(m),f.copyPosition(d),(e=f.clone().multiply(y)).premultiply(h.invert()),e}function Na(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 Ha(e){return e.split(",").map((function(e){return parseFloat(e)}))}function za(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=e.byteLength),r.LoaderUtils.decodeText(new Uint8Array(e,t,n))}function Va(e,t,r){return e.slice(0,t).concat(r).concat(e.slice(t))}function Ja(e){return(Ja="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 Ka(e,t){return(Ka=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Za(e){return(Za=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Wa=/^[og]\s*(.+)?/,Xa=/^mtllib /,Qa=/^usemtl /,Ya=/^usemap /,qa=new r.Vector3,$a=new r.Vector3,eo=new r.Vector3,to=new r.Vector3,ro=new r.Vector3,no=new r.Color;function io(){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;qa.fromArray(n,e),$a.fromArray(n,t),eo.fromArray(n,r),ro.subVectors(eo,$a),to.subVectors(qa,$a),ro.cross(to),ro.normalize(),i.push(ro.x,ro.y,ro.z),i.push(ro.x,ro.y,ro.z),i.push(ro.x,ro.y,ro.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 ao=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&&Ka(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=Za(e);if(r=t?(r=Za(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Ja(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,n,i,a=new io,o=(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=o.length;c<h;c++)if(s=o[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":a.vertices.push(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3])),7<=d.length?(no.setRGB(parseFloat(d[4]),parseFloat(d[5]),parseFloat(d[6])).convertSRGBToLinear(),a.colors.push(no.r,no.g,no.b)):a.colors.push(void 0,void 0,void 0);break;case"vn":a.normals.push(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3]));break;case"vt":a.uvs.push(parseFloat(d[1]),parseFloat(d[2]))}}else if("f"===t){for(var f=s.slice(1).trim().split(/\s+/),p=[],m=0,v=f.length;m<v;m++){var g=f[m];0<g.length&&(g=g.split("/"),p.push(g))}for(var y=p[0],b=1,x=p.length-1;b<x;b++){var w=p[b],A=p[b+1];a.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(" "),M=[],C=[];if(-1===s.indexOf("/"))M=S;else for(var B=0,_=S.length;B<_;B++){var E=S[B].split("/");""!==E[0]&&M.push(E[0]),""!==E[1]&&C.push(E[1])}a.addLineGeometry(M,C)}else"p"===t?(n=s.slice(1).trim().split(" "),a.addPointGeometry(n)):null!==(l=Wa.exec(s))?(n=(" "+l[0].slice(1).trim()).slice(1),a.startObject(n)):Qa.test(s)?a.object.startMaterial(s.substring(7).trim(),a.materialLibraries):Xa.test(s)?a.materialLibraries.push(s.substring(7).trim()):Ya.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(),a.object.smooth="0"!==i&&"off"!==i):a.object.smooth=!0,(i=a.object.currentMaterial())&&(i.smooth=a.object.smooth)):"\0"!==s&&console.warn('THREE.OBJLoader: Unexpected line: "'+s+'"');a.finalize();var T,D=new r.Group;if(1==(D.materialLibraries=[].concat(a.materialLibraries),e=!(1===a.objects.length&&0===a.objects[0].geometry.vertices.length)))for(var P=0,O=a.objects.length;P<O;P++){var k=a.objects[P],R=k.geometry,I=k.materials,L="Line"===R.type,F="Points"===R.type,U=!1;if(0!==R.vertices.length){for(var G=new r.BufferGeometry,j=(G.setAttribute("position",new r.Float32BufferAttribute(R.vertices,3)),0<R.normals.length&&G.setAttribute("normal",new r.Float32BufferAttribute(R.normals,3)),0<R.colors.length&&(U=!0,G.setAttribute("color",new r.Float32BufferAttribute(R.colors,3))),!0===R.hasUVIndices&&G.setAttribute("uv",new r.Float32BufferAttribute(R.uvs,2)),[]),N=0,H=I.length;N<H;N++){var z,V=I[N],J=V.name+"_"+V.smooth+"_"+U,K=a.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,a.materials[J]=K),j.push(K)}if(R=void 0,1<j.length){for(var Z=0,W=I.length;Z<W;Z++){var X=I[Z];G.addGroup(X.groupStart,X.groupCount,Z)}R=new(L?r.LineSegments:F?r.Points:r.Mesh)(G,j)}else R=new(L?r.LineSegments:F?r.Points:r.Mesh)(G,j[0]);R.name=k.name,D.add(R)}}else 0<a.vertices.length&&(e=new r.PointsMaterial({size:1,sizeAttenuation:!1}),(T=new r.BufferGeometry).setAttribute("position",new r.Float32BufferAttribute(a.vertices,3)),0<a.colors.length&&void 0!==a.colors[0]&&(T.setAttribute("color",new r.Float32BufferAttribute(a.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),oo=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 so=t.FBXLoader;class lo{constructor(e){this.parses={fbx:new so,obj:new ao,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 oo(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 oo(this,void 0,void 0,(function*(){var t=yield(0,jt.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 oo(this,void 0,void 0,(function*(){var t=e instanceof ArrayBuffer?e:yield(0,jt.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 oo(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,jt.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 oo(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,jt.toResult)(e,"text"):e;return{type:"model",result:this.runScene.loaderer.json.parse(t)}}))}}class uo 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.pp.bloomParams.isBloom=e}setRender2(e){this.runScene.assetsEx.setRender2(e)}setRender3(e){this.runScene.assetsEx.setRender3(e)}}class co 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 ho 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){const t=this.runScene.assetsEx.get().camera;var n=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){if(this.animating){const r=this.runScene.assetsEx.get().camera;e*=this.turnRate;var t=this.controls.target;this.q1.rotateTowards(this.q2,e),r.position.set(0,0,1).applyQuaternion(this.q1).multiplyScalar(this.radius).add(t),r.quaternion.rotateTowards(this.targetQuaternion,e),0===this.q1.angleTo(this.q2)&&(this.animating=!1)}}}class fo{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 st.Z.Vector3,this.transControlsStatusMap={position:"translate",rotation:"rotate",scale:"scale"},this.multipObj=null,this.speaceType="world",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.get();this.tansControls=new co(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()}setSpeace(e){e=e||("world"===this.speaceType?"local":"world"),this.speaceType=e,this.tansControls.setSpace(e),this.addObject(this.runScene.modelEx.select)}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 ho(e),this.grid=this.createGrid(),this.init())}init(){this.transContro.init(),this.runScene.assetsEx.get().scene.add(this.grid)}createGrid(){const e=new st.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.boxHelper.visible=!0,this.transContro.addObject(e),this.boxHelper.setFromObject(e),this.focusModelId=this.runScene.uniqueEx.getId(e))}unfocus(){"running"!==this.runScene.optionsEx.options.mode&&(this.transContro.removeFocus(),this.boxHelper&&(this.boxHelper.visible=!1),this.focusModelId=void 0)}}ar=__webpack_require__(4356);var po=__webpack_require__.n(ar),mo=__webpack_require__(6569),vo=__webpack_require__(5860),go=__webpack_require__(1682),yo=__webpack_require__(9960);class bo{constructor(e){this.selectors={},this.boxHelperMap={},this.savedV3=new ot.Z,this.tempOldval=new Cs.Vector3,this.runScene=e}add(e,t=!1){if("array"===(0,mo.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);const o=this.getSelectedList("value");var{x:i,y:s,z:l}=i;const u=i-a.x,c=s-a.y,h=l-a.z,d=[new go.Z({target:e,info:t,oldV3:this.runScene.modelEx.cloneV3(r),newV3:n,runScene:this.runScene}).execute()];o.map((r=>{if(r!==e){var{x:n,y:i,z:a}=r[t],n=n+=u,i=i+=c,a=a+=h;let e=r[t].clone();e.x=n,e.y=i,e.z=a,n=new go.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,yo.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,yo.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,Vt.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 go.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,a=this.getSelectedList("value");var{x:e,y:o,z:s}=n;const l=e-i.x,u=o-i.y,c=s-i.z;t[r].copy(n),a.map((e=>{if(e!==t){var{x:n,y:i,z:a}=e[r],n=n+=l,i=i+=u,a=a+=c;let t=e[r].clone();t.x=n,t.y=i,t.z=a,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}),po().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:a,step:o}=e,s=this.getSelectedList("value");0!==s.length&&(e=s.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 vo.Z({target:e,info:"name",newVal:l,oldVal:e.name,runScene:this.runScene}).execute()})),this.runScene.undoEx.addUndo(e))}align(e){const t=this.getSelectedList("value");if(0!==t.length){const[n]=t;var r=t.map((t=>{var r=t.position.clone();const i=("all"===e?n:t).position.clone();return"all"!==e&&(i[e]=n.position[e]),new go.Z({target:t,info:"position",oldV3:r,newV3:i,runScene:this.runScene}).execute()}));this.runScene.multipSelector.add(t,!0),this.runScene.undoEx.addUndo(r)}}}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 wo(e,t){return(wo=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 So=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&&wo(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"===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(){if(!(this instanceof i))throw new TypeError("Cannot call a class as a function");var e=i.SkyShader;return e=new r.ShaderMaterial({name:"SkyShader",fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:r.UniformsUtils.clone(e.uniforms),side:r.BackSide,depthWrite:!1}),n.call(this,new r.BoxGeometry(1,1,1),e)}return t=i,Object.defineProperty(t,"prototype",{writable:!1}),t}(r.Mesh),Mo=(So.prototype.isSky=!0,So.SkyShader={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new r.Vector3},up:{value:new r.Vector3(0,1,0)}},vertexShader:"\n\t\tuniform vec3 sunPosition;\n\t\tuniform float rayleigh;\n\t\tuniform float turbidity;\n\t\tuniform float mieCoefficient;\n\t\tuniform vec3 up;\n\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\t// constants for atmospheric scattering\n\t\tconst float e = 2.71828182845904523536028747135266249775724709369995957;\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\t// wavelength of used primaries, according to preetham\n\t\tconst vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );\n\t\t// this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:\n\t\t// (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))\n\t\tconst vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );\n\n\t\t// mie stuff\n\t\t// K coefficient for the primaries\n\t\tconst float v = 4.0;\n\t\tconst vec3 K = vec3( 0.686, 0.678, 0.666 );\n\t\t// MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K\n\t\tconst vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );\n\n\t\t// earth shadow hack\n\t\t// cutoffAngle = pi / 1.95;\n\t\tconst float cutoffAngle = 1.6110731556870734;\n\t\tconst float steepness = 1.5;\n\t\tconst float EE = 1000.0;\n\n\t\tfloat sunIntensity( float zenithAngleCos ) {\n\t\t\tzenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );\n\t\t\treturn EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );\n\t\t}\n\n\t\tvec3 totalMie( float T ) {\n\t\t\tfloat c = ( 0.2 * T ) * 10E-18;\n\t\t\treturn 0.434 * c * MieConst;\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\t\t\tvWorldPosition = worldPosition.xyz;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\tgl_Position.z = gl_Position.w; // set z to camera.far\n\n\t\t\tvSunDirection = normalize( sunPosition );\n\n\t\t\tvSunE = sunIntensity( dot( vSunDirection, up ) );\n\n\t\t\tvSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );\n\n\t\t\tfloat rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );\n\n\t\t\t// extinction (absorbtion + out scattering)\n\t\t\t// rayleigh coefficients\n\t\t\tvBetaR = totalRayleigh * rayleighCoefficient;\n\n\t\t\t// mie coefficients\n\t\t\tvBetaM = totalMie( turbidity ) * mieCoefficient;\n\n\t\t}",fragmentShader:"\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\tuniform float mieDirectionalG;\n\t\tuniform vec3 up;\n\n\t\tconst vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );\n\n\t\t// constants for atmospheric scattering\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\tconst float n = 1.0003; // refractive index of air\n\t\tconst float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius)\n\n\t\t// optical length at zenith for molecules\n\t\tconst float rayleighZenithLength = 8.4E3;\n\t\tconst float mieZenithLength = 1.25E3;\n\t\t// 66 arc seconds -> degrees, and the cosine of that\n\t\tconst float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;\n\n\t\t// 3.0 / ( 16.0 * pi )\n\t\tconst float THREE_OVER_SIXTEENPI = 0.05968310365946075;\n\t\t// 1.0 / ( 4.0 * pi )\n\t\tconst float ONE_OVER_FOURPI = 0.07957747154594767;\n\n\t\tfloat rayleighPhase( float cosTheta ) {\n\t\t\treturn THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );\n\t\t}\n\n\t\tfloat hgPhase( float cosTheta, float g ) {\n\t\t\tfloat g2 = pow( g, 2.0 );\n\t\t\tfloat inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );\n\t\t\treturn ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec3 direction = normalize( vWorldPosition - cameraPos );\n\n\t\t\t// optical length\n\t\t\t// cutoff angle at 90 to avoid singularity in next formula.\n\t\t\tfloat zenithAngle = acos( max( 0.0, dot( up, direction ) ) );\n\t\t\tfloat inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );\n\t\t\tfloat sR = rayleighZenithLength * inverse;\n\t\t\tfloat sM = mieZenithLength * inverse;\n\n\t\t\t// combined extinction factor\n\t\t\tvec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );\n\n\t\t\t// in scattering\n\t\t\tfloat cosTheta = dot( direction, vSunDirection );\n\n\t\t\tfloat rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );\n\t\t\tvec3 betaRTheta = vBetaR * rPhase;\n\n\t\t\tfloat mPhase = hgPhase( cosTheta, mieDirectionalG );\n\t\t\tvec3 betaMTheta = vBetaM * mPhase;\n\n\t\t\tvec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );\n\t\t\tLin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );\n\n\t\t\t// nightsky\n\t\t\tfloat theta = acos( direction.y ); // elevation --\x3e y-axis, [-pi/2, pi/2]\n\t\t\tfloat phi = atan( direction.z, direction.x ); // azimuth --\x3e x-axis [-pi/2, pi/2]\n\t\t\tvec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );\n\t\t\tvec3 L0 = vec3( 0.1 ) * Fex;\n\n\t\t\t// composition + solar disc\n\t\t\tfloat sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );\n\t\t\tL0 += ( vSunE * 19000.0 * Fex ) * sundisk;\n\n\t\t\tvec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );\n\n\t\t\tvec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );\n\n\t\t\tgl_FragColor = vec4( retColor, 1.0 );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\n\t\t}"},__webpack_require__(7042)),Co=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 Bo extends V{constructor(){super(...arguments),this.sun=new Cs.Vector3,this.sky=new So,this.directionalLight=new Cs.DirectionalLight,this.skyData={isShow:!1,size:450,effectController:{morning:{turbidity:1,rayleigh:1,mieCoefficient:.005,mieDirectionalG:.7,elevation:2,azimuth:180,exposure:1,lightConfig:this.cloneLightConfig(Mo.Z.toJSON(this.directionalLight)),time:2},noon:{lightConfig:this.cloneLightConfig(Mo.Z.toJSON(this.directionalLight)),turbidity:1,rayleigh:1,mieCoefficient:.005,mieDirectionalG:.7,elevation:90,azimuth:180,exposure:1,time:2},evening:{turbidity:2.1,rayleigh:1.837,mieCoefficient:.007,mieDirectionalG:.7,elevation:0,azimuth:0,exposure:0,lightConfig:this.cloneLightConfig(Mo.Z.toJSON(this.directionalLight)),time:2},night:{turbidity:1,rayleigh:1,mieCoefficient:.005,mieDirectionalG:.7,elevation:2,azimuth:180,exposure:.5,lightConfig:this.cloneLightConfig(Mo.Z.toJSON(this.directionalLight)),time:2},midnight:{turbidity:.3,rayleigh:1.148,mieCoefficient:.015,mieDirectionalG:.83,elevation:90,azimuth:0,exposure:.1,lightConfig:this.cloneLightConfig(Mo.Z.toJSON(this.directionalLight)),time:2}},currentState:"morning",light:this.directionalLight},this.skipStepMap={"morning-evening":["noon","evening"],"morning-night":["noon","evening","night"],"morning-midnight":["noon","evening","night","midnight"],"noon-night":["evening","night"],"noon-midnight":["evening","night","midnight"],"evening-midnight":["night","midnight"],"evening-morning":["night","midnight","morning"],"night-morning":["midnight","morning"],"night-noon":["midnight","morning","noon"],"midnight-noon":["morning","noon"],"midnight-evening":["morning","noon","evening"],"midnight-night":["morning","noon","evening","night"]},this.lastEffectController={turbidity:1,rayleigh:1,mieCoefficient:.005,mieDirectionalG:.7,elevation:2,azimuth:180,exposure:.5},this.effectController={turbidity:1,rayleigh:1,mieCoefficient:.005,mieDirectionalG:.7,elevation:2,azimuth:180,exposure:.5},this.lastTime={index:0,name:"morning"},this.skyChangeArr=[],this.lightChangeArr=[],this.animaArr=["lightAnima","skyAnima"],this.uniforms=null,this.inied=!1,this.currentLightConfig={}}init(){this.addToGroup(),this.addScene()}addScene(){dt.materialIgnore.set(this.sky.material,!0),(0,ut.setHelper)(this.sky),ut.selectableModel.close(this.sky),(0,ut.setHelper)(this.directionalLight),this.runScene.modelEx.add(this.sky,void 0,{addToTree:!1}),this.runScene.modelEx.add(this.directionalLight,void 0,{addToTree:!1})}open(){this.sky.visible||(this.runScene.assetsEx.get().renderer.toneMapping=4,this.directionalLight.visible=!0,this.sky.visible=!0)}close(){this.sky.visible&&(this.runScene.assetsEx.get().renderer.toneMapping=0,this.directionalLight.visible=!1,this.sky.visible=!1)}toJSON(){var e=Object.assign(Object.assign({},this.skyData),{light:Mo.Z.toJSON(this.directionalLight)});return console.log("导出数据data:",e),e}parseJSON(e){}beforeRecoverySky(e){var{light:e,isShow:t,effectController:r,currentState:n}=e;e=new Mo.Z(this.runScene).parseJSON(e,{addToScene:!0}),this.skyData.light=e,this.directionalLight=e,this.skyData.isShow=t,this.skyData.effectController=r,this.skyData.currentState=n,this.sky.visible=t}recoverySkyState(e,t){this.setSkyConfig(e),this.setSkyScale(t)}recoveryLightState(e){this.lightAnimaFn(e)}setState(e,t){var r=this.skyData.currentState;this.setSkyAndLightState({state:e,index:t}),this.saveLastTimeState({oldState:r,state:e,index:t})}setSkyAndLightState(e){var{state:e,index:t}=e,r=this.skyData.currentState+"-"+e,n="midnight-morning"==r;Math.abs(this.lastTime.index-t)<2||n?(this.skyAnima(e),this.lightAnimaFn(e)):(this.passThroughSky(r),this.passThroughLight(r))}saveLastTimeState(e){var{oldState:e,state:t,index:r}=e;this.lastTime.name=e,this.lastTime.index=r,this.skyData.currentState=t}getLightDataByState(e){let t=new Cs.Vector3,r=new Cs.Vector3;switch(e){case"morning":t.x=0,t.y=0,t.z=-this.skyData.size,r.x=0,r.y=this.skyData.size/2*-1,r.z=this.skyData.size/2;break;case"noon":t.x=0,t.y=this.skyData.size/2,t.z=0,r.x=0,r.y=-1*this.skyData.size,r.z=0;break;case"evening":case"night":case"midnight":t.x=0,t.y=0,t.z=this.skyData.size,r.x=0,r.y=this.skyData.size/2*-1,r.z=this.skyData.size/2*-1}return{position:t,targetPosition:r}}setLightConfigByState(e){e=this.getLightConfigByState(e),Mo.Z.setConfig(this.directionalLight,e),this.directionalLight.visible=e.visible}lightAnimaFn(e){const t=this.skyData.effectController[e].time,{position:r,targetPosition:n}=this.getLightDataByState(e);return this.setLightConfigByState(e),this.animaArr.map((e=>null==(e=this.animaArr[e])?void 0:e.kill())),new Promise((e=>{this.animaArr.lightAnima=oe.anima({x:this.directionalLight.position.x,y:this.directionalLight.position.y,z:this.directionalLight.position.z,tx:this.directionalLight.target.position.x,ty:this.directionalLight.target.position.y,tz:this.directionalLight.target.position.z},{x:r.x,y:r.y,z:r.z,tx:n.x,ty:n.y,tz:n.z},t,(e=>{this.directionalLight.position.set(e.x,e.y,e.z),this.directionalLight.target.position.set(e.tx,e.ty,e.tz),this.skyData.light.position.set(e.x,e.y,e.z),this.skyData.light.target.position.set(e.tx,e.ty,e.tz)}),(()=>{e(0)}))}))}passThroughLight(e){const t=this.skipStepMap[e];1<=this.lightChangeArr.length&&(this.lightChangeArr=[]);let r=t.map((e=>()=>this.lightAnimaFn(e)));this.lightChangeArr=[...r],this.deepLightAnima(this.lightChangeArr,(()=>r=[]))}deepLightAnima(e,t){return Co(this,void 0,void 0,(function*(){const r=e.shift();r?(yield r(),this.deepLightAnima(e,t)):t()}))}getLightJSON(e){var t=Mo.Z.toJSON(this.directionalLight);e&&(this.skyData.effectController[e].lightConfig=t)}saveCurrentLightConfig(){this.skyData.effectController[this.skyData.currentState].lightConfig=Mo.Z.toJSON(this.skyData.light)}getLightConfigByState(e){let t=this.skyData.effectController[e].lightConfig;return t||(t=Mo.Z.toJSON(this.directionalLight),this.skyData.effectController[e].lightConfig=t),t}skyAnima(e){const{renderer:t,scene:r,camera:n}=this.runScene.assetsEx.get(),i=this.skyData.effectController[e].time;return new Promise((a=>{this.effectController=this.skyData.effectController[e],oe.anima(Object.assign({},this.lastEffectController),Object.assign({},this.effectController),i||1,(e=>{this.sky.material.uniforms.turbidity.value=e.turbidity,this.sky.material.uniforms.mieCoefficient.value=e.mieCoefficient,this.sky.material.uniforms.mieDirectionalG.value=e.mieDirectionalG,t.toneMappingExposure=e.exposure,t.render(r,n),e=Cs.MathUtils.degToRad(90-e.elevation);var i=Cs.MathUtils.degToRad(this.effectController.azimuth);this.sun.setFromSphericalCoords(1,e,i),this.sky.material.uniforms.sunPosition.value.copy(this.sun)}),(()=>{this.lastEffectController=this.effectController,a(0),console.log(e,"当前时间点~~~")}))}))}deepSkyAnima(e,t){return Co(this,void 0,void 0,(function*(){const r=e.shift();r?(yield r(),this.deepSkyAnima(e,t)):t()}))}passThroughSky(e){return Co(this,void 0,void 0,(function*(){const t=this.skipStepMap[e];1<=this.skyChangeArr.length&&(this.skyChangeArr=[]);let r=t.map((e=>()=>this.skyAnima(e)));this.skyChangeArr=[...r],this.deepSkyAnima(this.skyChangeArr,(()=>r=[]))}))}setSkyConfig(e){const{renderer:t,scene:r,camera:n}=this.runScene.assetsEx.get();this.sky.material.uniforms.turbidity.value=this.skyData.effectController[e].turbidity,this.sky.material.uniforms.mieCoefficient.value=this.skyData.effectController[e].mieCoefficient,this.sky.material.uniforms.mieDirectionalG.value=this.skyData.effectController[e].mieDirectionalG,t.toneMappingExposure=this.skyData.effectController[e].exposure,t.render(r,n);var i=Cs.MathUtils.degToRad(90-this.skyData.effectController[e].elevation);e=Cs.MathUtils.degToRad(this.skyData.effectController[e].azimuth),this.sun.setFromSphericalCoords(1,i,e),this.sky.material.uniforms.sunPosition.value.copy(this.sun)}setSkyScale(e){this.sky.scale.setScalar(e),this.skyData.size=e}isShowSky(e){this.runScene.modelEx[e?"add":"remove"](this.directionalLight),e?this.open():this.close(),this.skyData.isShow=e,this.sky.visible=e}addToGroup(){this.directionalLight.name="定向灯光",this.sky.name="定向天空"}setEffectController(e){var{time:e,type:t,val:r,params:n}=e;this.skyData.effectController[e][t]=r,n&&this.setSkyConfig(n),console.log(this.skyData.effectController,"天空盒修改")}setCurrentTime(e){this.skyData.currentState=e}setImplementTime(e){var{info:e,time:t}=e;this.skyData.effectController[e].time=t}reset(){this.close()}cloneLightConfig(e){if(null===e)return null;if("object"!==e.constructor)return e;if(e.constructor===Date)return new Date(e);if(e.constructor===RegExp)return new RegExp(e);var t,r,n=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(r=e[t],n[t]="object"==typeof r?arguments.callee(r):r);return n}}class _o extends V{constructor(){super(...arguments),this.sky=new Bo(this.runScene)}init(){}toJSON(){return console.log("导出---"),{sky:this.sky.toJSON()}}parseJSON(e){console.log("加载----"),this.sky.parseJSON(e.sky)}reset(){this.sky.reset()}}function Eo(){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 Eo.Panel("FPS","#0ff","#002")),u=r(new Eo.Panel("MS","#0f0","#020"));return self.performance&&self.performance.memory&&(i=r(new Eo.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}}Eo.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,f=74*o,p=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,f,p),v.fillStyle=r,v.globalAlpha=.9,v.fillRect(h,d,f,p),{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,f-o,p,h,d,f-o,p),v.fillRect(h+f-o,d,o,p),v.fillStyle=r,v.globalAlpha=.9,v.fillRect(h+f-o,d,o,a((1-l/g)*p))}}};const To=Eo;class Do{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,oe.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,t){this.options=(0,oe.deepMergeObject)(this.options,e||{}),this.options.showFps&&(this.addFps(t),this.runScene.cb.render.add("optionx-ex-render",this.render.bind(this)))}addFps(e){this.stats=To(),this.stats.showPanel(0),e.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))}}class Po{constructor(e){this.glowModelLength=new Set,this.outlineModelLength=new Set,this.runScene=e,this.initGlow(),this.initOutline()}initGlow(){const{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(){const{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})=>{e.userData.outline&&this.outlineAdd(e)})),r.add("pp-set-outline",(({model:e})=>{e.userData.outline&&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 Oo={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__(8493),Ro=__webpack_require__(8512),Io={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 Lo(e){return(Lo="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 Fo(e,t){return(Fo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Uo(e){return(Uo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Go=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&&Fo(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=Uo(e);if(r=t?(r=Uo(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Lo(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=Io;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]),f=(l=Math.round(s.resolution.x/2),u=Math.round(s.resolution.y/2),0);f<s.nMips;f++)s.separableBlurMaterials.push(s.getSeperableBlurMaterial(d[f])),s.separableBlurMaterials[f].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=Oo,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 Ro.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}(Ro.w);Go.BlurDirectionX=new r.Vector2(1,0),Go.BlurDirectionY=new r.Vector2(0,1);class jo extends Ro.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 Ro.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 No extends Ro.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 Ho={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 zo{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 No(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 Go(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 jo(Ho,"baseTexture","bloomTexture"),this.mixingPass.renderToScreen=!1),this.effectCopy||(this.effectCopy=new ko.T(Oo),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 Vo(e){return(Vo="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 Jo(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ko(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 Zo(e,t,r){t&&Ko(e.prototype,t),r&&Ko(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function Wo(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&&Xo(e,t)}function Xo(e,t){return(Xo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Qo(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"===Vo(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 Yo(e){return(Yo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var qo=function(){Wo(t,Ro.w);var e=Qo(t);function t(r,n){var i;return Jo(this,t),(i=e.call(this)).scene=r,i.camera=n,i.clear=!0,i.needsSwap=!1,i.inverse=!1,i}return Zo(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}(),$o=function(){Wo(t,Ro.w);var e=Qo(t);function t(){var r;return Jo(this,t),(r=e.call(this)).needsSwap=!1,r}return Zo(t,[{key:"render",value:function(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}]),t}();function es(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 ts=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(Oo),this.clock=new r.Clock}return function(e,t,r){t&&es(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!==qo&&(s instanceof qo?r=!0:s instanceof $o&&(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),(ir=new r.BufferGeometry).setAttribute("position",new r.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),ir.setAttribute("uv",new r.Float32BufferAttribute([0,2,0,0,2,0],2));const rs="\n varying vec2 vUv;\n \n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",ns="\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 is{constructor(e){this.mtuPP=e,this.bloomLayer=new Cs.Layers,this.bloomLayer.set(this.mtuPP.BLOOM_SCENE),this.darkMaterial=new Cs.MeshBasicMaterial({color:"black"}),this.materials={},(e=this.mtuPP.mainScene).fog&&(this.mtuPP.sceneFogColor||(this.mtuPP.sceneFogColor=new Cs.Color),this.mtuPP.sceneFogColor.copy(e.fog.color)),e.background&&(this.mtuPP.sceneBackground=e.background),this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.bloomPass=new Go(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 Cs.ShaderMaterial({uniforms:{baseTexture:{value:null},bloomTexture:{value:this.mtuPP.effectComposer.renderTarget2.texture}},vertexShader:rs,fragmentShader:ns,defines:{}}),"baseTexture"),this.finalPass.needsSwap=!0;var e=new Cs.WebGLRenderTarget(this.mtuPP.rtSize.x,this.mtuPP.rtSize.y,{samples:this.mtuPP.ppParams.samples});this.finalComposer=new ts(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 as(e){return(as="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 ss(e){return(ss=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ls=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=ss(e);if(r=t?(r=ss(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===as(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=Oo,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 Ro.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 weightSum = gaussianPdf(0.0, kernelRadius);\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 w = gaussianPdf(uvOffset.x, kernelRadius);\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}(Ro.w);ls.BlurDirectionX=new r.Vector2(1,0),ls.BlurDirectionY=new r.Vector2(0,1);class us{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.outlinePass||(this.outlinePass=new ls(this.mtuPP.rtSize,this.mtuPP.mainScene,this.mtuPP.mainCamera)),this.mtuPP.effectComposer.addPass(this.outlinePass)}setOutlineData(e,t){this.outlinePass[e]="visibleEdgeColor"===e||"hiddenEdgeColor"===e?new Cs.Color(t):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)||(e.userData.outline=!0,this.outlinePass.selectedObjects.push(e)):this.outlinePass.selectedObjects.map(((t,r)=>{t.uuid===e.uuid&&(e.userData.outline=!1,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 cs(e){return(cs="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 hs(e,t){return(hs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function ds(e){return(ds=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var fs=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&&hs(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=ds(e);if(r=t?(r=ds(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===cs(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}(Ro.w);class ps{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 Cs.Color(0),this.runScene=e,this.info=new Po(this.runScene),this.isSafari=-1<navigator.userAgent.indexOf("Safari"),this.isChrome=-1<navigator.userAgent.indexOf("Chrome"),this.rtSize=new Cs.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 Cs.Color(t.color)),"background"===e&&(this.sceneBackground&&(0,ct.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(){this.effectComposer=new ts(this.renderer,this.getNewRenderTarget(this.ppParams.samples)),this.renderPass=new fs(this.mainScene,this.mainCamera),this.effectComposer.addPass(this.renderPass),this.ppOutline(),this.ppGlow()}getNewRenderTarget(e){const t=new Cs.WebGLRenderTarget(this.rtSize.x,this.rtSize.y,{samples:e});return t.depthTexture=new Cs.DepthTexture(this.rtSize.x,this.rtSize.y),t.depthTexture.type=Cs.UnsignedIntType,t.depthTexture.format=Cs.DepthFormat,t}ppOutline(){this.mtOutline=new us(this)}ppGlow(){this.isChrome?(this.effectComposer.renderToScreen=!0,this.mtuGlow=new zo(this)):this.isSafari&&(this.effectComposer.renderToScreen=!1,this.threeGlow=new is(this))}toJSON(){const e={};var{ppParams:t,bloomParams:r,outlineParams:n}=this;return e.ppParams=Object.assign({},t),e.bloomParams=Object.assign({},r),e.outlineParams=Object.assign({},n),JSON.stringify(e)}fromJSON(e){var t,r,n,i,{ppParams:e,bloomParams:a,outlineParams:o}=e;e&&(e=e.samples,this.ppParams.samples=e,this.effectComposer&&this.effectComposer.reset(this.getNewRenderTarget(this.ppParams.samples))),a&&(({isBloom:e,radius:a,strength:t,threshold:r}=a),this.bloomParams.isBloom=e,this.bloomParams.radius=a,this.bloomParams.strength=t,this.bloomParams.threshold=r,this.isChrome?(this.mtuGlow.setGlowData("radius",a),this.mtuGlow.setGlowData("strength",t),this.mtuGlow.setGlowData("threshold",r)):this.isSafari&&(this.threeGlow.setGlowData("radius",a),this.threeGlow.setGlowData("strength",t),this.threeGlow.setGlowData("threshold",r)),this.runScene.cb.pp.glow.setData.cb(this.bloomParams).then()),o&&(({isOutline:e,edgeStrength:a,edgeGlow:t,edgeThickness:r,pulsePeriod:o,visibleEdgeColor:n,hiddenEdgeColor:i}=o),this.outlineParams.isOutline=e,this.outlineParams.edgeStrength=a,this.outlineParams.edgeGlow=t,this.outlineParams.edgeThickness=r,this.outlineParams.pulsePeriod=o,this.outlineParams.visibleEdgeColor=n,this.outlineParams.hiddenEdgeColor=i,this.mtOutline.setOutlineData("edgeStrength",a),this.mtOutline.setOutlineData("edgeGlow",t),this.mtOutline.setOutlineData("edgeThickness",r),this.mtOutline.setOutlineData("pulsePeriod",o),this.mtOutline.setOutlineData("visibleEdgeColor",n),this.mtOutline.setOutlineData("hiddenEdgeColor",i),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)}setPPData(e,t){this.ppParams[e]=t,"samples"===e&&this.effectComposer&&this.effectComposer.reset(this.getNewRenderTarget(this.ppParams.samples))}setGlowData(e,t){this.bloomParams[e]=t,this.isChrome?this.mtuGlow.setGlowData(e,t):this.isSafari&&this.threeGlow.setGlowData(e,t)}setOutlineData(e,t){this.outlineParams[e]=t,this.mtOutline.setOutlineData(e,t)}addOutlineObj(e,t=!0){this.mtOutline.addSelectedObject(e,t)}}var ms=__webpack_require__(8266);class vs extends V{constructor(e){super(e),this.map=new ot.Z,this.playLimit=new ht.cM,this.renderName="script-texture-render",this._clock=new r.Clock,this.bindEvent()}parse(e,t){var r=(0,Vt.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;t.userData.scriptTextre||(t.userData.scriptTextre={offsetX:t.offset.x,offsetY:t.offset.y,rotation:t.rotation}),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 t=e.texture;let r=0,n=0,i=0;t.userData.scriptTextre&&(r=(e=t.userData.scriptTextre).offsetX,n=e.offsetY,i=e.rotation,delete t.userData.scriptTextre),t.offset.x=r,t.offset.y=n,t.rotation=i})),this.runScene.cb.render.delete(this.renderName)}}class gs extends V{constructor(e){super(e),this.runAll=!1,this.texture=new vs(e)}playAll(){this.runAll||(this.runAll=!0,this.texture.playAll())}closeAll(){this.runAll&&(this.runAll=!1,this.texture.closeAll())}}var ys=__webpack_require__(2016);class bs{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 ys.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,ht.lG)(t,"array"))return t.map((t=>{this.addModel(e,t)}));this.map.get(e).add((0,Vt.K)(t))}removeModel(e,t){if(this.map.has(e))return(0,ht.lG)(t,"array")?t.map((t=>{this.removeModel(e,t)})):void this.map.get(e).remove((0,Vt.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 ys.Z(r)})),this.map=ot.Z.formJSON(t),this.runScene.cb.tags.parseJSON.cb(e)}}var xs=__webpack_require__(9716);class ws{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=ws.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;const s=Object.keys(t).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t)));var l=(0,xs.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,f=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;if(!(i=e(h,c,0,f)))return n(0);var{begin:i,end:a}=i;return r=(0,oe.anima)(i,a,d,(e=>{(0,z.js)(f,((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)})),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":ws.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?po().model.v3ToMap(e):""}static SetTargetByData(e){const{baseType:t,data:r,defType:n,target:i}=e;var a,o;"number"===t?i[n]=r:"color"===t&&(({r:e,g:a,b:o}=r),i[n].setRGB(e,a,o))}getAllData(e=!1){return ws.getAllDefValByType(this.defOptions,this.target,e)}getData(e){return ws.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){ws.setTargetByBetween(e,t,r,this.defOptions,this.target)}clone(e){var{data:t,type:r}=this;const n=new(0,Ss[r])(e);return n.data=t,n}reset(){(0,z.js)(this.defOptions,((e,t)=>{ws.SetTargetByData({baseType:t.type,data:ws.getValByType(this.beginData,e,this.defOptions),target:this.target,defType:e})}))}remove(){delete this.target.userData.isTimeLineUsed}}ws.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]&&ws.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 As=ws,Ss={model:class extends As{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}=As.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;const o=Object.keys(t).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t)));var s=(0,xs.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,oe.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 As{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}=As.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,oe.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:f}=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,f)}),o)})),anima:oe.anima}};return(e,r,n,i=!1)=>{let a=i?n.time:0;const o=Object.keys(e).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t)));var s=(0,xs.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":po().model.v3ToMap(t),scale:e?"notNow":po().model.v3ToMap(r),rotation:e?"notNow":po().model.v3ToMap(n),target:e?"notNow":po().model.v3ToMap(this.controls.target)}}getData(e){var{position:t,scale:r,rotation:n}=this.target;let i;if("position"===e)i=po().model.v3ToMap(t);else if("scale"===e)i=po().model.v3ToMap(r);else if("rotation"===e)i=po().model.v3ToMap(n);else{if("target"!==e)throw TypeError("输入值不存在");i=po().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 As{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 Ms=__webpack_require__(2266);const Cs=st.Z,Bs={RunScene:class{constructor(e){this._clock=new r.Clock,this.cb=new Et,this.script=new gs(this),this.uniqueEx=new Vt.Z(this),this.fileEx=new lo(this),this.optionsEx=new Do(this),this.undoEx=new Ms.ZP(this),this.textureEx=new ct.default(this),this.controlsEx=new kt,this.assetsEx=new Bt(this),this.renderEx=new ms.Z(this),this.events=new class{constructor(e){this.key=new Ft(this),this.mouse=new Gt(this),this.drag=new Rt(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 bo(this),this.helperEx=null,this.materialEx=new dt.default(this),this.cameraEx=new Tt.Z(this),this.sceneEx=new ft.ZP(this),this.modelEx=new ut.default(this),this.loaderer=new wt(this),this.exporter=new Qr(this),this.lightEx=new Ht.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;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 a=i[r],o=i[r+1],s=e[a];if(e=e[o],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(a))/(Number(o)-Number(a))}}}})(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=Ss[t];if(t=i.getTarget(e,this.runScene)){const a=new i(t,this.runScene);a.data=r,n[e]=a}})),r.data=n,this.groupMap[t]=r,this.runScene.cb.timeLine.setGroupMap.cb({group:r,groupName:t})}))}playGroup(e,t){const r=(0,ht.Gm)({onlyReverse:!1},t).onlyReverse,n=(this.runScene.helperEx.unfocus(),this.groupMap[e]);if(n&&!n.run){n.run=!0;const i=Object.keys(n.data).map((e=>{const t=n.data[e];if(t.data=new Proxy(t.data,{set:(e,t,r)=>(e[t]=r,!0)}),r)return t.getAnima(n,!0);const i=t.getAnima(n);return n.reverse&&(e=t.getAnima(n,!0),i.push(...e)),i}));this.animaMap[e]||(this.animaMap[e]=[]),this.animaMap[e]=i.map((e=>(0,xs.eachTriggerArrGetControls)(e)));let a=0;a=r?n.time*n.speed:n.time*n.speed*(n.reverse?2:1);const o=(new Date).valueOf(),s=a;let l;t=setInterval((()=>{var t=((new Date).valueOf()-o)/s;this.runScene.cb.timeLine.playGroup.cb({groupName:e,progress:t})}),16.6);const u=new Promise((e=>l=setTimeout(e,a)));return this.timerMap[e]={setProgressTime:t,awaitRuned:l},u.then((()=>{if(clearInterval(this.timerMap[e].setProgressTime),n.run)return n.run=!1,n.loop?this.playGroup(e):void 0}))}}}(this),this.anima=new St(this),this.tags=new bs(this),this.globalConfig=new uo(this),this.pp=new ps(this),this.objects=new _o(this),this._renderLimit=new ht.cM,this._render=()=>{const{render2:e,render3:t}=this.assetsEx;var{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),(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 fo(this);const{camera:n,controls:i}=this.assetsEx.get();this.uniqueEx.model.add(n),this.renderEx.setSize(),i.update(),this.pp.init(),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 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){const{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:oe,ModelEx:ut,MaterialEx:dt,TextureEx:ct,Three:Cs,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__})()));
|