run-scene-v2 0.0.68 → 0.0.70
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__={2958:(e,t,r)=>{"use strict";function n(){return(n="undefined"!=typeof Reflect&&Reflect.get?Reflect.get: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||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(r=t?(r=l(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===f(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return s(n)}}function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(e,t,r){return t&&u(e.prototype,t),r&&u(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?p(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function f(e){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e){return void 0===e}function 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?k(e._tTime,e=e.duration()+e._rDelay)*e:0}function k(e,t){return t=Math.floor(e/=t),e&&t===e?t-1:t}function O(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=O(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)&&pe!==Ut.frame?(ot.push(e),e._lazy=[t,n]):void 0:1}function U(e){return(e=e.parent)&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||U(e))}function G(e){return"isFromStart"===(e=e.data)||"isStart"===e}function j(e,t,r,n){var i=e._repeat,a=mt(t)||0;return(t=e._tTime/e._tDur)&&!n&&(e._time*=a/e._dur),e._dur=a,e._tDur=i?i<0?1e10:mt(a*(i+1)+e._rDelay*i):a,0<t&&!n?St(e,e._tTime=e._tDur*t):e.parent&&At(e),r||wt(e.parent,e),e}function N(e){return e instanceof ar?wt(e):j(e,e._dur)}function H(e,t,r){var n,i,a,o=e.labels,s=e._recent||Mt,l=e.duration()>=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,p,f,m,v,g,y,b,x=(h||t).length,w=a[x];if(!w){if(!(b="auto"===t.grid?0:(t.grid||[1,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,p=b===Re?0:o?x*u/b-.5:n/b|0,y=Re,v=g=0;v<x;v++)m=v%b-d,f=p-(v/b|0),w[v]=m=s?Math.abs("y"===s?f:m):Ge(m*m+f*f),g<m&&(g=m),m<y&&(y=m);"random"===n&&Dt(w),w.max=g-y,w.min=y,w.v=x=(parseFloat(t.amount)||parseFloat(t.each)*(x<b?x-1:s?"y"===s?x/b:b:Math.max(b,x/b))||0)*("edges"===n?-1:1),w.b=x<0?i-x:i,w.u=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)*kt+.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,pe,fe,me,ve,ge,ye,be,xe,we,Ae,Se,Me,Ce,Be,_e,Ee,Te,De,Pe,ke={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Oe={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"==f(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="",pt=function(e){var t,r,n=e[0];if(Je(n)||ze(n)||(e=[e]),!(t=(n._gsap||{}).harness)){for(r=ht.length;r--&&!ht[r].targetTest(n););t=ht[r]}for(r=e.length;r--;)e[r]&&(e[r]._gsap||(e[r]._gsap=new nr(e[r],t)))||e.splice(r,1);return e},ft=function(e){return e._gsap||pt(Tt(e))[0]._gsap},mt=function(e){return Math.round(1e7*e)/1e7||0},vt=function(){var e,t,r=ot.length,n=ot.slice(0);for(st={},e=ot.length=0;e<r;e++)(t=n[e])&&t._lazy&&(t.render(t._lazy[0],t._lazy[1],!0)._lazy=0)},gt=function(e,t){for(var r in t)r in e||(e[r]=t[r]);return e},yt=function(e,t){var r,n={};for(r in e)r in t||(n[r]=e[r]);return n},bt=function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"_first",n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"_last",i=t._prev,a=t._next;i?i._next=a:e[r]===t&&(e[r]=a),a?a._prev=i:e[n]===t&&(e[n]=i),t._next=t._prev=t.parent=null},xt=function(e,t){!e.parent||t&&!e.parent.autoRemoveChildren||e.parent.remove(e),e._act=0},wt=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var r=e;r;)r._dirty=1,r=r.parent;return e},At=function(e){return e._end=mt(e._start+(e._tDur/Math.abs(e._ts||e._rts||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)},kt=255,Ot={aqua:[0,kt,kt],lime:[0,kt,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,kt],navy:[0,0,128],white:[kt,kt,kt],olive:[128,128,0],yellow:[kt,kt,0],orange:[kt,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[kt,0,0],pink:[kt,192,203],cyan:[0,kt,kt],transparent:[kt,kt,kt,0]},Rt=function(e,t,r){var n,i,a,o,s,l,u,c=e?Ve(e)?[e>>16,e>>8&kt,e&kt]:0:Ot.black;if(!c){if(","===e.substr(-1)&&(e=e.substr(0,e.length-1)),Ot[e])c=Ot[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&kt,c&kt,parseInt(e.substr(7),16)/255];c=[(e=parseInt(e.substr(1),16))>>16,e>>8&kt,e&kt]}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)||Ot.transparent;c=c.map(Number)}return t&&!u&&(n=c[0]/kt,i=c[1]/kt,a=c[2]/kt,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 Ot)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,p,f,m=e.vars,v=m.ease,g=m.startAt,y=m.immediateRender,b=m.lazy,x=m.onUpdate,w=m.onUpdateParams,A=m.callbackScope,S=m.runBackwards,M=m.yoyoEase,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,k="auto"===e._overwrite&&!se,O=e.timeline;if(e._ease=Vt(v=!O||C&&v?v:"none",Oe.ease),e._yEase=M?zt(Vt(!0===M?v:M,Oe.ease)):0,M&&e._yoyo&&!e._repeat&&(M=e._yEase,e._yEase=e._ease,e._ease=M),e._from=!O&&!!m.runBackwards,!O||C&&!m.stagger){if(p=(u=T[0]?ft(T[0]).harness:0)&&m[u.prop],r=yt(m,at),E&&xt(E.render(-1,!0)),g)if(xt(e._startAt=hr.set(T,gt({data:"isStart",overwrite:!1,parent:D,immediateRender:!0,lazy:Ke(b),startAt:null,delay:0,onUpdate:x,onUpdateParams:w,callbackScope:A,stagger:0},g))),t<0&&!y&&!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),p&&(i[u.prop]=p),xt(e._startAt=hr.set(T,i)),t<0&&e._startAt.render(-1,!0),e._zTime=t,y){if(!t)return}else Zt(e._startAt,Ie);for(e._pt=0,b=_&&Ke(b)||b&&!_,n=0;n<T.length;n++){if(l=(o=T[n])._gsap||pt(T)[n]._gsap,e._ptLookup[n]=h={},st[l.id]&&ot.length&&vt(),d=P===T?n:P.indexOf(o),u&&!1!==(c=new u).init(o,p||r,e,d,P)&&(e._pt=a=new br(e._pt,o,c.name,0,1,c.render,c,0,c.priority),c._props.forEach((function(e){h[e]=a})),c.priority&&(s=1)),!u||p)for(i in r)lt[i]&&(c=lr(i,r,e,d,o,P))?c.priority&&(s=1):h[i]=a=sr.call(e,o,i,"get",r[i],d,P,0,m.stringFilter);e._op&&e._op[n]&&e.kill(o,e._op[n]),k&&e._pt&&(rr=e,le.killTweensOf(o,h,e.globalTime(t)),f=!e.parent,rr=0),e._pt&&b&&(st[l.id]=1)}s&&yr(e),e._onInit&&e._onInit(e)}e._onUpdate=x,e._initted=(!e._op||e._pt)&&!f,C&&t<=0&&O.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}}},Oe.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?k(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?O(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?O(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,p=this._time,f=this._dirty?this.totalDuration():this._tDur,m=this._dur,v=e<=0?0:mt(e),g=this._zTime<0!=e<0&&(this._initted||!m);if((v=this!==le&&f<v&&0<=e?f:v)!==this._tTime||r||g){if(p!==this._time&&m&&(v+=this._time-p,e+=this._time-p),n=v,c=this._start,s=!(u=this._ts),g&&(m||(p=this._zTime),!e&&t||(this._zTime=e)),this._repeat){if(g=this._yoyo,o=m+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*o+e,t,r);if(n=mt(v%o),v===f?(a=this._repeat,n=m):((a=~~(v/o))&&a===v/o&&(n=m,a--),m<n&&(n=m)),h=k(this._tTime,o),g&&1&a&&(n=m-n,d=1),a!==(h=!p&&this._tTime&&h!==a?a:h)&&!this._lock){var y=g&&1&h;if(g=y===(g&&1&a),p=(y=a<h?!y:y)?0:m,this._lock=1,this.render(p||(d?0:mt(a*o)),t,!m)._lock=0,this._tTime=v,!t&&this.parent&&q(this,"onRepeat"),this.vars.repeatRefresh&&!d&&(this.invalidate()._lock=1),p&&p!==this._time||s!=!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(m=this._dur,f=this._tDur,g&&(this._lock=2,this.render(p=y?m:-1e-4,!0),this.vars.repeatRefresh&&!d&&this.invalidate()),this._lock=0,!this._ts&&!s)return this;re(this,d)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(l=function(e,t,r){var n;if(t<r)for(n=e._first;n&&n._start<=r;){if("isPause"===n.data&&n._start>t)return n;n=n._next}else for(n=e._last;n&&n._start>=r;){if("isPause"===n.data&&n._start<t)return n;n=n._prev}}(this,mt(p),mt(n)))&&(v-=n-(n=l._start)),this._tTime=v,this._time=n,this._act=!u,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=e,p=0),!p&&n&&!t&&(q(this,"onStart"),this._tTime!==v))return this;if(p<=n&&0<=e)for(b=this._first;b;){if(i=b._next,(b._act||n>=b._start)&&b._ts&&l!==b){if(b.parent!==this)return this.render(e,t,r);if(b.render(0<b._ts?(n-b._start)*b._ts:(b._dirty?b.totalDuration():b._tDur)+(n-b._start)*b._ts,t,r),n!==this._time||!this._ts&&!s){l=0,i&&(v+=this._zTime=-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(p<=n?0:-Ie)._zTime=p<=n?1:-1,this._ts))return this._start=c,At(this),this.render(e,t,r);this._onUpdate&&!t&&q(this,"onUpdate",!0),!(v===f&&f>=this.totalDuration()||!v&&p)||c!==this._start&&Math.abs(u)===Math.abs(this._ts)||this._lock||(!e&&m||!(v===f&&0<this._ts||!v&&this._ts<0)||xt(this,1),t||e<0&&!p||!v&&!p&&f||(q(this,v===f&&0<=e?"onComplete":"onReverseComplete",!0),!this._prom||v<f&&0<this.timeScale()||this._prom()))}return this}},{key:"add",value:function(e,t){var r=this;if(Ve(t)||(t=H(this,t,e)),!(e instanceof ir)){if(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,O(e,le)),pe=Ut.frame),Ut.frame>=ct){ct+=ke.autoSleep||120;var t=le._first;if((!t||!t._ts)&&ke.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),p=0,f=0;for(d.b=r,d.e=n,r+="",(i=~(n+="").indexOf("random("))&&(n=Pt(n)),a&&(a(a=[r,n],e,t),r=a[0],n=a[1]),s=r.match(qe)||[];c=qe.exec(n);)u=c[0],c=n.substring(p,c.index),l?l=(l+1)%5:"rgba("===c.substr(-5)&&(l=1),u!==s[f++]&&(h=parseFloat(s[f-1])||0,d._pt={_next:d._pt,p:c||1===f?c:",",s:h,c:"="===u.charAt(1)?parseFloat(u.substr(2))*("-"===u.charAt(0)?-1:1):parseFloat(u)-h,m:l&&l<4?Math.round:0},p=qe.lastIndex);return d.c=p<n.length?n.substring(p,n.length):"",d.fp=o,($e.test(n)||i)&&(d.e=0),this._pt=d}),sr=function(e,t,r,n,i,a,o,s,l){var u;if(ze(n)&&(n=n(i||0,e,a)),i=e[t],a="get"!==r?r:ze(i)?l?e[t.indexOf("set")||!ze(e["get"+t.substr(3)])?t:"get"+t.substr(3)](l):e[t]():i,r=ze(i)?l?fr:pr:dr,He(n)&&"="===(n=~n.indexOf("random(")?Pt(n):n).charAt(1)&&(!(u=parseFloat(a)+parseFloat(n.substr(2))*("-"===n.charAt(0)?-1:1)+(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||ke.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!==fe))for(l=r._ptLookup[r._targets.indexOf(i)],u=o._props.length;u--;)l[o._props[u]]=s;return o},ur=dt+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase",cr={},hr=(S(ur+",id,stagger,delay,duration,paused,scrollTrigger",(function(e){return cr[e]=1})),function(){i(t,ir);var e=o(t);function t(r,n,i,a){h(this,t),"number"==typeof n&&(i.duration=n,n=i,i=null);var o,l,u,c,d,p,f,m,v,y=(a=(o=e.call(this,a?n:T(n))).vars).duration,x=a.delay,w=a.immediateRender,A=a.stagger,S=a.overwrite,M=a.keyframes,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?pt(P):b("GSAP target "+r+" not found. https://greensock.com",!ke.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(p in A)~ur.indexOf(p)&&((v=v||{})[p]=A[p]);for(u=0;u<d;u++)(c=yt(n,cr)).stagger=0,E&&(c.yoyoEase=E),v&&_(c,v),f=P[u],c.duration=+Wt(y,s(o),u,f,P),c.delay=(+Wt(x,s(o),u,f,P)||0)-o._delay,!A&&1===d&&c.delay&&(o._delay=x=c.delay,o._start+=x,c.delay=0),l.to(f,c,m?m(u,f,P):0),l._ease=jt.none;l.duration()?y=x=0:o.timeline=0}else if(M){T(gt(l.vars.defaults,{ease:"none"})),l._ease=Vt(M.ease||n.ease||"none");var k,O,R,F=0;if(We(M))M.forEach((function(e){return l.to(P,e,">")}));else{for(p in c={},M)"ease"!==p&&"easeEach"!==p&&function(e,t,r,n){var i,a,o=t.ease||n||"power1.inOut";if(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})}(p,M[p],c,M.easeEach);for(p in c)for(k=c[p].sort((function(e,t){return e.t-t.t})),u=F=0;u<k.length;u++)(R={ease:(O=k[u]).e,duration:(O.t-(u?k[u-1].t:0))/100*y})[p]=O.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,f=this.timeline,this._repeat){if(h=s+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*h+e,t,r);if(m=mt(l%h),l===o?(g=this._repeat,m=s):((g=~~(l/h))&&g===l/h&&(m=s,g--),s<m&&(m=s)),(p=this._yoyo&&1&g)&&(d=this._yEase,m=s-m),y=k(this._tTime,h),m===a&&!r&&this._initted)return this;g!==y&&(f&&this._yEase&&re(f,p),!this.vars.repeatRefresh||p||this._lock||(this._lock=r=1,this.render(mt(h*g),!0).invalidate()._lock=0))}if(!this._initted){if(F(this,e<0?e:m,r,t))return this._tTime=0,this;if(s!==this._dur)return this.render(e,t,r)}if(this._tTime=l,this._time=m,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=i=(d||this._ease)(m/s),this._from&&(this.ratio=i=1-i),m&&!a&&!t&&(q(this,"onStart"),this._tTime!==l))return this;for(n=this._pt;n;)n.r(i,n.d),n=n._next;f&&f.render(e<0?e:!m&&p?-Ie:f._dur*f._ease(m/this._dur),t,r)||this._startAt&&(this._zTime=e),this._onUpdate&&!t&&(e<0&&this._startAt&&this._startAt.render(e,!0,r),q(this,"onUpdate")),this._repeat&&g!==y&&this.vars.onRepeat&&!t&&this.parent&&q(this,"onRepeat"),l!==this._tDur&&l||this._tTime!==l||(e<0&&this._startAt&&!this._onUpdate&&this._startAt.render(e,!0,!0),!e&&s||!(l===this._tDur&&0<this._ts||!l&&this._ts<0)||xt(this,1),t||e<0&&!a||!l&&!a||(q(this,l===o?"onComplete":"onReverseComplete",!0),!this._prom||l<o&&0<this.timeScale()||this._prom()))}}else{var u,c,h=this,d=e,p=t,f=r,m=h.ratio,v=d<0||!d&&(!h._start&&U(h)&&(h._initted||!G(h))||(h._ts<0||h._dp._ts<0)&&!G(h))?0:1,g=h._rDelay,y=0;if(g&&h._repeat&&(c=k(y=V(0,h._tDur,d),g),h._yoyo&&1&c&&(v=1-v),c!==k(h._tTime,g)&&(m=1-v,h.vars.repeatRefresh&&h._initted&&h.invalidate())),v!==m||f||h._zTime===Ie||!d&&h._zTime){if(h._initted||!F(h,d,f,p)){for(c=h._zTime,h._zTime=d||(p?Ie:0),p=p||d&&!c,h.ratio=v,h._from&&(v=1-v),h._time=0,h._tTime=y,u=h._pt;u;)u.r(v,u.d),u=u._next;h._startAt&&d<0&&h._startAt.render(d,!0,!0),h._onUpdate&&!p&&q(h,"onUpdate"),y&&h._repeat&&!p&&h.parent&&q(h,"onRepeat"),(d>=h._tDur||d<0)&&h.ratio===v&&(v&&xt(h,1),p||(q(h,v?"onComplete":"onReverseComplete",!0),h._prom&&h._prom()))}}else h._zTime||(h._zTime=d)}return this}},{key:"targets",value:function(){return this._targets}},{key:"invalidate",value:function(){return this._pt=this._op=this._startAt=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(),n(l(t.prototype),"invalidate",this).call(this)}},{key:"kill",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"all";if(!(e||t&&"all"!==t))return this._lazy=this._pt=0,this.parent?$(this):this;if(this.timeline)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]?ft(e[0]).harness:0)&&e.aliases;if(!o)return t;for(n in r=_({},t),o)if(n in r)for(i=(a=o[n].split(",")).length;i--;)r[a[i]]=r[n];return r}(u,t)),l=u.length;l--;)if(~c.indexOf(u[l]))for(o in n=h[l],"all"===t?(r[l]=t,a=n,i={}):(i=r[l]=r[l]||{},a=t),a)(s=n&&n[o])&&("kill"in s.d&&!0!==s.d.kill(o)||bt(this,s,"_pt"),delete n[o]),"all"!==i&&(i[o]=1);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}),pr=function(e,t,r){return e[t](r)},fr=function(e,t,r,n){return e[t](n.fp,r)},mr=function(e,t){return ze(e[t])?pr:m(e[t])&&e.setAttribute?Xt:dr},vr=function(e,t){return t.set(t.t,t.p,Math.round(1e6*(t.s+t.c*e))/1e6,t)},gr=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},yr=function(e){for(var t,r,n,i,a=e._pt;a;){for(t=a._next,r=n;r&&r.pr>a.pr;)r=r._next;(a._prev=r?r._prev:i)?a._prev._next=a:n=a,(a._next=r)?r._prev=a:i=a,a=t}e._pt=n},br=function(){function e(t,r,n,i,a,o,s,l,u){h(this,e),this.t=r,this.s=i,this.c=a,this.p=n,this.r=o||vr,this.d=s||this,this.set=l||dr,this.pr=u||0,(this._next=t)&&(t._prev=this)}return c(e,[{key:"modifier",value:function(e,t,r){this.mSet=this.mSet||this.set,this.set=er,this.m=e,this.mt=r,this.tween=t}}]),e}(),xr=(S(dt+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",(function(e){return at[e]=1})),rt.TweenMax=rt.TweenLite=hr,rt.TimelineLite=rt.TimelineMax=ar,le=new ar({sortChildren:!1,defaults:Oe,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),ke.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=ft(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=ft(e),s=o.harness&&(o.harness.aliases||{})[t]||t,l=a?function(t){var n=new a;fe._pt=0,n.init(e,r?t+r:t,fe,0,[e]),n.render(1,n),fe._pt&&Yt(1,fe)}:o.set(e,s);return a?l:function(t){return l(e,s,r?t+r:t,o,1)}},isTweening:function(e){return 0<le.getTweensOf(e,!0).length},defaults:function(e){return e&&e.ease&&(e.ease=Vt(e.ease,Oe.ease)),E(Oe,e||{})},config:function(e){return E(ke,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:ft,_removeLinkedListItem:bt,suppressOverwrites:function(e){return se=e}}}),wr=(S("to,from,fromTo,delayedCall,set,killTweensOf",(function(e){return xr[e]=hr[e]})),Ut.add(ar.updateRoot),fe=xr.to({},{duration:0}),function(e,t){for(var r=e._pt;r&&r.p!==t&&r.op!==t&&r.fp!==t;)r=r._next;return r}),Ar=xr.registerPlugin({name:"attr",init:function(e,t,r,n,i){var a,o;for(a in t)(o=this.add(e,"setAttribute",(e.getAttribute(a)||0)+"",t[a],n,i,0,0,a))&&(o.op=a),this._props.push(a)}},{name:"endArray",init:function(e,t){for(var r=t.length;r--;)this.add(e,r,e[r]||0,t[r])}},tr("roundProps",K),tr("modifiers"),tr("snap",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},3685:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},i=(Object.defineProperty(t,"__esModule",{value:!0}),t.downloadFile=t.getFileName=t.urlToBase64=t.toResult=t.getPrefixWord=t.getBackWord=t.bToMB=t.arrayBufferToStr=t.strToArrayBuffer=t.toUrl=t.blobToDataUrl=t.bufferToArrayBuffer=t.base64ToFile=void 0,n(r(3300)));t.base64ToFile=function(e,t){for(var r=(e=e.split(","))[0].match(/:(.*?);/)[1],n=atob(e[1]),i=n.length,a=new Uint8Array(i);i--;)a[i]=n.charCodeAt(i);return new File([a],t,{type:r})},t.bufferToArrayBuffer=function(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),n=0;n<e.length;++n)r[n]=e[n];return t},t.blobToDataUrl=function(e){return i.default.get(e,{baseURL:"",responseType:"blob",timeout:5e3}).then((function(e){return(0,t.toResult)(e.data)})).catch((function(e){return!1}))},t.toUrl=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"any.json";return e=e instanceof File?e:(e=JSON.stringify(e),new File([e],t)),window.URL.createObjectURL(e)},t.strToArrayBuffer=function(e){for(var t="",r=0;r<e.length;r++)""===t?t=e.charCodeAt(r).toString(16):t+=","+e.charCodeAt(r).toString(16);return new Uint8Array(t.match(/[\da-f]{2}/gi).map((function(e){return parseInt(e,16)}))).buffer},t.arrayBufferToStr=function(e){return new Promise((function(t){var r=new Blob([e]),n=new FileReader;n.readAsText(r,"utf-8"),n.onload=function(){t(n.result)}}))},t.bToMB=function(e){return e=e/1024/1024,1<arguments.length&&void 0!==arguments[1]&&arguments[1]?e:e.toFixed(2)+"MB"},t.getBackWord=function(e){return e.substr(e.lastIndexOf(".")+1).toLowerCase()},t.getPrefixWord=function(e){return e.substr(0,e.lastIndexOf("."))},t.toResult=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"text",r=new FileReader;return"text"===t?r.readAsText(e):"arrayBuffer"===t?r.readAsArrayBuffer(e):"base64"===t&&r.readAsDataURL(e),new Promise((function(e){r.onload=function(t){return e(t.target.result)}}))},t.urlToBase64=function(e){return i.default.get(e,{responseType:"arraybuffer"}).then((function(e){var t=e.headers["content-type"];return e=new Buffer(e.data,"binary").toString("base64"),"data:".concat(t,";base64,")+e}))},t.getFileName=function(e){return e.substring(e.lastIndexOf("-")+1)},t.downloadFile=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"any.text",r=document.createElement("a");e instanceof File||e instanceof Blob?r.setAttribute("href",window.URL.createObjectURL(e)):r.setAttribute("href",e),r.setAttribute("download",t),document.body.insertAdjacentElement("beforeend",r),r.click(),r.remove()}},4298:function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(){i=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,a=(m="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",o=m.asyncIterator||"@@asyncIterator",s=m.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(t){l=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var i,a,o,s;return t=t&&t.prototype instanceof d?t:d,t=Object.create(t.prototype),n=new A(n||[]),t._invoke=(i=e,a=r,o=n,s="suspendedStart",function(e,t){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===e)throw t;return{value:void 0,done:!0}}for(o.method=e,o.arg=t;;){var r=o.delegate;if(r&&(r=function e(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,e(t,r),"throw"===r.method))return h;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}return"throw"===(n=c(n,t.iterator,r.arg)).type?(r.method="throw",r.arg=n.arg,r.delegate=null,h):(n=n.arg)?n.done?(r[t.resultName]=n.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,h):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,h)}(r,o),r)){if(r===h)continue;return r}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if("suspendedStart"===s)throw s="completed",o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);if(s="executing","normal"===(r=c(i,a,o)).type){if(s=o.done?"completed":"suspendedYield",r.arg===h)continue;return{value:r.arg,done:o.done}}"throw"===r.type&&(s="completed",o.method="throw",o.arg=r.arg)}}),t}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var h={};function d(){}function p(){}function f(){}var m,v,g=(l(m={},a,(function(){return this})),(v=(v=Object.getPrototypeOf)&&v(v(S([]))))&&v!==t&&r.call(v,a)&&(m=v),f.prototype=d.prototype=Object.create(m));function y(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){var i;this._invoke=function(a,o){function s(){return new t((function(i,s){!function i(a,o,s,l){var u;if("throw"!==(a=c(e[a],e,o)).type)return(o=(u=a.arg).value)&&"object"==n(o)&&r.call(o,"__await")?t.resolve(o.__await).then((function(e){i("next",e,s,l)}),(function(e){i("throw",e,s,l)})):t.resolve(o).then((function(e){u.value=e,s(u)}),(function(e){return i("throw",e,s,l)}));l(a.arg)}(a,o,i,s)}))}return i=i?i.then(s,s):s()}}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function w(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function S(e){if(e){var t,n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(n=function n(){for(;++t<e.length;)if(r.call(e,t))return n.value=e[t],n.done=!1,n;return n.value=void 0,n.done=!0,n}).next=n}return{next:M}}function M(){return{value:void 0,done:!0}}return l(g,"constructor",p.prototype=f),l(f,"constructor",p),p.displayName=l(f,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){return!!(e="function"==typeof e&&e.constructor)&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,l(e,s,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},y(b.prototype),l(b.prototype,o,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var o=new b(u(t,r,n,i),a);return e.isGeneratorFunction(r)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},y(g),l(g,s,"Generator"),l(g,a,(function(){return this})),l(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,r=[];for(t in e)r.push(t);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=S,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(w),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return o.type="throw",o.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;0<=i;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}var o=(a=a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc?null:a)?a.completion:{};return o.type=e,o.arg=t,a?(this.method="next",this.next=a.finallyLoc,h):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),w(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,i=this.tryEntries[t];if(i.tryLoc===e)return"throw"===(r=i.completion).type&&(n=r.arg,w(i)),n}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:S(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},e}function a(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){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(3185));function u(e,t,r,n){return s(void 0,void 0,void 0,i().mark((function a(){var o,s,l;return i().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(o=e[t++]){i.next=3;break}return i.abrupt("return",r());case 3:if((s=o())instanceof Promise)return i.next=7,s;i.next=11;break;case 7:l=i.sent,null!=n&&n.eachCb(l,t),i.next=18;break;case 11:if(s.promise&&s.promise instanceof Promise)return null!=n&&n.eachCb(s,t),i.next=15,s.promise;i.next=17;break;case 15:i.next=18;break;case 17:null!=n&&n.eachCb(s,t);case 18:u(e,t,r,n);case 19:case"end":return i.stop()}}),a)})))}function c(e,t){e.map((function(e){if("array"===(0,l.getType)(e))return c(e,t);t.push(e)}))}t.lastArrayEle=function(e){return e.slice(-1)[0]},t.delArrEle=function(e,t){var r=e.slice(0,t);return e=e.slice(t+1),[].concat(a(r),a(e))},t.emptyArray=function(e){return 0===e.length},t.eachTriggerArrGetControls=function(e){var r=new Proxy({run:!0,clean:!1,target:e,index:0,runningAnima:null,eachCb:function(e,t){e.anima&&(r.runningAnima=e.anima),r.index=t}},{set:function(e,t,n){return"clean"===t&&!0===n&&!1===e[t]&&(r.run=!1,r.target.splice(0)),"run"===t&&!1===n&&!0===e[t]&&(console.log(r,"controls"),r.runningAnima&&r.runningAnima.pause()),"run"===t&&!0===n&&!1===e[t]&&r.runningAnima&&r.runningAnima.resume(),e[t]=n,!0}});return e=(0,t.eachTriggerArray)(e,r),{controls:r,promise:e}},t.eachTriggerArray=function(e,t){return new Promise((function(r){return u(e,0,r,t)}))},t.multiArrToArr=function(e){var t=[];return c(e,t),t},t.map=function(e,t){return e.map((function(r,n){return t(r,n,e)})).filter((function(e){return e}))},t.deepArrByMaps=function(e){var r=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}},758:(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)}}},9594:(e,t,r)=>{"use strict";t.qR=t.js=t.CV=void 0,r(3185),t.CV=function(e){return 0===Object.values(e).length},t.js=function(e,t){return Object.keys(e).map((function(r,n){var i=e[r];return t(r,i,n)}))},t.qR=function(e,t){var r=-1;return function e(n){return r++,t.length===r+1?n:e(n[t[r]])}(e)}},9251:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},i=(Object.defineProperty(t,"__esModule",{value:!0}),t.getId=t.getMacro=t.getUuid=void 0,n(r(7937))),a=n(r(181));t.getUuid=function(){return i.default.UUID1()},t.getMacro=function(e){var t=setTimeout((function(){return clearTimeout(t),t=null,e()}),1<arguments.length&&void 0!==arguments[1]?arguments[1]:0)},t.getId=function(){return(0,a.default)()}},3185:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isTrue=t.getType=void 0,t.getType=function(e){if(void 0!==e){if(null===e)return null;var t;switch(e.constructor){case Array:t="Array";break;case Object:t="Object";break;case String:t="String";break;case Number:t="Number";break;case Boolean:t="Boolean";break;case Function:t="Function"}return t&&t.toLowerCase()||"Object"}},t.isTrue=function(e){return!(null==e||!1===e)}},4326:e=>{e.exports=function(e,t,r){for(var n=(2<<Math.log(t.length-1)/Math.LN2)-1,i=-~(1.6*n*r/t.length),a="";;)for(var o=e(i),s=i;s--;)if((a+=t[o[s]&n]||"").length===+r)return a}},181:(e,t,r)=>{"use strict";e.exports=r(1882)},488:(e,t,r)=>{"use strict";var n,i,a,o=r(87),s="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";function l(){a=!1}function u(e){if(e){if(e!==n){if(e.length!==s.length)throw new Error("Custom alphabet for shortid must be "+s.length+" unique characters. You submitted "+e.length+" characters: "+e);var t=e.split("").filter((function(e,t,r){return t!==r.lastIndexOf(e)}));if(t.length)throw new Error("Custom alphabet for shortid must be "+s.length+" unique characters. These characters were not unique: "+t.join(", "));n=e,l()}}else n!==s&&(n=s,l())}function c(){return a=a||function(){n||u(s);var e,t=n.split(""),r=[];for(o.nextValue();0<t.length;)e=o.nextValue(),e=Math.floor(e*t.length),r.push(t.splice(e,1)[0]);return r.join("")}()}e.exports={get:function(){return n||s},characters:function(e){return u(e),n},seed:function(e){o.seed(e),i!==e&&(l(),i=e)},lookup:function(e){return c()[e]},shuffled:c}},6239:(e,t,r)=>{"use strict";var n,i,a=r(5253);r(488),e.exports=function(e){var t="",r=Math.floor(.001*(Date.now()-1567752802062));return r===i?n++:(n=0,i=r),t=(t+=a(7))+a(e),0<n&&(t+=a(n)),t+a(r)}},5253:(e,t,r)=>{"use strict";var n=r(488),i=r(2019),a=r(4326);e.exports=function(e){for(var t,r=0,o="";!t;)o+=a(i,n.get(),1),t=e<Math.pow(16,r+1),r++;return o}},1882:(e,t,r)=>{"use strict";var n=r(488),i=r(6239),a=r(2040),o=r(3595)||0;function s(){return i(o)}e.exports=s,e.exports.generate=s,e.exports.seed=function(t){return n.seed(t),e.exports},e.exports.worker=function(t){return o=t,e.exports},e.exports.characters=function(e){return void 0!==e&&n.characters(e),n.shuffled()},e.exports.isValid=a},2040:(e,t,r)=>{"use strict";var n=r(488);e.exports=function(e){return!(!e||"string"!=typeof e||e.length<6||new RegExp("[^"+n.get().replace(/[|\\{}()[\]^$+*?.-]/g,"\\$&")+"]").test(e))}},2019:e=>{"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r="object"===("undefined"==typeof window?"undefined":t(window))&&(window.crypto||window.msCrypto),n=r&&r.getRandomValues?function(e){return r.getRandomValues(new Uint8Array(e))}:function(e){for(var t=[],r=0;r<e;r++)t.push(Math.floor(256*Math.random()));return t};e.exports=n},87:e=>{"use strict";var t=1;e.exports={nextValue:function(){return(t=(9301*t+49297)%233280)/233280},seed:function(e){t=e}}},3595:e=>{"use strict";e.exports=0},4230:(e,t,r)=>{"use strict";r.d(t,{N:()=>a,Z:()=>i});var n=r(8881);class i{constructor(e){this.mode="PerspectiveCamera",this.oCam=this.createOrthographic(),this.pCam=this.create(),this.backgroudDom=null,this.runScene=e,this.runScene.cb.resize.add("camera-background",(()=>{var e,t;this.backgroudDom&&(({width:e,height:t}=this.runScene.renderEx.getDomSize()),this.backgroudDom.style.width=e+"px",this.backgroudDom.style.height=t+"px")}))}setBackground(e){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},4330:(e,t,r)=>{"use strict";r.d(t,{sG:()=>n,zX:()=>i});const n=["map","normalMap","aoMap"],i=["map","metalnessMap","roughnessMap","normalMap","aoMap","emissiveMap","alphaMap","lightMap","envMap","displacementMap"]},1794:(e,t,r)=>{"use strict";r.d(t,{Z:()=>i});var n=r(9594);class i extends Map{constructor(e){e?super((0,n.js)(e,((e,t)=>[e,t]))):super()}toArray(e){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)}}},272:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});class n extends Set{constructor(e){super(),this.isSet=!0,this.add(e||[])}add(e){return Array.isArray(e)?e.map((e=>this.add(e))):super.add(e),this}remove(e){if(Array.isArray(e))e.map((e=>this.remove(e)));else{if(!super.has(e))return;super.delete(e)}return this}toArray(){return[...this]}map(e,t=!1){const r=[];return this.forEach((n=>{if(n=e(n),!t)return r.push(n);n&&r.push(n)})),r}find(e){for(const t of this)if(e(t))return t}filter(e){const t=[];for(const r of this)e(r)&&t.push(r);return t}}},5247:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});const n=t=r(8881)},7625:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});class n{constructor(e){this.runScene=e}}},7585:(e,t,r)=>{"use strict";r.d(t,{Z:()=>i});var n=r(5247);class i extends r(7625).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:p}=h;return{type:n,intensity:t,name:r,visible:a,color:o.getHexString(),castShadow:s,shadow:{mapSize:e.x,camera:{near:d,far:p,scale:h.x}},position:{x:i.x,y:i.y,z:i.z},rotation:{x:u.x,y:u.y,z:u.z},targetPosition:{x:c.position.x,y:c.position.y,z:c.position.z}}}parseJSON(e,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,position:r,rotation:i,targetPosition:a,name:o,visible:s,color:l,castShadow:u,shadow:c,type:h}=t,{mapSize:c,camera:d}=c,{scale:d,near:p,far:f}=d;e.intensity=t,e.type=h,e.name=o,e.visible=s,e.castShadow=u,e.color=new n.Z.Color("#"+l),e.position.set(r.x,r.y,r.z),e.rotation.set(i.x,i.y,i.z),e.target.position.set(a.x,a.y,a.z),e.add(e.target),e.shadow.mapSize.x=c,e.shadow.mapSize.y=c,e.shadow.camera.scale.x=d,e.shadow.camera.scale.y=d,e.shadow.camera.scale.z=d,e.shadow.camera.near=p,e.shadow.camera.far=f,e.shadow.camera.updateProjectionMatrix(),null!=(t=e.cameraHelper)&&t.update()}}},1269:(e,t,r)=>{"use strict";r.d(t,{ZP:()=>M,RQ:()=>C});var n=r(9251),i=r(8881);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return(o=Object.setPrototypeOf||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: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(5247);t=r(7625);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(7585);class p 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 f 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:p,radius:f}=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:f,bias:p},position:{x:h.x,y:h.y,z:h.z}}}parseJSON(e){const t=this.runScene.lightEx.get("PointLight",{addUndo:!1});var{name:e,type:r,intensity:n,distance:i,decay:a,renderOrder:o,color:s,visible:l,castShadow:u,shadow:h,position:d}=e,{mapSize:h,camera:p,bias:f,radius:m}=h,{scale:p,near:v,far:g}=p;return t.intensity=n,t.type=r,t.name=e,t.visible=l,t.castShadow=u,t.distance=i,t.renderOrder=o,t.color=new c.Z.Color("#"+s),t.position.set(d.x,d.y,d.z),t.shadow.mapSize.x=h,t.shadow.mapSize.y=h,t.shadow.bias=f,t.decay=a,t.shadow.radius=m,t.shadow.camera.scale.x=p,t.shadow.camera.scale.y=p,t.shadow.camera.scale.z=p,t.shadow.camera.near=v,t.shadow.camera.far=g,t.shadow.camera.updateProjectionMatrix(),t}}class 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:p,target:f}=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:p.x,y:p.y,z:p.z},targetPosition:{x:f.position.x,y:f.position.y,z:f.position.z}}}parseJSON(e){const t=this.runScene.lightEx.get("SpotLight",{addUndo:!1});var{name:e,type:r,color:n,distance:i,decay:a,intensity:o,angle:s,penumbra:l,visible:u,castShadow:h,shadow:d,renderOrder:p,position:f,targetPosition:m}=e,{bias:d,camera:v,normalBias:g,mapSize:y,radius:b}=d,v=v.near;return t.intensity=o,t.type=r,t.name=e,t.visible=u,t.distance=i,t.decay=a,t.angle=s,t.penumbra=l,t.renderOrder=p,t.castShadow=h,t.color=new c.Z.Color("#"+n),t.position.set(f.x,f.y,f.z),t.shadow.mapSize.x=y,t.shadow.mapSize.y=y,t.shadow.camera.near=v,t.target.position.set(m.x,m.y,m.z),t.shadow.bias=d,t.shadow.normalBias=g,t.shadow.radius=b,t.shadow.camera.updateProjectionMatrix(),t}}var g=r(4852),y=r(3735),b=r(2510),x=r(7169),w=r(1056),A=r(3778);const S={DirectionalLight:d.Z,PointLight:f,SpotLight:v,RectAreaLight:m,HemisphereLight:p,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 f(e),SpotLight:new v(e),RectAreaLight:new m(e),HemisphereLight:new p(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,addToTree:o}=(0,w.mergeObject)({isClone:!1,id:(0,n.getId)(),addUndo:!0,addToScene:!0,addToTree:!0},t);let s=new c.Z[e];if(s.position.y=10,s.name=e,s.userData.id=r,this.shadowList.includes(e)&&(s.castShadow=!0),this.setLight(s),!a)return s;if(this.helperList.includes(s.type)){const t=this.setLightHelper(s);t.push({model:s,parent:this.runScene.sceneEx.get(),addTree:o}),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==s?void 0:s.lightHelper)&&e.update()}else this.runScene.modelEx.add(s,void 0,{addUndo:i,addToTree:o});return this.runScene.modelEx.setSelectByModel(s,{isClone:t}),s}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},4038:(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(9594),i=r(9251),a=r(8881),o=r(4330);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 p{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}}p.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 f=r(110),m=r(6651),v=r(3735);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(5180);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 k(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=O.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 k(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 k extends a.MeshStandardMaterial{constructor(e,t,r){e?super(e):(super(),this.opacity=O.uniforms.opacity.value,this.transparent=O.uniforms.transparent.value,this.roughness=O.uniforms.roughness.value,this.metalness=O.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=O.uniforms.resolution.value,this.blurSize=O.uniforms.blurSize.value,this.mirror=new a.Uniform(O.uniforms.mirror.value),this.mixBlur=new a.Uniform(O.uniforms.mixBlur.value),this.mixStrength=new a.Uniform(O.uniforms.mixStrength.value),this.mixContrast=new a.Uniform(O.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=O.vertexParas+""+e.vertexShader,e.vertexShader=e.vertexShader.replace("#include <project_vertex>",O.vertexShader),e.fragmentShader=O.fragmentParas+""+e.fragmentShader,e.fragmentShader=e.fragmentShader.replace("#include <emissivemap_fragment>",O.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 O={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(911),j=r(8024),N=r(2510),H=r(6272),z=r(4233),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:p,SpriteMaterial:f.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:p,SpriteMaterial:f.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&&p.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:f.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")}},110:(e,t,r)=>{"use strict";r.d(t,{Z:()=>s});var n=r(8881),i=r(4038),a=r(3778),o=r(4233);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}}},3801:(e,t,r)=>{"use strict";r.d(t,{Ju:()=>a,t9:()=>i,zf:()=>o});var n=r(4233);const i={isDynamic:()=>{}},a={isDeleted(e,t=!1){var r;return!!e&&(!(null==(r=null==e?void 0:e.userData)||!r.isDeleted)||!!t&&a.isDeleted(e.parent,t))},setDeleted(e,t){e.userData&&(t?(0,n.M)(e,"isDeleted",!0):null!=(t=null==e?void 0:e.userData)&&delete t.isDeleted)}},o={setLock(e){(0,n.M)(e,"lock",!0)},reLock(e){delete e.userData.lock},isLock(e,t=!1){if(!e||"Scene"===e.type)return!1;var r=e.userData.lock;return t?!!r||o.isLock(e.parent,t):void 0!==r&&r}}},3778:(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:()=>k,normalModel:()=>X,selectableModel:()=>W,setClonedModel:()=>H,setDynamicModel:()=>G,setHelper:()=>R,setLayers:()=>L,withAnima:()=>O}),t=r(4356);var n=r.n(t),i=r(4298),a=r(9594),o=r(8881),s=r(4091),l=r(4230);const u=["Group","Box","Circle","Cylinder","Dodecahedron","Icosahedron","Lathe","Octahedron","Plane","Ring","Sphere","Sprite","Tetrahedron","Torus","TorusKnot","Tube","Reflector"];var c=r(1794),h=r(272),d=r(5247),p=r(1269),f=r(110),m=r(4038),v=r(4233),g=r(4852),y=r(3735),b=r(2510);class x extends r(4616).Z{constructor(e){super(),this.type="修改父元素",this.isUndoParent=!0,this.runScene=e.runScene,this.oldParent=e.oldParent,this.newParent=e.newParent,this.target=e.target}execute(){return this.redo(),this}_execute(e,t){e.attach(this.target),this.runScene.cb.model.setParent.cb({model:this.target,parent:e}),(null==(e=this.runScene.modelEx.select)?void 0:e.userData.id)===t.userData.id&&this.runScene.modelEx.selectNull()}undo(){this._execute(this.oldParent,this.newParent)}redo(){this._execute(this.newParent,this.oldParent)}}const w=x;var A=r(7169),S=r(4380),M=r(3729),C=r(1056);var B=r(3801);class _{constructor(e){this._selectModel=void 0,this.geometryMap=new c.Z,this.clonedMap=new c.Z,this.defNodeMap={castShadow:!1,receiveShadow:!1,renderOrder:0,visible:!0},this.add=(()=>{const e=(e,t)=>{t?(this.runScene.uniqueEx.model.add(e,{hasReset:!0}),this.runScene.cb.model.clone.cb(e)):this.runScene.uniqueEx.model.add(e)};return(t,r,n)=>{var{addUndo:i,isClone:a,select:o,addToTree:s}=(0,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&&!O(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)return l;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=f.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},k=(e,t)=>{const r=[];if(t.map((e=>{e=e.geometry,r.push(e)})),t=s.qf(r))return new d.Z.Mesh(t,e)},O=e=>0!==e.animations.length,R=e=>{e&&e.userData&&(e.userData.isHelper=!0)},I=e=>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,p.RQ)(e)&&!(0,l.N)(e)&&void 0===e.userData.unNormal,hasUnNormal:e=>void 0!==(null==(e=null==e?void 0:e.userData)?void 0:e.unNormal)}},7738:(e,t,r)=>{"use strict";r.d(t,{Z:()=>i,s:()=>a});var n=r(8881);class i{constructor(e){this.setSize=(e,t)=>{var{width:r,height:n}=this.getDomSize();this.runScene.setSize(e||r,t||n)},this.runScene=e,this.runScene.cb.resize.add("render-ex-resize",(({width:e,height:t})=>{this.setSize(e,t)}))}setBackground(e){this.runScene.assetsEx.engineDom.style.background=e}create(e){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()}},4233:(e,t,r)=>{"use strict";r.d(t,{M:()=>m,ZP:()=>f,bv:()=>y,is:()=>g});var n=r(3685),i=r(4298),a=r(8881),o=r(4038),s=r(3778),l=r(7738),u=r(911),c=r(3735),h=r(2510),d=r(7169),p=function(e,t,r,n){return new(r=r||Promise)((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(o,s)}l((n=n.apply(e,t||[])).next())}))};class f{constructor(e){this.oldFog=null,this.removeMap={light:{valid:e=>this.runScene.lightEx.isLight(e),remove:e=>this.runScene.lightEx.remove(e)}},this.runScene=e}each(e){return this.runScene.assetsEx.get().scene.traverseAncestors(e)}get(){return new Proxy(this.runScene.assetsEx.get().scene,{set:(e,t,r)=>(e[t]=r,!0)})}getNromal(){return this.get().children.filter((e=>!this.runScene.helperEx.isHelper(e)))}remove(e){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 p(this,void 0,void 0,(function*(){e instanceof String&&(e=yield this.runScene.textureEx.load(e)),(0,u.isTexture)(e)&&(e.userData.isBackgroud=!0);var r=this.get(),n=new h.Z({target:r,info:"background",newVal:e,oldVal:r.background,runScene:this.runScene,cb:e=>{}}).execute();return t&&this.runScene.undoEx.addUndo(n),this.runScene.cb.setScene.cb({scene:r,type:"background",val:r.background}),e}))}isBackground(e){return e.userData.isBackgroud}clean(){this.setBackground(null),this.setEnv(null),this.runScene.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 p(this,void 0,void 0,(function*(){var t=this.runScene.assetsEx.scene;let r;return e instanceof String&&(r=yield this.runScene.textureEx.load(e)),e instanceof File&&(r=yield this.runScene.textureEx.parse(e)),r=(r=null!=e&&e.isTexture?this.runScene.textureEx.clone(e):r)&&(0,u.setTextureMapping)(r),this.setNormal({model:t,info:"environment",val:r}),this.runScene.cb.setScene.cb({scene:t,type:"environment",val:r}),r}))}setNormal(e,t=!0){var{model:e,info:r,val:n}=e;e=new h.Z({target:e,info:r,oldVal:e[r],newVal:n,runScene:this.runScene}).execute(),t&&this.runScene.undoEx.addUndo(e)}setFogShow(e){var t=this.runScene.assetsEx.scene,{show:e,color:r}=e;e?this.setNormal({model:t,info:"fog",val:this.oldFog||new a.Fog(r||"#ffffff")}):(this.oldFog=t.fog,this.setNormal({model:t,info:"fog",val:null})),this.runScene.cb.setScene.cb({scene:t,type:"fog",val:t.fog})}setFog(e){var t=this.runScene.assetsEx.scene,{type:e,val:r}=e;t=new c.Z({target:t,typeList:["fog",e],newVal:r}).execute(),this.runScene.undoEx.addUndo(t)}sreenShotDefFile(e,t){e=e||Number(prompt("请输入截图的宽"))||1920,t=t||Number(prompt("请输入截图的高"))||1080;var{width:r,height:i}=(this.runScene.helperEx.unfocus(),this.runScene.renderEx.getDomSize());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]}},911:(e,t,r)=>{"use strict";r.r(t),r.d(t,{bindTextureBaseData:()=>w,default:()=>v,disposeTexture:()=>x,getBlobByTexture:()=>A,getCloneIdFromTexture:()=>P,getMimeByTexture:()=>y,getSizeByTexture:()=>E,getTextureGpuMemory:()=>b,getTextureMinFilter:()=>I,getUrlByTexture:()=>B,initTexture:()=>S,isClonedTexture:()=>D,isTexture:()=>T,loadTexture:()=>C,parseImageBitMapByBlob:()=>M,setTextureCloneId:()=>k,setTextureMapping:()=>_,setTextureMinFilter:()=>R,textureNameMap:()=>g,updateTexture:()=>O});var n=r(9594),i=r(9251),a=r(8881),o=r(5247),s=r(8024),l=r(1056),u=r(3729),c=r(2510);class h extends r(4616).Z{constructor(e){super(),this.info="函数修改",this.map=e}_execute(e,t){throw new Error("Method not implemented.")}execute(){return this.map.redo(),this}undo(){this.map.undo()}redo(){this.map.redo()}}const d=h;var p=r(4038),f=r(4233),m=function(e,t,r,n){return new(r=r||Promise)((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(o,s)}l((n=n.apply(e,t||[])).next())}))};class v{constructor(e){this.allTextures=new Set,this.setAnima=e=>{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,f.bv)(t,"minFilter"),w(t),this.getSameAndAddtoAll(t)}getDef(e){return e=new a.Texture(e),w(e),this.getSameAndAddtoAll(e)}getSameAndAddtoAll(e){var t=e.userData.md5;return(t=this.getSameTexture(t,e))?(x(e),t):(this.initTextureAndAddtoAll(e),e)}afterLoad(e,t){return m(this,void 0,void 0,(function*(){return this.getSameAndAddtoAll(yield w(e,t))}))}getSameTexture(e,t){if(!D(t))for(const n in this.runScene.uniqueEx.texture.map){var r=this.runScene.uniqueEx.texture.get(n);if(r.userData.md5===e&&r.mapping===t.mapping)return r}}initTextureAndAddtoAll(e){return m(this,void 0,void 0,(function*(){return S(e),w(e),this.addTextureToAll(e),e}))}addTextureToAll(e){var t=this.runScene.uniqueEx.texture.getLength();this.runScene.uniqueEx.texture.add(e),this.runScene.uniqueEx.texture.getLength()!==t&&this.runScene.cb.texture.add.cb(e)}getBlobAndBase64(e){return e.userData.blob?e.userData:(0,l.imgBitMapToBlobAndBase64)(e)}coverByImage(e,t){return m(this,void 0,void 0,(function*(){let r;r=T(t)?t:t?yield this.parse(t):null;var i=this.runScene.uniqueEx.texture.getMaterials(this.runScene.uniqueEx.getId(e));if(i){const t=[];(0,n.js)(i,((n,i)=>{const a=this.runScene.uniqueEx.material.get(n);a&&i.forEach((n=>{t.push(new s.Z({target:a,info:n,newVal:r,oldVal:e,runScene:this.runScene}).execute())}))})),this.runScene.undoEx.addUndo(t)}}))}remove(e){const t=(0,u.K)(e);var r=this.runScene.uniqueEx.texture.map[t];if(r){const i=[];r=r.materialMap,(0,n.js)(r,((e,t)=>{const r=this.runScene.uniqueEx.material.get(e);r&&(t.forEach((e=>{i.push(new c.Z({target:r,info:e,oldVal:r[e],newVal:null,runScene:this.runScene,cb(){(0,p.updateMaterial)(r)}}).execute())})),(0,p.updateMaterial)(r))}));const a=this.runScene.uniqueEx.texture.map[t];i.push(new d({undo:()=>{this.runScene.cb.texture.add.cb(e),this.runScene.uniqueEx.texture.add(e)},redo:()=>{this.runScene.cb.texture.remove.cb(e),this.runScene.uniqueEx.texture.remove(e)}}).execute(),new d({undo:()=>{this.runScene.uniqueEx.texture.map[t]=a},redo:()=>{this.runScene.uniqueEx.texture.map[t]=null}}).execute()),this.runScene.undoEx.addUndo(i)}}delete(e){this.runScene.cb.texture.remove.cb(e),this.runScene.uniqueEx.texture.remove(e),x(e)}reverseImageBitMapTexture(e){return m(this,void 0,void 0,(function*(){var{canvas:t,imageBitMap:r}=yield(0,l.reverseImageBitMap)(e.image);const i=new a.Texture(r);return i.needsUpdate=!0,r=this.runScene.uniqueEx.texture.map[e.userData.id],(0,n.js)(r.materialMap,((e,t)=>{const r=this.runScene.uniqueEx.material.get(e);t.forEach((e=>{r[e]=i,this.runScene.uniqueEx.texture.addMaterial(i,{material:r,type:e})}))})),S(i),yield w(i),this.runScene.cb.texture.add.cb(i),this.delete(e),(0,l.disposeCanvas)(t),i}))}}const g={环境遮蔽:"aoMap",法线:"normalMap",金属度:"metalnessMap",粗糙度:"roughnessMap",自发光:"emissiveMap",颜色:"map",置换:"displacementMap",光照贴图:"lightMap",环境:"envMap",透明度:"alphaMap"},y=e=>1023===e.format?"image/png":"image/jpeg",b=e=>{var{width:e,height:t}=e.image;return e*t*4*1.33},x=e=>{var t,r;e&&(t=e.image,r=e.userData.url,t instanceof ImageBitmap?(0,l.disposeImageBitMap)(t):t instanceof HTMLCanvasElement&&(0,l.disposeCanvas)(t),URL.revokeObjectURL(r),e.dispose())},w=(e,t)=>m(void 0,void 0,void 0,(function*(){var r=(0,l.isBlob)(e.userData.blob)?e.userData.blob:null;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,k=(e,t)=>{e.userData.cloneSourceId=t},O=e=>{e.needsUpdate=!0},R=(e,t)=>{e.minFilter=o.Z["linear"===t?"LinearMipmapLinearFilter":"NearestFilter"],(0,f.M)(e,"minFilter",t),O(e)},I=e=>(0,f.is)(e,"minFilter")},6651:(e,t,r)=>{"use strict";r.d(t,{ZP:()=>n,d9:()=>i});class n{constructor(e){this.undos=[],this.redos=[],this.dataMap={history:[],index:0},this.runScene=e}undo(){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}}},4852:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});class n extends r(4773).Z{constructor(e){super(e),this.type="添加模型",this.isUndoAdd=!0}_execute(e){return Promise.reject()}undo(){this.remove({model:this.model,parent:this.parent,addTree:this.addTree,isClone:this.isClone,runScene:this.runScene})}redo(){this.add({model:this.model,parent:this.parent,addTree:this.addTree,isClone:this.isClone,runScene:this.runScene})}execute(){return this.redo(),this}}},4773:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});class n{constructor(e){this.addTree=!0,this.isClone=!1,this.cb=(e,t)=>{};var{model:e,parent:t,cb:r,addTree:n,isClone:i,runScene:a}=e;this.runScene=a,this.model=e,this.parent=t,!1===n&&(this.addTree=n),!0===i&&(this.isClone=i),r&&(this.cb=r)}remove(e){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)}}},4616:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});class n{}},8024:(e,t,r)=>{"use strict";r.d(t,{Z:()=>a});var n=r(4330);class i extends r(4616).Z{constructor(e){super(),this.isUndoMaterial=!0,this.type="修改材质";var{target:e,info:t,newVal:r,oldVal:n,runScene:i,cb:a}=e;this.runScene=i,this.target=e,this.info=t,this.newVal=r,this.oldVal=n,this.cb=a}_execute(e,t){if(this.target[this.info]=e,this.target.needsUpdate=!0,n.zX.includes(this.info)){if(!e)return;this.runScene.uniqueEx.texture.addMaterial(e,{material:this.target,type:this.info})}"depthWrite"===this.info&&!0===e&&delete this.target.userData[this.info],null!=(e=this.cb)&&e.call(this,this)}execute(){return this.redo(),this}undo(){this._execute(this.oldVal,this.newVal)}redo(){this._execute(this.newVal,this.oldVal)}}const a=i},3735:(e,t,r)=>{"use strict";r.d(t,{Z:()=>o});var n=r(4298),i=r(9594);class a extends r(4616).Z{constructor(e){super(),this.type="多层级修改",this.isUndoMultipLevel=!0,this.target=e.target,this.typeList=e.typeList,this.new=e.newVal,this.cb=e.cb,this.old=(0,i.qR)(e.target,this.typeList)[(0,n.lastArrayEle)(e.typeList)]}execute(){return this.redo(),this}_execute(e){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},2510:(e,t,r)=>{"use strict";r.d(t,{Z:()=>i});class n extends r(4616).Z{constructor(e){super(),this.type="修改属性",this.isUndoNormal=!0,this.cb=e=>{};var{target:e,info:t,oldVal:r,newVal:n,runScene:i,cb:a,executeCb:o}=e;this.runScene=i,this.target=e,this.info=t,this.newVal=n,this.oldVal=r,a&&(this.cb=a),o&&(this.executeCb=o)}_execute(e){var{target:t,info:r}=this;if(this.executeCb)return this.executeCb({target:t,info:r,val:e});this.target[this.info]=e,"name"===this.info&&this.target.isObject3D?(t=this.runScene.uniqueEx.model.parseName(this.target),r=e,this.runScene.cb.model.changeName.cb({model:this.target,name:e=t||e,oldName:r})):"material"===this.info?this.runScene.uniqueEx.material.addModel(this.target,e,e===this.newVal?this.oldVal:this.newVal):"visible"===this.info&&this.runScene.cb.model.setVisible.cb({model:this.target,visible:e}),this.runScene.cb.model.change.cb({type:this.info,model:this.target,val:e}),this.cb(this.target)}execute(){return this.redo(),this}undo(){this._execute(this.oldVal)}redo(){this._execute(this.newVal)}}const i=n},7169:(e,t,r)=>{"use strict";r.d(t,{Z:()=>n});class n extends r(4773).Z{constructor(e){super(e),this.type="移除模型",this.isUndoRemove=!0}undo(){this.add({model:this.model,parent:this.parent,addTree:this.addTree,runScene:this.runScene})}redo(){this.remove({model:this.model,parent:this.parent,addTree:this.addTree,runScene:this.runScene})}_execute(e){return Promise.reject()}execute(){return this.redo(),this}}},4380:(e,t,r)=>{"use strict";r.d(t,{Z:()=>i});class n extends r(4616).Z{constructor(e){super(),this.isUndoV3=!0,this.type="三维矩阵修改";var{target:e,info:t,newV3:r,oldV3:n,runScene:i}=e;this.target=e,this.info=t,this.runScene=i,this.newV3=r,this.oldV3=n,this.target.uuid===(null==(e=this.runScene.modelEx.select)?void 0:e.uuid)&&(this.runScene.cb.model.setSelect.cb(null),this.runScene.cb.model.setSelect.cb(this.target))}_execute(e){this.target[this.info].copy(e),this.target.uuid===(null==(e=this.runScene.modelEx.select)?void 0:e.uuid)&&this.runScene.helperEx.focus(this.target)}execute(e=!0){return e&&this.redo(),this}undo(){this._execute(this.oldV3)}redo(){this._execute(this.newV3)}}const i=n},3729:(e,t,r)=>{"use strict";r.d(t,{Z:()=>h,K:()=>d});var n=r(9594),i=r(9251),a=r(4038);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(158);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)||""},1056:(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(5137),i=r(6272),a=r(7453),o=r(158);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)}},5137:(e,t,r)=>{"use strict";r.d(t,{BW:()=>f,Cm:()=>p,Fs:()=>x,Pk:()=>y,Rd:()=>m,eZ:()=>w,gW:()=>l,jH:()=>d,lC:()=>v,lU:()=>h,mH:()=>S,oZ:()=>A,rx:()=>u,s4:()=>s,v1:()=>c,ve:()=>g,xK:()=>b});var n=r(5247),i=r(911),a=r(6272),o=function(e,t,r,n){return new(r=r||Promise)((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(o,s)}l((n=n.apply(e,t||[])).next())}))};const s=e=>{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)}))},p=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)})),f=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}},6272:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{B1:()=>getArrIndexByItem,F1:()=>sameArr,GG:()=>longestCommonPrefix,Gm:()=>mergeObject,J9:()=>rmArrEle,Jr:()=>base64ToBlob,Lj:()=>isBlob,Ls:()=>getMacro,Mh:()=>getTruthBase64,Ne:()=>fromCode,Ni:()=>toCode,OE:()=>fileAndBlobToCanvas,Op:()=>getTypeByBase64,RG:()=>base64ToArrayBuffer,Rn:()=>addElesFromIndexToArr,Rz:()=>filterFiles,U:()=>deepMergeObject,U9:()=>toTimeString,ZM:()=>getMd5,_c:()=>canvasToBlob,a_:()=>fileToBlob,cM:()=>LimitCb,cO:()=>bufferToArrayBuffer,d9:()=>clone,gY:()=>anima,h3:()=>rmPartOfString,hK:()=>getTime,hl:()=>blobToFile,iM:()=>transByte,kk:()=>getFilesFromFileList,lG:()=>validType,mr:()=>getRandomColor,nR:()=>getNamesByNum,o4:()=>urlToCanvas,oL:()=>getType,oo:()=>arrayBufferToBlobUr,pX:()=>urlToBlob,sM:()=>arrayBufferToBase64,sR:()=>getRes,xC:()=>getProgress,xb:()=>isEmpty,xl:()=>getFilesByDataTransfer});var _allex_md5__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(1129),_allex_md5__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(_allex_md5__WEBPACK_IMPORTED_MODULE_0__),axios__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(3300),axios__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(axios__WEBPACK_IMPORTED_MODULE_1__),js_funcs_trans_trans_file__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(3685),js_funcs_trans_trans_file__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__.n(js_funcs_trans_trans_file__WEBPACK_IMPORTED_MODULE_2__),js_funcs_type_obj__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(9594),_libs_Anima__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(2958),_UtilsImage__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(5137),__awaiter=function(e,t,r,n){return new(r=r||Promise)((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(o,s)}l((n=n.apply(e,t||[])).next())}))};const anima=(e,t,r,n,i)=>{let a=Object.assign({},e),o=new _libs_Anima__WEBPACK_IMPORTED_MODULE_4__.Q3(a,r,t).eventCallback("onUpdate",(e=>n&&n(a))).eventCallback("onComplete",(e=>{i&&i(),_libs_Anima__WEBPACK_IMPORTED_MODULE_4__.Q3.killTweensOf(o)}));return o},base64ToArrayBuffer=e=>__awaiter(void 0,void 0,void 0,(function*(){-1!==e.indexOf(",")&&(e=getTruthBase64(e));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;return!0}var a=e.length;const o=Math.floor(a/r);for(const n of new Array(r).fill("").map(((e,t)=>(t+1)*o)))if(e[n]!==t[n])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}},158:(e,t,r)=>{"use strict";r.d(t,{An:()=>a,FW:()=>o,hz:()=>i,te:()=>n});const n=e=>{},i=e=>"editor"===e.optionsEx.options.mode,a=e=>"running"===e.optionsEx.options.mode,o=e=>e.optionsEx.options},7453:(e,t,r)=>{"use strict";r.d(t,{Zv:()=>ue,F:()=>se,Hg:()=>te,Z7:()=>re,UZ:()=>$,YG:()=>ee,ol:()=>q,A2:()=>de,Gm:()=>he,aM:()=>pe,kG:()=>oe,Sp:()=>Y,SI:()=>le,yT:()=>ce,hX:()=>ae,VU:()=>X,hs:()=>ie,vp:()=>ne,xr:()=>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||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: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||function(e,t){return e.__proto__=t,e})(e,t)}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}c.prototype.isLineSegmentsGeometry=!0,n.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new n.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},n.ShaderLib.line={uniforms:n.UniformsUtils.merge([n.UniformsLib.common,n.UniformsLib.fog,n.UniformsLib.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// get the offset direction as perpendicular to the view vector\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 offset;\n\t\t\t\tif ( position.y < 0.5 ) {\n\n\t\t\t\t\toffset = normalize( cross( start.xyz, worldDir ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toffset = normalize( cross( end.xyz, worldDir ) );\n\n\t\t\t\t}\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\tfloat forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// extend the line bounds to encompass endcaps\n\t\t\t\t\tstart.xyz += - worldDir * linewidth * 0.5;\n\t\t\t\t\tend.xyz += worldDir * linewidth * 0.5;\n\n\t\t\t\t\t// shift the position of the quad so it hugs the forward edge of the line\n\t\t\t\t\toffset.xy -= dir * forwardOffset;\n\t\t\t\t\toffset.z += 0.5;\n\n\t\t\t\t#endif\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\toffset.xy += dir * 2.0 * forwardOffset;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth * 0.5;\n\n\t\t\t\t// set the world position\n\t\t\t\tworldPos = ( position.y < 0.5 ) ? start : end;\n\t\t\t\tworldPos.xyz += offset;\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"};var m=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=f(e);if(r=t?(r=f(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===h(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return p(n)}}(i);function i(e){var t;if(this instanceof i)return t=r.call(this,{type:"LineMaterial",uniforms:n.UniformsUtils.clone(n.ShaderLib.line.uniforms),vertexShader:n.ShaderLib.line.vertexShader,fragmentShader:n.ShaderLib.line.fragmentShader,clipping:!0}),Object.defineProperties(p(t),{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(e){!0===e?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashed:{enumerable:!0,get:function(){return Boolean("USE_DASH"in this.defines)},set:function(e){Boolean(e)!==Boolean("USE_DASH"in this.defines)&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},alphaToCoverage:{enumerable:!0,get:function(){return Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)},set:function(e){Boolean(e)!==Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),!0===e?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),t.setValues(e),t;throw new TypeError("Cannot call a class as a function")}return t=i,Object.defineProperty(t,"prototype",{writable:!1}),t}(n.ShaderMaterial);function 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||function(e,t){return e.__proto__=t,e})(e,t)}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf: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,k=new n.Box3,O=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(),O.copy(o.boundingSphere).applyMatrix4(e),a=r?.5*A:I(i,Math.max(i.near,O.distanceToPoint(b.origin)),s.resolution),O.radius+=a,!1!==b.intersectsSphere(O)&&(null===o.boundingBox&&o.computeBoundingBox(),k.copy(o.boundingBox).applyMatrix4(e),a=r?.5*A:I(i,Math.max(i.near,k.distanceToPoint(b.origin)),s.resolution),k.expandByScalar(a),!1!==b.intersectsBox(k)))if(r)for(var l=t,u=0,c=x.count;u<c;u++){D.start.fromBufferAttribute(x,u),D.end.fromBufferAttribute(w,u);var h=new n.Vector3,d=new n.Vector3;b.distanceSqToSegment(D.start,D.end,d,h),d.distanceTo(h)<.5*A&&l.push({point:d,pointOnLine:h,distance:b.origin.distanceTo(d),object:this,face:null,faceIndex:u,uv:null,uv2:null})}else{var p=this,f=t,m=(o=i).projectionMatrix,v=p.material.resolution,g=p.matrixWorld,y=(e=p.geometry).attributes.instanceStart,S=e.attributes.instanceEnd,M=-o.near;b.at(1,_),_.w=1,_.applyMatrix4(o.matrixWorldInverse),_.applyMatrix4(m),_.multiplyScalar(1/_.w),_.x*=v.x/2,_.y*=v.y/2,_.z=0,E.copy(_),T.multiplyMatrices(o.matrixWorldInverse,g);for(var 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),f.push({point:U,pointOnLine:F,distance:b.origin.distanceTo(U),object:p,face:null,faceIndex:G,uv:null,uv2:null})))}}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(n.Mesh);function F(e){return(F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function U(){return(U="undefined"!=typeof Reflect&&Reflect.get?Reflect.get: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||function(e,t){return e.__proto__=t,e})(e,t)}function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf: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||function(e,t){return e.__proto__=t,e})(e,t)}function V(e){return(V=Object.setPrototypeOf?Object.getPrototypeOf: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(699)),Z=r(3693),W=r(5247);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}},pe=()=>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__},4819:(e,t,r)=>{"use strict";r.d(t,{T:()=>c,w:()=>s});var n=r(8881);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){t&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var s=function(){function e(){i(this,e),this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}return o(e,[{key:"setSize",value:function(){}},{key:"render",value:function(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}}]),e}(),l=new n.OrthographicCamera(-1,1,1,-1,0,1),u=new n.BufferGeometry,c=(u.setAttribute("position",new n.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),u.setAttribute("uv",new n.Float32BufferAttribute([0,2,0,0,2,0],2)),function(){function e(t){i(this,e),this._mesh=new n.Mesh(u,t)}return o(e,[{key:"dispose",value:function(){this._mesh.geometry.dispose()}},{key:"render",value:function(e){e.render(this._mesh,l)}},{key:"material",get:function(){return this._mesh.material},set:function(e){this._mesh.material=e}}]),e}())},5180:(e,t,r)=>{"use strict";r.d(t,{T:()=>u});var n=r(8881),i=r(4819);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return(o=Object.setPrototypeOf||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:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=function(e){var t=a;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e);var r=s(a);function a(e,t){var o;if(this instanceof a)return(o=r.call(this)).textureID=void 0!==t?t:"tDiffuse",e instanceof n.ShaderMaterial?(o.uniforms=e.uniforms,o.material=e):e&&(o.uniforms=n.UniformsUtils.clone(e.uniforms),o.material=new n.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:o.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),o.fsQuad=new i.T(o.material),o;throw new TypeError("Cannot call a class as a function")}return t=a,(e=[{key:"render",value:function(e,t,r){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=r.texture),this.fsQuad.material=this.material,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)),this.fsQuad.render(e)}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),a}(i.w)},699:(e,t,r)=>{"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(){return(s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get: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||function(e,t){return e.__proto__=t,e})(e,t)}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf: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,p=new t.Matrix4,f=new t.Vector3,m=new t.Vector3,v=o((function e(){var t,r,n,a,o=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},s=(i(this,e),this),l={objects:new WeakMap},u=void 0!==o.element?o.element:document.createElement("div");function c(e,t){return f.setFromMatrixPosition(e.matrixWorld),m.setFromMatrixPosition(t.matrixWorld),f.distanceToSquared(m)}u.style.overflow="hidden",this.domElement=u,this.getSize=function(){return{width:t,height:r}},this.render=function(e,t){!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),d.copy(t.matrixWorldInverse),p.multiplyMatrices(t.projectionMatrix,d),function e(t,r,i){var o;t.isCSS2DObject&&(h.setFromMatrixPosition(t.matrixWorld),h.applyMatrix4(p),o=!0===t.visible&&-1<=h.z&&h.z<=1&&!0===t.layers.test(i.layers),t.element.style.display=1==o?"":"none",1==o&&(t.onBeforeRender(s,r,i),o=t.element,/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,f=t.children.length;d<f;d++)e(t.children[d],r,i)}(e,e,t);for(var r=function(e){var t=[];return e.traverse((function(e){e.isCSS2DObject&&t.push(e)})),t}(e).sort((function(e,t){return e.renderOrder!==t.renderOrder?t.renderOrder-e.renderOrder:l.objects.get(e).distanceToCameraSquared-l.objects.get(t).distanceToCameraSquared})),i=r.length,o=0,f=r.length;o<f;o++)r[o].element.style.zIndex=i-o},this.setSize=function(e,i){n=(t=e)/2,a=(r=i)/2,u.style.width=e+"px",u.style.height=i+"px"}}))},3693:(e,t,r)=>{"use strict";r.d(t,{P7:()=>g,cp:()=>v,lX:()=>x});var n=r(8881);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(){return(l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get: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||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:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var p=new n.Vector3,f=new n.Quaternion,m=new n.Vector3,v=function(){u(t,n.Object3D);var e=h(t);function t(){var r,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return a(this,t),(r=e.call(this)).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(p,f,m),y.setPosition(p),y.scale(m),y.elements[3]=0,y.elements[7]=0,y.elements[11]=0,y.elements[15]=1,v(y)):v(t.matrixWorld),o=t.element,void 0!==(u=l.objects.get(t))&&u.style===a||(u={style:o.style.transform=a},l.objects.set(t,u)),o.parentNode!==c&&c.appendChild(o),t.onAfterRender(s,r,n)));for(var h=0,d=t.children.length;h<d;h++)e(t.children[h],r,n,i)}(e,e,t,a)},this.setSize=function(e,a){n=(t=e)/2,i=(r=a)/2,u.style.width=e+"px",u.style.height=a+"px",c.style.width=e+"px",c.style.height=a+"px"}}))},4091:(e,t,r)=>{"use strict";r.d(t,{qf:()=>function(e){for(var t,r,a=1<arguments.length&&void 0!==arguments[1]&&arguments[1],o=null!==e[0].index,s=new Set(Object.keys(e[0].attributes)),l=new Set(Object.keys(e[0].morphAttributes)),u={},c={},h=e[0].morphTargetsRelative,d=new n.BufferGeometry,p=0,f=0;f<e.length;++f){var m,v,g=e[f],y=0;if(o!=(null!==g.index))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(m in g.attributes){if(!s.has(m))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+'. All geometries must have compatible attributes; make sure "'+m+'" attribute exists among all geometries, or in none of them.'),null;void 0===u[m]&&(u[m]=[]),u[m].push(g.attributes[m]),y++}if(y!==s.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". Make sure all geometries have the same number of attributes."),null;if(h!==g.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(v in g.morphAttributes){if(!l.has(v))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". .morphAttributes must be consistent throughout all geometries."),null;void 0===c[v]&&(c[v]=[]),c[v].push(g.morphAttributes[v])}if(d.userData.mergedUserData=d.userData.mergedUserData||[],d.userData.mergedUserData.push(g.userData),a){var b=void 0;if(o)b=g.index.count;else{if(void 0===g.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". The geometry must have either an index or a position attribute"),null;b=g.attributes.position.count}d.addGroup(p,b,f),p+=b}}if(o){for(var x=0,w=[],A=0;A<e.length;++A){for(var S=e[A].index,M=0;M<S.count;++M)w.push(S.getX(M)+x);x+=e[A].attributes.position.count}d.setIndex(w)}for(t in u){var 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:()=>fi,EncodeUTF8:()=>Ji,Gunzip:()=>Bi,Gzip:()=>Ai,Inflate:()=>yi,Unzip:()=>la,UnzipInflate:()=>oa,UnzipPassThrough:()=>aa,Unzlib:()=>Oi,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[p]=r,--o||t(null,i))}var c=(m=Qi(e,l,u))[0],h=m[1],d=m[2],p=m[3],f=m[4],m=m[5];if(m=Xi(e,m),l=f,c)if(8==c)if(f=e.subarray(m,m+h),h<32e4)try{s(null,wi(f,new en(d)))}catch(a){s(a,null)}else r.push(xi(f,{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 p=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],p=a[c],f=p[0],m=p[1],v=Hn(),g=f.length,y=(v.p(f),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(f,m))}catch(p){t(p,null)}else d.push(vi(f,m,t));else t(null,f)},f=0;f<c;++f)p(f);return n},zipSync:()=>function(e,t){var r,n={},i=[],a=(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),p=d&&d.length,f=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!=p,o:a,compression:u})),a+=30+c+f+v,o+=76+2*(c+f)+(p||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[ki]}],(function(e){return ti(ki(e.data[0],e.data[1]))}),4,r)},zlibSync:()=>ki}),{}),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: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||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:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var p=new r.Raycaster,f=new r.Vector3,m=new r.Vector3,v=new r.Quaternion,g={X:new r.Vector3(1,0,0),Y:new r.Vector3(0,1,0),Z:new r.Vector3(0,0,1)},y={type:"change"},b={type:"mouseDown"},x={type:"mouseUp",mode:null},w={type:"objectChange"},A=function(){l(t,r.Object3D);var e=c(t);function t(n,a){i(this,t),o=e.call(this),void 0===a&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),a=document),o.visible=!1,o.domElement=a,o.domElement.style.touchAction="none";var o,s=new U,l=(o._gizmo=s,o.add(s),new G),u=(o._plane=l,o.add(l),h(o));function c(e,t){var r=t;Object.defineProperty(u,e,{get:function(){return void 0!==r?r:t},set:function(t){r!==t&&(r=t,l[e]=t,s[e]=t,u.dispatchEvent({type:e+"-changed",value:t}),u.dispatchEvent(y))}}),u[e]=t,l[e]=t,s[e]=t}c("camera",n),c("object",void 0),c("enabled",!0),c("axis",null),c("mode","translate"),c("translationSnap",null),c("rotationSnap",null),c("scaleSnap",null),c("space","world"),c("size",1),c("dragging",!1),c("showX",!0),c("showY",!0),c("showZ",!0),a=new r.Vector3,n=new r.Vector3;var d=new r.Quaternion,p=new r.Quaternion,f=new r.Vector3,m=new r.Quaternion,v=new r.Vector3,g=new r.Vector3,b=new r.Vector3,x=new r.Vector3;return c("worldPosition",a),c("worldPositionStart",n),c("worldQuaternion",d),c("worldQuaternionStart",p),c("cameraPosition",f),c("cameraQuaternion",m),c("pointStart",v),c("pointEnd",g),c("rotationAxis",b),c("rotationAngle",0),c("eye",x),o._offset=new r.Vector3,o._startNorm=new r.Vector3,o._endNorm=new r.Vector3,o._cameraScale=new r.Vector3,o._parentPosition=new r.Vector3,o._parentQuaternion=new r.Quaternion,o._parentQuaternionInv=new r.Quaternion,o._parentScale=new r.Vector3,o._worldScaleStart=new r.Vector3,o._worldQuaternionInv=new r.Quaternion,o._worldScale=new r.Vector3,o._positionStart=new r.Vector3,o._quaternionStart=new r.Quaternion,o._scaleStart=new r.Vector3,o._getPointer=function(e){var t;return this.domElement.ownerDocument.pointerLockElement?{x:0,y:0,button:e.button}:(t=this.domElement.getBoundingClientRect(),{x:(e.clientX-t.left)/t.width*2-1,y:-(e.clientY-t.top)/t.height*2+1,button:e.button})}.bind(h(o)),o._onPointerDown=function(e){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(e.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(e)),this.pointerDown(this._getPointer(e)))}.bind(h(o)),o._onPointerHover=function(e){if(this.enabled)switch(e.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(e))}}.bind(h(o)),o._onPointerMove=function(e){this.enabled&&this.pointerMove(this._getPointer(e))}.bind(h(o)),o._onPointerUp=function(e){this.enabled&&(this.domElement.releasePointerCapture(e.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(e)))}.bind(h(o)),o.domElement.addEventListener("pointerdown",o._onPointerDown),o.domElement.addEventListener("pointermove",o._onPointerHover),o.domElement.addEventListener("pointerup",o._onPointerUp),o}return o(t,[{key:"updateMatrixWorld",value:function(){void 0!==this.object&&(this.object.updateMatrixWorld(),null===this.object.parent?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),s(d(t.prototype),"updateMatrixWorld",this).call(this,this)}},{key:"pointerHover",value:function(e){void 0!==this.object&&!0!==this.dragging&&(p.setFromCamera(e,this.camera),e=S(this._gizmo.picker[this.mode],p),this.axis=e?e.object.name:null)}},{key:"pointerDown",value:function(e){void 0!==this.object&&!0!==this.dragging&&0===e.button&&null!==this.axis&&(p.setFromCamera(e,this.camera),(e=S(this._plane,p,!0))&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(e.point).sub(this.worldPositionStart)),this.dragging=!0,b.mode=this.mode,this.dispatchEvent(b))}},{key:"pointerMove",value:function(e){var t=this.axis,r=this.mode,n=this.object,i=this.space;"scale"===r?i="local":"E"!==t&&"XYZE"!==t&&"XYZ"!==t||(i="world"),void 0!==n&&null!==t&&!1!==this.dragging&&-1===e.button&&(p.setFromCamera(e,this.camera),(e=S(this._plane,p,!0))&&(this.pointEnd.copy(e.point).sub(this.worldPositionStart),"translate"===r?(this._offset.copy(this.pointEnd).sub(this.pointStart),"local"===i&&"XYZ"!==t&&this._offset.applyQuaternion(this._worldQuaternionInv),-1===t.indexOf("X")&&(this._offset.x=0),-1===t.indexOf("Y")&&(this._offset.y=0),-1===t.indexOf("Z")&&(this._offset.z=0),("local"===i&&"XYZ"!==t?this._offset.applyQuaternion(this._quaternionStart):this._offset.applyQuaternion(this._parentQuaternionInv)).divide(this._parentScale),n.position.copy(this._offset).add(this._positionStart),this.translationSnap&&("local"===i&&(n.position.applyQuaternion(v.copy(this._quaternionStart).invert()),-1!==t.search("X")&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.position.applyQuaternion(this._quaternionStart)),"world"===i&&(n.parent&&n.position.add(f.setFromMatrixPosition(n.parent.matrixWorld)),-1!==t.search("X")&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.parent&&n.position.sub(f.setFromMatrixPosition(n.parent.matrixWorld))))):"scale"===r?(-1!==t.search("XYZ")?(e=this.pointEnd.length()/this.pointStart.length(),this.pointEnd.dot(this.pointStart)<0&&(e*=-1),m.set(e,e,e)):(f.copy(this.pointStart),m.copy(this.pointEnd),f.applyQuaternion(this._worldQuaternionInv),m.applyQuaternion(this._worldQuaternionInv),m.divide(f),-1===t.search("X")&&(m.x=1),-1===t.search("Y")&&(m.y=1),-1===t.search("Z")&&(m.z=1)),n.scale.copy(this._scaleStart).multiply(m),this.scaleSnap&&(-1!==t.search("X")&&(n.scale.x=Math.round(n.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Y")&&(n.scale.y=Math.round(n.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Z")&&(n.scale.z=Math.round(n.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))):"rotate"===r&&(this._offset.copy(this.pointEnd).sub(this.pointStart),e=20/this.worldPosition.distanceTo(f.setFromMatrixPosition(this.camera.matrixWorld)),"E"===t?(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1):"XYZE"===t?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(f.copy(this.rotationAxis).cross(this.eye))*e):"X"!==t&&"Y"!==t&&"Z"!==t||(this.rotationAxis.copy(g[t]),f.copy(g[t]),"local"===i&&f.applyQuaternion(this.worldQuaternion),this.rotationAngle=this._offset.dot(f.cross(this.eye).normalize())*e),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),"local"===i&&"E"!==t&&"XYZE"!==t?(n.quaternion.copy(this._quaternionStart),n.quaternion.multiply(v.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).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 p}},{key:"getMode",value:function(){return this.mode}},{key:"setMode",value:function(e){this.mode=e}},{key:"setTranslationSnap",value:function(e){this.translationSnap=e}},{key:"setRotationSnap",value:function(e){this.rotationSnap=e}},{key:"setScaleSnap",value:function(e){this.scaleSnap=e}},{key:"setSize",value:function(e){this.size=e}},{key:"setSpace",value:function(e){this.space=e}},{key:"update",value:function(){console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.")}}]),t}();function S(e,t,r){for(var n=t.intersectObject(e,!0),i=0;i<n.length;i++)if(n[i].object.visible||r)return n[i];return!1}A.prototype.isTransformControls=!0;var 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,k=new r.Vector3(1,0,0),O=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 p=(((a=a.clone()).color.setHex(7895160),v=new r.CylinderGeometry(0,.04,.1,12)).translate(0,.05,0),new r.BoxGeometry(.08,.08,.08)),f=(p.translate(0,.04,0),new r.BufferGeometry);function m(e,t){return(e=new r.TorusGeometry(e,.0075,3,64,t*Math.PI*2)).rotateY(Math.PI/2),e.rotateX(Math.PI/2),e}(f.setAttribute("position",new r.Float32BufferAttribute([0,0,0,1,0,0],3)),S=new r.CylinderGeometry(.0075,.0075,.5,3)).translate(0,.25,0);var v={X:[[new r.Mesh(v,w),[.5,0,0],[0,0,-Math.PI/2]],[new r.Mesh(v,w),[-.5,0,0],[0,0,Math.PI/2]],[new r.Mesh(S,w),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new r.Mesh(v,A),[0,.5,0]],[new r.Mesh(v,A),[0,-.5,0],[Math.PI,0,0]],[new r.Mesh(S,A)]],Z:[[new r.Mesh(v,l),[0,0,.5],[Math.PI/2,0,0]],[new r.Mesh(v,l),[0,0,-.5],[-Math.PI/2,0,0]],[new r.Mesh(S,l),null,[Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.OctahedronGeometry(.1,0),d.clone()),[0,0,0]]],XY:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),h.clone()),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),u.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),c.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},g={X:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[.3,0,0],[0,0,-Math.PI/2]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,.3,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,-.3,0],[0,0,Math.PI]]],Z:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,0,.3],[Math.PI/2,0,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.OctahedronGeometry(.2,0),s)]],XY:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]]},y={START:[[new r.Mesh(new r.OctahedronGeometry(.01,2),o),null,null,null,"helper"]],END:[[new r.Mesh(new r.OctahedronGeometry(.01,2),o),null,null,null,"helper"]],DELTA:[[new r.Line(((y=new r.BufferGeometry).setAttribute("position",new r.Float32BufferAttribute([0,0,0,1,1,1],3)),y),o),null,null,null,"helper"]],X:[[new r.Line(f,o.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new r.Line(f,o.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new r.Line(f,o.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},b=(a={XYZE:[[new r.Mesh(m(.5,1),a),null,[0,Math.PI/2,0]]],X:[[new r.Mesh(m(.5,.5),w)]],Y:[[new r.Mesh(m(.5,.5),A),null,[0,0,-Math.PI/2]]],Z:[[new r.Mesh(m(.5,.5),l),null,[0,Math.PI/2,0]]],E:[[new r.Mesh(m(.75,1),b),null,[0,Math.PI/2,0]]]},{AXIS:[[new r.Line(f,o.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]}),x={XYZE:[[new r.Mesh(new r.SphereGeometry(.25,10,8),s)]],X:[[new r.Mesh(new r.TorusGeometry(.5,.1,4,24),s),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new r.Mesh(new r.TorusGeometry(.5,.1,4,24),s),[0,0,0],[Math.PI/2,0,0]]],Z:[[new r.Mesh(new r.TorusGeometry(.5,.1,4,24),s),[0,0,0],[0,0,-Math.PI/2]]],E:[[new r.Mesh(new r.TorusGeometry(.75,.1,2,24),s)]]},w={X:[[new r.Mesh(p,w),[.5,0,0],[0,0,-Math.PI/2]],[new r.Mesh(S,w),[0,0,0],[0,0,-Math.PI/2]],[new r.Mesh(p,w),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new r.Mesh(p,A),[0,.5,0]],[new r.Mesh(S,A)],[new r.Mesh(p,A),[0,-.5,0],[0,0,Math.PI]]],Z:[[new r.Mesh(p,l),[0,0,.5],[Math.PI/2,0,0]],[new r.Mesh(S,l),[0,0,0],[Math.PI/2,0,0]],[new r.Mesh(p,l),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),h),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),u),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),c),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.BoxGeometry(.1,.1,.1),d.clone())]]},A={X:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[.3,0,0],[0,0,-Math.PI/2]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,.3,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,-.3,0],[0,0,Math.PI]]],Z:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,0,.3],[Math.PI/2,0,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),s),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.2),s),[0,0,0]]]},S={X:[[new r.Line(f,o.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new r.Line(f,o.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new r.Line(f,o.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function M(e){var t,n=new r.Object3D;for(t in e)for(var i=e[t].length;i--;){var a=e[t][i][0].clone(),o=e[t][i][1],s=e[t][i][2],l=e[t][i][3],u=e[t][i][4];(a.name=t,a.tag=u,o&&a.position.set(o[0],o[1],o[2]),s&&a.rotation.set(s[0],s[1],s[2]),l&&a.scale.set(l[0],l[1],l[2]),a.updateMatrix(),u=a.geometry.clone()).applyMatrix4(a.matrix),a.geometry=u,a.renderOrder=1/0,a.position.set(0,0,0),a.rotation.set(0,0,0),a.scale.set(1,1,1),n.add(a)}return n}return n.gizmo={},n.picker={},n.helper={},n.add(n.gizmo.translate=M(v)),n.add(n.gizmo.rotate=M(a)),n.add(n.gizmo.scale=M(w)),n.add(n.picker.translate=M(g)),n.add(n.picker.rotate=M(x)),n.add(n.picker.scale=M(A)),n.add(n.helper.translate=M(y)),n.add(n.helper.rotate=M(b)),n.add(n.helper.scale=M(S)),n.picker.translate.visible=!1,n.picker.rotate.visible=!1,n.picker.scale.visible=!1,n}return o(t,[{key:"updateMatrixWorld",value:function(e){var r=this,n="local"===("scale"===this.mode?"local":this.space)?this.worldQuaternion:T,i=(this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode,this.helper.translate.visible="translate"===this.mode,this.helper.rotate.visible="rotate"===this.mode,this.helper.scale.visible="scale"===this.mode,[]);i=(i=(i=i.concat(this.picker[this.mode].children)).concat(this.gizmo[this.mode].children)).concat(this.helper[this.mode].children);for(var a=0;a<i.length;a++)!function(e){var t=i[e];if(t.visible=!0,t.rotation.set(0,0,0),e=void t.position.copy(r.worldPosition),e=r.camera.isOrthographicCamera?(r.camera.top-r.camera.bottom)/r.camera.zoom:r.worldPosition.distanceTo(r.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*r.camera.fov/360)/r.camera.zoom,7),t.scale.set(1,1,1).multiplyScalar(e*r.size/4),"helper"===t.tag)return t.visible=!1,"AXIS"===t.name?(t.position.copy(r.worldPositionStart),t.visible=!!r.axis,"X"===r.axis&&(v.setFromEuler(M.set(0,0,0)),t.quaternion.copy(n).multiply(v),.9<Math.abs(C.copy(k).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(O).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,O)),t.quaternion.multiply(v),t.visible=r.dragging),"E"===r.axis&&(t.visible=!1)):"START"===t.name?(t.position.copy(r.worldPositionStart),t.visible=r.dragging):"END"===t.name?(t.position.copy(r.worldPosition),t.visible=r.dragging):"DELTA"===t.name?(t.position.copy(r.worldPositionStart),t.quaternion.copy(r.worldQuaternionStart),f.set(1e-10,1e-10,1e-10).add(r.worldPositionStart).sub(r.worldPosition).multiplyScalar(-1),f.applyQuaternion(r.worldQuaternionStart.clone().invert()),t.scale.copy(f),t.visible=r.dragging):(t.quaternion.copy(n),r.dragging?t.position.copy(r.worldPositionStart):t.position.copy(r.worldPosition),r.axis&&(t.visible=-1!==r.axis.search(t.name)));t.quaternion.copy(n),"translate"===r.mode||"scale"===r.mode?("X"===t.name&&.99<Math.abs(C.copy(k).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(O).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(k).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(O).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,O)),"X"===t.name&&(v.setFromAxisAngle(k,Math.atan2(-C.y,C.z)),v.multiplyQuaternions(E,v),t.quaternion.copy(v)),"Y"===t.name&&(v.setFromAxisAngle(O,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(k).applyQuaternion("local"===r?this.worldQuaternion:T),L.copy(O).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(f.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__(9251),z=__webpack_require__(9594);class V{constructor(e){this.runScene=e}}function J(e){return(J="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}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||function(e,t){return e.__proto__=t,e})(e,t)}function X(e){return(X=Object.setPrototypeOf?Object.getPrototypeOf: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=this;if(this.decoderPending)return this.decoderPending;var t="object"!==("undefined"==typeof WebAssembly?"undefined":Z(WebAssembly))||"js"===this.decoderConfig.type,r=[];return t?r.push(this._loadLibrary("draco_decoder.js","text")):(r.push(this._loadLibrary("draco_wasm_wrapper.js","text")),r.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(r).then((function(r){var n=r[0];t||(e.decoderConfig.wasmBinary=r[1]),r=function(){var e,t;onmessage=function(r){var n=r.data;switch(n.type){case"init":e=n.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var i=n.buffer,a=n.taskConfig;t.then((function(e){var t=new(e=e.draco).Decoder,r=new e.DecoderBuffer;r.Init(new Int8Array(i),i.byteLength);try{var o=function(e,t,r,n){var i,a=n.attributeIDs,o=n.attributeTypes,s=t.GetEncodedGeometryType(r);if(s===e.TRIANGULAR_MESH)i=new e.Mesh,g=t.DecodeBufferToMesh(r,i);else{if(s!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");i=new e.PointCloud,g=t.DecodeBufferToPointCloud(r,i)}if(!g.ok()||0===i.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+g.error_msg());var l,u,c,h,d,p,f,m,v,g,y,b,x,w={index:null,attributes:[]};for(l in a){var A=self[o[l]],S=void 0,M=void 0;if(n.useUniqueIDs)M=a[l],S=t.GetAttributeByUniqueId(i,M);else{if(-1===(M=t.GetAttributeId(i,e[a[l]])))continue;S=t.GetAttribute(i,M)}w.attributes.push((M=e,u=t,c=i,h=l,d=S.num_components(),f=(p=c.num_points()*d)*A.BYTES_PER_ELEMENT,m=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(M,A),v=M._malloc(f),u.GetAttributeDataArrayForAllPoints(c,S,m,f,v),u=new A(M.HEAPF32.buffer,v,p).slice(),M._free(v),{name:h,array:u,itemSize:d}))}return s===e.TRIANGULAR_MESH&&(w.index=(r=e,g=t,b=4*(y=3*(s=i).num_faces()),x=r._malloc(b),g.GetTrianglesUInt32Array(s,b,x),g=new Uint32Array(r.HEAPF32.buffer,x,y).slice(),r._free(x),{array:g,itemSize:1})),e.destroy(i),w}(e,t,r,a),s=o.attributes.map((function(e){return e.array.buffer}));o.index&&s.push(o.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:o},s)}catch(e){console.error(e),self.postMessage({type:"error",id:n.id,error:e.message})}finally{e.destroy(r),e.destroy(t)}}))}}}.toString(),n=["/* draco decoder */",n,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n"),e.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||function(e,t){return e.__proto__=t,e})(e,t)}function ie(e){return(ie=Object.setPrototypeOf?Object.getPrototypeOf: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__(1056));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 pe(){return(pe="undefined"!=typeof Reflect&&Reflect.get?Reflect.get: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 fe(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||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:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ae=function(){ge(t,r.Loader);var e=be(t);function t(r){return fe(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 Oe(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 ke(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 p=0;p<u.extensionsUsed.length;++p){var f=u.extensionsUsed[p],m=u.extensionsRequired||[];switch(f){case Me.KHR_MATERIALS_UNLIT:s[f]=new Be;break;case Me.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:s[f]=new Ne;break;case Me.KHR_DRACO_MESH_COMPRESSION:s[f]=new Ue(u,this.dracoLoader);break;case Me.KHR_TEXTURE_TRANSFORM:s[f]=new Ge;break;case Me.KHR_MESH_QUANTIZATION:s[f]=new He;break;default:0<=m.indexOf(f)&&void 0===l[f]&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}c.setExtensions(s),c.setPlugins(l),c.parse(n,i)}}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,i){r.parse(e,t,n,i)}))}}]),t}();function 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){fe(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)return 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)}return 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),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(){fe(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){fe(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){fe(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){fe(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){fe(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){fe(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()):Promise.resolve()}}]),e}(),ke=function(){function e(t){fe(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}(),Oe=function(){function e(t){fe(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])return null;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){fe(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){fe(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}return null}}]),e}(),Le="glTF",Fe=ve((function e(t){fe(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(fe(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,p,f=Qe[n]||n.toLowerCase();void 0!==s[n]&&(d=i.accessors[e.attributes[n]],p=Ke[d.componentType],c[f]=p,u[f]=!0===d.normalized)}return t.getDependency("bufferView",o).then((function(e){return new Promise((function(t){a.decodeDracoFile(e,(function(e){for(var r in e.attributes){var n=e.attributes[r];void 0!==(r=u[r])&&(n.normalized=r)}t(e)}),l,c)}))}))}}]),e}(),Ge=function(){function e(){fe(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){fe(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 pe(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(){fe(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(){fe(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 fe(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,p=t-r,f=1-d,m=p-r+n,v=0;v!==o;v++){var g=a[h+v+o],y=a[h+v+s]*u,b=a[c+v+o],x=a[c+v]*u;i[v]=f*g+m*y+d*b+p*x}return i},new r.Quaternion),Je=function(){ge(t,ze);var e=be(t);function t(){return fe(this,t),e.apply(this,arguments)}return ve(t,[{key:"interpolate_",value:function(e,r,n,i){return e=pe(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]:{};fe(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,p=h&&h!==u*s?(f=Math.floor(c/h),m="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+f+":"+i.count,(v=t.cache.get(m))||(a=new l(o,f*h,i.count*h/u),v=new r.InterleavedBuffer(a,h/u),t.cache.add(m,v)),new r.InterleavedBufferAttribute(v,s,c%h/u,d)):(a=null===o?new l(i.count*s):new l(o,c,i.count*s),new r.BufferAttribute(a,s,d));if(void 0!==i.sparse){var f=Ke[i.sparse.indices.componentType],m=i.sparse.indices.byteOffset||0,v=i.sparse.values.byteOffset||0,g=new f(e[1],m,i.sparse.count*Xe.SCALAR),y=new l(e[2],v,i.sparse.count*s);null!==o&&(p=new r.BufferAttribute(p.array.slice(),p.itemSize,p.normalized));for(var b=0,x=g.length;b<x;b++){var w=g[b];if(p.setX(w,y[b*s]),2<=s&&p.setY(w,y[b*s+1]),3<=s&&p.setZ(w,y[b*s+2]),4<=s&&p.setW(w,y[b*s+3]),5<=s)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return p})))}},{key:"loadTexture",value:function(e){var t=this.json,r=this.options,n=t.textures[e].source,i=(t=t.images[n],this.textureLoader);return t.uri&&null!==(r=r.manager.getHandler(t.uri))&&(i=r),this.loadTextureImage(e,n,i)}},{key:"loadTextureImage",value:function(e,t,n){var i=this,a=this.json,o=a.textures[e],s=((s=a.images[t]).uri||s.bufferView)+":"+o.sampler;return this.textureCache[s]?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],p=o[c],f=void 0,m=s[c];if(4===p.mode||5===p.mode||6===p.mode||void 0===p.mode)!0!==(f=new(!0===a.isSkinnedMesh?r.SkinnedMesh:r.Mesh)(d,m)).isSkinnedMesh||f.geometry.attributes.skinWeight.normalized||f.normalizeSkinWeights(),5===p.mode?f.geometry=at(f.geometry,r.TriangleStripDrawMode):6===p.mode&&(f.geometry=at(f.geometry,r.TriangleFanDrawMode));else if(1===p.mode)f=new r.LineSegments(d,m);else if(3===p.mode)f=new r.Line(d,m);else if(2===p.mode)f=new r.LineLoop(d,m);else{if(0!==p.mode)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+p.mode);f=new r.Points(d,m)}if(0<Object.keys(f.geometry.morphAttributes).length){A=w=x=b=y=v=void 0;var v=f,g=a;if(v.updateMorphTargets(),void 0!==g.weights)for(var y=0,b=g.weights.length;y<b;y++)v.morphTargetInfluences[y]=g.weights[y];if(g.extras&&Array.isArray(g.extras.targetNames)){var x=g.extras.targetNames;if(v.morphTargetInfluences.length===x.length){v.morphTargetDictionary={};for(var w=0,A=x.length;w<A;w++)v.morphTargetDictionary[x[w]]=w}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}f.name=t.createUniqueName(a.name||"mesh_"+e),et(f,a),p.extensions&&$e(i,f,p),t.assignFinalMaterial(f),u.push(f)}for(var S=0,M=u.length;S<M;S++)t.associations.set(u[S],{meshes:e,primitives:S});if(1===u.length)return u[0];var 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,p=void 0!==t.parameters?t.parameters[h.input]:h.input,f=void 0!==t.parameters?t.parameters[h.output]:h.output;n.push(this.getDependency("node",d)),i.push(this.getDependency("accessor",p)),a.push(this.getDependency("accessor",f)),o.push(h),s.push(c)}return Promise.all([Promise.all(n),Promise.all(i),Promise.all(a),Promise.all(o),Promise.all(s)]).then((function(n){for(var i=n[0],a=n[1],o=n[2],s=n[3],l=n[4],u=[],c=0,h=i.length;c<h;c++)!function(e){var t=i[e],n=a[e],c=o[e],h=s[e],d=l[e];if(void 0!==t){t.updateMatrix(),t.matrixAutoUpdate=!0;var p=void 0;switch(Ye[d.path]){case Ye.weights:p=r.NumberKeyframeTrack;break;case Ye.rotation:p=r.QuaternionKeyframeTrack;break;default:p=r.VectorKeyframeTrack}e=t.name||t.uuid;var f=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 p(m[w]+"."+Ye[d.path],n.array,v,f);"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,p=new Map,f=0,m=d.length;f<m;f++){var v=d[f];h.push(e({idMap:p,nodeId:v,parentObject:t,json:a,parser:o,children:d}))}return Promise.all(h)}))}({nodeId:o[l],parentObject:a,json:t,parser:i}));return Promise.all(s).then((function(){return i.options.myOptions&&i.options.myOptions.models.push(a),i.associations=function(e){var t,n=new Map,a=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 p=(h=c.json.accessors[h.POSITION]).min,f=h.max;if(void 0===p||void 0===f)console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");else{d.set(new r.Vector3(p[0],p[1],p[2]),new r.Vector3(f[0],f[1],f[2])),h.normalized&&(p=rt(Ke[h.componentType]),d.min.multiplyScalar(p),d.max.multiplyScalar(p));var m=u.targets;if(void 0!==m){for(var v=new r.Vector3,g=new r.Vector3,y=0,b=m.length;y<b;y++){var x,w,A=m[y];void 0!==A.POSITION&&(w=(A=c.json.accessors[A.POSITION]).min,x=A.max,void 0!==w&&void 0!==x?(g.setX(Math.max(Math.abs(w[0]),Math.abs(x[0]))),g.setY(Math.max(Math.abs(w[1]),Math.abs(x[1]))),g.setZ(Math.max(Math.abs(w[2]),Math.abs(x[2]))),A.normalized&&(w=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,f=new r.Sphere,d.getCenter(f.center),f.radius=d.min.distanceTo(d.max)/2,l.boundingSphere=f}}return Promise.all(o).then((function(){if(void 0===t.targets)return e;for(var r=e,i=t.targets,a=n,o=!1,s=!1,l=!1,u=0,c=i.length;u<c;u++){var h=i[u];if(void 0!==h.POSITION&&(o=!0),void 0!==h.NORMAL&&(s=!0),void 0!==h.COLOR_0&&(l=!0),o&&s&&l)break}if(!o&&!s&&!l)return Promise.resolve(r);for(var d=[],p=[],f=[],m=0,v=i.length;m<v;m++){var g,y=i[m];o&&(g=void 0!==y.POSITION?a.getDependency("accessor",y.POSITION):r.attributes.position,d.push(g)),s&&(g=void 0!==y.NORMAL?a.getDependency("accessor",y.NORMAL):r.attributes.normal,p.push(g)),l&&(y=void 0!==y.COLOR_0?a.getDependency("accessor",y.COLOR_0):r.attributes.color,f.push(y))}return Promise.all([Promise.all(d),Promise.all(p),Promise.all(f)]).then((function(e){var t=e[0],n=e[1];return e=e[2],o&&(r.morphAttributes.position=t),s&&(r.morphAttributes.normal=n),l&&(r.morphAttributes.color=e),r.morphTargetsRelative=!0,r}))}))}function 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__(4091);var ot=__webpack_require__(1794),st=__webpack_require__(5247),lt=__webpack_require__(110),ut=__webpack_require__(3778),ct=__webpack_require__(911),ht=__webpack_require__(6272),dt=__webpack_require__(4038),pt=__webpack_require__(4233);class ft{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,pt.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,pt.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 ft(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,pt.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:p}=(this.map[e].options=t,n);h.stop(),r=c?0:n.time,h.time=r,this.setPlayState(n,!0),c&&h.reset(),h.play();let f=!(n.runState="play");this.setUpdates(e,(()=>{var e=(0,oe.getProgress)(h.time,d.duration,!0);99<=e&&!f&&(a(),f=!0),i(e)})),u?(h.loop=st.Z.LoopRepeat,p.loop=o):(l&&(h.clampWhenFinished=!0),h.loop=st.Z.LoopOnce,p.finished=()=>{this.setPlayState(n,!1),i(100),s()})}}pause(e,t){e=this.findId(e,t);const r=this.map[e];r&&this.playings.has(r)&&(this.updateTime(r),this.setPlayState(r,!1),r.options.onPause(),r.runState="pause")}resume(e,t){var r=this.findId(e,t);const n=this.map[r];n&&this.playings.has(n)&&(n.options.onResume(),this.play(e,t,null==(r=this.map[t])?void 0:r.options))}playAll(){this.pauseAll(),this.playings.clear(),Object.values(this.map).map((e=>{this.playings.add(e);const t=e.action;t.time=0,t.play()})),this.anima()}setValue(e){let t=this.clock.getDelta();Object.keys(this.map).map((r=>{const{mixer:n,action:i}=this.map[r];i.play(),i.time=e,n.update(t)}))}getDetal(){return this.clock.getDelta()}update(e){const t=e||this.getDetal();(0,z.js)(this.updates,((e,r)=>r(t)))}anima(){let e=this.clock.getDelta();this.update(e),this.playings.forEach((t=>{t.mixer.update(e)})),this.tickIndex=window.requestAnimationFrame(this.anima.bind(this))}closeAnima(){window.cancelAnimationFrame(this.tickIndex)}resetItem(e){const{mixer:t,action:r}=e;r.reset(),r.stop(),t.time=0}pauseAll(){this.closeAnima(),this.playings.forEach((e=>this.resetItem(e))),this.playings.clear()}reset(){this.pauseAll(),this.map={},this.playings.clear(),this.closeAnima()}updateTime(e,t){e.time=t||e.action.time}setPlayState(e,t){t?(this.playings.add(e),1===this.playings.size&&this.anima()):(this.playings.delete(e),delete this.updates[e.clip.id],0===this.playings.size&&this.closeAnima())}getItem(e,t){return e=this.findId(e,t),this.map[e]}close(e,t,r){e=this.findId(e,t);const n=this.map[e];n&&this.playings.has(n)&&n.options&&((t=(0,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__(3693),Ct=__webpack_require__(699);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__(4230);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,p,f=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(f.object.up,n)),n.multiplyScalar(e),x.add(n)}),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.matrix)):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?b/=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(),w=!0):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.")},this.dollyOut=function(e){f.object instanceof st.Z.PerspectiveCamera?b*=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(),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,p=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-p.dot(this.object.quaternion)))||(d.copy(this.object.position),p.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,p=-1,f=p,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;f=0,i.set(e.clientX,e.clientY)}else if(e.button===n.mouseButtons.ZOOM){if(!1===n.enableZoom)return;f=1,c.set(e.clientX,e.clientY)}else if(e.button===n.mouseButtons.PAN){if(!1===n.enablePan)return;f=2,s.set(e.clientX,e.clientY)}f!==p&&(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===f){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===f){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===f){if(!1===n.enablePan)return;l.set(e.clientX,e.clientY),u.subVectors(l,s),y(u.x,u.y),s.copy(l)}f!==p&&n.update()}}function A(){!1!==n.enabled&&(document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",A),n.dispatchEvent(g),f=p)}function S(e){var t;!1!==n.enabled&&!1!==n.enableZoom&&f===p&&(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;f=3,i.set(e.touches[0].pageX,e.touches[0].pageY);break;case 2:if(!1===n.enableZoom)return;f=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;f=5,s.set(e.touches[0].pageX,e.touches[0].pageY);break;default:f=p}f!==p&&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!==f)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!==f)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!==f)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:f=p}}}function _(){!1!==n.enabled&&(n.dispatchEvent(g),f=p)}function E(e){e.preventDefault()}this.update=function(){this.autoRotate&&f===p&&r.rotateLeft(2*Math.PI/60/60*n.autoRotateSpeed),!0===r.update()&&this.dispatchEvent(m)},this.reset=function(){f=p,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 kt=Pt;class Ot{create(e,t){return new kt(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__(758),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__(3801);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;return e?void e.children.map((e=>{this.events.runScene.multipSelector.add(e)})):void 0}this.events.runScene.modelEx.setSelectByModel(t),this.events.runScene.lightEx.isLight(t)&&this.events.runScene.lightEx.setSelect(t)}}}var jt=__webpack_require__(3685),Nt=__webpack_require__(4330),Ht=__webpack_require__(1269);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({},pt.ZP.toJSON(t)),this._bindSceneTextures(e)),timeLine:this.runScene.timeLineEx.getSavedData(),controls:Ot.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,pt.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__(3729);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=(p="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",i=p.asyncIterator||"@@asyncIterator",a=p.toStringTag||"@@toStringTag";function o(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{o({},"")}catch(t){o=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var i,a,o,s;return t=t&&t.prototype instanceof c?t:c,t=Object.create(t.prototype),n=new x(n||[]),t._invoke=(i=e,a=r,o=n,s="suspendedStart",function(e,t){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===e)throw t;return{value:void 0,done:!0}}for(o.method=e,o.arg=t;;){var r=o.delegate;if(r&&(r=function e(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,e(t,r),"throw"===r.method))return u;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}return"throw"===(n=l(n,t.iterator,r.arg)).type?(r.method="throw",r.arg=n.arg,r.delegate=null,u):(n=n.arg)?n.done?(r[t.resultName]=n.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,u):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,u)}(r,o),r)){if(r===u)continue;return r}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if("suspendedStart"===s)throw s="completed",o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);if(s="executing","normal"===(r=l(i,a,o)).type){if(s=o.done?"completed":"suspendedYield",r.arg===u)continue;return{value:r.arg,done:o.done}}"throw"===r.type&&(s="completed",o.method="throw",o.arg=r.arg)}}),t}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var u={};function c(){}function h(){}function d(){}var p,f,m=(o(p={},n,(function(){return this})),(f=(f=Object.getPrototypeOf)&&f(f(w([]))))&&f!==t&&r.call(f,n)&&(p=f),d.prototype=c.prototype=Object.create(p));function v(e){["next","throw","return"].forEach((function(t){o(e,t,(function(e){return this._invoke(t,e)}))}))}function g(e,t){var n;this._invoke=function(i,a){function o(){return new t((function(n,o){!function n(i,a,o,s){var u;if("throw"!==(i=l(e[i],e,a)).type)return(a=(u=i.arg).value)&&"object"==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={},pr=(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 fr(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 p=s.getImageData(0,0,e,a).data,f=2;f<p.length;f+=4)l.data[f]=p[f]}return s.putImageData(l,0,0),new r.Texture(o)}}},{key:"processBuffer",value:function(e){var t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}},{key:"processBufferView",value:function(e,t,r,n,i){for(var a,o=this.json,s=(o.bufferViews||(o.bufferViews=[]),a=t===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 p={buffer:this.processBuffer(l.buffer),byteOffset:this.byteOffset,byteLength:s};return void 0!==i&&(p.target=i),34962===i&&(p.byteStride=e.itemSize*a),this.byteOffset+=s,o.bufferViews.push(p),{id:o.bufferViews.length-1,byteLength:0}}},{key:"processBufferViewImage",value:function(e){var t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(n,i){var a=new window.FileReader;if(!(e instanceof Blob))return i();a.readAsArrayBuffer(e),a.onloadend=function(){var e=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!=(p=i.userData)&&p.blob&&(null==i||null==(p=i.userData)?void 0:p.blob)instanceof Blob)u.push(new Promise((function(e){a.processBufferViewImage(i.userData.blob).then((function(t){h.bufferView=t,e()}))})));else if(l.embedImages){var d=gr=gr||document.createElement("canvas"),p=(d.width=Math.min(e.width,l.maxTextureSize),d.height=Math.min(e.height,l.maxTextureSize),d.getContext("2d"));if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap)p.drawImage(e,0,0,d.width,d.height);else{t!==r.RGBAFormat&&console.error("GLTFExporter: Only RGBAFormat is supported."),(e.width>l.maxTextureSize||e.height>l.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);for(var f=new Uint8ClampedArray(e.height*e.width*4),m=0;m<f.length;m+=4)f[m+0]=e.data[m+0],f[m+1]=e.data[m+1],f[m+2]=e.data[m+2],f[m+3]=e.data[m+3];p.putImageData(new ImageData(f,e.width,e.height),0,0)}!0===l.binary?u.push(new Promise((function(e){d.toBlob((function(t){a.processBufferViewImage(t).then((function(t){h.bufferView=t,e()}))}),c)}))):h.uri=d.toDataURL(c)}else h.uri=e.src;return t=s.images.push(h)-1,o[n]=t}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter: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=(fr((this.options.myOptions.helper.parseMaterial({material:e,materialDef:a,options:this}),!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."),o=e.color.toArray().concat([e.opacity])),[1,1,1,1])||(a.pbrMetallicRoughness.baseColorFactor=o),e.isMeshStandardMaterial?(a.pbrMetallicRoughness.metallicFactor=e.metalness,a.pbrMetallicRoughness.roughnessFactor=e.roughness):(a.pbrMetallicRoughness.metallicFactor=.5,a.pbrMetallicRoughness.roughnessFactor=.5),this.buildORMTexture(e));return(e.metalnessMap||e.roughnessMap)&&(o={index:this.processTexture(o)},this.applyTextureTransform(o,e.metalnessMap||e.roughnessMap),a.pbrMetallicRoughness.metallicRoughnessTexture=o),e.map&&(o={index:this.processTexture(e.map)},this.applyTextureTransform(o,e.map),a.pbrMetallicRoughness.baseColorTexture=o),e.emissive&&(o=e.emissive.clone().multiplyScalar(e.emissiveIntensity),1<(i=Math.max(o.r,o.g,o.b))&&(o.multiplyScalar(1/i),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),0<i&&(a.emissiveFactor=o.toArray()),e.emissiveMap&&(i={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(i,e.emissiveMap),a.emissiveTexture=i)),e.normalMap&&(o={index:this.processTexture(e.normalMap)},e.normalScale&&1!==e.normalScale.x&&(o.scale=e.normalScale.x),this.applyTextureTransform(o,e.normalMap),a.normalTexture=o),e.aoMap&&(i={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(i.strength=e.aoMapIntensity),this.applyTextureTransform(i,e.aoMap),a.occlusionTexture=i),e.transparent?a.alphaMode="BLEND":0<e.alphaTest&&(a.alphaMode="MASK",a.alphaCutoff=e.alphaTest),e.side===r.DoubleSide&&(a.doubleSided=!0),""!==e.name&&(a.name=e.name),this.serializeUserData(e,a),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,a)})),o=n.materials.push(a)-1,t.materials.set(e,o),o}},{key:"processMesh",value:function(e){var t=this.cache,n=this.json,i=[e.geometry.uuid];if(Array.isArray(e.material))for(var a=0,o=e.material.length;a<o;a++)i.push(e.material[a].uuid);else i.push(e.material.uuid);var s=i.join(":");if(t.meshes.has(s))return t.meshes.get(s);var l=e.geometry,u=e.isLineSegments?1:e.isLineLoop?2:e.isLine?3:e.isPoints?0:e.material.wireframe?1:4;if(!0!==l.isBufferGeometry)throw new Error("THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry.");var c,h,d,p={},f={},m=[],v=[],g={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},y=l.getAttribute("normal"),b=(void 0===y||this.isNormalizedNormalAttribute(y)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),l.setAttribute("normal",this.createNormalizedNormalAttribute(y))),null);for(h in l.attributes)"morph"!==h.slice(0,5)&&(c=l.attributes[h],h=g[h]||h.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(h)||(h="_"+h),t.attributes.has(this.getUID(c))?f[h]=t.attributes.get(this.getUID(c)):(b=null,d=c.array,"JOINTS_0"!==h||d instanceof Uint16Array||d instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),b=new r.BufferAttribute(new Uint16Array(d),c.itemSize,c.normalized)),null!==(d=this.processAccessor(b||c,l))&&(f[h]=d,t.attributes.set(this.getUID(c),d))));if(void 0!==y&&l.setAttribute("normal",y),0===Object.keys(f).length)return null;if(void 0!==e.morphTargetInfluences&&0<e.morphTargetInfluences.length){var x=[],w=[],A={};if(void 0!==e.morphTargetDictionary)for(var S in e.morphTargetDictionary)A[e.morphTargetDictionary[S]]=S;for(var M=0;M<e.morphTargetInfluences.length;++M){var 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 k=0,O=E.count;k<O;k++)P.setXYZ(k,E.getX(k)-D.getX(k),E.getY(k)-D.getY(k),E.getZ(k)-D.getZ(k));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])}p.weights=x,0<w.length&&(p.extras={},p.extras.targetNames=w)}if((y=Array.isArray(e.material))&&0===l.groups.length)return null;for(var 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:f},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 p.primitives=m,n.meshes||(n.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,p)})),y=n.meshes.push(p)-1,t.meshes.set(s,y),y}},{key:"processCamera",value:function(e){var t=this.json,n=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),i={type:n?"orthographic":"perspective"};return n?i.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:i.perspective={aspectRatio:e.aspect,yfov:r.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(i.name=e.type),t.cameras.push(i)-1}},{key:"processAnimation",value:function(e,t){for(var n=this.json,i=this.nodeMap,a=(n.animations||(n.animations=[]),(e=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=pr[c.propertyName];if(!(h="bones"===c.objectName?!0===h.isSkinnedMesh?h.skeleton.getBoneByName(c.objectIndex):void 0:h)||!d)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',u.name),null;c=u.values.length/u.times.length;var p=void(d===pr.morphTargetInfluences&&(c/=h.morphTargetInfluences.length));!0===u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(p="CUBICSPLINE",c/=3):p=u.getInterpolation()===r.InterpolateDiscrete?"STEP":"LINEAR",s.push({input:this.processAccessor(new r.BufferAttribute(u.times,1)),output:this.processAccessor(new r.BufferAttribute(u.values,c)),interpolation:p}),o.push({sampler:s.length-1,target:{node:i.get(h),path:d}})}return n.animations.push({name:e.name||"clip_"+n.animations.length,samplers:s,channels:o}),n.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,n=this.nodeMap,i=t.nodes[n.get(e)],a=e.skeleton;if(void 0===a)return null;var o=e.skeleton.bones[0];if(void 0===o)return null;for(var s=[],l=new Float32Array(16*a.bones.length),u=new r.Matrix4,c=0;c<a.bones.length;++c){var h=a.bones[c];h=this.options.myOptions.helper.getNodeMapValueWithBone(h,n),s.push(h),u.copy(a.boneInverses[c]),u.multiply(e.bindMatrix).toArray(l,16*c)}return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new r.BufferAttribute(l,16)),joints:s,skeleton:n.get(o)}),i.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,r,n=this.json,i=this.options,a=this.nodeMap,o=(n.nodes||(n.nodes=[]),{});if(i.myOptions.helper.parseNode({object:e,nodeDef:o,options:this}),console.log(e.children,"object.children"),i.trs?(r=e.quaternion.toArray(),d=e.position.toArray(),t=e.scale.toArray(),fr(r,[0,0,0,1])||(o.rotation=r),fr(d,[0,0,0])||(o.translation=d),fr(t,[1,1,1])||(o.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===fr(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=(p="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",i=p.asyncIterator||"@@asyncIterator",a=p.toStringTag||"@@toStringTag";function o(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{o({},"")}catch(t){o=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var i,a,o,s;return t=t&&t.prototype instanceof c?t:c,t=Object.create(t.prototype),n=new x(n||[]),t._invoke=(i=e,a=r,o=n,s="suspendedStart",function(e,t){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===e)throw t;return{value:void 0,done:!0}}for(o.method=e,o.arg=t;;){var r=o.delegate;if(r&&(r=function e(t,r){var n=t.iterator[r.method];if(void 0===n){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,e(t,r),"throw"===r.method))return u;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}return"throw"===(n=l(n,t.iterator,r.arg)).type?(r.method="throw",r.arg=n.arg,r.delegate=null,u):(n=n.arg)?n.done?(r[t.resultName]=n.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,u):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,u)}(r,o),r)){if(r===u)continue;return r}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if("suspendedStart"===s)throw s="completed",o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);if(s="executing","normal"===(r=l(i,a,o)).type){if(s=o.done?"completed":"suspendedYield",r.arg===u)continue;return{value:r.arg,done:o.done}}"throw"===r.type&&(s="completed",o.method="throw",o.arg=r.arg)}}),t}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var u={};function c(){}function h(){}function d(){}var p,f,m=(o(p={},n,(function(){return this})),(f=(f=Object.getPrototypeOf)&&f(f(w([]))))&&f!==t&&r.call(f,n)&&(p=f),d.prototype=c.prototype=Object.create(p));function v(e){["next","throw","return"].forEach((function(t){o(e,t,(function(e){return this._invoke(t,e)}))}))}function g(e,t){var n;this._invoke=function(i,a){function o(){return new t((function(n,o){!function n(i,a,o,s){var u;if("throw"!==(i=l(e[i],e,a)).type)return(a=(u=i.arg).value)&&"object"==_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 p=new((d=s.clone()).ValueBufferType)(c*d.times.length),f=0;f<d.times.length;f++)p[f*c+h]=d.values[f];d.name=(l.nodeName||"")+".morphTargetInfluences",d.values=p,i[u.uuid]=d,n.push(d)}else{var m=s.createInterpolant(new s.ValueBufferType(1));d=i[u.uuid];for(var v=0;v<d.times.length;v++)d.values[v*c+h]=m.evaluate(d.times[v]);for(var g=0;g<s.times.length;g++){var y=this.insertKeyframe(d,s.times[g]);d.values[y*c+h]=s.values[g]}}}}return e.tracks=n,e}};var 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}(),kr=5121,Or=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,p=1;p<d.length;p+=4)u.data[p]=d[p]}return l.putImageData(u,0,0),(n=(e||t).clone()).source=new r.Source(s),n}},{key:"processBuffer",value:function(e){var t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}},{key:"processBufferView",value:function(e,t,r,n,i){for(var a,o=this.json,s=(o.bufferViews||(o.bufferViews=[]),a=t===kr?1:t===Or?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===Or?l.setUint16(u,d,!0):t===kr&&l.setUint8(u,d),u+=a}var p={buffer:this.processBuffer(l.buffer),byteOffset:this.byteOffset,byteLength:s};return void 0!==i&&(p.target=i),34962===i&&(p.byteStride=e.itemSize*a),this.byteOffset+=s,o.bufferViews.push(p),{id:o.bufferViews.length-1,byteLength:0}}},{key:"processBufferViewImage",value:function(e){var t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(n){var i=new FileReader;i.readAsArrayBuffer(e),i.onloadend=function(){var e=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=Or;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");i=kr}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(),p=(d.width=Math.min(e.width,l.maxTextureSize),d.height=Math.min(e.height,l.maxTextureSize),d.getContext("2d"));if(!0===n&&(p.translate(0,d.height),p.scale(1,-1)),void 0!==e.data){t!==r.RGBAFormat&&console.error("GLTFExporter: Only RGBAFormat is supported."),(e.width>l.maxTextureSize||e.height>l.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);for(var f=new Uint8ClampedArray(e.height*e.width*4),m=0;m<f.length;m+=4)f[m+0]=e.data[m+0],f[m+1]=e.data[m+1],f[m+2]=e.data[m+2],f[m+3]=e.data[m+3];p.putImageData(new ImageData(f,e.width,e.height),0,0)}else p.drawImage(e,0,0,d.width,d.height);!0===l.binary?(n=void 0!==d.toBlob?new Promise((function(e){return d.toBlob(e,i)})):d.convertToBlob({type:i}),u.push(n.then((function(e){return a.processBufferViewImage(e).then((function(e){h.bufferView=e}))})))):h.uri=d.toDataURL(i)}else h.uri=e.src;return t=s.images.push(h)-1,o[c]=t}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter: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,p={},f={},m=[],v=[],g={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},y=l.getAttribute("normal"),b=(void 0===y||this.isNormalizedNormalAttribute(y)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),l.setAttribute("normal",this.createNormalizedNormalAttribute(y))),null);for(h in l.attributes)"morph"!==h.slice(0,5)&&(c=l.attributes[h],h=g[h]||h.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(h)||(h="_"+h),t.attributes.has(this.getUID(c))?f[h]=t.attributes.get(this.getUID(c)):(b=null,d=c.array,"JOINTS_0"!==h||d instanceof Uint16Array||d instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),b=new r.BufferAttribute(new Uint16Array(d),c.itemSize,c.normalized)),null!==(d=this.processAccessor(b||c,l))&&(f[h]=d,t.attributes.set(this.getUID(c),d))));if(void 0!==y&&l.setAttribute("normal",y),0===Object.keys(f).length)return null;if(void 0!==e.morphTargetInfluences&&0<e.morphTargetInfluences.length){var x=[],w=[],A={};if(void 0!==e.morphTargetDictionary)for(var S in e.morphTargetDictionary)A[e.morphTargetDictionary[S]]=S;for(var M=0;M<e.morphTargetInfluences.length;++M){var 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 k=0,O=E.count;k<O;k++)P.setXYZ(k,E.getX(k)-D.getX(k),E.getY(k)-D.getY(k),E.getZ(k)-D.getZ(k));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])}p.weights=x,0<w.length&&(p.extras={},p.extras.targetNames=w)}if((y=Array.isArray(e.material))&&0===l.groups.length)return null;for(var 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:f},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 p.primitives=m,n.meshes||(n.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,p)})),y=n.meshes.push(p)-1,t.meshes.set(s,y),y}},{key:"processCamera",value:function(e){var t=this.json,n=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),i={type:n?"orthographic":"perspective"};return n?i.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:i.perspective={aspectRatio:e.aspect,yfov:r.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(i.name=e.type),t.cameras.push(i)-1}},{key:"processAnimation",value:function(e,t){for(var n=this.json,i=this.nodeMap,a=(n.animations||(n.animations=[]),(e=Pr.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),o=[],s=[],l=0;l<a.length;++l){var u=a[l],c=r.PropertyBinding.parseTrackName(u.name),h=r.PropertyBinding.findNode(t,c.nodeName),d=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 p=void(d===Ir.morphTargetInfluences&&(c/=h.morphTargetInfluences.length));!0===u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(p="CUBICSPLINE",c/=3):p=u.getInterpolation()===r.InterpolateDiscrete?"STEP":"LINEAR",s.push({input:this.processAccessor(new r.BufferAttribute(u.times,1)),output:this.processAccessor(new r.BufferAttribute(u.values,c)),interpolation:p}),o.push({sampler:s.length-1,target:{node:i.get(h),path:d}})}return n.animations.push({name:e.name||"clip_"+n.animations.length,samplers:s,channels:o}),n.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,n=this.nodeMap,i=t.nodes[n.get(e)],a=e.skeleton;if(void 0===a)return null;var o=e.skeleton.bones[0];if(void 0===o)return null;for(var s=[],l=new Float32Array(16*a.bones.length),u=new r.Matrix4,c=0;c<a.bones.length;++c)s.push(n.get(a.bones[c])),u.copy(a.boneInverses[c]),u.multiply(e.bindMatrix).toArray(l,16*c);return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new r.BufferAttribute(l,16)),joints:s,skeleton:n.get(o)}),i.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,r,n=this.json,i=this.options,a=this.nodeMap,o=(n.nodes||(n.nodes=[]),{});if(i.trs?(r=e.quaternion.toArray(),h=e.position.toArray(),t=e.scale.toArray(),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 p=new((d=s.clone()).ValueBufferType)(c*d.times.length),f=0;f<d.times.length;f++)p[f*c+h]=d.values[f];d.name=(l.nodeName||"")+".morphTargetInfluences",d.values=p,i[u.uuid]=d,n.push(d)}else{var m=s.createInterpolant(new s.ValueBufferType(1));d=i[u.uuid];for(var v=0;v<d.times.length;v++)d.values[v*c+h]=m.evaluate(d.times[v]);for(var g=0;g<s.times.length;g++){var y=this.insertKeyframe(d,s.times[g]);d.values[y*c+h]=s.values[g]}}}}return e.tracks=n,e}},function(e,t,r,n){return new(r=r||Promise)((function(i,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(o,s)}l((n=n.apply(e,t||[])).next())}))});class 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 pn=(43690&dn)>>>1|(21845&dn)<<1;hn[dn]=((65280&(pn=(61680&(pn=(52428&pn)>>>2|(13107&pn)<<2))>>>4|(3855&pn)<<4))>>>8|(255&pn)<<8)>>>1}var fn=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=fn(mn,9,0),wn=fn(mn,9,1),An=fn(vn,5,0),Sn=fn(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==r||r>e.length)&&(r=e.length);var n=new(e instanceof tn?tn:e instanceof rn?rn:en)(r-(t=null==t||t<0?0: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,p=r.n,f=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,p=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=fn(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),p=Mn(T),c=fn(m,d,1),h=fn(T,p,1)}if(f<l){if(o)throw"unexpected EOF";break}}a&&i(u+131072);for(var D=(1<<d)-1,P=(1<<p)-1,k=l;;k=l){var O=(_=c[Bn(e,l)&D])>>>4;if(f<(l+=15&_)){if(o)throw"unexpected EOF";break}if(!_)throw"invalid length/literal";if(O<256)t[u++]=O;else{if(256==O){k=l,c=null;break}var R,I=O-254,L=(264<O&&(R=nn[w=O-257],I=Cn(e,l,(1<<R)-1)+sn[w],l+=R),(O=h[Bn(e,l)&P])>>>4);if(!O)throw"invalid distance";if(l+=15&O,T=un[L],3<L&&(R=an[L],T+=Bn(e,l)&(1<<R)-1,l+=R),f<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=k,r.b=u,c&&(s=1,r.m=d,r.d=h,r.n=p)}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},kn=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),p=On(r[u-1],d,0);if(t<p){n=0;var f=0,m=p-t,v=1<<m;for(a.sort((function(e,t){return d[t.s]-d[e.s]||e.f-t.f}));n<i;++n){var g=a[n].s;if(!(d[g]>t))break;f+=v-(1<<p-d[g]),d[g]=t}for(f>>>=m;0<f;){var y=a[n].s;d[y]<t?f-=1<<t-d[y]++-1:++n}for(;0<=n&&f;--n){var b=a[n].s;d[b]==t&&(--d[b],++f)}p=t}return[new en(d),p]},On=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=kn(i,15))[0],d=(r=r[1],(p=kn(a,15))[0]),p=p[1],f=(m=Rn(h))[0],m=m[1],v=(g=Rn(d))[0],g=g[1],y=new tn(19),b=0;b<f.length;++b)y[31&f[b]]++;for(b=0;b<v.length;++b)y[31&v[b]]++;for(var x=(w=kn(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=fn(h,r,0),_=h,E=fn(d,p,0),T=d,D=fn(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=[f,v],k=0;k<2;++k){var O=P[k];for(b=0;b<O.length;++b){var R=31&O[b];Dn(t,c,D[R]),c+=x[R],15<R&&(Dn(t,c,O[b]>>>5&127),c+=O[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,p=8191&t,f=(1<<r)-1,m=new tn(32768),v=new tn(1+f),g=Math.ceil(r/3),y=2*g,b=function(t){return(e[t]^e[t+1]<<g^e[t+2]<<y)&f},x=new 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 k=0;k<286;++k)w[k]=0;for(k=0;k<30;++k)A[k]=0}var O=2,R=0,I=p,L=T-D&32767;if(2<P&&E==b(c-L))for(var F=Math.min(d,P)-1,U=Math.min(32767,c),G=Math.min(258,P);L<=U&&--I&&T!=D;){if(e[c+O]==e[c+O-L]){for(var j=0;j<G&&e[c+j]==e[c+j-L];++j);if(O<j){if(R=L,F<(O=j))break;var N=Math.min(L,j-2),H=0;for(k=0;k<N;++k){var z=c-L+k+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[O]<<18|cn[R],E=31&ln[O],P=31&cn[R],M+=nn[E]+an[P],++w[257+E],++A[P],B=c+O,++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,fn,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,fn,Dn,Pn,kn,On,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 pi(e,t){return t||"function"!=typeof e||(t=e,e={}),this.ondata=t,e}var fi=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,fi]}],this,pi.call(this,e,t),(function(e){e=new fi(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,fi.call(this,e,t)}return e.prototype.push=function(e,t){fi.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,fi,Ai]}],this,pi.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,fi.call(this,e,t)}return e.prototype.push=function(e,t){fi.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,fi,Di]}],this,pi.call(this,e,t),(function(e){e=new Di(e.data),onmessage=gn(e)}),10)};function ki(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 Oi=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,Oi]}],this,0,(function(){var e=new Oi;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=Oi,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 p in u){var f=u[p],m=f.length;oi(e,t,+p),oi(e,t+2,m),e.set(f,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 fi(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,p,f,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(p=[]),a=2,f=ai(l,o+18),m=ai(l,o+22),v=Zi(l.subarray(o+30,o+=30+i),!t),4294967295==f?(i=n?[-2]:Yi(l,o),f=i[0],m=i[1]):n&&(f=-1),o+=d,h.c=f,y={name:v,compression:e,start:function(){if(!y.ondata)throw"no callback";if(f){var t=r.o[e];if(!t)throw"unknown compression type "+e;(g=f<0?new t(v):new t(v,f,m)).ondata=function(e,t,r){y.ondata(e,t,r)};for(var n=0,i=p;n<i.length;n++)g.push(i[n],!1);r.k[0]==p&&r.c?r.d=g:g.push(Gn,!0)}else y.ondata(null,Gn,!0)},terminate:function(){g&&g.terminate&&g.terminate()}},0<=f&&(y.size=f,y.originalSize=m),h.onfile(y)),"break"):c?134695760==b?(s=o+=12+(-2==c&&8),a=3,h.c=0,"break"):33639248==b?(s=o-=4,a=3,h.c=0,"break"):void 0:void 0}();++o);if(this.p=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),p=1;p<=r;++p){h[p]=t-i[e+1-p],d[p]=i[e+p]-t;for(var f=0,m=0;m<p;++m){var v=d[m+1],g=h[p-m],y=(u[p][m]=v+g,u[m][p-1]/u[p][m]);u[m][p]=f+v*y,f=g*y}u[p][p]=f}for(var b=0;b<=r;++b)s[0][b]=u[b][r];for(var x=0;x<=r;++x){for(var w=0,A=1,S=[],M=0;M<=r;++M)S[M]=a.slice(0);for(var 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 k=r,O=1;O<=n;++O){for(var R=0;R<=r;++R)s[O][R]*=k;k*=r-O}return s}(l,i,e,o,t),c=[],h=0;h<n.length;++h){var d=n[h].clone(),p=d.w;d.x*=p,d.y*=p,d.z*=p,c[h]=d}for(var f=0;f<=o;++f){for(var m=c[l-e].clone().multiplyScalar(u[f][0]),v=1;v<=e;++v)m.add(c[l-e+v].clone().multiplyScalar(u[f][v]));s[f]=m}for(var g=o+1;g<=a+1;++g)s[g]=new r.Vector4(0,0,0);return s}function 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 pa(e){return(pa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function fa(e,t){return(fa=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ma(e){return(ma=Object.setPrototypeOf?Object.getPrototypeOf: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&&fa(t,e);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ma(e);if(r=t?(r=ma(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===pa(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e,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||function(e,t){return e.__proto__=t,e})(e,t)}function Ca(e){return(Ca=Object.setPrototypeOf?Object.getPrototypeOf: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,p){var f,m,v,g,y=!1,b=(d<0&&(d^=-1,y=!0),[]),x=[];if(a.push(3*d,3*d+1,3*d+2),e.color&&(g=Fa(p,r,d,e.color),s.push(g[0],g[1],g[2])),e.skeleton){for(void 0!==e.weightTable[d]&&e.weightTable[d].forEach((function(e){x.push(e.weight),b.push(e.id)})),4<x.length&&(i||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),i=!0),m=[0,0,0,0],v=[0,0,0,0],x.forEach((function(e,t){var r=e,n=b[t];v.forEach((function(e,t,i){e<r&&(i[t]=r,r=e,i=m[t],m[t]=n,n=i)}))})),b=m,x=v);x.length<4;)x.push(0),b.push(0);for(var w=0;w<4;++w)u.push(x[w]),c.push(b[w])}e.normal&&(g=Fa(p,r,d,e.normal),o.push(g[0],g[1],g[2])),e.material&&"AllSame"!==e.material.mappingType&&(f=Fa(p,r,d,e.material)[0]),e.uv&&e.uv.forEach((function(e,t){e=Fa(p,r,d,e),void 0===l[t]&&(l[t]=[]),l[t].push(e[0]),l[t].push(e[1])})),n++,y&&(h.genFace(t,e,a,f,o,s,l,u,c,n),r++,n=0,a=[],o=[],s=[],l=[],u=[],c=[])})),t}},{key:"genFace",value:function(e,t,r,n,i,a,o,s,l,u){for(var c=2;c<u;c++)!function(u){e.vertex.push(t.vertexPositions[r[0]]),e.vertex.push(t.vertexPositions[r[1]]),e.vertex.push(t.vertexPositions[r[2]]),e.vertex.push(t.vertexPositions[r[3*(u-1)]]),e.vertex.push(t.vertexPositions[r[3*(u-1)+1]]),e.vertex.push(t.vertexPositions[r[3*(u-1)+2]]),e.vertex.push(t.vertexPositions[r[3*u]]),e.vertex.push(t.vertexPositions[r[3*u+1]]),e.vertex.push(t.vertexPositions[r[3*u+2]]),t.skeleton&&(e.vertexWeights.push(s[0]),e.vertexWeights.push(s[1]),e.vertexWeights.push(s[2]),e.vertexWeights.push(s[3]),e.vertexWeights.push(s[4*(u-1)]),e.vertexWeights.push(s[4*(u-1)+1]),e.vertexWeights.push(s[4*(u-1)+2]),e.vertexWeights.push(s[4*(u-1)+3]),e.vertexWeights.push(s[4*u]),e.vertexWeights.push(s[4*u+1]),e.vertexWeights.push(s[4*u+2]),e.vertexWeights.push(s[4*u+3]),e.weightsIndices.push(l[0]),e.weightsIndices.push(l[1]),e.weightsIndices.push(l[2]),e.weightsIndices.push(l[3]),e.weightsIndices.push(l[4*(u-1)]),e.weightsIndices.push(l[4*(u-1)+1]),e.weightsIndices.push(l[4*(u-1)+2]),e.weightsIndices.push(l[4*(u-1)+3]),e.weightsIndices.push(l[4*u]),e.weightsIndices.push(l[4*u+1]),e.weightsIndices.push(l[4*u+2]),e.weightsIndices.push(l[4*u+3])),t.color&&(e.colors.push(a[0]),e.colors.push(a[1]),e.colors.push(a[2]),e.colors.push(a[3*(u-1)]),e.colors.push(a[3*(u-1)+1]),e.colors.push(a[3*(u-1)+2]),e.colors.push(a[3*u]),e.colors.push(a[3*u+1]),e.colors.push(a[3*u+2])),t.material&&"AllSame"!==t.material.mappingType&&(e.materialIndex.push(n),e.materialIndex.push(n),e.materialIndex.push(n)),t.normal&&(e.normal.push(i[0]),e.normal.push(i[1]),e.normal.push(i[2]),e.normal.push(i[3*(u-1)]),e.normal.push(i[3*(u-1)+1]),e.normal.push(i[3*(u-1)+2]),e.normal.push(i[3*u]),e.normal.push(i[3*u+1]),e.normal.push(i[3*u+2])),t.uv&&t.uv.forEach((function(t,r){void 0===e.uvs[r]&&(e.uvs[r]=[]),e.uvs[r].push(o[r][0]),e.uvs[r].push(o[r][1]),e.uvs[r].push(o[r][2*(u-1)]),e.uvs[r].push(o[r][2*(u-1)+1]),e.uvs[r].push(o[r][2*u]),e.uvs[r].push(o[r][2*u+1])}))}(c)}},{key:"addMorphTargets",value:function(e,t,r,n){var i;0!==r.length&&(e.morphTargetsRelative=!0,e.morphAttributes.position=[],i=this,r.forEach((function(r){r.rawTargets.forEach((function(r){var a=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 Oa,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 ka(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 Oa;!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 ka(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}(),ka=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}(),Oa=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,p=new r.Matrix4,f=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===f?y.copy(e).multiply(m).multiply(v).multiply(g):1===f?y.copy(e).multiply(v).multiply(m).multiply(g):(f=(new r.Matrix4).scale((new r.Vector3).setFromMatrixScale(d)).clone().invert(),d=v.clone().multiply(f),y.copy(e).multiply(m).multiply(d).multiply(g)),v=c.clone().invert(),f=s.clone().invert(),e=t.clone().multiply(u).multiply(c).multiply(n).multiply(i).multiply(a).multiply(v).multiply(l).multiply(s).multiply(o).multiply(f),m=(new r.Matrix4).copyPosition(e),d=h.clone().multiply(m),p.copyPosition(d),(e=p.clone().multiply(y)).premultiply(h.invert()),e}function 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||function(e,t){return e.__proto__=t,e})(e,t)}function Za(e){return(Za=Object.setPrototypeOf?Object.getPrototypeOf: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 p=s.slice(1).trim().split(/\s+/),f=[],m=0,v=p.length;m<v;m++){var g=p[m];0<g.length&&(g=g.split("/"),f.push(g))}for(var y=f[0],b=1,x=f.length-1;b<x;b++){var w=f[b],A=f[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,k=a.objects.length;P<k;P++){var O=a.objects[P],R=O.geometry,I=O.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=O.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 po{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 fo=__webpack_require__.n(ar),mo=__webpack_require__(3185),vo=__webpack_require__(2510),go=__webpack_require__(4380),yo=__webpack_require__(7453);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}),fo().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||function(e,t){return e.__proto__=t,e})(e,t)}function Ao(e){return(Ao=Object.setPrototypeOf?Object.getPrototypeOf: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__(7585)),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:5e3,effectController:{morning:{turbidity:5,rayleigh:1,mieCoefficient:.007,mieDirectionalG:.7,elevation:0,azimuth:180,exposure:.3,lightConfig:Mo.Z.toJSON(this.directionalLight),time:1},noon:{lightConfig:Mo.Z.toJSON(this.directionalLight),turbidity:1,rayleigh:1,mieCoefficient:.005,mieDirectionalG:.7,elevation:90,azimuth:180,exposure:1,time:1},evening:{turbidity:2,rayleigh:.3,mieCoefficient:.011,mieDirectionalG:.67,elevation:3,azimuth:0,exposure:.3762,lightConfig:Mo.Z.toJSON(this.directionalLight),time:1},night:{turbidity:1,rayleigh:1,mieCoefficient:.005,mieDirectionalG:.7,elevation:2,azimuth:0,exposure:.2624,lightConfig:Mo.Z.toJSON(this.directionalLight),time:1},midnight:{turbidity:.1,rayleigh:.5,mieCoefficient:.022,mieDirectionalG:.83,elevation:0,azimuth:0,exposure:.3079,lightConfig:Mo.Z.toJSON(this.directionalLight),time:1}},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:5,rayleigh:1,mieCoefficient:.007,mieDirectionalG:.7,elevation:0,azimuth:180,exposure:.3},this.effectController={turbidity:5,rayleigh:1,mieCoefficient:.007,mieDirectionalG:.7,elevation:0,azimuth:180,exposure:.3},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),ut.selectableModel.close(this.directionalLight),(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,this.skyData),e}parseJSON(e){if(e){console.log("导入数据data:",e);const i=this.runScene.assetsEx.get().renderer;var{isShow:t,currentState:r,size:n}=e;this.beforeRecoverySky(e),this.inied||(this.init(),this.inied=!0),this.recoverySkyState(r,n),this.recoveryLightState(r),t&&this.open(),i.toneMapping=t?4:0}}beforeRecoverySky(e){var{light:e,isShow:t,effectController:r,currentState:n}=e;e=new Mo.Z(this.runScene).parseJSON(e,{addToTree:!1}),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}static setSkyLightConfig(e,t){var{intensity:t,name:r,visible:n,color:i,castShadow:a,shadow:o,type:s}=t,{mapSize:l,camera:u}=o,{scale:u,near:c,far:h}=u;e.intensity=t,e.type=s,e.name=r,e.visible=n,e.castShadow=a,e.color=new Cs.Color("#"+i),e.add(e.target),e.shadow.mapSize.x=l,e.shadow.mapSize.y=l,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(),console.log(o,"阴影参数")}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),Bo.setSkyLightConfig(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(){var e=Mo.Z.toJSON(this.skyData.light);this.skyData.effectController[this.skyData.currentState].lightConfig=e,this.syncLightShadow(e)}syncLightShadow(e){const{shadow:t,castShadow:r}=e;Object.keys(this.skyData.effectController).map((e=>{let n=this.skyData.effectController[e].lightConfig;n.shadow=t,n.castShadow=r}))}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)}))}))}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){e?this.open():this.close(),this.skyData.isShow=e,this.sky.visible=e}addToGroup(){this.directionalLight.name="sky定向灯光",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,n,"天空盒修改")}setCurrentTime(e){this.skyData.currentState=e}setImplementTime(e){var{info:e,time:t}=e;this.skyData.effectController[e].time=t}reset(){this.close()}}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,p=74*o,f=30*o,m=document.createElement("canvas"),v=(m.width=s,m.height=l,m.style.cssText="width:80px;height:48px",m.getContext("2d"));return v.font="bold "+9*o+"px Helvetica,Arial,sans-serif",v.textBaseline="top",v.fillStyle=r,v.fillRect(0,0,s,l),v.fillStyle=t,v.fillText(e,u,c),v.fillRect(h,d,p,f),v.fillStyle=r,v.globalAlpha=.9,v.fillRect(h,d,p,f),{dom:m,update:function(l,g){n=Math.min(n,l),i=Math.max(i,l),v.fillStyle=r,v.globalAlpha=1,v.fillRect(0,0,s,d),v.fillStyle=t,v.fillText(a(l)+" "+e+" ("+a(n)+"-"+a(i)+")",u,c),v.drawImage(m,h+o,d,p-o,f,h,d,p-o,f),v.fillRect(h+p-o,d,o,f),v.fillStyle=r,v.globalAlpha=.9,v.fillRect(h+p-o,d,o,a((1-l/g)*f))}}};const 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 ko={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}"},Oo=__webpack_require__(5180),Ro=__webpack_require__(4819),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||function(e,t){return e.__proto__=t,e})(e,t)}function Uo(e){return(Uo=Object.setPrototypeOf?Object.getPrototypeOf: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]),p=(l=Math.round(s.resolution.x/2),u=Math.round(s.resolution.y/2),0);p<s.nMips;p++)s.separableBlurMaterials.push(s.getSeperableBlurMaterial(d[p])),s.separableBlurMaterials[p].uniforms.texSize.value=new r.Vector2(l,u),l=Math.round(l/2),u=Math.round(u/2);return s.compositeMaterial=s.getCompositeMaterial(s.nMips),s.compositeMaterial.uniforms.blurTexture1.value=s.renderTargetsVertical[0].texture,s.compositeMaterial.uniforms.blurTexture2.value=s.renderTargetsVertical[1].texture,s.compositeMaterial.uniforms.blurTexture3.value=s.renderTargetsVertical[2].texture,s.compositeMaterial.uniforms.blurTexture4.value=s.renderTargetsVertical[3].texture,s.compositeMaterial.uniforms.blurTexture5.value=s.renderTargetsVertical[4].texture,s.compositeMaterial.uniforms.bloomStrength.value=t,s.compositeMaterial.uniforms.bloomRadius.value=.1,s.compositeMaterial.needsUpdate=!0,s.compositeMaterial.uniforms.bloomFactors.value=[1,.8,.6,.4,.2],s.bloomTintColors=[new r.Vector3(1,1,1),new r.Vector3(1,1,1),new r.Vector3(1,1,1),new r.Vector3(1,1,1),new r.Vector3(1,1,1)],s.compositeMaterial.uniforms.bloomTintColors.value=s.bloomTintColors,e=ko,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 Oo.T(ko),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||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: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===Oo.T&&console.error("THREE.EffectComposer relies on ShaderPass"),this.copyPass=new Oo.T(ko),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 Oo.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||function(e,t){return e.__proto__=t,e})(e,t)}function ss(e){return(ss=Object.setPrototypeOf?Object.getPrototypeOf: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=ko,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||function(e,t){return e.__proto__=t,e})(e,t)}function ds(e){return(ds=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ps=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 fs{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 ps(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__(7738);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__(272);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__(4298);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,p=a;const t={color(e){const{animaData:t,defType:r}=e,n={};(0,z.js)(t,(e=>{var i;-1!==e.indexOf(r)&&(i=e.substring(r.length),["r","g","b"].includes(i)&&(n[i]=t[e]))}));var{r:e,g:i,b:a}=n;if(e&&i&&a)return n}};return()=>{let r;return{promise:new Promise((n=>{var i;if(!(i=e(h,c,0,p)))return n(0);var{begin:i,end:a}=i;return r=(0,oe.anima)(i,a,d,(e=>{(0,z.js)(p,((r,n)=>{n=n.type;var i,a=e[r];"number"===n?c[r]=a:"color"===n&&(a=t.color({animaData:e,defType:r}))&&(({r:n,g:a,b:i}=a),c[r].setRGB(n,a,i))}))}),n)})),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?fo().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:p}=e;r.position&&t.position.set(e,n,i),r.scale&&t.scale.set(a,o,s),r.rotation&&t.rotation.set(l,u,c),r.target&&this.controls.target.set(h,d,p)}),o)})),anima: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":fo().model.v3ToMap(t),scale:e?"notNow":fo().model.v3ToMap(r),rotation:e?"notNow":fo().model.v3ToMap(n),target:e?"notNow":fo().model.v3ToMap(this.controls.target)}}getData(e){var{position:t,scale:r,rotation:n}=this.target;let i;if("position"===e)i=fo().model.v3ToMap(t);else if("scale"===e)i=fo().model.v3ToMap(r);else if("rotation"===e)i=fo().model.v3ToMap(n);else{if("target"!==e)throw TypeError("输入值不存在");i=fo().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__(6651);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 Ot,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 pt.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 fs(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 po(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,n)=>{"use strict";function r(){return(r="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=l(e)););return e}(e,t);if(r)return(r=Object.getOwnPropertyDescriptor(r,t)).get?r.get.call(arguments.length<3?e:n):r.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 n,r=l(e);if(n=t?(n=l(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===p(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return s(r)}}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 n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e,t,n){return t&&u(e.prototype,t),n&&u(e,n),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 n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?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 n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}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(rt=C(e,nt))&&Sn}function b(e,t){return!t&&console.warn(e)}function x(e,t){return e&&(nt[e]=t)&&rt&&(rt[e]=t)||nt}function w(){return 0}function A(e,t,n){return(n=e[t])&&ze(n)?e[t]():m(n)&&e.getAttribute&&e.getAttribute(t)||n}function S(e,t){(e=e.split(",")).forEach(t)}function M(e,t,n,r){ot.length&&vt(),e.render(t,n,r),ot.length&&vt()}function _(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 C(e,t){for(var n in t)e[n]=t[n];return e}function E(e,t){for(var n in t)"__proto__"!==n&&"constructor"!==n&&"prototype"!==n&&(e[n]=Je(t[n])?E(e[n]||(e[n]={}),t[n]):t[n]);return e}function T(e){var t,n=e.parent||le,r=e.keyframes?(t=Ze(e.keyframes),function(e,n){for(var r in n)r in e||"duration"===r&&t||"ease"===r||(e[r]=n[r])}):gt;if(We(e.inherit))for(;n;)r(e,n.vars.defaults),n=n.parent||n._dp;return e}function D(e){return!e||e._ts&&D(e.parent)}function P(e){return e._repeat?O(e._tTime,e=e.duration()+e._rDelay)*e:0}function O(e,t){return t=Math.floor(e/=t),e&&t===e?t-1:t}function R(e,t){return(e-t._start)*t._ts+(0<=t._ts?0:t._dirty?t.totalDuration():t._tDur)}function I(e,t){var n;if((t._time||t._initted&&!t._dur)&&(n=R(e.rawTime(),t),(!t._dur||V(0,t.totalDuration(),n)-t._tTime>ke)&&t.render(n,!0)),wt(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur<e.duration())for(n=e;n._dp;)0<=n.rawTime()&&n.totalTime(n._tTime),n=n._dp;e._zTime=-ke}}function k(e,t,n,r){return t.parent&&xt(t),t._start=mt((Ve(n)?n:n||e!==le?H(e,n,t):e._time)+t._delay),t._end=mt(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),function(e,t){var n,r=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(n=t[a];o&&o[a]>n;)o=o._prev;o?(t._next=o._next,o._next=t):(t._next=e[r],e[r]=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),r||I(e,t),e}function L(e,t){(nt.ScrollTrigger||it("scrollTrigger",t))&&nt.ScrollTrigger.create(t,e)}function F(e,t,n,r){return Kt(e,t),e._initted?!n&&e._pt&&(e._dur&&!1!==e.vars.lazy||!e._dur&&e.vars.lazy)&&fe!==Ut.frame?(ot.push(e),e._lazy=[t,r]):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 N(e,t,n,r){var i=e._repeat,a=mt(t)||0;return(t=e._tTime/e._tDur)&&!r&&(e._time*=a/e._dur),e._dur=a,e._tDur=i?i<0?1e10:mt(a*(i+1)+e._rDelay*i):a,0<t&&!r?St(e,e._tTime=e._tDur*t):e.parent&&At(e),n||wt(e.parent,e),e}function j(e){return e instanceof on?wt(e):N(e,e._dur)}function H(e,t,n){var r,i,a,o=e.labels,s=e._recent||Mt,l=e.duration()>=Ie?s.endTime(!1):e._dur;return He(t)&&(isNaN(t)||t in o)?(i=t.charAt(0),a="%"===t.substr(-1),r=t.indexOf("="),"<"===i||">"===i?(0<=r&&(t=t.replace(/=/,"")),("<"===i?s._start:s.endTime(0<=s._repeat))+(parseFloat(t.substr(1))||0)*(a?(r<0?s:n).totalDuration()/100:1)):r<0?(t in o||(o[t]=l),o[t]):(i=parseFloat(t.charAt(r-1)+t.substr(r+1)),a&&n&&(i=i/100*(Ze(n)?n[0]:n).totalDuration()),1<r?H(e,t.substr(0,r-1),n)+i:l+i)):null==t?l:+t}function z(e,t,n){var r,i,a=Ve(t[1]),o=(a?2:1)+(e<2?0:1),s=t[o];if(a&&(s.duration=t[1]),s.parent=n,e){for(r=s,i=n;i&&!("immediateRender"in r);)r=i.vars.defaults||{},i=We(i.vars.inherit)&&i.parent;s.immediateRender=We(r.immediateRender),e<2?s.runBackwards=1:s.startAt=t[o-1]}return new dn(t[0],s,t[1+o])}function V(e,t,n){return n<e?e:t<n?t:n}function J(e){if(ze(e))return e;var t=Je(e)?e:{each:e},n=Vt(t.ease),r=t.from||0,i=parseFloat(t.base)||0,a={},o=(e=0<r&&r<1,isNaN(r)||e),s=t.axis,l=r,u=r;return He(r)?l=u={center:.5,edges:.5,end:1}[r]||0:!e&&o&&(l=r[0],u=r[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,Ie])[1])){for(g=-Ie;g<(g=h[b++].getBoundingClientRect().left)&&b<x;);b--}for(w=a[x]=[],d=o?Math.min(b,x)*l-.5:r%b,f=b===Ie?0:o?x*u/b-.5:r/b|0,y=Ie,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"===r&&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"===r?-1:1),w.b=x<0?i-x:i,w.u=Bt(t.amount||t.each)||0,n=n&&x<0?zt(n):n}return x=(w[e]-w.min)/w.max||0,mt(w.b+(n?n(x):x)*w.v)+w.u}}function W(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(n){var r=Math.round(parseFloat(n)/e)*e*t;return(r-r%1)/t+(Ve(n)?0:Bt(n))}}function K(e,t){var n,r,i=Ze(e);return!i&&Je(e)&&(n=i=e.radius||Ie,e.values?(e=Tt(e.values),(r=!Ve(e[0]))&&(n*=n)):e=W(e.increment)),_t(t,i?ze(e)?function(t){return r=e(t),Math.abs(r-t)<=n?r:t}:function(t){for(var i,a,o=parseFloat(r?t.x:t),s=parseFloat(r?t.y:0),l=Ie,u=0,c=e.length;c--;)(i=r?(i=e[c].x-o)*i+(a=e[c].y-s)*a:Math.abs(e[c]-o))<l&&(l=i,u=c);return u=!n||l<=n?e[u]:t,r||u===t||Ve(t)?u:u+Bt(t)}:W(e))}function Z(e,t,n,r){return _t(Ze(e)?!t:!0===n?!!(n=0):!r,(function(){return Ze(e)?e[~~(Math.random()*e.length)]:(n=n||1e-5)&&(r=n<1?Math.pow(10,(n+"").length-2):1)&&Math.floor(Math.round((e-n/2+Math.random()*(t-e+.99*n))/n)*n*r)/r}))}function X(e,t,n){return _t(n,(function(n){return e[~~t(n)]}))}function Q(e,t,n,r,i){var a=t-e,o=r-n;return _t(i,(function(t){return n+((t-e)/a*o||0)}))}function Y(e,t,n){var r,i,a,o=e.labels,s=Ie;for(r in o)(i=o[r]-t)<0==!!n&&i&&s>(i=Math.abs(i))&&(a=r,s=i);return a}function q(e,t,n){var r=e.vars,i=r[t];i&&(t=r[t+"Params"],r=r.callbackScope||e,n&&ot.length&&vt(),t?i.apply(r,t):i.call(r))}function $(e){return xt(e),e.scrollTrigger&&e.scrollTrigger.kill(!1),e.progress()<1&&q(e,"onInterrupt"),e}function ee(e,t,n){return(6*(e+=e<0?1:1<e?-1:0)<1?t+(n-t)*e*6:e<.5?n:3*e<2?t+(n-t)*(2/3-e)*6:t)*Ot+.5|0}function te(e,t,n){var r,i,a,o,s="",l=(e+s).match(Lt),u=t?"hsla(":"rgba(",c=0;if(!l)return e;if(l=l.map((function(e){return(e=It(e,t,1))&&u+(t?e[0]+","+e[1]+"%,"+e[2]+"%,"+e[3]:e.join(","))+")"})),n&&(a=kt(e),(r=n.c).join(s)!==a.c.join(s)))for(o=(i=e.replace(Lt,"1").split(Ye)).length-1;c<o;c++)s+=i[c]+(~r.indexOf(c)?l.shift()||u+"0,0,0,0)":(a.length?a:l.length?l:n).shift());if(!i)for(o=(i=e.split(Lt)).length-1;c<o;c++)s+=i[c]+l[c];return s+i[o]}function ne(e,t){for(var n,r=e._first;r;)r instanceof on?ne(r,t):!r.vars.yoyoEase||r._yoyo&&r._repeat||r._yoyo===t||(r.timeline?ne(r.timeline,t):(n=r._ease,r._ease=r._yEase,r._yEase=n,r._yoyo=t)),r=r._next}function re(e,t){var n,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:function(e){return 1-t(1-e)},i={easeIn:t,easeOut:r,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 Nt[e]=nt[e]=i,Nt[n=e.toLowerCase()]=r,i)Nt[n+("easeIn"===t?".in":"easeOut"===t?".out":".inOut")]=Nt[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,n){function r(e){return 1===e?1:i*Math.pow(2,-10*e)*je((e-a)*o)+1}var i=1<=t?t:1,a=(o=(n||(e?.3:.45))/(t<1?t:1))/Le*(Math.asin(1/i)||0),o=(n="out"===e?r:"in"===e?function(e){return 1-r(1-e)}:ie(r),Le/o);return n.config=function(t,n){return ae(e,t,n)},n}function oe(e){function t(e){return e?--e*e*((n+1)*e+n)+1:0}var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1.70158,r="out"===e?t:"in"===e?function(e){return 1-t(1-e)}:ie(t);return r.config=function(t){return oe(e,t)},r}n.d(t,{Q3:()=>dn});var se,le,ue,ce,he,de,fe,pe,me,ve,ge,ye,be,xe,we,Ae,Se,Me,_e,Be,Ce,Ee,Te,De,Pe,Oe={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Re={duration:.5,overwrite:!1,delay:0},Ie=1e8,ke=1/Ie,Le=2*Math.PI,Fe=Le/4,Ue=0,Ge=Math.sqrt,Ne=Math.cos,je=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)},We=function(e){return!1!==e},Ke="function"==typeof ArrayBuffer&&ArrayBuffer.isView||function(){},Ze=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,nt={},rt={},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,n,r=e[0];if(Je(r)||ze(r)||(e=[e]),!(t=(r._gsap||{}).harness)){for(n=ht.length;n--&&!ht[n].targetTest(r););t=ht[n]}for(n=e.length;n--;)e[n]&&(e[n]._gsap||(e[n]._gsap=new rn(e[n],t)))||e.splice(n,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,n=ot.length,r=ot.slice(0);for(st={},e=ot.length=0;e<n;e++)(t=r[e])&&t._lazy&&(t.render(t._lazy[0],t._lazy[1],!0)._lazy=0)},gt=function(e,t){for(var n in t)n in e||(e[n]=t[n]);return e},yt=function(e,t){var n,r={};for(n in e)n in t||(r[n]=e[n]);return r},bt=function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"_first",r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"_last",i=t._prev,a=t._next;i?i._next=a:e[n]===t&&(e[n]=a),a?a._prev=i:e[r]===t&&(e[r]=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 n=e;n;)n._dirty=1,n=n.parent;return e},At=function(e){return e._end=mt(e._start+(e._tDur/Math.abs(e._ts||e._rts||ke)||0))},St=function(e,t){var n=e._dp;return n&&n.smoothChildTiming&&e._ts&&(e._start=mt(n._time-(0<e._ts?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),At(e),n._dirty||wt(n,e)),e},Mt={_start:0,endTime:w,totalDuration:w},_t=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):""},Ct=[].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,n){return!He(e)||n||!ce&&Gt()?Ze(e)?function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[];return e.forEach((function(e){return He(e)&&!t||Et(e,1)?n.push.apply(n,d(Tt(e))):n.push(e)}))||n}(e,n):Et(e)?Ct.call(e,0):e?[e]:[]:Ct.call((t||he).querySelectorAll(e),0)},Dt=function(e){return e.sort((function(){return.5-Math.random()}))},Pt=function(e){for(var t,n,r,i,a=0,o="";~(t=e.indexOf("random(",a));)r=e.indexOf(")",t),i="["===e.charAt(t+7),n=e.substr(t+7,r-t-7).match(i?et:Xe),o+=e.substr(a,t-a)+Z(i?n:+n[0],i?0:+n[1],+n[2]||1e-5),a=r+1;return o+e.substr(a,e.length-a)},Ot=255,Rt={aqua:[0,Ot,Ot],lime:[0,Ot,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Ot],navy:[0,0,128],white:[Ot,Ot,Ot],olive:[128,128,0],yellow:[Ot,Ot,0],orange:[Ot,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Ot,0,0],pink:[Ot,192,203],cyan:[0,Ot,Ot],transparent:[Ot,Ot,Ot,0]},It=function(e,t,n){var r,i,a,o,s,l,u,c=e?Ve(e)?[e>>16,e>>8&Ot,e&Ot]:0:Rt.black;if(!c){if(","===e.substr(-1)&&(e=e.substr(0,e.length-1)),Rt[e])c=Rt[e];else if("#"===e.charAt(0)){if(9===(e=e.length<6?"#"+(r=e.charAt(1))+r+(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),n&&c.length<4&&(c[3]=1),c}else o=+c[0]%360/360,s=+c[1]/100,r=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,r,i),c[1]=ee(o,r,i),c[2]=ee(o-1/3,r,i);else c=e.match(Xe)||Rt.transparent;c=c.map(Number)}return t&&!u&&(r=c[0]/Ot,i=c[1]/Ot,a=c[2]/Ot,l=((e=Math.max(r,i,a))+(t=Math.min(r,i,a)))/2,e===t?o=s=0:(u=e-t,s=.5<l?u/(2-e-t):u/(e+t),o=e===r?(i-a)/u+(i<a?6:0):e===i?(a-r)/u+2:(r-i)/u+4,o*=60),c[0]=~~(o+.5),c[1]=~~(100*s+.5),c[2]=~~(100*l+.5)),n&&c.length<4&&(c[3]=1),c},kt=function(e){var t=[],n=[],r=-1;return e.split(Lt).forEach((function(e){e=e.match(Ye)||[],t.push.apply(t,d(e)),n.push(r+=e.length+1)})),t.c=n,t},Lt=function(){var e,t="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b";for(e in Rt)t+="|"+e+"\\b";return new RegExp(t+")","gi")}(),Ft=/hsl[a]?\(/,Ut=(we=Date.now,Ae=500,Se=33,Me=we(),_e=Me,Ce=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||{},nt.gsap=Sn,(ue.gsapVersions||(ue.gsapVersions=[])).push(Sn.version),y(rt||ue.GreenSockGlobals||!ue.gsap&&ue||{}),ye=ue.requestAnimationFrame),ve&&Te.sleep(),ge=ye||function(e){return setTimeout(e,Ce-1e3*Te.time+1|0)},me=1,Jt(2))},sleep:function(){(ye?ue.cancelAnimationFrame:clearTimeout)(ve),me=0,ge=w},lagSmoothing:function(e,t){Ae=e||1/ke,Se=Math.min(t,Ae,0)},fps:function(e){Be=1e3/(e||240),Ce=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()},Nt={},jt=/^[\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:Nt[e]||function(e){var t,n,r,i=(e+"").split("("),a=Nt[i[0]];return a&&1<i.length&&a.config?a.config.apply(null,~e.indexOf("{")?[function(e){for(var t,n,r,i={},a=e.substr(1,e.length-3).split(":"),o=a[0],s=1,l=a.length;s<l;s++)n=a[s],t=s!==l-1?n.lastIndexOf(","):n.length,r=n.substr(0,t),i[o]=isNaN(r)?r.replace(Ht,"").trim():+r,o=n.substr(t+1).trim();return i}(i[1])]:(t=(i=e).indexOf("(")+1,n=i.indexOf(")"),r=i.indexOf("(",t),i.substring(t,~r&&r<n?i.indexOf(")",n+1):n).split(",").map(_))):Nt._CE&&jt.test(e)?Nt._CE("",e):a}(e))||t};function Jt(e){var t,n,r,i=we()-_e,a=!0===e;if(Ae<i&&(Me+=i-Se),(0<(i=(n=(_e+=i)-Me)-Ce)||a)&&(r=++Te.frame,be=n-1e3*Te.time,Te.time=n/=1e3,Ce+=i+(Be<=i?4:Be-i),t=1),a||(ve=ge(Jt)),t)for(xe=0;xe<Ee.length;xe++)Ee[xe](n,be,r,e)}function Wt(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 Kt(e,t){var n,r,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,_=m.keyframes,B=m.autoRevert,C=e._dur,E=e._startAt,T=e._targets,D=e.parent,P=D&&"nested"===D.data?D.parent._targets:T,O="auto"===e._overwrite&&!se,R=e.timeline;if(e._ease=Vt(v=!R||_&&v?v:"none",Re.ease),e._yEase=M?zt(Vt(!0===M?v:M,Re.ease)):0,M&&e._yoyo&&!e._repeat&&(M=e._yEase,e._yEase=e._ease,e._ease=M),e._from=!R&&!!m.runBackwards,!R||_&&!m.stagger){if(f=(u=T[0]?pt(T[0]).harness:0)&&m[u.prop],n=yt(m,at),E&&xt(E.render(-1,!0)),g)if(xt(e._startAt=dn.set(T,gt({data:"isStart",overwrite:!1,parent:D,immediateRender:!0,lazy:We(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),C&&t<=0)return void(t&&(e._zTime=t))}else!1===B&&(e._startAt=0);else if(S&&C)if(E)B||(e._startAt=0);else if(i=gt({overwrite:!1,data:"isFromStart",lazy:(y=!t&&y)&&We(b),immediateRender:y,stagger:0,parent:D},n),f&&(i[u.prop]=f),xt(e._startAt=dn.set(T,i)),t<0&&e._startAt.render(-1,!0),e._zTime=t,y){if(!t)return}else Kt(e._startAt,ke);for(e._pt=0,b=C&&We(b)||b&&!C,r=0;r<T.length;r++){if(l=(o=T[r])._gsap||ft(T)[r]._gsap,e._ptLookup[r]=h={},st[l.id]&&ot.length&&vt(),d=P===T?r:P.indexOf(o),u&&!1!==(c=new u).init(o,f||n,e,d,P)&&(e._pt=a=new xn(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 n)lt[i]&&(c=un(i,n,e,d,o,P))?c.priority&&(s=1):h[i]=a=ln.call(e,o,i,"get",n[i],d,P,0,m.stringFilter);e._op&&e._op[r]&&e.kill(o,e._op[r]),O&&e._pt&&(nn=e,le.killTweensOf(o,h,e.globalTime(t)),p=!e.parent,nn=0),e._pt&&b&&(st[l.id]=1)}s&&bn(e),e._onInit&&e._onInit(e)}e._onUpdate=x,e._initted=(!e._op||e._pt)&&!p,_&&t<=0&&R.render(Ie,!0,!0)}function Zt(e,t,n,r,i){return ze(e)?e.call(t,n,r,i):He(e)&&~e.indexOf("random(")?Pt(e):e}function Xt(e,t,n){return e.setAttribute(t,n)}function Qt(e,t){var n=t._pt,r="";if(!e&&t.b)r=t.b;else if(1===e&&t.e)r=t.e;else{for(;n;)r=n.p+(n.m?n.m(n.s+n.c*e):Math.round(1e4*(n.s+n.c*e))/1e4)+r,n=n._next;r+=t.c}t.set(t.t,t.p,r,t)}function Yt(e,t){for(var n=t._pt;n;)n.r(e,n.d),n=n._next}function qt(e,t,n,r){for(var i,a=this._pt;a;)i=a._next,a.p===r&&a.modifier(e,t,n),a=i}function $t(e){for(var t,n,r=this._pt;r;)n=r._next,r.p===e&&!r.op||r.op===e?bt(this,r,"_pt"):r.dep||(t=1),r=n;return!t}function en(e,t,n,r){r.mSet(e,t,r.m.call(r.tween,n,r.mt),r)}function tn(e,t){return{name:e,rawVars:1,init:function(e,n,r){r._onInit=function(e){var r,i;if(He(n)&&(r={},S(n,(function(e){return r[e]=1})),n=r),t){for(i in r={},n)r[i]=t(n[i]);n=r}var a,o,s,l=e,u=n,c=l._targets;for(a in u)for(o=c.length;o--;)(s=(s=l._ptLookup[o][a])&&s.d)&&(s=s._pt?An(s,a):s)&&s.modifier&&s.modifier(u[a],l,c[o],a)}}}}S("Linear,Quad,Cubic,Quart,Quint,Strong",(function(e,t){var n=t<5?t+1:t;re(e+",Power"+(n-1),t?function(e){return Math.pow(e,n)}:function(e){return e},(function(e){return 1-Math.pow(1-e,n)}),(function(e){return e<.5?Math.pow(2*e,n)/2:1-Math.pow(2*(1-e),n)/2}))})),Nt.Linear.easeNone=Nt.none=Nt.Linear.easeIn,re("Elastic",ae("in"),ae("out"),ae()),De=7.5625,Pe=1/2.75,re("Bounce",(function(e){return 1-Wt(1-e)}),Wt),re("Expo",(function(e){return e?Math.pow(2,10*(e-1)):0})),re("Circ",(function(e){return-(Ge(1-e*e)-1)})),re("Sine",(function(e){return 1===e?1:1-Ne(e*Fe)})),re("Back",oe("in"),oe("out"),oe()),Nt.SteppedEase=Nt.steps=nt.SteppedEase={config:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length?arguments[1]:void 0,n=1/e,r=e+(t?0:1),i=t?1:0,a=1-ke;return function(e){return((r*V(0,a,e)|0)+i)*n}}},Re.ease=Nt["quad.out"],S("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",(function(e){return dt+=e+","+e+"Params,"}));var nn,rn=c((function e(t,n){h(this,e),this.id=Ue++,(t._gsap=this).target=t,this.harness=n,this.get=n?n.get:A,this.set=n?n.getSetter:vn})),an=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,N(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,N(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 n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(St(this,e),n._dp&&!n.parent&&I(n,this);n&&n.parent;)n.parent._time!==n._start+(0<=n._ts?n._tTime/n._ts:(n.totalDuration()-n._tTime)/-n._ts)&&n.totalTime(n._tTime,!0),n=n.parent;!this.parent&&this._dp.autoRemoveChildren&&(0<this._ts&&e<this._tDur||this._ts<0&&0<e||!this._tDur&&!e)&&k(this._dp,this,this._start-this._delay)}return(this._tTime!==e||!this._dur&&!t||this._initted&&Math.abs(this._zTime)===ke||!e&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=e),M(this,e,t)),this}},{key:"time",value:function(e,t){return arguments.length?this.totalTime(Math.min(this.totalDuration(),e+P(this))%(this._dur+this._rDelay)||(e?this._dur:0),t):this._time}},{key:"totalProgress",value:function(e,t){return arguments.length?this.totalTime(this.totalDuration()*e,t):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.ratio}},{key:"progress",value:function(e,t){return arguments.length?this.totalTime(this.duration()*(!this._yoyo||1&this.iteration()?e:1-e)+P(this),t):this.duration()?Math.min(1,this._time/this._dur):this.ratio}},{key:"iteration",value:function(e,t){var n=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(e-1)*n,t):this._repeat?O(this._tTime,n)+1:1}},{key:"timeScale",value:function(e){if(!arguments.length)return this._rts===-ke?0:this._rts;if(this._rts===e)return this;for(var t=this.parent&&this._ts?R(this.parent._time,this):this._tTime,n=(this._rts=+e||0,this._ts=this._ps||e===-ke?0:this._rts,e=this.totalTime(V(-this._delay,this._tDur,t),!0)).parent;n&&n.parent;)n._dirty=1,n.totalDuration(),n=n.parent;return At(this),this}},{key:"paused",value:function(e){return arguments.length?(this._ps!==e&&((this._ps=e)?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(Gt(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,1===this.progress()&&Math.abs(this._zTime)!==ke&&(this._tTime-=ke)))),this):this._ps}},{key:"startTime",value:function(e){var t;return arguments.length?(this._start=e,!(t=this.parent||this._dp)||!t._sort&&this.parent||k(t,this,e-this._delay),this):this._start}},{key:"endTime",value:function(e){return this._start+(We(e)?this.totalDuration():this.duration())/Math.abs(this._ts||1)}},{key:"rawTime",value:function(e){var t=this.parent||this._dp;return t?e&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?R(t.rawTime(e),this):this._tTime:this._tTime}},{key:"globalTime",value:function(e){for(var t=this,n=arguments.length?e:t.rawTime();t;)n=t._start+n/(t._ts||1),t=t._dp;return n}},{key:"repeat",value:function(e){return arguments.length?(this._repeat=e===1/0?-2:e,j(this)):-2===this._repeat?1/0:this._repeat}},{key:"repeatDelay",value:function(e){var t;return arguments.length?(t=this._time,this._rDelay=e,j(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),We(t))}},{key:"restart",value:function(e,t){return this.play().totalTime(e?-this._delay:0,We(t))}},{key:"play",value:function(e,t){return null!=e&&this.seek(e,t),this.reversed(!1).paused(!1)}},{key:"reverse",value:function(e,t){return null!=e&&this.seek(e||this.totalDuration(),t),this.reversed(!0).paused(!1)}},{key:"pause",value:function(e,t){return null!=e&&this.seek(e,t),this.paused(!0)}},{key:"resume",value:function(){return this.paused(!1)}},{key:"reversed",value:function(e){return arguments.length?(!!e!==this.reversed()&&this.timeScale(-this._rts||(e?-ke:0)),this):this._rts<0}},{key:"invalidate",value:function(){return this._initted=this._act=0,this._zTime=-ke,this}},{key:"isActive",value:function(){var e=this.parent||this._dp,t=this._start;return!(e&&!(this._ts&&this._initted&&e.isActive()&&(e=e.rawTime(!0))>=t&&e<this.endTime(!0)-ke))}},{key:"eventCallback",value:function(e,t,n){var r=this.vars;return 1<arguments.length?(t?(r[e]=t,n&&(r[e+"Params"]=n),"onUpdate"===e&&(this._onUpdate=t)):delete r[e],this):r[e]}},{key:"then",value:function(e){var t=this;return new Promise((function(n){function r(){var e=t.then;t.then=null,ze(i)&&(i=i(t))&&(i.then||i===t)&&(t.then=e),n(i),t.then=e}var i=ze(e)?e:B;t._initted&&1===t.totalProgress()&&0<=t._ts||!t._tTime&&t._ts<0?r():t._prom=r}))}},{key:"kill",value:function(){$(this)}}]),e}(),on=(gt(an.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-ke,_prom:0,_ps:!1,_rts:1}),function(){i(t,an);var e=o(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},i=1<arguments.length?arguments[1]:void 0;return h(this,t),(n=e.call(this,r)).labels={},n.smoothChildTiming=!!r.smoothChildTiming,n.autoRemoveChildren=!!r.autoRemoveChildren,n._sort=We(r.sortChildren),le&&k(r.parent||le,s(n),i),r.reversed&&n.reverse(),r.paused&&n.paused(!0),r.scrollTrigger&&L(s(n),r.scrollTrigger),n}return c(t,[{key:"to",value:function(e,t,n){return z(0,arguments,this),this}},{key:"from",value:function(e,t,n){return z(1,arguments,this),this}},{key:"fromTo",value:function(e,t,n,r){return z(2,arguments,this),this}},{key:"set",value:function(e,t,n){return t.duration=0,t.parent=this,T(t).repeatDelay||(t.repeat=0),t.immediateRender=!!t.immediateRender,new dn(e,t,H(this,n),1),this}},{key:"call",value:function(e,t,n){return k(this,dn.delayedCall(0,e,t),n)}},{key:"staggerTo",value:function(e,t,n,r,i,a,o){return n.duration=t,n.stagger=n.stagger||r,n.onComplete=a,n.onCompleteParams=o,n.parent=this,new dn(e,n,H(this,i)),this}},{key:"staggerFrom",value:function(e,t,n,r,i,a,o){return n.runBackwards=1,T(n).immediateRender=We(n.immediateRender),this.staggerTo(e,t,n,r,i,a,o)}},{key:"staggerFromTo",value:function(e,t,n,r,i,a,o,s){return r.startAt=n,T(r).immediateRender=We(r.immediateRender),this.staggerTo(e,t,r,i,a,o,s)}},{key:"render",value:function(e,t,n){var r,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||n||g){if(f!==this._time&&m&&(v+=this._time-f,e+=this._time-f),r=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,n);if(r=mt(v%o),v===p?(a=this._repeat,r=m):((a=~~(v/o))&&a===v/o&&(r=m,a--),m<r&&(r=m)),h=O(this._tTime,o),g&&1&a&&(r=m-r,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;ne(this,d)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(l=function(e,t,n){var r;if(t<n)for(r=e._first;r&&r._start<=n;){if("isPause"===r.data&&r._start>t)return r;r=r._next}else for(r=e._last;r&&r._start>=n;){if("isPause"===r.data&&r._start<t)return r;r=r._prev}}(this,mt(f),mt(r)))&&(v-=r-(r=l._start)),this._tTime=v,this._time=r,this._act=!u,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=e,f=0),!f&&r&&!t&&(q(this,"onStart"),this._tTime!==v))return this;if(f<=r&&0<=e)for(b=this._first;b;){if(i=b._next,(b._act||r>=b._start)&&b._ts&&l!==b){if(b.parent!==this)return this.render(e,t,n);if(b.render(0<b._ts?(r-b._start)*b._ts:(b._dirty?b.totalDuration():b._tDur)+(r-b._start)*b._ts,t,n),r!==this._time||!this._ts&&!s){l=0,i&&(v+=this._zTime=-ke);break}}b=i}else for(var b=this._last,x=e<0?e:r;b;){if(i=b._prev,(b._act||x<=b._end)&&b._ts&&l!==b){if(b.parent!==this)return this.render(e,t,n);if(b.render(0<b._ts?(x-b._start)*b._ts:(b._dirty?b.totalDuration():b._tDur)+(x-b._start)*b._ts,t,n),r!==this._time||!this._ts&&!s){l=0,i&&(v+=this._zTime=x?-ke:ke);break}}b=i}if(l&&!t&&(this.pause(),l.render(f<=r?0:-ke)._zTime=f<=r?1:-1,this._ts))return this._start=c,At(this),this.render(e,t,n);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 n=this;if(Ve(t)||(t=H(this,t,e)),!(e instanceof an)){if(Ze(e))return e.forEach((function(e){return n.add(e,t)})),this;if(He(e))return this.addLabel(e,t);if(!ze(e))return this;e=dn.delayedCall(0,e)}return this!==e?k(this,e,t):this}},{key:"getChildren",value:function(){for(var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],n=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:-Ie,i=[],a=this._first;a;)a._start>=r&&(a instanceof dn?t&&i.push(a):(n&&i.push(a),e&&i.push.apply(i,d(a.getChildren(!0,t,n))))),a=a._next;return i}},{key:"getById",value:function(e){for(var t=this.getChildren(1,1,1),n=t.length;n--;)if(t[n].vars.id===e)return t[n]}},{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,n){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))),r(l(t.prototype),"totalTime",this).call(this,e,n),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,n){return(t=dn.delayedCall(0,t||w,n)).data="isPause",this._hasPause=1,k(this,t,H(this,e))}},{key:"removePause",value:function(e){var t=this._first;for(e=H(this,e);t;)t._start===e&&"isPause"===t.data&&xt(t),t=t._next}},{key:"killTweensOf",value:function(e,t,n){for(var r=this.getTweensOf(e,n),i=r.length;i--;)nn!==r[i]&&r[i].kill(e,t);return this}},{key:"getTweensOf",value:function(e,t){for(var n,r=[],i=Tt(e),a=this._first,o=Ve(t);a;)a instanceof dn?function(e,t){for(var n=t.length,r=0;e.indexOf(t[r])<0&&++r<n;);return r<n}(a._targets,i)&&(o?(!nn||a._initted&&a._ts)&&a.globalTime(0)<=t&&a.globalTime(a.totalDuration())>t:!t||a.isActive())&&r.push(a):(n=a.getTweensOf(i,t)).length&&r.push.apply(r,d(n)),a=a._next;return r}},{key:"tweenTo",value:function(e,t){t=t||{};var n,r=this,i=H(r,e),a=(e=t).startAt,o=e.onStart,s=e.onStartParams,l=(e=e.immediateRender,dn.to(r,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:r._time))/r.timeScale())||ke,onStart:function(){var e;r.pause(),n||(e=t.duration||Math.abs((i-(a&&"time"in a?a.time:r._time))/r.timeScale()),l._dur!==e&&N(l,e,0,1).render(l._time,!0,!0),n=1),o&&o.apply(l,s||[])}},t)));return e?l.render(0):l}},{key:"tweenFromTo",value:function(e,t,n){return this.tweenTo(t,gt({startAt:{time:H(this,e)}},n))}},{key:"recent",value:function(){return this._recent}},{key:"nextLabel",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._time;return Y(this,H(this,e))}},{key:"previousLabel",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._time;return Y(this,H(this,e),1)}},{key:"currentLabel",value:function(e){return arguments.length?this.seek(e,!0):this.previousLabel(this._time+ke)}},{key:"shiftChildren",value:function(e,t){for(var n,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=this._first,a=this.labels;i;)i._start>=r&&(i._start+=e,i._end+=e),i=i._next;if(t)for(n in a)a[n]>=r&&(a[n]+=e);return wt(this)}},{key:"invalidate",value:function(){var e=this._first;for(this._lock=0;e;)e.invalidate(),e=e._next;return r(l(t.prototype),"invalidate",this).call(this)}},{key:"clear",value:function(){for(var e,t=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],n=this._first;n;)e=n._next,this.remove(n),n=e;return this._dp&&(this._time=this._tTime=this._pTime=0),t&&(this.labels={}),wt(this)}},{key:"totalDuration",value:function(e){var t,n,r,i=0,a=this,o=a._last,s=Ie;if(arguments.length)return a.timeScale((a._repeat<0?a.duration():a.totalDuration())/(a.reversed()?-e:e));if(a._dirty){for(r=a.parent;o;)t=o._prev,o._dirty&&o.totalDuration(),(n=o._start)>s&&a._sort&&o._ts&&!a._lock?(a._lock=1,k(a,o,n-o._delay,1)._lock=0):s=n,n<0&&o._ts&&(i-=n,(!r&&!a._dp||r&&r.smoothChildTiming)&&(a._start+=n/a._ts,a._time-=n,a._tTime-=n),a.shiftChildren(-n,!1,-1/0),s=0),o._end>i&&o._ts&&(i=o._end),o=t;N(a,a===le&&a._time>i?a._time:i,1,1),a._dirty=0}return a._tDur}}],[{key:"updateRoot",value:function(e){if(le._ts&&(M(le,R(e,le)),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}()),sn=(gt(on.prototype,{_lock:0,_hasPause:0,_forcing:0}),function(e,t,n,r,i,a,o){var s,l,u,c,h,d=new xn(this._pt,e,t,0,1,Qt,null,i),f=0,p=0;for(d.b=n,d.e=r,n+="",(i=~(r+="").indexOf("random("))&&(r=Pt(r)),a&&(a(a=[n,r],e,t),n=a[0],r=a[1]),s=n.match(qe)||[];c=qe.exec(r);)u=c[0],c=r.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<r.length?r.substring(f,r.length):"",d.fp=o,($e.test(r)||i)&&(d.e=0),this._pt=d}),ln=function(e,t,n,r,i,a,o,s,l){var u;if(ze(r)&&(r=r(i||0,e,a)),i=e[t],a="get"!==n?n:ze(i)?l?e[t.indexOf("set")||!ze(e["get"+t.substr(3)])?t:"get"+t.substr(3)](l):e[t]():i,n=ze(i)?l?mn:pn:fn,He(r)&&"="===(r=~r.indexOf("random(")?Pt(r):r).charAt(1)&&(!(u=parseFloat(a)+parseFloat(r.substr(2))*("-"===r.charAt(0)?-1:1)+(Bt(a)||0))&&0!==u||(r=u)),a!==r)return isNaN(a*r)||""===r?(i||t in e||it(t,r),sn.call(this,e,t,a,r,n,s||Oe.stringFilter,l)):(u=new xn(this._pt,e,t,+a||0,r-(a||0),"boolean"==typeof i?yn:gn,0,n),l&&(u.fp=l),o&&u.modifier(o,this,e),this._pt=u)},un=function(e,t,n,r,i,a){var o,s,l,u;if(lt[e]&&!1!==(o=new lt[e]).init(i,o.rawVars?t[e]:function(e,t,n,r,i){if(ze(e)&&(e=Zt(e,i,t,n,r)),!Je(e)||e.style&&e.nodeType||Ze(e)||Ke(e))return He(e)?Zt(e,i,t,n,r):e;var a,o={};for(a in e)o[a]=Zt(e[a],i,t,n,r);return o}(t[e],r,i,a,n),n,r,a)&&(n._pt=s=new xn(n._pt,i,e,0,1,o.render,o,0,o.priority),n!==pe))for(l=n._ptLookup[n._targets.indexOf(i)],u=o._props.length;u--;)l[o._props[u]]=s;return o},cn=dt+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase",hn={},dn=(S(cn+",id,stagger,delay,duration,paused,scrollTrigger",(function(e){return hn[e]=1})),function(){i(t,an);var e=o(t);function t(n,r,i,a){h(this,t),"number"==typeof r&&(i.duration=r,r=i,i=null);var o,l,u,c,d,f,p,m,v,y=(a=(o=e.call(this,a?r:T(r))).vars).duration,x=a.delay,w=a.immediateRender,A=a.stagger,S=a.overwrite,M=a.keyframes,_=a.defaults,B=a.scrollTrigger,E=a.yoyoEase,P=(a=r.parent||le,(Ze(n)||Ke(n)?Ve(n[0]):"length"in r)?[n]:Tt(n));if(o._targets=P.length?ft(P):b("GSAP target "+n+" not found. https://greensock.com",!Oe.nullTargetWarn)||[],o._ptLookup=[],o._overwrite=S,M||A||g(y)||g(x)){if(r=o.vars,(l=o.timeline=new on({data:"nested",defaults:_||{}})).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)~cn.indexOf(f)&&((v=v||{})[f]=A[f]);for(u=0;u<d;u++)(c=yt(r,hn)).stagger=0,E&&(c.yoyoEase=E),v&&C(c,v),p=P[u],c.duration=+Zt(y,s(o),u,p,P),c.delay=(+Zt(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=Nt.none;l.duration()?y=x=0:o.timeline=0}else if(M){T(gt(l.vars.defaults,{ease:"none"})),l._ease=Vt(M.ease||r.ease||"none");var O,R,I,F=0;if(Ze(M))M.forEach((function(e){return l.to(P,e,">")}));else{for(f in c={},M)"ease"!==f&&"easeEach"!==f&&function(e,t,n,r){var i,a,o=t.ease||r||"power1.inOut";if(Ze(t))a=n[e]||(n[e]=[]),t.forEach((function(e,n){return a.push({t:n/(t.length-1)*100,v:e,e:o})}));else for(i in t)a=n[i]||(n[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++)(I={ease:(R=O[u]).e,duration:(R.t-(u?O[u-1].t:0))/100*y})[f]=R.v,l.to(P,I,F),F+=I.duration;l.duration()<y&&l.to({},{duration:y-l.duration()})}}y||o.duration(y=l.duration())}else o.timeline=0;return!0!==S||se||(nn=s(o),le.killTweensOf(P),nn=0),k(a,s(o),i),r.reversed&&o.reverse(),r.paused&&o.paused(!0),(w||!y&&!M&&o._start===mt(a._time)&&We(w)&&D(s(o))&&"nested"!==a.data)&&(o._tTime=-ke,o.render(Math.max(0,-x))),B&&L(s(o),B),o}return c(t,[{key:"render",value:function(e,t,n){var r,i,a=this._time,o=this._tDur,s=this._dur,l=o-ke<e&&0<=e?o:e<ke?0:e;if(s){if(l!==this._tTime||!e||n||!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,n);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&&!n&&this._initted)return this;g!==y&&(p&&this._yEase&&ne(p,f),!this.vars.repeatRefresh||f||this._lock||(this._lock=n=1,this.render(mt(h*g),!0).invalidate()._lock=0))}if(!this._initted){if(F(this,e<0?e:m,n,t))return this._tTime=0,this;if(s!==this._dur)return this.render(e,t,n)}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(r=this._pt;r;)r.r(i,r.d),r=r._next;p&&p.render(e<0?e:!m&&f?-ke:p._dur*p._ease(m/this._dur),t,n)||this._startAt&&(this._zTime=e),this._onUpdate&&!t&&(e<0&&this._startAt&&this._startAt.render(e,!0,n),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=n,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===ke||!d&&h._zTime){if(h._initted||!F(h,d,p,f)){for(c=h._zTime,h._zTime=d||(f?ke: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(),r(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,nn&&!0!==nn.vars.overwrite)._first||$(this),this.parent&&d!==this.timeline.totalDuration()&&N(this,this._dur*this.timeline._tDur/d,0,1),this;var n,r,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 n=e.length,r=n===t.length;r&&n--&&e[n]===t[n];);return n<0}(u,c))return"all"===t&&(this._pt=0),$(this);for(n=this._op=this._op||[],"all"!==t&&(He(t)&&(o={},S(t,(function(e){return o[e]=1})),t=o),t=function(e,t){var n,r,i,a,o=(e=e[0]?pt(e[0]).harness:0)&&e.aliases;if(!o)return t;for(r in n=C({},t),o)if(r in n)for(i=(a=o[r].split(",")).length;i--;)n[a[i]]=n[r];return n}(u,t)),l=u.length;l--;)if(~c.indexOf(u[l]))for(o in r=h[l],"all"===t?(n[l]=t,a=r,i={}):(i=n[l]=n[l]||{},a=t),a)(s=r&&r[o])&&("kill"in s.d&&!0!==s.d.kill(o)||bt(this,s,"_pt"),delete r[o]),"all"!==i&&(i[o]=1);return this._initted&&!this._pt&&d&&$(this),this}}],[{key:"to",value:function(e,n){return new t(e,n,arguments[2])}},{key:"from",value:function(e,t){return z(1,arguments)}},{key:"delayedCall",value:function(e,n,r,i){return new t(n,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:e,onComplete:n,onReverseComplete:n,onCompleteParams:r,onReverseCompleteParams:r,callbackScope:i})}},{key:"fromTo",value:function(e,t,n){return z(2,arguments)}},{key:"set",value:function(e,n){return n.duration=0,n.repeatDelay||(n.repeat=0),new t(e,n)}},{key:"killTweensOf",value:function(e,t,n){return le.killTweensOf(e,t,n)}}]),t}()),fn=(gt(dn.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),S("staggerTo,staggerFrom,staggerFromTo",(function(e){dn[e]=function(){var t=new on,n=Ct.call(arguments,0);return n.splice("staggerFromTo"===e?5:4,0,0),t[e].apply(t,n)}})),function(e,t,n){return e[t]=n}),pn=function(e,t,n){return e[t](n)},mn=function(e,t,n,r){return e[t](r.fp,n)},vn=function(e,t){return ze(e[t])?pn:m(e[t])&&e.setAttribute?Xt:fn},gn=function(e,t){return t.set(t.t,t.p,Math.round(1e6*(t.s+t.c*e))/1e6,t)},yn=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},bn=function(e){for(var t,n,r,i,a=e._pt;a;){for(t=a._next,n=r;n&&n.pr>a.pr;)n=n._next;(a._prev=n?n._prev:i)?a._prev._next=a:r=a,(a._next=n)?n._prev=a:i=a,a=t}e._pt=r},xn=function(){function e(t,n,r,i,a,o,s,l,u){h(this,e),this.t=n,this.s=i,this.c=a,this.p=r,this.r=o||gn,this.d=s||this,this.set=l||fn,this.pr=u||0,(this._next=t)&&(t._prev=this)}return c(e,[{key:"modifier",value:function(e,t,n){this.mSet=this.mSet||this.set,this.set=en,this.m=e,this.mt=n,this.tween=t}}]),e}(),wn=(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})),nt.TweenMax=nt.TweenLite=dn,nt.TimelineLite=nt.TimelineMax=on,le=new on({sortChildren:!1,defaults:Re,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Oe.stringFilter=function(e){var t=e.join(" ");if(Lt.lastIndex=0,Lt.test(t))return t=Ft.test(t),e[1]=te(e[1],t),e[0]=te(e[0],t,kt(e[1])),!0},{registerPlugin:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.forEach((function(e){var t=(e=!e.name&&e.default||e).name,n=ze(e),r=(n=t&&!n&&e.init?function(){this._props=[]}:e,{init:w,render:Yt,add:ln,kill:$t,modifier:qt,rawVars:0}),i={targetTest:0,get:0,getSetter:vn,aliases:{},register:0};if(Gt(),e!==n){if(lt[t])return;gt(n,gt(yt(e,r),i)),C(n.prototype,C(r,yt(e,i))),lt[n.prop=t]=n,e.targetTest&&(ht.push(n),at[t]=1),t=("css"===t?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}x(t,n),e.register&&e.register(Sn,n,xn)}))},timeline:function(e){return new on(e)},getTweensOf:function(e,t){return le.getTweensOf(e,t)},getProperty:function(e,t,n,r){He(e)&&(e=Tt(e)[0]);var i=pt(e||{}).get,a=n?B:_;return"native"===n&&(n=""),e&&(t?a((lt[t]&<[t].get||i)(e,t,n,r)):function(t,n,r){return a((lt[t]&<[t].get||i)(e,t,n,r))})},quickSetter:function(e,t,n){var r,i;if(1<(e=Tt(e)).length)return r=e.map((function(e){return Sn.quickSetter(e,t,n)})),i=r.length,function(e){for(var t=i;t--;)r[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 r=new a;pe._pt=0,r.init(e,n?t+n:t,pe,0,[e]),r.render(1,r),pe._pt&&Yt(1,pe)}:o.set(e,s);return a?l:function(t){return l(e,s,n?t+n:t,o,1)}},isTweening:function(e){return 0<le.getTweensOf(e,!0).length},defaults:function(e){return e&&e.ease&&(e.ease=Vt(e.ease,Re.ease)),E(Re,e||{})},config:function(e){return E(Oe,e||{})},registerEffect:function(e){var t=e.name,n=e.effect,r=e.plugins,i=e.defaults;e=e.extendTimeline,(r||"").split(",").forEach((function(e){return e&&!lt[e]&&!nt[e]&&b(t+" effect requires "+e+" plugin.")})),ut[t]=function(e,t,r){return n(Tt(e),gt(t||{},i),r)},e&&(on.prototype[t]=function(e,n,r){return this.add(ut[t](e,Je(n)?n:(r=n)&&{},this),r)})},registerEase:function(e,t){Nt[e]=Vt(t)},parseEase:function(e,t){return arguments.length?Vt(e,t):Nt},getById:function(e){return le.getById(e)},exportRoot:function(){var e,t,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},r=1<arguments.length?arguments[1]:void 0,i=new on(n);for(i.smoothChildTiming=We(n.smoothChildTiming),le.remove(i),i._dp=0,i._time=i._tTime=le._time,e=le._first;e;)t=e._next,!r&&!e._dur&&e instanceof dn&&e.vars.onComplete===e._targets[0]||k(i,e,e._start-e._delay),e=t;return k(le,i,0),i},utils:{wrap:function e(t,n,r){var i=n-t;return Ze(t)?X(t,e(0,t.length),n):_t(r,(function(e){return(i+(e-t)%i)%i+t}))},wrapYoyo:function e(t,n,r){var i=n-t,a=2*i;return Ze(t)?X(t,e(0,t.length-1),n):_t(r,(function(e){return t+(i<(e=(a+(e-t)%a)%a||0)?a-e:e)}))},distribute:J,random:Z,snap:K,normalize:function(e,t,n){return Q(e,t,0,1,n)},getUnit:Bt,clamp:function(e,t,n){return _t(n,(function(n){return V(e,t,n)}))},splitColor:It,toArray:Tt,selector:function(e){return e=Tt(e)[0]||b("Invalid scope")||{},function(t){var n=e.current||e.nativeElement||e;return Tt(t,n.querySelectorAll?n:n===e?b("Invalid scope")||he.createElement("div"):e)}},mapRange:Q,pipe:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return t.reduce((function(e,t){return t(e)}),e)}},unitize:function(e,t){return function(n){return e(parseFloat(n))+(t||Bt(n))}},interpolate:function e(t,n,r,i){var a=isNaN(t+n)?0:function(e){return(1-e)*t+e*n};if(!a){var o,s,l,u,c,h=He(t),d={};if(!0===r&&(i=1)&&(r=null),h)t={p:t},n={p:n};else if(Ze(t)&&!Ze(n)){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)},r=n}else i||(t=C(Ze(t)?[]:{},t));if(!l){for(o in n)ln.call(d,t,o,"get",n[o]);a=function(e){return Yt(e,d),h?t.p:t}}}return _t(r,a)},shuffle:Dt},install:y,effects:ut,ticker:Ut,updateRoot:on.updateRoot,plugins:lt,globalTimeline:le,core:{PropTween:xn,globals:x,Tween:dn,Timeline:on,Animation:an,getCache:pt,_removeLinkedListItem:bt,suppressOverwrites:function(e){return se=e}}}),An=(S("to,from,fromTo,delayedCall,set,killTweensOf",(function(e){return wn[e]=dn[e]})),Ut.add(on.updateRoot),pe=wn.to({},{duration:0}),function(e,t){for(var n=e._pt;n&&n.p!==t&&n.op!==t&&n.fp!==t;)n=n._next;return n}),Sn=wn.registerPlugin({name:"attr",init:function(e,t,n,r,i){var a,o;for(a in t)(o=this.add(e,"setAttribute",(e.getAttribute(a)||0)+"",t[a],r,i,0,0,a))&&(o.op=a),this._props.push(a)}},{name:"endArray",init:function(e,t){for(var n=t.length;n--;)this.add(e,n,e[n]||0,t[n])}},tn("roundProps",W),tn("modifiers"),tn("snap",K))||wn;dn.version=on.version=Sn.version="3.9.1",de=1,v()&&Gt(),Nt.Power0,Nt.Power1,Nt.Power2,Nt.Power3,Nt.Power4,Nt.Linear,Nt.Quad,Nt.Cubic,Nt.Quart,Nt.Quint,Nt.Strong,Nt.Elastic,Nt.Back,Nt.SteppedEase,Nt.Bounce,Nt.Sine,Nt.Expo,Nt.Circ},4547:function(e,t,n){"use strict";var r=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,r(n(3300)));t.base64ToFile=function(e,t){for(var n=(e=e.split(","))[0].match(/:(.*?);/)[1],r=atob(e[1]),i=r.length,a=new Uint8Array(i);i--;)a[i]=r.charCodeAt(i);return new File([a],t,{type:n})},t.bufferToArrayBuffer=function(e){for(var t=new ArrayBuffer(e.length),n=new Uint8Array(t),r=0;r<e.length;++r)n[r]=e[r];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="",n=0;n<e.length;n++)""===t?t=e.charCodeAt(n).toString(16):t+=","+e.charCodeAt(n).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 n=new Blob([e]),r=new FileReader;r.readAsText(n,"utf-8"),r.onload=function(){t(r.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",n=new FileReader;return"text"===t?n.readAsText(e):"arrayBuffer"===t?n.readAsArrayBuffer(e):"base64"===t&&n.readAsDataURL(e),new Promise((function(e){n.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",n=document.createElement("a");e instanceof File||e instanceof Blob?n.setAttribute("href",window.URL.createObjectURL(e)):n.setAttribute("href",e),n.setAttribute("download",t),document.body.insertAdjacentElement("beforeend",n),n.click(),n.remove()}},9716:function(e,t,n){"use strict";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 i(){i=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,a=(m="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",o=m.asyncIterator||"@@asyncIterator",s=m.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(t){l=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var i,a,o,s;return t=t&&t.prototype instanceof d?t:d,t=Object.create(t.prototype),r=new A(r||[]),t._invoke=(i=e,a=n,o=r,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 n=o.delegate;if(n&&(n=function e(t,n){var r=t.iterator[n.method];if(void 0===r){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=void 0,e(t,n),"throw"===n.method))return h;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}return"throw"===(r=c(r,t.iterator,n.arg)).type?(n.method="throw",n.arg=r.arg,n.delegate=null,h):(r=r.arg)?r.done?(n[t.resultName]=r.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,h):r:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}(n,o),n)){if(n===h)continue;return n}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"===(n=c(i,a,o)).type){if(s=o.done?"completed":"suspendedYield",n.arg===h)continue;return{value:n.arg,done:o.done}}"throw"===n.type&&(s="completed",o.method="throw",o.arg=n.arg)}}),t}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}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&&n.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"==r(o)&&n.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,r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(r=function r(){for(;++t<e.length;)if(n.call(e,t))return r.value=e[t],r.done=!1,r;return r.value=void 0,r.done=!0,r}).next=r}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,n,r,i,a){void 0===a&&(a=Promise);var o=new b(u(t,n,r,i),a);return e.isGeneratorFunction(n)?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,n=[];for(t in e)n.push(t);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,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)&&n.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 r(n,r){return o.type="throw",o.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;0<=i;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;0<=r;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.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 n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),w(n),h}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var n,r,i=this.tryEntries[t];if(i.tryLoc===e)return"throw"===(n=i.completion).type&&(r=n.arg,w(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:S(e),resultName:t,nextLoc:n},"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 n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?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 n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var s=this&&this.__awaiter||function(e,t,n,r){return new(n=n||Promise)((function(i,a){function o(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(o,s)}l((r=r.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,n(6569));function u(e,t,n,r){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",n());case 3:if((s=o())instanceof Promise)return i.next=7,s;i.next=11;break;case 7:l=i.sent,null!=r&&r.eachCb(l,t),i.next=18;break;case 11:if(s.promise&&s.promise instanceof Promise)return null!=r&&r.eachCb(s,t),i.next=15,s.promise;i.next=17;break;case 15:i.next=18;break;case 17:null!=r&&r.eachCb(s,t);case 18:u(e,t,n,r);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 n=e.slice(0,t);return e=e.slice(t+1),[].concat(a(n),a(e))},t.emptyArray=function(e){return 0===e.length},t.eachTriggerArrGetControls=function(e){var n=new Proxy({run:!0,clean:!1,target:e,index:0,runningAnima:null,eachCb:function(e,t){e.anima&&(n.runningAnima=e.anima),n.index=t}},{set:function(e,t,r){return"clean"===t&&!0===r&&!1===e[t]&&(n.run=!1,n.target.splice(0)),"run"===t&&!1===r&&!0===e[t]&&(console.log(n,"controls"),n.runningAnima&&n.runningAnima.pause()),"run"===t&&!0===r&&!1===e[t]&&n.runningAnima&&n.runningAnima.resume(),e[t]=r,!0}});return e=(0,t.eachTriggerArray)(e,n),{controls:n,promise:e}},t.eachTriggerArray=function(e,t){return new Promise((function(n){return u(e,0,n,t)}))},t.multiArrToArr=function(e){var t=[];return c(e,t),t},t.map=function(e,t){return e.map((function(n,r){return t(n,r,e)})).filter((function(e){return e}))},t.deepArrByMaps=function(e){var n=e.arr,r=e.typeList,i=e.findType;if(e=e.mapType,!n||!r||!i)return n;var o=a(r),s=n.find((function(e){return e[i]===r[0]}));return s?1!==r.length&&s[e]instanceof Array?(o.shift(),(0,t.deepArrByMaps)({arr:s[e],typeList:o,findType:i,mapType:e})):s:n}},7267:(e,t)=>{"use strict";t.d=void 0,t.d=function(e,t){var n=null;return function(){null!==n&&clearTimeout(n),n=setTimeout((function(){e()}),t)}}},2081:(e,t,n)=>{"use strict";t.qR=t.js=t.CV=void 0,n(6569),t.CV=function(e){return 0===Object.values(e).length},t.js=function(e,t){return Object.keys(e).map((function(n,r){var i=e[n];return t(n,i,r)}))},t.qR=function(e,t){var n=-1;return function e(r){return n++,t.length===n+1?r:e(r[t[n]])}(e)}},9728:function(e,t,n){"use strict";var r=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,r(n(7937))),a=r(n(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,n){for(var r=(2<<Math.log(t.length-1)/Math.LN2)-1,i=-~(1.6*r*n/t.length),a="";;)for(var o=e(i),s=i;s--;)if((a+=t[o[s]&r]||"").length===+n)return a}},2801:(e,t,n)=>{"use strict";e.exports=n(6104)},6330:(e,t,n)=>{"use strict";var r,i,a,o=n(3445),s="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";function l(){a=!1}function u(e){if(e){if(e!==r){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,n){return t!==n.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(", "));r=e,l()}}else r!==s&&(r=s,l())}function c(){return a=a||function(){r||u(s);var e,t=r.split(""),n=[];for(o.nextValue();0<t.length;)e=o.nextValue(),e=Math.floor(e*t.length),n.push(t.splice(e,1)[0]);return n.join("")}()}e.exports={get:function(){return r||s},characters:function(e){return u(e),r},seed:function(e){o.seed(e),i!==e&&(l(),i=e)},lookup:function(e){return c()[e]},shuffled:c}},9133:(e,t,n)=>{"use strict";var r,i,a=n(5239);n(6330),e.exports=function(e){var t="",n=Math.floor(.001*(Date.now()-1567752802062));return n===i?r++:(r=0,i=n),t=(t+=a(7))+a(e),0<r&&(t+=a(r)),t+a(n)}},5239:(e,t,n)=>{"use strict";var r=n(6330),i=n(6339),a=n(4403);e.exports=function(e){for(var t,n=0,o="";!t;)o+=a(i,r.get(),1),t=e<Math.pow(16,n+1),n++;return o}},6104:(e,t,n)=>{"use strict";var r=n(6330),i=n(9133),a=n(6932),o=n(517)||0;function s(){return i(o)}e.exports=s,e.exports.generate=s,e.exports.seed=function(t){return r.seed(t),e.exports},e.exports.worker=function(t){return o=t,e.exports},e.exports.characters=function(e){return void 0!==e&&r.characters(e),r.shuffled()},e.exports.isValid=a},6932:(e,t,n)=>{"use strict";var r=n(6330);e.exports=function(e){return!(!e||"string"!=typeof e||e.length<6||new RegExp("[^"+r.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 n="object"===("undefined"==typeof window?"undefined":t(window))&&(window.crypto||window.msCrypto),r=n&&n.getRandomValues?function(e){return n.getRandomValues(new Uint8Array(e))}:function(e){for(var t=[],n=0;n<e;n++)t.push(Math.floor(256*Math.random()));return t};e.exports=r},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,n)=>{"use strict";n.d(t,{N:()=>a,Z:()=>i});var r=n(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 n,r;this.backgroudDom||(this.backgroudDom=document.createElement("div"),({width:n,height:r}=this.runScene.renderEx.getDomSize()),this.backgroudDom.style.position="absolute",this.backgroudDom.style.width=n+"px",this.backgroudDom.style.height=r+"px",t.appendChild(this.backgroudDom)),e?(this.backgroudDom.style.display="block",this.backgroudDom.style.backgroundImage="url("+e+")",this.backgroudDom.style.backgroundRepeat="no-repeat",this.backgroudDom.style.backgroundSize="100% 100%"):this.backgroudDom.style.display="none"}create(){return new r.PerspectiveCamera}createOrthographic(){return new r.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 n=this.getCamera();n.aspect=e/t,n.updateProjectionMatrix()}}const a=e=>null==e?void 0:e.isCamera},1643:(e,t,n)=>{"use strict";n.d(t,{sG:()=>r,zX:()=>i});const r=["map","normalMap","aoMap"],i=["map","metalnessMap","roughnessMap","normalMap","aoMap","emissiveMap","alphaMap","lightMap","envMap","displacementMap"]},4513:(e,t,n)=>{"use strict";n.d(t,{F6:()=>r,YD:()=>i});var r={},i=(n.r(r),n.d(r,{filter:()=>a,isDef:()=>u,isEmpty:()=>o,notEmpty:()=>s,random:()=>l}),{});n.r(i),n.d(i,{is:()=>h,isDef:()=>c});const a=e=>e.filter((e=>e)),o=e=>0===e.length,s=e=>0!==e.length,l=e=>{var t=Math.random()*e.length;return e[Math.floor(t)]},u=(e,t)=>{for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!0;return!1};n(5259),n(2016);const c=(e,t)=>{if(!h(e)||!h(t))return!0;var n=Object.keys(e);for(let a=0;a<n.length;a++){var r=n[a],i=e[r];if(r=t[r],h(i))return!h(r)||c(i,r);if(i!==r)return!0}return!1},h=e=>(null==e?void 0:e.constructor)===Object},5259:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(2081);class i extends Map{constructor(e){e?super((0,r.js)(e,((e,t)=>[e,t]))):super()}toArray(e){let t=[];for(const n of this.entries())"key"==e?t.push(n[0]):t.push(n[1]);return t}map(e){return[...this.entries()].map((t=>{var[t,n]=t;return e(t,n)}))}toJSON(){const e={};return this.forEach(((t,n)=>{e[t]=n})),e}filter(e,t){let n=[];for(var[r,i]of this.entries())e(r,i)&&n.push("key"===t?r:i);return n}find(e){for(var[t,n]of this.entries())if(e(t,n))return n}static formJSON(e){return new i(e)}copy(e){e.map(((e,t)=>this.set(e,t)))}}},2016:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});class r 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 n=[];return this.forEach((r=>{if(r=e(r),!t)return n.push(r);r&&n.push(r)})),n}find(e){for(const t of this)if(e(t))return t}filter(e){const t=[];for(const n of this)e(n)&&t.push(n);return t}}},6999:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});const r=t=n(8881)},2959:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});class r{constructor(e){this.runScene=e}}},7042:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(6999);class i extends n(2959).Z{get(){throw new Error("Method not implemented.")}static toJSON(e){const{intensity:t,name:n,type:r,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:r,intensity:t,name:n,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){t=this.runScene.lightEx.get("DirectionalLight",t);var[n]=t;return i.setConfig(n,e),t}static setConfig(e,t){const{intensity:n,position:i,rotation:a,targetPosition:o,name:s,visible:l,color:u,castShadow:c,shadow:h}=t;var{mapSize:t,camera:d}=h,{scale:d,near:f,far:p}=d;e.intensity=n,e.name=s,e.visible=l,e.castShadow=c,e.color=new r.Z.Color(u.includes(u)?u:"#"+u),i&&e.position.set(i.x,i.y,i.z),a&&e.rotation.set(a.x,a.y,a.z),o&&e.target.position.set(o.x,o.y,o.z),e.add(e.target),e.shadow.mapSize.x=t,e.shadow.mapSize.y=t,e.shadow.camera.scale.x=d,e.shadow.camera.scale.y=d,e.shadow.camera.scale.z=d,e.shadow.camera.near=f,e.shadow.camera.far=p,e.shadow.camera.updateProjectionMatrix(),null!=(t=e.cameraHelper)&&t.update()}}},3352:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>M,RQ:()=>_});var r=n(9728),i=n(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 n,r=l(e);if(n=t?(n=l(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===a(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;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=r;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 n=s(r);function r(e,t){if(!(this instanceof r))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=n.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=r,(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 n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),r}(i.Line),c=n(6999);t=n(2959);class h extends t.Z{get(){}static toJSON(e){const{type:t,intensity:n,name:r,visible:i,color:a}=e;return{type:t,intensity:n,name:r,visible:i,color:a.getHexString()}}parseJSON(e){var t=this.runScene.lightEx.get("AmbientLight");const[n]=t;var{type:e,intensity:r,name:i,visible:a,color:o}=e;return n.intensity=r,n.type=e,n.name=i,n.visible=a,n.color=new c.Z.Color("#"+o),t}}var d=n(7042);class f extends t.Z{get(){throw new Error("Method not implemented.")}static toJSON(e){const{type:t,intensity:n,name:r,visible:i,color:a,groundColor:o,position:s}=e;return{name:r,type:t,intensity:n,visible:i,position:{x:s.x,y:s.y,z:s.z},groundColor:o.getHexString(),color:a.getHexString()}}parseJSON(e){var t=this.runScene.lightEx.get("HemisphereLight");const[n]=t;var{type:e,intensity:r,name:i,visible:a,color:o,groundColor:s,position:l}=e;return n.type=e,n.intensity=r,n.name=i,n.visible=a,n.color=new c.Z.Color("#"+o),n.groundColor=new c.Z.Color("#"+s),n.position.set(l.x,l.y,l.z),t}}class p extends t.Z{get(){throw new Error("Method not implemented.")}static toJSON(e){const{name:t,type:n,intensity:r,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:n,intensity:r,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){var t=this.runScene.lightEx.get("PointLight");const[n]=t;var{name:e,type:r,intensity:i,distance:a,decay:o,renderOrder:s,color:l,visible:u,castShadow:h,shadow:d,position:f}=e,{mapSize:d,camera:p,bias:m,radius:v}=d,{scale:p,near:g,far:y}=p;return n.intensity=i,n.type=r,n.name=e,n.visible=u,n.castShadow=h,n.distance=a,n.renderOrder=s,n.color=new c.Z.Color("#"+l),n.position.set(f.x,f.y,f.z),n.shadow.mapSize.x=d,n.shadow.mapSize.y=d,n.shadow.bias=m,n.decay=o,n.shadow.radius=v,n.shadow.camera.scale.x=p,n.shadow.camera.scale.y=p,n.shadow.camera.scale.z=p,n.shadow.camera.near=g,n.shadow.camera.far=y,n.shadow.camera.updateProjectionMatrix(),t}}class m{constructor(e){this.runScene=e}static toJSON(e){const{type:t,intensity:n,name:r,visible:i,color:a,position:o}=e;return{name:r,type:t,intensity:n,visible:i,position:{x:o.x,y:o.y,z:o.z},color:a.getHexString()}}parseJSON(e){var t=this.runScene.lightEx.get("RectAreaLight");const[n]=t;var{type:e,intensity:r,name:i,visible:a,color:o,position:s}=e;return n.type=e,n.intensity=r,n.name=i,n.visible=a,n.color=new c.Z.Color("#"+o),n.position.set(s.x,s.y,s.z),t}}class v{constructor(e){this.runScene=e}static toJSON(e){const{name:t,type:n,color:r,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:n,intensity:o,name:t,visible:u,distance:i,angle:s,decay:a,penumbra:l,renderOrder:d,color:r.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){var t=this.runScene.lightEx.get("SpotLight");const[n]=t;var{name:e,type:r,color:i,distance:a,decay:o,intensity:s,angle:l,penumbra:u,visible:h,castShadow:d,shadow:f,renderOrder:p,position:m,targetPosition:v}=e,{bias:f,camera:g,normalBias:y,mapSize:b,radius:x}=f,g=g.near;return n.intensity=s,n.type=r,n.name=e,n.visible=h,n.distance=a,n.decay=o,n.angle=l,n.penumbra=u,n.renderOrder=p,n.castShadow=d,n.color=new c.Z.Color("#"+i),n.position.set(m.x,m.y,m.z),n.shadow.mapSize.x=b,n.shadow.mapSize.y=b,n.shadow.camera.near=g,n.target.position.set(v.x,v.y,v.z),n.shadow.bias=f,n.shadow.normalBias=y,n.shadow.radius=x,n.shadow.camera.updateProjectionMatrix(),t}}var g=n(8366),y=n(9593),b=n(5860),x=n(986),w=n(5244),A=n(5613);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))}add(e,t){e=e.map((e=>this.runScene.modelEx.add(e,void 0,Object.assign(Object.assign({},t),{select:!!_(e)&&t.select,addUndo:!1})))),t.addUndo&&this.runScene.undoEx.addUndo(e)}get(e,t){t=(0,A.mergeObject)({id:(0,r.getId)()},t).id;let n=new c.Z[e],i=[n];return n.position.y=10,n.name=e,n.userData.id=t,this.shadowList.includes(e)&&(n.castShadow=!0),this.setLight(n),i.push(...this.setLightHelper(n)),null!=(t=null==n?void 0:n.lightHelper)&&t.update(),i}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?(null!=(t=e.helper)&&t.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 n;return this.runScene.helperEx.unfocus(),n="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&&n&&this.runScene.undoEx.addUndo(n),n}getLightHelper(e,t){this.runScene.uniqueEx.model.add(t);const n=(0,w.K)(t);let r,i=[];switch(e){case"RectAreaLight":r=new u(t,16773120);break;case"DirectionalLight":if(r=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=n,e.userData.unClick=!0})),e.userData.id=n,e.userData.unClick=!0,e.visible=!1,t.cameraHelper=e,i.push(e);break;case"PointLight":r=new c.Z.PointLightHelper(t,1,16711935);break;case"SpotLight":r=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=n})),o.userData.id=n,o.visible=!1,t.cameraHelper=o,i.push(o);break;case"HemisphereLight":r=new c.Z.HemisphereLightHelper(t,1,16773135)}return r.name="helperModel",this.runScene.helperEx.setHelper(r,!0,(e=>{e.userData.id=n})),r.userData.id=n,(r.light=t).helper=r,this.update(t),i.push(r),i}setLightHelper(e){return"editor"===this.runScene.optionsEx.options.mode&&this.helperList.includes(e.type)?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:n,val:r,cb:i}=e;return new b.Z({target:e,runScene:this.runScene,info:n,oldVal:e[n],newVal:r,cb:i}).execute()}setMultip(e,t,n=!0,r=!0){if(e instanceof Array)return i=e.map((e=>{var{model:e,typeList:r,newVal:i}=e;const a=new y.Z({target:e,typeList:r,newVal:i,cb:t});return n?a.execute():a})),r&&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 r&&this.runScene.undoEx.addUndo(o),n?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.get(e.type)}static toJSON(e){return e.filter((e=>!(0,g.isHelper)(e))).map((e=>{var t=e.type;return S[t].toJSON(e)}))}}const _=e=>null==(e=null==e?void 0:e.userData)?void 0:e.isLight},9835:(e,t,n)=>{"use strict";n.d(t,{B:()=>Pe,Z:()=>De});var r=n(8881),i=(t=n(3300),n.n(t));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)}n(2081);var o=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":a(WebAssembly)))return{supported:!1};var n,r="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,r,i,a,o){var s=n.exports.sbrk,l=r+3&-4,u=s(l*i),c=s(a.length),h=new Uint8Array(n.exports.memory.buffer);if(0==(h.set(a,c),e=e(u,r,i,c,a.length))&&o&&o(u,l,i),t.set(h.subarray(u,u+r*i)),s(u-s(0)),0!=e)throw new Error("Malformed buffer data: "+e)}WebAssembly.validate(e)&&(r="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 n=new Uint8Array(e.length),r=0;r<e.length;++r){var i=e.charCodeAt(r);n[r]=96<i?i-71:64<i?i-65:47<i?i+4:46<i?63:62}var a=0;for(r=0;r<e.length;++r)n[a++]=n[r]<60?t[n[r]]:64*(n[r]-60)+n[++r];return n.buffer.slice(0,a)}(r),{}).then((function(e){(n=e.instance).exports.__wasm_call_ctors()}));var o={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},s={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,r,a,s){i(n.exports.meshopt_decodeVertexBuffer,e,t,r,a,n.exports[o[s]])},decodeIndexBuffer:function(e,t,r,a){i(n.exports.meshopt_decodeIndexBuffer,e,t,r,a)},decodeIndexSequence:function(e,t,r,a){i(n.exports.meshopt_decodeIndexSequence,e,t,r,a)},decodeGltfBuffer:function(e,t,r,a,l,u){i(n.exports[s[l]],e,t,r,a,n.exports[o[u]])}}}();function s(e){return(s="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 l(e,t){return(l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function u(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 n,r=c(e);if(n=t?(n=c(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===s(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var h=new WeakMap,d=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&&l(t,e);var n=u(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 n={attributeIDs:a.defaultAttributeIDs,attributeTypes:a.defaultAttributeTypes,useUniqueIDs:!1};a.decodeGeometry(e,n).then(t).catch(i)}),n,i)}},{key:"decodeDracoFile",value:function(e,t,n,r){r={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!n},this.decodeGeometry(e,r).then(t)}},{key:"decodeGeometry",value:function(e,t){var n,r=this;for(n in t.attributeTypes){var i=t.attributeTypes[n];void 0!==i.BYTES_PER_ELEMENT&&(t.attributeTypes[n]=i.name)}var a,o=JSON.stringify(t);if(h.has(e)){if((l=h.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(n){return a=n,new Promise((function(n,r){a._callbacks[s]={resolve:n,reject:r},a.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))})).then((function(e){return r._createGeometry(e.geometry)})),l.catch((function(){return!0})).then((function(){a&&s&&r._releaseTask(a,s)})),h.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,n=this;return this.decoderPending||(t=[],(e="object"!==("undefined"==typeof WebAssembly?"undefined":s(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 r=t[0];e||(n.decoderConfig.wasmBinary=t[1]),t=function(){var e,t;onmessage=function(n){var r=n.data;switch(r.type){case"init":e=r.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var i=r.buffer,a=r.taskConfig;t.then((function(e){var t=new(e=e.draco).Decoder,n=new e.DecoderBuffer;n.Init(new Int8Array(i),i.byteLength);try{var o=function(e,t,n,r){var i,a=r.attributeIDs,o=r.attributeTypes,s=t.GetEncodedGeometryType(n);if(s===e.TRIANGULAR_MESH)i=new e.Mesh,g=t.DecodeBufferToMesh(n,i);else{if(s!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");i=new e.PointCloud,g=t.DecodeBufferToPointCloud(n,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(r.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=(n=e,g=t,b=4*(y=3*(s=i).num_faces()),x=n._malloc(b),g.GetTrianglesUInt32Array(s,b,x),g=new Uint32Array(n.HEAPF32.buffer,x,y).slice(),n._free(x),{array:g,itemSize:1})),e.destroy(i),w}(e,t,n,a),s=o.attributes.map((function(e){return e.array.buffer}));o.index&&s.push(o.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:o},s)}catch(e){console.error(e),self.postMessage({type:"error",id:r.id,error:e.message})}finally{e.destroy(n),e.destroy(t)}}))}}}.toString(),r=["/* draco decoder */",r,"","/* worker */",t.substring(t.indexOf("{")+1,t.lastIndexOf("}"))].join("\n"),n.workerSourceURL=URL.createObjectURL(new Blob([r]))}))),this.decoderPending}},{key:"_getWorker",value:function(e,t){var n=this;return this._initDecoder().then((function(){n.workerPool.length<n.workerLimit?((r=new Worker(n.workerSourceURL))._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:n.decoderConfig}),r.onmessage=function(e){var t=e.data;switch(t.type){case"decode":r._callbacks[t.id].resolve(t);break;case"error":r._callbacks[t.id].reject(t);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+t.type+'"')}},n.workerPool.push(r)):n.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));var r,i=n.workerPool[n.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 n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.Loader),f={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 p=new(function(e,t,n){return Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(t,n,r){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=n,this.onError=r,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,n=u.length;t<n;t+=2){var r=u[t],i=u[t+1];if(r.global&&(r.lastIndex=0),r.test(e))return i}return null}})));var m=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.manager=void 0!==t?t:p,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}var t,n;return t=e,(n=[{key:"load",value:function(){}},{key:"loadAsync",value:function(e,t){var n=this;return new Promise((function(r,i){n.load(e,r,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 n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();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){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function y(e,t){return(y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var x=function(){var e=r,t=m;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&&y(e,t);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=b(e);if(n=t?(n=b(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===v(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(r);function r(e){if(this instanceof r)return e=n.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=r,(t=[{key:"setOptions",value:function(e){return this.options=e,this}},{key:"load",value:function(e,t,n,r,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var a=this,o=f.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 n=(r=a.options).textureQuality,r=r.reverseTexture,o=i.notCompress,s=i.size,l=0===e.size?new ImageData(1,1):e;t(s&&1!==n?(s=(t=i.size).w,t=t.h,o=o?1:n,createImageBitmap(l,Object.assign(a.options,{imageOrientation:r?"none":"flipY",resizeHeight:t*o,resizeWidth:s*o}))):createImageBitmap(l,Object.assign(a.options,{imageOrientation:r?"none":"flipY"})))})),Promise.resolve(e)])})).then((function(n){n=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),2!==a.length);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e)||function(e,t){if(e){if("string"==typeof e)return g(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(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.")}()}(n);var r=n[0];n=n[1],f.add(e,r),t&&t(r,n),a.manager.itemEnd(e)})).catch((function(t){r&&r(t),a.manager.itemError(e),a.manager.itemEnd(e)})),a.manager.itemStart(e)}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),r}(),w=(x.prototype.isImageBitmapLoader=!0,n(5613));function A(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}}(e,t)||_(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 S(e,t){var n,r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_(e))||t&&e&&"number"==typeof e.length)return r&&(e=r),n=0,{s:t=function(){},n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},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(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){o=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(o)throw i}}}}function M(e){return function(e){if(Array.isArray(e))return B(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_(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 _(e,t){if(e){if("string"==typeof e)return B(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?B(e,t):void 0}}function B(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function C(e){return(C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function E(){return(E="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=L(e)););return e}(e,t);if(r)return(r=Object.getOwnPropertyDescriptor(r,t)).get?r.get.call(arguments.length<3?e:n):r.value}).apply(this,arguments)}function T(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function D(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function P(e,t,n){return t&&D(e.prototype,t),n&&D(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function O(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&&R(e,t)}function R(e,t){return(R=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function I(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 n,r=L(e);if(n=t?(n=L(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===C(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return k(r)}}function k(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)}var F=function(){O(t,r.Loader);var e=I(t);function t(n){return T(this,t),(n=e.call(this,n)).dracoLoader=null,n.ktx2Loader=null,n.meshoptDecoder=null,n.pluginCallbacks=[],n.register((function(e){return new H(e)})),n.register((function(e){return new Z(e)})),n.register((function(e){return new X(e)})),n.register((function(e){return new z(e)})),n.register((function(e){return new V(e)})),n.register((function(e){return new J(e)})),n.register((function(e){return new W(e)})),n.register((function(e){return new K(e)})),n.register((function(e){return new N(e)})),n.register((function(e){return new Q(e)})),n}return P(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(n){try{o.parse(n,s,(function(n){t(n),o.manager.itemEnd(e)}),a)}catch(n){a(n)}}),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))===Y){try{s[G.KHR_BINARY_GLTF]=new q(e)}catch(e){return void(i&&i(e))}o=s[G.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.core.beforeLoader(u)){var c=new ye(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 G.KHR_MATERIALS_UNLIT:s[p]=new j;break;case G.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:s[p]=new ne;break;case G.KHR_DRACO_MESH_COMPRESSION:s[p]=new $(u,this.dracoLoader);break;case G.KHR_TEXTURE_TRANSFORM:s[p]=new ee;break;case G.KHR_MESH_QUANTIZATION:s[p]=new re;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 n=this;return new Promise((function(r,i){n.parse(e,t,r,i)}))}}]),t}();function U(){var e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}var G={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"},N=function(){function e(t){T(this,e),this.parser=t,this.name=G.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return P(e,[{key:"_markDefs",value:function(){for(var e=this.parser,t=this.parser.json.nodes||[],n=0,r=t.length;n<r;n++){var i=t[n];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,n=this.parser,r=((e=n.json.nodes[e]).extensions&&e.extensions[this.name]||{}).light;return void 0===r?null:this._loadLight(r).then((function(e){return n._getNodeRef(t.cache,r,e)}))}}]),e}(),j=function(){function e(){T(this,e),this.name=G.KHR_MATERIALS_UNLIT}return P(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}(),H=function(){function e(t){T(this,e),this.parser=t,this.name=G.KHR_MATERIALS_CLEARCOAT}return P(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}(),z=function(){function e(t){T(this,e),this.parser=t,this.name=G.KHR_MATERIALS_SHEEN}return P(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}(),V=function(){function e(t){T(this,e),this.parser=t,this.name=G.KHR_MATERIALS_TRANSMISSION}return P(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 r=[];return void 0!==(e=e.extensions[this.name]).transmissionFactor&&(t.transmission=e.transmissionFactor),void 0!==e.transmissionTexture&&r.push(n.assignTexture(t,"transmissionMap",e.transmissionTexture)),Promise.all(r)}}]),e}(),J=function(){function e(t){T(this,e),this.parser=t,this.name=G.KHR_MATERIALS_VOLUME}return P(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}(),W=function(){function e(t){T(this,e),this.parser=t,this.name=G.KHR_MATERIALS_IOR}return P(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}(),K=function(){function e(t){T(this,e),this.parser=t,this.name=G.KHR_MATERIALS_SPECULAR}return P(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}(),Z=function(){function e(t){T(this,e),this.parser=t,this.name=G.KHR_TEXTURE_BASISU}return P(e,[{key:"loadTexture",value:function(e){var t=this.parser,n=t.json;if((r=n.textures[e]).extensions&&r.extensions[this.name]){var r=r.extensions[this.name],i=t.options.ktx2Loader;if(i)return t.loadTextureImage(e,r.source,i);if(n.extensionsRequired&&0<=n.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures")}return null}}]),e}(),X=function(){function e(t){T(this,e),this.parser=t,this.name=G.EXT_TEXTURE_WEBP,this.isSupported=null}return P(e,[{key:"loadTexture",value:function(e){var t=this.name,n=this.parser,r=n.json;if(!(i=r.textures[e]).extensions||!i.extensions[t])return null;var i=i.extensions[t],a=r.images[i.source],o=n.textureLoader;return a.uri&&null!==(i=n.options.manager.getHandler(a.uri))&&(o=i),this.detectSupport().then((function(i){if(i)return n.loadTextureImage(e,a,o);if(r.extensionsRequired&&0<=r.extensionsRequired.indexOf(t))throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.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}(),Q=function(){function e(t){T(this,e),this.name=G.EXT_MESHOPT_COMPRESSION,this.parser=t}return P(e,[{key:"loadBufferView",value:function(e){var t=this.parser.json;if((e=t.bufferViews[e]).extensions&&e.extensions[this.name]){var n=e.extensions[this.name],r=(e=this.parser.getDependency("buffer",n.buffer),this.parser.options.meshoptDecoder);if(r&&r.supported)return Promise.all([e,r.ready]).then((function(e){var t=n.byteOffset||0,i=n.byteLength||0,a=n.count,o=n.byteStride,s=new ArrayBuffer(a*o);return e=new Uint8Array(e[0],t,i),r.decodeGltfBuffer(new Uint8Array(s),a,o,e,n.mode,n.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}(),Y="glTF",q=P((function e(t){T(this,e),this.name=G.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!==Y)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.")})),$=function(){function e(t,n){if(T(this,e),!n)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=G.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=n,this.dracoLoader.preload()}return P(e,[{key:"decodePrimitive",value:function(e,t){var n,r,i=this.json,a=this.dracoLoader,o=e.extensions[this.name].bufferView,s=e.extensions[this.name].attributes,l={},u={},c={};for(n in s){var h=he[n]||n.toLowerCase();l[h]=s[n]}for(r in e.attributes){var d,f,p=he[r]||r.toLowerCase();void 0!==s[r]&&(d=i.accessors[e.attributes[r]],f=se[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 n in e.attributes){var r=e.attributes[n];void 0!==(n=u[n])&&(r.normalized=n)}t(e)}),l,c)}))}))}}]),e}(),ee=function(){function e(){T(this,e),this.name=G.KHR_TEXTURE_TRANSFORM}return P(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}(),te=function(){O(t,r.MeshStandardMaterial);var e=I(t);function t(n){T(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(k(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 P(t,[{key:"copy",value:function(e){return E(L(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(){T(this,e),this.name=G.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 P(e,[{key:"getMaterialType",value:function(){return te}},{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 te(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}(),re=P((function e(){T(this,e),this.name=G.KHR_MESH_QUANTIZATION})),ie=function(){O(t,r.Interpolant);var e=I(t);function t(n,r,i,a){return T(this,t),e.call(this,n,r,i,a)}return P(t,[{key:"copySampleValue_",value:function(e){for(var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r*3+r,a=0;a!==r;a++)t[a]=n[i+a];return t}}]),t}(),ae=(ie.prototype.beforeStart_=ie.prototype.copySampleValue_,ie.prototype.afterEnd_=ie.prototype.copySampleValue_,ie.prototype.interpolate_=function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=2*o,l=3*o,u=r-t,c=e*l,h=c-l,d=-2*(t=(n=(r=(n-t)/u)*r)*r)+3*n,f=t-n,p=1-d,m=f-n+r,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),oe=function(){O(t,ie);var e=I(t);function t(){return T(this,t),e.apply(this,arguments)}return P(t,[{key:"interpolate_",value:function(e,n,r,i){return e=E(L(t.prototype),"interpolate_",this).call(this,e,n,r,i),ae.fromArray(e).normalize().toArray(e),e}}]),t}(),se={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},le={9728:r.NearestFilter,9729:r.LinearFilter,9984:r.NearestMipmapNearestFilter,9985:r.LinearMipmapNearestFilter,9986:r.NearestMipmapLinearFilter,9987:r.LinearMipmapLinearFilter},ue={33071:r.ClampToEdgeWrapping,33648:r.MirroredRepeatWrapping,10497:r.RepeatWrapping},ce={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},he={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},de={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},fe={CUBICSPLINE:void 0,LINEAR:r.InterpolateLinear,STEP:r.InterpolateDiscrete};function pe(e,t,n){for(var r in n.extensions)void 0===e[r]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=n.extensions[r])}function me(e,t){void 0!==t.extras&&("object"===C(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function ve(e){for(var t="",n=Object.keys(e).sort(),r=0,i=n.length;r<i;r++)t+=n[r]+":"+e[n[r]]+";";return t}function ge(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 ye=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};T(this,e),this.json=t,this.extensions={},this.plugins={},this.options=n,this.cache=new U,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 x(this.options.manager):this.textureLoader=new r.TextureLoader(this.options.manager),this.options.myOptions.core.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 P(e,[{key:"setExtensions",value:function(e){this.extensions=e}},{key:"setPlugins",value:function(e){this.plugins=e}},{key:"parse",value:function(e,t){var n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(M(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()})))).then((function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])})).then((function(t){var a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};pe(i,a,r),me(a,r),Promise.all(n._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||[],n=this.json.meshes||[],r=0,i=t.length;r<i;r++)for(var a=t[r].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&&(n[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,n){var r=this;if(e.refs[t]<=1)return n;var i=n.clone();return function e(t,n){var i,a=r.associations.get(t),o=(null!=a&&r.associations.set(n,a),S(t.children.entries()));try{for(o.s();!(i=o.n()).done;){var s=A(i.value,2),l=s[0];e(s[1],n.children[l])}}catch(e){o.e(e)}finally{o.f()}}(n,i),i.name+="_instance_"+e.uses[t]++,i}},{key:"_invokeOne",value:function(e){var t=Object.values(this.plugins);t.push(this);for(var n=0;n<t.length;n++){var r=e(t[n]);if(r)return r}return null}},{key:"_invokeAll",value:function(e){for(var t=Object.values(this.plugins),n=(t.unshift(this),[]),r=0;r<t.length;r++){var i=e(t[r]);i&&n.push(i)}return n}},{key:"getDependency",value:function(e,t){var n=e+":"+t,r=this.cache.get(n);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this.loadNode(t);break;case"mesh":r=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":r=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":r=this.loadSkin(t);break;case"animation":r=this.loadAnimation(t);break;case"camera":r=this.loadCamera(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(n,r)}return r}},{key:"getDependencies",value:function(e){var t,n,r=this.cache.get(e);return r||(n=(t=this).json[e+("mesh"===e?"es":"s")]||[],r=Promise.all(n.map((function(n,r){return t.getDependency(e,r)}))),this.cache.add(e,r)),r}},{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[G.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 n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)}))}},{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=ce[i.type],l=se[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=se[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*ce.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,n=this.options,r=t.textures[e].source,i=(t=t.images[r],this.textureLoader);return t.uri&&null!==(n=n.manager.getHandler(t.uri))&&(i=n),this.loadTextureImage(e,r,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=le[n.magFilter]||r.LinearFilter,t.minFilter=le[n.minFilter]||r.LinearMipmapLinearFilter,t.wrapS=ue[n.wrapS]||r.RepeatWrapping,t.wrapT=ue[n.wrapT]||r.RepeatWrapping,i.associations.set(t,{textures:e}),i.options.myOptions.core.loadTexture({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,w.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 n=(e=t.isImageBitmapLoader?e:{texture:e,blob:null}).texture;return e=e.blob,!0===t.isImageBitmapLoader&&(n.userData.url=u,n.userData.blob=e),n.url=u,n})).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,n){var r=this;return this.getDependency("texture",n.index).then((function(i){var a,o;return void 0===n.texCoord||0==n.texCoord||"aoMap"===t&&1==n.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+n.texCoord+" for texture "+t+" not yet supported."),r.extensions[G.KHR_TEXTURE_TRANSFORM]&&(a=void 0!==n.extensions?n.extensions[G.KHR_TEXTURE_TRANSFORM]:void 0)&&(o=r.associations.get(i),i=r.extensions[G.KHR_TEXTURE_TRANSFORM].extendTexture(i,a),r.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.core.loadMaterial({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||{})[G.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]?(u=a[G.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS],t=u.getMaterialType(),l.push(u.extendParams(s,o,n))):i[G.KHR_MATERIALS_UNLIT]?(u=a[G.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===te?a[G.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),me(i,o),n.associations.set(i,{materials:e}),o.extensions&&pe(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[G.KHR_DRACO_MESH_COMPRESSION])?"draco:"+c.bufferView+":"+c.indices+":"+ve(c.attributes):u.indices+":"+ve(u.attributes)+":"+u.mode),c=i[u];c?a.push(c.promise):(c=void 0,c=l.extensions&&l.extensions[G.KHR_DRACO_MESH_COMPRESSION]?function(e){return n[G.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(n){return be(n,e,t)}))}(l):be(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=xe(p.geometry,r.TriangleStripDrawMode):6===f.mode&&(p.geometry=xe(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),me(p,a),f.extensions&&pe(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 _=new r.Group;t.associations.set(_,{meshes:e});for(var B=0,C=u.length;B<C;B++)_.add(u[B]);return _}))}},{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)),me(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(de[d.path]){case de.weights:f=r.NumberKeyframeTrack;break;case de.rotation:f=r.QuaternionKeyframeTrack;break;default:f=r.VectorKeyframeTrack}e=t.name||t.uuid;var p=void 0!==h.interpolation?fe[h.interpolation]:r.InterpolateLinear,m=[],v=(de[d.path]===de.weights?t.traverse((function(e){e.morphTargetInfluences&&m.push(e.name||e.uuid)})):m.push(e),c.array);if(c.normalized){for(var g=ge(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]+"."+de[d.path],n.array,v,p);"CUBICSPLINE"===h.interpolation&&(S.createInterpolant=function(e){return new(this instanceof r.QuaternionKeyframeTrack?oe:ie)(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,n=this,r=t.nodes[e];return void 0===r.mesh?null:n.getDependency("mesh",r.mesh).then((function(e){return e=n._getNodeRef(n.meshCache,r.mesh,e),void 0!==r.weights&&e.traverse((function(e){if(e.isMesh)for(var t=0,n=r.weights.length;t<n;t++)e.morphTargetInfluences[t]=r.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),me(l,o),o.extensions&&pe(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.core.loadNode({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)),me(a,e),e.extensions&&pe(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 n=[],r=0,i=(t=e).joints.length;r<i;r++)n.push(o.getDependency("node",t.joints[r]));return Promise.all(n)})).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=M(s.entries()).sort((function(e,t){return e[0]-t[0]})).map((function(e){return(e=A(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=S(i.associations);try{for(a.s();!(t=a.n()).done;){var o=A(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 be(e,t,n){var i,a=t.attributes,o=[];for(i in a){var s=he[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)),me(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=ge(se[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=ge(se[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 xe(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}var we=n(5259),Ae=n(5410);class Se{constructor(e,t){this.runScene=e,this.helper=t}setTextureLoader(e){this.textureLoader=e,this.initTextureLoader(e)}initTextureLoader(e){e instanceof x&&e.setOptions({reverseTexture:this.helper.loadConfig.reverseTexture,textureQuality:this.runScene.optionsEx.options.texture.quality})}}class Me{constructor(e,t){this.pending=[],this.models=[],this.module=new we.Z,this.runScene=e,this.loadConfig=t,this.options=new Se(e,this),this.callback("mountModule",null)}beforeLoader(e){this.callback("getJSON",e),this.json=e;var t=this.processBase64(e);return"editor"===this.runScene.optionsEx.options.mode?(this.callback("beforeParse",e),!0):(t&&this.callback("beforeParse",e),t)}loadTexture(e){this.callback("loadTexture",e)}processBase64(e){return!e.asset.ex||!(e=e.asset.ex.base64)||!!(e=(0,Ae.Ne)(e))&&(e=Number(e),!isNaN(e)&&(new Date).getTime()<e)}callback(e,t){var n,r;return this.loadConfig.triggerCb&&null!=(n=null==(r=this.runScene.cb.loaderer.gltf[e])?void 0:r.cb)&&n.call(r,t),null!=(r=null==(n=this.loadConfig.callBack)?void 0:n[e])&&r.call(n,t),this.runScene.exporter.gltf.module.loadCallback({type:e,json:this.json,data:t,config:this.loadConfig,core:this})}loadMaterial(e){this.callback("loadMaterial",e)}loadNode(e){if(1===(e=this.callback("loadNode",e)).length)return e[0];console.log(e,"back")}}class _e{constructor(e){this.dracoPath="./draco/",this._gltf=new F,this.runScene=e}init(){const e=new d;e.setDecoderPath(this.runScene.optionsEx.options.decodePath),this._gltf.setMeshoptDecoder(o),this._gltf.setDRACOLoader(e)}load(e,t){return function(e,t,n,r){return new(n=n||Promise)((function(t,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function o(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var r;e.done?t(e.value):((r=e.value)instanceof n?r:new n((function(e){e(r)}))).then(a,o)}s((r=r.apply(e,[])).next())}))}(this,0,void 0,(function*(){var n=yield i().get(e,{responseType:"arraybuffer",onDownloadProgress:e=>{var n,{total:e,loaded:r}=e;let i=r/e;1<(i=i<0?0:i)&&(i=1);var r=Number(i.toFixed(2));e=Math.floor(100*r),null!=(n=null==(r=null==t?void 0:t.callBack)?void 0:r.progress)&&n.call(r,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 n?this.parse(n,t):Promise.resolve()}))}parse(e,t){const n=(0,w.deepMergeObject)({cleanJSON:!0,triggerCb:!1,reverseTexture:!1,callBack:{mountModule:void 0,getJSON:void 0,beforeParse:void 0,afterParse:void 0,lazyLoadedTexture:void 0,loaded:void 0,loadMaterial:void 0,loadNode:void 0,modelLoaded:void 0,progress:void 0,getArrayBuffer:void 0,complete:void 0,loadedGltf:void 0,loadTexture:void 0},module:{light:!0,model:!0,camera:!0,controls:!0,tags:!0,objects:!0,timeline:!0,sceneConfig:!0}},t),r=new Me(this.runScene,n);return r.callback("getArrayBuffer",e),new Promise((t=>{try{e instanceof ArrayBuffer&&this._gltf.parse(e,"",(e=>{r.callback("loadedGltf",e),this.afterParse(e.parser.options.myOptions,e,n),t(r.models)}),(e=>{console.log(e,"_a")}),{rootModel:this.runScene.assetsEx.get().scene,models:[],core:r,runScene:this.runScene,loadConfig:n})}catch(e){throw this.runScene.optionsEx.log("加载场景出错:"+e),TypeError(e)}}))}afterParse(e,t,n){var r;const i=e.core;i.callback("afterParse",{options:e,json:t,loadConfig:n});var{cleanJSON:n,callBack:a}=n;this.runScene.optionsEx.log(t,"detail"),Promise.all(i.pending).then((()=>{i.callback("complete",{models:e.models,json:t})})),null!=(r=null==a?void 0:a.getJSON)&&r.call(a,t),n&&this.disposeJSON(t)}disposeJSON(e){}}var Be=n(2291),Ce=n(5105);class Ee{constructor(e){this._objectLoader=new r.ObjectLoader,this.runScene=e,this._parser=new Te(e)}parse(e){return function(e,t,n,r){return new(n=n||Promise)((function(t,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function o(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var r;e.done?t(e.value):((r=e.value)instanceof n?r:new n((function(e){e(r)}))).then(a,o)}s((r=r.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 Te{constructor(e){this.runScene=e}parseModel(e){e.material&&this.parseMaterial(e)}parseMaterial(e){var t=e.material;"SpriteMaterial"===t.type&&(0,Be.M)(t,"tools",Ce.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 De{constructor(e){this.imgBitMap=new r.ImageBitmapLoader,this.object=new r.ObjectLoader,this.runScene=e,this.gltf=new _e(e),this.json=new Ee(e)}init(){this.gltf.init()}}const Pe=new class{constructor(){this.load=new r.AnimationLoader}parse(e){return this.load.parse(e)}}},8953:(e,t,n)=>{"use strict";n.r(t),n.d(t,{SpecialMaterial:()=>ie,createDefMaterial:()=>J,defAllMaterialMap:()=>z,defBaseMaterialMap:()=>H,default:()=>V,disposeMaterial:()=>K,getBaseTextures:()=>Q,getMaterialType:()=>ae,getTextures:()=>X,getTexturesByMaterial:()=>Z,initMaterial:()=>q,isBaseMaterial:()=>re,isColor:()=>$,isMaterial:()=>te,materialIgnore:()=>oe,mergeMaterial:()=>W,setDefMaterialForSameGeo:()=>ne,setMaterialTexture:()=>Y,updateMaterial:()=>ee});var r=n(2081),i=n(9728),a=n(8881),o=n(1643);class s{constructor(e){this.init(e)}init(e){e.cb.material.add.add("base-material",(e=>{}))}static isDefVal(e){for(const t in this.defVal){const n=this.defVal[t],r=e[t];if(n instanceof a.Color){if(n.getHexString()!==r.getHexString())return!1}else if("object"==typeof n){if(r.x!==n.x)return!1}else if(r!==n)return!1}for(const t of o.zX)if(e[t])return!1;return!0}create(){return J()}}s.defVal={color:new a.Color(16777215),emissive:new a.Color(0),roughness:1,metalness:0,lightMapIntensity:1,aoMapIntensity:1,emissiveIntensity:1,bumpScale:1,normalScale:new a.Vector2(1,1),displacementScale:1,envMapIntensity:1,wireframe:!1,transparent:!1,depthTest:!0,depthWrite:!0,opacity:1};var l=n(5105),u=n(2266),c=n(9593);class h{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:n}=e,r=new a.ShaderMaterial({uniforms:(0,u.d9)(d.uniforms),vertexShader:d.vertexShader,fragmentShader:d.fragmentShader});return r.name=n.name,t.forEach((e=>{"ceilingTex"===e.type?r.uniforms.ceilingTex.value=e.texture||null:"floorTex"===e.type?r.uniforms.floorTex.value=e.texture||null:"sideWallTex"===e.type?r.uniforms.sideWallTex.value=e.texture||null:"backWallTex"===e.type&&(r.uniforms.backWallTex.value=e.texture||null)})),Object.keys(n.uniforms).filter((e=>!h.TextureNames.includes(e))).map((e=>{var t=n.uniforms[e];r.uniforms[e].value="roomsXYZPropsW"===e||"positionOffsetRoomsXYZPropsW"===e||"roomColorTint"===e?new a.Vector4(t.x,t.y,t.z,t.w):t})),r.userData.tools=this.tools,r},toNormal:e=>{const t=J(),n=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:this.tools.type,uniforms:{},name:e.name},textures:this.tools.getTextures(e)}),{}),r=e.uniforms,i=d.uniforms;return Object.keys(r).filter((e=>!h.TextureNames.includes(e))).map((e=>{var t,o,s,l,u,c,h=r[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||(n[e]=h)):h!==d&&(n[e]=h)})),t.userData.normal.uniforms=n,t},clone:(e,t)=>e,copy:e=>{const t=this.create();return Object.keys(t).filter((e=>!h.IgnoredAttributes.includes(e))).map((n=>{t[n]=e[n]})),t}},this.runScene=e}create(){const e=new a.ShaderMaterial({uniforms:(0,u.d9)(d.uniforms),vertexShader:d.vertexShader,fragmentShader:d.fragmentShader});return e.userData.tools=this.tools,e}undo(e){var{material:e,list:t,val:n}=e;this.runScene.undoEx.addUndo(new c.Z({target:e,typeList:["uniforms",...t],newVal:n}).execute())}}h.IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],h.TextureNames=["sideWallTex","backWallTex","floorTex","ceilingTex"];const d={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 f{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:n,material:r}=e,i=W(r,new p(void 0,void 0,this.runScene));return i.name=n.name,t.forEach((e=>{i[e.type]=e.texture})),Object.keys(n.uniforms).filter((e=>!f.TextureNames.includes(e))).map((e=>{i[e]=n.uniforms[e]})),i.insertFresnelShader(),i.userData.tools=this.tools,i},toNormal:e=>{const t=W(e,J()),n=(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,{}),r=m.uniforms;return Object.keys(r).filter((e=>!f.TextureNames.includes(e))).map((t=>{var i=e[t],a=r[t].value;"fresnelBias"===t||"fresnelScale"===t||"fresnelPower"===t||"isSurge"===t?i.value!==a&&(n[t]=i):i!==a&&(n[t]=i)})),t.userData.normal.uniforms=n,t},clone:(e,t)=>e,copy:e=>{const t=this.create();return Object.keys(t).filter((e=>!f.IgnoredAttributes.includes(e))).map((n=>{t[n]=e[n]})),t}},this.runScene=e}create(e){const t=new p(void 0,void 0,this.runScene);return t.insertFresnelShader(),t.userData.tools=this.tools,(e=e||this.runScene.modelEx.select)&&(t.name=e.name),t}undo(e){var{material:e,list:t,val:n}=e;this.runScene.undoEx.addUndo(new c.Z({target:e,typeList:[...t],newVal:n}).execute())}}f.IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],f.TextureNames=["envMap","displacementMap"];class p extends a.MeshPhysicalMaterial{constructor(e,t,n){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=n,this.isSpecialMaterial=!0,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(m.uniforms.fresnelBias.value),this.fresnelScale=new a.Uniform(m.uniforms.fresnelScale.value),this.fresnelPower=new a.Uniform(m.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,m.vertexParas),e.vertexShader=e.vertexShader.replace(/#include <begin_vertex>/g,m.vertexShader1),e.vertexShader=e.vertexShader.replace(/vWorldPosition = worldPosition.xyz;/g,m.vertexShader2),e.fragmentShader=e.fragmentShader.replace(/#include <transmission_pars_fragment>/g,m.fragmentParas),e.fragmentShader=e.fragmentShader.replace(/vec3 totalEmissiveRadiance = emissive;/g,m.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 m={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 v{constructor(e){this.tools={type:"Matcap",getTextures(e){const t=[];return v.TextureNames.forEach((n=>{e[n]&&t.push({type:n,texture:e[n]})})),t},toNormal:e=>{var t=this.tools.getTextures(e);const n=W(e,J()),r=(n.userData=Object.assign(Object.assign({},n.userData),{normal:{type:this.tools.type,uniforms:{},name:e.name},textures:t}),n.name=e.name,{}),i=new a.MeshMatcapMaterial;return Object.keys(e).filter((e=>!v.TextureNames.includes(e))).filter((e=>!v.IgnoredAttributes.includes(e))).map((t=>{var n=e[t],a=i[t];"bumpScale"===t||"displacementScale"===t||"displacementBias"===t||"depthTest"===t||"depthWrite"===t||"transparent"===t||"opacity"===t?n!==a&&(r[t]=n):"normalScale"!==t||n.x===a.x&&n.y===a.y||(r[t]=n)})),n.userData.normal.uniforms=r,n},parseData:e=>{const{normal:t,textures:n,material:r}=e,i=W(r,new a.MeshMatcapMaterial);return delete i.emissive,i.name=t.name,n.forEach((e=>{i[e.type]=e.texture})),Object.keys(t.uniforms).filter((e=>!v.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)=>e,copy:e=>{const t=this.create();return Object.keys(t).filter((e=>!v.IgnoredAttributes.includes(e))).map((n=>{t[n]=e[n]})),t}},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:n,val:r}=e;this.runScene.undoEx.addUndo(new c.Z({target:t,typeList:[...n],newVal:r,cb:()=>{t.needsUpdate=!0}}).execute())}}v.IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],v.TextureNames=["alphaMap","bumpMap","displacementMap","map","normalMap","matcap"];const g="\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 ",y="\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 ",b={defines:{USE_UV:!0,USE_MAP:!0},uniforms:{mapArray:{value:[null,null,null,null,null,null]},maskArray:{value:[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]},maskUvTransArray:{value:[new a.Matrix3,new a.Matrix3,new a.Matrix3,new a.Matrix3,new a.Matrix3]},diffuse:{value:new a.Color(16777215)},uvTransform:{value:new a.Matrix3},shadowShade:{value:.6}},vertex:"\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_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 <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 <fog_vertex>\n // vUv = (uvTransform * vec3(uv, 1.0)).xy;\n}\n ",fragment:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <uv2_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 6\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 #if MAX_TEX > 0\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 #endif\n #if MAX_TEX > 1\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 #endif\n // Custom UV End\n \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 diffuseColor *= textureColor;\n // Custom Texture End\n \n // ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n // reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n // vec3 outgoingLight = reflectedLight.indirectDiffuse;\n vec3 outgoingLight = diffuseColor.rgb;\n #include <output_fragment>\n \n // gl_FragColor = vec4(diffuse, opacity * (1.0 - getShadowMask()));\n gl_FragColor.rgb *= vec3(getShadowMask() * (1.0 - shadowShade) + shadowShade);\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n "};class x{constructor(e){this.tools={type:"MixTexture",getTextures(e){const t=[];return x.TextureNames.forEach((n=>{var r=parseInt(n.slice(-1));n.startsWith("terrainMap")?e.uniforms.mapArray.value[r]&&t.push({type:n,texture:e.uniforms.mapArray.value[r]}):n.startsWith("terrainMask")&&e.uniforms.maskArray.value[r]&&t.push({type:n,texture:e.uniforms.maskArray.value[r]})})),t},toNormal:e=>{const t=J(),n=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:this.tools.type,uniforms:{},name:e.name},textures:this.tools.getTextures(e)}),{}),r=e.uniforms,i=b.uniforms;return Object.keys(r).filter((e=>"mapArray"!==e&&"maskArray"!==e&&"mapUvTransArray"!==e&&"maskUvTransArray"!==e)).map((e=>{const t=r[e].value,a=i[e].value;"diffuse"===e?t.getHexString()!==a.getHexString()&&(n[e]=t.getHexString()):"uvTransform"!==e&&t!==a&&(n[e]=t)})),t.userData.normal.uniforms=n,t},parseData:e=>{const{textures:t,normal:n}=e,r=new a.ShadowMaterial({color:0,opacity:1});return r.uniforms=a.UniformsUtils.clone(b.uniforms),this.insertShader(r),t.forEach((e=>{var t=parseInt(e.type.slice(-1));e.type.startsWith("terrainMap")?(r.uniforms.mapArray.value[t]=e.texture,this.onTexRepeatChange(r,t,!0)):e.type.startsWith("terrainMask")&&(r.uniforms.maskArray.value[t]=e.texture,this.onTexRepeatChange(r,t,!1))})),Object.keys(n.uniforms).filter((e=>!x.TextureNames.includes(e))).map((e=>{var t=n.uniforms[e];"diffuse"===e?r.uniforms[e].value=new a.Color(parseInt(t,16)):"uvTransform"!==e&&(r.uniforms[e].value=t)})),r.name=n.name,r.userData.tools=this.tools,r},clone:(e,t)=>e,copy:e=>{const t=this.create();return Object.keys(t).filter((e=>!x.IgnoredAttributes.includes(e))).map((n=>{t[n]=e[n]})),t}},this.runScene=e}create(){const e=new a.ShadowMaterial({color:0,opacity:1});return e.uniforms=a.UniformsUtils.clone(b.uniforms),this.insertShader(e),e.userData.tools=this.tools,e}undo(e){var{material:e,list:t,val:n}=e;this.runScene.undoEx.addUndo(new c.Z({target:e,typeList:["uniforms",...t],newVal:n}).execute())}insertShader(e){e&&(e.onBeforeCompile=t=>{t.defines=b.defines,this.mergeUniforms(e.uniforms,t.uniforms),t.vertexShader=b.vertex,t.fragmentShader=b.fragment,t.fragmentShader=t.fragmentShader.replace(/\/\/ Insert Noise2D/g,g)})}mergeUniforms(e,t){if(e&&t)for(const n in e)t[n]=e[n]}onTexRepeatChange(e,t,n){e&&0<=t&&(n?(n=e.uniforms.mapArray.value[t],e.uniforms.mapUvTransArray.value[t].identity(),e.uniforms.mapUvTransArray.value[t].scale(n.repeat.x,n.repeat.y)):(n=e.uniforms.maskArray.value[t],e.uniforms.maskUvTransArray.value[t].identity(),e.uniforms.maskUvTransArray.value[t].scale(n.repeat.x,n.repeat.y)))}}x.IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],x.TextureNames=["terrainMap0","terrainMap1","terrainMap2","terrainMap3","terrainMap4","terrainMap5","terrainMap6","terrainMap7","terrainMask0","terrainMask1","terrainMask2","terrainMask3","terrainMask4","terrainMask5","terrainMask6"];class w{constructor(e){this.tools={type:"Physical",getTextures(e){const t=[];return w.TextureNames.forEach((n=>{e[n]&&t.push({type:n,texture:e[n]})})),t},parseData:e=>{const{normal:t,textures:n,material:r}=e,i=W(r,new a.MeshPhysicalMaterial);return i.name=t.name,n.forEach((e=>{i[e.type]=e.texture})),Object.keys(t.uniforms).filter((e=>!w.IgnoredAttributes.includes(e))).map((e=>{var n=t.uniforms[e];i[e]="attenuationColor"===e||"sheenColor"===e||"specularColor"===e?new a.Color(n):"clearcoatNormalScale"===e?new a.Vector2(n.x,n.y):n})),i.userData.tools=this.tools,i},toNormal:e=>{const t=W(e,J()),n=(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,{}),r=new a.MeshPhysicalMaterial;return Object.keys(e).filter((e=>!w.TextureNames.includes(e))).filter((e=>!w.IgnoredAttributes.includes(e))).filter((e=>void 0===t[e])).map((t=>{const i=e[t],a=r[t];"attenuationColor"===t||"sheenColor"===t||"specularColor"===t?i.getHexString()!==a.getHexString()&&(n[t]=i.getHexString()):"clearcoatNormalScale"===t?i.x===a.x&&i.y===a.y||(n[t]=i):i!==a&&(n[t]=i)})),t.userData.normal.uniforms=n,t},clone:(e,t)=>e,copy:e=>{const t=this.create();return Object.keys(t).filter((e=>!w.IgnoredAttributes.includes(e))).map((n=>{t[n]=e[n]})),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:n}=e;this.runScene.undoEx.addUndo(new c.Z({target:e,typeList:[...t],newVal:n}).execute())}}w.IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],w.TextureNames=["alphaMap","aoMap","bumpMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap","clearcoatMap","clearcoatNormalMap","clearcoatRoughnessMap","sheenRoughnessMap","sheenColorMap","specularIntensityMap","specularColorMap","thicknessMap","transmissionMap"];var A=n(8493);const S={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}"},M={uniforms:{tDiffuse:new a.Uniform(null),v:new a.Uniform(1/512)},vertexShader:"\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}",fragmentShader:"\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float v;\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvec4 sum = vec4( 0.0 );\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\t\t\t\n\t\t\tgl_FragColor = sum;\n\t\t}"};new a.Uniform(null),new a.Uniform(null),new a.Uniform(0),new a.Uniform(0),new a.Uniform(0),new a.Uniform(new a.Vector2),new a.Uniform(.1),new a.Uniform(1e3);class _{constructor(e){this.materials={},this.render=()=>{(0,r.js)(this.materials,((e,t)=>{const{model:n,material:r}=t;r.update(n)}))},this.tools={type:"Reflector",getTextures:e=>Z(e),parseData:e=>{const{textures:t,normal:n,models:r,material:i}=e,o=W(i,new B(void 0,void 0,this.runScene));return o.name=n.name,t.forEach((e=>{o[e.type]=e.texture})),Object.keys(n.uniforms).filter((e=>!_.TextureNames.includes(e))).map((e=>{o[e]="normalScale"===e?new a.Vector2(n.uniforms[e].x,n.uniforms[e].y):n.uniforms[e]})),o.setRTSize(o.resolution),o.setBlurPass(o.blurSize),o.insertReflectorShader(),o.userData.tools=this.tools,this.bindData({model:r[0],material:o}),o},toNormal:e=>{const t=W(e,J()),n=(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,{}),r=C.uniforms;return Object.keys(r).filter((e=>!_.TextureNames.includes(e))).map((t=>{var i=e[t],a=r[t].value;"mirror"===t||"mixBlur"===t||"mixStrength"===t||"mixContrast"===t?i.value!==a&&(n[t]=i):i!==a&&(n[t]=i)})),t.normalScale&&(n.normalScale=t.normalScale),t.userData.normal.uniforms=n,t},clone:(e,t)=>e,copy:e=>{const t=this.create();return Object.keys(t).filter((e=>!_.IgnoredAttributes.includes(e))).map((n=>{t[n]=e[n]})),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 n=(0,i.getId)();t.userData.id=n,this.materials[n]=e}create(e){const t=new B(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:n}=e;this.runScene.undoEx.addUndo(new c.Z({target:e,typeList:[...t],newVal:n}).execute())}dispose(){this.materials={}}}_.IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],_.TextureNames=["map","normalMap","roughnessMap","metalnessMap","tDiffuse","tDiffuseBlur"];class B extends a.MeshStandardMaterial{constructor(e,t,n){e?super(e):(super(),this.opacity=C.uniforms.opacity.value,this.transparent=C.uniforms.transparent.value,this.roughness=C.uniforms.roughness.value,this.metalness=C.uniforms.metalness.value),this.runScene=n,this.isSpecialMaterial=!0,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=C.uniforms.resolution.value,this.blurSize=C.uniforms.blurSize.value,this.mirror=new a.Uniform(C.uniforms.mirror.value),this.mixBlur=new a.Uniform(C.uniforms.mixBlur.value),this.mixStrength=new a.Uniform(C.uniforms.mixStrength.value),this.mixContrast=new a.Uniform(C.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 A.T(S),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 A.T(M),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=C.vertexParas+""+e.vertexShader,e.vertexShader=e.vertexShader.replace("#include <project_vertex>",C.vertexShader),e.fragmentShader=C.fragmentParas+""+e.fragmentShader,e.fragmentShader=e.fragmentShader.replace("#include <emissivemap_fragment>",C.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 C={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 "},E="\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 ",T="\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 D{constructor(e){this.tools={type:"TreeLeaf",getTextures(e){const t=[];return D.TextureNames.forEach((n=>{e[n]&&t.push({type:n,texture:e[n]})})),t},toNormal:e=>{var t=this.tools.getTextures(e);const n=W(e,J()),r=(n.userData=Object.assign(Object.assign({},n.userData),{normal:{type:this.tools.type,uniforms:{},name:e.name},textures:t}),n.name=e.name,{}),i=new O(this.runScene);return Object.keys(e).filter((e=>!D.TextureNames.includes(e))).filter((e=>!D.IgnoredAttributes.includes(e))).map((t=>{var n=e[t],a=i[t];"color"!==t&&"emissive"!==t&&("normalScale"===t?n.x===a.x&&n.y===a.y||(r[t]=n):"uniforms"===t?Object.keys(n).map((t=>{const n=e.uniforms[t].value,a=i.uniforms[t].value;"windForce"===t||"windSpeed"===t||"windWaveScale"===t||"colorLevel"===t||"colorFade"===t||"leavesCore"===t?n!==a&&(r[t]=n):"colorGradient"===t&&n.getHexString()!==a.getHexString()&&(r[t]=n.getHexString())})):n!==a&&(r[t]=n))})),n.userData.normal.uniforms=r,n},parseData:e=>{const{normal:t,textures:n,material:r,models:i}=e,o=W(r,new O(this.runScene));return o.name=t.name,o.setSize(i[0]),o.setWorldPos(i[0]),n.forEach((e=>{o[e.type]=e.texture})),Object.keys(t.uniforms).filter((e=>!D.IgnoredAttributes.includes(e))).map((e=>{var n=t.uniforms[e];"color"!==e&&"emissive"!==e&&("normalScale"===e?o[e]=new a.Vector2(n.x,n.y):"windForce"===e||"windSpeed"===e||"windWaveScale"===e||"colorLevel"===e||"colorFade"===e||"leavesCore"===e?o.uniforms[e]=new a.Uniform(n):"colorGradient"===e?o.uniforms[e]=new a.Uniform(new a.Color(parseInt(n,16))):o[e]=t.uniforms[e])})),o.userData.tools=this.tools,o},clone:(e,t)=>e,copy:e=>{const t=this.create();return Object.keys(t).filter((e=>!D.IgnoredAttributes.includes(e))).map((n=>{t[n]=e[n]})),t}},this.runScene=e}create(e){const t=new O(this.runScene);return t.userData.tools=this.tools,(e=e||this.runScene.modelEx.select)&&(t.name=e.name,t.setSize(e),t.setWorldPos(e)),t}undo(e){const{material:t,list:n,val:r}=e;this.runScene.undoEx.addUndo(new c.Z({target:t,typeList:[...n],newVal:r,cb:()=>{t.needsUpdate=!0}}).execute())}}D.IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines","onBeforeCompile"],D.TextureNames=["alphaMap","aoMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap"];const P=new a.Clock;class O extends a.MeshStandardMaterial{constructor(e){super(),this.isSpecialMaterial=!0,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=E,e.fragmentShader=T,e.vertexShader=e.vertexShader.replace(/\/\/ Insert Noise3D/g,y)}}update(){this.uniforms.time.value=P.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 R=n(1736),I=n(6214),k=n(5860),L=n(5410),F=n(2291),U=n(5244),G=n(5259);class N{constructor(e){this.data=this.getData(),this.pending=[],this.clonedTextures=[],this.mount=e=>{e.core.module.set("material",this)},this.complete=()=>{this.data=this.getData()},this.load=e=>{e=e.data;var{materialDef:e,material:t,model:n}=e;q(t),this.data.materialIns[e.id]||(this.data.materialIns[e.id]={material:t,models:[]}),this.data.materialIns[e.id].models.push(n)},this.done=e=>{const{json:t,core:n}=e;var{materialMap:e,textureMap:r}=t.asset.ex||{};this.processTextureMap(r||{}),this.processMaterialMap(e||{},t),this.processClonedTextures(),this.pending.push(this.lazyLoad(n)),n.pending.push(Promise.all(this.pending))},this.parser=null,this.loadTexture=e=>{e=e.data;const{textureDef:t,texture:n}=e;var{md5:e,format:r,size:i,uvScript:a,id:o,cloneSourceId:s,minFilter:l}=t;n.userData.md5=e,r&&(n.format=r,n.userData.format=r),a&&(n.userData.uvScript=a),s&&((0,R.setTextureCloneId)(n,s),this.clonedTextures.push(n)),"nearest"===l&&((0,R.setTextureMinFilter)(n,"nearest"),(0,F.M)(n,"minFilter",l)),n.userData.id=o,n.userData.size=i,this.data.textureIns[t.id]=this.runScene.textureEx.getSameTexture(e,n)||n},this.processTextureMap=(()=>{const e=e=>{const{target:t,data:n}=e;var r;n&&(({x:e,y:r}="object"==typeof n?n:{x:n,y:n}),t.x=e,t.y=r)};return t=>{(0,r.js)(t,((t,n)=>{var{format:n,center:r,rotation:i,offset:a,repeat:o}=n;const s=this.data.textureIns[t];s&&(s.format=n,e({target:s.repeat,data:o}),e({target:s.center,data:r}),e({target:s.offset,data:a}),i&&(s.rotation=i),this.runScene.textureEx.initTextureAndAddtoAll(s))}))}})(),this.processMaterialMap=(()=>{const e=(e,t)=>{const{textures:n,normal:r,models:i,material:a}=e;this.runScene.optionsEx.options.texture.load&&this.processBaseMaterialTextures({material:a,textures:n},t),this.runScene.materialEx.parseNromals(r,a),i.map((e=>e.material=a))},t=e=>{const{textures:t,normal:n,models:i,material:a}=e;e=(0,r.js)(t,((e,t)=>({type:e,texture:this.data.textureIns[t]})));const o=this.runScene.materialEx.getDataByType(n.type,{normal:n,textures:e,models:i,material:a});this.runScene.materialEx.parseNromals(n,o),o&&i.map((e=>e.material=o))};return(n,i)=>{(0,r.js)(n,((n,r)=>{if(n=this.data.materialIns[n]){const{material:a,models:o}=n;a&&(({normal:n,textures:r}=r),n.type?t({textures:r,models:o,material:a,normal:n}):e({textures:r,models:o,material:a,normal:n},i),a.needsUpdate=!0)}}))}})(),this.baseMaterialTextures=[],this.processBaseMaterialTextures=(e,t)=>{const{textures:n,material:i}=e;(0,r.js)(n,((e,n)=>{(n=this.data.textureIns[n])&&(this.runScene.optionsEx.options.texture.lazyLoad.open&&"scene"===t.asset.ex.type&&t.asset.ex.sceneEx.materialId!==i.userData.id?this.baseMaterialTextures.push({material:i,type:e,texture:n}):(this.runScene.uniqueEx.texture.addMaterial(n,{material:i,type:e}),Y({material:i,type:e,texture:n})))}))},this.lazyLoad=(()=>{const e=e=>{e.callback("lazyLoadedTexture",""),this.runScene.optionsEx.log("贴图懒加载完毕","base","success")},t=(n,r,i)=>{var a=this.baseMaterialTextures[n];if(!a)return r(),e(i);const{texture:o,type:s,material:l}=a;this.runScene.uniqueEx.texture.addMaterial(o,{material:l,type:s}),Y({material:l,type:s,texture:o}),l.needsUpdate=!0,setTimeout((()=>t(++n,r,i)),this.runScene.optionsEx.options.texture.lazyLoad.intervalTime)};return n=>new Promise((r=>{if(!this.runScene.optionsEx.options.texture.lazyLoad.open)return r(0),e(n);t(0,r,n)}))})(),this.afterParse=e=>{const{data:t,core:n,json:r}=e;if("material"===r.asset.ex.type){e=t.options.models;const[r]=e,i=[];r.material?(this.runScene.materialEx.add(r.material),i.push(r.material)):r.children.map((e=>{e.material&&(i.push(e.material),this.runScene.materialEx.add(e.material))})),n.models.push(...i)}},this.runScene=e}getData(){return{materialMap:{},textureMap:{},materialIns:{},textureIns:{}}}getMap(){return new G.Z({loadedGltf:this.done,loadMaterial:this.load,loadTexture:this.loadTexture,afterParse:this.afterParse,complete:this.complete,mountModule:this.mount})}processInput(e,t){return function(e,t,n,r){return new(n=n||Promise)((function(t,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function o(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var r;e.done?t(e.value):((r=e.value)instanceof n?r:new n((function(e){e(r)}))).then(a,o)}s((r=r.apply(e,[])).next())}))}(this,0,void 0,(function*(){this.parser=t}))}processClonedTextures(){this.clonedTextures.map((e=>{var t=(0,R.getCloneIdFromTexture)(e);(t=this.data.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,R.bindTextureBaseData)(e)):(this.runScene.textureEx.delete(e),(0,F.bv)(e,"cloneSourceId"),(0,R.disposeTexture)(e))}))}}var j=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function o(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(o,s)}l((r=r.apply(e,t||[])).next())}))};const H={depthTest:!0,depthWrite:!0,alphaTest:0,side:0,displacementScale:1,visible:!0,normalScale:{x:1,y:1},aoMapIntensity:1,lightMapIntensity:1,envMapIntensity:1},z=["color","emissive","roughness","metalness","normalScale","aoMapIntensity","displacementScale","transparent","lightMapIntensity","envMapIntensity","opacity","alphaTest"];class V{constructor(e){this.defMaterialMap={BaseMaterial:s,SpriteMaterial:l.Z,FakeInterior:h,Fresnel:f,Matcap:v,MixTexture:x,Physical:w,Reflector:_,TreeLeaf:D},this.clean=()=>{this.dispose()},this.defMaterial=J(),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.runScene.cb.clean.add("EngineMaterial",this.clean),this.import=new N(e),this.defMaterialMap={BaseMaterial:new s(e),SpriteMaterial:l.Z,FakeInterior:new h(e),Fresnel:new f(e),Matcap:new v(e),MixTexture:new x(e),Physical:new w(e),Reflector:new _(e),TreeLeaf:new D(e)},this.addSetParses((e=>{const{material:t,type:n,newVal:r}=e;"opacity"===n&&r<1&&(t.transparent=!0)}))}init(){var e={name:"material",loadCallBacks:this.import.getMap(),exportCallBacks:new G.Z};this.runScene.exporter.gltf.module.bind(e)}add(e,t,n){oe.is(e)||this.runScene.uniqueEx.material.add(e,t,n)}create(){var e=new a.MeshStandardMaterial;return this.add(e),e}toArray(){return(0,r.js)(this.runScene.uniqueEx.material.map,((e,t)=>t.material))}copy(e){var t;const n=(null==(t=e.userData.tools)?void 0:t.copy(e))||e.clone();return n.userData.id=(0,i.getId)(),n}clone(e){var t;const n=(null==(t=e.userData.tools)?void 0:t.clone(e))||e.clone();return n.userData.id=(0,i.getId)(),n}addSetParses(e){this.setParses.push(e)}set(e){const{material:t,type:n,val:r}=e,i=t[n];return t[n]=r,t.needsUpdate=!0,this.setParses.map((e=>e({material:t,type:n,newVal:r,oldVal:i})))}setNormals(e,t=!0){const{info:n,newVal:r,materials:i,oldval:a,cb:o}=e;let s=r;return s.isVector2&&(s=s.clone()),e=i.map((e=>new I.Z({info:n,target:e,newVal:s,oldVal:a||e[n],runScene:this.runScene,cb:o}).execute())),t&&this.runScene.undoEx.addUndo(e),e}setNormal(e,t=!0){return e=new I.Z(Object.assign(Object.assign({},e),{runScene:this.runScene})).execute(),t&&this.runScene.undoEx.addUndo(e),e}setTextures(e,t=!0){return j(this,void 0,void 0,(function*(){const{info:n,newVal:r,materials:i,oldVal:a}=e;r instanceof File&&(e.newVal=yield this.runScene.textureEx.parse(r)),"envMap"===n&&(0,R.setTextureMapping)(e.newVal);var o=i.map((t=>new I.Z({info:n,target:t,newVal:e.newVal,oldVal:a||t[n],runScene:this.runScene}).execute()));return t&&this.runScene.undoEx.addUndo(o),i[0][n]}))}setTexture(e,t=!0){return j(this,void 0,void 0,(function*(){var{info:n,newVal:r,target:i}=e,r=(r instanceof File&&(e.newVal=yield this.runScene.textureEx.parse(r)),"envMap"===n&&(0,R.setTextureMapping)(e.newVal),new I.Z(Object.assign(Object.assign({},e),{oldVal:i[n],runScene:this.runScene})).execute());return t&&this.runScene.undoEx.addUndo(r),e.newVal}))}resetMaterial(e,t,n){const{addUndo:r,includeChild:i}=n=(0,L.Gm)({addUndo:!0,includeChild:!1},n);if(e&&t){const n=new Set;((0,L.lG)(e,"array")?e:[e]).map((e=>{i?e.traverse((e=>{re(e.material)&&n.add(e)})):e.material&&n.add(e)}));const a=[];n.forEach((e=>{a.push(new k.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),r&&this.runScene.undoEx.addUndo(a)}}getBase(e){const t=this.defMaterialMap[e];if(t)return t.create()}toNromal(e){var t,n;const r=(null==(n=null==(t=e.userData.tools)?void 0:t.toNormal)?void 0:n.call(t,e))||e.clone();return r.userData=Object.assign(Object.assign({},r.userData),e.userData),r}setSelect(e){this.select=e,this.runScene.cb.setSelectMaterial.cb(e)}getDataByType(e,t){return this.defMaterialMap[e].tools.parseData(t)}dispose(){this.defMaterialMap.Reflector.dispose(),this.runScene.cb.material.dispose.cb("")}remove(e){const t=this.runScene.uniqueEx.material.getModels((0,U.K)(e));t&&(this.resetMaterial(t.toArray(),J()),this.runScene.cb.material.remove.cb(e))}getDefNromals(e){var t;if(null!=(t=null==(t=e.userData)?void 0:t.tools)&&t.type)return{};const n={};return(0,r.js)(H,((t,r)=>{const i=e[t];if("object"==typeof i)for(const e in i)if(i[e]!==r[e])return void(n[t]=i.clone());i!==r&&(n[t]=i)})),n}parseNromals(e,t){(0,r.js)(e,((e,n)=>{var r,i,a,o,s;void 0!==H[e]&&("object"==typeof n?(({x:a,y:o,z:s}=n),null!=(i=null==(r=t[e])?void 0:r.set)&&i.call(r,a,o,s)):t[e]=n)}))}isBaseMaterial(e){return"MeshStandardMaterial"===e.type&&!e.userData.tools&&!e.userData.isTimeLineUsed&&s.isDefVal(e)}}const J=e=>{const t=new a.MeshStandardMaterial(e);return t.userData.id=(0,i.getId)(),t},W=(e,t)=>(z.map((n=>{const r=e[n];"object"==typeof r&&(t[n]=r.clone()),t[n]=r})),t),K=e=>{e.dispose();const t=Z(e);0!==t.length&&t.map((e=>{e=e.texture,(0,R.disposeTexture)(e)}))},Z=e=>{var t=e.userData.textures||Q(e);return delete e.userData.textures,t},X=e=>{var t;return(null==(t=null==(t=e.userData)?void 0:t.tools)?void 0:t.getTextures(e))||Q(e)},Q=e=>o.zX.map((t=>({type:t,texture:e[t]}))).filter((e=>e.texture)),Y=e=>{const{material:t,type:n,texture:r}=e;"envMap"===n&&(0,R.setTextureMapping)(r),t[n]=r,t.needsUpdate=!0},q=e=>{e.vertexColors=!1,e.depthWrite=!0,e.needsUpdate=!1},$=e=>null==e?void 0:e.isColor,ee=e=>{e.needsUpdate=!0},te=e=>null==e?void 0:e.isMaterial,ne=e=>{},re=e=>(null==e?void 0:e.isMeshStandardMaterial)&&!e.isSpecialMaterial,ie={Sprite:l.Z},ae=e=>{var t;return(null==(t=null==e?void 0:e.userData.tools)?void 0:t.type)||(null==e?void 0:e.type)},oe={set(e,t){t?(0,F.M)(e,"ignore",!0):delete e.userData.ignore},is:e=>!0===(0,F.is)(e,"ignore")}},5105:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s});var r=n(8881),i=n(8953),a=n(8366),o=n(2291);class s{static create(){const e=new r.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 n=(0,a.createDefModel)("Box");return n.userData.normal={type:"MySpriteMaterial"},n.material=e.material,s.modelTools.merge(e,n),n},parseData:(e,t)=>{const n=(0,a.createDefModel)("Sprite");var r=e.userData.layers;return(0,a.setLayers)(n,r),s.modelTools.merge(e,n),n.material=e.material,n}},s.tools={type:"SpriteMaterial",getTextures:function(e){return["map","alphaMap"].map((t=>{var n=e[t];if(n)return{type:t,texture:n}})).filter((e=>e))},parseData:e=>{const{textures:t,material:n}=e,r=(0,i.mergeMaterial)(n,s.create());var{depthWrite:e,depthTest:a,name:o}=n.userData.normal;return void 0!==e&&(r.depthWrite=e),void 0!==a&&(r.depthTest=a),o&&(r.name=o),t.map((e=>{var{type:e,texture:t}=e;r[e]=t})),r},toNormal:e=>{const t=(0,i.mergeMaterial)(e,(0,i.createDefMaterial)()),n=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&&(n.normal.depthWrite=e.depthWrite),e.depthTest!==i.defBaseMaterialMap.depthTest&&(n.normal.depthTest=e.depthTest),t.userData=n,t},clone:(e,t)=>e,copy:function(e){const t=e.clone();return t.userData.tools=s.tools,t}}},7263:(e,t,n)=>{"use strict";n.d(t,{Ju:()=>a,t9:()=>i,zf:()=>o});var r=n(2291);const i={isDynamic:()=>{}},a={isDeleted(e,t=!1){var n;return!!e&&(!(null==(n=null==e?void 0:e.userData)||!n.isDeleted)||!!t&&a.isDeleted(e.parent,t))},setDeleted(e,t){e.userData&&(t?(0,r.M)(e,"isDeleted",!0):null!=(t=null==e?void 0:e.userData)&&delete t.isDeleted)}},o={setLock(e){(0,r.M)(e,"lock",!0)},reLock(e){delete e.userData.lock},isLock(e,t=!1){if(!e||"Scene"===e.type)return!1;var n=e.userData.lock;return t?!!n||o.isLock(e.parent,t):void 0!==n&&n}}},8366:(e,t,n)=>{"use strict";n.r(t),n.d(t,{createDefModel:()=>O,createSpecialModel:()=>P,default:()=>D,delClonedModel:()=>W,deletedModel:()=>T.Ju,disposeModel:()=>R,dynamicModel:()=>T.t9,getClonedIdModel:()=>V,getDeepModels:()=>N,getIdMapByModel:()=>te,getModelSize:()=>Q,hasSkeleton:()=>j,helperModel:()=>$,instanceModel:()=>I,isDynamicModel:()=>z,isGLowModel:()=>K,isGroup:()=>X,isHelper:()=>U,isSprite:()=>Z,lockModel:()=>T.zf,mergeModel:()=>k,normalModel:()=>q,selectableModel:()=>Y,setClonedModel:()=>J,setDynamicModel:()=>H,setHelper:()=>F,setLayers:()=>G,tempModel:()=>ne,uselessGroup:()=>ee,withAnima:()=>L}),t=n(4356);var r=n.n(t),i=n(9716),a=n(2081),o=n(8881);function s(e){for(var t,n,r,i=0,a=0;a<e.length;++a){var s=e[a];if(s.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if((t=void 0===t?s.array.constructor:t)!==s.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if((n=void 0===n?s.itemSize:n)!==s.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if((r=void 0===r?s.normalized:r)!==s.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;i+=s.array.length}for(var l=new t(i),u=0,c=0;c<e.length;++c)l.set(e[c].array,u),u+=e[c].array.length;return new o.BufferAttribute(l,n,r)}var l=n(1819);const u=["Group","Box","Circle","Cylinder","Dodecahedron","Icosahedron","Lathe","Octahedron","Plane","Ring","Sphere","Sprite","Tetrahedron","Torus","TorusKnot","Tube","Reflector"];var c=n(5259),h=n(2016),d=n(6999),f=n(3352),p=n(5105),m=n(8953),v=n(2291);class g extends n(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}}var y=n(9593),b=n(5860);class x extends n(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=n(986),S=n(1682),M=n(5244);class _{constructor(e){this.runScene=e}init(){this.bindEvent()}bindEvent(){}}var B=n(9835);class C{constructor(e){this.data=this.getData(),this.nodeType={MySpriteMaterial:p.Z},this.mount=e=>{e.core.module.set("model",this)},this.complete=()=>{this.data=this.getData()},this.loadNodeDef=e=>{let{node:t,nodeDef:n}=e;(0,a.js)(this.runScene.modelEx.defNodeMap,((e,r)=>{var i=n[e];null!=i&&(t[e]=i)})),n.wireframe&&(t.material.wireframe=!0)},this.load=e=>{var{data:e,core:t}=e;return this.loadNodeDef(e),this.loadExtras(e,t),e.node},this.done=()=>{this.removeHelperModel()},this.afterParse=e=>{var{config:e,data:t,json:n}=e;if("model"===n.asset.ex.type){if(null==(n=e.module)||!n.model)return[];t="glb_model"===(n=(e=t.options).models[0]).name&&(null==n?void 0:n.children[0])||n,ee.is(t)&&t.children,this.mergeClone()}},this.runScene=e}getData(){return{map:new c.Z,clonedMap:{},instancedMap:{},helperModels:[]}}getMap(){return new c.Z({loadNode:this.load,loadedGltf:this.done,afterParse:this.afterParse,complete:this.complete,mountModule:this.mount})}loadExtras(e,t){let{node:n,nodeDef:r}=e;if(r.extras){const{layers:s,normal:l,local:u,cloneId:c,id:h,animations:d,isDynamic:f}=r.extras;var i,a=z(n,!0);if("running"!==this.runScene.optionsEx.options.mode||a||null!=(o=this.runScene.optionsEx.options.renderConfig)&&o.matrixAutoUpdate||(n.matrixAutoUpdate=!1),d&&(n.animations=B.B.parse(d)),f&&(n.userData.isDynamic=!0),!c||a||(this.data.instancedMap[c]||(this.data.instancedMap[c]=new Set),this.data.instancedMap[c].add(n)),u&&([o,a,i]=u.split(","),n.position.set(o,a,i)),s&&(n.layers.enable(1),this.runScene.cb.model.setLayers.cb({model:n,val:1})),r.extras.isHelper&&this.data.helperModels.push(n),l){const t=this.nodeType[null==l?void 0:l.type];e.node=t.modelTools.parseData(n,l)}h&&this.data.map.set(h,e.node);var o=null==(i=null==(a=null==(o=e.node)?void 0:o.material)?void 0:a.userData)?void 0:i.id;if(o){const n=t.module.get("material").data.materialIns[o];n&&n.models.push(e.node)}}}removeHelperModel(){this.data.helperModels.map((e=>{var t;return null==(t=e.parent)?void 0:t.remove(e)}))}mergeClone(){var e;this.runScene.optionsEx.options.instanceClone&&"running"===this.runScene.optionsEx.options.mode&&(this.runScene.assetsEx.scene.updateMatrixWorld(),e=this.data.instancedMap,(0,a.js)(e,((e,t)=>{var n,r=this.runScene.uniqueEx.model.map[e];t.size<2||!r||!r.geometry||z(r,!0)||(n=I(r,[...t]),this.runScene.modelEx.add(n,void 0,{isClone:!1,select:!1,addUndo:!1}),K(r)&&this.runScene.modelEx.setGlow(n,!0),this.runScene.modelEx.remove(r,!1),t.forEach((e=>this.runScene.modelEx.remove(e,!1))),t.clear(),delete this.data.instancedMap[e])}))),this.data.instancedMap={}}mergeGeometry(){}}var E=n(5613);var T=n(7263);class D{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.clean=()=>{this.reset()},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,n,r)=>{var{addUndo:i,isClone:a,select:o,addToTree:s}=(0,E.mergeObject)({addUndo:!0,isClone:!1,select:!1,addToTree:!0},r);return t instanceof Array?t.map((e=>this.add(e,n,r))):(e(t,a),this.setGeometryMap(t),this.setCloneMap(t),s=new g({model:t,parent:n||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,n=!0)=>{if(!e.lightEx.isLight(t)){var r,i,o,s=j(t),l=(e=>{const t={};return(0,E.getModelMap)(e,"id",(e=>{0<e.animations.length&&(t[(0,M.K)(e)]=e.animations)})),t})(t),u=(s=s?function(e){var t=new Map,n=new Map,r=e.clone();return function e(t,n,r){r(t,n);for(var i=0;i<t.children.length;i++)e(t.children[i],n.children[i],r)}(e,r,(function(e,r){t.set(r,e),n.set(e,r)})),r.traverse((function(e){var r,i;e.isSkinnedMesh&&(i=(r=t.get(e)).skeleton.bones,e.skeleton=r.skeleton.clone(),e.bindMatrix.copy(r.bindMatrix),e.skeleton.bones=i.map((function(e){return n.get(e)})),e.bind(e.skeleton,e.bindMatrix))})),r}(t):t.clone(),u=t,(0,v.M)(s,"cloneId",V(u)||u.userData.id),(0,v.is)(t,"isDynamic")&&H(s,!0),(0,E.getModelMap)(s,"id"));c=s,null!=(i=null==(o=null==(r=t)?void 0:r.material)?void 0:o.userData)&&i.tools&&(i=null==(i=o.userData.tools)?void 0:i.clone(o,c))&&i.uuid!==o.uuid&&(e.materialEx.resetMaterial(c,i,{addUndo:!0}),e.materialEx.add(i,r,o));{const{animaMap:e,newModelMap:t}={newModelMap:u,animaMap:l};(0,a.js)(e,((e,n)=>{const r=t[e];r&&(r.animations=[...n.map((e=>e.clone()))])}))}return n&&e.uniqueEx.model.add(s,{reset:!0,hasReset:!0}),s}var c=t;c=e.lightEx.clone(c),console.log(c,"models")})(e),this.runScene.cb.clean.add("EngineModel",this.clean),this.export=new _(e),this.import=new C(e),this.runScene.cb.loaderer.gltf.getArrayBuffer.add("EngineModel",(()=>{this.selectNull()}))}get select(){return this._selectModel}set select(e){this.setSelectByModel(e)}init(){var e={name:"node",loadCallBacks:this.import.getMap(),exportCallBacks:new c.Z};this.runScene.exporter.gltf.module.bind(e)}setGeometryMap(e){if((0,E.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:n,uv:r}=e.attributes,{normal:t,position:i,uv:a}=t.attributes;return e.array.length===t.array.length&&n.array.length===i.array.length&&r.array.length===a.array.length&&(e=(0,E.sameArr)([...e.array],[...t.array],20),t=(0,E.sameArr)([...n.array],[...i.array],20),n=(0,E.sameArr)([...r.array],[...a.array],20),e&&t&&n)}getClonedIdFromModel(e){if(e.geometry){for(const e of this.clonedMap){const[n,r]=e;if(0!==r.size){var t=r.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 n}}this.clonedMap.map(((e,t)=>{t.size}))}}setCloneMap(e){if((0,E.validType)(e,"array"))return e.map((e=>this.setGeometryMap(e)));var t=V(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=V(t)||(0,M.K)(t);const n=this.clonedMap.get(t);n&&0!==n.size&&(e.userData.id=t,n.map((t=>{if(t=this.runScene.modelEx.getById(t)){var{position:n,rotation:r,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(n),s.rotation.copy(r),s.scale.copy(i),s.name=a,this.add(s,o,{addUndo:!1,isClone:!0,select:!1})}})))}replaceGeometry(e,t){t=t.uuid;const n=this.geometryMap.get(t);n&&0!==n.size&&(n.forEach((t=>{const n=this.runScene.uniqueEx.model.get(t);n&&(n.geometry=e,n.updateMatrix())})),this.geometryMap.delete(t),this.geometryMap.set(e.uuid,n))}setSelectByModel(e,t){this.runScene.optionsEx.log([e,"选中的模型",(0,M.K)(e)],"detail");var{isDomTreeActive:t,isClone:n}=t||{};if(this.runScene.events.key.ctrl&&!n)this.runScene.multipSelector.add(e);else{if(this.runScene.multipSelector.isEmpty()||this.runScene.multipSelector.setEmpty(),this._selectModel){if(this._selectModel===e)return void(this.runScene.helperEx.focusModelId||this.runScene.helperEx.focus(e));this.runScene.lightEx.setNull(this._selectModel),this.runScene.cb.model.unFocus.cb(this._selectModel)}e&&(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).isCamera||(this.runScene.helperEx.focus(e),this.runScene.lightEx.setSelect(e)))}}setSelectById(e){(e=this.runScene.uniqueEx.model.get(e))&&this.setSelectByModel(e)}remove(e,t=!0){let n=[];Array.isArray(e)?n.push(...e):n.push(e),e=n.map((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:n,z:r}=e;return e+n+r===t}isNavieV2(e,t=0){var{x:e,y:n}=e;return e===t&&n===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&&!L(e)}create(){return r().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,n=!0){if(t=new w({oldParent:e.parent,newParent:t,target:e,runScene:this.runScene}).execute(),!n)return t;this.runScene.undoEx.addUndo(t)}_setV3(e){const{model:t,info:n,newV3:r}=e;if(Array.isArray(t))return t.map((e=>{e[n].set(r.x,r.y,r.z),e.updateMatrix()}));t[n].set(r.x,r.y,r.z),t.updateMatrix()}update(e){if(Array.isArray(e))return e.map((e=>e.updateMatrix()));e.updateMatrix()}setV3(e,t=!0,n=!0){let{model:r,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,E.isRunning)(this.runScene))return this._setV3(e);var c=r instanceof Array?r.map((e=>new S.Z({target:e,info:i,runScene:this.runScene,oldV3:s||e[i].clone(),newV3:a}).execute(n))):new S.Z({target:r,info:i,oldV3:s||r[i].clone(),newV3:a,runScene:this.runScene}).execute(n);t&&this.runScene.undoEx.addUndo(c)}setNormal(e,t=!0){const{model:n,oldVal:r,info:i,val:a,executeCb:o}=e;return e=n instanceof Array?n.map((e=>new b.Z({target:e,info:i,runScene:this.runScene,oldVal:r||n[i],newVal:a,executeCb:o}).execute())):new b.Z({target:n,info:i,runScene:this.runScene,oldVal:r||n[i],newVal:a,executeCb:o}).execute(),t&&this.runScene.undoEx.addUndo(e),e}setMaterial(e,t,n=!0){var r=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,n&&this.runScene.undoEx.addUndo(r)}addDef(e){this.add(O(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 n=this.getIndexByModel(e);if(t=this.getIndexByModel(t),-1!==n&&-1!==t){const r=Math.max(n,t),i=n===r?t:n;return e.parent.children.map(((e,t)=>t>i&&t<r&&e)).filter((e=>e))}}}setMultip(e){var{model:e,typeList:t,newVal:n}=e;this.runScene.undoEx.addUndo(new y.Z({target:e,typeList:t,newVal:n}).execute())}createGroup(e,t,n){const r=t||new o.Group,i=[];i.push(new g({model:r,runScene:this.runScene,parent:n||this.runScene.assetsEx.get().scene}).execute()),e instanceof Array?i.push(...e.map((e=>new w({target:e,oldParent:e.parent,newParent:r,runScene:this.runScene}).execute()))):i.push(new w({target:e,oldParent:e.parent,newParent:r,runScene:this.runScene}).execute()),n&&this.runScene.cb.model.setOpen.cb({isOpen:!0,model:n}),this.runScene.cb.model.setOpen.cb({isOpen:!0,model:r}),this.runScene.cb.model.setMainStatue.cb({status:!0,model:r}),this.runScene.undoEx.addUndo(i),this.setSelectByModel(r)}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 n=[],r=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 n.push(...r.map((e=>e.execute()))),n.push(new A.Z({runScene:this.runScene,model:e,parent:e.parent}).execute()),t&&this.runScene.undoEx.addUndo(n),n}}hideOther(e){const t=e.uuid,n=0<e.children.length,i=this.runScene.sceneEx.getClearModels(),a=[];i.map((i=>{i.traverse((i=>{n?!1===r().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),r().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 n=t.map((e=>new b.Z({target:e,info:"visible",runScene:this.runScene,newVal:!0,oldVal:e.visible}).execute()));this.runScene.undoEx.addUndo(n)}removeHide(){const e=this.runScene.sceneEx.getClearModels(),t=new Set,n=[];e.map((e=>{e.traverse((e=>{e.visible||t.add(e)}))})),t.forEach((e=>{n.push(new A.Z({runScene:this.runScene,model:e,parent:e.parent}).execute())})),this.runScene.undoEx.addUndo(n)}_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,n=!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(n){if(0===(e=s.filter((e=>r().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:n}=this.runScene.assetsEx.camera.position,{x:r,y:i,z:a}=this.runScene.assetsEx.controls.target;return{cx:e,cy:t,cz:n,tx:r,ty:i,tz:a}}camAnima(e,t,n=1,r,i){return(0,E.anima)(e,t,n,(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=>{r&&r()}))}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:n,renderer:r,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=r.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(n.position,s),u.projectOnPlane(new o.Vector3(0,1,0)),u.normalize(),1<t&&(t=1/t),l=2*Math.tan(.5*n.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 r=new o.Vector3;r.subVectors(n.position,s),r.projectOnPlane(new o.Vector3(0,1,0)),r.normalize(),a.addVectors(s,r.multiplyScalar(3))}(0,E.anima)({positionX:n.position.x,positionY:n.position.y,positionZ:n.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=>{n.position.set(e.positionX,e.positionY,e.positionZ),n.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={},n=Array.isArray(e)?e:[e],r=[];n.map((e=>{e.traverse((e=>{var n;e.geometry&&!z(e)&&(n=V(e))&&(r.push(e),t[n]||(t[n]=new Set),t[n].add(e))}))})),(0,a.js)(t,((e,t)=>{e=this.runScene.uniqueEx.model.get(e),t.size<2||!e||(t=I(e,[...t]),this.runScene.modelEx.add(t,void 0,{isClone:!1,select:!1,addUndo:!1}),K(e)&&this.setGlow(t,!0),this.runScene.modelEx.remove(e,!1))})),r.map((e=>{this.runScene.modelEx.remove(e,!1)}))}reset(){const e=this.runScene.sceneEx.getClearModels();let t=[];e.map((e=>e.traverse((e=>t.push(e))))),t.map((e=>{R(e,{remove:!1}),this.runScene.cb.model.dispose.cb(e)})),this.runScene.modelEx.selectNull(),this.geometryMap.clear()}getHoverFromModels(e,t,n){const{getOriginData:r,ignoreMove:i}=(0,E.mergeObject)({ignoreMove:!1,getOriginData:!1},n);this.runScene.cb.events.pointer.move.add("get-hover-from-models",(n=>{if(i||!this.runScene.events.mouse.isMove){const i=new o.Raycaster,u=new o.Vector2;var{engineDom:a,camera:s}=this.runScene.assetsEx.get(),l=n.pageX-a.offsetLeft;n=n.pageY-a.offsetTop,u.x=l/a.clientWidth*2-1,u.y=-n/a.clientHeight*2+1,i.setFromCamera(u,s);const c=i.intersectObjects(e||[],!0);null!=t&&t(0===c.length?null:r?c:c.map((e=>e.object)))}}))}}const P=e=>{},O=e=>{if(u.includes(e)){const t=r().model.getModelByType(e);return"Sprite"===t.type&&(t.material.userData.tools=p.Z.tools),t}throw TypeError("")},R=(e,t)=>{t=(t||{}).remove;const{geometry:n,material:r}=e;n&&(null!=n&&n.dispose(),delete e.geometry),r&&((0,m.disposeMaterial)(e.material),e.material.dispose(),delete e.material),!1!==t&&e.parent&&e.parent.remove(e)},I=(e,t)=>{var{material:n,geometry:r}=e;const i=new d.Z.InstancedMesh(r,n,t.length+1);return[e,...t].map(((e,t)=>{e.updateMatrix(),i.setMatrixAt(t,e.matrixWorld)})),i.name=e.name,i},k=(e,t)=>{const n=[];if(t.map((e=>{e=e.geometry,n.push(e)})),t=function(e,t){for(var n,r,i=1<arguments.length&&void 0!==t&&t,a=null!==e[0].index,l=new Set(Object.keys(e[0].attributes)),u=new Set(Object.keys(e[0].morphAttributes)),c={},h={},d=e[0].morphTargetsRelative,f=new o.BufferGeometry,p=0,m=0;m<e.length;++m){var v,g,y=e[m],b=0;if(a!=(null!==y.index))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+m+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(v in y.attributes){if(!l.has(v))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+m+'. All geometries must have compatible attributes; make sure "'+v+'" attribute exists among all geometries, or in none of them.'),null;void 0===c[v]&&(c[v]=[]),c[v].push(y.attributes[v]),b++}if(b!==l.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+m+". Make sure all geometries have the same number of attributes."),null;if(d!==y.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+m+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(g in y.morphAttributes){if(!u.has(g))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+m+". .morphAttributes must be consistent throughout all geometries."),null;void 0===h[g]&&(h[g]=[]),h[g].push(y.morphAttributes[g])}if(f.userData.mergedUserData=f.userData.mergedUserData||[],f.userData.mergedUserData.push(y.userData),i){var x=void 0;if(a)x=y.index.count;else{if(void 0===y.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+m+". The geometry must have either an index or a position attribute"),null;x=y.attributes.position.count}f.addGroup(p,x,m),p+=x}}if(a){for(var w=0,A=[],S=0;S<e.length;++S){for(var M=e[S].index,_=0;_<M.count;++_)A.push(M.getX(_)+w);w+=e[S].attributes.position.count}f.setIndex(A)}for(n in c){var B=s(c[n]);if(!B)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+n+" attribute."),null;f.setAttribute(n,B)}for(r in h){var C=h[r][0].length;if(0===C)break;f.morphAttributes=f.morphAttributes||{},f.morphAttributes[r]=[];for(var E=0;E<C;++E){for(var T=[],D=0;D<h[r].length;++D)T.push(h[r][D][E]);var P=s(T);if(!P)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+r+" morphAttribute."),null;f.morphAttributes[r].push(P)}}return f}(n),t)return new d.Z.Mesh(t,e)},L=e=>0!==e.animations.length,F=e=>{e&&e.userData&&(e.userData.isHelper=!0)},U=e=>null==(e=null==e?void 0:e.userData)?void 0:e.isHelper,G=(e,t)=>{null!=t&&(0===t?e.layers.set(0):e.layers.enable(1),(0,v.M)(e,"layers",t))},N=e=>{const t=[];e.traverse((e=>{t.push(e)}))},j=e=>{let t=!1;if(e)return e.traverse((e=>{e.isSkinnedMesh&&(t=!0)})),t},H=(e,t)=>{t?(0,v.M)(e,"isDynamic",!0):delete e.userData.isDynamic},z=(e,t)=>e&&t?!!e.userData.isDynamic||!!e.parent&&z(e.parent,t):null==(t=null==e?void 0:e.userData)?void 0:t.isDynamic,V=e=>e.userData.cloneId,J=(e,t)=>{(0,v.M)(e,"cloneId",t)},W=e=>{delete e.userData.cloneId},K=e=>1===e.userData.layers,Z=e=>e.isSprite,X=e=>{},Q=e=>{var t=new o.Vector3;return(new o.Box3).setFromObject(e).getSize(t),t},Y={open(e){delete e.userData.unSelectable},close(e){e.userData.unSelectable=!0},is:e=>void 0===e.userData.unSelectable},q={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)},$={is:e=>null==(e=null==e?void 0:e.userData)?void 0:e.isHelper,set(e){e.userData.isHelper=!0}},ee={is:e=>null==(e=null==e?void 0:e.userData)?void 0:e.uselessGroup,set(e,t){t?e.userData.uselessGroup=!0:delete e.userData.uselessGroup}},te=(e,t)=>{let n=[];Array.isArray(e)?n.push(...e):n.push(e);const r={};return n.map((e=>e.traverse((e=>{null!=t&&t(e),r[(0,M.K)(e)]=e})))),r},ne={is:e=>!(null==(e=null==e?void 0:e.userData)||!e.isTemp),set(e,t){t?e.userData.isTemp=t:delete e.userData.isTemp}}},8266:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i,s:()=>a});var r=n(8881);class i{constructor(e){this.setSize=(e,t)=>{var{width:n,height:r}=this.getDomSize();this.runScene.setSize(e||n,t||r)},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 r.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=r.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()}},2291:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>v,bv:()=>x,is:()=>b,M:()=>g});var r=n(8881),i=n(5259),a=n(1736);class o{constructor(e){this.mount=e=>{e.core.module.set("scene",this)},this.parse={before:e=>{var t,n,r,i,a,{json:e,config:o,core:s}=e;"scene"===e.asset.ex.type&&(({camera:e,lights:t,options:n,controls:r,tags:i,objects:a}=e.asset.ex),this.parse.camera(e,o),this.parse.light(t,o,s),this.parse.controls(r,o),o.module.tags&&this.runScene.tags.parseJSON(i||{}),this.parse.options(n),a&&this.runScene.objects.parseJSON(a))},after:e=>{const{core:t,json:n,data:r,config:i}=e;if("scene"===n.asset.ex.type){var{options:e,json:a}=r;if(e=e.models,!t.loadConfig.module.model)return[];const o=e[0];if(t.module.get("model").data.map.map(((e,t)=>{this.runScene.uniqueEx.model.add(t)})),e=o.children.filter((e=>this.runScene.modelEx.isUnless(e)?void 0:e)),1===e.length){const[t]=e;t.animations=[...t.animations,...a.animations]}t.callback("loaded",""),this.runScene.optionsEx.sceneOptions.loaded=!0,this.parse.scene(n,i,t),t.models.push(...e)}},controls:(e,t)=>{var n;t.module.controls||(({x:t,y:e,z:n}=e),this.runScene.assetsEx.controls.target.set(t,e,n),this.runScene.assetsEx.controls.update())},camera:(e,t)=>{if(t.module.camera){var{position:t,far:e,near:n,fov:r,name:i,userData:a}=this.runScene.loaderer.object.parse(e);const o=this.runScene.assetsEx.get().camera;o.position.copy(t),o.far=e,o.near=n,o.fov=r,o.name=i,o.updateProjectionMatrix(),o.userData.id=a.id,this.runScene.uniqueEx.model.add(o),this.runScene.assetsEx.get().controls.update()}},light:(e,t,n)=>{if(t.module.light){const t=[];e.map((e=>{var n=e.type;t.push(...this.runScene.lightEx.lightExMap[n].parseJSON(e))})),n.models.push(...t)}},scene:(e,t,n)=>{if(t.module.sceneConfig){const s=this.runScene.sceneEx.get();t=n.module.get("material").data.materialIns;var{materialId:n,backgroundMapping:e,backgroundColor:i,fog:o}=e.asset.ex.sceneEx;if(n&&(n=null==(t=t[n])?void 0:t.material)){const{map:t,envMap:r}=n;t&&(t.mapping=e||300,t.needsUpdate=!0,this.runScene.sceneEx.setBackground(t,!1),t.userData.isBackgroud=!0),r&&(s.environment=(0,a.setTextureMapping)(r))}if(i&&this.runScene.sceneEx.setBackground(new r.Color("#"+i)),o){var{color:t,far:n,near:e,show:i}=o;const a=new r.Fog("#"+t,e,n);i?(a.show=i,s.fog=a):this.runScene.sceneEx.oldFog=a,this.runScene.cb.setScene.cb({scene:s,type:"fog",val:a})}this.runScene.cb.setScene.cb({scene:s,type:"any",val:"any"})}},options:e=>{e.map((e=>{var{type:e,data:t}=e;const n=this.runScene.exporter.gltf.options.getParse(e);null!=n&&n.parse(t)}))}},this.toJSON=()=>{},this.runScene=e}init(){this.bindEvent()}bindEvent(){var e={name:"sceneConfig",loadCallBacks:new i.Z({beforeParse:this.parse.before,afterParse:this.parse.after,mountModule:this.mount}),exportCallBacks:new i.Z};this.runScene.exporter.gltf.module.bind(e)}}var s=n(4547),l=n(9716),u=n(8953),c=n(8366),h=n(8266),d=n(9593),f=n(5860),p=n(986),m=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function o(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(o,s)}l((r=r.apply(e,t||[])).next())}))};class v{constructor(e){this.oldFog=null,this.removeMap={light:{valid:e=>this.runScene.lightEx.isLight(e),remove:e=>this.runScene.lightEx.remove(e)}},this.clean=()=>{this.cleanSceneInfo(this.get()),this.cleanNormal()},this.runScene=e,this.exportAndImport=new o(e),this.runScene.cb.clean.add("EngineScene",this.clean)}init(){this.exportAndImport.init()}each(e){return this.runScene.assetsEx.get().scene.traverseAncestors(e)}get(){return new Proxy(this.runScene.assetsEx.get().scene,{set:(e,t,n)=>(e[t]=n,!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 n in this.removeMap){const{valid:r,remove:i}=this.removeMap[n];if(r(e))return t.push(...(0,l.multiArrToArr)(i(e)))}t.push(new p.Z({model:e,runScene:this.runScene,parent:e.parent}).execute())})),this.runScene.undoEx.addUndo(t),t}for(const t in this.removeMap){const{valid:n,remove:r}=this.removeMap[t];if(n(e))return r(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 r.Group;return e.children.filter((e=>!this.runScene.helperEx.isHelper(e)&&!this.runScene.lightEx.isLight(e)&&c.normalModel.is(e))).map((e=>{const n=e.clone();(0,c.withAnima)(e)&&(n.animations=[...e.animations]),t.add(n)})),this.runScene.helperEx.setHelper(t),this.cleanUnlessLevel(t)}cleanNormal(){this.getNromal().map((e=>this.remove(e)))}cleanSceneInfo(e){this.setBackground(null),this.setEnv(null),e.fog=null,this.runScene.cb.setScene.cb({scene:e,type:"any",val:null})}setBackground(e,t=!0){return m(this,void 0,void 0,(function*(){e instanceof String&&(e=yield this.runScene.textureEx.load(e)),(0,a.isTexture)(e)&&(e.userData.isBackgroud=!0);var n=this.get(),r=new f.Z({target:n,info:"background",newVal:e,oldVal:n.background,runScene:this.runScene,cb:e=>{}}).execute();return t&&this.runScene.undoEx.addUndo(r),this.runScene.cb.setScene.cb({scene:n,type:"background",val:n.background}),e}))}isBackground(e){return e.userData.isBackgroud}dispose(){const{renderer:e,controls:t}=this.runScene.assetsEx.get();this.clean(),(0,h.s)(e),t.dispose(),this.runScene.pp.dispose(),r.Cache.clear()}render(){}create(){return new r.Scene}setEnv(e){return m(this,void 0,void 0,(function*(){var t=this.runScene.assetsEx.scene;let n;return e instanceof String&&(n=yield this.runScene.textureEx.load(e)),e instanceof File&&(n=yield this.runScene.textureEx.parse(e)),n=(n=null!=e&&e.isTexture?this.runScene.textureEx.clone(e):n)&&(0,a.setTextureMapping)(n),this.setNormal({model:t,info:"environment",val:n}),this.runScene.cb.setScene.cb({scene:t,type:"environment",val:n}),n}))}setNormal(e,t=!0){var{model:e,info:n,val:r}=e;e=new f.Z({target:e,info:n,oldVal:e[n],newVal:r,runScene:this.runScene}).execute(),t&&this.runScene.undoEx.addUndo(e)}setFogShow(e){var t=this.runScene.assetsEx.scene,{show:e,color:n}=e;if(e){let e=this.oldFog||new r.Fog(n||"#ffffff");e.show=!0,this.setNormal({model:t,info:"fog",val:e})}else this.oldFog=t.fog,this.setNormal({model:t,info:"fog",val:null}),this.oldFog.show=!1;this.runScene.cb.setScene.cb({scene:t,type:"fog",val:t.fog})}setFog(e){var t=this.runScene.assetsEx.scene,{type:e,val:n,cb:r}=e;t=new d.Z({target:t,typeList:["fog",e],newVal:n,cb:r}).execute(),this.runScene.undoEx.addUndo(t)}sreenShotDefFile(e,t){e=e||Number(prompt("请输入截图的宽"))||1920,t=t||Number(prompt("请输入截图的高"))||1080;var{width:n,height:r}=(this.runScene.helperEx.unfocus(),this.runScene.renderEx.getDomSize());const i=this.runScene.assetsEx.get().renderer.domElement;return this.runScene.pp.setSize(e,t),this.runScene.renderEx.setSize(e,t),this.runScene.pp.update(),e=i.toDataURL("image/png",1),t=(0,s.base64ToFile)(e,"screenShot.png"),this.runScene.pp.setSize(n,r),this.runScene.renderEx.setSize(),this.runScene.pp.update(),t}static toJSON(e,t){const n={};let r=!1,i=e.fog;return i?r=!0:i=t.sceneEx.oldFog,console.log(i,"fog"),i&&(n.fog=y(i,r)),(0,u.isColor)(e.background)&&(n.backgroundColor=e.background.getHexString()),n}setEnvStrength(e){this.runScene.uniqueEx.material.each((t=>{void 0!==t.envMapIntensity&&(console.log(t,"m"),t.envMapIntensity=e,(0,u.updateMaterial)(t))}))}}const g=(e,t,n)=>{e.userData[t]=n},y=(e,t)=>{const{color:n,far:r,near:i}=e;return{color:n.getHexString(),show:t,far:r,near:i}},b=(e,t)=>(null==(e=null==e?void 0:e.userData)?void 0:e[t])||"",x=(e,t)=>{delete e.userData[t]}},1736:(e,t,n)=>{"use strict";n.r(t),n.d(t,{bindTextureBaseData:()=>w,default:()=>v,disposeTexture:()=>x,getBlobByTexture:()=>A,getCloneIdFromTexture:()=>P,getMimeByTexture:()=>y,getSizeByTexture:()=>E,getTextureGpuMemory:()=>b,getTextureMinFilter:()=>k,getUrlByTexture:()=>B,initTexture:()=>S,isClonedTexture:()=>D,isTexture:()=>T,loadTexture:()=>_,parseImageBitMapByBlob:()=>M,setTextureCloneId:()=>O,setTextureMapping:()=>C,setTextureMinFilter:()=>I,textureNameMap:()=>g,updateTexture:()=>R});var r=n(2081),i=n(9728),a=n(8881),o=n(6999),s=n(6214),l=n(5613),u=n(5244),c=n(5860);class h extends n(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=n(8953),p=n(2291),m=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function o(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(o,s)}l((r=r.apply(e,t||[])).next())}))};class v{constructor(e){this.allTextures=new Set,this.setAnima=e=>{const{texture:t,type:n,val:r}=e,i=t.userData.uvScript||{};t.userData.uvScript||(t.userData.uvScript=i),0===r?delete i[n]:i[n]=r,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 n=yield(0,l.urlToBlob)(e);return this.parse(n,t)}))}parse(e,t){return m(this,void 0,void 0,(function*(){t=(0,l.mergeObject)({flipY:!0},t);var n="Blob"===(0,l.getType)(e)?e:yield(0,l.fileToBlob)(e);return this.afterLoad(yield _(n,t),n)}))}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 r in this.runScene.uniqueEx.texture.map){var n=this.runScene.uniqueEx.texture.get(r);if(n.userData.md5===e&&n.mapping===t.mapping)return n}}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 n;n=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,r.js)(i,((r,i)=>{const a=this.runScene.uniqueEx.material.get(r);a&&i.forEach((r=>{t.push(new s.Z({target:a,info:r,newVal:n,oldVal:e,runScene:this.runScene}).execute())}))})),this.runScene.undoEx.addUndo(t)}}))}remove(e){const t=(0,u.K)(e);var n=this.runScene.uniqueEx.texture.map[t];if(n){const i=[];n=n.materialMap,(0,r.js)(n,((e,t)=>{const n=this.runScene.uniqueEx.material.get(e);n&&(t.forEach((e=>{i.push(new c.Z({target:n,info:e,oldVal:n[e],newVal:null,runScene:this.runScene,cb(){(0,f.updateMaterial)(n)}}).execute())})),(0,f.updateMaterial)(n))}));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:n}=yield(0,l.reverseImageBitMap)(e.image);const i=new a.Texture(n);return i.needsUpdate=!0,n=this.runScene.uniqueEx.texture.map[e.userData.id],(0,r.js)(n.materialMap,((e,t)=>{const n=this.runScene.uniqueEx.material.get(e);t.forEach((e=>{n[e]=i,this.runScene.uniqueEx.texture.addMaterial(i,{material:n,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,n;e&&(t=e.image,n=e.userData.url,t instanceof ImageBitmap?(0,l.disposeImageBitMap)(t):t instanceof HTMLCanvasElement&&(0,l.disposeCanvas)(t),URL.revokeObjectURL(n),e.dispose())},w=(e,t)=>m(void 0,void 0,void 0,(function*(){var n=(0,l.isBlob)(e.userData.blob)?e.userData.blob:null;const r=t||n||(yield A(e));e.userData.blob=r;var{md5:n,url:i}=e.userData;return n||(e.userData.md5=(0,l.getMd5)(yield r.arrayBuffer())),i||(e.userData.url=URL.createObjectURL(r)),e.userData.gm=b(e),e.format=e.userData.format||-1!==r.type.indexOf("png")?1023:1022,e})),A=e=>(0,l.isBlob)(e.userData.blob)?e.userData.blob:(0,l.imgBitMapToBlob)(e.image),S=e=>(e.magFilter=1003,e.wrapS=o.Z.RepeatWrapping,e.wrapT=o.Z.RepeatWrapping,e.encoding=3e3,e.version=3,e.flipY=!1,"nearest"!==k(e)&&(e.minFilter=o.Z.LinearMipmapLinearFilter),e.needsUpdate=!0,e),M=(e,t)=>{let n={resizeQuality:"pixelated"};return null!=t&&t.flipY&&(n.imageOrientation="flipY"),createImageBitmap(e,n)},_=(e,t)=>m(void 0,void 0,void 0,(function*(){var n=yield M(e instanceof Blob?e:yield(0,l.urlToBlob)(e),t);return new a.Texture(n)})),B=e=>null==(e=e.userData)?void 0:e.url,C=(e,t="repeat")=>(e.mapping="repeat"===t?o.Z.EquirectangularReflectionMapping:300,e.needsUpdate=!0,e),E=e=>{var{width:e,height:t}=e.image;return{width:e,height:t}},T=e=>null==e?void 0:e.isTexture,D=e=>0<(null==(e=e.userData.cloneSourceId)?void 0:e.length),P=e=>e.userData.cloneSourceId,O=(e,t)=>{e.userData.cloneSourceId=t},R=e=>{e.needsUpdate=!0},I=(e,t)=>{e.minFilter=o.Z["linear"===t?"LinearMipmapLinearFilter":"NearestFilter"],(0,p.M)(e,"minFilter",t),R(e)},k=e=>(0,p.is)(e,"minFilter")},2266:(e,t,n)=>{"use strict";n.d(t,{ZP:()=>r,d9:()=>i});class r{constructor(e){this.undos=[],this.redos=[],this.dataMap={history:[],index:0},this.clean=()=>{this.reset()},this.runScene=e,this.runScene.cb.clean.add("Undo",this.clean)}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,n,r=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(n=i(e[t]),r[t]=n);return r}}},387:(e,t,n)=>{"use strict";n.d(t,{Z:()=>i});var r=n(3352);class i{constructor(e){this.addTree=!0,this.isClone=!1,this.cb=(e,t)=>{};var{model:e,parent:t,cb:n,addTree:r,isClone:i,runScene:a}=e;this.runScene=a,this.model=e,this.parent=t,!1===r&&(this.addTree=r),!0===i&&(this.isClone=i),n&&(this.cb=n)}remove(e){const{model:t,parent:n,addTree:r,runScene:i}=e;i.modelEx.select===t&&i.modelEx.selectNull(),n.remove(t),r&&i.uniqueEx.model.remove(t),r&&i.cb.model.remove.cb({model:t,parent:n}),this.cb(t,"remove"),i.uniqueEx.material.addModel(t,void 0,t.material)}add(e){const{model:t,parent:n,addTree:i,isClone:a,runScene:o}=e;n.add(t),i&&o.uniqueEx.model.add(t),i&&o.cb.model.add.cb({model:t,parent:n,isClone:a}),this.cb(t,"add"),o.uniqueEx.material.addModel(t,t.material),(0,r.RQ)(t)&&setTimeout((()=>{this.runScene.lightEx.update(t)}))}}},1981:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});class r{}},6214:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});var r=n(1643);class i extends n(1981).Z{constructor(e){super(),this.isUndoMaterial=!0,this.type="修改材质";var{target:e,info:t,newVal:n,oldVal:r,runScene:i,cb:a}=e;this.runScene=i,this.target=e,this.info=t,this.newVal=n,this.oldVal=r,this.cb=a}_execute(e,t){if(this.target[this.info]=e,this.target.needsUpdate=!0,r.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,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(9716),i=n(2081);class a extends n(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,r.lastArrayEle)(e.typeList)]}execute(){return this.redo(),this}_execute(e){const t=(0,i.qR)(this.target,this.typeList);t[(0,r.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,n)=>{"use strict";n.d(t,{Z:()=>i});class r extends n(1981).Z{constructor(e){super(),this.type="修改属性",this.isUndoNormal=!0,this.cb=e=>{};var{target:e,info:t,oldVal:n,newVal:r,runScene:i,cb:a,executeCb:o}=e;this.runScene=i,this.target=e,this.info=t,this.newVal=r,this.oldVal=n,a&&(this.cb=a),o&&(this.executeCb=o)}_execute(e){var{target:t,info:n}=this;if(this.executeCb)return this.executeCb({target:t,info:n,val:e});this.target[this.info]=e,"name"===this.info&&this.target.isObject3D?(t=this.runScene.uniqueEx.model.parseName(this.target),n=e,this.runScene.cb.model.changeName.cb({model:this.target,name:e=t||e,oldName:n})):"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=r},986:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});class r extends n(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,n)=>{"use strict";n.d(t,{Z:()=>i});class r extends n(1981).Z{constructor(e){super(),this.isUndoV3=!0,this.type="三维矩阵修改";var{target:e,info:t,newV3:n,oldV3:r,runScene:i}=e;this.target=e,this.info=t,this.runScene=i,this.newV3=n,this.oldV3=r,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=r},5244:(e,t,n)=>{"use strict";n.d(t,{Z:()=>p,K:()=>m});var r=n(2081),i=n(9728),a=n(2016),o=n(8953);class s{constructor(e){this.map={},this.removes=[],this.unique=e}add(e,t,n){if(null!=e&&e.userData&&!o.materialIgnore.is(e)){let r=e.userData.id;r||(r=(0,i.getId)(),e.userData.id=r),this.map[r]||(this.map[r]={material:e,models:new a.Z},this.unique.runScene.cb.unique.material.add.cb(e)),t&&this.addModel(t,e,n)}}addModel(e,t,n){n&&t&&m(n)===m(t)||(null!=t&&t.userData&&(t=m(t),null!=(t=this.map[t])&&t.models.add(e)),n&&null!=(t=this.map[m(n)])&&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}getModels(e){return null==(e=this.map[e])?void 0:e.models}remove(e){delete this.map[e]}addRemoved(e){this.map[e.uuid]&&this.removes.push(e.uuid)}dispose(){(0,r.js)(this.map,((e,t)=>{t.material.dispose()})),this.map={}}}var l=n(6001),u=n(3352),c=n(8366),h=n(7391);class d 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),l.type.isNumber(e)?Number.parseInt(e):-1)},t=(n,r)=>{var i=(t=>{if(-1===e(t))return t;var n=t.lastIndexOf("_");return-1===n?t:t.slice(0,n)})(n)+"_"+r++;return this.nameMap[i]?t(n,r):i},n=e=>Object.keys(this.nameMap).find((t=>this.nameMap[t]===e)),r=["PerspectiveCamera"];return i=>{if(r.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=n(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:n,hasReset:r}=t||{ignoreMaterial:!1};if(e instanceof Array)return e.map((e=>this.add(e,t)));if(e&&!(0,c.isHelper)(e)){let a=e.userData.id;if(a&&!n||(a=(0,i.getId)(),e.userData.id=a),this.map[a]){if(!(r||(0,h.An)(this.unique.runScene)&&(0,h.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||(0,u.RQ)(e)||(0,c.isHelper)(e)?a:this.add(e.children,t)}}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 n=t.toLowerCase();return n===(t=e.toLowerCase())||-1!==n.indexOf(t)}));return t=this.getIdByNames(t),this.getModelsWithIds(t)}}class f{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,n){var r;e=e.userData.id||this.add(e),t&&(({material:t,type:r}=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(r)),n&&(({material:t,type:r}=n),this.map[e].materialMap[t.userData.id]&&this.map[e].materialMap[t.userData.id].delete(r))}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,r.js)(t.materialMap,((e,t)=>{const n=this.unique.runScene.uniqueEx.material.get(e);n&&t.forEach((e=>{n[e]=null}))})),delete this.map[e.userData.id])}dispose(){(0,r.js)(this.map,((e,t)=>{t.texture.dispose()})),this.map={}}}class p{constructor(e){this.clean=()=>{this.dispose()},this.runScene=e,this.model=new d(this),this.material=new s(this),this.texture=new f(this),this.runScene.cb.clean.add("EngineModel",this.clean)}getId(e){return e.userData.id}dispose(){this.material.dispose(),this.model.dispose(),this.texture.dispose()}}const m=e=>(null==(e=null==e?void 0:e.userData)?void 0:e.id)||""},5613:(e,t,n)=>{"use strict";n.r(t),n.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:()=>r.Rd,blobToFile:()=>i.hl,bufferToArrayBuffer:()=>i.cO,canvasToBlob:()=>i._c,changeModelOpc:()=>a.Hg,changeModelOpcs:()=>a.Z7,clone:()=>i.d9,compressImgToUrl:()=>r.jH,deepMergeObject:()=>i.U,disposeCanvas:()=>r.eZ,disposeImageBitMap:()=>r.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,getColorByHex:()=>a.e9,getCurve:()=>a.kG,getDistance:()=>a.Sp,getEmptyImageData:()=>r.mH,getFilesByDataTransfer:()=>i.xl,getFilesFromFileList:()=>i.kk,getIdxInParent:()=>s,getImg:()=>r.Pk,getImgPixels:()=>r.BW,getImgPixels1:()=>r.Cm,getLine2:()=>a.SI,getMacro:()=>i.Ls,getMapByRgb:()=>i.fh,getMd5:()=>i.ZM,getModelMap:()=>a.yT,getNamesByNum:()=>i.nR,getOptions:()=>o.FW,getProgress:()=>i.xC,getRandomColor:()=>i.mr,getRes:()=>i.sR,getResultFromCanvas:()=>r.xK,getTime:()=>i.hK,getTruthBase64:()=>i.Mh,getType:()=>i.oL,getTypeByBase64:()=>i.Op,getTypeFromGlb:()=>o.te,getVideoTexture:()=>a.hX,getWorldLocal:()=>a.VU,hslToRgb:()=>r.ve,imgArrayBufferToBlobUrl:()=>r.lU,imgBitMapToBase64:()=>r.s4,imgBitMapToBlob:()=>r.gW,imgBitMapToBlobAndBase64:()=>r.v1,isBlob:()=>i.Lj,isDef:()=>i.Xq,isEditor:()=>o.hz,isEmpty:()=>i.xb,isRunning:()=>o.An,longestCommonPrefix:()=>i.GG,mergeObject:()=>i.Gm,removeUnLess:()=>a.hs,reverseImageBitMap:()=>r.Fs,reverseImg:()=>r.rx,rgbToHsl:()=>r.lC,rmArrEle:()=>i.J9,rmPartOfString:()=>i.h3,sameArr:()=>i.F1,strToNum:()=>i.LC,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 r=n(7179),i=n(5410),a=n(9960),o=n(7391);const s=e=>[...e.parentElement.children].findIndex((t=>t===e)),l=e=>{var{dom:e,beginIdx:t,endIdx:n}=e;return[...e.children].slice(t,n+1)}},7179:(e,t,n)=>{"use strict";n.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 r=n(6999),i=n(1736),a=n(5410),o=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function o(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(o,s)}l((r=r.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"),n=(t.width=e.width,t.height=e.height,t.getContext("2d"));n.translate(0,t.height),n.scale(1,-1),n.drawImage(e,0,0,t.width,t.height)},c=e=>o(void 0,void 0,void 0,(function*(){var t=e.image;const n=document.createElement("canvas"),r=(n.width=t.width,n.height=t.height,n.getContext("2d")),a=(0,i.getMimeByTexture)(e);return r.drawImage(t,0,0,n.width,n.height),new Promise((e=>{n.toBlob((t=>{e({blob:t,base64:n.toDataURL(a)})}),a)}))})),h=(e,t)=>URL.createObjectURL(new Blob([e],t)),d=(e,t)=>{const n=document.createElement("canvas"),r=n.getContext("2d");return n.width=e.width,n.height=e.height,r.drawImage(e,0,0,e.width,e.height),new Promise((e=>{n.toBlob((t=>{t&&e(URL.createObjectURL(t))}),"image/webp",t)}))},f=e=>o(void 0,void 0,void 0,(function*(){var{bitmap:t,texture:n}=e;const{ctx:i,canvas:o}=yield(0,a.OE)(URL.createObjectURL(n.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 r.Z.Texture(o)})),p=e=>{for(var t=(e=e.bitmap).width,n=e.height,r=m(e).ctx.getImageData(0,0,t,n).data,i=[],a=0;a<r/4;a+=1)i.push(r.slice(4*a,4*(a+1)))},m=e=>{const t=document.createElement("canvas"),n=t.getContext("2d");return n.drawImage(e,0,0,e.width,e.height),{ctx:n,canvas:t}},v=(e,t,n)=>{e/=255,t/=255,n/=255;var r,i=Math.max(e,t,n),a=Math.min(e,t,n),o=(i+a)/2;if(i==a)r=l=0;else{var s=i-a,l=.5<o?s/(2-i-a):s/(i+a);switch(i){case e:r=(t-n)/s+(t<n?6:0);break;case t:r=(n-e)/s+2;break;case n:r=(e-t)/s+4}r/=6}return[100*r,100*l,100*o]},g=(e,t,n)=>{var r,i,a,o;return 0==t?i=a=o=n:(i=(r=function(e,t,n){return n<0&&(n+=1),1<n&&--n,n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e})(t=2*n-(n=n<.5?n*(1+t):n+t-n*t),n,e+1/3),a=r(t,n,e),o=r(t,n,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,n)=>{const r=(0,a.Gm)({base64Type:"webp"},n).base64Type;return new Promise(((n,i)=>{"blob"===t?e.toBlob((e=>{(e?n:i)(e)})):"base64"===t&&n(e.toDataURL("image/"+r))}))},x=e=>o(void 0,void 0,void 0,(function*(){var{width:t,height:n}=e;const r=document.createElement("canvas"),i=(r.width=t,r.height=n,r.getContext("2d"));if(i)return i.translate(0,n),i.scale(1,-1),i.drawImage(e,0,0,t,n),{imageBitMap:yield createImageBitmap(i.getImageData(0,0,t,n)),canvas:r}})),w=e=>{e.remove()},A=e=>{e.close()},S=e=>{var{width:e,height:t}=e;const n=document.createElement("canvas");return(n.width=e,n.height=t,n.getContext("2d")).drawImage(new Image,0,0),n}},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,LC:()=>strToNum,Lj:()=>isBlob,Ls:()=>getMacro,Mh:()=>getTruthBase64,Ne:()=>fromCode,Ni:()=>toCode,OE:()=>fileAndBlobToCanvas,Op:()=>getTypeByBase64,RG:()=>base64ToArrayBuffer,Rn:()=>addElesFromIndexToArr,Rz:()=>filterFiles,U:()=>deepMergeObject,U9:()=>toTimeString,Xq:()=>isDef,ZM:()=>getMd5,_c:()=>canvasToBlob,a_:()=>fileToBlob,cM:()=>LimitCb,cO:()=>bufferToArrayBuffer,d9:()=>clone,fh:()=>getMapByRgb,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),_Ex_Ex__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(4513),_UtilsImage__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(7179),__awaiter=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function o(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(o,s)}l((r=r.apply(e,t||[])).next())}))};const anima=(e,t,n,r,i)=>{let a=Object.assign({},e),o=new _libs_Anima__WEBPACK_IMPORTED_MODULE_4__.Q3(a,n,t).eventCallback("onUpdate",(e=>r&&r(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 n=t.length;const r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.charCodeAt(e);return r.buffer})),getTruthBase64=e=>e.substring(e.indexOf(",")+1),arrayBufferToBlobUr=e=>URL.createObjectURL(new Blob([e])),arrayBufferToBase64=e=>{let t="";var n=new Uint8Array(e);for(let e=0,r=n.byteLength;e<r;e++)t+=String.fromCharCode(n[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(","),n=t[0].match(/:(.*?);/)[1],r=atob(t[1]),i=r.length,a=new Uint8Array(i);for(;i--;)a[i]=r.charCodeAt(i);return new Blob([a],{type:n})},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 n=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=n.indexOf("."),"00"==n.substr(e+1,2)?n.substring(0,e)+n.substr(e+3,2):t},getMd5=e=>(0,_allex_md5__WEBPACK_IMPORTED_MODULE_0__.md5)(e),fileAndBlobToCanvas=(e,t)=>{var{width:t,height:n}=t;let r=new Image,i=(r.src=e,r.width=t,r.height=n,document.createElement("canvas")),a=(i.width=t,i.height=n,i.getContext("2d"));return new Promise((e=>{r.onload=function(){a.drawImage(r,0,0,i.width,i.height),e({canvas:i,ctx:a})}}))},getFilesByDataTransfer=e=>new Array(e.files.length).fill(0).map(((t,n)=>e.files.item(n))).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 n=setTimeout((()=>(null!==n&&clearTimeout(n),n=null,e())),t)},clone=e=>{if(null===e)return null;if("object"!=typeof e)return e;var t,n,r=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(n=e[t],r[t]=n);return r},getNamesByNum=(e,t,n=1,r)=>new Array(t).fill("").map(((t,i)=>e+(i+n)+(r||""))),getType=e=>null==e?void 0:e.toString().replace(/(\[object )([a-zA-Z]+)(])/,"$2"),deepMergeObject=(e,t)=>((0,js_funcs_type_obj__WEBPACK_IMPORTED_MODULE_3__.js)(e,((n,r)=>{let i=t[n];void 0!==i&&("Object"===getType(r)&&"Object"===getType(i)&&(i=deepMergeObject(r,i)),e[n]=i)})),e),getArrIndexByItem=(e,t)=>e.find((e=>e===t)),getProgress=(e,t,n=!1)=>{let r=e/t;return n&&(r*=100),Number(r.toFixed(2))},urlToCanvas=e=>__awaiter(void 0,void 0,void 0,(function*(){if(!e)throw TypeError("该参数为空");var t=yield(0,_UtilsImage__WEBPACK_IMPORTED_MODULE_6__.Pk)(e);const n=document.createElement("canvas"),r=(n.width=t.width,n.height=t.height,n.getContext("2d"));return r.drawImage(t,0,0),{img:t,canvas:n,ctx:r}})),bufferToArrayBuffer=e=>{for(var t=new ArrayBuffer(e.length),n=new Uint8Array(t),r=0;r<e.length;++r)n[r]=e[r];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,n,r=key.length,i=key.split(""),a="",o=0;o<e.length;o++)a+=i[((n=((n=e.charCodeAt(o))-(t=n%r))/r)-(n%=r))/r%r]+i[n]+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 r=0;r<e.length;r++){var n=e.item(r);t.push(n)}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 n=e.findIndex((e=>e===t));if(-1!==n)return e.splice(n,1),n},addElesFromIndexToArr=(e,t,n)=>(t=Array.isArray(t)?t:[t],e.splice(n,0,...t)),sameArr=(e,t,n)=>{if("fill"===n){for(var[r,i]of e)if(r!==t[i])return!1}else{var a=e.length;const r=Math.floor(a/n);for(const i of new Array(n).fill("").map(((e,t)=>(t+1)*r)))if(e[i]!==t[i])return!1}return!0};class LimitCb{constructor(){this.timer=0}update(e){const{cb:t,now:n,cbRate:r}=e;this.timer+=n,this.timer>r&&(t(),this.timer=0)}}const longestCommonPrefix=e=>{if(0==e.length)return"";for(var t=e[0],n="",r=1;r<e.length;r++){for(var i=0;i<=e[r].length;i++){if(t[i]!=e[r][i]){t=n;break}n+=t[i]}n=""}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 n;return"number"===t?(n=Number(e),!isNaN(n)):"array"===t?Array.isArray(e):void 0},isDef=(e,t)=>e instanceof Array?_Ex_Ex__WEBPACK_IMPORTED_MODULE_5__.F6.isDef(e,t):_Ex_Ex__WEBPACK_IMPORTED_MODULE_5__.YD.is(e)?_Ex_Ex__WEBPACK_IMPORTED_MODULE_5__.YD.isDef(e,t):e===t,strToNum=e=>{if(e=e.replace(/[^\d]/g,""),e=Number(e),isNaN(e))throw TypeError("类型错误");return e},rgbArr=["r","g","b"],getMapByRgb=e=>{var t=e.split(",");const n={r:0,g:0,b:0};for(let e=0;e<rgbArr.length;e++){var r=rgbArr[e],i=t[e];if(!i)return;i=strToNum(i),n[r]=i}return n}},7391:(e,t,n)=>{"use strict";n.d(t,{An:()=>a,FW:()=>o,hz:()=>i,te:()=>r});const r=e=>{},i=e=>"editor"===e.optionsEx.options.mode,a=e=>"running"===e.optionsEx.options.mode,o=e=>e.optionsEx.options},9960:(e,t,n)=>{"use strict";n.d(t,{Zv:()=>he,F:()=>ue,Hg:()=>re,Z7:()=>ie,UZ:()=>te,YG:()=>ne,ol:()=>ee,A2:()=>pe,Gm:()=>fe,aM:()=>me,e9:()=>ve,kG:()=>le,Sp:()=>$,SI:()=>ce,yT:()=>de,hX:()=>se,VU:()=>Y,hs:()=>oe,vp:()=>ae,xr:()=>q});var r=n(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 n,r=s(e);if(n=t?(n=s(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===i(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;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 r.Box3,u=new r.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 n=o(i);function i(){var e;if(!(this instanceof i))throw new TypeError("Cannot call a class as a function");return(e=n.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 r.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 r.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,n=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),n.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 r.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceStart",new r.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceEnd",new r.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 r.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceColorStart",new r.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceColorEnd",new r.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 r.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 r.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 r.Sphere),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){for(var n=this.boundingSphere.center,i=(this.boundingBox.getCenter(n),0),a=0,o=e.count;a<o;a++)u.fromBufferAttribute(e,a),i=Math.max(i,n.distanceToSquared(u)),u.fromBufferAttribute(t,a),i=Math.max(i,n.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 n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.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,r.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new r.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},r.ShaderLib.line={uniforms:r.UniformsUtils.merge([r.UniformsLib.common,r.UniformsLib.fog,r.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 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 n,r=p(e);if(n=t?(n=p(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===h(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return f(r)}}(i);function i(e){var t;if(this instanceof i)return t=n.call(this,{type:"LineMaterial",uniforms:r.UniformsUtils.clone(r.ShaderLib.line.uniforms),vertexShader:r.ShaderLib.line.vertexShader,fragmentShader:r.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}(r.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 r.Vector3,M=new r.Vector3,_=new r.Vector4,B=new r.Vector4,C=new r.Vector4,E=new r.Vector3,T=new r.Matrix4,D=new r.Line3,P=new r.Vector3,O=new r.Box3,R=new r.Sphere,I=new r.Vector4;function k(e,t,n){return I.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),I.multiplyScalar(1/I.w),I.x=A/n.width,I.y=A/n.height,I.applyMatrix4(e.projectionMatrixInverse),I.multiplyScalar(1/I.w),Math.abs(Math.max(I.x,I.y))}var L=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&g(t,e);var 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 n,r=y(e);if(n=t?(n=y(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===v(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;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()}),r=this,a=i;if(r instanceof a)return(r=n.call(this,e,t)).type="LineSegments2",r;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,n=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(n,a),i[o]=0===o?0:i[o-1],i[o+1]=i[o]+S.distanceTo(M);var l=new r.InstancedInterleavedBuffer(i,2,1);return e.setAttribute("instanceDistanceStart",new r.InterleavedBufferAttribute(l,1,0)),e.setAttribute("instanceDistanceEnd",new r.InterleavedBufferAttribute(l,1,1)),this}},{key:"raycast",value:function(e,t){var n=this.material.worldUnits,i=e.camera,a=(null!==i||n||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),void 0!==e.params.Line2&&e.params.Line2.threshold||0),o=(b=e.ray,e=this.matrixWorld,this.geometry),s=this.material;if(A=s.linewidth+a,x=o.attributes.instanceStart,w=o.attributes.instanceEnd,null===o.boundingSphere&&o.computeBoundingSphere(),R.copy(o.boundingSphere).applyMatrix4(e),a=n?.5*A:k(i,Math.max(i.near,R.distanceToPoint(b.origin)),s.resolution),R.radius+=a,!1!==b.intersectsSphere(R)&&(null===o.boundingBox&&o.computeBoundingBox(),O.copy(o.boundingBox).applyMatrix4(e),a=n?.5*A:k(i,Math.max(i.near,O.distanceToPoint(b.origin)),s.resolution),O.expandByScalar(a),!1!==b.intersectsBox(O)))if(n)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 r.Vector3,d=new r.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,C),C.w=1,C.applyMatrix4(o.matrixWorldInverse),C.applyMatrix4(m),C.multiplyScalar(1/C.w),C.x*=v.x/2,C.y*=v.y/2,C.z=0,E.copy(C),T.multiplyMatrices(o.matrixWorldInverse,g);for(var I,L,F,U,G=0,N=y.count;G<N;G++)_.fromBufferAttribute(y,G),B.fromBufferAttribute(S,G),_.w=1,B.w=1,_.applyMatrix4(T),B.applyMatrix4(T),_.z>M&&B.z>M||(_.z>M?(I=_.z-B.z,I=(_.z-M)/I,_.lerp(B,I)):B.z>M&&(I=B.z-_.z,L=(B.z-M)/I,B.lerp(_,L)),_.applyMatrix4(m),B.applyMatrix4(m),_.multiplyScalar(1/_.w),B.multiplyScalar(1/B.w),_.x*=v.x/2,_.y*=v.y/2,B.x*=v.x/2,B.y*=v.y/2,D.start.copy(_),D.start.z=0,D.end.copy(B),D.end.z=0,L=D.closestPointToPointParameter(E,!0),D.at(L,P),F=-1<=(F=r.MathUtils.lerp(_.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 r.Vector3,U=new r.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 n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.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,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=N(e)););return e}(e,t);if(r)return(r=Object.getOwnPropertyDescriptor(r,t)).get?r.get.call(arguments.length<3?e:n):r.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 N(e){return(N=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}L.prototype.isLineSegments2=!0;var j=function(){var e=r,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 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 n,r=N(e);if(n=t?(n=N(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===F(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(r);function r(){var e;if(this instanceof r)return(e=n.call(this)).type="LineGeometry",e;throw new TypeError("Cannot call a class as a function")}return e=r,(t=[{key:"setPositions",value:function(e){for(var t=e.length-3,n=new Float32Array(2*t),i=0;i<t;i+=3)n[2*i]=e[i],n[2*i+1]=e[i+1],n[2*i+2]=e[i+2],n[2*i+3]=e[i+3],n[2*i+4]=e[i+4],n[2*i+5]=e[i+5];return U(N(r.prototype),"setPositions",this).call(this,n),this}},{key:"setColors",value:function(e){for(var t=e.length-3,n=new Float32Array(2*t),i=0;i<t;i+=3)n[2*i]=e[i],n[2*i+1]=e[i+1],n[2*i+2]=e[i+2],n[2*i+3]=e[i+3],n[2*i+4]=e[i+4],n[2*i+5]=e[i+5];return U(N(r.prototype),"setColors",this).call(this,n),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 n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),r}();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)}j.prototype.isLineGeometry=!0;var J=function(){var e=r,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 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 n,r=V(e);if(n=t?(n=V(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===H(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(r);function r(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new j,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new m({color:16777215*Math.random()}),i=this,a=r;if(i instanceof a)return(i=n.call(this,e,t)).type="Line2",i;throw new TypeError("Cannot call a class as a function")}return e=r,Object.defineProperty(e,"prototype",{writable:!1}),e}(),W=(J.prototype.isLine2=!0,n(2430)),K=n(8235),Z=n(6999),X=n(6001),Q=n(5410);const Y=(e,t)=>(t.updateMatrixWorld(!0),t=new Z.Z.Vector3,e.getWorldPosition(t),t),q={parse(e){var{x:e,y:t,z:n}=e;return void 0===n?new r.Vector2(e,t):new r.Vector3(e,t,n)},toJSON(e){var{x:e,y:t,z:n}=e;return null==n?{x:e,y:t}:{x:e,y:t,z:n}}},$=(e,t)=>e.distanceTo(t),ee=e=>new K.cp(e),te=e=>new W.j(e),ne=e=>new K.P7(e),re=(e,t=.5,n=!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),n)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)},ie=(e,t,n)=>{"Group"===e.type||"Object3D"===e.type?e.children.forEach((e=>ie(e,t,n))):re(e,t,n)},ae=e=>(e.mapping=r.EquirectangularReflectionMapping,e),oe=e=>{let t=e=>"Group"!==e.type&&"Object3D"!==e.type||1!==e.children.length?e:t(e.children[0]);return t(e)},se=(e,t)=>{let n=document.createElement("video");return n.style="position:absolute;top:0;left:0;z-index:1000000;",n.src=e,n.loop="loop",n.muted="muted",n.play(),t.appendChild(n),new r.VideoTexture(n)},le=(e,t=!1)=>{let n=new r.CatmullRomCurve3(e),i=new r.BufferGeometry;e=n.getSpacedPoints(100),i.setFromPoints(e),e=new r.LineBasicMaterial({color:26214});let a=new r.Line(i,e);return a.visible=t,{line:a,curve:n}},ue=e=>{let t=0;const n=[],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),n.push(new r.Vector3(o,s,l))),i[a[t]]=e,t++})),n},ce=e=>{var{pointArray:e,material:t,lineWidth:n,colorArray:i}=e;const a=new j,o=(a.setPositions(e),t||new m({transparent:!0,side:r.DoubleSide,linewidth:n||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},he=e=>3.1415926*e/180,de=(e,t="name",n)=>{const r={};return e.traverse((e=>{"id"===t?r[e.userData.id]=e:r[e[t]]=e,null!=n&&n(e)})),r},fe=(e,t,n,r,i,a)=>({cx:e,cy:t,cz:n,tx:r,ty:i,tz:a}),pe=(e,t)=>{var{x:e,y:n,z:r}=e,{x:t,y:i,z:a}=t;return{x:e-t,y:n-i,z:r-a}},me=()=>new Z.Z.Clock,ve=e=>{var{r:e,g:t,b:n}=(0,Q.fh)(X.trans.HextoRgb(e.includes("#")?e:"#"+e));return new Z.Z.Color(e,t,n)}},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,n)=>{"use strict";n.d(t,{T:()=>c,w:()=>s});var r=n(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 n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){t&&a(e.prototype,t),n&&a(e,n),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 r.OrthographicCamera(-1,1,1,-1,0,1),u=new r.BufferGeometry,c=(u.setAttribute("position",new r.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),u.setAttribute("uv",new r.Float32BufferAttribute([0,2,0,0,2,0],2)),function(){function e(t){i(this,e),this._mesh=new r.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,n)=>{"use strict";n.d(t,{T:()=>u});var r=n(8881),i=n(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 n,r=l(e);if(n=t?(n=l(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===a(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;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 n=s(a);function a(e,t){var o;if(this instanceof a)return(o=n.call(this)).textureID=void 0!==t?t:"tDiffuse",e instanceof r.ShaderMaterial?(o.uniforms=e.uniforms,o.material=e):e&&(o.uniforms=r.UniformsUtils.clone(e.uniforms),o.material=new r.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,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.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 n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),a}(i.w)},2430:(e,t,n)=>{"use strict";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 i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(){return(s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=u(e)););return e}(e,t);if(r)return(r=Object.getOwnPropertyDescriptor(r,t)).get?r.get.call(arguments.length<3?e:n):r.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)}n.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 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 n,i=u(e);if(n=t?(n=u(this).constructor,Reflect.construct(i,arguments,n)):i.apply(this,arguments),i=this,n&&("object"===r(n)||"function"==typeof n))return n;if(void 0!==n)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=n.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=n(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,n,r,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:n}},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,n,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,n,i),o=t.element,/apple/i.test(navigator.vendor)?o.style.transform="translate(-50%,-50%) translate("+Math.round(h.x*r+r)+"px,"+Math.round(-h.y*a+a)+"px)":o.style.transform="translate(-50%,-50%) translate("+(h.x*r+r)+"px,"+(-h.y*a+a)+"px)",o.parentNode!==u&&u.appendChild(o),t.onAfterRender(s,n,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],n,i)}(e,e,t);for(var n=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=n.length,o=0,p=n.length;o<p;o++)n[o].element.style.zIndex=i-o},this.setSize=function(e,i){r=(t=e)/2,a=(n=i)/2,u.style.width=e+"px",u.style.height=i+"px"}}))},8235:(e,t,n)=>{"use strict";n.d(t,{P7:()=>g,cp:()=>v,lX:()=>x});var r=n(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 n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(){return(l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(r)return(r=Object.getOwnPropertyDescriptor(r,t)).get?r.get.call(arguments.length<3?e:n):r.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 n,r=d(e);if(n=t?(n=d(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===i(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;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 r.Vector3,p=new r.Quaternion,m=new r.Vector3,v=function(){u(t,r.Object3D);var e=h(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return a(this,t),(n=e.call(this)).element=r,n.element.style.position="absolute",n.element.style.pointerEvents="auto",n.element.style.userSelect="none",n.element.setAttribute("draggable",!1),n.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),n}return s(t,[{key:"copy",value:function(e,n){return l(d(t.prototype),"copy",this).call(this,e,n),this.element=e.element.cloneNode(!0),this}}]),t}(),g=(v.prototype.isCSS3DObject=!0,function(){u(t,v);var e=h(t);function t(n){return a(this,t),(n=e.call(this,n)).rotation2D=0,n}return s(t,[{key:"copy",value:function(e,n){return l(d(t.prototype),"copy",this).call(this,e,n),this.rotation2D=e.rotation2D,this}}]),t}()),y=(g.prototype.isCSS3DSprite=!0,new r.Matrix4),b=new r.Matrix4,x=s((function e(){var t,n,r,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:n}},this.render=function(e,t){var n=t.projectionMatrix.elements[5]*i,a=(l.camera.fov!==n&&(u.style.perspective=t.isPerspectiveCamera?n+"px":"",l.camera.fov=n),!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("+n+")translate("+h(a)+"px,"+h(o)+"px)"+d(t.matrixWorldInverse):"translateZ("+n+"px)"+d(t.matrixWorldInverse)),o=a+"translate("+r+"px,"+i+"px)";l.camera.style!==o&&(c.style.transform=o,l.camera.style=o),function e(t,n,r,i){var a,o,u;t.isCSS3DObject&&(a=!0===t.visible&&!0===t.layers.test(r.layers),t.element.style.display=1==a?"":"none",1==a&&(t.onBeforeRender(s,n,r),a=t.isCSS3DSprite?(y.copy(r.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,n,r)));for(var h=0,d=t.children.length;h<d;h++)e(t.children[h],n,r,i)}(e,e,t,a)},this.setSize=function(e,a){r=(t=e)/2,i=(n=a)/2,u.style.width=e+"px",u.style.height=a+"px",c.style.width=e+"px",c.style.height=a+"px"}}))}},__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 n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__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:()=>Mo});var e={},t=(__webpack_require__.r(e),__webpack_require__.d(e,{AsyncCompress:()=>rr,AsyncDecompress:()=>yr,AsyncDeflate:()=>Xn,AsyncGunzip:()=>sr,AsyncGzip:()=>rr,AsyncInflate:()=>$n,AsyncUnzipInflate:()=>jr,AsyncUnzlib:()=>pr,AsyncZipDeflate:()=>Fr,AsyncZlib:()=>hr,Compress:()=>nr,DecodeUTF8:()=>Mr,Decompress:()=>gr,Deflate:()=>Zn,EncodeUTF8:()=>_r,Gunzip:()=>or,Gzip:()=>nr,Inflate:()=>qn,Unzip:()=>Hr,UnzipInflate:()=>Nr,UnzipPassThrough:()=>Gr,Unzlib:()=>fr,Zip:()=>Ur,ZipDeflate:()=>Lr,ZipPassThrough:()=>kr,Zlib:()=>cr,compress:()=>ir,compressSync:()=>ar,decompress:()=>function(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return(31==e[0]&&139==e[1]&&8==e[2]?lr:8!=(15&e[0])||7<e[0]>>4||(e[0]<<8|e[1])%31?er:mr)(e,t,n)},decompressSync:()=>function(e,t){return(31==e[0]&&139==e[1]&&8==e[2]?ur:8!=(15&e[0])||7<e[0]>>4||(e[0]<<8|e[1])%31?tr:vr)(e,t)},deflate:()=>Qn,deflateSync:()=>Yn,gunzip:()=>lr,gunzipSync:()=>ur,gzip:()=>ir,gzipSync:()=>ar,inflate:()=>er,inflateSync:()=>tr,strFromU8:()=>Cr,strToU8:()=>Br,unzip:()=>function(e,t){if("function"!=typeof t)throw"no callback";for(var n=[],r=function(){for(var e=0;e<n.length;++e)n[e]()},i={},a=e.length-22;101010256!=Gn(e,a);--a)if(!a||65558<e.length-a)return void t("invalid zip file",null);var o=Un(e,a+8);o||t(null,{});var s=o,l=Gn(e,a+16),u=4294967295==l;if(u){if(a=Gn(e,a-12),101075792!=Gn(e,a))return void t("invalid zip file",null);s=o=Gn(e,a+32),l=Gn(e,a+48)}for(var c=function(a){function s(e,n){e?(r(),t(e,null)):(i[f]=n,--o||t(null,i))}var c=(m=Dr(e,l,u))[0],h=m[1],d=m[2],f=m[3],p=m[4],m=m[5];if(m=Tr(e,m),l=p,c)if(8==c)if(p=e.subarray(m,m+h),h<32e4)try{s(null,tr(p,new It(d)))}catch(a){s(a,null)}else n.push(er(p,{size:d},s));else s("unknown compression type "+c,null);else s(null,ln(e,m,m+h))},h=0;h<s;++h)c();return r},unzipSync:()=>function(e){for(var t={},n=e.length-22;101010256!=Gn(e,n);--n)if(!n||65558<e.length-n)throw"invalid zip file";var r=Un(e,n+8);if(!r)return{};var i=Gn(e,n+16),a=4294967295==i;if(a){if(n=Gn(e,n-12),101075792!=Gn(e,n))throw"invalid zip file";r=Gn(e,n+32),i=Gn(e,n+48)}for(var o=0;o<r;++o){var s=(d=Dr(e,i,a))[0],l=d[1],u=d[2],c=d[3],h=d[4],d=d[5];if(d=Tr(e,d),i=h,s){if(8!=s)throw"unknown compression type "+s;t[c]=tr(e.subarray(d,d+l),new It(u))}else t[c]=ln(e,d,d+l)}return t},unzlib:()=>mr,unzlibSync:()=>vr,zip:()=>function(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";function r(){for(var e=0;e<d.length;++e)d[e]()}function i(){for(var e=new It(u+22),t=l,r=u-l,i=u=0;i<c;++i){var a=h[i];try{var o=a.c.length,s=(Rr(e,u,a,a.f,a.u,o),30+a.f.length+Or(a.extra)),d=u+s;e.set(a.c,d),Rr(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 n(e,null)}}Ir(e,l,h.length,r,t),n(null,e)}var a={},o=(br(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?(r(),n(t,null)):(t=a.length,h[e]=_n(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=An(),g=p.length,y=(v.p(p),Br(c)),b=y.length,x=m.comment,w=x&&Br(x),A=w&&w.length,S=Or(m.extra),M=0==m.level?0:8;if(65535<b&&t("filename too long",null),M)if(g<16e4)try{t(null,Yn(p,m))}catch(f){t(f,null)}else d.push(Qn(p,m,t));else t(null,p)},p=0;p<c;++p)f(p);return r},zipSync:()=>function(e,t){var n,r={},i=[],a=(br(e,"",r,t=t||{}),0),o=0;for(n in r){var s,l=(s=r[n])[0],u=0==(s=s[1]).level?0:8,c=(x=Br(n)).length,h=s.comment,d=h&&Br(h),f=d&&d.length,p=Or(s.extra);if(65535<c)throw"filename too long";var m=u?Yn(l,s):l,v=m.length,g=An();g.p(l),i.push(_n(s,{size:l.length,crc:g.d(),c:m,f:x,m:d,u:c!=n.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 It(o+22),b=(e=a,t=o-a,0);b<i.length;++b){var x=i[b],w=(Rr(y,x.o,x,x.f,x.u,x.c.length),30+x.f.length+Or(x.extra));y.set(x.c,x.o+w),Rr(y,a,x,x.f,x.u,x.c.length,x.o,x.m),a+=16+w+(x.m?x.m.length:0)}return Ir(y,a,i.length,t,e),y},zlib:()=>function(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return Fn(e,t,[Dn,Rn,function(){return[dr]}],(function(e){return kn(dr(e.data[0],e.data[1]))}),4,n)},zlibSync:()=>dr}),{}),n=(__webpack_require__.r(t),__webpack_require__.d(t,{FBXLoader:()=>oi}),__webpack_require__(8881));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 i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1})}function s(){return(s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(r)return(r=Object.getOwnPropertyDescriptor(r,t)).get?r.get.call(arguments.length<3?e:n):r.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 n,i=d(e);if(n=t?(n=d(this).constructor,Reflect.construct(i,arguments,n)):i.apply(this,arguments),i=this,n&&("object"===r(n)||"function"==typeof n))return n;if(void 0!==n)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 n.Raycaster,p=new n.Vector3,m=new n.Vector3,v=new n.Quaternion,g={X:new n.Vector3(1,0,0),Y:new n.Vector3(0,1,0),Z:new n.Vector3(0,0,1)},y={type:"change"},b={type:"mouseDown"},x={type:"mouseUp",mode:null},w={type:"objectChange"},A=function(){l(t,n.Object3D);var e=c(t);function t(r,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 n=t;Object.defineProperty(u,e,{get:function(){return void 0!==n?n:t},set:function(t){n!==t&&(n=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",r),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 n.Vector3,r=new n.Vector3;var d=new n.Quaternion,f=new n.Quaternion,p=new n.Vector3,m=new n.Quaternion,v=new n.Vector3,g=new n.Vector3,b=new n.Vector3,x=new n.Vector3;return c("worldPosition",a),c("worldPositionStart",r),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 n.Vector3,o._startNorm=new n.Vector3,o._endNorm=new n.Vector3,o._cameraScale=new n.Vector3,o._parentPosition=new n.Vector3,o._parentQuaternion=new n.Quaternion,o._parentQuaternionInv=new n.Quaternion,o._parentScale=new n.Vector3,o._worldScaleStart=new n.Vector3,o._worldQuaternionInv=new n.Quaternion,o._worldScale=new n.Vector3,o._positionStart=new n.Vector3,o._quaternionStart=new n.Quaternion,o._scaleStart=new n.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,n=this.mode,r=this.object,i=this.space;"scale"===n?i="local":"E"!==t&&"XYZE"!==t&&"XYZ"!==t||(i="world"),void 0!==r&&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"===n?(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),r.position.copy(this._offset).add(this._positionStart),this.translationSnap&&("local"===i&&(r.position.applyQuaternion(v.copy(this._quaternionStart).invert()),-1!==t.search("X")&&(r.position.x=Math.round(r.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(r.position.y=Math.round(r.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(r.position.z=Math.round(r.position.z/this.translationSnap)*this.translationSnap),r.position.applyQuaternion(this._quaternionStart)),"world"===i&&(r.parent&&r.position.add(p.setFromMatrixPosition(r.parent.matrixWorld)),-1!==t.search("X")&&(r.position.x=Math.round(r.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(r.position.y=Math.round(r.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(r.position.z=Math.round(r.position.z/this.translationSnap)*this.translationSnap),r.parent&&r.position.sub(p.setFromMatrixPosition(r.parent.matrixWorld))))):"scale"===n?(-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)),r.scale.copy(this._scaleStart).multiply(m),this.scaleSnap&&(-1!==t.search("X")&&(r.scale.x=Math.round(r.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Y")&&(r.scale.y=Math.round(r.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Z")&&(r.scale.z=Math.round(r.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))):"rotate"===n&&(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?(r.quaternion.copy(this._quaternionStart),r.quaternion.multiply(v.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),r.quaternion.copy(v.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),r.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,n){for(var r=t.intersectObject(e,!0),i=0;i<r.length;i++)if(r[i].object.visible||n)return r[i];return!1}A.prototype.isTransformControls=!0;var M=new n.Euler,_=new n.Vector3(0,1,0),B=new n.Vector3(0,0,0),C=new n.Matrix4,E=new n.Quaternion,T=new n.Quaternion,D=new n.Vector3,P=new n.Matrix4,O=new n.Vector3(1,0,0),R=new n.Vector3(0,1,0),I=new n.Vector3(0,0,1),k=new n.Vector3,L=new n.Vector3,F=new n.Vector3,U=function(){l(t,n.Object3D);var e=c(t);function t(){i(this,t),(r=e.call(this)).type="TransformControlsGizmo";var r,a=new n.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),o=new n.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 n.CylinderGeometry(0,.04,.1,12)).translate(0,.05,0),new n.BoxGeometry(.08,.08,.08)),p=(f.translate(0,.04,0),new n.BufferGeometry);function m(e,t){return(e=new n.TorusGeometry(e,.0075,3,64,t*Math.PI*2)).rotateY(Math.PI/2),e.rotateX(Math.PI/2),e}(p.setAttribute("position",new n.Float32BufferAttribute([0,0,0,1,0,0],3)),S=new n.CylinderGeometry(.0075,.0075,.5,3)).translate(0,.25,0);var v={X:[[new n.Mesh(v,w),[.5,0,0],[0,0,-Math.PI/2]],[new n.Mesh(v,w),[-.5,0,0],[0,0,Math.PI/2]],[new n.Mesh(S,w),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new n.Mesh(v,A),[0,.5,0]],[new n.Mesh(v,A),[0,-.5,0],[Math.PI,0,0]],[new n.Mesh(S,A)]],Z:[[new n.Mesh(v,l),[0,0,.5],[Math.PI/2,0,0]],[new n.Mesh(v,l),[0,0,-.5],[-Math.PI/2,0,0]],[new n.Mesh(S,l),null,[Math.PI/2,0,0]]],XYZ:[[new n.Mesh(new n.OctahedronGeometry(.1,0),d.clone()),[0,0,0]]],XY:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),h.clone()),[.15,.15,0]]],YZ:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),u.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),c.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},g={X:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),s),[.3,0,0],[0,0,-Math.PI/2]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),s),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),s),[0,.3,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),s),[0,-.3,0],[0,0,Math.PI]]],Z:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),s),[0,0,.3],[Math.PI/2,0,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),s),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new n.Mesh(new n.OctahedronGeometry(.2,0),s)]],XY:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),s),[.15,.15,0]]],YZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]]},y={START:[[new n.Mesh(new n.OctahedronGeometry(.01,2),o),null,null,null,"helper"]],END:[[new n.Mesh(new n.OctahedronGeometry(.01,2),o),null,null,null,"helper"]],DELTA:[[new n.Line(((y=new n.BufferGeometry).setAttribute("position",new n.Float32BufferAttribute([0,0,0,1,1,1],3)),y),o),null,null,null,"helper"]],X:[[new n.Line(p,o.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new n.Line(p,o.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new n.Line(p,o.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},b=(a={XYZE:[[new n.Mesh(m(.5,1),a),null,[0,Math.PI/2,0]]],X:[[new n.Mesh(m(.5,.5),w)]],Y:[[new n.Mesh(m(.5,.5),A),null,[0,0,-Math.PI/2]]],Z:[[new n.Mesh(m(.5,.5),l),null,[0,Math.PI/2,0]]],E:[[new n.Mesh(m(.75,1),b),null,[0,Math.PI/2,0]]]},{AXIS:[[new n.Line(p,o.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]}),x={XYZE:[[new n.Mesh(new n.SphereGeometry(.25,10,8),s)]],X:[[new n.Mesh(new n.TorusGeometry(.5,.1,4,24),s),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new n.Mesh(new n.TorusGeometry(.5,.1,4,24),s),[0,0,0],[Math.PI/2,0,0]]],Z:[[new n.Mesh(new n.TorusGeometry(.5,.1,4,24),s),[0,0,0],[0,0,-Math.PI/2]]],E:[[new n.Mesh(new n.TorusGeometry(.75,.1,2,24),s)]]},w={X:[[new n.Mesh(f,w),[.5,0,0],[0,0,-Math.PI/2]],[new n.Mesh(S,w),[0,0,0],[0,0,-Math.PI/2]],[new n.Mesh(f,w),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new n.Mesh(f,A),[0,.5,0]],[new n.Mesh(S,A)],[new n.Mesh(f,A),[0,-.5,0],[0,0,Math.PI]]],Z:[[new n.Mesh(f,l),[0,0,.5],[Math.PI/2,0,0]],[new n.Mesh(S,l),[0,0,0],[Math.PI/2,0,0]],[new n.Mesh(f,l),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),h),[.15,.15,0]]],YZ:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),u),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),c),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new n.Mesh(new n.BoxGeometry(.1,.1,.1),d.clone())]]},A={X:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),s),[.3,0,0],[0,0,-Math.PI/2]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),s),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),s),[0,.3,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),s),[0,-.3,0],[0,0,Math.PI]]],Z:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),s),[0,0,.3],[Math.PI/2,0,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),s),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),s),[.15,.15,0]]],YZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),s),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),s),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.2),s),[0,0,0]]]},S={X:[[new n.Line(p,o.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new n.Line(p,o.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new n.Line(p,o.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function M(e){var t,r=new n.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),r.add(a)}return r}return r.gizmo={},r.picker={},r.helper={},r.add(r.gizmo.translate=M(v)),r.add(r.gizmo.rotate=M(a)),r.add(r.gizmo.scale=M(w)),r.add(r.picker.translate=M(g)),r.add(r.picker.rotate=M(x)),r.add(r.picker.scale=M(A)),r.add(r.helper.translate=M(y)),r.add(r.helper.rotate=M(b)),r.add(r.helper.scale=M(S)),r.picker.translate.visible=!1,r.picker.rotate.visible=!1,r.picker.scale.visible=!1,r}return o(t,[{key:"updateMatrixWorld",value:function(e){var n=this,r="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(n.worldPosition),e=n.camera.isOrthographicCamera?(n.camera.top-n.camera.bottom)/n.camera.zoom:n.worldPosition.distanceTo(n.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*n.camera.fov/360)/n.camera.zoom,7),t.scale.set(1,1,1).multiplyScalar(e*n.size/4),"helper"===t.tag)return t.visible=!1,"AXIS"===t.name?(t.position.copy(n.worldPositionStart),t.visible=!!n.axis,"X"===n.axis&&(v.setFromEuler(M.set(0,0,0)),t.quaternion.copy(r).multiply(v),.9<Math.abs(_.copy(O).applyQuaternion(r).dot(n.eye))&&(t.visible=!1)),"Y"===n.axis&&(v.setFromEuler(M.set(0,0,Math.PI/2)),t.quaternion.copy(r).multiply(v),.9<Math.abs(_.copy(R).applyQuaternion(r).dot(n.eye))&&(t.visible=!1)),"Z"===n.axis&&(v.setFromEuler(M.set(0,Math.PI/2,0)),t.quaternion.copy(r).multiply(v),.9<Math.abs(_.copy(I).applyQuaternion(r).dot(n.eye))&&(t.visible=!1)),"XYZE"===n.axis&&(v.setFromEuler(M.set(0,Math.PI/2,0)),_.copy(n.rotationAxis),t.quaternion.setFromRotationMatrix(C.lookAt(B,_,R)),t.quaternion.multiply(v),t.visible=n.dragging),"E"===n.axis&&(t.visible=!1)):"START"===t.name?(t.position.copy(n.worldPositionStart),t.visible=n.dragging):"END"===t.name?(t.position.copy(n.worldPosition),t.visible=n.dragging):"DELTA"===t.name?(t.position.copy(n.worldPositionStart),t.quaternion.copy(n.worldQuaternionStart),p.set(1e-10,1e-10,1e-10).add(n.worldPositionStart).sub(n.worldPosition).multiplyScalar(-1),p.applyQuaternion(n.worldQuaternionStart.clone().invert()),t.scale.copy(p),t.visible=n.dragging):(t.quaternion.copy(r),n.dragging?t.position.copy(n.worldPositionStart):t.position.copy(n.worldPosition),n.axis&&(t.visible=-1!==n.axis.search(t.name)));t.quaternion.copy(r),"translate"===n.mode||"scale"===n.mode?("X"===t.name&&.99<Math.abs(_.copy(O).applyQuaternion(r).dot(n.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Y"===t.name&&.99<Math.abs(_.copy(R).applyQuaternion(r).dot(n.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Z"===t.name&&.99<Math.abs(_.copy(I).applyQuaternion(r).dot(n.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XY"===t.name&&Math.abs(_.copy(I).applyQuaternion(r).dot(n.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"YZ"===t.name&&Math.abs(_.copy(O).applyQuaternion(r).dot(n.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XZ"===t.name&&Math.abs(_.copy(R).applyQuaternion(r).dot(n.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1)):"rotate"===n.mode&&(E.copy(r),_.copy(n.eye).applyQuaternion(v.copy(r).invert()),-1!==t.name.search("E")&&t.quaternion.setFromRotationMatrix(C.lookAt(n.eye,B,R)),"X"===t.name&&(v.setFromAxisAngle(O,Math.atan2(-_.y,_.z)),v.multiplyQuaternions(E,v),t.quaternion.copy(v)),"Y"===t.name&&(v.setFromAxisAngle(R,Math.atan2(_.x,_.z)),v.multiplyQuaternions(E,v),t.quaternion.copy(v)),"Z"===t.name&&(v.setFromAxisAngle(I,Math.atan2(_.y,_.x)),v.multiplyQuaternions(E,v),t.quaternion.copy(v))),t.visible=t.visible&&(-1===t.name.indexOf("X")||n.showX),t.visible=t.visible&&(-1===t.name.indexOf("Y")||n.showY),t.visible=t.visible&&(-1===t.name.indexOf("Z")||n.showZ),t.visible=t.visible&&(-1===t.name.indexOf("E")||n.showX&&n.showY&&n.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,n.enabled&&n.axis&&(t.name===n.axis||n.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,n.Mesh);var e=c(t);function t(){var r;return i(this,t),(r=e.call(this,new n.PlaneGeometry(1e5,1e5,2,2),new n.MeshBasicMaterial({visible:!1,wireframe:!0,side:n.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1}))).type="TransformControlsPlane",r}return o(t,[{key:"updateMatrixWorld",value:function(e){var n=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(n="local"),k.copy(O).applyQuaternion("local"===n?this.worldQuaternion:T),L.copy(R).applyQuaternion("local"===n?this.worldQuaternion:T),F.copy(I).applyQuaternion("local"===n?this.worldQuaternion:T),_.copy(L),this.mode){case"translate":case"scale":switch(this.axis){case"X":_.copy(this.eye).cross(k),D.copy(k).cross(_);break;case"Y":_.copy(this.eye).cross(L),D.copy(L).cross(_);break;case"Z":_.copy(this.eye).cross(F),D.copy(F).cross(_);break;case"XY":D.copy(F);break;case"YZ":D.copy(k);break;case"XZ":_.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,_),this.quaternion.setFromRotationMatrix(P)),s(d(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}()),N=(G.prototype.isTransformControlsPlane=!0,__webpack_require__(3300)),j=__webpack_require__.n(N),H=__webpack_require__(9728),z=__webpack_require__(2081);class V{constructor(e){this.runScene=e}}var J=__webpack_require__(9835),W=__webpack_require__(6999),K=__webpack_require__(5613),Z=__webpack_require__(8366);class X extends V{constructor(e){super(e),this.map={},this.clock=new n.Clock,this.tickIndex=void 0,this.playings=new Set,this.updates={},this.clean=()=>{this.reset()},e.cb.model.add.add("anima-parse",(({model:e})=>{this.parses(e)})),e.cb.model.remove.add("anima-parse",(({model:e})=>{this.onModelDelete(e)})),this.runScene.cb.clean.add("EngineHelper",this.clean)}onModelDelete(e){e.traverse((e=>{(0,Z.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 n of e.animations)if(n.name===t)return n.id}parse(e,t){if(0!==e.animations.length||t){const a=e.animations.length?e.animations:J.B.parse(t),o=new n.AnimationMixer(e);for(const t of a){var r=(0,H.getId)(),i=(t.id=r,o.clipAction(t));const n={finished:()=>{},loop:()=>{}};o.addEventListener("finished",(()=>n.finished())),o.addEventListener("loop",(()=>n.loop())),this.map[r]={mixer:o,action:i,model:e,time:0,runState:"close",clip:t,eventMap:n}}a.map((t=>{e.animations.find((e=>e.uuid===t.uuid))||e.animations.push(t)}))}}play(e,t,n){e=this.findId(e,t);const r=this.map[e];if(r&&!this.playings.has(r)){t=(0,K.mergeObject)({onLoop:()=>{},onProgress:()=>{},onFinished:()=>{},onClose:()=>{},onPause:()=>{},onResume:()=>{},onBeforeEnd:()=>{},loop:!1,lastFrame:!0,reset:!0},n);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,r);h.stop(),n=c?0:r.time,h.time=n,this.setPlayState(r,!0),c&&h.reset(),h.play();let p=!(r.runState="play");this.setUpdates(e,(()=>{var e=(0,K.getProgress)(h.time,d.duration,!0);99<=e&&!p&&(a(),p=!0),i(e)})),u?(h.loop=W.Z.LoopRepeat,f.loop=o):(l&&(h.clampWhenFinished=!0),h.loop=W.Z.LoopOnce,f.finished=()=>{this.setPlayState(r,!1),i(100),s()})}}pause(e,t){e=this.findId(e,t);const n=this.map[e];n&&this.playings.has(n)&&(this.updateTime(n),this.setPlayState(n,!1),n.options.onPause(),n.runState="pause")}resume(e,t){var n=this.findId(e,t);const r=this.map[n];r&&this.playings.has(r)&&(r.options.onResume(),this.play(e,t,null==(n=this.map[t])?void 0:n.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((n=>{const{mixer:r,action:i}=this.map[n];i.play(),i.time=e,r.update(t)}))}getDetal(){return this.clock.getDelta()}update(e){const t=e||this.getDetal();(0,z.js)(this.updates,((e,n)=>n(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:n}=e;n.reset(),n.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,n){e=this.findId(e,t);const r=this.map[e];r&&this.playings.has(r)&&r.options&&((t=(0,K.mergeObject)({resetAction:!0},n).resetAction)&&r.action.reset(),this.setPlayState(r,!1),this.updateTime(r,0),r.options.onClose(),r.options=null,r.runState="pause")}setUpdates(e,t){this.updates[e]=t}fadeTo(e){var{lastModel:e,lastName:t,nextModel:n,nextName:r,duration:i}=e;e=this.findId(e,t);const a=this.map[e];a&&(t=this.findId(n,r),(e=this.map[t])&&a.action.crossFadeTo(e.action,i,!0))}resetTime(e,t){const n=this.getItem(e,t);n&&(n.action.time=0)}}var Q=__webpack_require__(8235),Y=__webpack_require__(2430);class q{constructor(e){this.scene=null,this.camera=null,this.controls=null,this.renderer=null,this.engineDom=null,this.clean=()=>{var e=this.get().camera;this.runScene.cameraEx.reset(e)},this.disposeRender=e=>{e&&(e.render=()=>{},e.domElement.remove())},this.runScene=e,this.runScene.cb.clean.add("assets",this.clean)}initRender3(){const e=new Q.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:n})=>{e.setSize(t,n)})),e}initRender2(){const e=new Y.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:n})=>{e.setSize(t,n)})),e}reset(){var e=this.get().camera;this.runScene.renderEx.setSize(),this.runScene.cameraEx.reset(e)}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(),n=this.runScene.cameraEx.pCam,r=this.runScene.renderEx.create(e),i=this.runScene.controlsEx.create(n,e),{render2:a,render3:o}=this.runScene.optionsEx.options;return this.camera=n,this.scene=t,this.renderer=r,this.controls=i,this.engineDom=e,this.runScene.renderEx.setSize(),this.setRender2(a),this.setRender3(o),{scene:t,camera:n,render:r,controls:i,engineDom:e}}get(){var{scene:e,renderer:t,controls:n,engineDom:r}=this;return{scene:e,camera:this.runScene.cameraEx.getCamera(),renderer:t,controls:n,engineDom:r}}}class ${constructor(){this.cbs=[],this.cb=e=>Promise.all(this.cbs.map((t=>{var n;return null==(n=t.fn)?void 0:n.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 ee{constructor(){this.resize=new $,this.setSelectMaterial=new $,this.setScene=new $,this.reset=new $,this.render=new $,this.tick=new $,this.baseLog=new $,this.inited=new $,this.texture={add:new $,remove:new $,setAnima:new $},this.model={multiSelect:{setEmpty:new $},change:new $,setSelect:new $,click:new $,add:new $,remove:new $,multipDrop:new $,focus:new $,unFocus:new $,changeName:new $,setOpen:new $,setMainStatue:new $,setVisible:new $,setParent:new $,setLayers:new $,setOutline:new $,clone:new $,dispose:new $},this.material={add:new $,remove:new $,dispose:new $,setName:new $},this.unique={material:{add:new $}},this.tranControls={changing:new $},this.undo={addUndos:new $,addRedus:new $,removeUndos:new $,undoByIndex:new $,reset:new $},this.scene={save:new $,saveNet:new $},this.timeLine={setProgress:new $,playGroup:new $,setGroupMap:new $,reset:new $,closeGroup:new $},this.events={key:{down:new $,up:new $},mouse:{move:new $,down:new $,up:new $},pointer:{rightTrigger:new $,down:new $,up:new $,move:new $,trigger:new $}},this.pp={glow:{setData:new $,setStatus:new $},outline:{setData:new $,setStatus:new $},ao:{setData:new $,setStatus:new $},vignette:{setData:new $,setStatus:new $}},this.load={getJSON:new $,progress:new $,complete:new $},this.exporter={gltf:{before:new $}},this.loaderer={gltf:{loadNode:new $,lazyLoadedTexture:new $,loaded:new $,modelLoaded:new $,progress:new $,getJSON:new $,getArrayBuffer:new $,complete:new $}},this.custom=new Proxy({},{get:(e,t)=>(e[t]||(e[t]=new $),e[t])}),this.tags={parseJSON:new $,clear:new $},this.clean=new $}}var te=__webpack_require__(1819);function ne(e,t){this.orbit=t,this.object=e,this.target=new W.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 n,r,i,a,o,s,l,u,c,h,d,f,p=this,m=0,v=0,g=0,y=0,b=1,x=new W.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=(n=new W.Z.Vector3,function(e){var t=this.object.matrix.elements;n.set(t[0],t[1],t[2]),n.multiplyScalar(-e),x.add(n)}),this.panUp=(r=new W.Z.Vector3,function(e,n){t.screenSpacePanning?r.setFromMatrixColumn(n,1):(r.setFromMatrixColumn(n,0),r.crossVectors(p.object.up,r)),r.multiplyScalar(e),x.add(r)}),this.pan=function(e,t,n,r){var i;p.object instanceof W.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/r),p.panUp(2*t*i/r,p.object.matrix)):p.object instanceof W.Z.OrthographicCamera?(p.panLeft(e*(p.object.right-p.object.left)/n),p.panUp(t*(p.object.top-p.object.bottom)/r)):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.")},this.dollyIn=function(e){p.object instanceof W.Z.PerspectiveCamera?b/=e:p.object instanceof W.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 W.Z.PerspectiveCamera?b*=e:p.object instanceof W.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 W.Z.Vector3,a=(new W.Z.Quaternion).setFromUnitVectors(e.up,new W.Z.Vector3(0,1,0)),o=a.clone().invert(),s=new W.Z.Vector3,l=new W.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 W.Z.Vector3,c=(new W.Z.Quaternion).setFromUnitVectors(e.up,new W.Z.Vector3(0,1,0)),h=c.clone().invert(),d=new W.Z.Vector3,f=new W.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 re(e,t){var n=new ne(e,this),r=(this.domElement=void 0!==t?t:document,Object.defineProperty(this,"constraint",{get:function(){return n}}),this.getPolarAngle=function(){return n.getPolarAngle()},this.getAzimuthalAngle=function(){return n.getAzimuthalAngle()},this.setPolarAngle=function(e){return n.setPolarAngle(e)},this.setAzimuthalAngle=function(e){return n.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:W.Z.MOUSE.LEFT,ZOOM:W.Z.MOUSE.MIDDLE,PAN:W.Z.MOUSE.RIGHT},this),i=new W.Z.Vector2,a=new W.Z.Vector2,o=new W.Z.Vector2,s=new W.Z.Vector2,l=new W.Z.Vector2,u=new W.Z.Vector2,c=new W.Z.Vector2,h=new W.Z.Vector2,d=new W.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=r.domElement===document?r.domElement.body:r.domElement;n.pan(e,t,i.clientWidth,i.clientHeight)}function b(){return Math.pow(.95,r.zoomSpeed)}function x(e){if(!1!==r.enabled){if(e.preventDefault(),e.button===r.mouseButtons.ORBIT){if(!1===r.enableRotate)return;p=0,i.set(e.clientX,e.clientY)}else if(e.button===r.mouseButtons.ZOOM){if(!1===r.enableZoom)return;p=1,c.set(e.clientX,e.clientY)}else if(e.button===r.mouseButtons.PAN){if(!1===r.enablePan)return;p=2,s.set(e.clientX,e.clientY)}p!==f&&(document.addEventListener("mousemove",w,!1),document.addEventListener("mouseup",A,!1),r.dispatchEvent(v))}}function w(e){if(null!=e&&null!=(t=e.preventDefault)&&t.call(e),!1!==r.enabled){var t=r.domElement===document?r.domElement.body:r.domElement;if(0===p){if(!1===r.enableRotate)return;a.set(e.clientX,e.clientY),o.subVectors(a,i),n.rotateLeft(2*Math.PI*o.x/t.clientWidth*r.rotateSpeed),n.rotateUp(2*Math.PI*o.y/t.clientHeight*r.rotateSpeed),i.copy(a)}else if(1===p){if(!1===r.enableZoom)return;h.set(e.clientX,e.clientY),d.subVectors(h,c),0<d.y?n.dollyIn(b()):d.y<0&&n.dollyOut(b()),c.copy(h)}else if(2===p){if(!1===r.enablePan)return;l.set(e.clientX,e.clientY),u.subVectors(l,s),y(u.x,u.y),s.copy(l)}p!==f&&r.update()}}function A(){!1!==r.enabled&&(document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",A),r.dispatchEvent(g),p=f)}function S(e){var t;!1!==r.enabled&&!1!==r.enableZoom&&p===f&&(e.stopPropagation(),void(t=0)!==e.wheelDelta?t=e.wheelDelta:void 0!==e.detail&&(t=-e.detail),0<t?n.dollyOut(b()):t<0&&n.dollyIn(b()),r.update(),r.dispatchEvent(v),r.dispatchEvent(g))}function M(e){if(!1!==r.enabled&&!1!==r.enableKeys&&!1!==r.enablePan)switch(e.keyCode){case r.keys.UP:y(0,r.keyPanSpeed),r.update();break;case r.keys.BOTTOM:y(0,-r.keyPanSpeed),r.update();break;case r.keys.LEFT:y(r.keyPanSpeed,0),r.update();break;case r.keys.RIGHT:y(-r.keyPanSpeed,0),r.update()}}function _(e){if(!1!==r.enabled){switch(e.touches.length){case 1:if(!1===r.enableRotate)return;p=3,i.set(e.touches[0].pageX,e.touches[0].pageY);break;case 2:if(!1===r.enableZoom)return;p=4;var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY;t=Math.sqrt(t*t+n*n),c.set(0,t);break;case 3:if(!1===r.enablePan)return;p=5,s.set(e.touches[0].pageX,e.touches[0].pageY);break;default:p=f}p!==f&&r.dispatchEvent(v)}}function B(e){if(e.stopPropagation(),!1!==r.enabled){var t=r.domElement===document?r.domElement.body:r.domElement;switch(e.touches.length){case 1:if(!1===r.enableRotate)return;if(3!==p)return;a.set(e.touches[0].pageX,e.touches[0].pageY),o.subVectors(a,i),n.rotateLeft(2*Math.PI*o.x/t.clientWidth*r.rotateSpeed),n.rotateUp(2*Math.PI*o.y/t.clientHeight*r.rotateSpeed),i.copy(a),r.update();break;case 2:if(!1===r.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?n.dollyOut(b()):d.y<0&&n.dollyIn(b()),c.copy(h),r.update();break;case 3:if(!1===r.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),r.update();break;default:p=f}}}function C(){!1!==r.enabled&&(r.dispatchEvent(g),p=f)}function E(e){e.preventDefault()}this.update=function(){this.autoRotate&&p===f&&n.rotateLeft(2*Math.PI/60/60*r.autoRotateSpeed),!0===n.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",_,!1),this.domElement.removeEventListener("touchend",C,!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",_,{passive:!0}),this.domElement.addEventListener("touchend",C,!1),this.domElement.addEventListener("touchmove",B,{passive:!0}),window.addEventListener("keydown",M,!1),this.update()}W.Z.MOUSE,(re.prototype=Object.create(W.Z.EventDispatcher.prototype)).constructor=re,Object.defineProperties(re.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 ie=re;class ae{create(e,t){return new ie(e,t)}static toJSON(e){return e.target}}class oe{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 se=__webpack_require__(7267),le=__webpack_require__(5259),ue=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function o(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(o,s)}l((r=r.apply(e,t||[])).next())}))};class ce{constructor(e){this.alt=!1,this.ctrl=!1,this.shift=!1,this.unExec=new le.Z,this.specialKeyDebounce=(0,se.d)((()=>{this.ctrl=!1,this.shift=!1,this.alt=!1}),1e3),this.allFn={s_saveScene:()=>ue(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 ue(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 n=this.events.runScene.multipSelector.getSelectedList("value");this.events.runScene.sceneEx.remove(this.events.runScene.modelEx.select||n),n&&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 he=__webpack_require__(7263);class de{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,n,r,i;this.isMove=!1,1===e.button||null!=(t=this.events.runScene.helperEx.transContro)&&t.isDraggingChange||(t=e.offsetX,n=e.offsetY,({x:r,y:i}=this.downPosition[e.button]),t===r&&n===i&&(0===e.button?this.trigger(e):this.events.runScene.cb.events.pointer.rightTrigger.cb(e)))},this.selectable=!0,this.events=e}init(e){var t=this.events.runScene.optionsEx.options.event.base;let n=e;"canvas"===t?n=e:"window"===t&&(n=window),n.addEventListener("pointerdown",this.down.bind(this)),n.addEventListener("pointerup",this.up.bind(this)),n.addEventListener("pointerdown",this.events.runScene.cb.events.pointer.down.cb),n.addEventListener("pointerup",this.events.runScene.cb.events.pointer.up.cb),n.addEventListener("pointermove",(e=>{this.moveEvent=e,this.events.runScene.cb.events.pointer.move.cb(e)})),n.addEventListener("mousemove",this.events.runScene.cb.events.mouse.move.cb),n.addEventListener("mousedown",this.events.runScene.cb.events.mouse.down.cb),n.addEventListener("mouseup",this.events.runScene.cb.events.mouse.up.cb)}getTriggerModels(e){const t=new n.Raycaster,r=new n.Vector2,{engineDom:i,camera:a,scene:o}=this.events.runScene.assetsEx.get();var s=e.pageX-i.offsetLeft;e=e.pageY-i.offsetTop,r.x=s/i.clientWidth*2-1,r.y=-e/i.clientHeight*2+1,t.setFromCamera(r,a),s=o.children.filter((e=>{if((!this.events.runScene.helperEx.isHelper(e)||e.userData.id)&&!e.userData.unClick)return e}));const l=t.intersectObjects(s,!0);return this.events.runScene.cb.events.pointer.trigger.cb(l),l.map((e=>e.object))}removeHideOrLockModel(e){return e.find((e=>this.events.runScene.modelEx.deepIsVisible(e)&&!he.zf.isLock(e,!0)&&Z.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 fe=__webpack_require__(4547);function pe(){pe=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=(f="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",i=f.asyncIterator||"@@asyncIterator",a=f.toStringTag||"@@toStringTag";function o(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{o({},"")}catch(t){o=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var i,a,o,s;return t=t&&t.prototype instanceof c?t:c,t=Object.create(t.prototype),r=new x(r||[]),t._invoke=(i=e,a=n,o=r,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 n=o.delegate;if(n&&(n=function e(t,n){var r=t.iterator[n.method];if(void 0===r){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=void 0,e(t,n),"throw"===n.method))return u;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}return"throw"===(r=l(r,t.iterator,n.arg)).type?(n.method="throw",n.arg=r.arg,n.delegate=null,u):(r=r.arg)?r.done?(n[t.resultName]=r.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,u):r:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,u)}(n,o),n)){if(n===u)continue;return n}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"===(n=l(i,a,o)).type){if(s=o.done?"completed":"suspendedYield",n.arg===u)continue;return{value:n.arg,done:o.done}}"throw"===n.type&&(s="completed",o.method="throw",o.arg=n.arg)}}),t}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var u={};function c(){}function h(){}function d(){}var f,p,m=(o(f={},r,(function(){return this})),(p=(p=Object.getPrototypeOf)&&p(p(w([]))))&&p!==t&&n.call(p,r)&&(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 r;this._invoke=function(i,a){function o(){return new t((function(r,o){!function r(i,a,o,s){var u;if("throw"!==(i=l(e[i],e,a)).type)return(a=(u=i.arg).value)&&"object"==ve(a)&&n.call(a,"__await")?t.resolve(a.__await).then((function(e){r("next",e,o,s)}),(function(e){r("throw",e,o,s)})):t.resolve(a).then((function(e){u.value=e,o(u)}),(function(e){return r("throw",e,o,s)}));s(i.arg)}(i,a,r,o)}))}return r=r?r.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[r];if(i)return i.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(i=function r(){for(;++t<e.length;)if(n.call(e,t))return r.value=e[t],r.done=!1,r;return r.value=void 0,r.done=!0,r}).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,n,r,i,a){void 0===a&&(a=Promise);var o=new g(s(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},v(m),o(m,a,"Generator"),o(m,r,(function(){return this})),o(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,n=[];for(t in e)n.push(t);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,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)&&n.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 r(n,r){return o.type="throw",o.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;0<=i;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;0<=r;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.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 n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),b(n),u}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var n,r,i=this.tryEntries[t];if(i.tryLoc===e)return"throw"===(n=i.completion).type&&(r=n.arg,b(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:w(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},e}function me(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function ve(e){return(ve="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 ge(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ye(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function be(e,t,n){t&&ye(e.prototype,t),n&&ye(e,n),Object.defineProperty(e,"prototype",{writable:!1})}var xe=function(){function e(){ge(this,e),this.pluginCallbacks=[],this.register((function(e){return new Ue(e)})),this.register((function(e){return new Ge(e)})),this.register((function(e){return new Ne(e)})),this.register((function(e){return new He(e)})),this.register((function(e){return new ze(e)})),this.register((function(e){return new je(e)}))}return be(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,n,r){"object"===ve(n)&&(console.warn("THREE.GLTFExporter: parse() expects options as the fourth argument now."),r=n);for(var i=new Fe,a=[],o=0,s=this.pluginCallbacks.length;o<s;o++)a.push(this.pluginCallbacks[o](i));i.setPlugins(a),i.write(e,t,r).catch(n)}},{key:"parseAsync",value:function(e,t){var n=this;return new Promise((function(r,i){n.parse(e,r,i,t)}))}}]),e}(),we=5121,Ae=5123,Se=(N=9728,9729),Me=9984,_e=9985,Be=9986,Ce=9987,Ee=33071,Te=33648,De=10497,Pe={},Oe=(Pe[n.NearestFilter]=N,Pe[n.NearestMipmapNearestFilter]=Me,Pe[n.NearestMipmapLinearFilter]=Be,Pe[n.LinearFilter]=Se,Pe[n.LinearMipmapNearestFilter]=_e,Pe[n.LinearMipmapLinearFilter]=Ce,Pe[n.ClampToEdgeWrapping]=Ee,Pe[n.RepeatWrapping]=De,Pe[n.MirroredRepeatWrapping]=Te,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"});function Re(e,t){return e.length===t.length&&e.every((function(e,n){return e===t[n]}))}function Ie(e){return 4*Math.ceil(e/4)}function ke(e,t){var n=1<arguments.length&&void 0!==t?t:0,r=Ie(e.byteLength);if(r===e.byteLength)return e;var i=new Uint8Array(r);if(i.set(new Uint8Array(e)),0!==n)for(var a=e.byteLength;a<r;a++)i[a]=n;return i.buffer}var Le=null,Fe=function(){function e(){ge(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,r;return be(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=pe().mark((function e(t,n,r){var i,a,o,s,l,u,c;return pe().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},r),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,r=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===r.binary?((u=new window.FileReader).readAsArrayBuffer(s),u.onloadend=function(){var e=ke(u.result),t=new DataView(new ArrayBuffer(8)),r=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),ke(function(e){if(void 0!==window.TextEncoder)return(new TextEncoder).encode(e).buffer;for(var t=new Uint8Array(new ArrayBuffer(e.length)),n=0,r=e.length;n<r;n++){var i=e.charCodeAt(n);t[n]=255<i?32:i}return t.buffer}(JSON.stringify(o)),32)),i=new DataView(new ArrayBuffer(8)),a=(i.setUint32(0,r.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+r.byteLength+t.byteLength+e.byteLength),l=(l.setUint32(8,s,!0),new Blob([a,i,r,t,e],{type:"application/octet-stream"})),c=new window.FileReader;c.readAsArrayBuffer(l),c.onloadend=function(){n(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,n(o)}):n(o);case 17:case"end":return e.stop()}}),e,this)})),r=function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function o(e){me(a,r,i,o,s,"next",e)}function s(e){me(a,r,i,o,s,"throw",e)}o(void 0)}))},function(e,t,n){return r.apply(this,arguments)})},{key:"serializeUserData",value:function(e,t){if(0!==Object.keys(e.userData).length){var n=this.options,r=this.extensionsUsed;try{var i=JSON.parse(JSON.stringify(e.userData));if(n.includeCustomExtensions&&i.gltfExtensions){for(var a in void 0===t.extensions&&(t.extensions={}),i.gltfExtensions)t.extensions[a]=i.gltfExtensions[a],r[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 n.Vector3,r=0,i=e.count;r<i;r++)if(5e-4<Math.abs(t.fromBufferAttribute(e,r).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 r=e.clone(),i=new n.Vector3,a=0,o=r.count;a<o;a++)i.fromBufferAttribute(r,a),0===i.x&&0===i.y&&0===i.z?i.setX(1):i.normalize(),r.setXYZ(a,i.x,i.y,i.z);return t.attributesNormalized.set(e,r),r}},{key:"applyTextureTransform",value:function(e,t){var n=!1,r={};0===t.offset.x&&0===t.offset.y||(r.offset=t.offset.toArray(),n=!0),0!==t.rotation&&(r.rotation=t.rotation,n=!0),1===t.repeat.x&&1===t.repeat.y||(r.scale=t.repeat.toArray(),n=!0),n&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=r,this.extensionsUsed.KHR_texture_transform=!0)}},{key:"buildORMTexture",value:function(e){var t=null==(t=e.aoMap)?void 0:t.image,r=null==(r=e.roughnessMap)?void 0:r.image,i=null==(i=e.metalnessMap)?void 0:i.image;if(t===r&&r===i)return e.aoMap;if(t||r||i){e=Math.max((null==t?void 0:t.width)||0,(null==r?void 0:r.width)||0,(null==i?void 0:i.width)||0);var a=Math.max((null==t?void 0:t.height)||0,(null==r?void 0:r.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(r){s.drawImage(r,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 n.Texture(o)}}},{key:"processBuffer",value:function(e){var t=this.json,n=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),n.push(e),0}},{key:"processBufferView",value:function(e,t,n,r,i){for(var a,o=this.json,s=(o.bufferViews||(o.bufferViews=[]),a=t===we?1:t===Ae?2:4,Ie(r*e.itemSize*a)),l=new DataView(new ArrayBuffer(s)),u=0,c=n;c<n+r;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===Ae?l.setUint16(u,d,!0):t===we&&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,n=t.json;return n.bufferViews||(n.bufferViews=[]),new Promise((function(r,i){var a=new window.FileReader;if(!(e instanceof Blob))return i();a.readAsArrayBuffer(e),a.onloadend=function(){var e=ke(a.result),i={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,r(n.bufferViews.push(i)-1)}}))}},{key:"processAccessor",value:function(e,t,n,r){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=Ae;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");i=we}if(void 0===n&&(n=0),void 0===r&&(r=e.count),a.truncateDrawRange&&void 0!==t&&null===t.index&&(a=n+r,l=t.drawRange.count===1/0?e.count:t.drawRange.start+t.drawRange.count,n=Math.max(n,t.drawRange.start),(r=Math.min(a,l)-n)<0&&(r=0)),0===r)return null;a=function(e,t,n){for(var r={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},i=t;i<t+n;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)),r.min[a]=Math.min(r.min[a],o),r.max[a]=Math.max(r.max[a],o)}return r}(e,n,r);var s,l=(void 0!==t&&(s=e===t.index?34963:34962),this.processBufferView(e,i,n,r,s));return t={bufferView:l.id,byteOffset:l.byteOffset,componentType:i,count:r,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,r,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[r=c+":flipY/"+r.toString()])return o[r];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=Le=Le||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!==n.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[r]=t}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter:Pe[e.magFilter],minFilter:Pe[e.minFilter],wrapS:Pe[e.wrapS],wrapT:Pe[e.wrapT]},t.samplers.push(e)-1}},{key:"processTexture",value:function(e){var t=this.cache,n=this.json;if(t.textures.has(e))return t.textures.get(e);n.textures||(n.textures=[]);var r={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,e)};return e.name&&(r.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,r)})),n=n.textures.push(r)-1,t.textures.set(e,n),this.options.myOptions.helper.parseTexture({texture:e,textureDef:r}),n}},{key:"processMaterial",value:function(e){var t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);var i,a={pbrMetallicRoughness:{}},o=(Re((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===n.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=r.materials.push(a)-1,t.materials.set(e,o),o}},{key:"processMesh",value:function(e){var t=this.cache,r=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 n.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 _,B={},C=!1;for(_ in l.morphAttributes)if("position"!==_&&"normal"!==_)C||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),C=!0);else{var E=l.morphAttributes[_][M],T=_.toUpperCase(),D=l.attributes[_];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,R=E.count;O<R;O++)P.setXYZ(O,E.getX(O)-D.getX(O),E.getY(O)-D.getY(O),E.getZ(O)-D.getZ(O));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 I=y?e.material:[e.material],k=y?l.groups:[{materialIndex:0,start:void 0,count:void 0}],L=0,F=k.length;L<F;L++){var U={mode:u,attributes:p},G=(this.serializeUserData(l,U),0<v.length&&(U.targets=v),null!==l.index&&(G=this.getUID(l.index),void 0===k[L].start&&void 0===k[L].count||(G+=":"+k[L].start+":"+k[L].count),t.attributes.has(G)?U.indices=t.attributes.get(G):(U.indices=this.processAccessor(l.index,l,k[L].start,k[L].count),t.attributes.set(G,U.indices)),null===U.indices&&delete U.indices),this.processMaterial(I[k[L].materialIndex]));null!==G&&(U.material=G),m.push(U)}return f.primitives=m,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,f)})),y=r.meshes.push(f)-1,t.meshes.set(s,y),y}},{key:"processCamera",value:function(e){var t=this.json,r=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),i={type:r?"orthographic":"perspective"};return r?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:n.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 r=this.json,i=this.nodeMap,a=(r.animations||(r.animations=[]),(e=xe.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),o=[],s=[],l=0;l<a.length;++l){var u=a[l],c=n.PropertyBinding.parseTrackName(u.name),h=n.PropertyBinding.findNode(t,c.nodeName),d=Oe[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===Oe.morphTargetInfluences&&(c/=h.morphTargetInfluences.length));!0===u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(f="CUBICSPLINE",c/=3):f=u.getInterpolation()===n.InterpolateDiscrete?"STEP":"LINEAR",s.push({input:this.processAccessor(new n.BufferAttribute(u.times,1)),output:this.processAccessor(new n.BufferAttribute(u.values,c)),interpolation:f}),o.push({sampler:s.length-1,target:{node:i.get(h),path:d}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:s,channels:o}),r.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,r=this.nodeMap,i=t.nodes[r.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 n.Matrix4,c=0;c<a.bones.length;++c){var h=a.bones[c];h=this.options.myOptions.helper.getNodeMapValueWithBone(h,r),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 n.BufferAttribute(l,16)),joints:s,skeleton:r.get(o)}),i.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,n,r=this.json,i=this.options,a=this.nodeMap,o=(r.nodes||(r.nodes=[]),{});if(i.myOptions.helper.parseNode({object:e,nodeDef:o,options:this}),i.trs?(n=e.quaternion.toArray(),h=e.position.toArray(),t=e.scale.toArray(),Re(n,[0,0,0,1])||(o.rotation=n),Re(h,[0,0,0])||(o.translation=h),Re(t,[1,1,1])||(o.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===Re(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!==(n=this.processMesh(e))&&(o.mesh=n):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];console.log(c,"child"),c.userData.isTemp||!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=r.nodes.push(o)-1;return a.set(e,h),h}},{key:"processScene",value:function(e){for(var t=this.json,n=this.options,r=(t.scenes||(t.scenes=[],t.scene=0),{}),i=(""!==e.name&&(r.name=e.name),t.scenes.push(r),[]),a=0,o=e.children.length;a<o;a++){var s=e.children[a];console.log(s,"child"),s.userData.isTemp||!s.visible&&!1!==n.onlyVisible||null!==(s=this.processNode(s))&&i.push(s)}0<i.length&&(r.nodes=i),this.serializeUserData(e,r)}},{key:"processObjects",value:function(e){var t=new n.Scene;t.name="AuxScene";for(var r=0;r<e.length;r++)t.children.push(e[r]);this.processScene(t)}},{key:"processInput",value:function(e){for(var t,r,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 n.Scene?this.processScene(e[o]):a.push(e[o]);1===a.length?(t=a[0],"model"===i.myOptions.helper.type&&((r=new n.Group).name="glb_model",r.add(t),t=r),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,n=this.plugins.length;t<n;t++)e(this.plugins[t])}}]),e}(),Ue=function(){function e(t){ge(this,e),this.writer=t,this.name="KHR_lights_punctual"}return be(e,[{key:"writeNode",value:function(e,t){var n,r,i;e.isLight&&(e.isDirectionalLight||e.isPointLight||e.isSpotLight?(n=(i=this.writer).json,i=i.extensionsUsed,r={},e.name&&(r.name=e.name),r.color=e.color.toArray(),r.intensity=e.intensity,e.isDirectionalLight?r.type="directional":e.isPointLight?(r.type="point",0<e.distance&&(r.range=e.distance)):e.isSpotLight&&(r.type="spot",0<e.distance&&(r.range=e.distance),r.spot={},r.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,r.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]||(n.extensions=n.extensions||{},n.extensions[this.name]={lights:[]},i[this.name]=!0),(i=n.extensions[this.name].lights).push(r),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}(),Ge=function(){function e(t){ge(this,e),this.writer=t,this.name="KHR_materials_unlit"}return be(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}(),Ne=function(){function e(t){ge(this,e),this.writer=t,this.name="KHR_materials_pbrSpecularGlossiness"}return be(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isGLTFSpecularGlossinessMaterial&&(r=(n=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:n.processTexture(e.specularMap)},n.applyTextureTransform(a,e.specularMap),i.specularGlossinessTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),je=function(){function e(t){ge(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return be(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&(r=(n=this.writer).extensionsUsed,(i={}).clearcoatFactor=e.clearcoat,e.clearcoatMap&&(a={index:n.processTexture(e.clearcoatMap)},n.applyTextureTransform(a,e.clearcoatMap),i.clearcoatTexture=a),i.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap&&(a={index:n.processTexture(e.clearcoatRoughnessMap)},n.applyTextureTransform(a,e.clearcoatRoughnessMap),i.clearcoatRoughnessTexture=a),e.clearcoatNormalMap&&(a={index:n.processTexture(e.clearcoatNormalMap)},n.applyTextureTransform(a,e.clearcoatNormalMap),i.clearcoatNormalTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),He=function(){function e(t){ge(this,e),this.writer=t,this.name="KHR_materials_transmission"}return be(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&0!==e.transmission&&(r=(n=this.writer).extensionsUsed,(i={}).transmissionFactor=e.transmission,e.transmissionMap&&(a={index:n.processTexture(e.transmissionMap)},n.applyTextureTransform(a,e.transmissionMap),i.transmissionTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),ze=function(){function e(t){ge(this,e),this.writer=t,this.name="KHR_materials_volume"}return be(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&0!==e.transmission&&(r=(n=this.writer).extensionsUsed,(i={}).thicknessFactor=e.thickness,e.thicknessMap&&(a={index:n.processTexture(e.thicknessMap)},n.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,r[this.name]=!0)}}]),e}();function Ve(){Ve=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=(f="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",i=f.asyncIterator||"@@asyncIterator",a=f.toStringTag||"@@toStringTag";function o(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{o({},"")}catch(t){o=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var i,a,o,s;return t=t&&t.prototype instanceof c?t:c,t=Object.create(t.prototype),r=new x(r||[]),t._invoke=(i=e,a=n,o=r,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 n=o.delegate;if(n&&(n=function e(t,n){var r=t.iterator[n.method];if(void 0===r){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=void 0,e(t,n),"throw"===n.method))return u;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}return"throw"===(r=l(r,t.iterator,n.arg)).type?(n.method="throw",n.arg=r.arg,n.delegate=null,u):(r=r.arg)?r.done?(n[t.resultName]=r.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,u):r:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,u)}(n,o),n)){if(n===u)continue;return n}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"===(n=l(i,a,o)).type){if(s=o.done?"completed":"suspendedYield",n.arg===u)continue;return{value:n.arg,done:o.done}}"throw"===n.type&&(s="completed",o.method="throw",o.arg=n.arg)}}),t}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var u={};function c(){}function h(){}function d(){}var f,p,m=(o(f={},r,(function(){return this})),(p=(p=Object.getPrototypeOf)&&p(p(w([]))))&&p!==t&&n.call(p,r)&&(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 r;this._invoke=function(i,a){function o(){return new t((function(r,o){!function r(i,a,o,s){var u;if("throw"!==(i=l(e[i],e,a)).type)return(a=(u=i.arg).value)&&"object"==We(a)&&n.call(a,"__await")?t.resolve(a.__await).then((function(e){r("next",e,o,s)}),(function(e){r("throw",e,o,s)})):t.resolve(a).then((function(e){u.value=e,o(u)}),(function(e){return r("throw",e,o,s)}));s(i.arg)}(i,a,r,o)}))}return r=r?r.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[r];if(i)return i.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(i=function r(){for(;++t<e.length;)if(n.call(e,t))return r.value=e[t],r.done=!1,r;return r.value=void 0,r.done=!0,r}).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,n,r,i,a){void 0===a&&(a=Promise);var o=new g(s(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},v(m),o(m,a,"Generator"),o(m,r,(function(){return this})),o(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,n=[];for(t in e)n.push(t);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,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)&&n.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 r(n,r){return o.type="throw",o.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;0<=i;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;0<=r;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.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 n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),b(n),u}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var n,r,i=this.tryEntries[t];if(i.tryLoc===e)return"throw"===(n=i.completion).type&&(r=n.arg,b(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:w(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},e}function Je(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function We(e){return(We="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 Ke(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ze(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Xe(e,t,n){t&&Ze(e.prototype,t),n&&Ze(e,n),Object.defineProperty(e,"prototype",{writable:!1})}xe.Utils={insertKeyframe:function(e,t){var n,r=e.getValueSize(),i=new e.TimeBufferType(e.times.length+1),a=new e.ValueBufferType(e.values.length+r),o=e.createInterpolant(new e.ValueBufferType(r));if(0===e.times.length){i[0]=t;for(var s=0;s<r;s++)a[s]=0;n=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,r),n=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),n=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)*r),0),a.set(o.evaluate(t),(l+1)*r),a.set(e.values.slice((l+1)*r),(l+2)*r),n=l+1;break}}return e.times=i,e.values=a,n},mergeMorphTargetTracks:function(e,t){for(var r=[],i={},a=e.tracks,o=0;o<a.length;++o){var s=a[o],l=n.PropertyBinding.parseTrackName(s.name),u=n.PropertyBinding.findNode(t,l.nodeName);if("morphTargetInfluences"!==l.propertyName||void 0===l.propertyIndex)r.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(n.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,r.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=r,e}};var Qe=function(){function e(){Ke(this,e),this.pluginCallbacks=[],this.register((function(e){return new st(e)})),this.register((function(e){return new lt(e)})),this.register((function(e){return new ut(e)})),this.register((function(e){return new ht(e)})),this.register((function(e){return new dt(e)})),this.register((function(e){return new ct(e)}))}return Xe(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,n,r){"object"===We(n)&&(console.warn("THREE.GLTFExporter: parse() expects options as the fourth argument now."),r=n);for(var i=new ot,a=[],o=0,s=this.pluginCallbacks.length;o<s;o++)a.push(this.pluginCallbacks[o](i));i.setPlugins(a),i.write(e,t,r).catch(n)}},{key:"parseAsync",value:function(e,t){var n=this;return new Promise((function(r,i){n.parse(e,r,i,t)}))}}]),e}(),Ye=5121,qe=5123,$e=(N=9728,Me=9729,Be=9984,Se=9985,_e=9986,Ce=9987,Ee=33071,De=33648,Te=10497,{}),et=($e[n.NearestFilter]=N,$e[n.NearestMipmapNearestFilter]=Be,$e[n.NearestMipmapLinearFilter]=_e,$e[n.LinearFilter]=Me,$e[n.LinearMipmapNearestFilter]=Se,$e[n.LinearMipmapLinearFilter]=Ce,$e[n.ClampToEdgeWrapping]=Ee,$e[n.RepeatWrapping]=Te,$e[n.MirroredRepeatWrapping]=De,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"});function tt(e,t){return e.length===t.length&&e.every((function(e,n){return e===t[n]}))}function nt(e){return 4*Math.ceil(e/4)}function rt(e,t){var n=1<arguments.length&&void 0!==t?t:0,r=nt(e.byteLength);if(r===e.byteLength)return e;var i=new Uint8Array(r);if(i.set(new Uint8Array(e)),0!==n)for(var a=e.byteLength;a<r;a++)i[a]=n;return i.buffer}var it=null;function at(){return it=it||("undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"))}var ot=function(){function e(){Ke(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,r;return Xe(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=Ve().mark((function e(t,n,r){var i,a,o,s,l;return Ve().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},r),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,r=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===r.binary?((s=new FileReader).readAsArrayBuffer(a),s.onloadend=function(){var e=rt(s.result),t=new DataView(new ArrayBuffer(8)),r=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),rt((r=JSON.stringify(i),(new TextEncoder).encode(r).buffer),32)),a=new DataView(new ArrayBuffer(8)),o=(a.setUint32(0,r.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+r.byteLength+t.byteLength+e.byteLength),u=(u.setUint32(8,l,!0),new Blob([o,a,r,t,e],{type:"application/octet-stream"})),c=new FileReader;c.readAsArrayBuffer(u),c.onloadend=function(){n(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,n(i)}):n(i);case 15:case"end":return e.stop()}}),e,this)})),r=function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function o(e){Je(a,r,i,o,s,"next",e)}function s(e){Je(a,r,i,o,s,"throw",e)}o(void 0)}))},function(e,t,n){return r.apply(this,arguments)})},{key:"serializeUserData",value:function(e,t){if(0!==Object.keys(e.userData).length){var n=this.options,r=this.extensionsUsed;try{var i=JSON.parse(JSON.stringify(e.userData));if(n.includeCustomExtensions&&i.gltfExtensions){for(var a in void 0===t.extensions&&(t.extensions={}),i.gltfExtensions)t.extensions[a]=i.gltfExtensions[a],r[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 n.Vector3,r=0,i=e.count;r<i;r++)if(5e-4<Math.abs(t.fromBufferAttribute(e,r).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 r=e.clone(),i=new n.Vector3,a=0,o=r.count;a<o;a++)i.fromBufferAttribute(r,a),0===i.x&&0===i.y&&0===i.z?i.setX(1):i.normalize(),r.setXYZ(a,i.x,i.y,i.z);return t.attributesNormalized.set(e,r),r}},{key:"applyTextureTransform",value:function(e,t){var n=!1,r={};0===t.offset.x&&0===t.offset.y||(r.offset=t.offset.toArray(),n=!0),0!==t.rotation&&(r.rotation=t.rotation,n=!0),1===t.repeat.x&&1===t.repeat.y||(r.scale=t.repeat.toArray(),n=!0),n&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=r,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 r=null==e?void 0:e.image,i=null==t?void 0:t.image,a=Math.max((null==r?void 0:r.width)||0,(null==i?void 0:i.width)||0),o=Math.max((null==r?void 0:r.height)||0,(null==i?void 0:i.height)||0),s=at(),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(r){l.drawImage(r,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),(r=(e||t).clone()).source=new n.Source(s),r}},{key:"processBuffer",value:function(e){var t=this.json,n=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),n.push(e),0}},{key:"processBufferView",value:function(e,t,n,r,i){for(var a,o=this.json,s=(o.bufferViews||(o.bufferViews=[]),a=t===Ye?1:t===qe?2:4,nt(r*e.itemSize*a)),l=new DataView(new ArrayBuffer(s)),u=0,c=n;c<n+r;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===qe?l.setUint16(u,d,!0):t===Ye&&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,n=t.json;return n.bufferViews||(n.bufferViews=[]),new Promise((function(r){var i=new FileReader;i.readAsArrayBuffer(e),i.onloadend=function(){var e=rt(i.result),a={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,r(n.bufferViews.push(a)-1)}}))}},{key:"processAccessor",value:function(e,t,n,r){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=qe;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");i=Ye}if(void 0===n&&(n=0),void 0===r&&(r=e.count),a.truncateDrawRange&&void 0!==t&&null===t.index&&(a=n+r,l=t.drawRange.count===1/0?e.count:t.drawRange.start+t.drawRange.count,n=Math.max(n,t.drawRange.start),(r=Math.min(a,l)-n)<0&&(r=0)),0===r)return null;a=function(e,t,n){for(var r={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},i=t;i<t+n;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)),r.min[a]=Math.min(r.min[a],o),r.max[a]=Math.max(r.max[a],o)}return r}(e,n,r);var s,l=(void 0!==t&&(s=e===t.index?34963:34962),this.processBufferView(e,i,n,r,s));return t={bufferView:l.id,byteOffset:l.byteOffset,componentType:i,count:r,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,r){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/"+r.toString());if(void 0!==o[c])return o[c];s.images||(s.images=[]);var h={mimeType:i};if(l.embedImages){var d=at(),f=(d.width=Math.min(e.width,l.maxTextureSize),d.height=Math.min(e.height,l.maxTextureSize),d.getContext("2d"));if(!0===r&&(f.translate(0,d.height),f.scale(1,-1)),void 0!==e.data){t!==n.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?(r=void 0!==d.toBlob?new Promise((function(e){return d.toBlob(e,i)})):d.convertToBlob({type:i}),u.push(r.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:$e[e.magFilter],minFilter:$e[e.minFilter],wrapS:$e[e.wrapS],wrapT:$e[e.wrapT]},t.samplers.push(e)-1}},{key:"processTexture",value:function(e){var t=this.cache,n=this.json;if(t.textures.has(e))return t.textures.get(e);n.textures||(n.textures=[]);var r=("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&&(r.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,r)})),n.textures.push(r)-1);return t.textures.set(e,i),i}},{key:"processMaterial",value:function(e){var t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.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=(tt(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===n.DoubleSide&&(i.doubleSided=!0),""!==e.name&&(i.name=e.name),this.serializeUserData(e,i),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,i)})),r.materials.push(i)-1);return t.materials.set(e,o),o}},{key:"processMesh",value:function(e){var t=this.cache,r=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 n.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 _,B={},C=!1;for(_ in l.morphAttributes)if("position"!==_&&"normal"!==_)C||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),C=!0);else{var E=l.morphAttributes[_][M],T=_.toUpperCase(),D=l.attributes[_];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,R=E.count;O<R;O++)P.setXYZ(O,E.getX(O)-D.getX(O),E.getY(O)-D.getY(O),E.getZ(O)-D.getZ(O));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 I=y?e.material:[e.material],k=y?l.groups:[{materialIndex:0,start:void 0,count:void 0}],L=0,F=k.length;L<F;L++){var U={mode:u,attributes:p},G=(this.serializeUserData(l,U),0<v.length&&(U.targets=v),null!==l.index&&(G=this.getUID(l.index),void 0===k[L].start&&void 0===k[L].count||(G+=":"+k[L].start+":"+k[L].count),t.attributes.has(G)?U.indices=t.attributes.get(G):(U.indices=this.processAccessor(l.index,l,k[L].start,k[L].count),t.attributes.set(G,U.indices)),null===U.indices&&delete U.indices),this.processMaterial(I[k[L].materialIndex]));null!==G&&(U.material=G),m.push(U)}return f.primitives=m,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,f)})),y=r.meshes.push(f)-1,t.meshes.set(s,y),y}},{key:"processCamera",value:function(e){var t=this.json,r=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),i={type:r?"orthographic":"perspective"};return r?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:n.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 r=this.json,i=this.nodeMap,a=(r.animations||(r.animations=[]),(e=Qe.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),o=[],s=[],l=0;l<a.length;++l){var u=a[l],c=n.PropertyBinding.parseTrackName(u.name),h=n.PropertyBinding.findNode(t,c.nodeName),d=et[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===et.morphTargetInfluences&&(c/=h.morphTargetInfluences.length));!0===u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(f="CUBICSPLINE",c/=3):f=u.getInterpolation()===n.InterpolateDiscrete?"STEP":"LINEAR",s.push({input:this.processAccessor(new n.BufferAttribute(u.times,1)),output:this.processAccessor(new n.BufferAttribute(u.values,c)),interpolation:f}),o.push({sampler:s.length-1,target:{node:i.get(h),path:d}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:s,channels:o}),r.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,r=this.nodeMap,i=t.nodes[r.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 n.Matrix4,c=0;c<a.bones.length;++c)s.push(r.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 n.BufferAttribute(l,16)),joints:s,skeleton:r.get(o)}),i.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,n,r=this.json,i=this.options,a=this.nodeMap,o=(r.nodes||(r.nodes=[]),{});if(i.trs?(n=e.quaternion.toArray(),h=e.position.toArray(),t=e.scale.toArray(),tt(n,[0,0,0,1])||(o.rotation=n),tt(h,[0,0,0])||(o.translation=h),tt(t,[1,1,1])||(o.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===tt(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!==(n=this.processMesh(e))&&(o.mesh=n):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=r.nodes.push(o)-1;return a.set(e,h),h}},{key:"processScene",value:function(e){for(var t=this.json,n=this.options,r=(t.scenes||(t.scenes=[],t.scene=0),{}),i=(""!==e.name&&(r.name=e.name),t.scenes.push(r),[]),a=0,o=e.children.length;a<o;a++){var s=e.children[a];!s.visible&&!1!==n.onlyVisible||null!==(s=this.processNode(s))&&i.push(s)}0<i.length&&(r.nodes=i),this.serializeUserData(e,r)}},{key:"processObjects",value:function(e){var t=new n.Scene;t.name="AuxScene";for(var r=0;r<e.length;r++)t.children.push(e[r]);this.processScene(t)}},{key:"processInput",value:function(e){for(var t=this.options,r=(e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)})),[]),i=0;i<e.length;i++)e[i]instanceof n.Scene?this.processScene(e[i]):r.push(e[i]);0<r.length&&this.processObjects(r);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,n=this.plugins.length;t<n;t++)e(this.plugins[t])}}]),e}(),st=function(){function e(t){Ke(this,e),this.writer=t,this.name="KHR_lights_punctual"}return Xe(e,[{key:"writeNode",value:function(e,t){var n,r,i;e.isLight&&(e.isDirectionalLight||e.isPointLight||e.isSpotLight?(n=(i=this.writer).json,i=i.extensionsUsed,r={},e.name&&(r.name=e.name),r.color=e.color.toArray(),r.intensity=e.intensity,e.isDirectionalLight?r.type="directional":e.isPointLight?(r.type="point",0<e.distance&&(r.range=e.distance)):e.isSpotLight&&(r.type="spot",0<e.distance&&(r.range=e.distance),r.spot={},r.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,r.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]||(n.extensions=n.extensions||{},n.extensions[this.name]={lights:[]},i[this.name]=!0),(i=n.extensions[this.name].lights).push(r),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}(),lt=function(){function e(t){Ke(this,e),this.writer=t,this.name="KHR_materials_unlit"}return Xe(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}(),ut=function(){function e(t){Ke(this,e),this.writer=t,this.name="KHR_materials_pbrSpecularGlossiness"}return Xe(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isGLTFSpecularGlossinessMaterial&&(r=(n=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:n.processTexture(e.specularMap)},n.applyTextureTransform(a,e.specularMap),i.specularGlossinessTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),ct=function(){function e(t){Ke(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return Xe(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&(r=(n=this.writer).extensionsUsed,(i={}).clearcoatFactor=e.clearcoat,e.clearcoatMap&&(a={index:n.processTexture(e.clearcoatMap)},n.applyTextureTransform(a,e.clearcoatMap),i.clearcoatTexture=a),i.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap&&(a={index:n.processTexture(e.clearcoatRoughnessMap)},n.applyTextureTransform(a,e.clearcoatRoughnessMap),i.clearcoatRoughnessTexture=a),e.clearcoatNormalMap&&(a={index:n.processTexture(e.clearcoatNormalMap)},n.applyTextureTransform(a,e.clearcoatNormalMap),i.clearcoatNormalTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),ht=function(){function e(t){Ke(this,e),this.writer=t,this.name="KHR_materials_transmission"}return Xe(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&0!==e.transmission&&(r=(n=this.writer).extensionsUsed,(i={}).transmissionFactor=e.transmission,e.transmissionMap&&(a={index:n.processTexture(e.transmissionMap)},n.applyTextureTransform(a,e.transmissionMap),i.transmissionTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),dt=function(){function e(t){Ke(this,e),this.writer=t,this.name="KHR_materials_volume"}return Xe(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&0!==e.transmission&&(r=(n=this.writer).extensionsUsed,(i={}).thicknessFactor=e.thickness,e.thicknessMap&&(a={index:n.processTexture(e.thicknessMap)},n.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,r[this.name]=!0)}}]),e}(),ft=(Qe.Utils={insertKeyframe:function(e,t){var n,r=e.getValueSize(),i=new e.TimeBufferType(e.times.length+1),a=new e.ValueBufferType(e.values.length+r),o=e.createInterpolant(new e.ValueBufferType(r));if(0===e.times.length){i[0]=t;for(var s=0;s<r;s++)a[s]=0;n=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,r),n=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),n=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)*r),0),a.set(o.evaluate(t),(l+1)*r),a.set(e.values.slice((l+1)*r),(l+2)*r),n=l+1;break}}return e.times=i,e.values=a,n},mergeMorphTargetTracks:function(e,t){for(var r=[],i={},a=e.tracks,o=0;o<a.length;++o){var s=a[o],l=n.PropertyBinding.parseTrackName(s.name),u=n.PropertyBinding.findNode(t,l.nodeName);if("morphTargetInfluences"!==l.propertyName||void 0===l.propertyIndex)r.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(n.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,r.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=r,e}},__webpack_require__(2016));class pt{constructor(e){this.map=new ft.Z,this.loadMap=new le.Z,this.exportMap=new le.Z,this.runScene=e,this.loadMap}bind(e){this.processMap(e),this.map.add(e)}processMap(e){e.loadCallBacks.map(((e,t)=>{let n=this.loadMap.get(e);n||(n=new ft.Z,this.loadMap.set(e,n)),n.add(t)})),e.exportCallBacks.map(((e,t)=>{let n=this.exportMap.get(e);n||(n=new ft.Z,this.exportMap.set(e,n)),n.add(t)}))}loadCallback(e){const{type:t,json:n,data:r,config:i,core:a}=e;return null==(e=this.loadMap.get(t))?void 0:e.map((e=>e({json:n,data:r,config:i,core:a})))}}var mt=__webpack_require__(1736),vt=__webpack_require__(1643),gt=__webpack_require__(3352),yt=__webpack_require__(5105),bt=__webpack_require__(8953),xt=__webpack_require__(2291),wt=__webpack_require__(5410);class At{constructor(e){this.materialMap={},this.textureMap={},this.modelType={Sprite:yt.Z},this.geoDefMaterialMap=new le.Z;var{type:e,runScene:t,helper:n}=e;this.type=e,this.helper=n,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 n.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:n,camera:r}=this.runScene.assetsEx.get();var i=this.runScene.optionsEx.exporterOptions.outTime;return console.log(this.runScene.timeLineEx.getSavedData()," this.runScene.timeLineEx.getSavedData()"),{base64:(0,wt.Ni)(String(i)),lights:gt.ZP.toJSON(this.runScene.lightEx.getLightsByScene()),camera:r.toJSON(),sceneEx:Object.assign(Object.assign({},xt.ZP.toJSON(t,this.runScene)),this._bindSceneTextures(e)),timeLine:this.runScene.timeLineEx.getSavedData(),controls:ae.toJSON(n),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 n={};if((0,mt.isTexture)(t.background)||(0,mt.isTexture)(t.environment)){this.runScene.pp.setUpdate(!1);const{background:r,environment:i}=t,a=(this.runScene.pp.setUpdate(!0),(0,Z.createDefModel)("Box")),o=(0,bt.createDefMaterial)();a.material=o,e.add(a),t=o.userData.id,n.materialId=t,this.materialMap[t]={normalMaterial:o,models:[]},(0,mt.isTexture)(r)&&(r.userData.notCompress=!0,303===(o.map=r).mapping&&(n.backgroundMapping=303)),(0,mt.isTexture)(i)&&(i.userData.notCompress=!0,o.envMap=i)}return n}compressLocal(e){var{x:t,y:n,z:r}=e.position;0===t&&0===n&&0===r||(e.position.set(0,0,0),e.userData.local=t+","+n+","+r)}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,Z.withAnima)(e)&&(t=e.animations.map((e=>e.toJSON())),(0,xt.M)(e,"animations",t));let n=e;const r=this.modelType[e.type];r&&(t=r.modelTools.toNormal(e),this.runScene.optionsEx.options.hideLocal&&this.compressLocal(t),e.parent.add(t),e.parent.remove(e),n=t),this.runScene.optionsEx.options.hideLocal&&this.compressLocal(n)}_processMaterial(e){if((0,bt.isMaterial)(e.material)){const r=this.materialMap[e.material.userData.id];if(r)return r.normalMaterial&&(e.material=r.normalMaterial),void r.models.push(e);var t=this.runScene.materialEx.isBaseMaterial(e.material),n=e.material;const i=t||this.runScene.optionsEx.exporterOptions.notMaterial?this.getMaterialFromModel(e):this.runScene.materialEx.toNromal(e.material);(e.material=i).userData.id=n.userData.id,this.materialMap[i.userData.id]={oldMaterial:n,normalMaterial:i,models:[e]}}}materialMapToJson(){(0,z.js)(this.materialMap,((e,t)=>{var n;t=t.normalMaterial,this.helper.ex.materialMap[t.userData.id]||(n=(0,bt.getTexturesByMaterial)(t),this.helper.ex.materialMap[t.userData.id]={normal:t.userData.normal||{},textures:{}},this.mergeAndRemoveTexture(n,t))}))}mergeSame(e){e.userData||(e.userData={});var t=e.userData;if((0,mt.isClonedTexture)(e))e=this.parseCloneTexture(e);else for(const a in this.textureMap){var n=this.textureMap[a],{md5:r,texture:i}=n;if(t.md5===r&&e.mapping===i.mapping&&!(0,mt.isClonedTexture)(n.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,n,r){return new(n=n||Promise)((function(t,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function o(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var r;e.done?t(e.value):((r=e.value)instanceof n?r:new n((function(e){e(r)}))).then(a,o)}s((r=r.apply(e,[])).next())}))}(this,0,void 0,(function*(){return e.map((e=>{var{type:e,texture:n}=e;this.runScene.uniqueEx.texture.add(n),t[e]=null;const r=this.mergeSame(n).texture;if(!this.helper.ex.textureMap[r.userData.id]){var i,{format:n,repeat:a,center:o,rotation:s,offset:l}=r;const e={format:n};this.runScene.modelEx.isNavieV2(a,1)||(({x:n,y:i}=a),e.repeat=n===i?n:a),this.runScene.modelEx.isNavieV2(o,0)||(({x:i,y:n}=o),e.center=i===n?i:o),this.runScene.modelEx.isNavieV2(l,0)||(({x:a,y:n}=l),e.offset=a===n?a:l),0!==s&&(e.rotation=s),this.helper.ex.textureMap[r.userData.id]=e}"normalMap"!==e||r.userData.isNormalMap||(r.userData.isNormalMap=!0),this.helper.ex.materialMap[t.userData.id].textures[e]=r.userData.id}))}))}parseCloneTexture(e){const t=e.clone();t.userData=Object.assign({},e.userData);var{width:e,height:n}=e.image;const r=document.createElement("canvas");return r.width=e,r.height=n,t.image=r,t.userData.blob=new Blob([]),t}setMultipMaterial(e,t){const n=this.runScene.modelEx.create(),r=(0,bt.createDefMaterial)();n.material=r,e.add(n);for(const e of vt.sG){if(!t.length)return;var i=t.pop();if(!i)return;r[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,bt.createDefMaterial)()),this.geoDefMaterialMap.get(e)):this.runScene.materialEx.defMaterial}}var St=__webpack_require__(5244);class Mt extends V{constructor(){super(...arguments),this.savedMap=new le.Z,this.clonedMap=new le.Z}getSameNode(e){return this.savedMap.find(((t,n)=>n.materialUuid===e.material.uuid&&n.geometryUuid===e.geometry.uuid))}parseUnClonedModel(e){var t,n=(0,St.K)(e);e.material&&e.geometry&&((t=this.getSameNode(e))&&(0,Z.setClonedModel)(e,t.id),this.savedMap.set(n,{id:n,geometryUuid:e.geometry.uuid,materialUuid:e.material.uuid}))}parseClonedModel(e){var t=(0,Z.getClonedIdModel)(e),n=(0,St.K)(e);this.clonedMap.get(t)||this.clonedMap.set(t,{newId:void 0,ids:new Set});const r=this.clonedMap.get(t);r&&(r.ids.add(n),r.newId||this.runScene.uniqueEx.model.get(t)||(t=(0,St.K)(e),r.newId=t),r.newId&&(r.newId!==n?(0,Z.setClonedModel)(e,r.newId):(0,Z.delClonedModel)(e)))}parseNode(e){(0,Z.getClonedIdModel)(e)?this.parseClonedModel(e):this.parseUnClonedModel(e)}}class _t{constructor(){this.savedMap=new le.Z}getSameCount(e){return this.savedMap.filter(((t,n)=>n.geometry.attributes.normal.count===e),"value")}setSameNode(e,t){e.geometry=t}getSameGeo(e,t){var{normal:n,position:r,uv:i}=e.attributes;for(const e of t){var{normal:a,position:o,uv:s}=e.attributes;if(n.array.length===a.array.length&&r.array.length===o.array.length&&i.array.length===s.array.length&&(a=(0,wt.F1)([...n.array],[...a.array],20),o=(0,wt.F1)([...r.array],[...o.array],20),s=(0,wt.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,n=(n=t.attributes.normal).count;const i=this.getSameCount(n);if(i){var r=this.getSameGeo(t,i.map((e=>e.geometry)));if(r)return this.setSameNode(e,r)}this.savedMap.set(t.uuid,{count:n,geometry:t})}}}class Bt{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:n,type:r}=t;return{type:r,data:n(e)}}))}}class Ct{constructor(e){this.helperModels=[],this.mergeSameGeo=new _t;var{type:e,runScene:t,model:n}=e;this.runScene=t,this.type=e,this.bindClondId=new Mt(t),this.ex={materialMap:{},textureMap:{},type:e},this.before=new At({helper:this,type:e,runScene:t}),this.before.parse(n)}parseNode(e){const{object:t,nodeDef:n}=e;this.mergeSameGeo.parseNode(t),this.bindClondId.parseNode(t),(0,z.js)(this.runScene.modelEx.defNodeMap,((e,r)=>{t[e]!==r&&(n[e]=t[e])})),t.material&&t.material.wireframe&&(t.material.wireframe=!1,n.wireframe=!0)}parseMaterial(e){const{material:t,materialDef:n}=e;n.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:n}=e;var{notCompress:e,minFilter:r}=t.userData,{width:e,height:r}=(e&&(n.notCompress=!0),n.uvScript=t.userData.uvScript,n.md5=t.userData.md5,n.id=t.userData.id,r&&(n.minFilter=r),(0,mt.isClonedTexture)(t)&&(n.cloneSourceId=(0,mt.getCloneIdFromTexture)(t)),n.format=t.userData.format,(0,mt.getSizeByTexture)(t));n.size={w:e,h:r}}getNodeMapValueWithBone(e,t){for(const n of t.keys())if(n.userData.id===e.userData.id)return t.get(n)}done(e){e.asset.ex=this.ex,this.runScene.optionsEx.log([e,"json"])}}var Et=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function o(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(o,s)}l((r=r.apply(e,t||[])).next())}))};class Tt extends V{constructor(e){super(e),this._gltf=new xe,this._originGltf=new Qe,this.options=new Bt,this.module=new pt(e)}getArrayBuffer(e=this.runScene.sceneEx.getClear(),t){return Et(this,void 0,void 0,(function*(){const n=new Ct({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:n,optionsEx:this.runScene.optionsEx}})}))}))}getOriginArrayBuffer(e){return Et(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]})}))}))}model(e){return Et(this,void 0,void 0,(function*(){let t=e||this.runScene.modelEx.select,r=[];if(0!==(r=t?[t]:this.runScene.multipSelector.getSelectedList("value")).length){var i=(t=r[0]).name||t.type;const e=new n.Group;e.name="models",Z.uselessGroup.set(e,!0),console.log(e,"group"),r.map((t=>e.add(this.runScene.modelEx.clone(t,!1))));var a=yield this.getArrayBuffer(e,"model");(0,fe.downloadFile)(new Blob([a]),i+".glb")}}))}material(e){var t;return Et(this,void 0,void 0,(function*(){if(n=e||(null==(t=this.runScene.modelEx.select)?void 0:t.material)){const e=(0,Z.createDefModel)("Group");let t=n;(t=n instanceof Array?t:[n]).map((t=>{const n=(0,Z.createDefModel)("Box");n.material=t,e.add(n)}));var n=n.name||"material",r=yield this.getArrayBuffer(e,"material");(0,fe.downloadFile)(new Blob([r]),n+".glb")}}))}scene(e=!0,t="scene"){return Et(this,void 0,void 0,(function*(){this.runScene.cb.exporter.gltf.before.cb(null);var n=yield this.getArrayBuffer(this.runScene.sceneEx.getClear(),t);return e&&(0,fe.downloadFile)(new Blob([n]),"scene.glb"),n}))}originModel(e){return Et(this,void 0,void 0,(function*(){var t,n;e&&(t=e.name||e.type,n=yield this.getOriginArrayBuffer(e),(0,fe.downloadFile)(new Blob([n]),t+".glb"))}))}}class Dt extends V{constructor(e){super(e),this.gltf=new Tt(e)}}var Pt={},Ot=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},Rt=function(e){return new Worker(e)};try{URL.revokeObjectURL(Ot(""))}catch(Jt){Ot=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)},Rt=function(e){return new Worker(e,{type:"module"})}}for(var It=Uint8Array,kt=Uint16Array,Lt=Uint32Array,Ft=new It([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]),Ut=new It([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]),Gt=new It([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Nt=(N=function(e,t){for(var n=new kt(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new Lt(n[30]);for(r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return[n,i]},(Be=N(Ft,2))[0]),jt=Be[1],Ht=(Nt[28]=258,jt[258]=28,_e=N(Ut,0))[0],zt=_e[1],Vt=new kt(32768),Jt=0;Jt<32768;++Jt){var Wt=(43690&Jt)>>>1|(21845&Jt)<<1;Vt[Jt]=((65280&(Wt=(61680&(Wt=(52428&Wt)>>>2|(13107&Wt)<<2))>>>4|(3855&Wt)<<4))>>>8|(255&Wt)<<8)>>>1}var Kt=function(e,t,n){for(var r=e.length,i=0,a=new kt(t);i<r;++i)++a[e[i]-1];var o=new kt(t);for(i=0;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;if(n){var s=new kt(1<<t),l=15-t;for(i=0;i<r;++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[Vt[h]>>>l]=u}else for(s=new kt(r),i=0;i<r;++i)e[i]&&(s[i]=Vt[o[e[i]-1]++]>>>15-e[i]);return s},Zt=new It(288);for(Jt=0;Jt<144;++Jt)Zt[Jt]=8;for(Jt=144;Jt<256;++Jt)Zt[Jt]=9;for(Jt=256;Jt<280;++Jt)Zt[Jt]=7;for(Jt=280;Jt<288;++Jt)Zt[Jt]=8;var Xt=new It(32);for(Jt=0;Jt<32;++Jt)Xt[Jt]=5;function Qt(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 Yt(e,t,n,r,i){var a,o=En(e,r,i,(function(e,n){e?(o.terminate(),t.ondata.call(t,e)):(n[1]&&o.terminate(),t.ondata.call(t,e,n[0],n[1]))}));o.postMessage(n),t.push=function(e,n){if(a)throw"stream finished";if(!t.ondata)throw"no stream handler";o.postMessage([e,a=n],[e.buffer])},t.terminate=function(){o.terminate()}}function qt(e,t){return Gn(e,t)+4294967296*Gn(e,t+4)}var $t=Kt(Zt,9,0),en=Kt(Zt,9,1),tn=Kt(Xt,5,0),nn=Kt(Xt,5,1),rn=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},an=function(e,t,n){var r=t/8|0;return(e[r]|e[1+r]<<8)>>(7&t)&n},on=function(e,t){var n=t/8|0;return(e[n]|e[1+n]<<8|e[2+n]<<16)>>(7&t)},sn=function(e){return(e/8|0)+(7&e&&1)},ln=function(e,t,n){(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof kt?kt:e instanceof Lt?Lt:It)(n-t);return r.set(e.subarray(t,n)),r},un=function(e,t,n){var r=e.length;if(!r||n&&!n.l&&r<5)return t||new It(0);function i(e){var n=t.length;n<e&&((n=new It(Math.max(2*n,e))).set(t),t=n)}var a=!t||n,o=!n||n.i,s=(n=n||{},t=t||new It(3*r),n.f||0),l=n.p||0,u=n.b||0,c=n.l,h=n.d,d=n.m,f=n.n,p=8*r;do{if(!c){n.f=s=an(e,l,1);var m=an(e,l+1,3);if(l+=3,!m){var v=e[(_=sn(l)+4)-4]|e[_-3]<<8;if(r<(A=_+v)){if(o)throw"unexpected EOF";break}a&&i(u+v),t.set(e.subarray(_,A),u),n.b=u+=v,n.p=l=8*A;continue}if(1==m)c=en,h=nn,d=9,f=5;else{if(2!=m)throw"invalid block type";v=an(e,l,31)+257;for(var g=an(e,l+10,15)+4,y=v+an(e,l+5,31)+1,b=(l+=14,new It(y)),x=new It(19),w=0;w<g;++w)x[Gt[w]]=an(e,l+3*w,7);l+=3*g;var A,S=(1<<(A=rn(x)))-1,M=Kt(x,A,1);for(w=0;w<y;){var _,B=M[an(e,l,S)];if(l+=15&B,(_=B>>>4)<16)b[w++]=_;else{var C=0,E=0;for(16==_?(E=3+an(e,l,3),l+=2,C=b[w-1]):17==_?(E=3+an(e,l,7),l+=3):18==_&&(E=11+an(e,l,127),l+=7);E--;)b[w++]=C}}m=b.subarray(0,v);var T=b.subarray(v);d=rn(m),f=rn(T),c=Kt(m,d,1),h=Kt(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 R=(C=c[on(e,l)&D])>>>4;if(p<(l+=15&C)){if(o)throw"unexpected EOF";break}if(!C)throw"invalid length/literal";if(R<256)t[u++]=R;else{if(256==R){O=l,c=null;break}var I,k=R-254,L=(264<R&&(I=Ft[w=R-257],k=an(e,l,(1<<I)-1)+Nt[w],l+=I),(R=h[on(e,l)&P])>>>4);if(!R)throw"invalid distance";if(l+=15&R,T=Ht[L],3<L&&(I=Ut[L],T+=on(e,l)&(1<<I)-1,l+=I),p<l){if(o)throw"unexpected EOF";break}a&&i(u+131072);for(var F=u+k;u<F;u+=4)t[u]=t[u-T],t[u+1]=t[u+1-T],t[u+2]=t[u+2-T],t[u+3]=t[u+3-T];u=F}}n.l=c,n.p=O,n.b=u,c&&(s=1,n.m=d,n.d=h,n.n=f)}while(!s);return u==t.length?t:ln(t,0,u)},cn=function(e,t,n){var r=t/8|0;e[r]|=n<<=7&t,e[1+r]|=n>>>8},hn=function(e,t,n){var r=t/8|0;e[r]|=n<<=7&t,e[1+r]|=n>>>8,e[2+r]|=n>>>16},dn=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return[bn,0];if(1==i)return(m=new It(n[0].s+1))[n[0].s]=1,[m,1];n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var o=n[0],s=n[1],l=0,u=1,c=2;for(n[0]={s:-1,f:o.f+s.f,l:o,r:s};u!=i-1;)o=n[n[l].f<n[c].f?l++:c++],s=n[l!=u&&n[l].f<n[c].f?l++:c++],n[u++]={s:-1,f:o.f+s.f,l:o,r:s};var h=a[0].s;for(r=1;r<i;++r)a[r].s>h&&(h=a[r].s);var d=new kt(h+1),f=fn(n[u-1],d,0);if(t<f){r=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}));r<i;++r){var g=a[r].s;if(!(d[g]>t))break;p+=v-(1<<f-d[g]),d[g]=t}for(p>>>=m;0<p;){var y=a[r].s;d[y]<t?p-=1<<t-d[y]++-1:++r}for(;0<=r&&p;--r){var b=a[r].s;d[b]==t&&(--d[b],++p)}f=t}return[new It(d),f]},fn=function e(t,n,r){return-1==t.s?Math.max(e(t.l,n,r+1),e(t.r,n,r+1)):n[t.s]=r},pn=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new kt(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=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[n.subarray(0,r),t]},mn=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},vn=function(e,t,n){var r=n.length,i=sn(t+2);e[i]=255&r,e[i+1]=r>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var a=0;a<r;++a)e[i+a+4]=n[a];return 8*(i+4+r)},gn=function(e,t,n,r,i,a,o,s,l,u,c){cn(t,c++,n),++i[256];for(var h=(n=dn(i,15))[0],d=(n=n[1],(f=dn(a,15))[0]),f=f[1],p=(m=pn(h))[0],m=m[1],v=(g=pn(d))[0],g=g[1],y=new kt(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=dn(y,7))[0],w=w[1],A=19;4<A&&!x[Gt[A-1]];--A);var S,M=u+5<<3,_=mn(i,Zt)+mn(a,Xt)+o;if(i=mn(i,h)+mn(a,d)+o+14+3*A+mn(y,x)+(2*y[16]+3*y[17]+7*y[18]),M<=_&&M<=i)return vn(t,c,e.subarray(l,l+u));if(cn(t,c,1+(i<_)),c+=2,i<_){var B=Kt(h,n,0),C=h,E=Kt(d,f,0),T=d,D=Kt(x,w,0);for(cn(t,c,m-257),cn(t,c+5,g-1),cn(t,c+10,A-4),c+=14,b=0;b<A;++b)cn(t,c+3*b,x[Gt[b]]);c+=3*A;for(var P=[p,v],O=0;O<2;++O){var R=P[O];for(b=0;b<R.length;++b){var I=31&R[b];cn(t,c,D[I]),c+=x[I],15<I&&(cn(t,c,R[b]>>>5&127),c+=R[b]>>>12)}}}else B=$t,C=Zt,E=tn,T=Xt;for(b=0;b<s;++b)255<r[b]?(I=r[b]>>>18&31,hn(t,c,B[I+257]),c+=C[I+257],7<I&&(cn(t,c,r[b]>>>23&31),c+=Ft[I]),S=31&r[b],hn(t,c,E[S]),c+=T[S],3<S&&(hn(t,c,r[b]>>>5&8191),c+=Ut[S])):(hn(t,c,B[r[b]]),c+=C[r[b]]);return hn(t,c,B[256]),c+C[256]},yn=new Lt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),bn=new It(0),xn=function(e,t,n,r,i,a){var o=e.length,s=new It(r+o+5*(1+Math.ceil(o/7e3))+i),l=s.subarray(r,s.length-i),u=0;if(!t||o<8)for(var c=0;c<=o;c+=65535){var h=c+65535;u=h<o?vn(l,u,e.subarray(c,h)):(l[c]=a,vn(l,u,e.subarray(c,o)))}else{for(var d=(t=yn[t-1])>>>13,f=8191&t,p=(1<<n)-1,m=new kt(32768),v=new kt(1+p),g=Math.ceil(n/3),y=2*g,b=function(t){return(e[t]^e[t+1]<<g^e[t+2]<<y)&p},x=new Lt(25e3),w=new kt(288),A=new kt(32),S=0,M=0,_=(c=0,0),B=0,C=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<_)&&423<P){u=gn(e,l,0,x,w,A,M,_,C,c-C,u),_=S=M=0,C=c;for(var O=0;O<286;++O)w[O]=0;for(O=0;O<30;++O)A[O]=0}var R=2,I=0,k=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&&--k&&T!=D;){if(e[c+R]==e[c+R-L]){for(var N=0;N<G&&e[c+N]==e[c+N-L];++N);if(R<N){if(I=L,F<(R=N))break;var j=Math.min(L,N-2),H=0;for(O=0;O<j;++O){var z=c-L+O+32768&32767,V=z-m[z]+32768&32767;H<V&&(H=V,D=z)}}}L+=(T=D)-(D=m[T])+32768&32767}I?(x[_++]=268435456|jt[R]<<18|zt[I],E=31&jt[R],P=31&zt[I],M+=Ft[E]+Ut[P],++w[257+E],++A[P],B=c+R,++S):(x[_++]=e[c],++w[e[c]])}}u=gn(e,l,a,x,w,A,M,_,C,c-C,u),!a&&7&u&&(u=vn(l,u+1,bn))}return ln(s,0,r+sn(u)+i)},wn=function(){for(var e=new Lt(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),An=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=wn[255&n^t[r]]^n>>>8;e=n},d:function(){return~e}}},Sn=function(){var e=1,t=0;return{p:function(n){for(var r=e,i=t,a=n.length,o=0;o!=a;){for(var s=Math.min(o+2655,a);o<s;++o)i+=r+=n[o];r=(65535&r)+15*(r>>16),i=(65535&i)+15*(i>>16)}e=r,t=i},d:function(){return(255&(e%=65521))<<24|e>>>8<<16|(255&(t%=65521))<<8|t>>>8}}},Mn=function(e,t,n,r,i){return xn(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,n,r,!i)},_n=function(e,t){var n,r={};for(n in e)r[n]=e[n];for(n in t)r[n]=t[n];return r},Bn=function(e,t,n){for(var r=e(),i=(e=e.toString()).slice(e.indexOf("[")+1,e.lastIndexOf("]")).replace(/ /g,"").split(","),a=0;a<r.length;++a){var o=r[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 n[s]=o}return[t,n]},Cn=[],En=function(e,t,n,r){var i;if(!Cn[n]){for(var a="",o={},s=e.length-1,l=0;l<s;++l)a=(i=Bn(e[l],a,o))[0],o=i[1];Cn[n]=Bn(e[s],a,o)}var u=_n({},Cn[n][1]);return function(e,t,n,r,i){return(t=Rt(Pt[t]||(Pt[t]=Ot(e)))).onerror=function(e){return i(e.error,null)},t.onmessage=function(e){return i(null,e.data)},t.postMessage(n,r),t}(Cn[n][0]+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",n,u,function(e){var t,n=[];for(t in e)(e[t]instanceof It||e[t]instanceof kt||e[t]instanceof Lt)&&n.push((e[t]=new e[t].constructor(e[t])).buffer);return n}(u),r)},Tn=function(){return[It,kt,Lt,Ft,Ut,Gt,Nt,Ht,en,nn,Vt,Kt,rn,an,on,sn,ln,un,tr,kn,Ln]},Dn=function(){return[It,kt,Lt,Ft,Ut,Gt,jt,zt,$t,Zt,tn,Xt,Vt,yn,bn,Kt,cn,hn,dn,fn,pn,mn,vn,gn,sn,ln,xn,Mn,Yn,kn]},Pn=function(){return[jn,Vn,Nn,An,wn]},On=function(){return[Hn,zn]},Rn=function(){return[Jn,Nn,Sn]},In=function(){return[Wn]},kn=function(e){return postMessage(e,[e.buffer])},Ln=function(e){return e&&e.size&&new It(e.size)},Fn=function(e,t,n,r,i,a){var o=En(n,r,i,(function(e,t){o.terminate(),a(e,t)}));return o.postMessage([e,t],t.consume?[e.buffer]:[]),function(){o.terminate()}},Un=function(e,t){return e[t]|e[t+1]<<8},Gn=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},Nn=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},jn=function(e,t){var n=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&&Nn(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;r<=n.length;++r)e[r+10]=n.charCodeAt(r)}},Hn=function(e){if(31!=e[0]||139!=e[1]||8!=e[2])throw"invalid gzip data";var t=e[3],n=10;4&t&&(n+=e[10]|2+(e[11]<<8));for(var r=(t>>3&1)+(t>>4&1);0<r;r-=!e[n++]);return n+(2&t)},zn=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},Vn=function(e){return 10+(e.filename&&e.filename.length+1||0)},Jn=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)},Wn=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 Kn(e,t){return t||"function"!=typeof e||(t=e,e={}),this.ondata=t,e}var Zn=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(Mn(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}(),Xn=function(e,t){Yt([Dn,function(){return[Qt,Zn]}],this,Kn.call(this,e,t),(function(e){e=new Zn(e.data),onmessage=Qt(e)}),6)};function Qn(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return Fn(e,t,[Dn],(function(e){return kn(Yn(e.data[0],e.data[1]))}),0,n)}function Yn(e,t){return Mn(e,t||{},0,0)}var qn=function(){function e(e){this.s={},this.p=new It(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,n=new It(t+e.length);n.set(this.p),n.set(e,t),this.p=n},e.prototype.c=function(e){this.d=this.s.i=e||!1,e=this.s.b;var t=un(this.p,this.o,this.s);this.ondata(ln(t,e,this.s.b),this.d),this.o=ln(t,this.s.b-32768),this.s.b=this.o.length,this.p=ln(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),$n=function(e){this.ondata=e,Yt([Tn,function(){return[Qt,qn]}],this,0,(function(){var e=new qn;onmessage=Qt(e)}),7)};function er(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return Fn(e,t,[Tn],(function(e){return kn(tr(e.data[0],Ln(e.data[1])))}),1,n)}function tr(e,t){return un(e,t)}var nr=function(){function e(e,t){this.c=An(),this.l=0,this.v=1,Zn.call(this,e,t)}return e.prototype.push=function(e,t){Zn.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),this.l+=e.length,e=Mn(e,this.o,this.v&&Vn(this.o),t&&8,!t),this.v&&(jn(e,this.o),this.v=0),t&&(Nn(e,e.length-8,this.c.d()),Nn(e,e.length-4,this.l)),this.ondata(e,t)},e}(),rr=function(e,t){Yt([Dn,Pn,function(){return[Qt,Zn,nr]}],this,Kn.call(this,e,t),(function(e){e=new nr(e.data),onmessage=Qt(e)}),8)};function ir(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return Fn(e,t,[Dn,Pn,function(){return[ar]}],(function(e){return kn(ar(e.data[0],e.data[1]))}),2,n)}function ar(e,t){t=t||{};var n=An(),r=e.length,i=(n.p(e),e=Mn(e,t,Vn(t),8)).length;return jn(e,t),Nn(e,i-8,n.d()),Nn(e,i-4,r),e}var or=function(){function e(e){this.v=1,qn.call(this,e)}return e.prototype.push=function(e,t){if(qn.prototype.e.call(this,e),this.v){if((e=3<this.p.length?Hn(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)}qn.prototype.c.call(this,t)},e}(),sr=function(e){this.ondata=e,Yt([Tn,On,function(){return[Qt,qn,or]}],this,0,(function(){var e=new or;onmessage=Qt(e)}),9)};function lr(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return Fn(e,t,[Tn,On,function(){return[ur]}],(function(e){return kn(ur(e.data[0]))}),3,n)}function ur(e,t){return un(e.subarray(Hn(e),-8),t||new It(zn(e)))}var cr=function(){function e(e,t){this.c=Sn(),this.v=1,Zn.call(this,e,t)}return e.prototype.push=function(e,t){Zn.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),e=Mn(e,this.o,this.v&&2,t&&4,!t),this.v&&(Jn(e,this.o),this.v=0),t&&Nn(e,e.length-4,this.c.d()),this.ondata(e,t)},e}(),hr=function(e,t){Yt([Dn,Rn,function(){return[Qt,Zn,cr]}],this,Kn.call(this,e,t),(function(e){e=new cr(e.data),onmessage=Qt(e)}),10)};function dr(e,t){t=t||{};var n=Sn();return n.p(e),e=Mn(e,t,2,4),Jn(e,t),Nn(e,e.length-4,n.d()),e}var fr=function(){function e(e){this.v=1,qn.call(this,e)}return e.prototype.push=function(e,t){if(qn.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)}qn.prototype.c.call(this,t)},e}(),pr=function(e){this.ondata=e,Yt([Tn,In,function(){return[Qt,qn,fr]}],this,0,(function(){var e=new fr;onmessage=Qt(e)}),11)};function mr(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return Fn(e,t,[Tn,In,function(){return[vr]}],(function(e){return kn(vr(e.data[0],Ln(e.data[1])))}),5,n)}function vr(e,t){return un((Wn(e),e.subarray(2,-4)),t)}var gr=function(){function e(e){this.G=or,this.I=qn,this.Z=fr,this.ondata=e}return e.prototype.push=function(e,t){if(!this.ondata)throw"no stream handler";var n,r;this.s?this.s.push(e,t):(this.p&&this.p.length?((n=new It(this.p.length+e.length)).set(this.p),n.set(e,this.p.length)):this.p=e,2<this.p.length&&((r=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(){r.ondata.apply(r,arguments)})),this.s.push(this.p,t),this.p=null))},e}(),yr=function(){function e(e){this.G=sr,this.I=$n,this.Z=pr,this.ondata=e}return e.prototype.push=function(e,t){gr.prototype.push.call(this,e,t)},e}(),br=function e(t,n,r,i){for(var a in t){var o=t[a];a=n+a,o instanceof It?r[a]=[o,i]:Array.isArray(o)?r[a]=[o[0],_n(i,o[1])]:e(o,a+"/",r,i)}},xr="undefined"!=typeof TextEncoder&&new TextEncoder,wr="undefined"!=typeof TextDecoder&&new TextDecoder,Ar=0;try{wr.decode(bn,{stream:!0}),Ar=1}catch(Jt){}var Sr=function(e){for(var t="",n=0;;){var r=e[n++],i=(127<r)+(223<r)+(239<r);if(n+i>e.length)return[t,ln(e,n-1)];i?3==i?(r=((15&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t+=String.fromCharCode(55296|r>>10,56320|1023&r)):t+=1&i?String.fromCharCode((31&r)<<6|63&e[n++]):String.fromCharCode((15&r)<<12|(63&e[n++])<<6|63&e[n++]):t+=String.fromCharCode(r)}},Mr=function(){function e(e){this.ondata=e,Ar?this.t=new TextDecoder:this.p=bn}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 n=((n=new It(this.p.length+e.length)).set(this.p),n.set(e,this.p.length),e=Sr(n))[0];if(e=e[1],t){if(e.length)throw"invalid utf-8 data";this.p=null}else this.p=e;this.ondata(n,t)}},e}(),_r=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(Br(e),this.d=t||!1)},e}();function Br(e,t){if(t){for(var n=new It(e.length),r=0;r<e.length;++r)n[r]=e.charCodeAt(r);return n}if(xr)return xr.encode(e);var i=e.length,a=new It(e.length+(e.length>>1)),o=0,s=function(e){a[o++]=e};for(r=0;r<i;++r){o+5>a.length&&((l=new It(o+8+(i-r<<1))).set(a),a=l);var l=e.charCodeAt(r);l<128||t?s(l):(l<2048?s(192|l>>6):(55295<l&&l<57344?(s(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++r))>>18),s(128|l>>12&63)):s(224|l>>12),s(128|l>>6&63)),s(128|63&l))}return ln(a,0,o)}function Cr(e,t){if(t){for(var n="",r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}if(wr)return wr.decode(e);var i=(t=Sr(e))[0];if(t[1].length)throw"invalid utf-8 data";return i}function Er(e){return 1==e?3:e<6?2:9==e?1:0}var Tr=function(e,t){return t+30+Un(e,t+26)+Un(e,t+28)},Dr=function(e,t,n){var r=Un(e,t+28),i=Cr(e.subarray(t+46,t+46+r),!(2048&Un(e,t+8))),a=(r=t+46+r,Gn(e,t+20)),o=(a=(n=n&&4294967295==a?Pr(e,r):[a,Gn(e,t+24),Gn(e,t+42)])[0],n[1]);return n=n[2],[Un(e,t+10),a,o,i,r+Un(e,t+30)+Un(e,t+32),n]},Pr=function(e,t){for(;1!=Un(e,t);t+=4+Un(e,t+2));return[qt(e,t+12),qt(e,t+4),qt(e,t+20)]},Or=function(e){var t=0;if(e)for(var n in e){if(65535<(n=e[n].length))throw"extra field too long";t+=n+4}return t},Rr=function(e,t,n,r,i,a,o,s){var l=r.length,u=n.extra,c=s&&s.length,h=Or(u),d=(Nn(e,t,null!=o?33639248:67324752),t+=4,null!=o&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(null==a&&8),e[t++]=i&&8,e[t++]=255&n.compression,e[t++]=n.compression>>8,i=new Date(null==n.mtime?Date.now():n.mtime)).getFullYear()-1980;if(d<0||119<d)throw"date not in range 1980-2099";if(Nn(e,t,d<<25|i.getMonth()+1<<21|i.getDate()<<16|i.getHours()<<11|i.getMinutes()<<5|i.getSeconds()>>>1),t+=4,null!=a&&(Nn(e,t,n.crc),Nn(e,t+4,a),Nn(e,t+8,n.size)),Nn(e,t+12,l),Nn(e,t+14,h),t+=16,null!=o&&(Nn(e,t,c),Nn(e,t+6,n.attrs),Nn(e,t+10,o),t+=14),e.set(r,t),t+=l,h)for(var f in u){var p=u[f],m=p.length;Nn(e,t,+f),Nn(e,t+2,m),e.set(p,t+4),t+=4+m}return c&&(e.set(s,t),t+=c),t},Ir=function(e,t,n,r,i){Nn(e,t,101010256),Nn(e,t+8,n),Nn(e,t+10,n),Nn(e,t+12,r),Nn(e,t+16,i)},kr=function(){function e(e){this.filename=e,this.c=An(),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}(),Lr=function(){function e(e,t){var n=this;t=t||{},kr.call(this,e),this.d=new Zn(t,(function(e,t){n.ondata(null,e,t)})),this.compression=8,this.flag=Er(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){kr.prototype.push.call(this,e,t)},e}(),Fr=function(){function e(e,t){var n=this;t=t||{},kr.call(this,e),this.d=new Xn(t,(function(e,t,r){n.ondata(e,t,r)})),this.compression=8,this.flag=Er(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){kr.prototype.push.call(this,e,t)},e}(),Ur=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 n=Br(e.filename),r=n.length,i=(a=e.comment)&&Br(a),a=r!=e.filename.length||i&&a.length!=i.length,o=r+Or(e.extra)+30;if(65535<r)throw"filename too long";function s(){for(var e=0,n=l;e<n.length;e++){var r=n[e];t.ondata(null,r,!1)}l=[]}r=new It(o);var l=(Rr(r,0,e,n,a),[r]),u=this.d,c=(this.d=0,this.u.length),h=_n(e,{f:n,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(n,r,i){n?(t.ondata(n,r,i),t.terminate()):(d+=r.length,l.push(r),i?(n=new It(16),Nn(n,0,134695760),Nn(n,4,e.crc),Nn(n,8,d),Nn(n,12,e.size),l.push(n),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,n=0,r=0,i=this.u;r<i.length;r++)n+=46+(l=i[r]).f.length+Or(l.extra)+(l.o?l.o.length:0);for(var a=new It(n+22),o=0,s=this.u;o<s.length;o++){var l=s[o];Rr(a,e,l,l.f,l.u,l.c,t,l.o),e+=46+l.f.length+Or(l.extra)+(l.o?l.o.length:0),t+=l.b}Ir(a,e,this.u.length,n,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}(),Gr=function(){function e(){}return e.prototype.push=function(e,t){this.ondata(null,e,t)},e.compression=0,e}(),Nr=function(){function e(){var e=this;this.i=new qn((function(t,n){e.ondata(null,t,n)}))}return e.prototype.push=function(e,t){try{this.i.push(e,t)}catch(n){this.ondata(n,e,t)}},e.compression=8,e}(),jr=function(){function e(e,t){var n=this;t<32e4?this.i=new qn((function(e,t){n.ondata(null,e,t)})):(this.i=new $n((function(e,t,r){n.ondata(e,t,r)})),this.terminate=this.i.terminate)}return e.prototype.push=function(e,t){this.i.terminate&&(e=ln(e,0)),this.i.push(e,t)},e.compression=8,e}(),Hr=function(){function e(e){this.onfile=e,this.k=[],this.o={0:Gr},this.p=bn}return e.prototype.push=function(e,t){var n=this;if(!this.onfile)throw"no callback";if(!this.p)throw"stream finished";if(0<this.c){var r=Math.min(this.c,e.length),i=e.subarray(0,r);if(this.c-=r,this.d?this.d.push(i,!this.c):this.k[0].push(i),(e=e.subarray(r)).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 It(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,r,i,d,f,p,m,v,g,y,b=Gn(l,o);return 67324752==b?(a=1,s=o,h.d=null,h.c=0,r=Un(l,o+6),e=Un(l,o+8),t=2048&r,r&=8,i=Un(l,o+26),d=Un(l,o+28),o+30+i+d<u&&(h.k.unshift(f=[]),a=2,p=Gn(l,o+18),m=Gn(l,o+22),v=Cr(l.subarray(o+30,o+=30+i),!t),4294967295==p?(i=r?[-2]:Pr(l,o),p=i[0],m=i[1]):r&&(p=-1),o+=d,h.c=p,y={name:v,compression:e,start:function(){if(!y.ondata)throw"no callback";if(p){var t=n.o[e];if(!t)throw"unknown compression type "+e;(g=p<0?new t(v):new t(v,p,m)).ondata=function(e,t,n){y.ondata(e,t,n)};for(var r=0,i=f;r<i.length;r++)g.push(i[r],!1);n.k[0]==f&&n.c?n.d=g:g.push(bn,!0)}else y.ondata(null,bn,!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=bn,c<0&&(r=a?l.subarray(0,s-12-(-2==c&&8)-(134695760==Gn(l,s-16)&&4)):l.subarray(0,o),i?i.push(r,!!a):this.k[+(2==a)].push(r)),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 zr(e,t,n){var r=n.length-e-1;if(t>=n[r])return r-1;if(t<=n[e])return e;for(var i=e,a=r,o=Math.floor((i+a)/2);t<n[o]||t>=n[o+1];)t<n[o]?a=o:i=o,o=Math.floor((i+a)/2);return o}function Vr(e,t,n,r){for(var i=[],a=[],o=[],s=i[0]=1;s<=n;++s){a[s]=t-r[e+1-s],o[s]=r[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 Jr(e,t,r,i,a){for(var o=a<e?a:e,s=[],l=zr(e,i,t),u=function(e,t,n,r,i){for(var a=[],o=0;o<=n;++o)a[o]=0;for(var s=[],l=0;l<=r;++l)s[l]=a.slice(0);for(var u=[],c=0;c<=n;++c)u[c]=a.slice(0);u[0][0]=1;for(var h=a.slice(0),d=a.slice(0),f=1;f<=n;++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<=n;++b)s[0][b]=u[b][n];for(var x=0;x<=n;++x){for(var w=0,A=1,S=[],M=0;M<=n;++M)S[M]=a.slice(0);for(var _=S[0][0]=1;_<=r;++_){var B=0,C=x-_,E=n-_;_<=x&&(S[A][0]=S[w][0]/u[1+E][C],B=S[A][0]*u[C][E]);for(var T=x-1<=E?_-1:n-x,D=-1<=C?1:-C;D<=T;++D)S[A][D]=(S[w][D]-S[w][D-1])/u[1+E][C+D],B+=S[A][D]*u[C+D][E];x<=E&&(S[A][_]=-S[w][_-1]/u[1+E][x],B+=S[A][_]*u[x][E]),s[_][x]=B;var P=w;w=A,A=P}}for(var O=n,R=1;R<=r;++R){for(var I=0;I<=n;++I)s[R][I]*=O;O*=n-R}return s}(l,i,e,o,t),c=[],h=0;h<r.length;++h){var d=r[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 n.Vector4(0,0,0);return s}function Wr(e){for(var t=e.length,r=[],i=[],a=0;a<t;++a){var o=e[a];r[a]=new n.Vector3(o.x,o.y,o.z),i[a]=o.w}for(var s=[],l=0;l<t;++l){for(var u=r[l].clone(),c=1;c<=l;++c)u.sub(s[l-c].clone().multiplyScalar(function(e,t){for(var n=1,r=2;r<=e;++r)n*=r;for(var i=1,a=2;a<=t;++a)i*=a;for(var o=2;o<=e-t;++o)i*=o;return n/i}(l,c)*i[c]));s[l]=u.divideScalar(i[0])}return s}function Kr(e){return(Kr="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 Zr(e,t){return(Zr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Xr(e){return(Xr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Qr,Yr,qr,$r=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&&Zr(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 n,r=Xr(e);if(n=t?(n=Xr(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===Kr(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;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=r.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 n.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 n.Vector3;return e=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),e=function(e,t,r,i){for(var a=zr(e,i,t),o=Vr(a,i,e,t),s=new n.Vector4(0,0,0,0),l=0;l<=e;++l){var u=r[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 n.Vector3,r=(e=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),Wr(Jr(r=this.degree,this.knots,this.controlPoints,e,1)));return t.copy(r[1]).normalize(),t}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(n.Curve);function ei(e){return(ei="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 ti(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ni(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ri(e,t,n){t&&ni(e.prototype,t),n&&ni(e,n),Object.defineProperty(e,"prototype",{writable:!1})}function ii(e,t){return(ii=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function ai(e){return(ai=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var oi=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&&ii(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 n,r=ai(e);if(n=t?(n=ai(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===ei(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e){return ti(this,i),r.call(this,e)}return ri(i,[{key:"load",value:function(e,t,r,i){var a=this,o=""===a.path?n.LoaderUtils.extractUrlBase(e):a.path,s=new n.FileLoader(this.manager);s.setPath(a.path),s.setResponseType("arraybuffer"),s.setRequestHeader(a.requestHeader),s.setWithCredentials(a.withCredentials),s.load(e,(function(n){try{t(a.parse(n,o))}catch(n){i?i(n):console.error(n),a.manager.itemError(e)}}),r,i)}},{key:"parse",value:function(e,t){if(i="Kaydara FBX Binary \0",(r=e).byteLength>=i.length&&i===Si(r,0,i.length))Qr=(new hi).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","\\","\\"],n=0,r=0;r<t.length;++r)if(function(t){var r=e[0];return e=e.slice(n+1),n++,r}()===t[r])return;return 1}(r=Si(e)))throw new Error("THREE.FBXLoader: Unknown format.");if(pi(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+pi(r));Qr=(new ci).parse(r)}var r,i=new n.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new si(i,this.manager).parse(Qr)}}]),i}(n.Loader),si=function(){function e(t,n){ti(this,e),this.textureLoader=t,this.manager=n}return ri(e,[{key:"parse",value:function(){Yr=this.parseConnections();var e=this.parseImages(),t=(e=this.parseTextures(e),e=this.parseMaterials(e),this.parseDeformers()),n=(new li).parse(t);return this.parseScene(t,n,e),qr}},{key:"parseConnections",value:function(){var e=new Map;return"Connections"in Qr&&Qr.Connections.connections.forEach((function(t){var n=t[0],r=t[1],i=(t=t[2],e.has(n)||e.set(n,{parents:[],children:[]}),{ID:r,relationship:t});e.get(n).parents.push(i),e.has(r)||e.set(r,{parents:[],children:[]}),i={ID:n,relationship:t},e.get(r).children.push(i)})),e}},{key:"parseImages",value:function(){var e,t={},n={};if("Video"in Qr.Objects){var r,i=Qr.Objects.Video;for(r in i){var a,o,s=i[r];t[parseInt(r)]=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[r]),n[s.RelativeFilename||s.Filename]=o))}}for(e in t){var l=t[e];void 0!==n[l]?t[e]=n[l]:t[e]=t[e].split("\\").pop()}return t}},{key:"parseImage",value:function(e){var t,n=e.Content,r=e.RelativeFilename||e.Filename,i=r.slice(r.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 ",r),t="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+i+'" is not supported.')}return"string"==typeof n?"data:"+t+";base64,"+n:(e=new Uint8Array(n),window.URL.createObjectURL(new Blob([e],{type:t})))}},{key:"parseTextures",value:function(e){var t=new Map;if("Texture"in Qr.Objects){var n,r=Qr.Objects.Texture;for(n in r){var i=this.parseTexture(r[n],e);t.set(parseInt(n),i)}}return t}},{key:"parseTexture",value:function(e,t){var r=((t=this.loadTexture(e,t)).ID=e.id,t.name=e.attrName,e.WrapModeU),i=e.WrapModeV;return r=void 0!==r?r.value:0,i=void 0!==i?i.value:0,t.wrapS=0===r?n.RepeatWrapping:n.ClampToEdgeWrapping,t.wrapT=0===i?n.RepeatWrapping:n.ClampToEdgeWrapping,"Scaling"in e&&(r=e.Scaling.value,t.repeat.x=r[0],t.repeat.y=r[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 r,i=this.textureLoader.path,a=Yr.get(e.id).children;return a="tga"===(void 0!==a&&0<a.length&&void 0!==t[a[0].ID]&&(0!==(r=t[a[0].ID]).indexOf("blob:")&&0!==r.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 n.Texture):(a.setPath(this.textureLoader.path),a.load(r)):"psd"===t?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),new n.Texture):this.textureLoader.load(r),this.textureLoader.setPath(i),a}},{key:"parseMaterials",value:function(e){var t=new Map;if("Material"in Qr.Objects){var n,r=Qr.Objects.Material;for(n in r){var i=this.parseMaterial(r[n],e);null!==i&&t.set(parseInt(n),i)}}return t}},{key:"parseMaterial",value:function(e,t){var r,i=e.id,a=e.attrName,o=e.ShadingModel;if("object"===ei(o)&&(o=o.value),!Yr.has(i))return null;switch(e=this.parseParameters(e,t,i),o.toLowerCase()){case"phong":r=new n.MeshPhongMaterial;break;case"lambert":r=new n.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',o),r=new n.MeshPhongMaterial}return r.setValues(e),r.name=a,r}},{key:"parseParameters",value:function(e,t,r){var i={},a=(e.BumpFactor&&(i.bumpScale=e.BumpFactor.value),e.Diffuse?i.color=(new n.Color).fromArray(e.Diffuse.value):!e.DiffuseColor||"Color"!==e.DiffuseColor.type&&"ColorRGB"!==e.DiffuseColor.type||(i.color=(new n.Color).fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=(new n.Color).fromArray(e.Emissive.value):!e.EmissiveColor||"Color"!==e.EmissiveColor.type&&"ColorRGB"!==e.EmissiveColor.type||(i.emissive=(new n.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 n.Color).fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(i.specular=(new n.Color).fromArray(e.SpecularColor.value)),this);return Yr.get(r).children.forEach((function(e){var r=e.relationship;switch(r){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=n.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=n.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=n.EquirectangularReflectionMapping,i.envMap.encoding=n.sRGBEncoding);break;case"SpecularColor":i.specularMap=a.getTexture(t,e.ID),void 0!==i.specularMap&&(i.specularMap.encoding=n.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.",r)}})),i}},{key:"getTexture",value:function(e,t){return"LayeredTexture"in Qr.Objects&&t in Qr.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Yr.get(t).children[0].ID),e.get(t)}},{key:"parseDeformers",value:function(){var e={},t={};if("Deformer"in Qr.Objects){var n,r=Qr.Objects.Deformer;for(n in r){var i,a=r[n],o=Yr.get(parseInt(n));"Skin"===a.attrType?((i=this.parseSkeleton(o,r)).ID=n,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[n]=i):"BlendShape"===a.attrType&&((i={id:n}).rawTargets=this.parseMorphTargets(o,r),i.id=n,1<o.parents.length&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[n]=i)}}return{skeletons:e,morphTargets:t}}},{key:"parseSkeleton",value:function(e,t){var r=[];return e.children.forEach((function(e){var i=t[e.ID];"Cluster"===i.attrType&&(e={ID:e.ID,indices:[],weights:[],transformLink:(new n.Matrix4).fromArray(i.TransformLink.a)},"Indexes"in i&&(e.indices=i.Indexes.a,e.weights=i.Weights.a),r.push(e))})),{rawBones:r,bones:[]}}},{key:"parseMorphTargets",value:function(e,t){for(var n=[],r=0;r<e.children.length;r++){var i=e.children[r],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=Yr.get(parseInt(i.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,n.push(o)}return n}},{key:"parseScene",value:function(e,t,r){qr=new n.Group;var i=this.parseModels(e.skeletons,t,r),a=Qr.Objects.Model,o=this;i.forEach((function(e){var t=a[e.ID];o.setLookAtProperties(e,t),Yr.get(e.ID).parents.forEach((function(t){void 0!==(t=i.get(t.ID))&&t.add(e)})),null===e.parent&&qr.add(e)})),this.bindSkeleton(e.skeletons,t,i),this.createAmbientLight(),qr.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=xi(e.userData.transformData),e.applyMatrix4(t),e.updateWorldMatrix())})),r=(new ui).parse(),1===qr.children.length&&qr.children[0].isGroup&&(qr.children[0].animations=r,qr=qr.children[0]),qr.animations=r}},{key:"parseModels",value:function(e,t,r){var i,a=new Map,o=Qr.Objects.Model;for(i in o){var s=parseInt(i),l=o[i],u=Yr.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,r);break;case"NurbsCurve":c=this.createCurve(u,t);break;case"LimbNode":case"Root":c=new n.Bone;break;default:c=new n.Group}c.name=l.attrName?n.PropertyBinding.sanitizeNodeName(l.attrName):"",c.ID=s}this.getTransformData(c,l),a.set(s,c)}return a}},{key:"buildSkeleton",value:function(e,t,r,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 n.Bone).matrixWorld.copy(t.transformLink),a.name=i?n.PropertyBinding.sanitizeNodeName(i):"",a.ID=r,s.bones[o]=a,null!==l&&a.add(l))}))}(o)})),a}},{key:"createCamera",value:function(e){var t,r;if(e.children.forEach((function(e){void 0!==(e=Qr.Objects.NodeAttribute[e.ID])&&(r=e)})),void 0===r)t=new n.Object3D;else{var i=0,a=(void 0!==r.CameraProjectionType&&1===r.CameraProjectionType.value&&(i=1),1),o=(void 0!==r.NearPlane&&(a=r.NearPlane.value/1e3),1e3),s=(void 0!==r.FarPlane&&(o=r.FarPlane.value/1e3),window.innerWidth),l=window.innerHeight,u=(void 0!==r.AspectWidth&&void 0!==r.AspectHeight&&(s=r.AspectWidth.value,l=r.AspectHeight.value),s/l),c=45,h=(void 0!==r.FieldOfView&&(c=r.FieldOfView.value),r.FocalLength?r.FocalLength.value:null);switch(i){case 0:t=new n.PerspectiveCamera(c,u,a,o),null!==h&&t.setFocalLength(h);break;case 1:t=new n.OrthographicCamera(-s/2,s/2,l/2,-l/2,a,o);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+i+"."),t=new n.Object3D}}return t}},{key:"createLight",value:function(e){var t,r;if(e.children.forEach((function(e){void 0!==(e=Qr.Objects.NodeAttribute[e.ID])&&(r=e)})),void 0===r)t=new n.Object3D;else{e=void 0===r.LightType?0:r.LightType.value;var i=16777215,a=(void 0!==r.Color&&(i=(new n.Color).fromArray(r.Color.value)),void 0===r.Intensity?1:r.Intensity.value/100),o=(void 0!==r.CastLightOnObject&&0===r.CastLightOnObject.value&&(a=0),0);switch(void 0!==r.FarAttenuationEnd&&(o=void 0!==r.EnableFarAttenuation&&0===r.EnableFarAttenuation.value?0:r.FarAttenuationEnd.value),e){case 0:t=new n.PointLight(i,a,o,1);break;case 1:t=new n.DirectionalLight(i,a);break;case 2:var s=Math.PI/3,l=(void 0!==r.InnerAngle&&(s=n.MathUtils.degToRad(r.InnerAngle.value)),0);void 0!==r.OuterAngle&&(l=n.MathUtils.degToRad(r.OuterAngle.value),l=Math.max(l,1)),t=new n.SpotLight(i,a,o,s,l,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+r.LightType.value+", defaulting to a PointLight."),t=new n.PointLight(i,a)}void 0!==r.CastShadows&&1===r.CastShadows.value&&(t.castShadow=!0)}return t}},{key:"createMesh",value:function(e,t,r){var i,a=null,o=null,s=[];return e.children.forEach((function(e){t.has(e.ID)&&(a=t.get(e.ID)),r.has(e.ID)&&s.push(r.get(e.ID))})),1<s.length?o=s:0<s.length?o=s[0]:(o=new n.MeshPhongMaterial({color:13421772}),s.push(o)),"color"in a.attributes&&s.forEach((function(e){e.vertexColors=!0})),a.FBX_Deformer?(i=new n.SkinnedMesh(a,o)).normalizeSkinWeights():i=new n.Mesh(a,o),i}},{key:"createCurve",value:function(e,t){e=e.children.reduce((function(e,n){return t.has(n.ID)?t.get(n.ID):e}),null);var r=new n.LineBasicMaterial({color:3342591,linewidth:1});return new n.Line(e,r)}},{key:"getTransformData",value:function(e,t){var n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),n.eulerOrder="RotationOrder"in t?wi(t.RotationOrder.value):"ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}},{key:"setLookAtProperties",value:function(e,t){"LookAtProperty"in t&&Yr.get(e.ID).children.forEach((function(t){"LookAtProperty"===t.relationship&&"Lcl_Translation"in(t=Qr.Objects.Model[t.ID])&&(t=t.Lcl_Translation.value,void 0!==e.target?(e.target.position.fromArray(t),qr.add(e.target)):e.lookAt((new n.Vector3).fromArray(t)))}))}},{key:"bindSkeleton",value:function(e,t,r){var i,a=this.parsePoseNodes();for(i in e)!function(i){var o=e[i];Yr.get(parseInt(o.ID)).parents.forEach((function(e){t.has(e.ID)&&(e=e.ID,Yr.get(e).parents.forEach((function(e){r.has(e.ID)&&r.get(e.ID).bind(new n.Skeleton(o.bones),a[e.ID])})))}))}(i)}},{key:"parsePoseNodes",value:function(){var e={};if("Pose"in Qr.Objects){var t,r,i=Qr.Objects.Pose;for(t in i)"BindPose"===i[t].attrType&&0<i[t].NbPoseNodes&&(r=i[t].PoseNode,Array.isArray(r)?r.forEach((function(t){e[t.Node]=(new n.Matrix4).fromArray(t.Matrix.a)})):e[r.Node]=(new n.Matrix4).fromArray(r.Matrix.a))}return e}},{key:"createAmbientLight",value:function(){var e,t,r;"GlobalSettings"in Qr&&"AmbientColor"in Qr.GlobalSettings&&(r=(t=Qr.GlobalSettings.AmbientColor.value)[0],e=t[1],t=t[2],0===r&&0===e&&0===t||(r=new n.Color(r,e,t),qr.add(new n.AmbientLight(r,1))))}}]),e}(),li=function(){function e(){ti(this,e)}return ri(e,[{key:"parse",value:function(e){var t=new Map;if("Geometry"in Qr.Objects){var n,r=Qr.Objects.Geometry;for(n in r){var i=Yr.get(parseInt(n));i=this.parseGeometry(i,r[n],e),t.set(parseInt(n),i)}}return t}},{key:"parseGeometry",value:function(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}},{key:"parseMeshGeometry",value:function(e,t,n){var r,i=n.skeletons,a=[],o=e.parents.map((function(e){return Qr.Objects.Model[e.ID]}));if(0!==o.length)return r=e.children.reduce((function(e,t){return void 0!==i[t.ID]?i[t.ID]:e}),null),e.children.forEach((function(e){void 0!==n.morphTargets[e.ID]&&a.push(n.morphTargets[e.ID])})),e=o[0],o={},"RotationOrder"in e&&(o.eulerOrder=wi(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=xi(o),this.genGeometry(t,r,a,e)}},{key:"genGeometry",value:function(e,t,r,i){var a,o,s=new n.BufferGeometry,l=(e.attrName&&(s.name=e.attrName),this.parseGeoNode(e,t)),u=this.genBuffers(l),c=new n.Float32BufferAttribute(u.vertex,3);return c.applyMatrix4(i),s.setAttribute("position",c),0<u.colors.length&&s.setAttribute("color",new n.Float32BufferAttribute(u.colors,3)),t&&(s.setAttribute("skinIndex",new n.Uint16BufferAttribute(u.weightsIndices,4)),s.setAttribute("skinWeight",new n.Float32BufferAttribute(u.vertexWeights,4)),s.FBX_Deformer=t),0<u.normal.length&&(c=(new n.Matrix3).getNormalMatrix(i),(t=new n.Float32BufferAttribute(u.normal,3)).applyNormalMatrix(c),s.setAttribute("normal",t)),u.uvs.forEach((function(e,t){var r="uv"+(t+1).toString();s.setAttribute(r=0===t?"uv":r,new n.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,r,i),s}},{key:"parseGeoNode",value:function(e,t){var n={};if(n.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],n.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];for(var r=0;e.LayerElementUV[r];)e.LayerElementUV[r].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return n.weightTable={},null!==t&&(n.skeleton=t).rawBones.forEach((function(e,t){e.indices.forEach((function(r,i){void 0===n.weightTable[r]&&(n.weightTable[r]=[]),n.weightTable[r].push({id:t,weight:e.weights[i]})}))})),n}},{key:"genBuffers",value:function(e){var t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},n=0,r=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=gi(f,n,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 n=e,r=b[t];v.forEach((function(e,t,i){e<n&&(i[t]=n,n=e,i=m[t],m[t]=r,r=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=gi(f,n,d,e.normal),o.push(g[0],g[1],g[2])),e.material&&"AllSame"!==e.material.mappingType&&(p=gi(f,n,d,e.material)[0]),e.uv&&e.uv.forEach((function(e,t){e=gi(f,n,d,e),void 0===l[t]&&(l[t]=[]),l[t].push(e[0]),l[t].push(e[1])})),r++,y&&(h.genFace(t,e,a,p,o,s,l,u,c,r),n++,r=0,a=[],o=[],s=[],l=[],u=[],c=[])})),t}},{key:"genFace",value:function(e,t,n,r,i,a,o,s,l,u){for(var c=2;c<u;c++)!function(u){e.vertex.push(t.vertexPositions[n[0]]),e.vertex.push(t.vertexPositions[n[1]]),e.vertex.push(t.vertexPositions[n[2]]),e.vertex.push(t.vertexPositions[n[3*(u-1)]]),e.vertex.push(t.vertexPositions[n[3*(u-1)+1]]),e.vertex.push(t.vertexPositions[n[3*(u-1)+2]]),e.vertex.push(t.vertexPositions[n[3*u]]),e.vertex.push(t.vertexPositions[n[3*u+1]]),e.vertex.push(t.vertexPositions[n[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(r),e.materialIndex.push(r),e.materialIndex.push(r)),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,n){void 0===e.uvs[n]&&(e.uvs[n]=[]),e.uvs[n].push(o[n][0]),e.uvs[n].push(o[n][1]),e.uvs[n].push(o[n][2*(u-1)]),e.uvs[n].push(o[n][2*(u-1)+1]),e.uvs[n].push(o[n][2*u]),e.uvs[n].push(o[n][2*u+1])}))}(c)}},{key:"addMorphTargets",value:function(e,t,n,r){var i;0!==n.length&&(e.morphTargetsRelative=!0,e.morphAttributes.position=[],i=this,n.forEach((function(n){n.rawTargets.forEach((function(n){var a=Qr.Objects.Geometry[n.geoID];void 0!==a&&i.genMorphGeometry(e,t,a,r,n.name)}))})))}},{key:"genMorphGeometry",value:function(e,t,r,i,a){t=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[];for(var o=void 0!==r.Vertices?r.Vertices.a:[],s=void 0!==r.Indexes?r.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 n.Float32BufferAttribute(l.vertex,3)).name=a||r.attrName,t.applyMatrix4(i),e.morphAttributes.position.push(t)}},{key:"parseNormals",value:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Normals.a,i=[];return"IndexToDirect"===n&&("NormalIndex"in e?i=e.NormalIndex.a:"NormalsIndex"in e&&(i=e.NormalsIndex.a)),{dataSize:3,buffer:r,indices:i,mappingType:t,referenceType:n}}},{key:"parseUVs",value:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=[];return{dataSize:2,buffer:e.UV.a,indices:r="IndexToDirect"===n?e.UVIndex.a:r,mappingType:t,referenceType:n}}},{key:"parseVertexColors",value:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=[];return{dataSize:4,buffer:e.Colors.a,indices:r="IndexToDirect"===n?e.ColorIndex.a:r,mappingType:t,referenceType:n}}},{key:"parseMaterialIndices",value:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};for(var r=e.Materials.a,i=[],a=0;a<r.length;++a)i.push(a);return{dataSize:1,buffer:r,indices:i,mappingType:t,referenceType:n}}},{key:"parseNurbsGeometry",value:function(e){if(void 0===$r)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 n.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 n.BufferGeometry;for(var r=t-1,i=(t=e.KnotVector.a,[]),a=e.Points.a,o=0,s=a.length;o<s;o+=4)i.push((new n.Vector4).fromArray(a,o));if("Closed"===e.Form)i.push(i[0]);else if("Periodic"===e.Form)for(var l=r,u=t.length-1-l,c=0;c<r;++c)i.push(i[c]);return e=new $r(r,t,i,l,u).getPoints(12*i.length),(new n.BufferGeometry).setFromPoints(e)}}]),e}(),ui=function(){function e(){ti(this,e)}return ri(e,[{key:"parse",value:function(){var e=[],t=this.parseClips();if(void 0!==t)for(var n in t)n=t[n],n=this.addClip(n),e.push(n);return e}},{key:"parseClips",value:function(){var e;if(void 0!==Qr.Objects.AnimationCurve)return e=this.parseAnimationCurveNodes(),this.parseAnimationCurves(e),e=this.parseAnimationLayers(e),this.parseAnimStacks(e)}},{key:"parseAnimationCurveNodes",value:function(){var e,t=Qr.Objects.AnimationCurveNode,n=new Map;for(e in t){var r=t[e];null!==r.attrName.match(/S|R|T|DeformPercent/)&&(r={id:r.id,attr:r.attrName,curves:{}},n.set(r.id,r))}return n}},{key:"parseAnimationCurves",value:function(e){var t,n=Qr.Objects.AnimationCurve;for(t in n){var r,i={id:n[t].id,times:n[t].KeyTime.a.map(mi),values:n[t].KeyValueFloat.a},a=Yr.get(i.id);void 0!==a&&(r=a.parents[0].ID,(a=a.parents[0].relationship).match(/X/)?e.get(r).curves.x=i:a.match(/Y/)?e.get(r).curves.y=i:a.match(/Z/)?e.get(r).curves.z=i:a.match(/d|DeformPercent/)&&e.has(r)&&(e.get(r).curves.morph=i))}}},{key:"parseAnimationLayers",value:function(e){var t,r=Qr.Objects.AnimationLayer,i=new Map;for(t in r)!function(t){var r=[],a=Yr.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===r[i]){var o=Yr.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID;if(void 0!==o){var s=Qr.Objects.Model[o.toString()];if(void 0===s)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",t);var l={modelName:s.attrName?n.PropertyBinding.sanitizeNodeName(s.attrName):"",ID:s.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};qr.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 n.Matrix4),"PreRotation"in s&&(l.preRotation=s.PreRotation.value),"PostRotation"in s&&(l.postRotation=s.PostRotation.value),r[i]=l}}r[i]&&(r[i][a.attr]=a)}else void 0!==a.curves.morph&&(void 0===r[i]&&(o=Yr.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,t=Yr.get(o).parents[0].ID,t=Yr.get(t).parents[0].ID,t=Yr.get(t).parents[0].ID,t={modelName:(t=Qr.Objects.Model[t]).attrName?n.PropertyBinding.sanitizeNodeName(t.attrName):"",morphName:Qr.Objects.Deformer[o].attrName},r[i]=t),r[i][a.attr]=a)}})),i.set(parseInt(t),r))}(t);return i}},{key:"parseAnimStacks",value:function(e){var t,n=Qr.Objects.AnimationStack,r={};for(t in n){var i=(1<(i=Yr.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));r[t]={name:n[t].attrName,layer:i}}return r}},{key:"addClip",value:function(e){var t=[],r=this;return e.layer.forEach((function(e){t=t.concat(r.generateTracks(e))})),new n.AnimationClip(e.name,-1,t)}},{key:"generateTracks",value:function(e){var t=[],r=new n.Vector3,i=new n.Quaternion,a=new n.Vector3;return e.transform&&e.transform.decompose(r,i,a),r=r.toArray(),i=(new n.Euler).setFromQuaternion(i,e.eulerOrder).toArray(),a=a.toArray(),void 0!==e.T&&0<Object.keys(e.T.curves).length&&void 0!==(r=this.generateVectorTrack(e.modelName,e.T.curves,r,"position"))&&t.push(r),void 0!==e.R&&0<Object.keys(e.R.curves).length&&void 0!==(r=this.generateRotationTrack(e.modelName,e.R.curves,i,e.preRotation,e.postRotation,e.eulerOrder))&&t.push(r),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!==(r=this.generateMorphTrack(e))&&t.push(r),t}},{key:"generateVectorTrack",value:function(e,t,r,i){var a=this.getTimesForAllAxes(t);return t=this.getKeyframeTrackValues(a,t,r),new n.VectorKeyframeTrack(e+"."+i,a,t)}},{key:"generateRotationTrack",value:function(e,t,r,i,a,o){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(n.MathUtils.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(n.MathUtils.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(n.MathUtils.degToRad));for(var s=this.getTimesForAllAxes(t),l=this.getKeyframeTrackValues(s,t,r),u=(void 0!==i&&((i=i.map(n.MathUtils.degToRad)).push(o),i=(new n.Euler).fromArray(i),i=(new n.Quaternion).setFromEuler(i)),void 0!==a&&((a=a.map(n.MathUtils.degToRad)).push(o),a=(new n.Euler).fromArray(a),a=(new n.Quaternion).setFromEuler(a).invert()),new n.Quaternion),c=new n.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 n.QuaternionKeyframeTrack(e+".quaternion",s,h)}},{key:"generateMorphTrack",value:function(e){var t=e.DeformPercent.curves.morph,r=t.values.map((function(e){return e/100})),i=qr.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new n.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+i+"]",t.times,r)}},{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 n=1,r=t[0],i=1;i<t.length;i++){var a=t[i];a!==r&&(r=t[n]=a,n++)}t=t.slice(0,n)}return t}},{key:"getKeyframeTrackValues",value:function(e,t,n){var r=n,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),r[0]=e):i.push(r[0]),-1!==o?(e=t.y.values[o],i.push(e),r[1]=e):i.push(r[1]),-1!==s?(e=t.z.values[s],i.push(e),r[2]=e):i.push(r[2])})),i}},{key:"interpolateRotations",value:function(e){for(var t=1;t<e.values.length;t++){var n=e.values[t-1],r=e.values[t]-n;if(180<=(i=Math.abs(r))){for(var i,a=r/(i/=180),o=n+a,s=(r=e.times[t-1],(e.times[t]-r)/i),l=r+s,u=[],c=[];l<e.times[t];)u.push(l),l+=s,c.push(o),o+=a;e.times=Mi(e.times,t,u),e.values=Mi(e.values,t,c)}}}}]),e}(),ci=function(){function e(){ti(this,e)}return ri(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 fi,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var t=this,n=e.split(/[\r\n]+/);return n.forEach((function(e,r){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,n[++r]):i?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e))})),this.allNodes}},{key:"parseNodeBegin",value:function(e,t){var n=t[1].trim().replace(/^"/,"").replace(/"$/,""),r=(t=t[2].split(",").map((function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")})),{name:n}),i=(t=this.parseNodeAttr(t),this.getCurrentNode());0===this.currentIndent?this.allNodes.add(n,r):n in i?("PoseNode"===n?i.PoseNode.push(r):void 0!==i[n].id&&(i[n]={},i[n][i[n].id]=i[n]),""!==t.id&&(i[n][t.id]=r)):"number"==typeof t.id?(i[n]={},i[n][t.id]=r):"Properties70"!==n&&(i[n]="PoseNode"===n?[r]:r),"number"==typeof t.id&&(r.id=t.id),""!==t.name&&(r.attrName=t.name),""!==t.type&&(r.attrType=t.type),this.pushStack(r)}},{key:"parseNodeAttr",value:function(e){var t=e[0],n=(""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0])),""),r="";return 1<e.length&&(n=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:n,type:r}}},{key:"parseNodeProperty",value:function(e,t,n){var r=t[1].replace(/^"/,"").replace(/"$/,"").trim();if(t=t[2].replace(/^"/,"").replace(/"$/,"").trim(),"Properties70"===("Content"===r&&","===t&&(t=n.replace(/"/g,"").replace(/,$/,"").trim()),n=this.getCurrentNode()).name)this.parseNodeSpecialProperty(e,r,t);else{if("C"===r){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=(r="connections",t=[i,e]),s=a,l=0,u=o.length,c=s.length;l<c;l++,u++)o[u]=s[l];void 0===n[r]&&(n[r]=[])}"Node"===r&&(n.id=t),r in n&&Array.isArray(n[r])?n[r].push(t):"a"!==r?n[r]=t:n.a=t,this.setCurrentProp(n,r),"a"===r&&","!==t.slice(-1)&&(n.a=Ai(t))}}},{key:"parseNodePropertyContinued",value:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=Ai(t.a))}},{key:"parseNodeSpecialProperty",value:function(e,t,n){n=n.split('",').map((function(e){return e.trim().replace(/^\"/,"").replace(/\s/,"_")}));var r=n[0],i=n[1],a=n[2],o=n[3],s=n[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=Ai(s)}this.getPrevNode()[r]={type:i,type2:a,flag:o,value:s},this.setCurrentProp(this.getPrevNode(),r)}}]),e}(),hi=function(){function t(){ti(this,t)}return ri(t,[{key:"parse",value:function(e){var t=new di(e),n=(t.skip(23),t.getUint32());if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);for(var r=new fi;!this.endOfContent(t);){var i=this.parseNode(t,n);null!==i&&r.add(i.name,i)}return r}},{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 n={},r=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===r)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(n.singleProperty=1===i&&e.getOffset()===r;r>e.getOffset();){var h=this.parseNode(e,t);null!==h&&this.parseSubNode(o,n,h)}return n.propertyList=s,"number"==typeof a&&(n.id=a),""!==u&&(n.attrName=u),""!==c&&(n.attrType=c),""!==o&&(n.name=o),n}},{key:"parseSubNode",value:function(e,t,n){var r,i,a,o,s;!0===n.singleProperty?(i=n.propertyList[0],Array.isArray(i)?(t[n.name]=n).a=i:t[n.name]=i):"Connections"===e&&"C"===n.name?(r=[],n.propertyList.forEach((function(e,t){0!==t&&r.push(e)})),void 0===t.connections&&(t.connections=[]),t.connections.push(r)):"Properties70"===n.name?Object.keys(n).forEach((function(e){t[e]=n[e]})):"Properties70"===e&&"P"===n.name?(i=n.propertyList[0],e=n.propertyList[1],a=n.propertyList[2],o=n.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_")?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],t[i]={type:e,type2:a,flag:o,value:s}):void 0===t[n.name]?"number"==typeof n.id?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:"PoseNode"===n.name?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):void 0===t[n.name][n.id]&&(t[n.name][n.id]=n)}},{key:"parseProperty",value:function(t){var n=t.getString(1);switch(n){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 r=t.getUint32(),i=t.getUint32(),a=t.getUint32();if(0===i)switch(n){case"b":case"c":return t.getBooleanArray(r);case"d":return t.getFloat64Array(r);case"f":return t.getFloat32Array(r);case"i":return t.getInt32Array(r);case"l":return t.getInt64Array(r)}void 0===e&&console.error("THREE.FBXLoader: External library fflate.min.js required."),i=vr(new Uint8Array(t.getArrayBuffer(a)));var o=new di(i.buffer);switch(n){case"b":case"c":return o.getBooleanArray(r);case"d":return o.getFloat64Array(r);case"f":return o.getFloat32Array(r);case"i":return o.getInt32Array(r);case"l":return o.getInt64Array(r)}default:throw new Error("THREE.FBXLoader: Unknown property type "+n)}}}]),t}(),di=function(){function e(t,n){ti(this,e),this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===n||n}return ri(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=[],n=0;n<e;n++)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=[],n=0;n<e;n++)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=[],n=0;n<e;n++)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=[],n=0;n<e;n++)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=[],n=0;n<e;n++)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=[],r=0;r<e;r++)t[r]=this.getUint8();var i=t.indexOf(0);return 0<=i&&(t=t.slice(0,i)),n.LoaderUtils.decodeText(new Uint8Array(t))}}]),e}(),fi=function(){function e(){ti(this,e)}return ri(e,[{key:"add",value:function(e,t){this[e]=t}}]),e}();function pi(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 mi(e){return e/46186158e3}var vi=[];function gi(e,t,n,r){var i;switch(r.mappingType){case"ByPolygonVertex":i=e;break;case"ByPolygon":i=t;break;case"ByVertice":i=n;break;case"AllSame":i=r.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+r.mappingType)}for(var a=(i="IndexToDirect"===r.referenceType?r.indices[i]:i)*r.dataSize,o=a+r.dataSize,s=vi,l=r.buffer,u=o,c=a,h=0;c<u;c++,h++)s[h]=l[c];return s}var yi=new n.Euler,bi=new n.Vector3;function xi(e){var t=new n.Matrix4,r=new n.Matrix4,i=new n.Matrix4,a=new n.Matrix4,o=new n.Matrix4,s=new n.Matrix4,l=new n.Matrix4,u=new n.Matrix4,c=new n.Matrix4,h=new n.Matrix4,d=new n.Matrix4,f=new n.Matrix4,p=e.inheritType||0,m=(e.translation&&t.setPosition(bi.fromArray(e.translation)),e.preRotation&&((m=e.preRotation.map(n.MathUtils.degToRad)).push(e.eulerOrder),r.makeRotationFromEuler(yi.fromArray(m))),e.rotation&&((m=e.rotation.map(n.MathUtils.degToRad)).push(e.eulerOrder),i.makeRotationFromEuler(yi.fromArray(m))),e.postRotation&&((m=e.postRotation.map(n.MathUtils.degToRad)).push(e.eulerOrder),a.makeRotationFromEuler(yi.fromArray(m)),a.invert()),e.scale&&o.scale(bi.fromArray(e.scale)),e.scalingOffset&&l.setPosition(bi.fromArray(e.scalingOffset)),e.scalingPivot&&s.setPosition(bi.fromArray(e.scalingPivot)),e.rotationOffset&&u.setPosition(bi.fromArray(e.rotationOffset)),e.rotationPivot&&c.setPosition(bi.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(d.copy(e.parentMatrix),h.copy(e.parentMatrixWorld)),r.clone().multiply(i).multiply(a)),v=(((e=new n.Matrix4).extractRotation(h),v=new n.Matrix4).copyPosition(h),v.clone().invert().multiply(h)),g=(v=e.clone().invert().multiply(v),o),y=new n.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 n.Matrix4).scale((new n.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(r).multiply(i).multiply(a).multiply(v).multiply(l).multiply(s).multiply(o).multiply(p),m=(new n.Matrix4).copyPosition(e),d=h.clone().multiply(m),f.copyPosition(d),(e=f.clone().multiply(y)).premultiply(h.invert()),e}function wi(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 Ai(e){return e.split(",").map((function(e){return parseFloat(e)}))}function Si(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=e.byteLength),n.LoaderUtils.decodeText(new Uint8Array(e,t,r))}function Mi(e,t,n){return e.slice(0,t).concat(n).concat(e.slice(t))}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 Bi(e,t){return(Bi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Ci(e){return(Ci=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ei=/^[og]\s*(.+)?/,Ti=/^mtllib /,Di=/^usemtl /,Pi=/^usemap /,Oi=new n.Vector3,Ri=new n.Vector3,Ii=new n.Vector3,ki=new n.Vector3,Li=new n.Vector3,Fi=new n.Color;function Ui(){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 n=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 n=this._finalize(!1);return n&&(n.inherited||n.groupCount<=0)&&this.materials.splice(n.index,1),e={index:this.materials.length,name:e||"",mtllib:Array.isArray(t)&&0<t.length?t[t.length-1]:"",smooth:(void 0!==n?n:this).smooth,groupStart:void 0!==n?n.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 n=this.materials.length-1;0<=n;n--)this.materials[n].groupCount<=0&&this.materials.splice(n,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},n&&n.name&&"function"==typeof n.clone&&((e=n.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,n){var r=this.vertices,i=this.object.geometry.vertices;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+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,n){var r=this.normals,i=this.object.geometry.normals;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addFaceNormal:function(e,t,n){var r=this.vertices,i=this.object.geometry.normals;Oi.fromArray(r,e),Ri.fromArray(r,t),Ii.fromArray(r,n),Li.subVectors(Ii,Ri),ki.subVectors(Oi,Ri),Li.cross(ki),Li.normalize(),i.push(Li.x,Li.y,Li.z),i.push(Li.x,Li.y,Li.z),i.push(Li.x,Li.y,Li.z)},addColor:function(e,t,n){var r=this.colors,i=this.object.geometry.colors;void 0!==r[e]&&i.push(r[e+0],r[e+1],r[e+2]),void 0!==r[t]&&i.push(r[t+0],r[t+1],r[t+2]),void 0!==r[n]&&i.push(r[n+0],r[n+1],r[n+2])},addUV:function(e,t,n){var r=this.uvs,i=this.object.geometry.uvs;i.push(r[e+0],r[e+1]),i.push(r[t+0],r[t+1]),i.push(r[n+0],r[n+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,n,r,i,a,o,s,l){var u=this.vertices.length;e=this.parseVertexIndex(e,u),t=this.parseVertexIndex(t,u),n=this.parseVertexIndex(n,u),this.addVertex(e,t,n),this.addColor(e,t,n),void 0!==o&&""!==o?(u=this.normals.length,e=this.parseNormalIndex(o,u),t=this.parseNormalIndex(s,u),n=this.parseNormalIndex(l,u),this.addNormal(e,t,n)):this.addFaceNormal(e,t,n),void 0!==r&&""!==r?(o=this.uvs.length,e=this.parseUVIndex(r,o),t=this.parseUVIndex(i,o),n=this.parseUVIndex(a,o),this.addUV(e,t,n),this.object.geometry.hasUVIndices=!0):this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";for(var t=this.vertices.length,n=0,r=e.length;n<r;n++){var i=this.parseVertexIndex(e[n],t);this.addVertexPoint(i),this.addColor(i)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";for(var n=this.vertices.length,r=this.uvs.length,i=0,a=e.length;i<a;i++)this.addVertexLine(this.parseVertexIndex(e[i],n));for(var o=0,s=t.length;o<s;o++)this.addUVLine(this.parseUVIndex(t[o],r))}};return e.startObject("",!1),e}var Gi=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&&Bi(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 n,r=Ci(e);if(n=t?(n=Ci(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===_i(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e){if(this instanceof i)return(e=r.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,r,i){var a=this,o=new n.FileLoader(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(function(n){try{t(a.parse(n))}catch(n){i?i(n):console.error(n),a.manager.itemError(e)}}),r,i)}},{key:"setMaterials",value:function(e){return this.materials=e,this}},{key:"parse",value:function(e){for(var t,r,i,a=new Ui,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?(Fi.setRGB(parseFloat(d[4]),parseFloat(d[5]),parseFloat(d[6])).convertSRGBToLinear(),a.colors.push(Fi.r,Fi.g,Fi.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=[],_=[];if(-1===s.indexOf("/"))M=S;else for(var B=0,C=S.length;B<C;B++){var E=S[B].split("/");""!==E[0]&&M.push(E[0]),""!==E[1]&&_.push(E[1])}a.addLineGeometry(M,_)}else"p"===t?(r=s.slice(1).trim().split(" "),a.addPointGeometry(r)):null!==(l=Ei.exec(s))?(r=(" "+l[0].slice(1).trim()).slice(1),a.startObject(r)):Di.test(s)?a.object.startMaterial(s.substring(7).trim(),a.materialLibraries):Ti.test(s)?a.materialLibraries.push(s.substring(7).trim()):Pi.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 n.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 R=a.objects[P],I=R.geometry,k=R.materials,L="Line"===I.type,F="Points"===I.type,U=!1;if(0!==I.vertices.length){for(var G=new n.BufferGeometry,N=(G.setAttribute("position",new n.Float32BufferAttribute(I.vertices,3)),0<I.normals.length&&G.setAttribute("normal",new n.Float32BufferAttribute(I.normals,3)),0<I.colors.length&&(U=!0,G.setAttribute("color",new n.Float32BufferAttribute(I.colors,3))),!0===I.hasUVIndices&&G.setAttribute("uv",new n.Float32BufferAttribute(I.uvs,2)),[]),j=0,H=k.length;j<H;j++){var z,V=k[j],J=V.name+"_"+V.smooth+"_"+U,W=a.materials[J];null!==this.materials&&(W=this.materials.create(V.name),!L||!W||W instanceof n.LineBasicMaterial?!F||!W||W instanceof n.PointsMaterial||(z=new n.PointsMaterial({size:10,sizeAttenuation:!1}),n.Material.prototype.copy.call(z,W),z.color.copy(W.color),z.map=W.map,W=z):(z=new n.LineBasicMaterial,n.Material.prototype.copy.call(z,W),z.color.copy(W.color),W=z)),void 0===W&&((W=L?new n.LineBasicMaterial:F?new n.PointsMaterial({size:1,sizeAttenuation:!1}):new n.MeshPhongMaterial).name=V.name,W.flatShading=!V.smooth,W.vertexColors=U,a.materials[J]=W),N.push(W)}if(I=void 0,1<N.length){for(var K=0,Z=k.length;K<Z;K++){var X=k[K];G.addGroup(X.groupStart,X.groupCount,K)}I=new(L?n.LineSegments:F?n.Points:n.Mesh)(G,N)}else I=new(L?n.LineSegments:F?n.Points:n.Mesh)(G,N[0]);I.name=R.name,D.add(I)}}else 0<a.vertices.length&&(e=new n.PointsMaterial({size:1,sizeAttenuation:!1}),(T=new n.BufferGeometry).setAttribute("position",new n.Float32BufferAttribute(a.vertices,3)),0<a.colors.length&&void 0!==a.colors[0]&&(T.setAttribute("color",new n.Float32BufferAttribute(a.colors,3)),e.vertexColors=!0),T=new n.Points(T,e),D.add(T));return D}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(n.Loader),Ni=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function o(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(o,s)}l((r=r.apply(e,t||[])).next())}))};const ji=t.FBXLoader;class Hi{constructor(e){this.parses={fbx:new ji,obj:new Gi,object:new n.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 Ni(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 Ni(this,void 0,void 0,(function*(){var t=yield(0,fe.toResult)(e,"arrayBuffer");let n="model";return t=yield this.runScene.loaderer.gltf.parse(t,{triggerCb:!0,callBack:{beforeParse:e=>{"scene"===(e=e.asset.ex.type)&&this.runScene.sceneEx.clean()},getJSON(e){n=(null==(e=e.asset.ex)?void 0:e.type)||"scene"}}}),{type:n,result:t}}))}fbx(e){return Ni(this,void 0,void 0,(function*(){var t=e instanceof ArrayBuffer?e:yield(0,fe.toResult)(e,"arrayBuffer");const n=this.parses.fbx.parse(t,"");return n.traverse((e=>{e.material&&(e.material=this.runScene.materialEx.create())})),{type:"model",result:this.runScene.sceneEx.cleanUnlessLevel(n)}}))}obj(e){return Ni(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,fe.toResult)(e,"text"):e;const n=this.parses.obj.parse(t);return n.traverse((e=>{e.material&&(e.material=this.runScene.materialEx.create())})),{type:"model",result:this.runScene.sceneEx.cleanUnlessLevel(n)}}))}json(e){return Ni(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,fe.toResult)(e,"text"):e,n=JSON.parse(t);return"timeLine"===n.type?{type:"timeLine",result:n.data}:{type:"model",result:this.runScene.loaderer.json.parse(t)}}))}}class zi 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)},n=()=>{const{renderer:e,controls:t}=this.runScene.assetsEx;var n=this.runScene.render;"tick"===this._lastRenderMode?e.setAnimationLoop(null):"controlsChange"===this._lastRenderMode&&t.removeEventListener("change",n)},r=e=>{var t=this.runScene.render;const{renderer:n,controls:r}=this.runScene.assetsEx;"tick"===e?n.setAnimationLoop(t):"controlsChange"===e&&r.addEventListener("change",t)};return e=>{this._lastRenderMode!==e&&(t(),n(),r(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 Vi extends A{constructor(e,t){super(e,t),this.transGizmo=this.children[0],this.scaleCoefficient=new n.Vector3,this.beginScale=new n.Vector3,this.posStart=new n.Vector2,this.posEnd=new n.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 Ji extends n.Object3D{constructor(e){super(),this.isViewHelper=!0,this.animating=!1,this.controls=null,this.dummy=new n.Object3D,this.turnRate=2*Math.PI,this.targetPosition=new n.Vector3,this.targetQuaternion=new n.Quaternion,this.q1=new n.Quaternion,this.q2=new n.Quaternion,this.radius=0,this.clock=new n.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 r=this.controls.target;switch(e){case"posX":this.targetPosition.set(1,0,0),this.targetQuaternion.setFromEuler(new n.Euler(0,.5*Math.PI,0));break;case"posY":this.targetPosition.set(0,1,0),this.targetQuaternion.setFromEuler(new n.Euler(.5*-Math.PI,0,0));break;case"posZ":this.targetPosition.set(0,0,1),this.targetQuaternion.setFromEuler(new n.Euler);break;case"negX":this.targetPosition.set(-1,0,0),this.targetQuaternion.setFromEuler(new n.Euler(0,.5*-Math.PI,0));break;case"negY":this.targetPosition.set(0,-1,0),this.targetQuaternion.setFromEuler(new n.Euler(.5*Math.PI,0,0));break;case"negZ":this.targetPosition.set(0,0,-1),this.targetQuaternion.setFromEuler(new n.Euler(0,Math.PI,0));break;default:console.error("ViewHelper: Invalid axis.")}this.radius=t.position.distanceTo(r),this.targetPosition.multiplyScalar(this.radius).add(r),this.dummy.position.copy(r),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 n=this.runScene.assetsEx.get().camera;e*=this.turnRate;var t=this.controls.target;this.q1.rotateTowards(this.q2,e),n.position.set(0,0,1).applyQuaternion(this.q1).multiplyScalar(this.radius).add(t),n.quaternion.rotateTowards(this.targetQuaternion,e),0===this.q1.angleTo(this.q2)&&(this.animating=!1)}}}class Wi{constructor(e){this.grid=null,this.transContro=null,this.boxHelper=null,this.clean=()=>{this.unfocus()},this.deepIsHelper=e=>"Scene"===e.type||!this.isHelper(e)&&!!e.parent&&this.deepIsHelper(e.parent),this.getBoxHelper=e=>(e=new n.BoxHelper(e),this.setHelper(e),this.runScene.assetsEx.get().scene.add(e),e),this.runScene=e,"running"!==this.runScene.optionsEx.options.mode&&(this.runScene.cb.clean.add("EngineHelper",this.clean),this.transContro=new class{constructor(e){this.tansControls=null,this.controlsMode="position",this.isDraggingChange=!1,this.modelNewVal=new W.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,n=this.controlsMode,r=this.runScene.modelEx.select||this.runScene.multipSelector.getLast();r&&(this.runScene.multipSelector.draggingchanged(e),t.enabled?(this.modelNewVal=this.runScene.modelEx.cloneV3(r[n]),this.isDraggingChange=!0):(this.runScene.multipSelector.isEmpty()&&this.runScene.modelEx.setV3({model:r,info:n,newV3:this.runScene.modelEx.cloneV3(r[n]),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:n}=this.runScene.assetsEx.get();this.tansControls=new Vi(e,t.domElement),this.tansControls.addEventListener("dragging-changed",this.draggingChanged),this.tansControls.addEventListener("change",this.transChangeFn.bind(this)),this.tansControls.name="helper",n.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),console.log(234,"234")),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 Ji(e),this.grid=this.createGrid(),this.init())}init(){this.transContro.init(),this.runScene.assetsEx.get().scene.add(this.grid)}createGrid(){const e=new W.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,n){return e.userData.isHelper=!0,t&&e.traverse((e=>{e.userData.isHelper=!0,n&&n(e)})),e}focus(e){"running"!==this.runScene.optionsEx.options.mode&&(this.boxHelper||(this.boxHelper=this.getBoxHelper(e)),(0,gt.RQ)(e)||(this.boxHelper.visible=!0,this.boxHelper.setFromObject(e)),this.transContro.addObject(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)}}Me=__webpack_require__(4356);var Ki=__webpack_require__.n(Me),Zi=__webpack_require__(6569),Xi=__webpack_require__(5860),Qi=__webpack_require__(1682),Yi=__webpack_require__(9960);class qi{constructor(e){this.selectors={},this.boxHelperMap={},this.savedV3=new le.Z,this.tempOldval=new So.Vector3,this.runScene=e}add(e,t=!1){if("array"===(0,Zi.getType)(e))return e.map((e=>this.add(e)));var n=this.runScene.modelEx.select;if(n&&(this.runScene.modelEx.selectNull(),delete this.selectors[e.uuid],this.add(n)),"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,n,r,i,a){"position"!==t&&(i=r,a=n);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 Qi.Z({target:e,info:t,oldV3:this.runScene.modelEx.cloneV3(n),newV3:r,runScene:this.runScene}).execute()];o.map((n=>{if(n!==e){var{x:r,y:i,z:a}=n[t],r=r+=u,i=i+=c,a=a+=h;let e=n[t].clone();e.x=r,e.y=i,e.z=a,r=new Qi.Z({target:n,info:t,oldV3:this.runScene.modelEx.cloneV3(n[t]),newV3:e,runScene:this.runScene}).execute(),d.push(r),this.boxHelperMap[n.uuid].setFromObject(n)}})),this.boxHelperMap[e.uuid].setFromObject(e),this.runScene.undoEx.addUndo(d)}draggingchanged(e){const t=this.runScene.assetsEx.get().controls;var n;this.isEmpty()?this.runScene.events.mouse.enableUp=!0:this.runScene.events.mouse.enableUp=!1,e.value?this.isEmpty()||(t.enabled=!1,e=this.getLast(),n=this.runScene.helperEx.transContro.controlsMode,this.tempOldval="position"===n?(0,Yi.VU)(e,this.runScene.sceneEx.get()):this.runScene.modelEx.cloneV3(e[n]),this.saveV3(n)):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 n;this.runScene.events.mouse.enableUp=!1,this.runScene.helperEx.boxHelper.setFromObject(this.runScene.assetsEx.get().scene),n="position"===e?(0,Yi.VU)(t,this.runScene.sceneEx.get()):this.runScene.modelEx.cloneV3(t[e]),this.getInfo({model:t,type:e,newV3:n,oldV3:this.tempOldval}),this.tempOldval.copy(n)}}saveV3(e){this.getSelectedList("value").map((t=>{var n=(0,St.K)(t);this.savedV3.set(n,{model:t,type:e,val:this.runScene.modelEx.cloneV3(t[e])})}))}useV3(){var e=this.savedV3.map(((e,{type:t,val:n,model:r})=>new Qi.Z({target:r,info:t,newV3:this.runScene.modelEx.cloneV3(r[t]),oldV3:n,runScene:this.runScene})));this.runScene.undoEx.addUndo(e),this.savedV3.clear()}getInfo(e){const{model:t,type:n,newV3:r,oldV3:i}=e,a=this.getSelectedList("value");var{x:e,y:o,z:s}=r;const l=e-i.x,u=o-i.y,c=s-i.z;t[n].copy(r),a.map((e=>{if(e!==t){var{x:r,y:i,z:a}=e[n],r=r+=l,i=i+=u,a=a+=c;let t=e[n].clone();t.x=r,t.y=i,t.z=a,e[n].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 n.Group;const t=new n.Group;this.runScene.modelEx.add(e,void 0,{addUndo:!1}),this.runScene.modelEx.add(t);var r=[...this.getSelectedList("value")],i=(this.runScene.cb.model.multipDrop.cb({models:this.getSelectedList("value"),dropModel:e}),Ki().group.getCenter(e));t.position.copy(i),this.runScene.cb.model.multipDrop.cb({models:r,dropModel:t}),this.runScene.modelEx.remove(e,!1),this.runScene.modelEx.select=t}getSelectorGroup(){const e=this.getSelectedList("value"),t=new n.Group;return e.forEach((e=>t.add(e.clone()))),this.setEmpty(),t}rename(e){const{prefix:t,rmPrefixLength:n,back:r,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!==n){if(n>l.length)return;l=l.substring(n)}if(0!==i){if(i>l.length)return;l=l.substring(0,l.length-i)}0<t.length&&(l=t+l),0<r.length&&(l+=r)}else l=a+(s+1)*o;return new Xi.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[r]=t;var n=t.map((t=>{var n=t.position.clone();const i=("all"===e?r:t).position.clone();return"all"!==e&&(i[e]=r.position[e]),new Qi.Z({target:t,info:"position",oldV3:n,newV3:i,runScene:this.runScene}).execute()}));this.runScene.multipSelector.add(t,!0),this.runScene.undoEx.addUndo(n)}}}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 ea(e,t){return(ea=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function ta(e){return(ta=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var na=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ea(t,e);var 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 n,r=ta(e);if(n=t?(n=ta(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===$i(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;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 n.ShaderMaterial({name:"SkyShader",fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:n.UniformsUtils.clone(e.uniforms),side:n.BackSide,depthWrite:!1}),r.call(this,new n.BoxGeometry(1,1,1),e)}return t=i,Object.defineProperty(t,"prototype",{writable:!1}),t}(n.Mesh),ra=(na.prototype.isSky=!0,na.SkyShader={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new n.Vector3},up:{value:new n.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)),ia=__webpack_require__(2266);const aa={color:"#000000",intensity:1};class oa{diff(e,t){const n={};return(0,z.js)(aa,(r=>{var i=e[r];(0,wt.Xq)(i,t[r])&&(n[r]=i)})),n}setConfig(e,t){var{color:t,intensity:n,shadow:r}=t,{mapSize:r,camera:i}=r||{},{far:i,near:a,scale:o}=i||{};void 0!==o&&(e.shadow.camera.scale.x=o,e.shadow.camera.scale.y=o,e.shadow.camera.scale.z=o),void 0!==a&&(e.shadow.camera.near=a),void 0!==i&&(e.shadow.camera.far=i),void 0!==r&&(e.shadow.mapSize.x=r,e.shadow.mapSize.y=r),void 0!==n&&(e.intensity=n),void 0!==t&&(e.color=(0,Yi.e9)(t)),e.shadow.camera.updateProjectionMatrix(),null!=(o=e.cameraHelper)&&o.update()}}var sa=__webpack_require__(6001);class la extends V{constructor(){super(...arguments),this.allState=["morning","noon","evening","night","midnight"],this.sun=new So.Vector3,this.light=new oa,this.sky=new na,this.directionalLight=new So.DirectionalLight,this.baseLightConfig={name:"天空定向光",type:"DirectionalLight",castShadow:!0},this.skyData={isShow:!1,size:5e3,lightConfig:{shadow:{mapSize:512,camera:{near:.5,far:500,scale:1,top:5,bottom:5,left:5,right:5}}},effectController:{morning:{turbidity:2,rayleigh:1,mieCoefficient:.007,mieDirectionalG:.7,elevation:0,azimuth:180,exposure:.3,lightConfig:Object.assign(Object.assign({},(0,ia.d9)(aa)),{color:"#3DC1F1"}),time:1},noon:{turbidity:1,rayleigh:1,mieCoefficient:.005,mieDirectionalG:.7,elevation:90,azimuth:180,exposure:1,time:1,lightConfig:Object.assign(Object.assign({},(0,ia.d9)(aa)),{color:"#FFFFFF"})},evening:{turbidity:2,rayleigh:.3,mieCoefficient:.011,mieDirectionalG:.67,elevation:3,azimuth:0,exposure:.3762,lightConfig:Object.assign(Object.assign({},(0,ia.d9)(aa)),{color:"#FFFFFF"}),time:1},night:{turbidity:1,rayleigh:1,mieCoefficient:.005,mieDirectionalG:.7,elevation:2,azimuth:0,exposure:.2624,lightConfig:Object.assign(Object.assign({},(0,ia.d9)(aa)),{color:"#B8A277"}),time:1},midnight:{turbidity:.1,rayleigh:.5,mieCoefficient:.022,mieDirectionalG:.83,elevation:0,azimuth:0,exposure:.3079,lightConfig:Object.assign(Object.assign({},(0,ia.d9)(aa)),{color:"#B47E15"}),time:1}},currentState:"morning"},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.lastTime={index:0,name:"morning"},this.skyChangeArr=[],this.lightChangeArr=[],this.uniforms=null,this.inied=!1,this.currentLightConfig={},this.backUpSkyData={},this.currentAnimas=[],this.awaitAnimas=[],this.animaInstance=null,this.animaIndex={begin:0,end:0},this.getNromalFn=()=>{this.playSky()},this.getSpecialFn=()=>{var e=this.allState[0];this.setSkyConfig(e),this.setLightSpecialConfig(e),this.lightAnima(e),0!==this.animaIndex.end&&(this.currentAnimas=this.getAnimasDataByState(this.allState[this.animaIndex.end],e),this.playSky())}}init(){this.backUpData(),this.addScene()}addScene(){bt.materialIgnore.set(this.sky.material,!0),(0,Z.setHelper)(this.sky),Z.selectableModel.close(this.sky),Z.selectableModel.close(this.directionalLight),(0,Z.setHelper)(this.directionalLight),this.directionalLight.helper&&(this.directionalLight.helper.visible=!1),this.runScene.modelEx.add(this.sky,void 0,{addToTree:!1})}setOpen(e){const t=this.runScene.assetsEx.get().renderer;this.sky.visible!==e&&(this.directionalLight.visible=e),t.toneMapping=e?4:0,this.skyData.isShow=e,this.sky.visible=e}toJSON(){var{currentState:e,effectController:t,isShow:n,lightConfig:r,size:i}=this.skyData;return{currentState:e,effectController:t,isShow:n,lightConfig:r,size:i}}parseJSON(e){var t,n,r;e&&(({isShow:t,currentState:n,size:r}=e),this.parseLightConfig(e),this.inied||(this.init(),this.inied=!0),this.parseSkyConfig(n,r),this.setOpen(t))}parseLightConfig(e){var{isShow:e,effectController:t,currentState:n,lightConfig:r,size:i}=e,a=r.shadow,o=t[n].lightConfig,[o]=(a=new ra.Z(this.runScene).parseJSON(Object.assign(Object.assign({shadow:a},o),this.baseLightConfig)),this.runScene.lightEx.add(a,{addToTree:!1}),a);this.directionalLight=o,this.skyData.lightConfig=r,this.skyData.isShow=e,this.directionalLight.visible=e,this.skyData.effectController=t,this.skyData.currentState=n,this.skyData.size=i,this.sky.visible=e,this.setLightSpecialConfig(n),this.lightAnima(n)}parseSkyConfig(e,t){this.setSkyConfig(e),this.setSkyScale(t)}setState(e){var t=this.skyData.currentState;this.doAnimaByState(e,t),this.saveLastTimeState({oldState:t,state:e,index:this.allState.findIndex((t=>t===e))})}saveLastTimeState(e){var{oldState:e,state:t,index:n}=e;this.lastTime.name=e,this.lastTime.index=n,this.skyData.currentState=t}getLightDataByState(e){let t=new So.Vector3,n=new So.Vector3;switch(e){case"morning":t.x=0,t.y=0,t.z=-this.skyData.size,n.x=0,n.y=this.skyData.size/2*-1,n.z=this.skyData.size/2;break;case"noon":t.x=0,t.y=this.skyData.size/2,t.z=0,n.x=0,n.y=-1*this.skyData.size,n.z=0;break;case"evening":case"night":case"midnight":t.x=0,t.y=0,t.z=this.skyData.size,n.x=0,n.y=this.skyData.size/2*-1,n.z=this.skyData.size/2*-1}return{position:t,targetPosition:n}}getIdxByState(e){return this.allState.findIndex((t=>t===e))}setSkyConfig(e){const{renderer:t,scene:n,camera:r}=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(n,r);var i=So.MathUtils.degToRad(90-this.skyData.effectController[e].elevation);e=So.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}setSky(e){var{state:e,type:t,val:n}=e;this.skyData.effectController[e][t]=n,this.setSkyConfig(e)}setCurrentState(e){this.skyData.currentState=e}setStateTime(e){var{info:e,time:t}=e;this.skyData.effectController[e].time=t}reset(){this.setOpen(!1)}clean(){this.setOpen(!1),this.skyData=this.backUpSkyData}setLight(e,t){switch(console.log(e,t,"data"),e){case"mapSize":this.skyData.lightConfig.shadow.mapSize=t,this.directionalLight.shadow.mapSize.x=t,this.directionalLight.shadow.mapSize.y=t;break;case"near":this.skyData.lightConfig.shadow.camera.near=t,this.directionalLight.shadow.camera.near=t;break;case"far":this.skyData.lightConfig.shadow.camera.far=t,this.directionalLight.shadow.camera.far=t;break;case"scale":this.skyData.lightConfig.shadow.camera.scale=t,this.directionalLight.shadow.camera.scale.set(t,t,t);break;case"top":this.skyData.lightConfig.shadow.camera.top=t,this.skyData.lightConfig.shadow.camera.bottom=t,this.skyData.lightConfig.shadow.camera.left=t,this.skyData.lightConfig.shadow.camera.right=t,this.directionalLight.shadow.camera.top=t,this.directionalLight.shadow.camera.bottom=t,this.directionalLight.shadow.camera.left=t,this.directionalLight.shadow.camera.right=t,this.directionalLight.shadow.camera.updateProjectionMatrix(),null!=(n=this.directionalLight.cameraHelper)&&n.update();break;case"color":this.skyData.effectController[this.skyData.currentState].lightConfig.color=t;var n=new So.Color(t);this.directionalLight.color=n;break;case"intensity":this.skyData.effectController[this.skyData.currentState].lightConfig.intensity=t,this.directionalLight.intensity=t}}setLightSpecialConfig(e){var{color:e,intensity:t}=this.skyData.effectController[e].lightConfig;this.directionalLight.color=(0,Yi.e9)(e),this.directionalLight.intensity=t}getAnimasDataByState(e,t){e=this.getIdxByState(e);const n=[];if((t=this.getIdxByState(t))<e){this.animaIndex={begin:e,end:t};var r=e-t;let l=t;for(let e=0;e<r;e++){var{color:i,intensity:a}=this.skyData.effectController[this.allState[l]].lightConfig,{position:o,targetPosition:s}=this.getLightDataByState(this.allState[l]),{color:i,intensity:a}=(n.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[l]],color:i,intensity:a,position:o,targetPosition:s})}),l++,this.skyData.effectController[this.allState[l]].lightConfig),{position:o,targetPosition:s}=this.getLightDataByState(this.allState[l]);n.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[l]],color:i,intensity:a,position:o,targetPosition:s}),onDone:this.getNromalFn})}}else{var l=4-t;this.animaIndex={begin:t,end:e};let r=t;if(0==l)return n.push({onDone:this.getSpecialFn}),n;for(let e=0;e<l;e++){var{color:u,intensity:c}=this.skyData.effectController[this.allState[r]].lightConfig,{position:h,targetPosition:d}=this.getLightDataByState(this.allState[r]),{position:h,targetPosition:d}=(n.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[r]],color:u,intensity:c,position:h,targetPosition:d})}),r++,this.getLightDataByState(this.allState[r]));n.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[r]],color:u,intensity:c,position:h,targetPosition:d}),onDone:4===r?this.getSpecialFn:this.getNromalFn})}}return n}playSky(){if(0!==this.currentAnimas.length){const t=this.currentAnimas.shift();var e=this.currentAnimas.shift();if(!e)return t.onDone();this.playAnima(t,e)}}playAnima(e,t){const{renderer:n,scene:r,camera:i}=this.runScene.assetsEx.get();this.animaInstance=K.anima(Object.assign(Object.assign({},e.data),{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}),Object.assign(Object.assign({},t.data),{ease:"none"}),e.data.time,(e=>{var{r:a,g:o,b:s}=e,l=(this.onUpdated(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,n.toneMappingExposure=e.exposure,n.render(r,i),So.MathUtils.degToRad(90-e.elevation)),u=So.MathUtils.degToRad(t.data.azimuth);this.sun.setFromSphericalCoords(1,l,u),this.sky.material.uniforms.sunPosition.value.copy(this.sun),l=new So.Color(a,o,s),this.directionalLight.color=l,this.directionalLight.intensity=e.intensity,this.directionalLight.position.set(e.x,e.y,e.z),this.directionalLight.target.position.set(e.tx,e.ty,e.tz)}),(()=>{t.onDone(),this.animaInstance=null}))}doAnimaByState(e,t){e=this.getAnimasDataByState(e,t),this.animaInstance?this.awaitAnimas=e:(this.currentAnimas=e,this.playSky())}onUpdated(e){var t;0!==this.awaitAnimas.length&&(this.animaInstance.kill(),this.animaInstance=null,[t]=this.awaitAnimas,this.currentAnimas=[...this.awaitAnimas],this.awaitAnimas=[],null!=t&&t.data&&(this.currentAnimas.unshift({data:t.data,onDone:this.getNromalFn}),this.currentAnimas.unshift({data:e})),this.playSky())}lightAnima(e){var{position:e,targetPosition:t}=this.getLightDataByState(e);this.directionalLight.position.set(e.x,e.y,e.z),this.directionalLight.target.position.set(t.x,t.y,t.z)}transDataToAnimaData(e){var{sky:e,color:t,position:n,targetPosition:r,intensity:i}=e,{x:n,y:a,z:o}=n,{x:r,y:s,z:l}=r,{r:t,g:u,b:c}=(0,wt.fh)(sa.trans.HextoRgb(t));return Object.assign(Object.assign({},e),{r:t,g:u,b:c,x:n,y:a,z:o,tx:r,ty:s,tz:l,intensity:i})}backUpData(){this.backUpSkyData=this.deepClone(this.skyData)}deepClone(e){let t=null;if([Date,RegExp,Set,WeakSet,Map,WeakMap,Error].includes(null==e?void 0:e.constructor))t=new e.constructor(e);else if(Array.isArray(e))t=[],e.forEach(((e,n)=>{t[n]=this.deepClone(e)}));else if("object"==typeof e&&null!==e){t={};for(const n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=this.deepClone(e[n]))}else t=e;return t}}class ua{constructor(e){this.clean=()=>{this.sky.reset()},this.sky=new la(e),this.runScene=e,this.runScene.cb.clean.add("Objects",this.clean)}init(){}toJSON(){return{sky:this.sky.toJSON()}}parseJSON(e){this.sky.parseJSON(e.sky)}}function ca(){var e=0,t=document.createElement("div");function n(e){return t.appendChild(e.dom),e}function r(n){for(var r=0;r<t.children.length;r++)t.children[r].style.display=r===n?"block":"none";e=n}t.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",t.addEventListener("click",(function(n){n.preventDefault(),r(++e%t.children.length)}),!1);var i,a=(performance||Date).now(),o=a,s=0,l=n(new ca.Panel("FPS","#0ff","#002")),u=n(new ca.Panel("MS","#0f0","#020"));return self.performance&&self.performance.memory&&(i=n(new ca.Panel("MB","#f08","#201"))),r(0),{REVISION:16,dom:t,addPanel:n,showPanel:r,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:r}}ca.Panel=function(e,t,n){var r=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=n,v.fillRect(0,0,s,l),v.fillStyle=t,v.fillText(e,u,c),v.fillRect(h,d,f,p),v.fillStyle=n,v.globalAlpha=.9,v.fillRect(h,d,f,p),{dom:m,update:function(l,g){r=Math.min(r,l),i=Math.max(i,l),v.fillStyle=n,v.globalAlpha=1,v.fillRect(0,0,s,d),v.fillStyle=t,v.fillText(a(l)+" "+e+" ("+a(r)+"-"+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=n,v.globalAlpha=.9,v.fillRect(h+f-o,d,o,a((1-l/g)*p))}}};const ha=ca;class da{constructor(e,t){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},event:{base:"canvas"},texture:{load:!0,lazyLoad:{open:!1,intervalTime:16.6},quality:1}},this.exporterOptions={compressTexture:!1,notMaterial:!1,outTime:(0,K.getTime)(7)},this.sceneOptions={loaded:!1},this.setLoadInterval=(()=>{let e=null;return t=>{const{inputInterval:n,cb:r}=t;e&&clearTimeout(e),e=setTimeout((()=>{r(),e=null,clearTimeout(e)}),n)}})(),this.runScene=e,this.options=(0,K.deepMergeObject)(this.options,t||{})}init(e){this.options.showFps&&(this.addFps(e),this.runScene.cb.render.add("optionx-ex-render",this.render.bind(this)))}addFps(e){this.stats=ha(),this.stats.showPanel(0),e.appendChild(this.stats.dom)}render(){var e;null!=(e=this.stats)&&e.update()}log(e,t="detail",n="success"){var r;null!=(r=null==(r=this.options)?void 0:r.msg)&&r.show&&("base"===this.options.msg.level&&"base"===t&&this.runScene.cb.baseLog.cb({msg:e,type:n}),console.log(e))}}class fa{constructor(e){this.glowModelLength=new Set,this.outlineModelLength=new Set,this.runScene=e,this.initGlow(),this.initOutline()}initGlow(){const{setLayers:e,add:t,remove:n}=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)})),n.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:n}=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)})),n.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 pa={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}"},ma=__webpack_require__(8493),va=__webpack_require__(8512),ga={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new n.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 ya(e){return(ya="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 ba(e,t){return(ba=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function xa(e){return(xa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var wa=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&&ba(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 n,r=xa(e);if(n=t?(n=xa(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===ya(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;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=r.call(this)).strength=void 0!==t?t:1,s.radius=a,s.threshold=o,s.resolution=void 0!==e?new n.Vector2(e.x,e.y):new n.Vector2(256,256),s.clearColor=new n.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 n.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 n.WebGLRenderTarget(l,u)).texture.name="UnrealBloomPass.h"+c,h.texture.generateMipmaps=!1,s.renderTargetsHorizontal.push(h),h=new n.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=ga;for(var d=(s.highPassUniforms=n.UniformsUtils.clone(a.uniforms),s.highPassUniforms.luminosityThreshold.value=o,s.highPassUniforms.smoothWidth.value=.01,s.materialHighPassFilter=new n.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 n.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 n.Vector3(1,1,1),new n.Vector3(1,1,1),new n.Vector3(1,1,1),new n.Vector3(1,1,1),new n.Vector3(1,1,1)],s.compositeMaterial.uniforms.bloomTintColors.value=s.bloomTintColors,e=pa,s.copyUniforms=n.UniformsUtils.clone(e.uniforms),s.copyUniforms.opacity.value=1,s.materialCopy=new n.ShaderMaterial({uniforms:s.copyUniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,blending:n.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0}),s.enabled=!0,s.needsSwap=!1,s._oldClearColor=new n.Color,s.oldClearAlpha=1,s.basic=new n.MeshBasicMaterial,s.fsQuad=new va.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 r=Math.round(e/2),i=Math.round(t/2);this.renderTargetBright.setSize(r,i);for(var a=0;a<this.nMips;a++)this.renderTargetsHorizontal[a].setSize(r,i),this.renderTargetsVertical[a].setSize(r,i),this.separableBlurMaterials[a].uniforms.texSize.value=new n.Vector2(r,i),r=Math.round(r/2),i=Math.round(i/2)}},{key:"render",value:function(e,t,n,r,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=n.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=n.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(n),this.fsQuad.render(e),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=o}},{key:"getSeperableBlurMaterial",value:function(e){return new n.ShaderMaterial({defines:{KERNEL_RADIUS:e,SIGMA:e},uniforms:{colorTexture:{value:null},texSize:{value:new n.Vector2(.5,.5)},direction:{value:new n.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 n.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 n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(va.w);wa.BlurDirectionX=new n.Vector2(1,0),wa.BlurDirectionY=new n.Vector2(0,1);class Aa extends va.w{constructor(e,t,r){super(),this.baseTextureID=void 0!==t?t:"tDiffuse",this.effectTextureID=void 0!==r?r:"tDiffuse",e instanceof n.ShaderMaterial?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=n.UniformsUtils.clone(e.uniforms),this.material=new n.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new va.T(this.material)}render(e,t,n){this.uniforms[this.baseTextureID]&&(this.uniforms[this.baseTextureID].value=t.texture),this.uniforms[this.effectTextureID]&&(this.uniforms[this.effectTextureID].value=n.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 Sa extends va.w{constructor(e,t,r,i,a){super(),this.scene=e,this.camera=t,this.layerIndex=0,this.overrideMaterial=r,this.clearColor=i,this.clearAlpha=void 0!==a?a:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.oldClearColor=new n.Color,this.oldCameraLayer=t.layers.mask}render(e,t,n){var r=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:n),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=r}}const Ma={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 _a{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 Sa(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 wa(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 Aa(Ma,"baseTexture","bloomTexture"),this.mixingPass.renderToScreen=!1),this.effectCopy||(this.effectCopy=new ma.T(pa),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 Ba(e){return(Ba="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ca(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ea(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ta(e,t,n){t&&Ea(e.prototype,t),n&&Ea(e,n),Object.defineProperty(e,"prototype",{writable:!1})}function Da(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&&Pa(e,t)}function Pa(e,t){return(Pa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function Oa(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 n,r=Ra(e);if(n=t?(n=Ra(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===Ba(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function Ra(e){return(Ra=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ia=function(){Da(t,va.w);var e=Oa(t);function t(n,r){var i;return Ca(this,t),(i=e.call(this)).scene=n,i.camera=r,i.clear=!0,i.needsSwap=!1,i.inverse=!1,i}return Ta(t,[{key:"render",value:function(e,t,n){var r,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?(r=0,1):(r=1,0),o.buffers.stencil.setTest(!0),o.buffers.stencil.setOp(a.REPLACE,a.REPLACE,a.REPLACE),o.buffers.stencil.setFunc(a.ALWAYS,r,4294967295),o.buffers.stencil.setClear(i),o.buffers.stencil.setLocked(!0),e.setRenderTarget(n),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}(),ka=function(){Da(t,va.w);var e=Oa(t);function t(){var n;return Ca(this,t),(n=e.call(this)).needsSwap=!1,n}return Ta(t,[{key:"render",value:function(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}]),t}();function La(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var Fa=function(){function e(t,r){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===r?(i=t.getSize(new n.Vector2),this._pixelRatio=t.getPixelRatio(),this._width=i.width,this._height=i.height,(r=new n.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio)).texture.name="EffectComposer.rt1"):(this._pixelRatio=1,this._width=r.width,this._height=r.height),this.renderTarget1=r,this.renderTarget2=r.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],void 0===ma.T&&console.error("THREE.EffectComposer relies on ShaderPass"),this.copyPass=new ma.T(pa),this.clock=new n.Clock}return function(e,t,n){t&&La(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(),n=!1,r=0,i=this.passes.length;r<i;r++){var a,o,s=this.passes[r];!1!==s.enabled&&(s.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(r),s.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),s.needsSwap&&(n&&(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!==Ia&&(s instanceof Ia?n=!0:s instanceof ka&&(n=!1)))}this.renderer.setRenderTarget(t)}},{key:"reset",value:function(e){var t;void 0===e&&(t=this.renderer.getSize(new n.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 n=this._width*this._pixelRatio,r=this._height*this._pixelRatio;this.renderTarget1.setSize(n,r),this.renderTarget2.setSize(n,r);for(var i=0;i<this.passes.length;i++)this.passes[i].setSize(n,r)}},{key:"setPixelRatio",value:function(e){this._pixelRatio=e,this.setSize(this._width,this._height)}}]),e}();new n.OrthographicCamera(-1,1,1,-1,0,1),(Se=new n.BufferGeometry).setAttribute("position",new n.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),Se.setAttribute("uv",new n.Float32BufferAttribute([0,2,0,0,2,0],2));const Ua="\n varying vec2 vUv;\n \n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",Ga="\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 Na{constructor(e){this.mtuPP=e,this.bloomLayer=new So.Layers,this.bloomLayer.set(this.mtuPP.BLOOM_SCENE),this.darkMaterial=new So.MeshBasicMaterial({color:"black"}),this.materials={},(e=this.mtuPP.mainScene).fog&&(this.mtuPP.sceneFogColor||(this.mtuPP.sceneFogColor=new So.Color),this.mtuPP.sceneFogColor.copy(e.fog.color)),e.background&&(this.mtuPP.sceneBackground=e.background),this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.bloomPass=new wa(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 ma.T(new So.ShaderMaterial({uniforms:{baseTexture:{value:null},bloomTexture:{value:this.mtuPP.effectComposer.renderTarget2.texture}},vertexShader:Ua,fragmentShader:Ga,defines:{}}),"baseTexture"),this.finalPass.needsSwap=!0;var e=new So.WebGLRenderTarget(this.mtuPP.rtSize.x,this.mtuPP.rtSize.y,{samples:this.mtuPP.ppParams.samples});this.finalComposer=new Fa(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 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 Ha(e,t){return(Ha=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 Va=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&&Ha(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 n,r=za(e);if(n=t?(n=za(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===ja(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;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=r.call(this)).renderScene=t,s.renderCamera=a,s.selectedObjects=void 0!==o?o:[],s.visibleEdgeColor=new n.Color(1,1,1),s.hiddenEdgeColor=new n.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 n.Vector2(e.x,e.y):new n.Vector2(256,256),t=Math.round(s.resolution.x/s.downSampleRatio),a=Math.round(s.resolution.y/s.downSampleRatio),s.renderTargetMaskBuffer=new n.WebGLRenderTarget(s.resolution.x,s.resolution.y),s.renderTargetMaskBuffer.texture.name="OutlinePass.mask",s.renderTargetMaskBuffer.texture.generateMipmaps=!1,s.depthMaterial=new n.MeshDepthMaterial,s.depthMaterial.side=n.DoubleSide,s.depthMaterial.depthPacking=n.RGBADepthPacking,s.depthMaterial.blending=n.NoBlending,s.prepareMaskMaterial=s.getPrepareMaskMaterial(),s.prepareMaskMaterial.side=n.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 n.WebGLRenderTarget(s.resolution.x,s.resolution.y),s.renderTargetDepthBuffer.texture.name="OutlinePass.depth",s.renderTargetDepthBuffer.texture.generateMipmaps=!1,s.renderTargetMaskDownSampleBuffer=new n.WebGLRenderTarget(t,a),s.renderTargetMaskDownSampleBuffer.texture.name="OutlinePass.depthDownSample",s.renderTargetMaskDownSampleBuffer.texture.generateMipmaps=!1,s.renderTargetBlurBuffer1=new n.WebGLRenderTarget(t,a),s.renderTargetBlurBuffer1.texture.name="OutlinePass.blur1",s.renderTargetBlurBuffer1.texture.generateMipmaps=!1,s.renderTargetBlurBuffer2=new n.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 n.WebGLRenderTarget(t,a),s.renderTargetEdgeBuffer1.texture.name="OutlinePass.edge1",s.renderTargetEdgeBuffer1.texture.generateMipmaps=!1,s.renderTargetEdgeBuffer2=new n.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=pa,s.copyUniforms=n.UniformsUtils.clone(o.uniforms),s.copyUniforms.opacity.value=1,s.materialCopy=new n.ShaderMaterial({uniforms:s.copyUniforms,vertexShader:o.vertexShader,fragmentShader:o.fragmentShader,blending:n.NoBlending,depthTest:!1,depthWrite:!1,transparent:!0}),s.enabled=!0,s.needsSwap=!1,s._oldClearColor=new n.Color,s.oldClearAlpha=1,s.fsQuad=new va.T(null),s.tempPulseColor1=new n.Color,s.tempPulseColor2=new n.Color,s.textureMatrix=new n.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 n(n){n.isMesh&&(!0===e?n.visible=t.get(n):(t.set(n,n.visible),n.visible=e))}for(var r=0;r<this.selectedObjects.length;r++)this.selectedObjects[r].traverse(n)}},{key:"changeVisibilityOfNonSelectedObjects",value:function(e){var t=this._visibilityCache,n=[];function r(e){e.isMesh&&n.push(e)}for(var i=0;i<this.selectedObjects.length;i++)this.selectedObjects[i].traverse(r);this.renderScene.traverse((function(r){if(r.isMesh||r.isSprite){for(var i,a=!1,o=0;o<n.length;o++)if(n[o].id===r.id){a=!0;break}!1===a&&(i=r.visible,!1!==e&&!0!==t.get(r)||(r.visible=e),t.set(r,i))}else(r.isPoints||r.isLine)&&(!0===e?r.visible=t.get(r):(t.set(r,r.visible),r.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,n,r,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(n),this.fsQuad.render(e),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=o),this.renderToScreen&&(this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=n.texture,e.setRenderTarget(null),this.fsQuad.render(e))}},{key:"getPrepareMaskMaterial",value:function(){return new n.ShaderMaterial({uniforms:{depthTexture:{value:null},cameraNearFar:{value:new n.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 n.ShaderMaterial({uniforms:{maskTexture:{value:null},texSize:{value:new n.Vector2(.5,.5)},visibleEdgeColor:{value:new n.Vector3(1,1,1)},hiddenEdgeColor:{value:new n.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 n.ShaderMaterial({defines:{MAX_RADIUS:e},uniforms:{colorTexture:{value:null},texSize:{value:new n.Vector2(.5,.5)},direction:{value:new n.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 n.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:n.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0})}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(va.w);Va.BlurDirectionX=new n.Vector2(1,0),Va.BlurDirectionY=new n.Vector2(0,1);class Ja{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.outlinePass||(this.outlinePass=new Va(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 So.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,n)=>{t.uuid===e.uuid&&(e.userData.outline=!1,this.outlinePass.selectedObjects.splice(n,1))})))}isObjExist(e){if(!e||!this.outlinePass||!this.outlinePass.selectedObjects)return!1;let t=!1;return this.outlinePass.selectedObjects.forEach((n=>{e.uuid===n.uuid&&(t=!0)})),t}enablePass(e){this.outlinePass&&this.outlinePass.enabled!==e&&(this.outlinePass.enabled=e)}}class Wa extends n.ShaderMaterial{constructor(...e){super(...e),["opacity","map","emissiveMap","roughnessMap","metalnessMap"].forEach((e=>{Object.defineProperty(this,e,{get(){if(e in this.uniforms)return this.uniforms[e].value},set(t){e in this.uniforms&&(this.uniforms[e].value=t)}})}))}}class Ka extends Wa{constructor(...e){super(...e),this.modifiedDefines={},this.modifiedUniforms={}}setDefine(e,t){const n=this.defines,r=this.modifiedDefines;null==t?e in n&&(e in r||(r[e]=n[e]),delete n[e]):n[e]!==t&&(e in r||(r[e]=e in n?n[e]:void 0),n[e]=t)}setTextureUniform(e,t){const n=this.uniforms,r=this.modifiedUniforms;e in r||(r[e]=n[e].value),n[e].value=t}finalize(){const e=this.modifiedDefines;var t=this.defines;for(const n in e)void 0===e[n]?n in t&&(this.needsUpdate=!0):t[n]!==e[n]&&(this.needsUpdate=!0),delete e[n];const n=this.modifiedUniforms;var r=this.uniforms;for(const e in n)n[e]!==r[e].value&&(this.needsUpdate=!0),delete n[e]}}const Za=new WeakMap;class Xa{constructor(e){this._replacementMaterial=new Ka(e),this._replacementMaterials=new WeakMap,this.overrideUniforms={},this.overrideDefines={}}replace(e,t=!1,n=!0){const r=this;function i(e){if(!e.isHelper&&(e.isMesh||e.isSkinnedMesh)){if(!a.has(e)){const t=r.createMaterial(e);a.set(e,t)}const t=a.get(e);if(null!==t){let i=e.material;n?o.set(e,i):i=o.get(e),i||console.error("ShaderReplacement : Material for object was not cached before replacing shader.",e),r.updateUniforms(e,i,t),t.finalize&&t.finalize(),e.material=t}}}const a=this._replacementMaterials,o=Za;if(Array.isArray(e))if(t)for(let t=0,n=e.length;t<n;t++)e[t].traverse(i);else for(let t=0,n=e.length;t<n;t++)i(e[t]);else t?e.traverse(i):i(e)}reset(e,t){function n(e){e.isHelper||(r.has(e)?(e.material=r.get(e),r.delete(e)):(e.isSkinnedMesh||e.isMesh)&&console.error("ShaderReplacement : Material for object was not cached before resetting.",e))}const r=Za;if(Array.isArray(e))if(t)for(let t=0,r=e.length;t<r;t++)n(e[t]);else for(let t=0,r=e.length;t<r;t++)e[t].traverse(n);else t?e.traverse(n):n(e)}createMaterial(e){return this._replacementMaterial.clone()}updateUniforms(e,t,n){var r=this._replacementMaterial.defines,i=t.defines;const a=n.defines;if(n.side=t.side,n.flatShading=t.flatShading,n.skinning=t.skinning,i){for(const e in i)n.setDefine(e,i[e]);for(const e in a)e in i?n.setDefine(e,i[e]):n.setDefine(e,r[e])}const o=n.uniforms;if(t.isShaderMaterial){var s=t.uniforms;for(const e in o){var l=s[e];const t=o[e];l&&l.value!==t.value&&(t.value&&t.value.isTexture||l.value&&l.value.isTexture?n.setTextureUniform(e,l.value):t.value=l.value)}}else for(const e in o){const r=o[e];e in t&&t[e]!==r.value&&(r.value&&r.value.isTexture||t[e]&&t[e].isTexture?n.setTextureUniform(e,t[e]):r.value=t[e])}var{overrideDefines:u,overrideUniforms:c}=this;for(const e in u)null===u[e]||void 0===u[e]?delete a[e]:a[e]!==u[e]&&(a[e]=u[e],n.needsUpdate=!0);for(const e in c)e in o&&(o[e].value=c[e].value)}dispose(){}}class Qa extends Xa{constructor(){super({extensions:{derivatives:!0},defines:{USE_UV:""},uniforms:Object.assign(Object.assign({},n.ShaderLib.normal.uniforms),{alphaMap:{value:null},alphaTest:{value:0},map:{value:null},opacity:{value:1}}),vertexShader:n.ShaderLib.normal.vertexShader,fragmentShader:"\n\t\t\t\t#define NORMAL\n\t\t\t\tuniform float opacity;\n\t\t\t\t#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\t\t\t\t\tvarying vec3 vViewPosition;\n\t\t\t\t#endif\n\t\t\t\t#ifndef FLAT_SHADED\n\t\t\t\t\tvarying vec3 vNormal;\n\t\t\t\t\t#ifdef USE_TANGENT\n\t\t\t\t\t\tvarying vec3 vTangent;\n\t\t\t\t\t\tvarying vec3 vBitangent;\n\t\t\t\t\t#endif\n\t\t\t\t#endif\n\t\t\t\t#include <packing>\n\t\t\t\t#include <uv_pars_fragment>\n\t\t\t\t#include <map_pars_fragment>\n\t\t\t\t#include <bumpmap_pars_fragment>\n\t\t\t\t#include <normalmap_pars_fragment>\n\t\t\t\t#include <alphamap_pars_fragment>\n\t\t\t\t#include <logdepthbuf_pars_fragment>\n\t\t\t\t#include <clipping_planes_pars_fragment>\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t\t\t\t\t#include <clipping_planes_fragment>\n\t\t\t\t\t#include <logdepthbuf_fragment>\n\t\t\t\t\t#include <map_fragment>\n\t\t\t\t\t#include <alphamap_fragment>\n\t\t\t\t\t#include <alphatest_fragment>\n\t\t\t\t\t#include <normal_fragment_begin>\n\t\t\t\t\t#include <normal_fragment_maps>\n\t\t\t\t\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t\t\t\t}\n\t\t\t"}),this.useNormalMaps=!1}createMaterial(...e){return super.createMaterial(...e)}updateUniforms(e,t,n){super.updateUniforms(e,t,n),n.setDefine("USE_NORMALMAP",this.useNormalMaps&&n.uniforms.normalMap.value?"":void 0),n.setDefine("TANGENTSPACE_NORMALMAP",this.useNormalMaps&&n.uniforms.normalMap.value?"":void 0),n.setDefine("ALPHATEST",n.uniforms.alphaTest.value||void 0),n.setDefine("USE_ALPHAMAP",0!==n.defines.ALPHATEST&&n.uniforms.alphaMap.value?"":void 0),n.setDefine("USE_MAP",0!==n.defines.ALPHATEST&&n.uniforms.map.value?"":void 0),n.setDefine("USE_UV","USE_ALPHAMAP"in n.defines||"USE_MAP"in n.defines?"":void 0)}}class Ya extends Xa{constructor(){super({extensions:{derivatives:!0},defines:{USE_UV:""},uniforms:Object.assign(Object.assign({},n.ShaderLib.normal.uniforms),{alphaMap:{value:null},alphaTest:{value:0},map:{value:null},opacity:{value:1}}),vertexShader:"\n\t\t\t\tvarying vec3 vViewPosition;\n\t\t\t\t#include <common>\n\t\t\t\t#include <uv_pars_vertex>\n\t\t\t\t#include <displacementmap_pars_vertex>\n\t\t\t\t#include <morphtarget_pars_vertex>\n\t\t\t\t#include <skinning_pars_vertex>\n\t\t\t\t#include <logdepthbuf_pars_vertex>\n\t\t\t\t#include <clipping_planes_pars_vertex>\n\t\t\t\tvoid main() {\n\t\t\t\t\t#include <uv_vertex>\n\t\t\t\t\t#include <beginnormal_vertex>\n\t\t\t\t\t#include <morphnormal_vertex>\n\t\t\t\t\t#include <skinbase_vertex>\n\t\t\t\t\t#include <skinnormal_vertex>\n\t\t\t\t\t#include <defaultnormal_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 <displacementmap_vertex>\n\t\t\t\t\t#include <project_vertex>\n\t\t\t\t\t#include <logdepthbuf_vertex>\n\t\t\t\t\t#include <clipping_planes_vertex>\n\t\t\t\t\tvViewPosition = mvPosition.xyz;\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\t\t\t\tuniform float opacity;\n\t\t\t\tvarying vec3 vViewPosition;\n\t\t\t\t#include <uv_pars_fragment>\n\t\t\t\t#include <map_pars_fragment>\n\t\t\t\t#include <bumpmap_pars_fragment>\n\t\t\t\t#include <normalmap_pars_fragment>\n\t\t\t\t#include <alphamap_pars_fragment>\n\t\t\t\t#include <logdepthbuf_pars_fragment>\n\t\t\t\t#include <clipping_planes_pars_fragment>\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t\t\t\t\t#include <clipping_planes_fragment>\n\t\t\t\t\t#include <logdepthbuf_fragment>\n\t\t\t\t\t#include <map_fragment>\n\t\t\t\t\t#include <alphamap_fragment>\n\t\t\t\t\t#include <alphatest_fragment>\n\t\t\t\t\tgl_FragColor = vec4( vViewPosition.z );\n\t\t\t\t}\n\t\t\t"}),this.invertSide=!1}updateUniforms(e,t,r){super.updateUniforms(e,t,r),this.invertSide&&(r.side=r.side===n.FrontSide?n.BackSide:n.FrontSide),e=r.defines.ALPHATEST,0===r.uniforms.alphaTest.value?delete r.defines.ALPHATEST:r.defines.ALPHATEST=r.uniforms.alphaTest.value,e!==r.defines.ALPHATEST&&(r.needsUpdate=!0),e=r.defines.USE_ALPHAMAP,0!==r.defines.ALPHATEST&&r.uniforms.alphaMap.value?r.defines.USE_ALPHAMAP="":delete r.defines.USE_ALPHAMAP,e!==r.defines.USE_ALPHAMAP&&(r.needsUpdate=!0),e=r.defines.USE_MAP,0!==r.defines.ALPHATEST&&r.uniforms.map.value?r.defines.USE_MAP="":delete r.defines.USE_MAP,e!==r.defines.USE_MAP&&(r.needsUpdate=!0),e=r.defines.USE_UV,"USE_ALPHAMAP"in r.defines||"USE_MAP"in r.defines?r.defines.USE_UV="":delete r.defines.USE_UV,e!==r.defines.USE_UV&&(r.needsUpdate=!0)}}const qa={uniforms:{tex:{value:null},displayRoughness:{value:0}},vertexShader:"\n\t\tvarying vec3 vViewPosition;\n\t\tvarying vec2 vUv;\n\t\tvoid main() {\n\t\t\t#include <begin_vertex>\n\t\t\t#include <project_vertex>\n\t\t\tvViewPosition = mvPosition.xyz;\n\t\t\tvUv = uv;\n\t\t}\n\t",fragmentShader:"\n\t\tvarying vec2 vUv;\n\t\tuniform sampler2D tex;\n\t\tuniform float displayRoughness;\n\t\tvoid main() {\n\t\t\tvec4 texVal = texture2D( tex, vUv );\n\t\t\tfloat roughness = texVal.a;\n\t\t\tvec3 packedNormal = texVal.xyz;\n\t\t\tvec3 unpackedNormal = ( packedNormal - 0.5 ) * 2.0;\n\t\t\tgl_FragColor = mix(\n\t\t\t\tvec4( unpackedNormal, 1.0 ),\n\t\t\t\tvec4( roughness, roughness, roughness, 1.0 ),\n\t\t\t\tdisplayRoughness\n\t\t\t);\n\n\t\t}\n\t"},$a={uniforms:{tex:{value:null}},vertexShader:"\n\t\tvarying vec3 vViewPosition;\n\t\tvarying vec2 vUv;\n\t\tvoid main() {\n\t\t\t#include <begin_vertex>\n\t\t\t#include <project_vertex>\n\t\t\tvViewPosition = mvPosition.xyz;\n\t\t\tvUv = uv;\n\t\t}\n\t",fragmentShader:"\n\t\tvarying vec2 vUv;\n\t\tuniform sampler2D tex;\n\t\tuniform float divide;\n\t\tvoid main() {\n\t\t\tvec4 texVal = texture2D( tex, vUv );\n\t\t\tfloat depthVal = mod( - texVal.r, 1.0 );\n\t\t\tgl_FragColor = vec4( depthVal );\n\n\t\t}\n\t"},eo={defines:{NUM_DIRECTIONS:32,NUM_STEPS:16,RADIUS:"2.0",ENABLE_FALLOFF:1,FALLOFF_START2:"0.16",FALLOFF_END2:"4.0",ENABLE_ROTATION_JITTER:1,ENABLE_RADIUS_JITTER:1,ENABLE_COLOR_BOUNCE:1,JITTER_TYPE:0},uniforms:{colorBuffer:{value:null},normalBuffer:{value:null},depthBuffer:{value:null},renderSize:{value:new n.Vector2},blueNoiseTex:{value:null},blueNoiseSize:{value:1},clipInfo:{value:new n.Vector4},projInfo:{value:new n.Vector4},params:{value:new n.Vector2},lightBounceIntensity:{value:1}},vertexShader:"\n\t\tvarying vec2 vUv;\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}\n\t",fragmentShader:"\n\t\t#define TWO_PI\t\t\t6.2831853071795864\n\t\t#define HALF_PI\t\t\t1.5707963267948966\n\t\t#define ONE_OVER_PI\t\t0.3183098861837906\n\n\t\t#include <common>\n\t\t#include <packing>\n\t\tvarying vec2 vUv;\n\n\t\tuniform sampler2D noiseTexture;\n\t\tuniform sampler2D normalBuffer;\n\t\tuniform sampler2D depthBuffer;\n\t\tuniform sampler2D colorBuffer;\n\t\tuniform vec2 renderSize;\n\n\t\tuniform vec4 projInfo;\n\t\tuniform vec4 clipInfo;\n\t\tuniform vec4 params;\n\t\tuniform float lightBounceIntensity;\n\n\t\t#if ENABLE_ROTATION_JITTER == 2 || ENABLE_RADIUS_JITTER == 2\n\t\tuniform float blueNoiseSize;\n\t\tuniform sampler2D blueNoiseTex;\n\t\t#endif\n\n\t\tfloat roundF(float f) {\n\t\t\treturn f < 0.5 ? floor(f) : ceil(f);\n\t\t}\n\n\t\tvec2 roundV2(vec2 v) {\n\t\t\tv.x = roundF(v.x);\n\t\t\tv.y = roundF(v.y);\n\t\t\treturn v;\n\t\t}\n\n\t\tvec3 UnpackNormal(vec4 d) {\n\t\t\treturn d.xyz * 2.0 - 1.0;\n\t\t}\n\n\t\tvec4 GetViewPosition( vec2 uv ) {\n\n\t\t\tfloat near = clipInfo.x;\n\t\t\tfloat far = clipInfo.y;\n\n\t\t\tvec2 basesize = renderSize;\n\t\t\tvec2 coord = ( uv / basesize );\n\n\t\t\t// d is expected to be [ 0.0, 1.0 ]\n\t\t\tfloat d = texture2D( depthBuffer, coord ).r;\n\t\t\td = d == 0.0 ? far : d;\n\t\t\td = ( abs( d ) - near ) / ( far - near );\n\n\t\t\tvec4 ret = vec4( 0.0 );\n\t\t\tret.w = d;\n\t\t\tret.z = near + d * ( far - near );\n\t\t\tret.xy = ( uv * projInfo.xy + projInfo.zw ) * ret.z;\n\n\t\t\treturn ret;\n\n\t\t}\n\n\t\tfloat Falloff( float dist2 ) {\n\n\t\t\treturn 2.0 * clamp(\n\t\t\t\t( dist2 - FALLOFF_START2 ) / ( FALLOFF_END2 - FALLOFF_START2 ),\n\t\t\t\t0.0,\n\t\t\t\t1.0\n\t\t\t);\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec2 screenCoord = gl_FragCoord.xy;\n\t\t\tvec4 vpos = GetViewPosition( renderSize * vUv );\n\n\t\t\t// if it's the background\n\t\t\tif ( vpos.w == 1.0 ) {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0);\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tvec4 s;\n\t\t\tvec3 vnorm\t= UnpackNormal( texture2D( normalBuffer, vUv ) );\n\t\t\tvec3 vdir\t= normalize( - vpos.xyz );\n\t\t\tvec3 dir, ws;\n\n\t\t\t// calculation uses left handed system\n\t\t\tvnorm.z = - vnorm.z;\n\n\t\t\tvec2 noises\t= vec2( 0.0 );\n\t\t\tvec2 offset;\n\t\t\tvec2 horizons = vec2( - 1.0, - 1.0 );\n\n\t\t\t// scale the search radius by the depth and camera FOV\n\t\t\tfloat radius = ( RADIUS * clipInfo.z ) / vpos.z;\n\t\t\tradius = max( float( NUM_STEPS ), radius );\n\n\t\t\tfloat stepSize\t= radius / float( NUM_STEPS );\n\t\t\tfloat phi\t\t= 0.0;\n\t\t\tfloat ao\t\t= 0.0;\n\t\t\tfloat division\t= noises.y * stepSize;\n\t\t\tfloat currStep\t= 1.0 + division + 0.25 * stepSize * params.y;\n\t\t\tfloat dist2, invdist, falloff, cosh;\n\n\t\t\t#if ENABLE_COLOR_BOUNCE\n\t\t\tvec3 color = vec3( 0.0 );\n\t\t\t#endif\n\n\t\t\t#if ENABLE_ROTATION_JITTER == 1\n\n\t\t\t// Rotation jitter approach from\n\t\t\t// https://github.com/MaxwellGengYF/Unity-Ground-Truth-Ambient-Occlusion/blob/9cc30e0f31eb950a994c71866d79b2798d1c508e/Shaders/GTAO_Common.cginc#L152-L155\n\t\t\tfloat rotJitterOffset = PI * fract( 52.9829189 * fract( dot( screenCoord, vec2( 0.06711056, 0.00583715 ) ) ) );\n\n\t\t\t#elif ENABLE_ROTATION_JITTER == 2\n\n\t\t\tfloat rotJitterOffset = PI * texture2D( blueNoiseTex, gl_FragCoord.xy / blueNoiseSize ).r;\n\n\t\t\t#endif\n\n\t\t\t#if ENABLE_RADIUS_JITTER == 1\n\n\t\t\tfloat jitterMod = ( gl_FragCoord.x + gl_FragCoord.y ) * 0.25;\n\t\t\tfloat radiusJitterOffset = mod( jitterMod, 1.0 ) * stepSize * 0.25;\n\n\t\t\t#elif ENABLE_RADIUS_JITTER == 2\n\n\t\t\tfloat radiusJitterOffset = PI * texture2D( blueNoiseTex, gl_FragCoord.xy / blueNoiseSize ).g;\n\n\t\t\t#endif\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = 0; i < NUM_DIRECTIONS; i ++ ) {\n\n\t\t\t\tphi = float( i ) * ( PI / float( NUM_DIRECTIONS ) ) + params.x * PI;\n\n\t\t\t\t#if ENABLE_ROTATION_JITTER != 0\n\n\t\t\t\tphi += rotJitterOffset;\n\n\t\t\t\t#endif\n\n\t\t\t\tcurrStep = 1.0 + 0.25 * stepSize * params.y;\n\n\n\t\t\t\t#if ENABLE_RADIUS_JITTER != 0\n\n\t\t\t\tcurrStep += radiusJitterOffset;\n\n\t\t\t\t#endif\n\n\t\t\t\tdir = vec3( cos( phi ), sin( phi ), 0.0 );\n\t\t\t\thorizons = vec2( - 1.0 );\n\n\t\t\t\t// calculate horizon angles\n\t\t\t\tfor ( int j = 0; j < NUM_STEPS; ++ j ) {\n\n\t\t\t\t\toffset = roundV2(dir.xy * currStep);\n\n\t\t\t\t\t// h1\n\t\t\t\t\ts = GetViewPosition( screenCoord + offset );\n\t\t\t\t\tws = s.xyz - vpos.xyz;\n\n\t\t\t\t\tdist2 = dot( ws, ws );\n\t\t\t\t\tinvdist = inversesqrt( dist2 );\n\t\t\t\t\tcosh = invdist * dot( ws, vdir );\n\n\t\t\t\t\t#if ENABLE_FALLOFF\n\n\t\t\t\t\tfalloff = Falloff( dist2 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\thorizons.x = max( horizons.x, cosh - falloff );\n\n\t\t\t\t\t#if ENABLE_COLOR_BOUNCE\n\n\t\t\t\t\tvec3 ptColor, ptDir;\n\t\t\t\t\tfloat alpha;\n\t\t\t\t\tptColor = texture2D( colorBuffer, ( screenCoord + offset ) / renderSize ).rgb;\n\t\t\t\t\tptDir = normalize( ws );\n\t\t\t\t\talpha = saturate( length( ws ) / float( RADIUS ) );\n\t\t\t\t\tcolor += ptColor * saturate( dot( ptDir, vnorm ) ) * pow( ( 1.0 - alpha ), 2.0 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\t// h2\n\t\t\t\t\ts = GetViewPosition( screenCoord - offset );\n\t\t\t\t\tws = s.xyz - vpos.xyz;\n\n\t\t\t\t\tdist2 = dot( ws, ws );\n\t\t\t\t\tinvdist = inversesqrt( dist2 );\n\t\t\t\t\tcosh = invdist * dot( ws, vdir );\n\n\t\t\t\t\t#if ENABLE_FALLOFF\n\n\t\t\t\t\tfalloff = Falloff( dist2 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\thorizons.y = max( horizons.y, cosh - falloff );\n\n\t\t\t\t\t// increment\n\t\t\t\t\tcurrStep += stepSize;\n\n\t\t\t\t\t#if ENABLE_COLOR_BOUNCE\n\n\t\t\t\t\tptColor = texture2D( colorBuffer, ( screenCoord - offset ) / renderSize ).rgb;\n\t\t\t\t\tptDir = normalize( ws );\n\t\t\t\t\talpha = saturate( length( ws ) / float( RADIUS ) );\n\t\t\t\t\tcolor += ptColor * saturate( dot( ptDir, vnorm ) ) * pow( ( 1.0 - alpha ), 2.0 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t}\n\n\t\t\t\thorizons = acos( horizons );\n\n\t\t\t\t// calculate gamma\n\t\t\t\tvec3 bitangent\t= normalize( cross( dir, vdir ) );\n\t\t\t\tvec3 tangent\t= cross( vdir, bitangent );\n\t\t\t\tvec3 nx\t\t\t= vnorm - bitangent * dot( vnorm, bitangent );\n\n\t\t\t\tfloat nnx\t\t= length( nx );\n\t\t\t\tfloat invnnx\t= 1.0 / ( nnx + 1e-6 );\t\t\t// to avoid division with zero\n\t\t\t\tfloat cosxi\t\t= dot( nx, tangent ) * invnnx;\t// xi = gamma + HALF_PI\n\t\t\t\tfloat gamma\t\t= acos( cosxi ) - HALF_PI;\n\t\t\t\tfloat cosgamma\t= dot( nx, vdir ) * invnnx;\n\t\t\t\tfloat singamma2\t= - 2.0 * cosxi;\t\t\t\t\t// cos(x + HALF_PI) = -sin(x)\n\n\t\t\t\t// clamp to normal hemisphere\n\t\t\t\thorizons.x = gamma + max( - horizons.x - gamma, - HALF_PI );\n\t\t\t\thorizons.y = gamma + min( horizons.y - gamma, HALF_PI );\n\n\t\t\t\t// Riemann integral is additive\n\t\t\t\tao += nnx * 0.25 * (\n\t\t\t\t\t( horizons.x * singamma2 + cosgamma - cos( 2.0 * horizons.x - gamma ) ) +\n\t\t\t\t\t( horizons.y * singamma2 + cosgamma - cos( 2.0 * horizons.y - gamma ) ) );\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t// PDF = 1 / pi and must normalize with pi because of Lambert\n\t\t\tao = ao / float( NUM_DIRECTIONS );\n\n\t\t\t#if ENABLE_COLOR_BOUNCE\n\n\t\t\tcolor /= float( NUM_STEPS * NUM_DIRECTIONS ) * 2.0 / lightBounceIntensity;\n\t\t\tgl_FragColor = vec4( color, ao );\n\n\t\t\t#else\n\n\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, ao );\n\n\t\t\t#endif\n\t\t}\n\t"},to={defines:{BLUR_ITERATIONS:5,BLUR_MODE:0,AO_ONLY:0,COLOR_ONLY:0,DEPTH_THRESHOLD:"5e-1"},uniforms:{fullSize:{value:new n.Vector2},aoSize:{value:new n.Vector2},normalBuffer:{value:null},depthBuffer:{value:null},colorBuffer:{value:null},gtaoBuffer:{value:null},intensity:{value:1},blurStride:{value:1},ambientColor:{value:new n.Color},ambientIntensity:{value:0}},vertexShader:"\n\t\tvarying vec2 vUv;\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}\n\t",fragmentShader:"\n\t\tvarying vec2 vUv;\n\t\tuniform vec3 ambientColor;\n\t\tuniform float ambientIntensity;\n\t\tuniform vec2 aoSize;\n\t\tuniform vec2 fullSize;\n\t\tuniform sampler2D colorBuffer;\n\t\tuniform sampler2D depthBuffer;\n\t\tuniform sampler2D normalBuffer;\n\t\tuniform sampler2D gtaoBuffer;\n\t\tuniform float intensity;\n\t\tuniform int blurStride;\n\n\t\tvec3 UnpackNormal( vec4 d ) {\n\t\t\treturn d.xyz * 2.0 - 1.0;\n\t\t}\n\n\t\tvec3 MultiBounce( float ao, vec3 albedo ) {\n\t\t\tvec3 x = vec3( ao );\n\t\t\tvec3 a = 2.0404 * albedo - vec3( 0.3324 );\n\t\t\tvec3 b = -4.7951 * albedo + vec3( 0.6417 );\n\t\t\tvec3 c = 2.7552 * albedo + vec3( 0.6903 );\n\t\t\treturn max( x, ( ( x * a + b ) * x + c ) * x );\n\t\t}\n\n\t\tvoid main() {\n\t\t\tvec4 color = texture2D( colorBuffer, vUv );\n\t\t\t// NO_BLUR\n\t\t\t#if BLUR_MODE == 0\n\t\t\t\tvec4 accumSample = texture2D( gtaoBuffer, vUv );\n\t\t\t#else\n\t\t\tvec2 currTexel = vUv * fullSize;\n\t\t\tvec2 currAoTexel = vUv * aoSize;\n\n\t\t\t// aoPixels per full size ones. Should be 1/2 at\n\t\t\tvec2 texelRatio = aoSize / fullSize;\n\n\t\t\tvec3 currNormal = UnpackNormal( texture2D( normalBuffer, vUv ) );\n\t\t\tfloat currDepth = texture2D( depthBuffer, vUv ).r;\n\n\t\t\t// TODO: pull this sampling out into a function\n\t\t\tvec4 accumSample = vec4( 0.0 );\n\t\t\tfloat totalWeight = 1e-10;\n\t\t\tfloat pixelOffset = - float( BLUR_ITERATIONS ) / 2.0;\n\t\t\tpixelOffset += mod( float( BLUR_ITERATIONS ), 2.0 ) == 0.0 ? 0.0 : 0.5;\n\t\t\tpixelOffset *= float( blurStride );\n\n\t\t\t// BOX_BLUR\n\t\t\t#if BLUR_MODE == 1\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int x = 0; x < BLUR_ITERATIONS; x ++ ) {\n\n\t\t\t\t#pragma unroll_loop_start\n\t\t\t\tfor ( int y = 0; y < BLUR_ITERATIONS; y ++ ) {\n\n\t\t\t\t\tvec2 step = vec2( float( x ), float( y ) ) * float( blurStride );\n\n\t\t\t\t\t// iterate over full res pixels\n\t\t\t\t\tvec2 offsetUv = currTexel + ( pixelOffset + step ) / texelRatio;\n\t\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\t\t// get the associated pixel in the AO buffer\n\t\t\t\t\tvec2 aoUv = currAoTexel + pixelOffset + step;\n\t\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t\t// if the pixels are close enough in space then blur them together\n\t\t\t\t\tfloat offsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\t\tif ( abs( offsetDepth - currDepth ) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\t\t// Weigh the sample based on normal similarity\n\t\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\t\tfloat weight = max( 0.0, dot( offsetNormal, currNormal ) );\n\n\t\t\t\t\t\t// square the weight to give pixels with a closer normal even higher priority\n\t\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\t\t// accumulate\n\t\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\t#pragma unroll_loop_end\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t// CROSS_BLUR\n\t\t\t#elif BLUR_MODE == 2\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = 0; i < BLUR_ITERATIONS; i ++ ) {\n\n\t\t\t\tvec2 offsetUv, aoUv;\n\t\t\t\tfloat offsetDepth;\n\n\t\t\t\t// X sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( pixelOffset + float( i * blurStride ), 0.0 ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( pixelOffset + float( i * blurStride ), 0.0 );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t\t// TODO: this should not be here if on the center pixel\n\t\t\t\t// Y sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( 0.0, pixelOffset + float( i * blurStride ) ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( 0.0, pixelOffset + float( i * blurStride ) );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t// DIAGONAL_BLUR\n\t\t\t#elif BLUR_MODE == 3\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = 0; i < BLUR_ITERATIONS; i ++ ) {\n\n\t\t\t\tvec2 offsetUv, aoUv;\n\t\t\t\tfloat offsetDepth;\n\n\t\t\t\t// X sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( pixelOffset + float( i * blurStride ), pixelOffset + float( i * blurStride ) ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( pixelOffset + float( i * blurStride ), pixelOffset + float( i * blurStride ) );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t\t// TODO: this should not be here if on the center pixel\n\t\t\t\t// Y sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( - pixelOffset - float( i * blurStride ), pixelOffset + float( i * blurStride ) ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( - pixelOffset - float( i * blurStride ), pixelOffset + float( i * blurStride ) );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t#endif\n\n\t\t\taccumSample /= totalWeight;\n\n\t\t\t#endif\n\n\t\t\tfloat gtao = accumSample.a;\n\n\t\t\t#if COLOR_ONLY\n\n\t\t\tgl_FragColor = vec4( accumSample.rgb, 1.0 );\n\n\t\t\t#elif AO_ONLY\n\n\t\t\tvec3 rgb = mix( vec3( 1.0 ), vec3( accumSample.a ), intensity );\n\t\t\tgl_FragColor = vec4( rgb, 1.0 );\n\n\t\t\t#else\n\n\t\t\tvec3 rgb = mix( color.rgb, color.rgb * MultiBounce( gtao, color.rgb ), intensity );\n\t\t\tvec3 delta = color.rgb - rgb;\n\t\t\tvec3 ambient = ambientColor * delta * ambientIntensity;\n\n\t\t\tfloat colorFade = ( 1.0 - pow( 1.0 - gtao, 2.0 ) );\n\t\t\tgl_FragColor = vec4( rgb + ambient + accumSample.rgb * ( 0.75 + colorFade * 0.25 ), color.a );\n\n\t\t\t#endif\n\n\t\t}\n\t\t"};class no{constructor(e){this.count=0,this.size=-1,this.sigma=-1,this.radius=-1,this.lookupTable=null,this.score=null,this.binaryPattern=null,this.resize(e),this.setSigma(1.5)}findVoid(){var e,{score:t,binaryPattern:n}=this;let r=1/0,i=-1;for(let a=0,o=n.length;a<o;a++)0===n[a]&&(e=t[a])<r&&(r=e,i=a);return i}findCluster(){var e,{score:t,binaryPattern:n}=this;let r=-1/0,i=-1;for(let a=0,o=n.length;a<o;a++)1===n[a]&&(e=t[a])>r&&(r=e,i=a);return i}setSigma(e){if(e!==this.sigma){var t=~~(Math.sqrt(20*Math.pow(e,2))+1),n=2*t+1;const o=new Float32Array(n*n);var r=e*e;for(let e=-t;e<=t;e++)for(let s=-t;s<=t;s++){var i=(t+s)*n+e+t,a=e*e+s*s;o[i]=Math.pow(Math.E,-a/(2*r))}this.lookupTable=o,this.sigma=e,this.radius=t}}resize(e){this.size!==e&&(this.size=e,this.score=new Float32Array(e*e),this.binaryPattern=new Uint8Array(e*e))}invert(){const{binaryPattern:e,score:t,size:n}=this;t.fill(0);for(let t=0,a=e.length;t<a;t++){var r,i;0===e[t]?(r=~~(t/n),i=t-r*n,this.updateScore(i,r,1),e[t]=1):e[t]=0}}updateScore(e,t,n){const{size:r,score:i,lookupTable:a}=this;var o=this.radius,s=2*o+1;for(let c=-o;c<=o;c++)for(let h=-o;h<=o;h++){var l=a[(o+h)*s+c+o];let d=e+c,f=(d=d<0?r+d:d%r,t+h);var u=(f=f<0?r+f:f%r)*r+d;i[u]+=n*l}}addPointIndex(e){this.binaryPattern[e]=1;var t=this.size,n=~~(e/t);this.updateScore(e-n*t,n,1),this.count++}removePointIndex(e){this.binaryPattern[e]=0;var t=this.size,n=~~(e/t);this.updateScore(e-n*t,n,-1),this.count--}copy(e){this.resize(e.size),this.score.set(e.score),this.binaryPattern.set(e.binaryPattern),this.setSigma(e.sigma),this.count=e.count}}class ro{constructor(){this.random=Math.random,this.sigma=1.5,this.size=64,this.majorityPointsRatio=.1,this.samples=new no(1),this.savedSamples=new no(1)}generate(){const{samples:e,savedSamples:t,sigma:n,majorityPointsRatio:r,size:i}=this;e.resize(i),e.setSigma(n);var a=Math.floor(i*i*r),o=e.binaryPattern,s=o,l=a;s.fill(0);for(let e=0;e<l;e++)s[e]=1;var[u,c=Math.random]=[o,this.random];for(let e=u.length-1;0<e;e--){var h=~~((c()-1e-6)*e),d=u[e];u[e]=u[h],u[h]=d}for(let t=0,n=o.length;t<n;t++)1===o[t]&&e.addPointIndex(t);for(;;){var f=e.findCluster(),p=(e.removePointIndex(f),e.findVoid());if(f===p){e.addPointIndex(f);break}e.addPointIndex(p)}const m=new Uint32Array(i*i);let v;for(t.copy(e),v=e.count-1;0<=v;){var g=e.findCluster();e.removePointIndex(g),m[g]=v,v--}var y=i*i;for(v=t.count;v<y/2;){var b=t.findVoid();t.addPointIndex(b),m[b]=v,v++}for(t.invert();v<y;){var x=t.findCluster();t.removePointIndex(x),m[x]=v,v++}return{data:m,maxValue:y}}}class io extends va.w{constructor(e,t){super(),this.enabled=!0,this.needsSwap=!0,this.scene=e,this.camera=t,this.debug={display:io.DEFAULT},this.renderTargetScale=1,this.enableJitter=!0,this.radiusJitter=0,this.rotationJitter=0,this.numSteps=8,this.numDirections=8,this.intensity=1,this.radius=2,this.directionOffset=0,this.stepOffset=0,this.blurMode=io.BOX_BLUR,this.blurIterations=4,this.blurStride=1,this.enableFalloff=!0,this.falloffStart=.4,this.falloffEnd=2,this.ambientColor=new n.Color,this.ambientIntensity=0,this.lightBounceIntensity=1,this._gtaoBuffer=new n.WebGLRenderTarget(1,1,{format:n.RGBAFormat}),this._depthBuffer=new n.WebGLRenderTarget(1,1,{minFilter:n.NearestFilter,magFilter:n.NearestFilter,format:n.RGBFormat,type:n.HalfFloatType}),this._depthReplacement=new Ya,this._normalBuffer=new n.WebGLRenderTarget(1,1,{minFilter:n.NearestFilter,magFilter:n.NearestFilter,format:n.RGBAFormat}),this._normalReplacement=new Qa,this.gtaoQuad=new va.T(new n.ShaderMaterial(eo)),this.debugPackedQuad=new va.T(new n.ShaderMaterial(qa)),this.debugDepthQuad=new va.T(new n.ShaderMaterial($a)),this.compositeQuad=new va.T(new n.ShaderMaterial(to));const r=new ro,i=(r.size=32,new Uint8Array(4*Math.pow(32,2)));for(let e=0;e<4;e++){var a=r.generate(),o=a.data,s=a.maxValue;for(let t=0,n=o.length;t<n;t++)i[4*t+e]=o[t]/s*255}this.blueNoiseTex=new n.DataTexture(i,r.size,r.size,n.RGBAFormat),this.blueNoiseTex.wrapS=n.RepeatWrapping,this.blueNoiseTex.wrapT=n.RepeatWrapping,this.blueNoiseTex.minFilter=n.LinearFilter,this.blueNoiseTex.needsUpdate=!0}dispose(){}setSize(e,t){var n=this.renderTargetScale,r=Math.floor(e*n);n=Math.floor(t*n),this._depthBuffer.setSize(e,t),this._normalBuffer.setSize(e,t),this._gtaoBuffer.setSize(r,n)}render(e,t,r){t=this.renderToScreen?null:t;const{scene:i,camera:a,debug:o,debugPackedQuad:s,debugDepthQuad:l,compositeQuad:u,gtaoQuad:c}=this,h=c.material;io.RendererState.copy(e,i);var d=()=>{io.RendererState.restore(e,i),p.reset(i,!0)},f=this._depthBuffer;const p=this._depthReplacement;if(i.background=null,p.replace(i,!0,!0),e.setRenderTarget(f),e.setClearColor(io.BlackColor,0),e.clear(),e.render(i,a),o.display===io.DEPTH)return e.setRenderTarget(t),l.material.uniforms.texture.value=f.texture,l.render(e),void d();const m=this._normalReplacement;var v=this._normalBuffer;if(m.replace(i,!0,!1),e.setRenderTarget(v),e.clear(),e.render(i,a),o.display===io.NORMAL)return e.setRenderTarget(t),e.clear(),s.material.uniforms.displayRoughness.value=0,s.material.uniforms.texture.value=v.texture,s.render(e),void d();this.numSteps!==h.defines.NUM_STEPS&&(h.defines.NUM_STEPS=this.numSteps,h.needsUpdate=!0),this.numDirections!==h.defines.NUM_DIRECTIONS&&(h.defines.NUM_DIRECTIONS=this.numDirections,h.needsUpdate=!0),this.radius.toFixed(16)!==h.defines.RADIUS&&(h.defines.RADIUS=this.radius.toFixed(16),h.needsUpdate=!0),Math.pow(this.falloffStart,2).toFixed(16)===h.defines.FALLOFF_START2&&Math.pow(this.falloffEnd,2).toFixed(16)===h.defines.FALLOFF_END2&&this.enableFalloff===Boolean(h.defines.ENABLE_FALLOFF)||(h.defines.FALLOFF_START2=Math.pow(this.falloffStart,2).toFixed(16),h.defines.FALLOFF_END2=Math.pow(this.falloffEnd,2).toFixed(16),h.defines.ENABLE_FALLOFF=this.enableFalloff?1:0,h.needsUpdate=!0),this.rotationJitter!==h.defines.ENABLE_ROTATION_JITTER&&(h.defines.ENABLE_ROTATION_JITTER=this.rotationJitter,h.needsUpdate=!0),this.radiusJitter!==h.defines.ENABLE_RADIUS_JITTER&&(h.defines.ENABLE_RADIUS_JITTER=this.radiusJitter,h.needsUpdate=!0),0!==this.lightBounceIntensity!==Boolean(h.defines.ENABLE_COLOR_BOUNCE)&&(h.defines.ENABLE_COLOR_BOUNCE=0!==this.lightBounceIntensity?1:0,h.needsUpdate=!0);var g=this._gtaoBuffer,y=Math.floor(g.texture.image.width),b=Math.floor(g.texture.image.height),x=a.projectionMatrix,w=n.MathUtils.DEG2RAD*a.fov;h.uniforms.params.value.set(this.directionOffset,this.stepOffset),h.uniforms.projInfo.value.set(2/(y*x.elements[0]),2/(b*x.elements[5]),-1/x.elements[0],-1/x.elements[5]),h.uniforms.clipInfo.value.set(a.near,a.far,b/(2*Math.tan(.5*w))*.5,0),h.uniforms.normalBuffer.value=v.texture,h.uniforms.depthBuffer.value=f.texture,h.uniforms.colorBuffer.value=r.texture,h.uniforms.lightBounceIntensity.value=this.lightBounceIntensity,h.uniforms.renderSize.value.set(Math.floor(g.texture.image.width),Math.floor(g.texture.image.height)),h.uniforms.blueNoiseTex.value=this.blueNoiseTex,h.uniforms.blueNoiseSize.value=this.blueNoiseTex.image.width,e.setRenderTarget(g),e.clear(),c.render(e);const A=u.material;A.uniforms.depthBuffer.value=f.texture,A.uniforms.normalBuffer.value=v.texture,A.uniforms.colorBuffer.value=r.texture,A.uniforms.gtaoBuffer.value=g.texture,A.uniforms.intensity.value=this.intensity,A.uniforms.aoSize.value.set(g.width,g.height),A.uniforms.fullSize.value.set(r.width,r.height),A.uniforms.blurStride.value=this.blurStride,A.uniforms.ambientColor.value.copy(this.ambientColor),A.uniforms.ambientIntensity.value=this.ambientIntensity,this.blurIterations!==A.defines.BLUR_ITERATIONS&&(A.defines.BLUR_ITERATIONS=this.blurIterations,A.needsUpdate=!0),this.blurMode!==A.defines.BLUR_MODE&&(A.defines.BLUR_MODE=this.blurMode,A.needsUpdate=!0),o.display===io.AO_SAMPLE?1!==A.defines.AO_ONLY&&(A.defines.AO_ONLY=1,A.needsUpdate=!0):0!==A.defines.AO_ONLY&&(A.defines.AO_ONLY=0,A.needsUpdate=!0),o.display===io.COLOR_SAMPLE?1!==A.defines.COLOR_ONLY&&(A.defines.COLOR_ONLY=1,A.needsUpdate=!0):0!==A.defines.COLOR_ONLY&&(A.defines.COLOR_ONLY=0,A.needsUpdate=!0),e.setRenderTarget(t),e.clear(),u.render(e),d()}}io.NO_JITTER=0,io.RANDOM_JITTER=1,io.BLUENOISE_JITTER=2,io.DEFAULT=0,io.DEPTH=1,io.NORMAL=2,io.AO_SAMPLE=3,io.COLOR_SAMPLE=4,io.NO_BLUR=0,io.BOX_BLUR=1,io.CROSS_BLUR=2,io.DIAGONAL_BLUR=3,io.BlackColor=new n.Color(0),io.RendererState=new class{constructor(){this.clearAlpha=0,this.clearColor=new n.Color,this.renderTarget=null,this.outputEncoding=n.LinearEncoding,this.overrideMaterial=null,this.shadowsEnabled=!1,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.background=null,this.autoUpdate=!0}copy(e,t){e&&(this.clearAlpha=e.getClearAlpha(),this.clearColor=e.getClearColor(this.clearColor),this.renderTarget=e.getRenderTarget(),this.shadowsEnabled=e.shadowMap.enabled,this.outputEncoding=e.outputEncoding,this.autoClear=e.autoClear,this.autoClearColor=e.autoClearColor,this.autoClearDepth=e.autoClearDepth,this.autoClearStencil=e.autoClearStencil),t&&(this.overrideMaterial=t.overrideMaterial,this.background=t.background,this.autoUpdate=t.autoUpdate)}restore(e,t){e&&(e.setClearAlpha(this.clearAlpha),e.setClearColor(this.clearColor),e.setRenderTarget(this.renderTarget),e.shadowMap.enabled=this.shadowsEnabled,e.outputEncoding=this.outputEncoding,e.autoClear=this.autoClear,e.autoClearColor=this.autoClearColor,e.autoClearDepth=this.autoClearDepth,e.autoClearStencil=this.autoClearStencil),t&&(t.overrideMaterial=this.overrideMaterial,t.background=this.background,t.autoUpdate=this.autoUpdate),this.renderTarget=null,this.overrideMaterial=null}};class ao{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.gtaoPass||(this.gtaoPass=new io(this.mtuPP.mainScene,this.mtuPP.mainCamera)),this.mtuPP.effectComposer.addPass(this.gtaoPass)}setAOData(e,t){"rotationJitter"===e||"radiusJitter"===e?"NONE"===t?this.gtaoPass[e]=0:"RANDOM"===t?this.gtaoPass[e]=1:"BLUE_NOISE"===t&&(this.gtaoPass[e]=2):"blurMode"===e?"NO_BLUR"===t?this.gtaoPass[e]=0:"BOX_BLUR"===t?this.gtaoPass[e]=1:"CROSS_BLUR"===t?this.gtaoPass[e]=2:"DIAGONAL_BLUR"===t&&(this.gtaoPass[e]=3):this.gtaoPass[e]="ambientColor"===e?new So.Color(t):t}dispose(){this.gtaoPass&&(this.gtaoPass.dispose(),this.gtaoPass=null)}enablePass(e){this.gtaoPass&&this.gtaoPass.enabled!==e&&(this.gtaoPass.enabled=e)}}function oo(e){return(oo="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 so(e,t){return(so=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function lo(e){return(lo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var uo=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&&so(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 n,r=lo(e);if(n=t?(n=lo(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===oo(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;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=r.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 n.Color,l;throw new TypeError("Cannot call a class as a function")}return t=i,(e=[{key:"render",value:function(e,t,n){var r,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),r=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor&&e.setClearColor(this._oldClearColor,r),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=i),e.autoClear=a}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(va.w),co={uniforms:{tDiffuse:{value:null},resolution:{value:new n.Vector2(1/1024,1/512)}},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\tprecision highp float;\n\n\tuniform sampler2D tDiffuse;\n\n\tuniform vec2 resolution;\n\n\tvarying vec2 vUv;\n\n\t// FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)\n\n\t//----------------------------------------------------------------------------------\n\t// File: es3-keplerFXAAassetsshaders/FXAA_DefaultES.frag\n\t// SDK Version: v3.00\n\t// Email: gameworks@nvidia.com\n\t// Site: http://developer.nvidia.com/\n\t//\n\t// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.\n\t//\n\t// Redistribution and use in source and binary forms, with or without\n\t// modification, are permitted provided that the following conditions\n\t// are met:\n\t// * Redistributions of source code must retain the above copyright\n\t// notice, this list of conditions and the following disclaimer.\n\t// * Redistributions in binary form must reproduce the above copyright\n\t// notice, this list of conditions and the following disclaimer in the\n\t// documentation and/or other materials provided with the distribution.\n\t// * Neither the name of NVIDIA CORPORATION nor the names of its\n\t// contributors may be used to endorse or promote products derived\n\t// from this software without specific prior written permission.\n\t//\n\t// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY\n\t// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n\t// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n\t// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n\t// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n\t// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n\t// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n\t// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n\t// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\t// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\t// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\t//\n\t//----------------------------------------------------------------------------------\n\n\t#ifndef FXAA_DISCARD\n\t\t\t//\n\t\t\t// Only valid for PC OpenGL currently.\n\t\t\t// Probably will not work when FXAA_GREEN_AS_LUMA = 1.\n\t\t\t//\n\t\t\t// 1 = Use discard on pixels which don't need AA.\n\t\t\t// For APIs which enable concurrent TEX+ROP from same surface.\n\t\t\t// 0 = Return unchanged color on pixels which don't need AA.\n\t\t\t//\n\t\t\t#define FXAA_DISCARD 0\n\t#endif\n\n\t/*--------------------------------------------------------------------------*/\n\t#define FxaaTexTop(t, p) texture2D(t, p, -100.0)\n\t#define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), -100.0)\n\t/*--------------------------------------------------------------------------*/\n\n\t#define NUM_SAMPLES 5\n\n\t// assumes colors have premultipliedAlpha, so that the calculated color contrast is scaled by alpha\n\tfloat contrast( vec4 a, vec4 b ) {\n\t\t\tvec4 diff = abs( a - b );\n\t\t\treturn max( max( max( diff.r, diff.g ), diff.b ), diff.a );\n\t}\n\n\t/*============================================================================\n\n\t\t\t\t\t\t\t\t\tFXAA3 QUALITY - PC\n\n\t============================================================================*/\n\n\t/*--------------------------------------------------------------------------*/\n\tvec4 FxaaPixelShader(\n\t\t\tvec2 posM,\n\t\t\tsampler2D tex,\n\t\t\tvec2 fxaaQualityRcpFrame,\n\t\t\tfloat fxaaQualityEdgeThreshold,\n\t\t\tfloat fxaaQualityinvEdgeThreshold\n\t) {\n\t\t\tvec4 rgbaM = FxaaTexTop(tex, posM);\n\t\t\tvec4 rgbaS = FxaaTexOff(tex, posM, vec2( 0.0, 1.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaE = FxaaTexOff(tex, posM, vec2( 1.0, 0.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaN = FxaaTexOff(tex, posM, vec2( 0.0,-1.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaW = FxaaTexOff(tex, posM, vec2(-1.0, 0.0), fxaaQualityRcpFrame.xy);\n\t\t\t// . S .\n\t\t\t// W M E\n\t\t\t// . N .\n\n\t\t\tbool earlyExit = max( max( max(\n\t\t\t\t\tcontrast( rgbaM, rgbaN ),\n\t\t\t\t\tcontrast( rgbaM, rgbaS ) ),\n\t\t\t\t\tcontrast( rgbaM, rgbaE ) ),\n\t\t\t\t\tcontrast( rgbaM, rgbaW ) )\n\t\t\t\t\t< fxaaQualityEdgeThreshold;\n\t\t\t// . 0 .\n\t\t\t// 0 0 0\n\t\t\t// . 0 .\n\n\t\t\t#if (FXAA_DISCARD == 1)\n\t\t\t\t\tif(earlyExit) FxaaDiscard;\n\t\t\t#else\n\t\t\t\t\tif(earlyExit) return rgbaM;\n\t\t\t#endif\n\n\t\t\tfloat contrastN = contrast( rgbaM, rgbaN );\n\t\t\tfloat contrastS = contrast( rgbaM, rgbaS );\n\t\t\tfloat contrastE = contrast( rgbaM, rgbaE );\n\t\t\tfloat contrastW = contrast( rgbaM, rgbaW );\n\n\t\t\tfloat relativeVContrast = ( contrastN + contrastS ) - ( contrastE + contrastW );\n\t\t\trelativeVContrast *= fxaaQualityinvEdgeThreshold;\n\n\t\t\tbool horzSpan = relativeVContrast > 0.;\n\t\t\t// . 1 .\n\t\t\t// 0 0 0\n\t\t\t// . 1 .\n\n\t\t\t// 45 deg edge detection and corners of objects, aka V/H contrast is too similar\n\t\t\tif( abs( relativeVContrast ) < .3 ) {\n\t\t\t\t\t// locate the edge\n\t\t\t\t\tvec2 dirToEdge;\n\t\t\t\t\tdirToEdge.x = contrastE > contrastW ? 1. : -1.;\n\t\t\t\t\tdirToEdge.y = contrastS > contrastN ? 1. : -1.;\n\t\t\t\t\t// . 2 . . 1 .\n\t\t\t\t\t// 1 0 2 ~= 0 0 1\n\t\t\t\t\t// . 1 . . 0 .\n\n\t\t\t\t\t// tap 2 pixels and see which ones are \"outside\" the edge, to\n\t\t\t\t\t// determine if the edge is vertical or horizontal\n\n\t\t\t\t\tvec4 rgbaAlongH = FxaaTexOff(tex, posM, vec2( dirToEdge.x, -dirToEdge.y ), fxaaQualityRcpFrame.xy);\n\t\t\t\t\tfloat matchAlongH = contrast( rgbaM, rgbaAlongH );\n\t\t\t\t\t// . 1 .\n\t\t\t\t\t// 0 0 1\n\t\t\t\t\t// . 0 H\n\n\t\t\t\t\tvec4 rgbaAlongV = FxaaTexOff(tex, posM, vec2( -dirToEdge.x, dirToEdge.y ), fxaaQualityRcpFrame.xy);\n\t\t\t\t\tfloat matchAlongV = contrast( rgbaM, rgbaAlongV );\n\t\t\t\t\t// V 1 .\n\t\t\t\t\t// 0 0 1\n\t\t\t\t\t// . 0 .\n\n\t\t\t\t\trelativeVContrast = matchAlongV - matchAlongH;\n\t\t\t\t\trelativeVContrast *= fxaaQualityinvEdgeThreshold;\n\n\t\t\t\t\tif( abs( relativeVContrast ) < .3 ) { // 45 deg edge\n\t\t\t\t\t\t\t// 1 1 .\n\t\t\t\t\t\t\t// 0 0 1\n\t\t\t\t\t\t\t// . 0 1\n\n\t\t\t\t\t\t\t// do a simple blur\n\t\t\t\t\t\t\treturn mix(\n\t\t\t\t\t\t\t\t\trgbaM,\n\t\t\t\t\t\t\t\t\t(rgbaN + rgbaS + rgbaE + rgbaW) * .25,\n\t\t\t\t\t\t\t\t\t.4\n\t\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\thorzSpan = relativeVContrast > 0.;\n\t\t\t}\n\n\t\t\tif(!horzSpan) rgbaN = rgbaW;\n\t\t\tif(!horzSpan) rgbaS = rgbaE;\n\t\t\t// . 0 . 1\n\t\t\t// 1 0 1 -> 0\n\t\t\t// . 0 . 1\n\n\t\t\tbool pairN = contrast( rgbaM, rgbaN ) > contrast( rgbaM, rgbaS );\n\t\t\tif(!pairN) rgbaN = rgbaS;\n\n\t\t\tvec2 offNP;\n\t\t\toffNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\n\t\t\toffNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\n\n\t\t\tbool doneN = false;\n\t\t\tbool doneP = false;\n\n\t\t\tfloat nDist = 0.;\n\t\t\tfloat pDist = 0.;\n\n\t\t\tvec2 posN = posM;\n\t\t\tvec2 posP = posM;\n\n\t\t\tint iterationsUsed = 0;\n\t\t\tint iterationsUsedN = 0;\n\t\t\tint iterationsUsedP = 0;\n\t\t\tfor( int i = 0; i < NUM_SAMPLES; i++ ) {\n\t\t\t\t\titerationsUsed = i;\n\n\t\t\t\t\tfloat increment = float(i + 1);\n\n\t\t\t\t\tif(!doneN) {\n\t\t\t\t\t\t\tnDist += increment;\n\t\t\t\t\t\t\tposN = posM + offNP * nDist;\n\t\t\t\t\t\t\tvec4 rgbaEndN = FxaaTexTop(tex, posN.xy);\n\t\t\t\t\t\t\tdoneN = contrast( rgbaEndN, rgbaM ) > contrast( rgbaEndN, rgbaN );\n\t\t\t\t\t\t\titerationsUsedN = i;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(!doneP) {\n\t\t\t\t\t\t\tpDist += increment;\n\t\t\t\t\t\t\tposP = posM - offNP * pDist;\n\t\t\t\t\t\t\tvec4 rgbaEndP = FxaaTexTop(tex, posP.xy);\n\t\t\t\t\t\t\tdoneP = contrast( rgbaEndP, rgbaM ) > contrast( rgbaEndP, rgbaN );\n\t\t\t\t\t\t\titerationsUsedP = i;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(doneN || doneP) break;\n\t\t\t}\n\n\n\t\t\tif ( !doneP && !doneN ) return rgbaM; // failed to find end of edge\n\n\t\t\tfloat dist = min(\n\t\t\t\t\tdoneN ? float( iterationsUsedN ) / float( NUM_SAMPLES - 1 ) : 1.,\n\t\t\t\t\tdoneP ? float( iterationsUsedP ) / float( NUM_SAMPLES - 1 ) : 1.\n\t\t\t);\n\n\t\t\t// hacky way of reduces blurriness of mostly diagonal edges\n\t\t\t// but reduces AA quality\n\t\t\tdist = pow(dist, .5);\n\n\t\t\tdist = 1. - dist;\n\n\t\t\treturn mix(\n\t\t\t\t\trgbaM,\n\t\t\t\t\trgbaN,\n\t\t\t\t\tdist * .5\n\t\t\t);\n\t}\n\n\tvoid main() {\n\t\t\tconst float edgeDetectionQuality = .2;\n\t\t\tconst float invEdgeDetectionQuality = 1. / edgeDetectionQuality;\n\n\t\t\tgl_FragColor = FxaaPixelShader(\n\t\t\t\t\tvUv,\n\t\t\t\t\ttDiffuse,\n\t\t\t\t\tresolution,\n\t\t\t\t\tedgeDetectionQuality, // [0,1] contrast needed, otherwise early discard\n\t\t\t\t\tinvEdgeDetectionQuality\n\t\t\t);\n\n\t}\n\t"},ho={uniforms:{tDiffuse:{value:null},offset:{value:1},darkness:{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 offset;\n\t\tuniform float darkness;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\t// Eskil's vignette\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\t\t\tvec2 uv = ( vUv - vec2( 0.5 ) ) * vec2( offset );\n\t\t\tgl_FragColor = vec4( mix( texel.rgb, vec3( 1.0 - darkness ), dot( uv, uv ) ), texel.a );\n\n\t\t}"};class fo{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.aoParams={isAO:!1,directionOffset:0,stepOffset:0,rotationJitter:"NONE",radiusJitter:"NONE",numSteps:8,numDirections:1,intensity:1,radius:2,enableFalloff:!0,falloffStart:.4,falloffEnd:2,renderTargetScale:.5,blurMode:"NO_BLUR",blurIterations:5,blurStride:1,ambientColor:"#FFFFFF",ambientIntensity:0,lightBounceIntensity:0},this.vignetteParams={isVignette:!1,offset:1,darkness:1},this.clean=()=>{this.reset()},this.ENTIRE_SCENE=0,this.BLOOM_SCENE=1,this.BLACK_COLOR=new So.Color(0),this.runScene=e,this.info=new fa(this.runScene),this.isSafari=-1<navigator.userAgent.indexOf("Safari"),this.isChrome=-1<navigator.userAgent.indexOf("Chrome"),this.rtSize=new So.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.clean.add("pp",this.clean),this.runScene.cb.setScene.add("post-processing",(({type:e,val:t})=>{"fog"===e&&(console.log(t,"val"),t&&t.show&&(this.sceneFogColor?this.sceneFogColor.copy(t.color):this.sceneFogColor=new So.Color(t.color))),"background"===e&&(this.sceneBackground&&(0,mt.isTexture)(this.sceneBackground)&&this.sceneBackground.dispose(),this.sceneBackground=t,this.isChrome&&this.mtuGlow?this.mtuGlow.setSceneBg():this.isSafari)}))}init(){try{var{camera:e,scene:t,renderer:n}=this.runScene.assetsEx.get();this.mainScene=t,this.mainCamera=e,this.renderer=n,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 Fa(this.renderer,this.getNewRenderTarget(this.ppParams.samples)),this.renderPass=new uo(this.mainScene,this.mainCamera),this.fxaaPass=new ma.T(co),this.fxaaPass.uniforms.resolution.value.set(1/window.innerWidth,1/window.innerHeight),this.vignettePass=new ma.T(ho),this.effectComposer.addPass(this.renderPass),this.ppOutline(),this.ppGlow(),this.ppAO(),this.effectComposer.addPass(this.vignettePass)}getNewRenderTarget(e){const t=new So.WebGLRenderTarget(this.rtSize.x,this.rtSize.y,{samples:e});return t.depthTexture=new So.DepthTexture(this.rtSize.x,this.rtSize.y),t.depthTexture.type=So.UnsignedIntType,t.depthTexture.format=So.DepthFormat,t.texture.format=So.RGBAFormat,t.texture.encoding=So.sRGBEncoding,t}ppOutline(){this.mtOutline=new Ja(this)}ppGlow(){this.isChrome?(this.effectComposer.renderToScreen=!0,this.mtuGlow=new _a(this)):this.isSafari&&(this.effectComposer.renderToScreen=!1,this.threeGlow=new Na(this))}ppAO(){this.mtAO=new ao(this)}toJSON(){const e={};var{ppParams:t,bloomParams:n,outlineParams:r,aoParams:i,vignetteParams:a}=this;return e.ppParams=Object.assign({},t),e.bloomParams=Object.assign({},n),e.outlineParams=Object.assign({},r),e.aoParams=Object.assign({},i),e.vignetteParams=Object.assign({},a),JSON.stringify(e)}fromJSON(e){var{ppParams:e,bloomParams:t,outlineParams:n,aoParams:r,vignetteParams:i}=e;e&&(e=e.samples,this.ppParams.samples=e,this.effectComposer&&this.effectComposer.reset(this.getNewRenderTarget(this.ppParams.samples))),t&&(this.bloomParams.isBloom=t.isBloom,this.setGlowData("radius",t.radius),this.setGlowData("strength",t.strength),this.setGlowData("threshold",t.threshold),this.runScene.cb.pp.glow.setData.cb(this.bloomParams).then()),n&&this.mtOutline&&(this.outlineParams.isOutline=n.isOutline,this.setOutlineData("edgeStrength",n.edgeStrength),this.setOutlineData("edgeGlow",n.edgeGlow),this.setOutlineData("edgeThickness",n.edgeThickness),this.setOutlineData("pulsePeriod",n.pulsePeriod),this.setOutlineData("visibleEdgeColor",n.visibleEdgeColor),this.setOutlineData("hiddenEdgeColor",n.hiddenEdgeColor),this.runScene.cb.pp.outline.setData.cb(this.outlineParams).then()),r&&this.mtAO&&(this.aoParams.isAO=r.isAO,this.setAOData("directionOffset",r.directionOffset),this.setAOData("stepOffset",r.stepOffset),this.setAOData("rotationJitter",r.rotationJitter),this.setAOData("radiusJitter",r.radiusJitter),this.setAOData("numSteps",r.numSteps),this.setAOData("numDirections",r.numDirections),this.setAOData("intensity",r.intensity),this.setAOData("radius",r.radius),this.setAOData("enableFalloff",r.enableFalloff),this.setAOData("falloffStart",r.falloffStart),this.setAOData("falloffEnd",r.falloffEnd),this.setAOData("renderTargetScale",r.renderTargetScale),this.setAOData("blurMode",r.blurMode),this.setAOData("blurIterations",r.blurIterations),this.setAOData("blurStride",r.blurStride),this.setAOData("ambientColor",r.ambientColor),this.setAOData("ambientIntensity",r.ambientIntensity),this.setAOData("lightBounceIntensity",r.lightBounceIntensity),this.runScene.cb.pp.ao.setData.cb(this.aoParams).then()),i&&this.vignettePass&&(this.vignetteParams.isVignette=i.isVignette,this.setVignetteData("offset",i.offset),this.setVignetteData("darkness",i.darkness),this.runScene.cb.pp.vignette.setData.cb(this.vignetteParams).then())}setUpdate(e){this.isUpdate=e}update(){this.isUpdate&&this.mainScene&&this.mainCamera&&this.renderer&&(this.bloomParams.isBloom||this.outlineParams.isOutline||this.aoParams.isAO||this.vignetteParams.isVignette?(this.vignettePass.enabled=this.vignetteParams.isVignette,this.mtAO.enablePass(this.aoParams.isAO),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)}reset(){this.runScene.pp.dispose(),this.runScene.pp.init()}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?this.mtuGlow.setGlowData(e,t):this.isSafari&&this.threeGlow&&this.threeGlow.setGlowData(e,t)}setOutlineData(e,t){this.outlineParams[e]=t,this.mtOutline&&this.mtOutline.setOutlineData(e,t)}addOutlineObj(e,t=!0){this.mtOutline.addSelectedObject(e,t)}setAOData(e,t){this.aoParams[e]=t,this.mtAO&&this.mtAO.setAOData(e,t)}setVignetteData(e,t){this.vignetteParams[e]=t,this.vignettePass&&(this.vignettePass.uniforms[e].value=t)}}var po=__webpack_require__(8266);class mo extends V{constructor(e){super(e),this.map=new le.Z,this.playLimit=new wt.cM,this.renderName="script-texture-render",this._clock=new n.Clock,this.bindEvent()}parse(e,t){var n=(0,St.K)(t);0===Object.keys(e).length?this.map.has(n)&&this.map.delete(n):this.map.set(n,{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:n}=e;var{moveX:e,moveY:r,rotate:i}=n;t.userData.scriptTextre||(t.userData.scriptTextre={offsetX:t.offset.x,offsetY:t.offset.y,rotation:t.rotation}),e&&(t.offset.x+=e),r&&(t.offset.y+=r),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 n=0,r=0,i=0;t.userData.scriptTextre&&(n=(e=t.userData.scriptTextre).offsetX,r=e.offsetY,i=e.rotation,delete t.userData.scriptTextre),t.offset.x=n,t.offset.y=r,t.rotation=i})),this.runScene.cb.render.delete(this.renderName)}}class vo extends V{constructor(e){super(e),this.runAll=!1,this.texture=new mo(e)}playAll(){this.runAll||(this.runAll=!0,this.texture.playAll())}closeAll(){this.runAll&&(this.runAll=!1,this.texture.closeAll())}}class go{constructor(e){this.map=new le.Z,this.clean=()=>{this.clear()},this.runScene=e,this.runScene.cb.clean.add("Tags",this.clean)}get(e){return this.map.get(e)}add(e){this.get(e)||this.map.set(e,new ft.Z)}rename(e,t){const n=this.get(e);n&&(this.addId(t,n.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,wt.lG)(t,"array"))return t.map((t=>{this.addModel(e,t)}));this.map.get(e).add((0,St.K)(t))}removeModel(e,t){if(this.map.has(e))return(0,wt.lG)(t,"array")?t.map((t=>{this.removeModel(e,t)})):void this.map.get(e).remove((0,St.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,n)=>{e[t]=[...n.filter((e=>this.runScene.modelEx.getById(e)))]})),e}parseJSON(e){let t={};(0,z.js)(e,((e,n)=>{t[e]=new ft.Z(n)})),this.map=le.Z.formJSON(t),this.runScene.cb.tags.parseJSON.cb(e)}}var yo=__webpack_require__(9716);class bo{constructor(e,t){this.showTransform=!1,this.data=new Proxy({},{set:(e,t,n)=>(e[t]=n,!0)}),this.uuid="",this.getAnimaByModelData=(()=>{const e=(e,t,n,r)=>{const i={},a={};if(e=bo.isNotNow(e)?this.getAllData():e,(0,z.js)(r,((n,r)=>{void 0!==e[n]&&("number"===(r=r.type)?(i[n]=t[n],a[n]=e[n]):"color"===r&&(0,z.js)(e[n],((e,r)=>{var o=n+e;i[o]=t[n][e],a[o]=r})))})),!(0,z.CV)(i))return{begin:i,end:a}};return(t,n,r,i=!1,a)=>{let o=i?r.time:0;const s=Object.keys(t).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t)));var l=(0,yo.lastArrayEle)(s),u=i?"0.00":String(r.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)*r.speed;o=s;{var c=n,h=l,d=u,f=a;const t={color(e){const{animaData:t,defType:n}=e,r={};(0,z.js)(t,(e=>{var i;-1!==e.indexOf(n)&&(i=e.substring(n.length),["r","g","b"].includes(i)&&(r[i]=t[e]))}));var{r:e,g:i,b:a}=r;if(e&&i&&a)return r}};return()=>{let n;return{promise:new Promise((r=>{var i;if(!(i=e(h,c,0,f)))return r(0);var{begin:i,end:a}=i;return n=(0,K.anima)(i,a,d,(e=>{(0,z.js)(f,((n,r)=>{r=r.type;var i,a=e[n];"number"===r?c[n]=a:"color"===r&&(a=t.color({animaData:e,defType:n}))&&(({r,g:a,b:i}=a),c[n].setRGB(r,a,i))}))}),r)})),anima:n}}}}))}})(),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,n=!1){return 1e3<Number(e)&&(e="1000.00"),n?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,n=!1){const r={};return(0,z.js)(e,(i=>{r[i]=n?"notNow":bo.getValByType(t,i,e)})),r}static getValByType(e,t,n){var r,i;return n=n[t].type,e=e[t],"number"===n?e:"color"===n?(({r:t,g:r,b:i}=e),{r:t,g:r,b:i}):"V3"===n?Ki().model.v3ToMap(e):""}static SetTargetByData(e){const{baseType:t,data:n,defType:r,target:i}=e;var a,o;"number"===t?i[r]=n:"color"===t&&(({r:e,g:a,b:o}=n),i[r].setRGB(e,a,o))}getAllData(e=!1){return bo.getAllDefValByType(this.defOptions,this.target,e)}getData(e){return bo.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,n){bo.setTargetByBetween(e,t,n,this.defOptions,this.target)}clone(e){var{data:t,type:n}=this;const r=new(0,Ao[n])(e);return r.data=t,r}reset(){(0,z.js)(this.defOptions,((e,t)=>{bo.SetTargetByData({baseType:t.type,data:bo.getValByType(this.beginData,e,this.defOptions),target:this.target,defType:e})}))}remove(){delete this.target.userData.isTimeLineUsed}}bo.setTargetByBetween=(()=>{const e=(e,t,n)=>e!==t?(t-e)*n+e:e;return(t,n,r,i,a)=>{(0,z.js)(i,((i,o)=>{var s,l,u,c,h,d;o=o.type,void 0!==t[i]&&void 0!==n[i]&&bo.SetTargetByData({baseType:o,data:(s=t[i],l=n[i],u=r,"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 xo=bo;class wo extends V{constructor(){super(...arguments),this.mount=e=>{e.core.module.set("timeline",this)},this.after=e=>{var t,{json:e,config:n}=e;"scene"===(null==(t=e.asset.ex)?void 0:t.type)&&n.module.timeline&&this.runScene.timeLineEx.parseSavedGroupMap((null==(t=e.asset.ex)?void 0:t.timeLine)||{})}}init(){var e={name:"timeline",loadCallBacks:new le.Z({afterParse:this.after,mountModule:this.mount}),exportCallBacks:new le.Z};this.runScene.exporter.gltf.module.bind(e)}}const Ao={model:class extends xo{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,n)=>{var{x:e,y:r,z:i}=e,{x:t,y:a,z:o}=t;return{x:e!==t?(t-e)*n+e:e,y:r!==a?(a-r)*n+r:r,z:i!==o?(o-i)*n+i:i}};return(t,n,r)=>{var i,{position:t,scale:a,rotation:o}=t,{position:n,scale:s,rotation:l}=n;t&&n&&(({x:t,y:n,z:i}=e(t,n,r)),this.target.position.set(t,n,i)),a&&s&&(({x:t,y:n,z:i}=e(a,s,r)),this.target.scale.set(t,n,i)),o&&l&&(({x:a,y:s,z:t}=e(o,l,r)),this.target.rotation.set(a,s,t))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,n)=>{var{position:t,scale:r,rotation:i}=t,{position:e,scale:a,rotation:o}=xo.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},a?{sx:r.x,sy:r.y,sz:r.z}:{},o?{rx:i.x,ry:i.y,rz:i.z}:{}),end:Object.assign({},n.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,n,r,i=!1)=>{let a=i?r.time:0;const o=Object.keys(t).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t)));var s=(0,yo.lastArrayEle)(o),l=i?"0.00":String(r.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)*r.speed;return a=o,s=n,l=h,u=d,c=r,()=>{let t;return{promise:new Promise((n=>{var{begin:r,end:i}=e(l,s,c);return t=(0,K.anima)(r,i,u,(e=>{var{px:e,py:t,pz:n,sx:r,sy:i,sz:a,rx:o,ry:u,rz:c}=e;l.position&&s.position.set(e,t,n),l.scale&&s.scale.set(r,i,a),l.rotation&&s.rotation.set(o,u,c)}),n)})),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: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(n.x,n.y,n.z)}},camera:class extends xo{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,n)=>{var{x:e,y:r,z:i}=e,{x:t,y:a,z:o}=t;return{x:e!==t?(t-e)*n+e:e,y:r!==a?(a-r)*n+r:r,z:i!==o?(o-i)*n+i:i}};return(t,n,r)=>{var i,{position:t,scale:a,rotation:o,target:s}=t,{position:n,scale:l,rotation:u,target:c}=n;t&&n&&(({x:t,y:n,z:i}=e(t,n,r)),this.target.position.set(t,n,i)),a&&l&&(({x:t,y:n,z:i}=e(a,l,r)),this.target.scale.set(t,n,i)),o&&u&&(({x:a,y:l,z:t}=e(o,u,r)),this.target.rotation.set(a,l,t)),s&&c&&(({x:n,y:i,z:o}=e(s,c,r)),this.controls.target.set(n,i,o))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,n)=>{var{position:t,scale:r,rotation:i}=t,{position:e,scale:a,rotation:o,target:s}=xo.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},a?{sx:r.x,sy:r.y,sz:r.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({},n.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,n,r,i)=>()=>{let a;return{promise:new Promise((o=>{var{begin:s,end:l}=e(n,t,i);return a=(0,K.anima)(s,l,r,(e=>{var{px:e,py:r,pz:i,sx:a,sy:o,sz:s,rx:l,ry:u,rz:c,tx:h,ty:d,tz:f}=e;n.position&&t.position.set(e,r,i),n.scale&&t.scale.set(a,o,s),n.rotation&&t.rotation.set(l,u,c),n.target&&this.controls.target.set(h,d,f)}),o)})),anima:K.anima}};return(e,n,r,i=!1)=>{let a=i?r.time:0;const o=Object.keys(e).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t)));var s=(0,yo.lastArrayEle)(o),l=i?"0.00":String(r.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)*r.speed;return a=o,t(n,s,l,r)}))}})(),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:n,rotation:r}=this.target;return{position:e?"notNow":Ki().model.v3ToMap(t),scale:e?"notNow":Ki().model.v3ToMap(n),rotation:e?"notNow":Ki().model.v3ToMap(r),target:e?"notNow":Ki().model.v3ToMap(this.controls.target)}}getData(e){var{position:t,scale:n,rotation:r}=this.target;let i;if("position"===e)i=Ki().model.v3ToMap(t);else if("scale"===e)i=Ki().model.v3ToMap(n);else if("rotation"===e)i=Ki().model.v3ToMap(r);else{if("target"!==e)throw TypeError("输入值不存在");i=Ki().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:n,target: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(n.x,n.y,n.z),this.controls.target.set(r.x,r.y,r.z)}},material:class extends xo{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)}}};__webpack_require__(4513);const So=W.Z,Mo={RunScene:class{constructor(e){this._clock=new n.Clock,this.cb=new ee,this.script=new vo(this),this.uniqueEx=new St.Z(this),this.fileEx=new Hi(this),this.undoEx=new ia.ZP(this),this.textureEx=new mt.default(this),this.controlsEx=new ae,this.assetsEx=new q(this),this.renderEx=new po.Z(this),this.events=new class{constructor(e){this.key=new ce(this),this.mouse=new de(this),this.drag=new oe(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 qi(this),this.helperEx=null,this.materialEx=new bt.default(this),this.cameraEx=new te.Z(this),this.sceneEx=new xt.ZP(this),this.modelEx=new Z.default(this),this.loaderer=new J.Z(this),this.exporter=new Dt(this),this.lightEx=new gt.ZP(this),this.timeLineEx=new class{constructor(e){this.timerMap={},this.animaMap={},this.groupMap={},this.clean=()=>{this.reset()},this.setModelLocal=(e,t)=>{Object.values(e.data).map((e=>{var n,r,i=((e,t)=>{let n=-1,r=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<r&&(r=e,n=i)})),-1!==n)){var a=i[n],o=i[n+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:n,progress:r}=i),e.setTargetByBetween(i,n,r))}))},this.runScene=e,this.runScene.cb.clean.add("TimeLine",this.clean),this.exportAndImport=new wo(e)}init(){this.exportAndImport.init()}reset(){this.timerMap={},this.animaMap={},this.groupMap={},this.runScene.cb.timeLine.reset.cb("")}closeGroup(e){var t,n;this.timerMap[e]&&(({setProgressTime:t,awaitRuned:n}=this.timerMap[e]),t&&clearInterval(t),n&&clearInterval(n)),this.groupMap[e].run=!1,this.runScene.cb.timeLine.closeGroup.cb(e);const r=this.animaMap[e];r&&r.length&&r.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 n=e[t],r={};(0,z.js)(n.data,((e,t)=>{var{type:t,data:n}=t;const i=Ao[t];if(t=i.getTarget(e,this.runScene)){const a=new i(t,this.runScene);a.data=n,r[e]=a}})),n.data=r,this.groupMap[t]=n,this.runScene.cb.timeLine.setGroupMap.cb({group:n,groupName:t})}))}playGroup(e,t){const n=(0,wt.Gm)({onlyReverse:!1},t).onlyReverse,r=(this.runScene.helperEx.unfocus(),this.groupMap[e]);if(r&&!r.run){r.run=!0;const i=Object.keys(r.data).map((e=>{const t=r.data[e];if(t.data=new Proxy(t.data,{set:(e,t,n)=>(e[t]=n,!0)}),n)return t.getAnima(r,!0);const i=t.getAnima(r);return r.reverse&&(e=t.getAnima(r,!0),i.push(...e)),i}));this.animaMap[e]||(this.animaMap[e]=[]),this.animaMap[e]=i.map((e=>(0,yo.eachTriggerArrGetControls)(e)));let a=0;a=n?r.time*r.speed:r.time*r.speed*(r.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),r.run)return r.run=!1,r.loop?this.playGroup(e):void 0}))}}}(this),this.anima=new X(this),this.tags=new go(this),this.globalConfig=new zi(this),this.pp=new fo(this),this.objects=new ua(this),this.inited=!1,this._renderLimit=new wt.cM,this._render=()=>{const{render2:e,render3:t}=this.assetsEx;var{scene:n,camera:r}=this.assetsEx.get();this.cb.render.cb(""),this.pp.update(),null!=t&&t.render(n,r),null!=e&&e.render(n,r)},this.render=()=>{if(null!=(e=this.optionsEx.options)&&e.run){const n=this._render;var{frame:e,mode:t}=this.optionsEx.options.renderConfig;-1!==e&&"tick"===t?(t=this._clock.getDelta(),this._renderLimit.update({cb(){n()},cbRate:1/e,now:t})):this._render()}},this.optionsEx=new da(this,e)}initLibs(e){if(!this.inited){this.materialEx.init(),this.modelEx.init(),this.sceneEx.init(),this.timeLineEx.init(),this.loaderer.init(),this.inited=!0,this.assetsEx.init(e),this.events.init(e),this.globalConfig.setRenderMode(this.optionsEx.options.renderConfig.mode),this.helperEx=new Wi(this);const{camera:t,controls:n}=this.assetsEx.get();this.uniqueEx.model.add(t),this.renderEx.setSize(),n.update(),this.pp.init(),this.cameraEx.reset(t)}}init(e){return this.initLibs(e),this}load(e){var{path:e,dom:t,loadConfig:n}=e;return this.init(t),this.loadScene(e,n).then((e=>{0!==(null==e?void 0:e.length)&&this.modelEx.add(e)})),this.cb.inited.cb(0),this}loadScene(e,t){return function(e,t,n,r){return new(n=n||Promise)((function(t,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function o(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var r;e.done?t(e.value):((r=e.value)instanceof n?r:new n((function(e){e(r)}))).then(a,o)}s((r=r.apply(e,[])).next())}))}(this,0,void 0,(function*(){const{getJSON:n,progress:r,complete:i}=this.cb.load;t=t||{};var a=Object.assign(Object.assign({},t),{callBack:Object.assign(Object.assign({},t.callBack),{getJSON:e=>{var r,i;null!=(i=null==(r=null==t?void 0:t.callBack)?void 0:r.getJSON)&&i.call(r,e),n.cb(e)},progress:e=>{var n,i;null!=(i=null==(n=null==t?void 0:t.callBack)?void 0:n.progress)&&i.call(n,e),r.cb(e)},complete:e=>{var n,r;null!=(r=null==(n=null==t?void 0:t.callBack)?void 0:n.complete)&&r.call(n,e),i.cb(e)}}),triggerCb:!1});if(e instanceof ArrayBuffer)return this.optionsEx.log("正在解析二进制文件","base","info"),this.loaderer.gltf.parse(e,a);this.optionsEx.log("正在拉取场景","base","info");var o=yield j().get(e,{responseType:"arraybuffer",onDownloadProgress:e=>{var{total:e,loaded:t}=e;let n=t/e;1<(n=n<0?0:n)&&(n=1),t=Number(n.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 o?(this.optionsEx.log("拉取场景成功、正在解析","base","success"),this.loaderer.gltf.parse(o,a)):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:n,render3:r}=this.assetsEx,i=this.assetsEx.get().renderer;this.cameraEx.setSize(),null!=r&&r.setSize(e,t),null!=n&&n.setSize(e,t),i.setSize(e,t,!0),this.pp.setSize(e,t)}clean(){this.cb.clean.cb(0)}},Utils:K,ModelEx:Z,MaterialEx:bt,TextureEx:mt,Three:So,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__})()));
|