run-scene-v2 0.0.81 → 0.0.82
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 +3 -3
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("three"),require("axios"),require("js-funcs"),require("js-funcs-three"),require("@allex/md5")):"function"==typeof define&&define.amd?define(["three","axios","js-funcs","js-funcs-three","@allex/md5"],t):"object"==typeof exports?exports.RunScene=t(require("three"),require("axios"),require("js-funcs"),require("js-funcs-three"),require("@allex/md5")):e.RunScene=t(e.three,e.axios,e["js-funcs"],e["js-funcs-three"],e["@allex/md5"])}(self,((__WEBPACK_EXTERNAL_MODULE__881__,__WEBPACK_EXTERNAL_MODULE__300__,__WEBPACK_EXTERNAL_MODULE__1__,__WEBPACK_EXTERNAL_MODULE__356__,__WEBPACK_EXTERNAL_MODULE__129__)=>(()=>{"use strict";var __webpack_modules__={958:(e,t,r)=>{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 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"===f(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return o(n)}}function o(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 He(e)||ze(e)}function y(e){return(nt=E(e,rt))&&Sr}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 S(e,t,r){return(r=e[t])&&He(r)?e[t]():m(r)&&e.getAttribute&&e.getAttribute(t)||r}function A(e,t){(e=e.split(",")).forEach(t)}function M(e,t,r,n){st.length&&vt(),e.render(t,r,n),st.length&&vt()}function B(e){var t=parseFloat(e);return(t||0===t)&&(e+"").match(et).length<2?t:ze(e)?e.trim():e}function C(e){return e}function E(e,t){for(var r in t)e[r]=t[r];return e}function T(e,t){for(var r in t)"__proto__"!==r&&"constructor"!==r&&"prototype"!==r&&(e[r]=Je(t[r])?T(e[r]||(e[r]={}),t[r]):t[r]);return e}function _(e){var t,r=e.parent||le,n=e.keyframes?(t=We(e.keyframes),function(e,r){for(var n in r)n in e||"duration"===n&&t||"ease"===n||(e[n]=r[n])}):gt;if(Ke(e.inherit))for(;r;)n(e,r.vars.defaults),r=r.parent||r._dp;return e}function D(e){return!e||e._ts&&D(e.parent)}function P(e){return e._repeat?O(e._tTime,e=e.duration()+e._rDelay)*e:0}function O(e,t){return t=Math.floor(e/=t),e&&t===e?t-1:t}function R(e,t){return(e-t._start)*t._ts+(0<=t._ts?0:t._dirty?t.totalDuration():t._tDur)}function I(e,t){var r;if((t._time||t._initted&&!t._dur)&&(r=R(e.rawTime(),t),(!t._dur||V(0,t.totalDuration(),r)-t._tTime>ke)&&t.render(r,!0)),wt(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur<e.duration())for(r=e;r._dp;)0<=r.rawTime()&&r.totalTime(r._tTime),r=r._dp;e._zTime=-ke}}function k(e,t,r,n){return t.parent&&xt(t),t._start=mt((Ve(r)?r:r||e!==le?z(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,s=e[i];if(a)for(r=t[a];s&&s[a]>r;)s=s._prev;s?(t._next=s._next,s._next=t):(t._next=e[n],e[n]=t),t._next?t._next._prev=t:e[i]=t,t._prev=s,t.parent=t._dp=e}(e,t,"_first","_last",e._sort?"_start":0),G(t)||(e._recent=t),n||I(e,t),e}function L(e,t){(rt.ScrollTrigger||it("scrollTrigger",t))&&rt.ScrollTrigger.create(t,e)}function F(e,t,r,n){return Zt(e,t),e._initted?!r&&e._pt&&(e._dur&&!1!==e.vars.lazy||!e._dur&&e.vars.lazy)&&pe!==Ut.frame?(st.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 N(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?At(e,e._tTime=e._tDur*t):e.parent&&St(e),r||wt(e.parent,e),e}function j(e){return e instanceof ar?wt(e):N(e,e._dur)}function z(e,t,r){var n,i,a,s=e.labels,o=e._recent||Mt,l=e.duration()>=Ie?o.endTime(!1):e._dur;return ze(t)&&(isNaN(t)||t in s)?(i=t.charAt(0),a="%"===t.substr(-1),n=t.indexOf("="),"<"===i||">"===i?(0<=n&&(t=t.replace(/=/,"")),("<"===i?o._start:o.endTime(0<=o._repeat))+(parseFloat(t.substr(1))||0)*(a?(n<0?o:r).totalDuration()/100:1)):n<0?(t in s||(s[t]=l),s[t]):(i=parseFloat(t.charAt(n-1)+t.substr(n+1)),a&&r&&(i=i/100*(We(r)?r[0]:r).totalDuration()),1<n?z(e,t.substr(0,n-1),r)+i:l+i)):null==t?l:+t}function H(e,t,r){var n,i,a=Ve(t[1]),s=(a?2:1)+(e<2?0:1),o=t[s];if(a&&(o.duration=t[1]),o.parent=r,e){for(n=o,i=r;i&&!("immediateRender"in n);)n=i.vars.defaults||{},i=Ke(i.vars.inherit)&&i.parent;o.immediateRender=Ke(n.immediateRender),e<2?o.runBackwards=1:o.startAt=t[s-1]}return new hr(t[0],o,t[1+s])}function V(e,t,r){return r<e?e:t<r?t:r}function J(e){if(He(e))return e;var t=Je(e)?e:{each:e},r=Vt(t.ease),n=t.from||0,i=parseFloat(t.base)||0,a={},s=(e=0<n&&n<1,isNaN(n)||e),o=t.axis,l=n,u=n;return ze(n)?l=u={center:.5,edges:.5,end:1}[n]||0:!e&&s&&(l=n[0],u=n[1]),function(e,c,h){var d,p,f,m,v,g,y,b,x=(h||t).length,w=a[x];if(!w){if(!(b="auto"===t.grid?0:(t.grid||[1,Ie])[1])){for(g=-Ie;g<(g=h[b++].getBoundingClientRect().left)&&b<x;);b--}for(w=a[x]=[],d=s?Math.min(b,x)*l-.5:n%b,p=b===Ie?0:s?x*u/b-.5:n/b|0,y=Ie,v=g=0;v<x;v++)m=v%b-d,f=p-(v/b|0),w[v]=m=o?Math.abs("y"===o?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:o?"y"===o?x/b:b:Math.max(b,x/b))||0)*("edges"===n?-1:1),w.b=x<0?i-x:i,w.u=Ct(t.amount||t.each)||0,r=r&&x<0?Ht(r):r}return x=(w[e]-w.min)/w.max||0,mt(w.b+(r?r(x):x)*w.v)+w.u}}function K(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(r){var n=Math.round(parseFloat(r)/e)*e*t;return(n-n%1)/t+(Ve(r)?0:Ct(r))}}function Z(e,t){var r,n,i=We(e);return!i&&Je(e)&&(r=i=e.radius||Ie,e.values?(e=_t(e.values),(n=!Ve(e[0]))&&(r*=r)):e=K(e.increment)),Bt(t,i?He(e)?function(t){return n=e(t),Math.abs(n-t)<=r?n:t}:function(t){for(var i,a,s=parseFloat(n?t.x:t),o=parseFloat(n?t.y:0),l=Ie,u=0,c=e.length;c--;)(i=n?(i=e[c].x-s)*i+(a=e[c].y-o)*a:Math.abs(e[c]-s))<l&&(l=i,u=c);return u=!r||l<=r?e[u]:t,n||u===t||Ve(t)?u:u+Ct(t)}:K(e))}function W(e,t,r,n){return Bt(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 Bt(r,(function(r){return e[~~t(r)]}))}function Q(e,t,r,n,i){var a=t-e,s=n-r;return Bt(i,(function(t){return r+((t-e)/a*s||0)}))}function Y(e,t,r){var n,i,a,s=e.labels,o=Ie;for(n in s)(i=s[n]-t)<0==!!r&&i&&o>(i=Math.abs(i))&&(a=n,o=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&&st.length&&vt(),t?i.apply(n,t):i.call(n))}function $(e){return xt(e),e.scrollTrigger&&e.scrollTrigger.kill(!1),e.progress()<1&&q(e,"onInterrupt"),e}function ee(e,t,r){return(6*(e+=e<0?1:1<e?-1:0)<1?t+(r-t)*e*6:e<.5?r:3*e<2?t+(r-t)*(2/3-e)*6:t)*Ot+.5|0}function te(e,t,r){var n,i,a,s,o="",l=(e+o).match(Lt),u=t?"hsla(":"rgba(",c=0;if(!l)return e;if(l=l.map((function(e){return(e=It(e,t,1))&&u+(t?e[0]+","+e[1]+"%,"+e[2]+"%,"+e[3]:e.join(","))+")"})),r&&(a=kt(e),(n=r.c).join(o)!==a.c.join(o)))for(s=(i=e.replace(Lt,"1").split(Ye)).length-1;c<s;c++)o+=i[c]+(~n.indexOf(c)?l.shift()||u+"0,0,0,0)":(a.length?a:l.length?l:r).shift());if(!i)for(s=(i=e.split(Lt)).length-1;c<s;c++)o+=i[c]+l[c];return o+i[s]}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}};A(e,(function(e){for(var t in Nt[e]=rt[e]=i,Nt[r=e.toLowerCase()]=n,i)Nt[r+("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,r){function n(e){return 1===e?1:i*Math.pow(2,-10*e)*je((e-a)*s)+1}var i=1<=t?t:1,a=(s=(r||(e?.3:.45))/(t<1?t:1))/Le*(Math.asin(1/i)||0),s=(r="out"===e?n:"in"===e?function(e){return 1-n(1-e)}:ie(n),Le/s);return r.config=function(t,r){return ae(e,t,r)},r}function se(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 se(e,t)},n}r.d(t,{Q3:()=>hr});var oe,le,ue,ce,he,de,pe,fe,me,ve,ge,ye,be,xe,we,Se,Ae,Me,Be,Ce,Ee,Te,_e,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,ze=function(e){return"string"==typeof e},He=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={},st=[],ot={},lt={},ut={},ct=30,ht=[],dt="",pt=function(e){var t,r,n=e[0];if(Je(n)||He(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(_t(e))[0]._gsap},mt=function(e){return Math.round(1e7*e)/1e7||0},vt=function(){var e,t,r=st.length,n=st.slice(0);for(ot={},e=st.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},St=function(e){return e._end=mt(e._start+(e._tDur/Math.abs(e._ts||e._rts||ke)||0))},At=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)),St(e),r._dirty||wt(r,e)),e},Mt={_start:0,endTime:w,totalDuration:w},Bt=function(e,t){return e||0===e?t(e):t},Ct=function(e,t){return ze(e)&&(t=tt.exec(e))?e.substr(t.index+t[0].length):""},Et=[].slice,Tt=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},_t=function(e,t,r){return!ze(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 ze(e)&&!t||Tt(e,1)?r.push.apply(r,d(_t(e))):r.push(e)}))||r}(e,r):Tt(e)?Et.call(e,0):e?[e]:[]:Et.call((t||he).querySelectorAll(e),0)},Dt=function(e){return e.sort((function(){return.5-Math.random()}))},Pt=function(e){for(var t,r,n,i,a=0,s="";~(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),s+=e.substr(a,t-a)+W(i?r:+r[0],i?0:+r[1],+r[2]||1e-5),a=n+1;return s+e.substr(a,e.length-a)},Ot=255,Rt={aqua:[0,Ot,Ot],lime:[0,Ot,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Ot],navy:[0,0,128],white:[Ot,Ot,Ot],olive:[128,128,0],yellow:[Ot,Ot,0],orange:[Ot,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Ot,0,0],pink:[Ot,192,203],cyan:[0,Ot,Ot],transparent:[Ot,Ot,Ot,0]},It=function(e,t,r){var n,i,a,s,o,l,u,c=e?Ve(e)?[e>>16,e>>8&Ot,e&Ot]:0:Rt.black;if(!c){if(","===e.substr(-1)&&(e=e.substr(0,e.length-1)),Rt[e])c=Rt[e];else if("#"===e.charAt(0)){if(9===(e=e.length<6?"#"+(n=e.charAt(1))+n+(i=e.charAt(2))+i+(a=e.charAt(3))+a+(5===e.length?e.charAt(4)+e.charAt(4):""):e).length)return[(c=parseInt(e.substr(1,6),16))>>16,c>>8&Ot,c&Ot,parseInt(e.substr(7),16)/255];c=[(e=parseInt(e.substr(1),16))>>16,e>>8&Ot,e&Ot]}else if("hsl"===e.substr(0,3))if(c=u=e.match(Xe),t){if(~e.indexOf("="))return c=e.match(Qe),r&&c.length<4&&(c[3]=1),c}else s=+c[0]%360/360,o=+c[1]/100,n=2*(l=+c[2]/100)-(i=l<=.5?l*(o+1):l+o-l*o),3<c.length&&(c[3]*=1),c[0]=ee(s+1/3,n,i),c[1]=ee(s,n,i),c[2]=ee(s-1/3,n,i);else c=e.match(Xe)||Rt.transparent;c=c.map(Number)}return t&&!u&&(n=c[0]/Ot,i=c[1]/Ot,a=c[2]/Ot,l=((e=Math.max(n,i,a))+(t=Math.min(n,i,a)))/2,e===t?s=o=0:(u=e-t,o=.5<l?u/(2-e-t):u/(e+t),s=e===n?(i-a)/u+(i<a?6:0):e===i?(a-n)/u+2:(n-i)/u+4,s*=60),c[0]=~~(s+.5),c[1]=~~(100*o+.5),c[2]=~~(100*l+.5)),r&&c.length<4&&(c[3]=1),c},kt=function(e){var t=[],r=[],n=-1;return e.split(Lt).forEach((function(e){e=e.match(Ye)||[],t.push.apply(t,d(e)),r.push(n+=e.length+1)})),t.c=r,t},Lt=function(){var e,t="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b";for(e in Rt)t+="|"+e+"\\b";return new RegExp(t+")","gi")}(),Ft=/hsl[a]?\(/,Ut=(we=Date.now,Se=500,Ae=33,Me=we(),Be=Me,Ee=Ce=1e3/240,_e={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=Sr,(ue.gsapVersions||(ue.gsapVersions=[])).push(Sr.version),y(nt||ue.GreenSockGlobals||!ue.gsap&&ue||{}),ye=ue.requestAnimationFrame),ve&&_e.sleep(),ge=ye||function(e){return setTimeout(e,Ee-1e3*_e.time+1|0)},me=1,Jt(2))},sleep:function(){(ye?ue.cancelAnimationFrame:clearTimeout)(ve),me=0,ge=w},lagSmoothing:function(e,t){Se=e||1/ke,Ae=Math.min(t,Se,0)},fps:function(e){Ce=1e3/(e||240),Ee=1e3*_e.time+Ce},add:function(e){Te.indexOf(e)<0&&Te.push(e),Gt()},remove:function(e,t){~(t=Te.indexOf(e))&&Te.splice(t,1)&&t<=xe&&xe--},_listeners:Te=[]}),Gt=function(){return!me&&Ut.wake()},Nt={},jt=/^[\d.\-M][\d.\-,\s]/,zt=/["']/g,Ht=function(e){return function(t){return 1-e(1-t)}},Vt=function(e,t){return e&&(He(e)?e:Nt[e]||function(e){var t,r,n,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,r,n,i={},a=e.substr(1,e.length-3).split(":"),s=a[0],o=1,l=a.length;o<l;o++)r=a[o],t=o!==l-1?r.lastIndexOf(","):r.length,n=r.substr(0,t),i[s]=isNaN(n)?n.replace(zt,"").trim():+n,s=r.substr(t+1).trim();return i}(i[1])]:(t=(i=e).indexOf("(")+1,r=i.indexOf(")"),n=i.indexOf("(",t),i.substring(t,~n&&n<r?i.indexOf(")",r+1):r).split(",").map(B))):Nt._CE&&jt.test(e)?Nt._CE("",e):a}(e))||t};function Jt(e){var t,r,n,i=we()-Be,a=!0===e;if(Se<i&&(Me+=i-Ae),(0<(i=(r=(Be+=i)-Me)-Ee)||a)&&(n=++_e.frame,be=r-1e3*_e.time,_e.time=r/=1e3,Ee+=i+(Ce<=i?4:Ce-i),t=1),a||(ve=ge(Jt)),t)for(xe=0;xe<Te.length;xe++)Te[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,s,o,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,S=m.callbackScope,A=m.runBackwards,M=m.yoyoEase,B=m.keyframes,C=m.autoRevert,E=e._dur,T=e._startAt,_=e._targets,D=e.parent,P=D&&"nested"===D.data?D.parent._targets:_,O="auto"===e._overwrite&&!oe,R=e.timeline;if(e._ease=Vt(v=!R||B&&v?v:"none",Re.ease),e._yEase=M?Ht(Vt(!0===M?v:M,Re.ease)):0,M&&e._yoyo&&!e._repeat&&(M=e._yEase,e._yEase=e._ease,e._ease=M),e._from=!R&&!!m.runBackwards,!R||B&&!m.stagger){if(p=(u=_[0]?ft(_[0]).harness:0)&&m[u.prop],r=yt(m,at),T&&xt(T.render(-1,!0)),g)if(xt(e._startAt=hr.set(_,gt({data:"isStart",overwrite:!1,parent:D,immediateRender:!0,lazy:Ke(b),startAt:null,delay:0,onUpdate:x,onUpdateParams:w,callbackScope:S,stagger:0},g))),t<0&&!y&&!C&&e._startAt.render(-1,!0),y){if(0<t&&!C&&(e._startAt=0),E&&t<=0)return void(t&&(e._zTime=t))}else!1===C&&(e._startAt=0);else if(A&&E)if(T)C||(e._startAt=0);else if(i=gt({overwrite:!1,data:"isFromStart",lazy:(y=!t&&y)&&Ke(b),immediateRender:y,stagger:0,parent:D},r),p&&(i[u.prop]=p),xt(e._startAt=hr.set(_,i)),t<0&&e._startAt.render(-1,!0),e._zTime=t,y){if(!t)return}else Zt(e._startAt,ke);for(e._pt=0,b=E&&Ke(b)||b&&!E,n=0;n<_.length;n++){if(l=(s=_[n])._gsap||pt(_)[n]._gsap,e._ptLookup[n]=h={},ot[l.id]&&st.length&&vt(),d=P===_?n:P.indexOf(s),u&&!1!==(c=new u).init(s,p||r,e,d,P)&&(e._pt=a=new br(e._pt,s,c.name,0,1,c.render,c,0,c.priority),c._props.forEach((function(e){h[e]=a})),c.priority&&(o=1)),!u||p)for(i in r)lt[i]&&(c=lr(i,r,e,d,s,P))?c.priority&&(o=1):h[i]=a=or.call(e,s,i,"get",r[i],d,P,0,m.stringFilter);e._op&&e._op[n]&&e.kill(s,e._op[n]),O&&e._pt&&(rr=e,le.killTweensOf(s,h,e.globalTime(t)),f=!e.parent,rr=0),e._pt&&b&&(ot[l.id]=1)}o&&yr(e),e._onInit&&e._onInit(e)}e._onUpdate=x,e._initted=(!e._op||e._pt)&&!f,B&&t<=0&&R.render(Ie,!0,!0)}function Wt(e,t,r,n,i){return He(e)?e.call(t,r,n,i):ze(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(ze(r)&&(n={},A(r,(function(e){return n[e]=1})),r=n),t){for(i in n={},r)n[i]=t(r[i]);r=n}var a,s,o,l=e,u=r,c=l._targets;for(a in u)for(s=c.length;s--;)(o=(o=l._ptLookup[s][a])&&o.d)&&(o=o._pt?wr(o,a):o)&&o.modifier&&o.modifier(u[a],l,c[s],a)}}}}A("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}))})),Nt.Linear.easeNone=Nt.none=Nt.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-Ne(e*Fe)})),ne("Back",se("in"),se("out"),se()),Nt.SteppedEase=Nt.steps=rt.SteppedEase={config:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length?arguments[1]:void 0,r=1/e,n=e+(t?0:1),i=t?1:0,a=1-ke;return function(e){return((n*V(0,a,e)|0)+i)*r}}},Re.ease=Nt["quad.out"],A("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:S,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,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 r=this._dp;if(r&&r.smoothChildTiming&&this._ts){for(At(this,e),r._dp&&!r.parent&&I(r,this);r&&r.parent;)r.parent._time!==r._start+(0<=r._ts?r._tTime/r._ts:(r.totalDuration()-r._tTime)/-r._ts)&&r.totalTime(r._tTime,!0),r=r.parent;!this.parent&&this._dp.autoRemoveChildren&&(0<this._ts&&e<this._tDur||this._ts<0&&0<e||!this._tDur&&!e)&&k(this._dp,this,this._start-this._delay)}return(this._tTime!==e||!this._dur&&!t||this._initted&&Math.abs(this._zTime)===ke||!e&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=e),M(this,e,t)),this}},{key:"time",value:function(e,t){return arguments.length?this.totalTime(Math.min(this.totalDuration(),e+P(this))%(this._dur+this._rDelay)||(e?this._dur:0),t):this._time}},{key:"totalProgress",value:function(e,t){return arguments.length?this.totalTime(this.totalDuration()*e,t):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.ratio}},{key:"progress",value:function(e,t){return arguments.length?this.totalTime(this.duration()*(!this._yoyo||1&this.iteration()?e:1-e)+P(this),t):this.duration()?Math.min(1,this._time/this._dur):this.ratio}},{key:"iteration",value:function(e,t){var r=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(e-1)*r,t):this._repeat?O(this._tTime,r)+1:1}},{key:"timeScale",value:function(e){if(!arguments.length)return this._rts===-ke?0:this._rts;if(this._rts===e)return this;for(var t=this.parent&&this._ts?R(this.parent._time,this):this._tTime,r=(this._rts=+e||0,this._ts=this._ps||e===-ke?0:this._rts,e=this.totalTime(V(-this._delay,this._tDur,t),!0)).parent;r&&r.parent;)r._dirty=1,r.totalDuration(),r=r.parent;return St(this),this}},{key:"paused",value:function(e){return arguments.length?(this._ps!==e&&((this._ps=e)?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(Gt(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,1===this.progress()&&Math.abs(this._zTime)!==ke&&(this._tTime-=ke)))),this):this._ps}},{key:"startTime",value:function(e){var t;return arguments.length?(this._start=e,!(t=this.parent||this._dp)||!t._sort&&this.parent||k(t,this,e-this._delay),this):this._start}},{key:"endTime",value:function(e){return this._start+(Ke(e)?this.totalDuration():this.duration())/Math.abs(this._ts||1)}},{key:"rawTime",value:function(e){var t=this.parent||this._dp;return t?e&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?R(t.rawTime(e),this):this._tTime:this._tTime}},{key:"globalTime",value:function(e){for(var t=this,r=arguments.length?e:t.rawTime();t;)r=t._start+r/(t._ts||1),t=t._dp;return r}},{key:"repeat",value:function(e){return arguments.length?(this._repeat=e===1/0?-2:e,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(z(this,e),Ke(t))}},{key:"restart",value:function(e,t){return this.play().totalTime(e?-this._delay:0,Ke(t))}},{key:"play",value:function(e,t){return null!=e&&this.seek(e,t),this.reversed(!1).paused(!1)}},{key:"reverse",value:function(e,t){return null!=e&&this.seek(e||this.totalDuration(),t),this.reversed(!0).paused(!1)}},{key:"pause",value:function(e,t){return null!=e&&this.seek(e,t),this.paused(!0)}},{key:"resume",value:function(){return this.paused(!1)}},{key:"reversed",value:function(e){return arguments.length?(!!e!==this.reversed()&&this.timeScale(-this._rts||(e?-ke:0)),this):this._rts<0}},{key:"invalidate",value:function(){return this._initted=this._act=0,this._zTime=-ke,this}},{key:"isActive",value:function(){var e=this.parent||this._dp,t=this._start;return!(e&&!(this._ts&&this._initted&&e.isActive()&&(e=e.rawTime(!0))>=t&&e<this.endTime(!0)-ke))}},{key:"eventCallback",value:function(e,t,r){var n=this.vars;return 1<arguments.length?(t?(n[e]=t,r&&(n[e+"Params"]=r),"onUpdate"===e&&(this._onUpdate=t)):delete n[e],this):n[e]}},{key:"then",value:function(e){var t=this;return new Promise((function(r){function n(){var e=t.then;t.then=null,He(i)&&(i=i(t))&&(i.then||i===t)&&(t.then=e),r(i),t.then=e}var i=He(e)?e:C;t._initted&&1===t.totalProgress()&&0<=t._ts||!t._tTime&&t._ts<0?n():t._prom=n}))}},{key:"kill",value:function(){$(this)}}]),e}(),ar=(gt(ir.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-ke,_prom:0,_ps:!1,_rts:1}),function(){i(t,ir);var e=s(t);function t(){var r,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},i=1<arguments.length?arguments[1]:void 0;return h(this,t),(r=e.call(this,n)).labels={},r.smoothChildTiming=!!n.smoothChildTiming,r.autoRemoveChildren=!!n.autoRemoveChildren,r._sort=Ke(n.sortChildren),le&&k(n.parent||le,o(r),i),n.reversed&&r.reverse(),n.paused&&r.paused(!0),n.scrollTrigger&&L(o(r),n.scrollTrigger),r}return c(t,[{key:"to",value:function(e,t,r){return H(0,arguments,this),this}},{key:"from",value:function(e,t,r){return H(1,arguments,this),this}},{key:"fromTo",value:function(e,t,r,n){return H(2,arguments,this),this}},{key:"set",value:function(e,t,r){return t.duration=0,t.parent=this,_(t).repeatDelay||(t.repeat=0),t.immediateRender=!!t.immediateRender,new hr(e,t,z(this,r),1),this}},{key:"call",value:function(e,t,r){return k(this,hr.delayedCall(0,e,t),r)}},{key:"staggerTo",value:function(e,t,r,n,i,a,s){return r.duration=t,r.stagger=r.stagger||n,r.onComplete=a,r.onCompleteParams=s,r.parent=this,new hr(e,r,z(this,i)),this}},{key:"staggerFrom",value:function(e,t,r,n,i,a,s){return r.runBackwards=1,_(r).immediateRender=Ke(r.immediateRender),this.staggerTo(e,t,r,n,i,a,s)}},{key:"staggerFromTo",value:function(e,t,r,n,i,a,s,o){return n.startAt=r,_(n).immediateRender=Ke(n.immediateRender),this.staggerTo(e,t,n,i,a,s,o)}},{key:"render",value:function(e,t,r){var n,i,a,s,o,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,o=!(u=this._ts),g&&(m||(p=this._zTime),!e&&t||(this._zTime=e)),this._repeat){if(g=this._yoyo,s=m+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*s+e,t,r);if(n=mt(v%s),v===f?(a=this._repeat,n=m):((a=~~(v/s))&&a===v/s&&(n=m,a--),m<n&&(n=m)),h=O(this._tTime,s),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*s)),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||o!=!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&&!o)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&&!o){l=0,i&&(v+=this._zTime=-ke);break}}b=i}else for(var b=this._last,x=e<0?e:n;b;){if(i=b._prev,(b._act||x<=b._end)&&b._ts&&l!==b){if(b.parent!==this)return this.render(e,t,r);if(b.render(0<b._ts?(x-b._start)*b._ts:(b._dirty?b.totalDuration():b._tDur)+(x-b._start)*b._ts,t,r),n!==this._time||!this._ts&&!o){l=0,i&&(v+=this._zTime=x?-ke:ke);break}}b=i}if(l&&!t&&(this.pause(),l.render(p<=n?0:-ke)._zTime=p<=n?1:-1,this._ts))return this._start=c,St(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=z(this,t,e)),!(e instanceof ir)){if(We(e))return e.forEach((function(e){return r.add(e,t)})),this;if(ze(e))return this.addLabel(e,t);if(!He(e))return this;e=hr.delayedCall(0,e)}return this!==e?k(this,e,t):this}},{key:"getChildren",value:function(){for(var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],r=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:-Ie,i=[],a=this._first;a;)a._start>=n&&(a instanceof hr?t&&i.push(a):(r&&i.push(a),e&&i.push.apply(i,d(a.getChildren(!0,t,r))))),a=a._next;return i}},{key:"getById",value:function(e){for(var t=this.getChildren(1,1,1),r=t.length;r--;)if(t[r].vars.id===e)return t[r]}},{key:"remove",value:function(e){return ze(e)?this.removeLabel(e):He(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]=z(this,t),this}},{key:"removeLabel",value:function(e){return delete this.labels[e],this}},{key:"addPause",value:function(e,t,r){return(t=hr.delayedCall(0,t||w,r)).data="isPause",this._hasPause=1,k(this,t,z(this,e))}},{key:"removePause",value:function(e){var t=this._first;for(e=z(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=_t(e),a=this._first,s=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)&&(s?(!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=z(n,e),a=(e=t).startAt,s=e.onStart,o=e.onStartParams,l=(e=e.immediateRender,hr.to(n,gt({ease:t.ease||"none",lazy:!1,immediateRender:!1,time:i,overwrite:"auto",duration:t.duration||Math.abs((i-(a&&"time"in a?a.time:n._time))/n.timeScale())||ke,onStart:function(){var e;n.pause(),r||(e=t.duration||Math.abs((i-(a&&"time"in a?a.time:n._time))/n.timeScale()),l._dur!==e&&N(l,e,0,1).render(l._time,!0,!0),r=1),s&&s.apply(l,o||[])}},t)));return e?l.render(0):l}},{key:"tweenFromTo",value:function(e,t,r){return this.tweenTo(t,gt({startAt:{time:z(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,z(this,e))}},{key:"previousLabel",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._time;return Y(this,z(this,e),1)}},{key:"currentLabel",value:function(e){return arguments.length?this.seek(e,!0):this.previousLabel(this._time+ke)}},{key:"shiftChildren",value:function(e,t){for(var r,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=this._first,a=this.labels;i;)i._start>=n&&(i._start+=e,i._end+=e),i=i._next;if(t)for(r in a)a[r]>=n&&(a[r]+=e);return wt(this)}},{key:"invalidate",value:function(){var e=this._first;for(this._lock=0;e;)e.invalidate(),e=e._next;return n(l(t.prototype),"invalidate",this).call(this)}},{key:"clear",value:function(){for(var e,t=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],r=this._first;r;)e=r._next,this.remove(r),r=e;return this._dp&&(this._time=this._tTime=this._pTime=0),t&&(this.labels={}),wt(this)}},{key:"totalDuration",value:function(e){var t,r,n,i=0,a=this,s=a._last,o=Ie;if(arguments.length)return a.timeScale((a._repeat<0?a.duration():a.totalDuration())/(a.reversed()?-e:e));if(a._dirty){for(n=a.parent;s;)t=s._prev,s._dirty&&s.totalDuration(),(r=s._start)>o&&a._sort&&s._ts&&!a._lock?(a._lock=1,k(a,s,r-s._delay,1)._lock=0):o=r,r<0&&s._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),o=0),s._end>i&&s._ts&&(i=s._end),s=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)),pe=Ut.frame),Ut.frame>=ct){ct+=Oe.autoSleep||120;var t=le._first;if((!t||!t._ts)&&Oe.autoSleep&&Ut._listeners.length<2){for(;t&&!t._ts;)t=t._next;t||Ut.sleep()}}}}]),t}()),sr=(gt(ar.prototype,{_lock:0,_hasPause:0,_forcing:0}),function(e,t,r,n,i,a,s){var o,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]),o=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!==o[f++]&&(h=parseFloat(o[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=s,($e.test(n)||i)&&(d.e=0),this._pt=d}),or=function(e,t,r,n,i,a,s,o,l){var u;if(He(n)&&(n=n(i||0,e,a)),i=e[t],a="get"!==r?r:He(i)?l?e[t.indexOf("set")||!He(e["get"+t.substr(3)])?t:"get"+t.substr(3)](l):e[t]():i,r=He(i)?l?fr:pr:dr,ze(n)&&"="===(n=~n.indexOf("random(")?Pt(n):n).charAt(1)&&(!(u=parseFloat(a)+parseFloat(n.substr(2))*("-"===n.charAt(0)?-1:1)+(Ct(a)||0))&&0!==u||(n=u)),a!==n)return isNaN(a*n)||""===n?(i||t in e||it(t,n),sr.call(this,e,t,a,n,r,o||Oe.stringFilter,l)):(u=new br(this._pt,e,t,+a||0,n-(a||0),"boolean"==typeof i?gr:vr,0,r),l&&(u.fp=l),s&&u.modifier(s,this,e),this._pt=u)},lr=function(e,t,r,n,i,a){var s,o,l,u;if(lt[e]&&!1!==(s=new lt[e]).init(i,s.rawVars?t[e]:function(e,t,r,n,i){if(He(e)&&(e=Wt(e,i,t,r,n)),!Je(e)||e.style&&e.nodeType||We(e)||Ze(e))return ze(e)?Wt(e,i,t,r,n):e;var a,s={};for(a in e)s[a]=Wt(e[a],i,t,r,n);return s}(t[e],n,i,a,r),r,n,a)&&(r._pt=o=new br(r._pt,i,e,0,1,s.render,s,0,s.priority),r!==fe))for(l=r._ptLookup[r._targets.indexOf(i)],u=s._props.length;u--;)l[s._props[u]]=o;return s},ur=dt+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase",cr={},hr=(A(ur+",id,stagger,delay,duration,paused,scrollTrigger",(function(e){return cr[e]=1})),function(){i(t,ir);var e=s(t);function t(r,n,i,a){h(this,t),"number"==typeof n&&(i.duration=n,n=i,i=null);var s,l,u,c,d,p,f,m,v,y=(a=(s=e.call(this,a?n:_(n))).vars).duration,x=a.delay,w=a.immediateRender,S=a.stagger,A=a.overwrite,M=a.keyframes,B=a.defaults,C=a.scrollTrigger,T=a.yoyoEase,P=(a=n.parent||le,(We(r)||Ze(r)?Ve(r[0]):"length"in n)?[r]:_t(r));if(s._targets=P.length?pt(P):b("GSAP target "+r+" not found. https://greensock.com",!Oe.nullTargetWarn)||[],s._ptLookup=[],s._overwrite=A,M||S||g(y)||g(x)){if(n=s.vars,(l=s.timeline=new ar({data:"nested",defaults:B||{}})).kill(),l.parent=l._dp=o(s),l._start=0,S||g(y)||g(x)){if(d=P.length,m=S&&J(S),Je(S))for(p in S)~ur.indexOf(p)&&((v=v||{})[p]=S[p]);for(u=0;u<d;u++)(c=yt(n,cr)).stagger=0,T&&(c.yoyoEase=T),v&&E(c,v),f=P[u],c.duration=+Wt(y,o(s),u,f,P),c.delay=(+Wt(x,o(s),u,f,P)||0)-s._delay,!S&&1===d&&c.delay&&(s._delay=x=c.delay,s._start+=x,c.delay=0),l.to(f,c,m?m(u,f,P):0),l._ease=Nt.none;l.duration()?y=x=0:s.timeline=0}else if(M){_(gt(l.vars.defaults,{ease:"none"})),l._ease=Vt(M.ease||n.ease||"none");var O,R,I,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,s=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:s})}));else for(i in t)a=r[i]||(r[i]=[]),"ease"!==i&&a.push({t:parseFloat(e),v:t[i],e:s})}(p,M[p],c,M.easeEach);for(p in c)for(O=c[p].sort((function(e,t){return e.t-t.t})),u=F=0;u<O.length;u++)(I={ease:(R=O[u]).e,duration:(R.t-(u?O[u-1].t:0))/100*y})[p]=R.v,l.to(P,I,F),F+=I.duration;l.duration()<y&&l.to({},{duration:y-l.duration()})}}y||s.duration(y=l.duration())}else s.timeline=0;return!0!==A||oe||(rr=o(s),le.killTweensOf(P),rr=0),k(a,o(s),i),n.reversed&&s.reverse(),n.paused&&s.paused(!0),(w||!y&&!M&&s._start===mt(a._time)&&Ke(w)&&D(o(s))&&"nested"!==a.data)&&(s._tTime=-ke,s.render(Math.max(0,-x))),C&&L(o(s),C),s}return c(t,[{key:"render",value:function(e,t,r){var n,i,a=this._time,s=this._tDur,o=this._dur,l=s-ke<e&&0<=e?s:e<ke?0:e;if(o){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=o+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*h+e,t,r);if(m=mt(l%h),l===s?(g=this._repeat,m=o):((g=~~(l/h))&&g===l/h&&(m=o,g--),o<m&&(m=o)),(p=this._yoyo&&1&g)&&(d=this._yEase,m=o-m),y=O(this._tTime,h),m===a&&!r&&this._initted)return this;g!==y&&(f&&this._yEase&&re(f,p),!this.vars.repeatRefresh||p||this._lock||(this._lock=r=1,this.render(mt(h*g),!0).invalidate()._lock=0))}if(!this._initted){if(F(this,e<0?e:m,r,t))return this._tTime=0,this;if(o!==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/o),this._from&&(this.ratio=i=1-i),m&&!a&&!t&&(q(this,"onStart"),this._tTime!==l))return this;for(n=this._pt;n;)n.r(i,n.d),n=n._next;f&&f.render(e<0?e:!m&&p?-ke:f._dur*f._ease(m/this._dur),t,r)||this._startAt&&(this._zTime=e),this._onUpdate&&!t&&(e<0&&this._startAt&&this._startAt.render(e,!0,r),q(this,"onUpdate")),this._repeat&&g!==y&&this.vars.onRepeat&&!t&&this.parent&&q(this,"onRepeat"),l!==this._tDur&&l||this._tTime!==l||(e<0&&this._startAt&&!this._onUpdate&&this._startAt.render(e,!0,!0),!e&&o||!(l===this._tDur&&0<this._ts||!l&&this._ts<0)||xt(this,1),t||e<0&&!a||!l&&!a||(q(this,l===s?"onComplete":"onReverseComplete",!0),!this._prom||l<s&&0<this.timeScale()||this._prom()))}}else{var u,c,h=this,d=e,p=t,f=r,m=h.ratio,v=d<0||!d&&(!h._start&&U(h)&&(h._initted||!G(h))||(h._ts<0||h._dp._ts<0)&&!G(h))?0:1,g=h._rDelay,y=0;if(g&&h._repeat&&(c=O(y=V(0,h._tDur,d),g),h._yoyo&&1&c&&(v=1-v),c!==O(h._tTime,g)&&(m=1-v,h.vars.repeatRefresh&&h._initted&&h.invalidate())),v!==m||f||h._zTime===ke||!d&&h._zTime){if(h._initted||!F(h,d,f,p)){for(c=h._zTime,h._zTime=d||(p?ke:0),p=p||d&&!c,h.ratio=v,h._from&&(v=1-v),h._time=0,h._tTime=y,u=h._pt;u;)u.r(v,u.d),u=u._next;h._startAt&&d<0&&h._startAt.render(d,!0,!0),h._onUpdate&&!p&&q(h,"onUpdate"),y&&h._repeat&&!p&&h.parent&&q(h,"onRepeat"),(d>=h._tDur||d<0)&&h.ratio===v&&(v&&xt(h,1),p||(q(h,v?"onComplete":"onReverseComplete",!0),h._prom&&h._prom()))}}else h._zTime||(h._zTime=d)}return this}},{key:"targets",value:function(){return this._targets}},{key:"invalidate",value:function(){return this._pt=this._op=this._startAt=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(),n(l(t.prototype),"invalidate",this).call(this)}},{key:"kill",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"all";if(!(e||t&&"all"!==t))return this._lazy=this._pt=0,this.parent?$(this):this;if(this.timeline)return d=this.timeline.totalDuration(),this.timeline.killTweensOf(e,t,rr&&!0!==rr.vars.overwrite)._first||$(this),this.parent&&d!==this.timeline.totalDuration()&&N(this,this._dur*this.timeline._tDur/d,0,1),this;var r,n,i,a,s,o,l,u=this._targets,c=e?_t(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&&(ze(t)&&(s={},A(t,(function(e){return s[e]=1})),t=s),t=function(e,t){var r,n,i,a,s=(e=e[0]?ft(e[0]).harness:0)&&e.aliases;if(!s)return t;for(n in r=E({},t),s)if(n in r)for(i=(a=s[n].split(",")).length;i--;)r[a[i]]=r[n];return r}(u,t)),l=u.length;l--;)if(~c.indexOf(u[l]))for(s in n=h[l],"all"===t?(r[l]=t,a=n,i={}):(i=r[l]=r[l]||{},a=t),a)(o=n&&n[s])&&("kill"in o.d&&!0!==o.d.kill(s)||bt(this,o,"_pt"),delete n[s]),"all"!==i&&(i[s]=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 H(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 H(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}),A("staggerTo,staggerFrom,staggerFromTo",(function(e){hr[e]=function(){var t=new ar,r=Et.call(arguments,0);return r.splice("staggerFromTo"===e?5:4,0,0),t[e].apply(t,r)}})),function(e,t,r){return e[t]=r}),pr=function(e,t,r){return e[t](r)},fr=function(e,t,r,n){return e[t](n.fp,r)},mr=function(e,t){return He(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,s,o,l,u){h(this,e),this.t=r,this.s=i,this.c=a,this.p=n,this.r=s||vr,this.d=o||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=(A(dt+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",(function(e){return at[e]=1})),rt.TweenMax=rt.TweenLite=hr,rt.TimelineLite=rt.TimelineMax=ar,le=new ar({sortChildren:!1,defaults:Re,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Oe.stringFilter=function(e){var t=e.join(" ");if(Lt.lastIndex=0,Lt.test(t))return t=Ft.test(t),e[1]=te(e[1],t),e[0]=te(e[0],t,kt(e[1])),!0},{registerPlugin:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];t.forEach((function(e){var t=(e=!e.name&&e.default||e).name,r=He(e),n=(r=t&&!r&&e.init?function(){this._props=[]}:e,{init:w,render:Yt,add:or,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)),E(r.prototype,E(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(Sr,r,br)}))},timeline:function(e){return new ar(e)},getTweensOf:function(e,t){return le.getTweensOf(e,t)},getProperty:function(e,t,r,n){ze(e)&&(e=_t(e)[0]);var i=ft(e||{}).get,a=r?C:B;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=_t(e)).length)return n=e.map((function(e){return Sr.quickSetter(e,t,r)})),i=n.length,function(e){for(var t=i;t--;)n[t](e)};e=e[0]||{};var a=lt[t],s=ft(e),o=s.harness&&(s.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)}:s.set(e,o);return a?l:function(t){return l(e,o,r?t+r:t,s,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)),T(Re,e||{})},config:function(e){return T(Oe,e||{})},registerEffect:function(e){var t=e.name,r=e.effect,n=e.plugins,i=e.defaults;e=e.extendTimeline,(n||"").split(",").forEach((function(e){return e&&!lt[e]&&!rt[e]&&b(t+" effect requires "+e+" plugin.")})),ut[t]=function(e,t,n){return r(_t(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){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,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length?arguments[1]:void 0,i=new ar(r);for(i.smoothChildTiming=Ke(r.smoothChildTiming),le.remove(i),i._dp=0,i._time=i._tTime=le._time,e=le._first;e;)t=e._next,!n&&!e._dur&&e instanceof hr&&e.vars.onComplete===e._targets[0]||k(i,e,e._start-e._delay),e=t;return k(le,i,0),i},utils:{wrap:function e(t,r,n){var i=r-t;return We(t)?X(t,e(0,t.length),r):Bt(n,(function(e){return(i+(e-t)%i)%i+t}))},wrapYoyo:function e(t,r,n){var i=r-t,a=2*i;return We(t)?X(t,e(0,t.length-1),r):Bt(n,(function(e){return t+(i<(e=(a+(e-t)%a)%a||0)?a-e:e)}))},distribute:J,random:W,snap:Z,normalize:function(e,t,r){return Q(e,t,0,1,r)},getUnit:Ct,clamp:function(e,t,r){return Bt(r,(function(r){return V(e,t,r)}))},splitColor:It,toArray:_t,selector:function(e){return e=_t(e)[0]||b("Invalid scope")||{},function(t){var r=e.current||e.nativeElement||e;return _t(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||Ct(r))}},interpolate:function e(t,r,n,i){var a=isNaN(t+r)?0:function(e){return(1-e)*t+e*r};if(!a){var s,o,l,u,c,h=ze(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,o=1;o<u;o++)l.push(e(t[o-1],t[o]));u--,a=function(e){e*=u;var t=Math.min(c,~~e);return l[t](e-t)},n=r}else i||(t=E(We(t)?[]:{},t));if(!l){for(s in r)or.call(d,t,s,"get",r[s]);a=function(e){return Yt(e,d),h?t.p:t}}}return Bt(n,a)},shuffle:Dt},install:y,effects:ut,ticker:Ut,updateRoot:ar.updateRoot,plugins:lt,globalTimeline:le,core:{PropTween:br,globals:x,Tween:hr,Timeline:ar,Animation:ir,getCache:ft,_removeLinkedListItem:bt,suppressOverwrites:function(e){return oe=e}}}),wr=(A("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}),Sr=xr.registerPlugin({name:"attr",init:function(e,t,r,n,i){var a,s;for(a in t)(s=this.add(e,"setAttribute",(e.getAttribute(a)||0)+"",t[a],n,i,0,0,a))&&(s.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=Sr.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},230:(e,t,r)=>{r.d(t,{N:()=>o,Z:()=>s});var n=r(881),i=r(794),a=r(723);class s{constructor(e){this.mode="PerspectiveCamera",this.oCam=this.createOrthographic(),this.pCam=this.create(),this.clean=()=>{this.temp.clear()},this.backgroudDom=null,this.temp=new i.Z,this.pointerDown=()=>{var e;null!=(e=this.animaIns)&&e.kill()},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")})),this.runScene.cb.events.pointer.down.add("camera",this.pointerDown),this.runScene.cb.clean.add("camera",this.clean)}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;e.near=.1,e.far=1e3,e.fov=50,t.target.set(0,0,0),t.update(),e.updateProjectionMatrix()}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()}addTemp(e){var{name:e,data:t}=e;this.temp.set(e,{name:e,data:t})}delTemp(e){this.temp.delete(e)}getLocal(){var{camera:e,controls:t}=this.runScene.assetsEx,{x:e,y:r,z:n}=e.position,{x:t,y:i,z:a}=t.target;return{x:e,y:r,z:n,tx:t,ty:i,tz:a}}setTemp(e,t){return(e=this.temp.get(e))?this.anima(e.data,t):Promise.resolve()}anima(e,t){return new Promise((r=>{const{time:n,onComplete:i,onUpdate:s}=t||{},{camera:o,controls:l}=this.runScene.assetsEx;this.animaIns&&(this.animaIns.kill(),this.animaIns=null),this.animaIns=(0,a.gY)(this.getLocal(),e,n||.5,(e=>{var{x:t,y:r,z:n,tx:i,ty:a,tz:u}=e;o.position.set(t,r,n),l.target.set(i,a,u),l.update(),null!=s&&s(e)}),(()=>{null!=i&&i(),r(0)}))}))}static toJSON(e){const t=e.assetsEx.camera;return{temp:e.cameraEx.temp.toJSON(),camera:t.toJSON()}}}const o=e=>null==e?void 0:e.isCamera},330:(e,t,r)=>{r.d(t,{sG:()=>n,zX:()=>i});const n=["map","normalMap","aoMap"],i=["map","metalnessMap","roughnessMap","normalMap","aoMap","emissiveMap","alphaMap","lightMap","envMap","displacementMap"]},263:(e,t,r)=>{r.d(t,{F6:()=>n,YD:()=>u});var n={};r.r(n),r.d(n,{filter:()=>i,isDef:()=>l,isEmpty:()=>a,notEmpty:()=>s,random:()=>o});const i=e=>e.filter((e=>e)),a=e=>0===e.length,s=e=>0!==e.length,o=e=>{var t=Math.random()*e.length;return e[Math.floor(t)]},l=(e,t)=>{for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!0;return!1};r(794),r(272);var u=r(201)},794:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(1);class i extends Map{constructor(e){e?super((0,n.mapObj)(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[r]=t})),e}toString(){return JSON.stringify(this.map)}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)}copy(e){e.map(((e,t)=>this.set(e,t)))}}},201:(e,t,r)=>{r.r(t),r.d(t,{is:()=>a,isDef:()=>i,logObj:()=>c,objToStr:()=>u,replaceKVForObj:()=>o,replaceKeyForObj:()=>l,replaceValForObj:()=>s});var n=r(1);const i=(e,t)=>{if(!a(e))return!0;var r=Object.keys(e);for(let o=0;o<r.length;o++){var n=r[o],s=e[n];if(n=t[n],a(s))return!a(n)||i(s,n);if(s!==n)return!0}return!1},a=e=>(null==e?void 0:e.constructor)===Object,s=(e,t)=>{let r={};return Object.keys(e).map(((n,i)=>{var a=e[n];r[n]=t(n,a,i)})),r},o=(e,t)=>{let r={};return Object.keys(e).map(((n,i)=>{var a=e[n],{k:n,v:a}=t(n,a,i);r[n]=a})),r},l=(e,t)=>{let r={};return Object.keys(e).map(((n,i)=>{var a=e[n];r[t(n,a,i)]=a})),r},u=e=>{let t="";return(0,n.mapObj)(e,((e,r)=>{t=(t+=e+":")+(a(r)?u(r):r)})),t},c=e=>{console.log(u(e))}},272:(e,t,r)=>{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}}},247:(e,t,r)=>{r.d(t,{Z:()=>n});const n=t=r(881)},598:(e,t,r)=>{r.d(t,{Z:()=>n});class n{constructor(e){this.runScene=e}}},585:(e,t,r)=>{r.d(t,{Z:()=>c});var n=r(247),i=r(736),a=r(398),s=r(729),o=r(457);t=r(598);const l={far:1e5,near:.5,mapSizeX:512,scaleX:1,targetPosition:{x:0,y:-10,z:0}},u={position:{type:"v3",val:{x:0,y:10,z:0},shortKey:"p"},intensity:{type:"number",val:1,shortKey:"i"},visible:{type:"other",val:!0,shortKey:"v"},color:{type:"color",val:{r:1,g:1,b:1},shortKey:"c"}};class c extends t.Z{static toJSON(e){const{intensity:t,name:r,type:n,position:i,visible:a,color:o,castShadow:l,shadow:u,rotation:c,target:h}=e;var{mapSize:d,camera:p}=u,{scale:p,near:f,far:m}=p;return{type:n,intensity:t,name:r,visible:a,color:o.getHexString(),castShadow:l,shadow:{mapSize:d.x,camera:{near:f,far:m,scale:p.x}},id:(0,s.Ki)(e),position:{x:i.x,y:i.y,z:i.z},rotation:{x:c.x,y:c.y,z:c.z},targetPosition:{x:h.position.x,y:h.position.y,z:h.position.z}}}parseJSON(e,t){t=this.runScene.lightEx.get("DirectionalLight",t);var[r]=t;return c.setConfig(r,e),(0,i.M)(r,"id",e.id),t}get(e){return this.runScene.lightEx.get("DirectionalLight",e)}static setConfig(e,t){const{intensity:r,position:i,rotation:a,targetPosition:s,name:o,visible:l,color:u,castShadow:c,shadow:h}=t;var{mapSize:t,camera:d}=h,{scale:d,near:p,far:f}=d;e.intensity=r,e.name=o,e.visible=l,e.castShadow=c,e.color=new n.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),s&&e.target.position.set(s.x,s.y,s.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=p,e.shadow.camera.far=f,e.shadow.camera.updateProjectionMatrix(),null!=(t=e.cameraHelper)&&t.update()}}c.snapshot={create:e=>{const t=a.LV.getDiff(u,e);var r=e.shadow,{mapSize:r,camera:n}=r,{scale:n,near:i,far:s}=n,{x:e,y:c,z:h}=e.target.position;return(0,o.isDef)(r.x,l.mapSizeX)&&(t.m=r.x),(0,o.isDef)({x:e,y:c,z:h},l.targetPosition)&&(t.tp={x:e,y:c,z:h}),(0,o.isDef)(n.x,l.scaleX)&&(t.s=n.x),(0,o.isDef)(i,l.near)&&(t.n=i),(0,o.isDef)(s,l.far)&&(t.f=s),t},set:e=>{const{map:t,light:r,runScene:n,data:i}=e,{m:s,tp:o,s:c,n:h,f:d}=(a.LV.set({def:u,data:i,runScene:n,map:t,target:r}),i);t.data.completedCbs.push((()=>{var{far:e,near:t,mapSizeX:n,scaleX:i,targetPosition:a}=l,{x:a,y:u,z:p}=o||a,a=(r.target.position.set(a,u,p),s||n),u=(r.shadow.mapSize.x=a,r.shadow.mapSize.y=a,c||i);r.shadow.camera.scale.x=u,r.shadow.camera.scale.y=u,r.shadow.camera.scale.z=u,r.shadow.camera.near=h||t,r.shadow.camera.far=d||e,r.shadow.camera.updateProjectionMatrix(),null!=(p=r.cameraHelper)&&p.update()}))}}},269:(e,t,r)=>{r.d(t,{ZP:()=>E,RQ:()=>T});var n=r(1),i=r(881);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 s(e,t){return(s=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"===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&&s(t,e);var r=o(n);function n(e,t){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");var a=new i.BufferGeometry,s=(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,s)).light=e,a.color=t,a.type="RectAreaLightHelper",s=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)),s.computeBoundingSphere(),a.add(new i.Mesh(s,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(247),h=r(736),d=r(398),p=r(729);t=r(598);const f={intensity:{type:"number",val:1,shortKey:"i"},visible:{type:"other",val:!0,shortKey:"v"},color:{type:"color",val:{r:1,g:1,b:1},shortKey:"c"}};class m 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,id:(0,p.Ki)(e),color:a.getHexString()}}parseJSON(e){var t=this.runScene.lightEx.get("AmbientLight");const[r]=t;var{type:e,intensity:n,name:i,visible:a,color:s,id:o}=e;return r.intensity=n,r.type=e,r.name=i,r.visible=a,r.color=new c.Z.Color("#"+s),(0,h.M)(r,"id",o),t}}m.snapshot={create:e=>d.LV.getDiff(f,e),set:e=>{var{map:e,light:t,runScene:r,data:n}=e;d.LV.set({def:f,data:n,runScene:r,map:e,target:t})}};var v=r(585);class g 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:s,position:o}=e;return{name:n,id:(0,p.Ki)(e),type:t,intensity:r,visible:i,position:{x:o.x,y:o.y,z:o.z},groundColor:s.getHexString(),color:a.getHexString()}}parseJSON(e){var t=this.runScene.lightEx.get("HemisphereLight");const[r]=t;var{type:e,intensity:n,name:i,visible:a,color:s,groundColor:o,id:l,position:u}=e;return r.type=e,r.intensity=n,r.name=i,r.visible=a,r.color=new c.Z.Color("#"+s),r.groundColor=new c.Z.Color("#"+o),r.position.set(u.x,u.y,u.z),(0,h.M)(r,"id",l),t}}class y 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:s,color:o,visible:l,castShadow:u,shadow:c,position:h}=e;var{mapSize:d,camera:f,bias:m,radius:v}=c,{scale:f,near:g,far:y}=f;return{name:t,type:r,intensity:n,visible:l,color:o.getHexString(),castShadow:u,id:(0,p.Ki)(e),distance:i,decay:a,renderOrder:s,shadow:{mapSize:d.x,camera:{near:g,far:y,scale:f.x},radius:v,bias:m},position:{x:h.x,y:h.y,z:h.z}}}parseJSON(e){var t=this.runScene.lightEx.get("PointLight");const[r]=t;var{name:e,type:n,intensity:i,distance:a,decay:s,renderOrder:o,color:l,visible:u,castShadow:d,shadow:p,position:f,id:m}=e,{mapSize:p,camera:v,bias:g,radius:y}=p,{scale:v,near:b,far:x}=v;return r.intensity=i,r.type=n,r.name=e,r.visible=u,r.castShadow=d,r.distance=a,r.renderOrder=o,r.color=new c.Z.Color("#"+l),r.position.set(f.x,f.y,f.z),r.shadow.mapSize.x=p,r.shadow.mapSize.y=p,r.shadow.bias=g,r.decay=s,r.shadow.radius=y,r.shadow.camera.scale.x=v,r.shadow.camera.scale.y=v,r.shadow.camera.scale.z=v,r.shadow.camera.near=b,(0,h.M)(r,"id",m),r.shadow.camera.far=x,r.shadow.camera.updateProjectionMatrix(),t}}class b{constructor(e){this.runScene=e}static toJSON(e){const{type:t,intensity:r,name:n,visible:i,color:a,position:s}=e;return{name:n,type:t,intensity:r,id:(0,p.Ki)(e),visible:i,position:{x:s.x,y:s.y,z:s.z},color:a.getHexString()}}parseJSON(e){var t=this.runScene.lightEx.get("RectAreaLight");const[r]=t;var{type:e,intensity:n,name:i,visible:a,color:s,position:o,id:l}=e;return r.type=e,(0,h.M)(r,"id",l),r.intensity=n,r.name=i,r.visible=a,r.color=new c.Z.Color("#"+s),r.position.set(o.x,o.y,o.z),t}}class x{constructor(e){this.runScene=e}static toJSON(e){const{name:t,type:r,color:n,distance:i,decay:a,intensity:s,angle:o,penumbra:l,visible:u,castShadow:c,shadow:h,renderOrder:d,position:f,target:m}=e;var{bias:v,camera:g,normalBias:y,mapSize:b,radius:x}=h,g=g.near;return{type:r,intensity:s,name:t,visible:u,distance:i,angle:o,id:(0,p.Ki)(e),decay:a,penumbra:l,renderOrder:d,color:n.getHexString(),castShadow:c,shadow:{bias:v,normalBias:y,mapSize:b.x,camera:{near:g},radius:x},position:{x:f.x,y:f.y,z:f.z},targetPosition:{x:m.position.x,y:m.position.y,z:m.position.z}}}parseJSON(e){var t=this.runScene.lightEx.get("SpotLight");const[r]=t;var{name:e,type:n,color:i,distance:a,decay:s,intensity:o,angle:l,penumbra:u,visible:d,castShadow:p,shadow:f,renderOrder:m,id:v,position:g,targetPosition:y}=e,{bias:f,camera:b,normalBias:x,mapSize:w,radius:S}=f,b=b.near;return r.intensity=o,r.type=n,r.name=e,r.visible=d,r.distance=a,r.decay=s,r.angle=l,r.penumbra=u,r.renderOrder=m,r.castShadow=p,r.color=new c.Z.Color("#"+i),r.position.set(g.x,g.y,g.z),r.shadow.mapSize.x=w,r.shadow.mapSize.y=w,r.shadow.camera.near=b,r.target.position.set(y.x,y.y,y.z),r.shadow.bias=f,r.shadow.normalBias=x,r.shadow.radius=S,(0,h.M)(r,"id",v),r.shadow.camera.updateProjectionMatrix(),t}}var w=r(749),S=r(735),A=r(510),M=r(169),B=r(457);const C={DirectionalLight:v.Z,PointLight:y,SpotLight:x,RectAreaLight:b,HemisphereLight:g,AmbientLight:m};class E{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.snapshot={create:e=>{const t=this.runScene.assetsEx.scene.children.filter((e=>this.isLight(e)&&!(0,w.isHelper)(e))),r={};t.map((e=>{var t=e.type,n=(0,p.Ki)(e),i=null==(i=null==(t=C[t].snapshot)?void 0:t.create)?void 0:i.call(t,e);i&&n&&(r[n]=i)})),e.data.set("light",r)},set:e=>{var t=e.snapshot.data.get("light");t&&(0,n.mapObj)(t,((t,r)=>{var n,i=((t=this.runScene.modelEx.getById(t))||{}).type;i&&null!=(n=null==(i=C[i].snapshot)?void 0:i.set)&&n.call(i,{data:r,runScene:this.runScene,light:t,map:e})}))}},this.runScene=e,this.lightExMap={DirectionalLight:new v.Z(e),PointLight:new y(e),SpotLight:new x(e),RectAreaLight:new b(e),HemisphereLight:new g(e),AmbientLight:new m(e)},e.cb.snapshot.create.add("light",this.snapshot.create),e.cb.snapshot.set.add("light",this.snapshot.set)}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:!!T(e)&&t.select,addUndo:!1})))),t.addUndo&&this.runScene.undoEx.addUndo(e)}get(e,t){t=(0,B.mergeObject)({id:(0,n.getId)()},t).id;let r=new c.Z[e],i=[r];return r.position.y=10,r.name=e,r.userData.id=t,this.shadowList.includes(e)&&(r.castShadow=!0),this.setLight(r),i.push(...this.setLightHelper(r)),null!=(t=null==r?void 0:r.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 r;return this.runScene.helperEx.unfocus(),r="DirectionalLight"===e.type||"SpotLight"===e.type?[e,e.cameraHelper,e.helper].map((t=>{if(t)return new M.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 M.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=(0,p.Ki)(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,e.visible=!1,t.cameraHelper=e,i.push(e);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 s=new c.Z.CameraHelper(t.shadow.camera);t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(s,!0,(e=>{e.userData.id=r})),s.userData.id=r,s.visible=!1,t.cameraHelper=s,i.push(s);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,this.update(t),i.push(n),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:r,val:n,cb:i}=e;return new A.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 S.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 s=new S.Z({target:i,typeList:e,newVal:a,cb:t});return n&&this.runScene.undoEx.addUndo(s),r?s.execute():s}}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,w.isHelper)(e))).map((e=>{var t=e.type;return C[t].toJSON(e)}))}}const T=e=>null==(e=null==e?void 0:e.userData)?void 0:e.isLight},143:(e,t,r)=>{r.d(t,{B:()=>Pe,Z:()=>De});var n=r(881),i=(t=r(300),r.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)}r(1);var s=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 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,s){var o=r.exports.sbrk,l=n+3&-4,u=o(l*i),c=o(a.length),h=new Uint8Array(r.exports.memory.buffer);if(0==(h.set(a,c),e=e(u,n,i,c,a.length))&&s&&s(u,l,i),t.set(h.subarray(u,u+n*i)),o(u-o(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 s={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,a,o){i(r.exports.meshopt_decodeVertexBuffer,e,t,n,a,r.exports[s[o]])},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,a,l,u){i(r.exports[o[l]],e,t,n,a,r.exports[s[u]])}}}();function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){return(l=Object.setPrototypeOf||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 r,n=c(e);if(r=t?(r=c(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===o(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf: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 r=u(i);function i(e){if(this instanceof i)return(e=r.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,r,i){var a=this,s=new n.FileLoader(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(e){var r={attributeIDs:a.defaultAttributeIDs,attributeTypes:a.defaultAttributeTypes,useUniqueIDs:!1};a.decodeGeometry(e,r).then(t).catch(i)}),r,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,s=JSON.stringify(t);if(h.has(e)){if((l=h.get(e)).key===s)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 o=this.workerNextTaskID++,l=e.byteLength;return l=this._getWorker(o,l).then((function(r){return a=r,new Promise((function(r,n){a._callbacks[o]={resolve:r,reject:n},a.postMessage({type:"decode",id:o,taskConfig:t,buffer:e},[e])}))})).then((function(e){return n._createGeometry(e.geometry)})),l.catch((function(){return!0})).then((function(){a&&o&&n._releaseTask(a,o)})),h.set(e,{key:s,promise:l}),l}},{key:"_createGeometry",value:function(e){var t=new n.BufferGeometry;e.index&&t.setIndex(new n.BufferAttribute(e.index.array,1));for(var r=0;r<e.attributes.length;r++){var i=(s=e.attributes[r]).name,a=s.array,s=s.itemSize;t.setAttribute(i,new n.BufferAttribute(a,s))}return t}},{key:"_loadLibrary",value:function(e,t){var r=new n.FileLoader(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise((function(t,n){r.load(e,t,void 0,n)}))}},{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":o(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 s=function(e,t,r,n){var i,a=n.attributeIDs,s=n.attributeTypes,o=t.GetEncodedGeometryType(r);if(o===e.TRIANGULAR_MESH)i=new e.Mesh,g=t.DecodeBufferToMesh(r,i);else{if(o!==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 S=self[s[l]],A=void 0,M=void 0;if(n.useUniqueIDs)M=a[l],A=t.GetAttributeByUniqueId(i,M);else{if(-1===(M=t.GetAttributeId(i,e[a[l]])))continue;A=t.GetAttribute(i,M)}w.attributes.push((M=e,u=t,c=i,h=l,d=A.num_components(),f=(p=c.num_points()*d)*S.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,S),v=M._malloc(f),u.GetAttributeDataArrayForAllPoints(c,A,m,f,v),u=new S(M.HEAPF32.buffer,v,p).slice(),M._free(v),{name:h,array:u,itemSize:d}))}return o===e.TRIANGULAR_MESH&&(w.index=(r=e,g=t,b=4*(y=3*(o=i).num_faces()),x=r._malloc(b),g.GetTrianglesUInt32Array(o,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),o=s.attributes.map((function(e){return e.array.buffer}));s.index&&o.push(s.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:s},o)}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}(n.Loader),p={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 f=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,s=0,o=0,l=void 0,u=[];this.onStart=void 0,this.onLoad=t,this.onProgress=r,this.onError=n,this.itemStart=function(e){o++,!1===a&&void 0!==i.onStart&&i.onStart(e,s,o),a=!0},this.itemEnd=function(e){s++,void 0!==i.onProgress&&i.onProgress(e,s,o),s===o&&(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 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:f,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 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 r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var x=function(){var e=n,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 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=b(e);if(r=t?(r=b(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")}}(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,s=p.get(e);if(void 0!==s)return a.manager.itemStart(e),setTimeout((function(){t&&t(s),a.manager.itemEnd(e)}),0),s;var o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader,fetch(e,o).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,s=i.notCompress,o=i.size,l=0===e.size?new ImageData(1,1):e;t(o&&1!==r?(o=(t=i.size).w,t=t.h,s=s?1:r,createImageBitmap(l,Object.assign(a.options,{imageOrientation:n?"none":"flipY",resizeHeight:t*s,resizeWidth:o*s}))):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=[],s=!0,o=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(a.push(n.value),2!==a.length);s=!0);}catch(e){o=!0,i=e}finally{try{s||null==r.return||r.return()}finally{if(o)throw i}}return a}}(e)||function(e,t){if(e){if("string"==typeof e)return g(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)?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.")}()}(r);var n=r[0];r=r[1],p.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}(),w=(x.prototype.isImageBitmapLoader=!0,r(457));function S(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=[],s=!0,o=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);s=!0);}catch(e){o=!0,i=e}finally{try{s||null==r.return||r.return()}finally{if(o)throw i}}return a}}(e,t)||B(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 A(e,t){var r,n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=B(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,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function M(e){return function(e){if(Array.isArray(e))return C(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||B(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 B(e,t){if(e){if("string"==typeof e)return C(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)?C(e,t):void 0}}function C(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 E(e){return(E="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function T(){return(T="undefined"!=typeof Reflect&&Reflect.get?Reflect.get: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 _(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function D(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 P(e,t,r){return t&&D(e.prototype,t),r&&D(e,r),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||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 r,n=L(e);if(r=t?(r=L(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===E(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return k(n)}}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:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var F=function(){O(t,n.Loader);var e=I(t);function t(r){return _(this,t),(r=e.call(this,r)).dracoLoader=null,r.ktx2Loader=null,r.meshoptDecoder=null,r.pluginCallbacks=[],r.register((function(e){return new z(e)})),r.register((function(e){return new W(e)})),r.register((function(e){return new X(e)})),r.register((function(e){return new H(e)})),r.register((function(e){return new V(e)})),r.register((function(e){return new J(e)})),r.register((function(e){return new K(e)})),r.register((function(e){return new Z(e)})),r.register((function(e){return new N(e)})),r.register((function(e){return new Q(e)})),r}return P(t,[{key:"load",value:function(e,t,r,i){function a(t){i?i(t):console.error(t),s.manager.itemError(e),s.manager.itemEnd(e)}var s=this,o=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:n.LoaderUtils.extractUrlBase(e),l=(this.manager.itemStart(e),new n.FileLoader(this.manager));l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,(function(r){try{s.parse(r,o,(function(r){t(r),s.manager.itemEnd(e)}),a)}catch(r){a(r)}}),r,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,r,i,a){var s,o={},l={};if("string"==typeof e)s=e;else if(n.LoaderUtils.decodeText(new Uint8Array(e,0,4))===Y){try{o[G.KHR_BINARY_GLTF]=new q(e)}catch(e){return void(i&&i(e))}s=o[G.KHR_BINARY_GLTF].content}else s=n.LoaderUtils.decodeText(new Uint8Array(e));var u=JSON.parse(s);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);o[(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 G.KHR_MATERIALS_UNLIT:o[f]=new j;break;case G.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:o[f]=new re;break;case G.KHR_DRACO_MESH_COMPRESSION:o[f]=new $(u,this.dracoLoader);break;case G.KHR_TEXTURE_TRANSFORM:o[f]=new ee;break;case G.KHR_MESH_QUANTIZATION:o[f]=new ne;break;default:0<=m.indexOf(f)&&void 0===l[f]&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}c.setExtensions(o),c.setPlugins(l),c.parse(r,i)}}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,i){r.parse(e,t,n,i)}))}}]),t}();function U(){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 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){_(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||[],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,r="light:"+e,i=t.cache.get(r);if(i)return i;var a,s=t.json,o=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e],l=new n.Color(16777215),u=(void 0!==o.color&&l.fromArray(o.color),void 0!==o.range?o.range:0);switch(o.type){case"directional":(a=new n.DirectionalLight(l)).target.position.set(0,0,-1),a.add(a.target);break;case"point":(a=new n.PointLight(l)).distance=u;break;case"spot":(a=new n.SpotLight(l)).distance=u,o.spot=o.spot||{},o.spot.innerConeAngle=void 0!==o.spot.innerConeAngle?o.spot.innerConeAngle:0,o.spot.outerConeAngle=void 0!==o.spot.outerConeAngle?o.spot.outerConeAngle:Math.PI/4,a.angle=o.spot.outerConeAngle,a.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,a.target.position.set(0,0,-1),a.add(a.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return a.position.set(0,0,0),a.decay=2,void 0!==o.intensity&&(a.intensity=o.intensity),a.name=t.createUniqueName(o.name||"light_"+e),i=Promise.resolve(a),t.cache.add(r,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}(),j=function(){function e(){_(this,e),this.name=G.KHR_MATERIALS_UNLIT}return P(e,[{key:"getMaterialType",value:function(){return n.MeshBasicMaterial}},{key:"extendParams",value:function(e,t,r){var i,a=[];return e.color=new n.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(r.assignTexture(e,"map",t.baseColorTexture))),Promise.all(a)}}]),e}(),z=function(){function e(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]?n.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 i=[];return void 0!==(e=e.extensions[this.name]).clearcoatFactor&&(t.clearcoat=e.clearcoatFactor),void 0!==e.clearcoatTexture&&i.push(r.assignTexture(t,"clearcoatMap",e.clearcoatTexture)),void 0!==e.clearcoatRoughnessFactor&&(t.clearcoatRoughness=e.clearcoatRoughnessFactor),void 0!==e.clearcoatRoughnessTexture&&i.push(r.assignTexture(t,"clearcoatRoughnessMap",e.clearcoatRoughnessTexture)),void 0!==e.clearcoatNormalTexture&&(i.push(r.assignTexture(t,"clearcoatNormalMap",e.clearcoatNormalTexture)),void 0!==e.clearcoatNormalTexture.scale&&(r=e.clearcoatNormalTexture.scale,t.clearcoatNormalScale=new n.Vector2(r,r))),Promise.all(i)}}]),e}(),H=function(){function e(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]?n.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 i=[];return void 0!==(t.sheenColor=new n.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(r.assignTexture(t,"sheenColorMap",e.sheenColorTexture)),void 0!==e.sheenRoughnessTexture&&i.push(r.assignTexture(t,"sheenRoughnessMap",e.sheenRoughnessTexture)),Promise.all(i)}}]),e}(),V=function(){function e(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]?n.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}(),J=function(){function e(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]?n.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 r=[],i=(e=e.extensions[this.name],t.thickness=void 0!==e.thicknessFactor?e.thicknessFactor:0,void 0!==e.thicknessTexture&&r.push(i.assignTexture(t,"thicknessMap",e.thicknessTexture)),t.attenuationDistance=e.attenuationDistance||0,e.attenuationColor||[1,1,1]);return t.attenuationColor=new n.Color(i[0],i[1],i[2]),Promise.all(r)}}]),e}(),K=function(){function e(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]?n.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}(),Z=function(){function e(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]?n.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 i=[],a=(e=e.extensions[this.name],t.specularIntensity=void 0!==e.specularFactor?e.specularFactor:1,void 0!==e.specularTexture&&i.push(r.assignTexture(t,"specularIntensityMap",e.specularTexture)),e.specularColorFactor||[1,1,1]);return t.specularColor=new n.Color(a[0],a[1],a[2]),void 0!==e.specularColorTexture&&i.push(r.assignTexture(t,"specularColorMap",e.specularColorTexture).then((function(e){e.encoding=n.sRGBEncoding}))),Promise.all(i)}}]),e}(),W=function(){function e(t){_(this,e),this.parser=t,this.name=G.KHR_TEXTURE_BASISU}return P(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}(),X=function(){function e(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,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],s=r.textureLoader;return a.uri&&null!==(i=r.options.manager.getHandler(a.uri))&&(s=i),this.detectSupport().then((function(i){if(i)return r.loadTextureImage(e,a,s);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}(),Q=function(){function e(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 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,s=r.byteStride,o=new ArrayBuffer(a*s);return e=new Uint8Array(e[0],t,i),n.decodeGltfBuffer(new Uint8Array(o),a,s,e,r.mode,r.filter),o}));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}(),Y="glTF",q=P((function e(t){_(this,e),this.name=G.KHR_BINARY_GLTF,this.content=null,this.body=null;var r=new DataView(t,0,12);if(this.header={magic:n.LoaderUtils.decodeText(new Uint8Array(t.slice(0,4))),version:r.getUint32(4,!0),length:r.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),s=0;s<i;){var o,l=a.getUint32(s,!0),u=(s+=4,a.getUint32(s,!0));s+=4,1313821514===u?(o=new Uint8Array(t,12+s,l),this.content=n.LoaderUtils.decodeText(o)):5130562===u&&(this.body=t.slice(o=12+s,o+l)),s+=l}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")})),$=function(){function e(t,r){if(_(this,e),!r)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=G.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=r,this.dracoLoader.preload()}return P(e,[{key:"decodePrimitive",value:function(e,t){var r,n,i=this.json,a=this.dracoLoader,s=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,l={},u={},c={};for(r in o){var h=he[r]||r.toLowerCase();l[h]=o[r]}for(n in e.attributes){var d,p,f=he[n]||n.toLowerCase();void 0!==o[n]&&(d=i.accessors[e.attributes[n]],p=oe[d.componentType],c[f]=p,u[f]=!0===d.normalized)}return t.getDependency("bufferView",s).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}(),ee=function(){function e(){_(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,n.MeshStandardMaterial);var e=I(t);function t(r){_(this,t),(i=e.call(this)).isGLTFSpecularGlossinessMaterial=!0;var i,a=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),s=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),o=["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 n.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>",s).replace("#include <roughnessmap_fragment>",o).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(r),i}return P(t,[{key:"copy",value:function(e){return T(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}(),re=function(){function e(){_(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,r){t=t.extensions[this.name];var i,a=(e.color=new n.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(r.assignTexture(e,"map",t.diffuseTexture)),e.emissive=new n.Color(0,0,0),e.glossiness=void 0!==t.glossinessFactor?t.glossinessFactor:1,e.specular=new n.Color(1,1,1),Array.isArray(t.specularFactor)&&e.specular.fromArray(t.specularFactor),void 0!==t.specularGlossinessTexture&&(i=t.specularGlossinessTexture,a.push(r.assignTexture(e,"glossinessMap",i)),a.push(r.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=n.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}(),ne=P((function e(){_(this,e),this.name=G.KHR_MESH_QUANTIZATION})),ie=function(){O(t,n.Interpolant);var e=I(t);function t(r,n,i,a){return _(this,t),e.call(this,r,n,i,a)}return P(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}(),ae=(ie.prototype.beforeStart_=ie.prototype.copySampleValue_,ie.prototype.afterEnd_=ie.prototype.copySampleValue_,ie.prototype.interpolate_=function(e,t,r,n){for(var i=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=2*s,l=3*s,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!==s;v++){var g=a[h+v+s],y=a[h+v+o]*u,b=a[c+v+s],x=a[c+v]*u;i[v]=f*g+m*y+d*b+p*x}return i},new n.Quaternion),se=function(){O(t,ie);var e=I(t);function t(){return _(this,t),e.apply(this,arguments)}return P(t,[{key:"interpolate_",value:function(e,r,n,i){return e=T(L(t.prototype),"interpolate_",this).call(this,e,r,n,i),ae.fromArray(e).normalize().toArray(e),e}}]),t}(),oe={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},le={9728:n.NearestFilter,9729:n.LinearFilter,9984:n.NearestMipmapNearestFilter,9985:n.LinearMipmapNearestFilter,9986:n.NearestMipmapLinearFilter,9987:n.LinearMipmapLinearFilter},ue={33071:n.ClampToEdgeWrapping,33648:n.MirroredRepeatWrapping,10497:n.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"},pe={CUBICSPLINE:void 0,LINEAR:n.InterpolateLinear,STEP:n.InterpolateDiscrete};function fe(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 me(e,t){void 0!==t.extras&&("object"===E(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function ve(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 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]:{},r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};_(this,e),this.json=t,this.extensions={},this.plugins={},this.options=r,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 n.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 n.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 r=this,n=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([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:{}};fe(i,a,n),me(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,s=0,o=a.length;s<o;s++)e[a[s]].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),s=(null!=a&&n.associations.set(r,a),A(t.children.entries()));try{for(s.s();!(i=s.n()).done;){var o=S(i.value,2),l=o[0];e(o[1],r.children[l])}}catch(e){s.e(e)}finally{s.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],r=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){r.load(n.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,r=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,s=e[0],o=ce[i.type],l=oe[i.componentType],u=l.BYTES_PER_ELEMENT,c=i.byteOffset||0,h=void 0!==i.bufferView?r.bufferViews[i.bufferView].byteStride:void 0,d=!0===i.normalized,p=h&&h!==u*o?(f=Math.floor(c/h),m="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+f+":"+i.count,(v=t.cache.get(m))||(a=new l(s,f*h,i.count*h/u),v=new n.InterleavedBuffer(a,h/u),t.cache.add(m,v)),new n.InterleavedBufferAttribute(v,o,c%h/u,d)):(a=null===s?new l(i.count*o):new l(s,c,i.count*o),new n.BufferAttribute(a,o,d));if(void 0!==i.sparse){var f=oe[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*ce.SCALAR),y=new l(e[2],v,i.sparse.count*o);null!==s&&(p=new n.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*o]),2<=o&&p.setY(w,y[b*o+1]),3<=o&&p.setZ(w,y[b*o+2]),4<=o&&p.setW(w,y[b*o+3]),5<=o)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,r){var i=this,a=this.json,s=a.textures[e],o=((o=a.images[t]).uri||o.bufferView)+":"+s.sampler;return this.textureCache[o]?this.textureCache[o]:(t=this.loadImageSource(t,r,e).then((function(t){t.flipY=!1,s.name&&(t.name=s.name);var r=(a.samplers||{})[s.sampler]||{};return t.magFilter=le[r.magFilter]||n.LinearFilter,t.minFilter=le[r.minFilter]||n.LinearMipmapLinearFilter,t.wrapS=ue[r.wrapS]||n.RepeatWrapping,t.wrapT=ue[r.wrapT]||n.RepeatWrapping,i.associations.set(t,{textures:e}),i.options.myOptions.core.loadTexture({texture:t,textureDef:s}),t})).catch((function(e){return null})),this.textureCache[o]=t)}},{key:"loadImageSource",value:function(e,t,r){var i=this.json,a=this.options,s=i.textures[r];if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((function(e){return e.clone()})).catch((function(e){throw e}));var o=i.images[e],l=self.URL||self.webkitURL,u=o.uri||"";if(void 0!==o.bufferView)u=this.getDependency("bufferView",o.bufferView).then((function(e){return e=new Blob([e],{type:o.mimeType}),u=l.createObjectURL(e)}));else if(void 0===o.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");return r=Promise.resolve(u).then((function(e){return new Promise((function(r,i){var o,l;!0===t.isImageBitmapLoader?(o=function(e,t){(e=new n.Texture(e)).needsUpdate=!0,r({texture:e,blob:t})},t.load(n.LoaderUtils.resolveURL(e,a.path),o,void 0,i,s)):(l=a.myOptions.loadConfig.reverseTexture,(0,w.urlToCanvas)(e).then((function(e){var t=e.ctx,i=e.canvas,a=(e=e.img,new n.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)),r(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]=r}},{key:"assignTexture",value:function(e,t,r){var n=this;return this.getDependency("texture",r.index).then((function(i){var a,s;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[G.KHR_TEXTURE_TRANSFORM]&&(a=void 0!==r.extensions?r.extensions[G.KHR_TEXTURE_TRANSFORM]:void 0)&&(s=n.associations.get(i),i=n.extensions[G.KHR_TEXTURE_TRANSFORM].extendTexture(i,a),n.associations.set(i,s)),e[t]=i}))}},{key:"assignFinalMaterial",value:function(e){var t,r,i=e.geometry,a=e.material,s=void 0===i.attributes.tangent,o=void 0!==i.attributes.color,l=void 0===i.attributes.normal;e.isPoints?(t="PointsMaterial:"+a.uuid,(r=this.cache.get(t))||(r=new n.PointsMaterial,n.Material.prototype.copy.call(r,a),r.color.copy(a.color),r.map=a.map,r.sizeAttenuation=!1,this.cache.add(t,r)),a=r):e.isLine&&(t="LineBasicMaterial:"+a.uuid,(r=this.cache.get(t))||(r=new n.LineBasicMaterial,n.Material.prototype.copy.call(r,a),r.color.copy(a.color),this.cache.add(t,r)),a=r),(s||o||l)&&(t="ClonedMaterial:"+a.uuid+":",a.isGLTFSpecularGlossinessMaterial&&(t+="specular-glossiness:"),s&&(t+="derivative-tangents:"),o&&(t+="vertex-colors:"),l&&(t+="flat-shading:"),(r=this.cache.get(t))||(r=a.clone(),o&&(r.vertexColors=!0),l&&(r.flatShading=!0),s&&(r.normalScale&&(r.normalScale.y*=-1),r.clearcoatNormalScale&&(r.clearcoatNormalScale.y*=-1)),this.cache.add(t,r),this.associations.set(r,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 n.MeshStandardMaterial}},{key:"loadMaterial",value:function(e){var t,r=this,i=this.json,a=this.extensions,s=i.materials[e],o={},l=[],u=((i=s.extensions||{})[G.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]?(u=a[G.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS],t=u.getMaterialType(),l.push(u.extendParams(o,s,r))):i[G.KHR_MATERIALS_UNLIT]?(u=a[G.KHR_MATERIALS_UNLIT],t=u.getMaterialType(),l.push(u.extendParams(o,s,r))):(i=s.pbrMetallicRoughness||{},o.color=new n.Color(1,1,1),o.opacity=1,Array.isArray(i.baseColorFactor)&&(u=i.baseColorFactor,o.color.fromArray(u),o.opacity=u[3]),void 0!==i.baseColorTexture&&l.push(r.assignTexture(o,"map",i.baseColorTexture)),o.metalness=void 0!==i.metallicFactor?i.metallicFactor:1,o.roughness=void 0!==i.roughnessFactor?i.roughnessFactor:1,void 0!==i.metallicRoughnessTexture&&(l.push(r.assignTexture(o,"metalnessMap",i.metallicRoughnessTexture)),l.push(r.assignTexture(o,"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,o)}))))),!0===s.doubleSided&&(o.side=n.DoubleSide),s.alphaMode||"OPAQUE");return"BLEND"===u?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,"MASK"===u&&(o.alphaTest=void 0!==s.alphaCutoff?s.alphaCutoff:.5)),void 0!==s.normalTexture&&t!==n.MeshBasicMaterial&&(l.push(r.assignTexture(o,"normalMap",s.normalTexture)),o.normalScale=new n.Vector2(1,1),void 0!==s.normalTexture.scale&&(i=s.normalTexture.scale,o.normalScale.set(i,i))),void 0!==s.occlusionTexture&&t!==n.MeshBasicMaterial&&(l.push(r.assignTexture(o,"aoMap",s.occlusionTexture)),void 0!==s.occlusionTexture.strength&&(o.aoMapIntensity=s.occlusionTexture.strength)),void 0!==s.emissiveFactor&&t!==n.MeshBasicMaterial&&(o.emissive=(new n.Color).fromArray(s.emissiveFactor)),void 0!==s.emissiveTexture&&t!==n.MeshBasicMaterial&&l.push(r.assignTexture(o,"emissiveMap",s.emissiveTexture)),Promise.all(l).then((function(){var i=t===te?a[G.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(o):new t(o);return s.name&&(i.name=s.name),i.map&&(i.map.encoding=n.sRGBEncoding),i.emissiveMap&&(i.emissiveMap.encoding=n.sRGBEncoding),me(i,s),r.associations.set(i,{materials:e}),s.extensions&&fe(a,i,s),i}))}},{key:"createUniqueName",value:function(e){for(var t=n.PropertyBinding.sanitizeNodeName(e||""),r=t,i=1;this.nodeNamesUsed[r];++i)r=t+"_"+i;return this.nodeNamesUsed[r]=!0,r}},{key:"loadGeometries",value:function(e){for(var t=this,r=this.extensions,i=this.primitiveCache,a=[],s=0,o=e.length;s<o;s++){var l=e[s],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 r[G.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(r){return be(r,e,t)}))}(l):be(new n.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,r=this.json,i=this.extensions,a=r.meshes[e],s=a.primitives,o=[],l=0,u=s.length;l<u;l++){var c=void 0===s[l].material?(void 0===(c=this.cache).DefaultMaterial&&(c.DefaultMaterial=new n.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:n.FrontSide})),c.DefaultMaterial):this.getDependency("material",s[l].material);o.push(c)}return o.push(t.loadGeometries(s)),Promise.all(o).then((function(r){for(var o=r.slice(0,r.length-1),l=r[r.length-1],u=[],c=0,h=l.length;c<h;c++){var d=l[c],p=s[c],f=void 0,m=o[c];if(4===p.mode||5===p.mode||6===p.mode||void 0===p.mode)!0!==(f=new(!0===a.isSkinnedMesh?n.SkinnedMesh:n.Mesh)(d,m)).isSkinnedMesh||f.geometry.attributes.skinWeight.normalized||f.normalizeSkinWeights(),5===p.mode?f.geometry=xe(f.geometry,n.TriangleStripDrawMode):6===p.mode&&(f.geometry=xe(f.geometry,n.TriangleFanDrawMode));else if(1===p.mode)f=new n.LineSegments(d,m);else if(3===p.mode)f=new n.Line(d,m);else if(2===p.mode)f=new n.LineLoop(d,m);else{if(0!==p.mode)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+p.mode);f=new n.Points(d,m)}if(0<Object.keys(f.geometry.morphAttributes).length){S=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,S=x.length;w<S;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),me(f,a),p.extensions&&fe(i,f,p),t.assignFinalMaterial(f),u.push(f)}for(var A=0,M=u.length;A<M;A++)t.associations.set(u[A],{meshes:e,primitives:A});if(1===u.length)return u[0];var B=new n.Group;t.associations.set(B,{meshes:e});for(var C=0,E=u.length;C<E;C++)B.add(u[C]);return B}))}},{key:"loadCamera",value:function(e){var t,r=(e=this.json.cameras[e])[e.type];if(r)return"perspective"===e.type?t=new n.PerspectiveCamera(n.MathUtils.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===e.type&&(t=new n.OrthographicCamera(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.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],r=[],i=[],a=[],s=[],o=[],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;r.push(this.getDependency("node",d)),i.push(this.getDependency("accessor",p)),a.push(this.getDependency("accessor",f)),s.push(h),o.push(c)}return Promise.all([Promise.all(r),Promise.all(i),Promise.all(a),Promise.all(s),Promise.all(o)]).then((function(r){for(var i=r[0],a=r[1],s=r[2],o=r[3],l=r[4],u=[],c=0,h=i.length;c<h;c++)!function(e){var t=i[e],r=a[e],c=s[e],h=o[e],d=l[e];if(void 0!==t){t.updateMatrix(),t.matrixAutoUpdate=!0;var p=void 0;switch(de[d.path]){case de.weights:p=n.NumberKeyframeTrack;break;case de.rotation:p=n.QuaternionKeyframeTrack;break;default:p=n.VectorKeyframeTrack}e=t.name||t.uuid;var f=void 0!==h.interpolation?pe[h.interpolation]:n.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,S=m.length;w<S;w++){var A=new p(m[w]+"."+de[d.path],r.array,v,f);"CUBICSPLINE"===h.interpolation&&(A.createInterpolant=function(e){return new(this instanceof n.QuaternionKeyframeTrack?se:ie)(this.times,this.values,this.getValueSize()/3,e)},A.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),u.push(A)}}}(c);return r=t.name||"animation_"+e,new n.AnimationClip(r,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,r=this.json,i=this.extensions,a=this,s=r.nodes[e],o=s.name?a.createUniqueName(s.name):"";return t=[],(r=a._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)})))&&t.push(r),void 0!==s.camera&&t.push(a.getDependency("camera",s.camera).then((function(e){return a._getNodeRef(a.cameraCache,s.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 r,l=!0===s.isBone?new n.Bone:1<t.length?new n.Group:1===t.length?t[0]:new n.Object3D;if(l!==t[0])for(var u=0,c=t.length;u<c;u++)l.add(t[u]);return s.name&&(l.userData.name=s.name,l.name=o),me(l,s),s.extensions&&fe(i,l,s),void 0!==s.matrix?((r=new n.Matrix4).fromArray(s.matrix),l.applyMatrix4(r)):(void 0!==s.translation&&l.position.fromArray(s.translation),void 0!==s.rotation&&l.quaternion.fromArray(s.rotation),void 0!==s.scale&&l.scale.fromArray(s.scale)),a.associations.has(l)||a.associations.set(l,{}),a.associations.get(l).nodes=e,a.options.myOptions.core.loadNode({node:l,nodeDef:s})||l}))}},{key:"loadScene",value:function(e){for(var t=this.json,r=this.extensions,i=(e=this.json.scenes[e],this),a=new n.Group,s=(a.isLoadScene=!0,e.name&&(a.name=i.createUniqueName(e.name)),me(a,e),e.extensions&&fe(r,a,e),e.nodes||[]),o=[],l=0,u=s.length;l<u;l++)o.push(function e(t){var r=t.nodeId,i=t.parentObject,a=t.json,s=t.parser,o=t.idMap,l=t.children,u=a.nodes[r];return s.getDependency("node",r).then((function(e){return void 0===u.skin?e:s.getDependency("skin",u.skin).then((function(e){for(var r=[],n=0,i=(t=e).joints.length;n<i;n++)r.push(s.getDependency("node",t.joints[n]));return Promise.all(r)})).then((function(r){return e.traverse((function(e){if(e.isMesh){for(var i=[],a=[],s=0,o=r.length;s<o;s++){var l=r[s];l?(i.push(l),l=new n.Matrix4,void 0!==t.inverseBindMatrices&&l.fromArray(t.inverseBindMatrices.array,16*s),a.push(l)):console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[s])}e.bind(new n.Skeleton(i,a),e.matrixWorld)}})),e}));var t})).then((function(t){var n,c;i.isLoadScene&&null!=(n=a.asset.ex)&&n.type,o&&o.set(r,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){o.get(e)||(c=!1)})),c&&(i.children=M(o.entries()).sort((function(e,t){return e[0]-t[0]})).map((function(e){return(e=S(e,2))[0],e[1]})),o.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:s,children:d}))}return Promise.all(h)}))}({nodeId:s[l],parentObject:a,json:t,parser:i}));return Promise.all(o).then((function(){return i.options.myOptions&&i.options.myOptions.models.push(a),i.associations=function(e){var t,r=new Map,a=A(i.associations);try{for(a.s();!(t=a.n()).done;){var s=S(t.value,2),o=s[0],l=s[1];(o instanceof n.Material||o instanceof n.Texture)&&r.set(o,l)}}catch(e){a.e(e)}finally{a.f()}return e.traverse((function(e){var t=i.associations.get(e);null!=t&&r.set(e,t)})),r}(a),a}))}}]),e}();function be(e,t,r){var i,a=t.attributes,s=[];for(i in a){var o=he[i]||i.toLowerCase();o in e.attributes||s.push(function(t,n){return r.getDependency("accessor",t).then((function(t){e.setAttribute(n,t)}))}(a[i],o))}void 0===t.indices||e.index||(l=r.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)})),s.push(l)),me(e,t);var l=e,u=t,c=r,h=u.attributes,d=new n.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 n.Vector3(p[0],p[1],p[2]),new n.Vector3(f[0],f[1],f[2])),h.normalized&&(p=ge(oe[h.componentType]),d.min.multiplyScalar(p),d.max.multiplyScalar(p));var m=u.targets;if(void 0!==m){for(var v=new n.Vector3,g=new n.Vector3,y=0,b=m.length;y<b;y++){var x,w,S=m[y];void 0!==S.POSITION&&(w=(S=c.json.accessors[S.POSITION]).min,x=S.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]))),S.normalized&&(w=ge(oe[S.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 n.Sphere,d.getCenter(f.center),f.radius=d.min.distanceTo(d.max)/2,l.boundingSphere=f}}return Promise.all(s).then((function(){if(void 0===t.targets)return e;for(var n=e,i=t.targets,a=r,s=!1,o=!1,l=!1,u=0,c=i.length;u<c;u++){var h=i[u];if(void 0!==h.POSITION&&(s=!0),void 0!==h.NORMAL&&(o=!0),void 0!==h.COLOR_0&&(l=!0),s&&o&&l)break}if(!s&&!o&&!l)return Promise.resolve(n);for(var d=[],p=[],f=[],m=0,v=i.length;m<v;m++){var g,y=i[m];s&&(g=void 0!==y.POSITION?a.getDependency("accessor",y.POSITION):n.attributes.position,d.push(g)),o&&(g=void 0!==y.NORMAL?a.getDependency("accessor",y.NORMAL):n.attributes.normal,p.push(g)),l&&(y=void 0!==y.COLOR_0?a.getDependency("accessor",y.COLOR_0):n.attributes.color,f.push(y))}return Promise.all([Promise.all(d),Promise.all(p),Promise.all(f)]).then((function(e){var t=e[0],r=e[1];return e=e[2],s&&(n.morphAttributes.position=t),o&&(n.morphAttributes.normal=r),l&&(n.morphAttributes.color=e),n.morphTargetsRelative=!0,n}))}))}function xe(e,t){var r=e.getIndex();if(null===r){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 s=0;s<a.count;s++)i.push(s);e.setIndex(i),r=e.getIndex()}var o=r.count-2,l=[];if(t===n.TriangleFanDrawMode)for(var u=1;u<=o;u++)l.push(r.getX(0)),l.push(r.getX(u)),l.push(r.getX(u+1));else for(var c=0;c<o;c++)c%2==0?(l.push(r.getX(c)),l.push(r.getX(c+1)),l.push(r.getX(c+2))):(l.push(r.getX(c+2)),l.push(r.getX(c+1)),l.push(r.getX(c)));return l.length/3!=o&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles."),(t=e.clone()).setIndex(l),t}var we=r(794),Se=r(723);class Ae{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 Ae(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){if(null==(t=e.asset)||!t.ex)return!0;var t=e.asset.ex.base64;return!t||!!(e=(0,Se.Ne)(t))&&(t=Number(e),!isNaN(t)&&(new Date).getTime()<t)}callback(e,t){var r,n;return this.loadConfig.triggerCb&&null!=(r=null==(n=this.runScene.cb.loaderer.gltf[e])?void 0:n.cb)&&r.call(n,t),null!=(n=null==(r=this.loadConfig.callBack)?void 0:r[e])&&n.call(r,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]}}class Be{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(s),this._gltf.setDRACOLoader(e)}load(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function a(e){try{o(n.next(e))}catch(e){i(e)}}function s(e){try{o(n.throw(e))}catch(e){i(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(a,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){var r=yield i().get(e,{responseType:"arraybuffer",onDownloadProgress:e=>{var r,{total:e,loaded:n}=e;let i=n/e;1<(i=i<0?0:i)&&(i=1);var n=Number(i.toFixed(2));e=Math.floor(100*n),null!=(r=null==(n=null==t?void 0:t.callBack)?void 0:n.progress)&&r.call(n,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){const r=(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||{}),n=new Me(this.runScene,r);return n.callback("getArrayBuffer",e),new Promise((t=>{e instanceof ArrayBuffer&&this._gltf.parse(e,"",(e=>{n.callback("loadedGltf",e);try{this.afterParse(e.parser.options.myOptions,e,r)}catch(e){console.log(e,"e")}t(n.models)}),(e=>{console.log(e,"_a")}),{rootModel:this.runScene.assetsEx.get().scene,models:[],core:n,runScene:this.runScene,loadConfig:r})}))}afterParse(e,t,r){var n;const i=e.core;i.callback("afterParse",{options:e,json:t,loadConfig:r});var{cleanJSON:r,callBack:a}=r;if(!t.asset.ex){const{models:r,core:n}=e,i=this.runScene.sceneEx.cleanUnlessLevel(r[0]);n.models.push(i),0<t.animations.length&&(i.animations=[...t.animations])}this.runScene.optionsEx.log(t,"detail"),Promise.all(i.pending).then((()=>{i.callback("complete",{models:e.models,json:t})})),null!=(n=null==a?void 0:a.getJSON)&&n.call(a,t),r&&this.disposeJSON(t)}disposeJSON(e){}}var Ce=r(736),Ee=r(110);class Te{constructor(e){this._objectLoader=new n.ObjectLoader,this.runScene=e,this._parser=new _e(e)}parse(e){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function a(e){try{o(n.next(e))}catch(e){i(e)}}function s(e){try{o(n.throw(e))}catch(e){i(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(a,s)}o((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 _e{constructor(e){this.runScene=e}parseModel(e){e.material&&this.parseMaterial(e)}parseMaterial(e){var t=e.material;"SpriteMaterial"===t.type&&(0,Ce.M)(t,"type",Ee.Z.tools.type),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 n.ImageBitmapLoader,this.object=new n.ObjectLoader,this.runScene=e,this.gltf=new Be(e),this.json=new Te(e)}init(){this.gltf.init()}}const Pe=new class{constructor(){this.load=new n.AnimationLoader}parse(e){return this.load.parse(e)}}},880:(e,t,r)=>{r.d(t,{Ws:()=>Q,ZP:()=>Y,ee:()=>q});var n,i,a,s=r(707),o=r(881),l=r(932),u=r(651),c=r(735),h=r(736);class d{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new c.Z({target:e,typeList:["uniforms",...t],newVal:r}).execute())}}(n=d).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],d.TextureNames=["sideWallTex","backWallTex","floorTex","ceilingTex"],d.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},create:(e,t)=>{var r=new o.ShaderMaterial({uniforms:(0,u.d9)(p.uniforms),vertexShader:p.vertexShader,fragmentShader:p.fragmentShader});return n.tools.bind(r),r},parseData:e=>{const{texture:t,normal:r,material:i}=e,{data:a,load:s}=t,l=new o.ShaderMaterial({uniforms:(0,u.d9)(p.uniforms),vertexShader:p.vertexShader,fragmentShader:p.fragmentShader}),c=[];return s&&c.push(...a.map((e=>()=>{"ceilingTex"===e.type?l.uniforms.ceilingTex.value=e.texture||null:"floorTex"===e.type?l.uniforms.floorTex.value=e.texture||null:"sideWallTex"===e.type?l.uniforms.sideWallTex.value=e.texture||null:"backWallTex"===e.type&&(l.uniforms.backWallTex.value=e.texture||null)}))),Object.keys(r.uniforms).filter((e=>!d.TextureNames.includes(e))).map((e=>{var t=r.uniforms[e];l.uniforms[e].value="roomsXYZPropsW"===e||"positionOffsetRoomsXYZPropsW"===e||"roomColorTint"===e?new o.Vector4(t.x,t.y,t.z,t.w):t})),l.name=r.name,l.userData.id=i.userData.id,n.tools.bind(l),{material:l,setTextureFns:c}},toNormal:e=>{const t=(0,l.createDefMaterial)(),r=(t.userData=Object.assign({},t.userData),{}),i=e.uniforms,a=p.uniforms;return Object.keys(i).filter((e=>!d.TextureNames.includes(e))).map((e=>{var t,n,s,l,u,c,h=i[e].value,d=a[e].value;h instanceof o.Vector4?(({x:t,y:n,z:s}=h),({x:l,y:u,z:c}=d),t===l&&n===u&&s===c||(r[e]=h)):h!==d&&(r[e]=h)})),{material:t,normal:{type:n.tools.type,uniforms:r,name:e.name},textures:n.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=n.tools.create(t);return Object.keys(r).filter((e=>!d.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,h.M)(e,"type",n.tools.type)},validType:e=>"FakeInterior"===e.userData.type};const p={uniforms:{roomIntensity:{value:1},roomColorTint:{value:new o.Vector4(1,1,1,1)},sideWallTex:{value:null},backWallTex:{value:null},floorTex:{value:null},ceilingTex:{value:null},sideWallTexTiling:{value:.097},backWallTexTiling:{value:.097},floorTexTiling:{value:.15},ceilingTexTiling:{value:.15},roomTile:{value:.3},roomsXYZPropsW:{value:new o.Vector4(.35,.65,.1,1)},positionOffsetRoomsXYZPropsW:{value:new o.Vector4(4.7,2,-11,-3)},depthTest:{value:!0},depthWrite:{value:!0}},vertexShader:"\n varying vec2 vUv;\n varying vec3 vPos;\n varying mat4 vModelMatrix;\n \n void main() {\n vUv = uv;\n vPos = position;\n vModelMatrix = modelMatrix;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform float roomIntensity;\n uniform vec4 roomColorTint;\n \n uniform sampler2D sideWallTex;\n uniform sampler2D backWallTex;\n uniform sampler2D floorTex;\n uniform sampler2D ceilingTex;\n \n uniform float sideWallTexTiling;\n uniform float backWallTexTiling;\n uniform float floorTexTiling;\n uniform float ceilingTexTiling;\n \n uniform float roomTile;\n uniform vec4 roomsXYZPropsW;\n uniform vec4 positionOffsetRoomsXYZPropsW;\n \n varying vec2 vUv;\n varying vec3 vPos;\n varying mat4 vModelMatrix;\n \n void main() {\n vec4 interpVertexPos = vec4(vPos.xyz, vPos.z);\n // 将相机世界空间坐标转换为对象空间坐标\n vec4 cameraObjectPos = inverse(vModelMatrix) * vec4(cameraPosition, 1.0);\n vec4 transCameraPos = vec4(cameraObjectPos.xyz, cameraObjectPos.z);\n \n vec4 temp1 = (interpVertexPos - positionOffsetRoomsXYZPropsW);\n vec4 temp2 = ((roomsXYZPropsW + vec4(-1E-05, -1E-05, -1E-05, -1E-05)) * roomTile);\n vec4 V2 = transCameraPos - positionOffsetRoomsXYZPropsW;\n vec4 V1 = temp1 - V2;\n vec4 middleman = ((floor(temp2 * temp1) + step(vec4(0, 0, 0, 0), V1)) / temp2 - V2) / V1;\n \n // Side Walls\n vec2 sideWallUv = (middleman.x * V1 + V2).zy * sideWallTexTiling;\n vec4 sideWallColor = texture2D(sideWallTex, sideWallUv);\n \n // Back Wall\n vec2 backWallUv = (middleman.z * V1 + V2).xy * backWallTexTiling;\n vec4 backWallColor = texture2D(backWallTex, backWallUv);\n \n // Floor Ceiling\n vec2 floorUv = ((middleman.y * V1) + V2).xz * floorTexTiling;\n vec2 ceilingUv = ((middleman.y * V1) + V2).xz * ceilingTexTiling;\n vec4 floorColor = texture2D(floorTex, floorUv);\n vec4 ceilingColor = texture2D(ceilingTex, ceilingUv);\n vec4 cfColor = mix(floorColor, ceilingColor, step(0.0, V1.y));\n \n // Mix\n float compareXZ = 0.0;\n float stepXZ = step(middleman.z, middleman.x);\n if(stepXZ <= 0.0)\n compareXZ = middleman.x;\n else\n compareXZ = middleman.z;\n \n vec4 wallColor = vec4(0);\n if(stepXZ <= 0.0)\n wallColor = sideWallColor;\n else\n wallColor = backWallColor;\n \n vec4 finalColor = vec4(0);\n if(middleman.y <= compareXZ)\n finalColor = cfColor;\n else\n finalColor = wallColor;\n \n // Tint Room\n vec4 tintColor = roomColorTint * finalColor * roomIntensity;\n \n gl_FragColor = tintColor;\n }\n "};class f{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new c.Z({target:e,typeList:[...t],newVal:r}).execute())}}(i=f).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],f.TextureNames=["envMap","displacementMap"],f.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},create:(e,t)=>{const r=new m(void 0,void 0,e);return r.insertFresnelShader(),i.tools.bind(r),(t=t||e.modelEx.select)&&(r.name=t.name),r},parseData:(e,t)=>{const{texture:r,normal:n,material:a}=e,{data:s,load:o}=r,u=(0,l.mergeMaterial)(a,new m(void 0,void 0,t)),c=[];return o&&c.push(...s.map((e=>()=>{u[e.type]=e.texture}))),Object.keys(n.uniforms).filter((e=>!f.TextureNames.includes(e))).map((e=>{u[e]=n.uniforms[e]})),u.insertFresnelShader(),u.name=n.name,u.userData.id=a.userData.id,i.tools.bind(u),{material:u,setTextureFns:c}},toNormal:e=>{const t=(0,l.mergeMaterial)(e,(0,l.createDefMaterial)()),r=(t.userData=Object.assign({},t.userData),t.name=e.name,{}),n=v.uniforms;return Object.keys(n).filter((e=>!f.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)})),{material:t,normal:{type:i.tools.type,uniforms:r,name:e.name},textures:i.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=i.tools.create(t);return Object.keys(r).filter((e=>!f.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,h.M)(e,"type",i.tools.type)},validType:e=>"Fresnel"===e.userData.type};class m extends o.MeshPhysicalMaterial{constructor(e,t,r){if(e?super(e):(super(),this.emissive=new o.Color(65535),this.envMap=null,this.displacementMap=null,this.metalness=0,this.roughness=0,this.ior=1.5,this.transmission=1,this.opacity=1,this.transparent=!0,this.thickness=0),this.runScene=r,this.isSpecialMaterial=!0,t?(this.fresnelBias=new o.Uniform(t.fresnelBias),this.fresnelScale=new o.Uniform(t.fresnelScale),this.fresnelPower=new o.Uniform(t.fresnelPower)):(this.fresnelBias=new o.Uniform(v.uniforms.fresnelBias.value),this.fresnelScale=new o.Uniform(v.uniforms.fresnelScale.value),this.fresnelPower=new o.Uniform(v.uniforms.fresnelPower.value)),this.clock=new o.Clock,this.isSurge=new o.Uniform(!1),this.deltaTime=new o.Uniform(0),!this.cubeCamera){const e=new o.WebGLCubeRenderTarget(2048);e.texture.mapping=o.CubeRefractionMapping,this.cubeCamera=new o.CubeCamera(.1,1e5,e),this.runScene.assetsEx.scene.add(this.cubeCamera),this.runScene.cb.render.add("Fresnel",(()=>{this.update()}))}}insertFresnelShader(){this.onBeforeCompile=e=>{e.uniforms.isSurge=this.isSurge,e.uniforms.deltaTime=this.deltaTime,e.uniforms.fresnelBias=this.fresnelBias,e.uniforms.fresnelScale=this.fresnelScale,e.uniforms.fresnelPower=this.fresnelPower,e.vertexShader=e.vertexShader.replace(/varying vec3 vWorldPosition;/g,v.vertexParas),e.vertexShader=e.vertexShader.replace(/#include <begin_vertex>/g,v.vertexShader1),e.vertexShader=e.vertexShader.replace(/vWorldPosition = worldPosition.xyz;/g,v.vertexShader2),e.fragmentShader=e.fragmentShader.replace(/#include <transmission_pars_fragment>/g,v.fragmentParas),e.fragmentShader=e.fragmentShader.replace(/vec3 totalEmissiveRadiance = emissive;/g,v.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 v={uniforms:{depthTest:new o.Uniform(!0),depthWrite:new o.Uniform(!0),isSurge:new o.Uniform(!1),deltaTime:new o.Uniform(0),fresnelBias:new o.Uniform(0),fresnelScale:new o.Uniform(1),fresnelPower:new o.Uniform(3)},vertexParas:"\n uniform bool isSurge;\n uniform float deltaTime;\n varying vec3 vWorldPosition;\n varying vec3 vWorldNormal;\n ",vertexShader1:"\n vec3 transformed = vec3(position);\n if(isSurge) {\n // 0.15作为系数控制气泡表面波纹的稀疏程度,数值越大越密\n float wobbleValue = 0.15 * transformed.y + deltaTime;\n // 三角函数的系数控制气泡表面波纹的波动幅度,数值越大波幅越大\n vec3 wobblePos = vec3(0.75 * cos(wobbleValue) + 0.25 * sin(wobbleValue));\n transformed += wobblePos;\n }\n ",vertexShader2:"\n vWorldPosition = worldPosition.xyz;\n vWorldNormal = normalize(vec3(modelMatrix * vec4(normal, 0.0)));\n ",fragmentParas:"\n #include <transmission_pars_fragment>\n varying vec3 vWorldNormal;\n uniform float fresnelBias;\n uniform float fresnelScale;\n uniform float fresnelPower;\n ",fragmentShaderEmissive:"\n vec3 viewDir = normalize(cameraPosition - vWorldPosition);\n float fresnelNdot = dot(viewDir, vWorldNormal);\n float fresnelValue = fresnelBias + fresnelScale * pow(1.0 - fresnelNdot, fresnelPower);\n // fresnelValue = [0, 1], 0=center,1=edge\n \n vec3 totalEmissiveRadiance = emissive * fresnelValue;\n "};class g{constructor(e){this.runScene=e}undo(e){const{material:t,list:r,val:n}=e;this.runScene.undoEx.addUndo(new c.Z({target:t,typeList:[...r],newVal:n,cb:()=>{t.needsUpdate=!0}}).execute())}}(a=g).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],g.TextureNames=["alphaMap","bumpMap","displacementMap","map","normalMap","matcap"],g.tools={type:"Matcap",getTextures:e=>{const t=[];return g.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},create:(e,t)=>{const r=new o.MeshMatcapMaterial;return a.tools.bind(r),(t=t||e.modelEx.select)&&(r.name="Matcap-"+t.name),r},parseData:e=>{const{normal:t,texture:r,material:n}=e,{data:i,load:s}=r,u=(0,l.mergeMaterial)(n,new o.MeshMatcapMaterial),c=(delete u.emissive,[]);return s&&c.push(...i.map((e=>()=>{u[e.type]=e.texture}))),Object.keys(t.uniforms).filter((e=>!g.IgnoredAttributes.includes(e))).map((e=>{u[e]="normalScale"===e?new o.Vector2(t.uniforms[e].x,t.uniforms[e].y):t.uniforms[e]})),u.name=t.name,u.userData.id=n.userData.id,a.tools.bind(u),{material:u,setTextureFns:c}},toNormal:e=>{var t=a.tools.getTextures(e);const r=(0,l.mergeMaterial)(e,(0,l.createDefMaterial)()),n=(r.userData=Object.assign({},r.userData),r.name=e.name,{}),i=new o.MeshMatcapMaterial;return Object.keys(e).filter((e=>!g.TextureNames.includes(e))).filter((e=>!g.IgnoredAttributes.includes(e))).map((t=>{var r=e[t],a=i[t];"bumpScale"===t||"displacementScale"===t||"displacementBias"===t||"depthTest"===t||"depthWrite"===t||"transparent"===t||"opacity"===t?r!==a&&(n[t]=r):"normalScale"!==t||r.x===a.x&&r.y===a.y||(n[t]=r)})),{material:r,normal:{type:a.tools.type,uniforms:n,name:e.name},textures:t}},clone:(e,t)=>e,copy:(e,t)=>{const r=a.tools.create(t);return Object.keys(r).filter((e=>!g.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,h.M)(e,"type",a.tools.type)},validType:e=>"Matcap"===e.userData.type};const y="\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 ",b="\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 ",x={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 o.Matrix3,new o.Matrix3,new o.Matrix3,new o.Matrix3,new o.Matrix3,new o.Matrix3]},maskUvTransArray:{value:[new o.Matrix3,new o.Matrix3,new o.Matrix3,new o.Matrix3,new o.Matrix3]},diffuse:{value:new o.Color(16777215)},uvTransform:{value:new o.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 "};var w,S=r(398),A=r(729);const M={diffuse:{type:"color",label:["uniforms","diffuse","value"],val:{r:1,g:1,b:1},shortKey:"df"},shadowShade:{type:"number",label:["uniforms","shadowShade","value"],val:.6,shortKey:"ss"},terrainMap0:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[0])?(0,A.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[0]=r},shortKey:"p0"},terrainMap1:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[1])?(0,A.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[1]=r},shortKey:"p1"},terrainMap2:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[2])?(0,A.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[2]=r},shortKey:"p2"},terrainMap3:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[3])?(0,A.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[3]=r},shortKey:"p3"},terrainMap4:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[4])?(0,A.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[4]=r},shortKey:"p4"},terrainMap5:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[5])?(0,A.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[5]=r},shortKey:"p5"},terrainMap6:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[6])?(0,A.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[6]=r},shortKey:"p6"},terrainMap7:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[7])?(0,A.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[7]=r},shortKey:"p7"},terrainMask0:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[0])?(0,A.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[0]=r},shortKey:"k0"},terrainMask1:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[1])?(0,A.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[1]=r},shortKey:"k1"},terrainMask2:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[2])?(0,A.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[2]=r},shortKey:"k2"},terrainMask3:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[3])?(0,A.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[3]=r},shortKey:"k3"},terrainMask4:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[4])?(0,A.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[4]=r},shortKey:"k4"},terrainMask5:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[5])?(0,A.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[5]=r},shortKey:"k5"},terrainMask6:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[6])?(0,A.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[6]=r},shortKey:"k6"}};class B{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new c.Z({target:e,typeList:["uniforms",...t],newVal:r}).execute())}insertShader(e){e&&(e.onBeforeCompile=t=>{t.defines=x.defines,this.mergeUniforms(e.uniforms,t.uniforms),t.vertexShader=x.vertex,t.fragmentShader=x.fragment,t.fragmentShader=t.fragmentShader.replace(/\/\/ Insert Noise2D/g,y)})}mergeUniforms(e,t){if(e&&t)for(const r in e)t[r]=e[r]}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)))}}(w=B).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],B.TextureNames=["terrainMap0","terrainMap1","terrainMap2","terrainMap3","terrainMap4","terrainMap5","terrainMap6","terrainMap7","terrainMask0","terrainMask1","terrainMask2","terrainMask3","terrainMask4","terrainMask5","terrainMask6"],B.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},create:(e,t)=>{const r=new o.ShadowMaterial({color:0,opacity:1});return r.uniforms=o.UniformsUtils.clone(x.uniforms),e.materialEx.def.map.MixTexture.insertShader(r),w.tools.bind(r),r},parseData:(e,t)=>{const{texture:r,normal:n,material:i}=e,{data:a,load:s}=r,l=new o.ShadowMaterial({color:0,opacity:1}),u=(l.uniforms=o.UniformsUtils.clone(x.uniforms),t.materialEx.def.map.MixTexture.insertShader(l),[]);return s&&u.push(...a.map((e=>()=>{var r=parseInt(e.type.slice(-1));e.type.startsWith("terrainMap")?(l.uniforms.mapArray.value[r]=e.texture,t.materialEx.def.map.MixTexture.onTexRepeatChange(l,r,!0)):e.type.startsWith("terrainMask")&&(l.uniforms.maskArray.value[r]=e.texture,t.materialEx.def.map.MixTexture.onTexRepeatChange(l,r,!1))}))),Object.keys(n.uniforms).filter((e=>!B.TextureNames.includes(e))).map((e=>{var t=n.uniforms[e];"diffuse"===e?l.uniforms[e].value=new o.Color(parseInt(t,16)):"uvTransform"!==e&&(l.uniforms[e].value=t)})),l.name=n.name,l.userData.id=i.userData.id,w.tools.bind(l),{material:l,setTextureFns:u}},toNormal:e=>{const t=(0,l.createDefMaterial)(),r=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:w.tools.type,uniforms:{},name:e.name},textures:w.tools.getTextures(e)}),{}),n=e.uniforms,i=x.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!==a&&(r[e]=t)})),{material:t,normal:{type:w.tools.type,uniforms:r,name:e.name},textures:w.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=w.tools.create(t);return Object.keys(r).filter((e=>!B.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,h.M)(e,"type",w.tools.type)},validType:e=>"MixTexture"===e.userData.type,snapshot:{getDiff:e=>S.LV.getDiff(M,e),set:e=>{const{map:t,material:r,runScene:n,data:i}=e;S.LV.set({def:M,data:i,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,l.updateMaterial)(r)}))}}};var C,E=r(110);class T{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new c.Z({target:e,typeList:[...t],newVal:r}).execute())}}(C=T).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],T.TextureNames=["alphaMap","aoMap","bumpMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap","clearcoatMap","clearcoatNormalMap","clearcoatRoughnessMap","sheenRoughnessMap","sheenColorMap","specularIntensityMap","specularColorMap","thicknessMap","transmissionMap"],T.tools={type:"Physical",getTextures:e=>{const t=[];return T.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},create:(e,t)=>{const r=new o.MeshPhysicalMaterial;return C.tools.bind(r),(t=t||e.modelEx.select)&&(r.name="MeshPhysicalMaterial-"+t.name),r},parseData:e=>{const{normal:t,texture:r,material:n}=e,{data:i,load:a}=r,s=(0,l.mergeMaterial)(n,new o.MeshPhysicalMaterial),u=[];return a&&u.push(...i.map((e=>()=>{s[e.type]=e.texture}))),Object.keys(t.uniforms).filter((e=>!T.IgnoredAttributes.includes(e))).map((e=>{var r=t.uniforms[e];s[e]="attenuationColor"===e||"sheenColor"===e||"specularColor"===e?new o.Color(r):"clearcoatNormalScale"===e?new o.Vector2(r.x,r.y):r})),s.name=t.name,s.userData.id=n.userData.id,C.tools.bind(s),{material:s,setTextureFns:u}},toNormal:e=>{const t=(0,l.mergeMaterial)(e,(0,l.createDefMaterial)()),r=(t.userData=Object.assign({},t.userData),t.name=e.name,{}),n=new o.MeshPhysicalMaterial;return Object.keys(e).filter((e=>!T.TextureNames.includes(e))).filter((e=>!T.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)})),{material:t,normal:{type:C.tools.type,uniforms:r,name:e.name},textures:C.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=C.tools.create(t);return Object.keys(r).filter((e=>!T.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,h.M)(e,"type",C.tools.type)},validType:e=>"MeshPhysicalMaterial"===e.type};var _=r(1),D=r(180);const P={uniforms:{tDiffuse:new o.Uniform(null),h:new o.Uniform(1/512)},vertexShader:"\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}",fragmentShader:"\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float h;\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvec4 sum = vec4( 0.0 );\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\t\n\t\t\tgl_FragColor = sum;\n\t\t}"},O={uniforms:{tDiffuse:new o.Uniform(null),v:new o.Uniform(1/512)},vertexShader:"\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}",fragmentShader:"\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float v;\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvec4 sum = vec4( 0.0 );\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\t\t\t\n\t\t\tgl_FragColor = sum;\n\t\t}"};var R,I;new o.Uniform(null),new o.Uniform(null),new o.Uniform(0),new o.Uniform(0),new o.Uniform(0),new o.Uniform(new o.Vector2),new o.Uniform(.1),new o.Uniform(1e3);class k{constructor(e){this.materials={},this.render=()=>{(0,_.mapObj)(this.materials,((e,t)=>{const{model:r,material:n}=t;n.update(r)}))},this.runScene=e,this.init(),this.runScene.cb.material.dispose.add("Reflector",this.dispose.bind(this))}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,_.getId)();t.userData.id=r,this.materials[r]=e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new c.Z({target:e,typeList:[...t],newVal:r}).execute())}dispose(){this.materials={}}}(R=k).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],k.TextureNames=["map","normalMap","roughnessMap","metalnessMap","tDiffuse","tDiffuseBlur"],k.tools={type:"Reflector",getTextures:e=>(0,l.getTexturesByMaterial)(e),create:(e,t)=>{const r=new L(void 0,void 0,e);return r.insertReflectorShader(),R.tools.bind(r),(t=t||e.modelEx.select)&&(r.name=t.name),e.materialEx.def.map.Reflector.bindData({model:t,material:r}),r},parseData:(e,t)=>{const{texture:r,normal:n,models:i,material:a}=e,{data:s,load:u}=r,c=(0,l.mergeMaterial)(a,new L(void 0,void 0,t)),h=[];return u&&h.push(...s.map((e=>()=>{c[e.type]=e.texture}))),Object.keys(n.uniforms).filter((e=>!k.TextureNames.includes(e))).map((e=>{c[e]="normalScale"===e?new o.Vector2(n.uniforms[e].x,n.uniforms[e].y):n.uniforms[e]})),c.setRTSize(c.resolution),c.setBlurPass(c.blurSize),c.insertReflectorShader(),t.materialEx.def.map.Reflector.bindData({model:i[0],material:c}),c.name=n.name,c.userData.id=a.userData.id,R.tools.bind(c),{material:c,setTextureFns:h}},toNormal:e=>{const t=(0,l.mergeMaterial)(e,(0,l.createDefMaterial)()),r=(t.userData=Object.assign({},t.userData),t.name=e.name,{}),n=F.uniforms;return Object.keys(n).filter((e=>!k.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),{material:t,normal:{type:R.tools.type,uniforms:r,name:e.name},textures:R.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=R.tools.create(t);return Object.keys(r).filter((e=>!k.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,h.M)(e,"type",R.tools.type)},validType:e=>"Reflector"===e.userData.type};class L extends o.MeshStandardMaterial{constructor(e,t,r){e?super(e):(super(),this.opacity=F.uniforms.opacity.value,this.transparent=F.uniforms.transparent.value,this.roughness=F.uniforms.roughness.value,this.metalness=F.uniforms.metalness.value),this.runScene=r,this.isSpecialMaterial=!0,t?(this.resolution=t.resolution,this.blurSize=t.blurSize,this.mirror=new o.Uniform(t.mirror),this.mixBlur=new o.Uniform(t.mixBlur),this.mixStrength=new o.Uniform(t.mixStrength),this.mixContrast=new o.Uniform(t.mixContrast)):(this.resolution=F.uniforms.resolution.value,this.blurSize=F.uniforms.blurSize.value,this.mirror=new o.Uniform(F.uniforms.mirror.value),this.mixBlur=new o.Uniform(F.uniforms.mixBlur.value),this.mixStrength=new o.Uniform(F.uniforms.mixStrength.value),this.mixContrast=new o.Uniform(F.uniforms.mixContrast.value)),this.textureMatrix=new o.Uniform(new o.Matrix4),this.reflectorWorldPosition=new o.Vector3,this.cameraWorldPosition=new o.Vector3,this.rotationMatrix=new o.Matrix4,this.normal=new o.Vector3,this.view=new o.Vector3,this.lookAtPosition=new o.Vector3,this.target=new o.Vector3,this.tempQuaternion=new o.Vector4,this.virtualCamera=new o.PerspectiveCamera,this.reflectorPlane=new o.Plane,this.clipPlane=new o.Vector4,e={minFilter:o.LinearFilter,magFilter:o.LinearFilter,type:o.HalfFloatType,encoding:this.runScene.assetsEx.get().renderer.outputEncoding},this.glRT1=new o.WebGLRenderTarget(this.resolution,this.resolution,e),this.glRT2=new o.WebGLRenderTarget(this.resolution,this.resolution,e),this.tDiffuse=new o.Uniform(this.glRT1.texture),this.tDiffuseBlur=new o.Uniform(this.glRT2.texture),this.hBlurPass=new D.T(P),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 D.T(O),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=F.vertexParas+""+e.vertexShader,e.vertexShader=e.vertexShader.replace("#include <project_vertex>",F.vertexShader),e.fragmentShader=F.fragmentParas+""+e.fragmentShader,e.fragmentShader=e.fragmentShader.replace("#include <emissivemap_fragment>",F.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 F={uniforms:{opacity:new o.Uniform(1),transparent:new o.Uniform(!1),roughness:new o.Uniform(1),metalness:new o.Uniform(.6),resolution:new o.Uniform(1024),blurSize:new o.Uniform(1024),mirror:new o.Uniform(0),mixBlur:new o.Uniform(10),mixStrength:new o.Uniform(2),mixContrast:new o.Uniform(1),depthTest:new o.Uniform(!0),depthWrite:new o.Uniform(!0)},vertexParas:"\n uniform mat4 textureMatrix;\n varying vec4 my_vUv;\n ",vertexShader:"\n #include <project_vertex>\n my_vUv = textureMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n ",fragmentParas:"\n uniform sampler2D tDiffuse;\n uniform sampler2D tDiffuseBlur;\n uniform sampler2D tDepth;\n uniform sampler2D distortionMap;\n uniform float distortion;\n uniform float mirror;\n uniform float mixBlur;\n uniform float mixStrength;\n uniform float mixContrast;\n uniform float minDepthThreshold;\n uniform float maxDepthThreshold;\n uniform float depthScale;\n uniform float depthToBlurRatioBias;\n varying vec4 my_vUv;\n ",fragmentShader:"\n #include <emissivemap_fragment>\n float distortionFactor = 0.0;\n #ifdef USE_DISTORTION\n distortionFactor = texture2D(distortionMap, vUv).r * distortion;\n #endif\n \n vec4 new_vUv = my_vUv;\n new_vUv.x += distortionFactor;\n new_vUv.y += distortionFactor;\n \n vec4 base = texture2DProj(tDiffuse, new_vUv);\n vec4 blur = texture2DProj(tDiffuseBlur, new_vUv);\n \n vec4 merge = base;\n \n #ifdef USE_NORMALMAP\n vec2 normal_uv = vec2(0.0);\n vec4 normalColor = texture2D(normalMap, vUv * normalScale);\n vec3 my_normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) );\n vec3 coord = new_vUv.xyz / new_vUv.w;\n normal_uv = coord.xy + coord.z * my_normal.xz * 0.05;\n vec4 base_normal = texture2D(tDiffuse, normal_uv);\n vec4 blur_normal = texture2D(tDiffuseBlur, normal_uv);\n merge = base_normal;\n blur = blur_normal;\n #endif\n \n float blurFactor = 0.0;\n float depthFactor = 0.0001;\n \n #ifdef USE_DEPTH\n vec4 depth = texture2DProj(tDepth, new_vUv);\n depthFactor = smoothstep(minDepthThreshold, maxDepthThreshold, 1.0-(depth.r * depth.a));\n depthFactor *= depthScale;\n depthFactor = max(0.0001, min(1.0, depthFactor));\n #ifdef USE_BLUR\n blur = blur * min(1.0, depthFactor + depthToBlurRatioBias);\n merge = merge * min(1.0, depthFactor + 0.5);\n #else\n merge = merge * depthFactor;\n #endif\n #endif\n \n float reflectorRoughnessFactor = roughness;\n #ifdef USE_ROUGHNESSMAP\n vec4 reflectorTexelRoughness = texture2D( roughnessMap, vUv );\n reflectorRoughnessFactor *= reflectorTexelRoughness.g;\n #endif\n \n #ifdef USE_BLUR\n blurFactor = min(1.0, mixBlur * reflectorRoughnessFactor);\n merge = mix(merge, blur, blurFactor);\n #endif\n \n vec4 newMerge = vec4(0.0, 0.0, 0.0, 1.0);\n newMerge.r = (merge.r - 0.5) * mixContrast + 0.5;\n newMerge.g = (merge.g - 0.5) * mixContrast + 0.5;\n newMerge.b = (merge.b - 0.5) * mixContrast + 0.5;\n \n diffuseColor.rgb = diffuseColor.rgb * ((1.0 - min(1.0, mirror)) + newMerge.rgb * mixStrength);\n "},U="\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 ",G="\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 ",N={emissive:s.Gf.emissive,alphaTest:{type:"number",val:0,shortKey:"at"},colorGradient:{type:"color",label:["uniforms","colorGradient","value"],val:{r:0,g:1,b:0},shortKey:"cg"}};class j{constructor(e){this.runScene=e}undo(e){const{material:t,list:r,val:n}=e;this.runScene.undoEx.addUndo(new c.Z({target:t,typeList:[...r],newVal:n,cb:()=>{t.needsUpdate=!0}}).execute())}}(I=j).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines","onBeforeCompile"],j.TextureNames=["alphaMap","aoMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap"],j.tools={type:"TreeLeaf",getTextures:e=>{const t=[];return j.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},create:(e,t)=>{const r=new H(e);return I.tools.bind(r),(t=t||e.modelEx.select)&&(r.name=t.name,r.setSize(t),r.setWorldPos(t)),r},parseData:(e,t)=>{const{normal:r,texture:n,material:i,models:a}=e,{data:s,load:u}=n,c=(0,l.mergeMaterial)(i,new H(t)),h=(c.setSize(a[0]),c.setWorldPos(a[0]),[]);return u&&h.push(...s.map((e=>()=>{c[e.type]=e.texture}))),Object.keys(r.uniforms).filter((e=>!j.IgnoredAttributes.includes(e))).map((e=>{var t=r.uniforms[e];"color"!==e&&"emissive"!==e&&("normalScale"===e?c[e]=new o.Vector2(t.x,t.y):"windForce"===e||"windSpeed"===e||"windWaveScale"===e||"colorLevel"===e||"colorFade"===e||"leavesCore"===e?c.uniforms[e]=new o.Uniform(t):"colorGradient"===e?c.uniforms[e]=new o.Uniform(new o.Color(parseInt(t,16))):c[e]=r.uniforms[e])})),c.name=r.name,c.userData.id=i.userData.id,I.tools.bind(c),{material:c,setTextureFns:h}},toNormal:(e,t)=>{var r=I.tools.getTextures(e);const n=(0,l.mergeMaterial)(e,(0,l.createDefMaterial)()),i=(n.name=e.name,{}),a=new H(t);return Object.keys(e).filter((e=>!j.TextureNames.includes(e))).filter((e=>!j.IgnoredAttributes.includes(e))).map((t=>{var r=e[t],n=a[t];"color"!==t&&"emissive"!==t&&("normalScale"===t?r.x===n.x&&r.y===n.y||(i[t]=r):"uniforms"===t?Object.keys(r).map((t=>{const r=e.uniforms[t].value,n=a.uniforms[t].value;"windForce"===t||"windSpeed"===t||"windWaveScale"===t||"colorLevel"===t||"colorFade"===t||"leavesCore"===t?r!==n&&(i[t]=r):"colorGradient"===t&&r.getHexString()!==n.getHexString()&&(i[t]=r.getHexString())})):r!==n&&(i[t]=r))})),{material:n,normal:{type:I.tools.type,uniforms:i,name:e.name},textures:r}},clone:(e,t)=>e,copy:(e,t)=>{const r=I.tools.create(t);return Object.keys(r).filter((e=>!j.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,h.M)(e,"type",I.tools.type)},validType:e=>"TreeLeaf"===e.userData.type,snapshot:{getDiff:e=>S.LV.getDiff(N,e),set:e=>{const{map:t,material:r,runScene:n,data:i}=e;S.LV.set({def:N,data:i,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,l.updateMaterial)(r)}))}}};const z=new o.Clock;class H extends o.MeshStandardMaterial{constructor(e){super(),this.isSpecialMaterial=!0,this.uniforms={time:new o.Uniform(0),windForce:new o.Uniform(.3),windSpeed:new o.Uniform(.5),windWaveScale:new o.Uniform(.25),colorGradient:new o.Uniform(new o.Color(65280)),colorLevel:new o.Uniform(-.5),colorFade:new o.Uniform(-.25),leavesCore:new o.Uniform(.3),leavesSize:new o.Uniform(new o.Vector3),leavesPos:new o.Uniform(new o.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=U,e.fragmentShader=G,e.vertexShader=e.vertexShader.replace(/\/\/ Insert Noise3D/g,b)}}update(){this.uniforms.time.value=z.getElapsedTime()}setSize(e){var t=new o.Vector3;e.getWorldScale(t),t=new o.Vector3,(new o.Box3).setFromObject(e).getSize(t),this.uniforms.leavesSize.value=t}setWorldPos(e){var t=new o.Vector3;e.getWorldPosition(t),this.uniforms.leavesPos.value=t}}var V,J,K=r(263);const Z={color:s.Gf.color,opacity:s.Gf.opacity};class W{constructor(e){this.runScene=e}}(V=W).tools={type:"LineBasicMaterial",bind(e){(0,h.M)(e,"type","LineBasicMaterial")},create:()=>{var e=new o.LineBasicMaterial;return V.tools.bind(e),e},parseData:e=>{const{texture:t,normal:r,core:n,material:i}=e,{data:a,load:s}=t,o=[];return s&&o.push(...K.F6.filter(a.map((e=>{const{type:t,texture:r}=e;if(r)return()=>{n.runScene.uniqueEx.texture.addMaterial(r,{material:i,type:t})}})))),n.runScene.materialEx.parseNromals(r,i),V.tools.bind(i),{material:i,setTextureFns:o}},toNormal:e=>({material:e.clone(),normal:{type:V.tools.type},textures:[]}),clone:(e,t)=>e,copy:e=>e.clone(),getTextures:()=>[],snapshot:{getDiff:e=>S.LV.getDiff(Z,e),set:e=>{const{map:t,material:r,runScene:n,data:i}=e;S.LV.set({def:Z,data:i,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,l.updateMaterial)(r)}))}},validType:e=>e.type===V.tools.type};class X{constructor(e){this.runScene=e}}(J=X).tools={type:"MyPointsMaterial",bind(e){(0,h.M)(e,"type","MyPointsMaterial")},getTextures:e=>["map","alphaMap"].map((t=>{var r=e[t];if(r)return{type:t,texture:r}})).filter((e=>e)),create:(e,t)=>(t=t.modelEx.def.vertices.rain.createMaterial(e),J.tools.bind(t),t),parseData:(e,t)=>{var{texture:e,material:r,normal:n}=e;const{data:i,load:a}=e,s=[];var{name:e,size:n}=n;const o=X.tools.create({size:n},t);return(0,A.x)(o,(0,A.Ki)(r)),e&&(o.name=e),a&&s.push(...i.map((e=>{const{type:t,texture:r}=e;return()=>{o[t]=r,(0,l.updateMaterial)(o)}}))),{material:o,setTextureFns:s}},toNormal:e=>{const t=(0,l.createDefMaterial)();var r={type:X.tools.type,name:e.name,size:e.size};return t.map=e.map,t.userData=Object.assign({},t.userData),{normal:r,textures:X.tools.getTextures(e),material:t}},clone:e=>e,copy:e=>{const t=e.clone();return t.userData.type=X.tools.type,t}};const Q={SpriteMaterial:E.Z,FakeInterior:d,Fresnel:f,Matcap:g,MixTexture:B,Physical:T,Reflector:k,TreeLeaf:j,BasicMaterial:s.ZP,LineBasicMaterial:W,MyPointsMaterial:X};class Y{constructor(e){this.runScene=e,this.map={SpriteMaterial:new E.Z(e),FakeInterior:new d(e),Fresnel:new f(e),Matcap:new g(e),MixTexture:new B(e),Physical:new T(e),Reflector:new k(e),TreeLeaf:new j(e),BasicMaterial:new s.ZP(e)}}static create(e,t){return Q[e].tools.create(t)}static copy(e,t,r){return Q[e].tools.copy(t,r)}static clone(e,t){return Q[e].tools.clone(t)}static toNromal(e,t,r){return Q[e].tools.toNormal(t,r)}static parseData(e,t,r){var n=t.material;let i=e;return Q.LineBasicMaterial.tools.validType(n)&&(i=Q.LineBasicMaterial.tools.type),Q[i].tools.parseData(t,r)}static bind(e){e.material&&("MeshStandardMaterial"===e.material.type?s.ZP.tools.bind(e):"SpriteMaterial"===e.material.type&&E.Z.tools.bind(e))}static getTextures(e){var t=q(e);if(t)return Q[t].tools.getTextures(e);throw TypeError("该材质没有类型")}static parseNode(e){e.material&&(e=e.material,(0,l.isBaseMaterial)(e)&&s.ZP.tools.bind(e),e.isSpriteMaterial&&E.Z.tools.bind(e))}static validType(e,t){return!Q[e].tools.validType||Q[e].tools.validType(t)}}Y.snapshot={getDiff:e=>{var t=q(e);if(Q[t])return Q[t].tools.snapshot.getDiff(e);throw TypeError("该材质没有类型")},set:e=>{var t=e.material;if(t=q(t),Q[t])return Q[t].tools.snapshot.set(e);throw TypeError("该材质没有类型")}};const q=e=>{var t=e.userData.type;if(t)return Y.validType(t,e)?t:void 0}},932:(e,t,r)=>{r.r(t),r.d(t,{SpecialMaterial:()=>I,createDefMaterial:()=>w,defAllMaterialMap:()=>b,defBaseMaterialMap:()=>y,default:()=>x,disposeMaterial:()=>A,getBaseTextures:()=>C,getMaterialType:()=>k,getTextures:()=>B,getTexturesByMaterial:()=>M,initMaterial:()=>T,isBaseMaterial:()=>R,isColor:()=>_,isMaterial:()=>P,materialIgnore:()=>L,mergeMaterial:()=>S,setDefMaterialForSameGeo:()=>O,setMaterialTexture:()=>E,updateMaterial:()=>D});var n=r(1),i=r(881),a=r(330),s=r(794),o=r(736),l=r(625),u=r(24),c=r(510),h=r(729),d=r(723),p=r(707);class f{constructor(e){this.data=this.getData(),this.pending=[],this.clonedTextures=[],this.mount=e=>{e.core.module.set("material",this)},this.complete=()=>{this.reset()},this.load=e=>{e=e.data;var{materialDef:e,material:t,model:r}=e;T(t),this.data.materialIns[e.id]||(this.data.materialIns[e.id]={material:t,models:[]}),this.data.materialIns[e.id].models.push(r)},this.done=e=>{const{json:t,core:r}=e;var{materialMap:e,textureMap:n}=(null==(e=t.asset)?void 0:e.ex)||{};this.processTextureMap(n||{}),this.processMaterialMap(e||{},t),this.processClonedTextures(),this.pending.push(this.loadTextures(r)),r.pending.push(Promise.all(this.pending))},this.parser=null,this.loadTexture=e=>{e=e.data;const{textureDef:t,texture:r}=e;var{md5:e,format:n,size:i,uvScript:a,unDelAble:s,id:u,cloneSourceId:c,minFilter:h}=t;r.userData.md5=e,n&&(r.format=n,r.userData.format=n),a&&(r.userData.uvScript=a),c&&((0,l.setTextureCloneId)(r,c),this.clonedTextures.push(r)),"nearest"===h&&((0,l.setTextureMinFilter)(r,"nearest"),(0,o.M)(r,"minFilter",h)),s&&l.unDelAbleTexture.set(r,s),r.userData.id=u,r.userData.size=i,this.data.textureIns[t.id]=this.runScene.textureEx.getSameTexture(e,r)||r},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,n.mapObj)(t,((t,r)=>{var{format:r,center:n,rotation:i,offset:a,repeat:s}=r;const o=this.data.textureIns[t];o&&(o.format=r,e({target:o.repeat,data:s}),e({target:o.center,data:n}),e({target:o.offset,data:a}),i&&(o.rotation=i),this.runScene.textureEx.initTextureAndAddtoAll(o))}))}})(),this.processMaterialMap=(()=>{const e=e=>{const{textures:t,normal:r,models:i,material:a}=e;e=(0,n.mapObj)(t,((e,t)=>({type:e,texture:this.data.textureIns[t]})));const{material:s,setTextureFns:o}=this.runScene.materialEx.parseData(r.type,{normal:r,texture:{data:e,load:this.runScene.optionsEx.options.texture.load},core:this,models:i,material:a});s&&(0<o.length&&this.lazyLoadFns.push(...o),i.map((e=>e.material=s)))};return(t,r)=>{(0,n.mapObj)(t,((t,i)=>{if(t=this.data.materialIns[t]){const{material:a,models:s}=t;if(a){const{normal:o,textures:l}=i;o.type||(o.type=p.ZP.tools.type),"scene"===(null==(i=null==(t=r.asset)?void 0:t.ex)?void 0:i.type)&&r.asset.ex.sceneEx.materialId===a.userData.id&&(0,n.mapObj)(l,((e,t)=>{t=this.data.textureIns[t],E({material:a,type:e,texture:t})})),e({textures:l,models:s,material:a,normal:o}),a.needsUpdate=!0}}}))}})(),this.lazyLoadFns=[],this.loadTextures=(()=>{const e=e=>{e.callback("lazyLoadedTexture",""),this.runScene.optionsEx.log("贴图懒加载完毕","base","success")},t=(r,n,i)=>{const a=this.lazyLoadFns[r];if(!a)return n(0),e(i);a(),setTimeout((()=>t(++r,n,i)),this.runScene.optionsEx.options.texture.lazyLoad.intervalTime)};return e=>new Promise((r=>{this.runScene.optionsEx.options.texture.lazyLoad.open?t(0,r,e):(this.lazyLoadFns.map((e=>e())),r(0))}))})(),this.afterParse=e=>{const{data:t,core:r,json:n}=e;if("material"===(null==(e=null==(e=n.asset)?void 0:e.ex)?void 0:e.type)){e=t.options.models;const[n]=e,i=[];n.material?(this.runScene.materialEx.add(n.material),i.push(n.material)):n.children.map((e=>{e.material&&(i.push(e.material),this.runScene.materialEx.add(e.material))})),r.models.push(...i)}},this.runScene=e}getData(){return{materialMap:{},textureMap:{},materialIns:{},textureIns:{}}}getMap(){return new s.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,r,n){return new(r=r||Promise)((function(t,i){function a(e){try{o(n.next(e))}catch(e){i(e)}}function s(e){try{o(n.throw(e))}catch(e){i(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(a,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){this.parser=t}))}processClonedTextures(){this.clonedTextures.map((e=>{var t=(0,l.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,l.bindTextureBaseData)(e)):(this.runScene.textureEx.delete(e),(0,o.bv)(e,"cloneSourceId"),(0,l.disposeTexture)(e))}))}reset(){this.clonedTextures=[],this.data=this.getData(),this.pending=[]}}var m=r(880);t=r(110);class v{constructor(e){this.getDiff=()=>{let e={};return this.runScene.uniqueEx.material.getAll("values").map((t=>{t=t.material;var r=(0,m.ee)(t);r&&m.Ws[r].tools.snapshot&&(r=(0,h.Ki)(t))&&(e[r]=m.ZP.snapshot.getDiff(t))})),e},this.create=e=>{e.data.set("material",this.getDiff())},this.set=e=>{var t=e.snapshot.data.get("material");t&&(0,n.mapObj)(t,((t,r)=>{(t=this.runScene.uniqueEx.material.get(t))&&m.ZP.snapshot.set({material:t,data:r,runScene:this.runScene,map:e})}))},this.runScene=e,this.runScene.cb.snapshot.create.add("material",this.create),this.runScene.cb.snapshot.set.add("material",this.set)}}var g=function(e,t,r,n){return new(r=r||Promise)((function(i,a){function s(e){try{l(n.next(e))}catch(e){a(e)}}function o(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(s,o)}l((n=n.apply(e,t||[])).next())}))};const y={depthTest:!0,depthWrite:!0,alphaTest:0,side:0,displacementScale:1,visible:!0,normalScale:{x:1,y:1},aoMapIntensity:1,lightMapIntensity:1,envMapIntensity:1,fog:!0},b=["color","emissive","roughness","metalness","normalScale","aoMapIntensity","displacementScale","transparent","lightMapIntensity","envMapIntensity","opacity","alphaTest","fog"];class x{constructor(e){this.clean=()=>{this.dispose()},this.defMaterial=w(),this.addCb=e=>{this.runScene.cb.material.add.cb(e)},this.runScene=e,this.def=new m.ZP(e),this.snaphot=new v(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 f(e)}init(){var e={name:"material",loadCallBacks:this.import.getMap(),exportCallBacks:new s.Z};this.runScene.exporter.gltf.module.bind(e)}parse(e){m.Ws.LineBasicMaterial.tools.validType(e)&&m.Ws.LineBasicMaterial.tools.bind(e),this.setEnvStrength(e,this.runScene.sceneEx.envStrength)}add(e,t,r){L.is(e)||this.runScene.uniqueEx.material.add(e,t,r)}setEnvStrength(e,t,r=!1){void 0===e.envMapIntensity||e.envMapIntensity===t||!r&&e.envMapIntensity!==this.runScene.sceneEx.envStrength||(e.envMapIntensity=t,D(e))}create(e="BasicMaterial"){return e=m.ZP.create(e,this.runScene),this.add(e),e}toArray(){return(0,n.mapObj)(this.runScene.uniqueEx.material.map,((e,t)=>t.material))}copy(e){var t=k(e);if(t){const r=m.ZP.copy(t,e,this.runScene);return r.userData.id=(0,n.getId)(),r}}clone(e){var t=k(e);if(t){const r=m.ZP.clone(t,e);return r.userData.id=(0,n.getId)(),r}}setNormals(e,t=!0){const{info:r,newVal:n,materials:i,oldval:a,cb:s}=e;let o=n;return o.isVector2&&(o=o.clone()),e=i.map((e=>new u.Z({info:r,target:e,newVal:o,oldVal:a||e[r],runScene:this.runScene,cb:s}).execute())),t&&this.runScene.undoEx.addUndo(e),e}setNormal(e,t=!0){return e=new u.Z(Object.assign(Object.assign({},e),{runScene:this.runScene})).execute(),t&&this.runScene.undoEx.addUndo(e),e}setTextures(e,t=!0){return g(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,l.setTextureMapping)(e.newVal);var s=i.map((t=>new u.Z({info:r,target:t,newVal:e.newVal,oldVal:a||t[r],runScene:this.runScene}).execute()));return t&&this.runScene.undoEx.addUndo(s),i[0][r]}))}setTexture(e,t=!0){return g(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,l.setTextureMapping)(e.newVal),new u.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,d.Gm)({addUndo:!0,includeChild:!1},r);if(e&&t){const r=new Set;((0,d.lG)(e,"array")?e:[e]).map((e=>{i?e.traverse((e=>{R(e.material)&&r.add(e)})):e.material&&r.add(e)}));const a=[];r.forEach((e=>{a.push(new c.Z({target:e,runScene:this.runScene,info:"material",newVal:t,oldVal:e.material}).execute())})),this.runScene.modelEx.select===e&&this.runScene.cb.setSelectMaterial.cb(t),n&&this.runScene.undoEx.addUndo(a)}}toNromal(e){var t=k(e);if(t){const r=m.ZP.toNromal(t,e,this.runScene);return r.material.userData=Object.assign(Object.assign({},r.material.userData),e.userData),r}}setSelect(e){this.select=e,this.runScene.cb.setSelectMaterial.cb(e)}parseData(e,t){return m.ZP.parseData(e,t,this.runScene)}dispose(){this.runScene.cb.material.dispose.cb("")}remove(e){const t=this.runScene.uniqueEx.material.getModels((0,h.Ki)(e));t&&(this.resetMaterial(t.toArray(),w()),this.runScene.cb.material.remove.cb(e))}getDefNromals(e){var t;return"BasicMaterial"!==(null==(t=e.userData)?void 0:t.type)?{}:(0,d.ad)(y,e)}parseNromals(e,t){(0,n.mapObj)(e,((e,r)=>{var n,i,a,s,o;void 0!==y[e]&&("object"==typeof r?(({x:a,y:s,z:o}=r),null!=(i=null==(n=t[e])?void 0:n.set)&&i.call(n,a,s,o)):t[e]=r)}))}isBaseMaterial(e){return"MeshStandardMaterial"===e.type&&"BasicMaterial"===e.userData.type&&!e.userData.isTimeLineUsed&&p.ZP.isDefVal(e)}setByType(e,t){"SpriteMaterial"===e&&!t.isSprite||(e=this.create(e))&&(this.add(e),this.runScene.modelEx.setMaterial(t,e))}}const w=e=>{const t=new i.MeshStandardMaterial(e);return t.userData.id=(0,n.getId)(),p.ZP.tools.bind(t),t},S=(e,t)=>(b.map((r=>{const n=e[r];"object"==typeof n&&(t[r]=n.clone()),t[r]=n})),t),A=e=>{e.dispose();const t=M(e);0!==t.length&&t.map((e=>{e=e.texture,(0,l.disposeTexture)(e)}))},M=e=>C(e),B=e=>m.ZP.getTextures(e)||C(e),C=e=>a.zX.map((t=>({type:t,texture:e[t]}))).filter((e=>e.texture)),E=e=>{const{material:t,type:r,texture:n}=e;"envMap"===r&&(0,l.setTextureMapping)(n),t[r]=n,t.needsUpdate=!0},T=e=>{e.vertexColors=!1,e.depthWrite=!0,e.needsUpdate=!1},_=e=>null==e?void 0:e.isColor,D=e=>{e.needsUpdate=!0},P=e=>null==e?void 0:e.isMaterial,O=e=>{},R=e=>(null==e?void 0:e.isMeshStandardMaterial)&&!e.isSpecialMaterial,I={Sprite:t.Z},k=e=>{var t;return(null==(t=null==e?void 0:e.userData)?void 0:t.type)||(null==e?void 0:e.type)},L={set(e,t){t?(0,o.M)(e,"ignore",!0):delete e.userData.ignore},is:e=>!0===(0,o.is)(e,"ignore")}},707:(e,t,r)=>{r.d(t,{ZP:()=>g,Gf:()=>v});var n=r(881),i=r(330),a=r(263),s=r(736);const o="\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 ";var p,f=r(398),m=r(932);const v={color:{type:"color",val:{r:1,g:1,b:1},shortKey:"clr"},map:{type:"texture",val:null,shortKey:"map"},emissiveMap:{type:"texture",val:null,shortKey:"em"},roughnessMap:{type:"texture",val:null,shortKey:"rm"},emissive:{type:"color",val:{r:0,g:0,b:0},shortKey:"emi"},roughness:{type:"number",val:1,shortKey:"rgh"},metalness:{type:"number",val:0,shortKey:"meta"},metalnessMap:{type:"texture",val:null,shortKey:"mm"},lightMap:{type:"texture",val:null,shortKey:"lm"},lightMapIntensity:{type:"number",val:1,shortKey:"lmi"},envMap:{type:"texture",val:null,shortKey:"envm"},envMapIntensity:{type:"number",val:1,shortKey:"envI"},opacity:{type:"number",val:1,shortKey:"opc",before:({target:e,end:t})=>{t<1&&!e.transparent&&(e.transparent=!0,(0,m.updateMaterial)(e))}},depthTest:{type:"other",val:!0,shortKey:"dt"},depthWrite:{type:"other",val:!0,shortKey:"dw"},fog:{type:"other",val:!0,shortKey:"fo"},wireframe:{type:"other",val:!1,shortKey:"wf"},alphaMap:{type:"texture",val:null,shortKey:"alpm"}};class g{constructor(e){this.init(e)}init(e){e.cb.material.add.add("base-material",(e=>{(0,m.isBaseMaterial)(e)&&"MeshPhysicalMaterial"!==e.type&&(g.tools.bind(e),e.userData.uvCount||(e.userData.uvCount=new n.Uniform(1)),e.onBeforeCompile=t=>{t.uniforms.uvCount=e.userData.uvCount,t.vertexShader=t.vertexShader.replace(/#include <uv2_pars_vertex>/g,l),t.vertexShader=t.vertexShader.replace(/#include <uv2_vertex>/g,u),t.fragmentShader=t.fragmentShader.replace(/#define STANDARD/g,o),t.fragmentShader=t.fragmentShader.replace(/#include <uv2_pars_fragment>/g,c),t.fragmentShader=t.fragmentShader.replace(/#include <map_fragment>/g,h),t.fragmentShader=t.fragmentShader.replace(/#include <emissivemap_fragment>/g,d)})}))}static isDefVal(e){for(const t in this.defVal){const r=this.defVal[t],i=e[t];if(r instanceof n.Color){if(r.getHexString()!==i.getHexString())return!1}else if("object"==typeof r){if(i.x!==r.x)return!1}else if(i!==r)return!1}for(const t of i.zX)if(e[t])return!1;return!0}create(){return(0,m.createDefMaterial)()}}(p=g).tools={type:"BasicMaterial",bind(e){(0,s.M)(e,"type","BasicMaterial")},create:()=>{var e=new n.MeshStandardMaterial;return p.tools.bind(e),e},parseData:e=>{const{texture:t,normal:r,core:n,material:i}=e,{data:s,load:o}=t,l=[];return o&&l.push(...a.F6.filter(s.map((e=>{const{type:t,texture:r}=e;if(r)return()=>{n.runScene.uniqueEx.texture.addMaterial(r,{material:i,type:t}),(0,m.setMaterialTexture)({material:i,type:t,texture:r})}})))),n.runScene.materialEx.parseNromals(r,i),{material:i,setTextureFns:l}},toNormal:e=>({material:e.clone(),normal:{type:g.tools.type},textures:(0,m.getBaseTextures)(e)}),clone:(e,t)=>e,copy:e=>e.clone(),getTextures:e=>(0,m.getBaseTextures)(e),snapshot:{getDiff:e=>f.LV.getDiff(v,e),set:e=>{const{map:t,material:r,runScene:n,data:i}=e;f.LV.set({def:v,data:i,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,m.updateMaterial)(r)}))}},validType:e=>"MeshStandardMaterial"===e.type},g.defVal={color:new n.Color(16777215),emissive:new n.Color(0),roughness:1,metalness:0,lightMapIntensity:1,aoMapIntensity:1,emissiveIntensity:1,bumpScale:1,normalScale:new n.Vector2(1,1),displacementScale:1,envMapIntensity:1,wireframe:!1,transparent:!1,depthTest:!0,depthWrite:!0,opacity:1,fog:!0}},110:(e,t,r)=>{r.d(t,{Z:()=>h});var n,i=r(881),a=r(749),s=r(736),o=r(398),l=r(729),u=r(932);const c={color:(t=r(707)).Gf.color,map:t.Gf.map,opacity:t.Gf.opacity};class h{constructor(e){this.modelParse={toNormal:e=>{e=e.model;const t=(0,a.createDefModel)("Box");return t.userData.normal=Object.assign({type:"MySpriteMaterial"},e.userData),t.material=e.material,h.modelTools.merge(e,t),t},parse:e=>{var{model:e,normal:t}=e;const r=(0,a.createDefModel)("Sprite");var n=e.userData.layers;return(0,a.setLayers)(r,n),r.userData=Object.assign(Object.assign({},t),r.userData),h.modelTools.merge(e,r),r.material=e.material,r}},this.runScene=e;const t=h.modelTools.type,{parse:r,toNormal:n}=this.modelParse;e.cb.inited.add("MySpriteMaterial",(()=>{e.modelEx.importAndExport.addParses(t,{parse:r,toNormal:n})}))}}(n=h).tools={type:"SpriteMaterial",bind(e){(0,s.M)(e,"type","SpriteMaterial")},getTextures:e=>["map","alphaMap"].map((t=>{var r=e[t];if(r)return{type:t,texture:r}})).filter((e=>e)),create:()=>{var e=new i.SpriteMaterial;return n.tools.bind(e),e},parseData:(e,t)=>{var{texture:e,material:r,normal:n}=e;const{data:i,load:a}=e,s=[],o=(0,u.mergeMaterial)(r,h.tools.create(t));(0,l.x)(o,(0,l.Ki)(r));var{depthWrite:e,depthTest:t,name:r,fog:n}=n;return!1===n&&(o.fog=!1),void 0!==e&&(o.depthWrite=e),void 0!==t&&(o.depthTest=t),r&&(o.name=r),a&&s.push(...i.map((e=>{const{type:t,texture:r}=e;return()=>{o[t]=r}}))),{material:o,setTextureFns:s}},toNormal:e=>{const t=(0,u.mergeMaterial)(e,(0,u.createDefMaterial)());var r=Object.assign({},t.userData);const n={type:h.tools.type,name:e.name};return e.fog||(n.fog=!1),e.depthWrite!==u.defBaseMaterialMap.depthWrite&&(n.depthWrite=e.depthWrite),e.depthTest!==u.defBaseMaterialMap.depthTest&&(n.depthTest=e.depthTest),t.userData=r,{normal:n,textures:h.tools.getTextures(e),material:t}},clone:e=>e,copy:e=>{const t=e.clone();return t.userData.type=h.tools.type,t},snapshot:{getDiff:e=>o.LV.getDiff(c,e),set:e=>{const{map:t,material:r,runScene:n,data:i}=e;o.LV.set({def:c,data:i,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,u.updateMaterial)(r)}))}}},h.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,t.name=e.name,(0,s.M)(e,"name",e.name),(0,a.setLayers)(t,1===e.layers.mask?0:1)},toNormal:e=>{const t=(0,a.createDefModel)("Box");return t.userData.normal=Object.assign({type:"MySpriteMaterial"},e.userData),t.material=e.material,h.modelTools.merge(e,t),t},parseData:(e,t)=>{const r=(0,a.createDefModel)("Sprite");var n=e.userData.layers;return(0,a.setLayers)(r,n),r.userData=Object.assign(Object.assign({},t),r.userData),h.modelTools.merge(e,r),r.material=e.material,r},type:"MySpriteMaterial"}},801:(e,t,r)=>{r.d(t,{Ju:()=>a,t9:()=>i,zf:()=>s});var n=r(736);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)}},s={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||s.isLock(e.parent,t):void 0!==r&&r}}},749:(e,t,r)=>{r.r(t),r.d(t,{createDefModel:()=>N,createSpecialModel:()=>G,default:()=>U,delClonedModel:()=>ee,deletedModel:()=>F.Ju,disposeModel:()=>j,dynamicModel:()=>F.t9,getClonedIdModel:()=>q,getDeepModels:()=>W,getIdMapByModel:()=>ue,getModelSize:()=>ie,hasSkeleton:()=>X,helperModel:()=>oe,instanceModel:()=>z,isDynamicModel:()=>Y,isGLowModel:()=>te,isGroup:()=>ne,isHelper:()=>K,isSprite:()=>re,lockModel:()=>F.zf,mergeModel:()=>H,normalModel:()=>se,selectableModel:()=>ae,setClonedModel:()=>$,setDynamicModel:()=>Q,setHelper:()=>J,setLayers:()=>Z,tempModel:()=>ce,uselessGroup:()=>le,withAnima:()=>V}),t=r(356);var n=r.n(t),i=r(1),a=r(881);function s(e){for(var t,r,n,i=0,s=0;s<e.length;++s){var o=e[s];if(o.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if((t=void 0===t?o.array.constructor:t)!==o.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?o.itemSize:r)!==o.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if((n=void 0===n?o.normalized:n)!==o.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;i+=o.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 a.BufferAttribute(l,r,n)}var o=r(230);const l=["Group","Box","Circle","Cylinder","Dodecahedron","Icosahedron","Lathe","Octahedron","Plane","Ring","Sphere","Sprite","Tetrahedron","Torus","TorusKnot","Tube","Reflector","VerticesRain"];var u=r(794),c=r(272),h=r(247),d=r(269),p=r(880),f=r(932),m=r(736);class v extends r(773).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 g=r(735),y=r(510);class b extends r(616).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 x=b;var w=r(169),S=r(380),A=r(729),M=r(814);class B{constructor(e){this.definfo={speed:1,size:10,length:2e3},this.map=new u.Z,this.modelParse={toNormal:e=>{const{model:t,runScene:r}=e,n=N("Box");e=(0,A.Ki)(t);var i=r.modelEx.def.vertices.rain.map.get(e);if(n.material=t.material,!e||!i)throw TypeError("缺少属性");var{length:e,size:i,speed:a}=i;return n.userData.normal={type:B.modelTools.type,length:e,size:i,speed:a,materialId:(0,A.Ki)(t.material)},n},parse:e=>{const{runScene:t,normal:r,model:n}=e,i=t.modelEx.def.create(B.modelTools.type,r);return i.material=n.material,i.material.userData.id=r.materialId,i}},this.update=()=>{const e=this.runScene.assetsEx.get().camera;this.map.map(((t,r)=>{const{model:n,length:i,speed:a,del:s}=r;if(!s){n.position.set(e.position.x,e.position.y,e.position.z);for(let e=0;e<i;e++)n.geometry.attributes.position.setY(e,n.geometry.attributes.position.getY(e)-a),0<=a?n.geometry.attributes.position.getY(e)<=-1e3&&n.geometry.attributes.position.setY(e,1e3):1e3<=n.geometry.attributes.position.getY(e)&&n.geometry.attributes.position.setY(e,-1e3),n.geometry.attributes.position.needsUpdate=!0}}))},this.tools={type:"VerticesRain",merge:function(e,t){},toNormal:function(e){const t=N("Box");var r=(0,A.Ki)(e),n=this.map.get(r);if(t.material.map=e.material.map,r&&n)return t.userData.normal=Object.assign({type:this.tools.type},n),t;throw TypeError("缺少属性")},parseData:function(e,t){}},(this.runScene=e).cb.render.add("verticesRain",this.update),e.cb.model.add.add("verticesRain",(({model:e})=>{var t;if((null==(t=e.userData.normal)?void 0:t.type)===this.tools.type){const t=this.map.get((0,A.Ki)(e));t&&(t.del=!1)}})),e.cb.model.remove.add("verticesRain",(({model:e})=>{var t;if((null==(t=e.userData.normal)?void 0:t.type)===this.tools.type){const t=this.map.get((0,A.Ki)(e));t&&(t.del=!0)}})),e.cb.clean.add("verticesRain",(()=>{this.map.clear()}));const{toNormal:t,parse:r}=this.modelParse;e.cb.inited.add("VerticesRain",(()=>{e.modelEx.importAndExport.addParses(B.modelTools.type,{toNormal:t,parse:r})}))}bindMaterial(e,t){(0,m.M)(e,"id",t||(0,i.getId)()),(0,m.M)(e,"type","MyPointsMaterial")}create(e){var t=(e=e||this.definfo).length;const r=new M.Sf.Points(this.createGeo(t),this.createMaterial(e));return r.name="雨雪",r.renderOrder=1,t=(0,i.getId)(),(0,m.M)(r,"id",t),this.bindMaterial(r.material),(0,m.M)(r,"type",this.tools.type),(0,m.M)(r,"normal",{type:this.tools.type}),this.map.set(t,{model:r,length:e.length,size:e.size,speed:e.speed,del:!1}),r}createGeo(e){let t=[];const r=new a.BufferGeometry;for(let r=0;r<e;r++){var n=2e3*Math.random()-1e3,i=2e3*Math.random()-1e3,s=2e3*Math.random()-1e3;t.push(n,i,s)}return r.setAttribute("position",new a.Float32BufferAttribute(t,3)),r}createMaterial(e){var{size:e,map:t}=e;return new M.Sf.PointsMaterial({blending:M.Sf.AdditiveBlending,depthTest:!1,transparent:!0,size:e,map:t})}setForModel(e){var{model:e,type:t,data:r}=e;(e=(0,A.Ki)(e))&&this.set(e,t,r)}set(e,t,r){const n=this.map.get(e);if(n){const{model:e,size:a}=n;switch(t){case"show":e.visible=r;break;case"length":e.geometry=this.createGeo(r),n[t]=r;break;case"size":var i=e.material;e.material=this.createMaterial({map:e.material.map,size:r}),this.bindMaterial(e.material,(0,A.Ki)(i)),n[t]=r;break;case"speed":n[t]=r;break;case"texture":i=e.material,e.material=this.createMaterial({map:r,size:a}),this.bindMaterial(e.material,(0,A.Ki)(i))}}}}B.modelTools={type:"VerticesRain",parseData:function(e,t,r){const n=r.modelEx.def.create(B.modelTools.type,t);return n.material=e.material,n.material.userData.id=t.materialId,n},toNormal:(e,t,r)=>{const n=N("Box");var i=(0,A.Ki)(e);if(t=t.modelEx.def.vertices.rain.map.get(i),n.material=e.material,!i||!t)throw TypeError("缺少属性");var{length:i,size:t,speed:a}=t;return n.userData.normal={type:B.modelTools.type,length:i,size:t,speed:a,materialId:(0,A.Ki)(e.material)},n}};class C{constructor(e){this.runScene=e,this.rain=new B(e)}}class E{constructor(e){this.runScene=e,this.vertices=new C(e)}create(e,t){let r;return"VerticesRain"===e?r=this.vertices.rain.create(t):l.includes(e)&&(r=n().model.getModelByType(e,t)),p.ZP.parseNode(r),r}}var T=r(457);class _{constructor(e){this.runScene=e}init(){this.bindEvent()}bindEvent(){}}var D=r(143),P=r(110);class O{constructor(e){this.data=this.getData(),this.parses=new u.Z,this.nodeType={MySpriteMaterial:P.Z,VerticesRain:B},this.mount=e=>{e.core.module.set("model",this)},this.complete=()=>{this.data=this.getData()},this.loadNodeDef=e=>{let{node:t,nodeDef:r}=e;(0,i.mapObj)(this.runScene.modelEx.defNodeMap,((e,n)=>{var i=r[e];null!=i&&(t[e]=i)})),r.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=>{const{config:t,data:r,json:n,core:i}=e;if("model"===(null==(e=null==(e=n.asset)?void 0:e.ex)?void 0:e.type)){if(null==(e=t.module)||!e.model)return[];let n=["glb_model"===(e=(e=r.options).models[0]).name&&(null==e?void 0:e.children[0])||e];var[e]=n;le.is(e)&&(n=[...e.children]),i.models.push(...n),this.mergeClone()}},this.toNromal=e=>{var t=e.type;const r=this.parses.get(t);if(r)return r.toNormal(e)},this.parse=e=>{var t=e.type;const r=this.parses.get(t);if(r)return r.parse(e)},this.runScene=e}getData(){return{map:new u.Z,clonedMap:{},instancedMap:{},helperModels:[]}}getMap(){return new u.Z({loadNode:this.load,loadedGltf:this.done,afterParse:this.afterParse,complete:this.complete,mountModule:this.mount})}addParses(e,t){this.parses.set(e,t)}loadExtras(e,t){let{node:r,nodeDef:n}=e;if(n.extras){const{layers:o,normal:l,local:u,cloneId:c,id:h,animations:d,isDynamic:p}=n.extras;var i,a=Y(r,!0),s=("running"!==this.runScene.optionsEx.options.mode||a||null!=(s=this.runScene.optionsEx.options.renderConfig)&&s.matrixAutoUpdate||(r.matrixAutoUpdate=!1),d&&(r.animations=D.B.parse(d)),p&&(r.userData.isDynamic=!0),!c||a||(this.data.instancedMap[c]||(this.data.instancedMap[c]=new Set),this.data.instancedMap[c].add(r)),u&&([s,a,i]=u.split(","),r.position.set(s,a,i)),o&&(r.layers.enable(1),this.runScene.cb.model.setLayers.cb({model:r,val:1})),n.extras.isHelper&&this.data.helperModels.push(r),l&&(e.node=this.parse({type:l.type,model:e.node,normal:l,runScene:this.runScene})),h&&this.data.map.set(h,e.node),null==(i=null==(a=null==(s=e.node)?void 0:s.material)?void 0:a.userData)?void 0:i.id);if(s){const r=t.module.get("material").data.materialIns[s];r&&r.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,i.mapObj)(e,((e,t)=>{var r,n=this.runScene.uniqueEx.model.map[e];t.size<2||!n||!n.geometry||Y(n,!0)||(r=z(n,[...t]),this.runScene.modelEx.add(r,void 0,{isClone:!1,select:!1,addUndo:!1}),te(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.data.instancedMap[e])}))),this.data.instancedMap={}}mergeGeometry(){}}var R=r(228),I=r(398);const k={position:{type:"v3",val:{x:0,y:0,z:0},shortKey:"po"},rotation:{type:"v3",val:{x:0,y:0,z:0},shortKey:"ro"},scale:{type:"v3",val:{x:1,y:1,z:1},shortKey:"scl"},visible:{type:"other",val:!0,shortKey:"vi"},castShadow:{type:"other",val:!1,shortKey:"ca"},receiveShadow:{type:"other",val:!1,shortKey:"rec"},renderOrder:{type:"other",val:0,shortKey:"ren"}};class L{constructor(e){this.create=e=>{e.data.set("model",this.getDiff())},this.set=e=>{var t=e.snapshot.data.get("model");if(t){const r=e.data.completedCbs;this.runScene.pp.clearAllOutlineObj(),(0,i.mapObj)(t,((t,n)=>{const i=this.runScene.uniqueEx.model.get(t);i&&(I.LV.set({def:k,runScene:this.runScene,data:n,target:i,map:e}),void 0!==n.visible&&n.visible&&(i.visible=n.visible),r.push((()=>{this.runScene.modelEx.setGlow(i,!!n.isGLow),n.isOutline&&this.runScene.pp.addOutlineObj(i)})))}))}},this.runScene=e,this.runScene.cb.snapshot.create.add("scene",this.create),this.runScene.cb.snapshot.set.add("scene",this.set)}getDiff(){const e={};return this.runScene.sceneEx.getClearModels().map((t=>{t.traverse((t=>{var r=(0,A.Ki)(t);r&&(e[r]=I.LV.getDiff(k,t),te(t)&&(e[r].isGLow=!0),(0,R.S)(t)&&(e[r].isOutline=!0))}))})),e}getData(){}}var F=r(801);class U{constructor(e){this._selectModel=void 0,this.geometryMap=new u.Z,this.clonedMap=new u.Z,this.defNodeMap={castShadow:!1,receiveShadow:!1,renderOrder:0,visible:!0},this.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,r,n)=>{var{addUndo:i,isClone:a,select:s,addToTree:o}=(0,T.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),o=new v({model:t,parent:r||this.runScene.sceneEx.get(),isClone:a,addTree:o,runScene:this.runScene}).execute(),!0===i&&this.runScene.undoEx.addUndo(o),s&&this.setSelectByModel(t,{isDomTreeActive:!1,isClone:a}),o)}})(),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,a,s=X(t),o=(e=>{const t={};return(0,T.getModelMap)(e,"id",(e=>{0<e.animations.length&&(t[(0,A.Ki)(e)]=e.animations)})),t})(t),l=(s=s?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,m.M)(s,"cloneId",q(l)||l.userData.id),(0,m.is)(t,"isDynamic")&&Q(s,!0),(0,T.getModelMap)(s,"id"));u=s,(a=null==t?void 0:t.material)&&(n=p.ZP.clone((0,p.ee)(a),a))&&n.uuid!==a.uuid&&(e.materialEx.resetMaterial(u,n,{addUndo:!0}),e.materialEx.add(n,t,a));{var u={newModel:s,newModelMap:l,animaMap:o};const{animaMap:t,newModelMap:r}=u;(0,i.mapObj)(t,((t,n)=>{const a=r[t],s={};a&&(a.animations=[...n.map((e=>{const t=e.clone();return t.tracks.map((e=>{var[t]=e.name.split(".");s[t]||(s[t]=[]),s[t].push(e)})),t}))],(0,i.mapObj)(s,((t,r)=>{var n=a.getObjectByName(t);if(n){(0,m.M)(n,"id",(0,i.getId)());const a=e.uniqueEx.model.parseName(n);r.map((e=>{e.name=a+e.name.slice(t.length)}))}})))}))}return r&&e.uniqueEx.model.add(s,{hasReset:!0}),s})(e),this.runScene.cb.clean.add("EngineModel",this.clean),this.export=new _(e),this.importAndExport=new O(e),this.snapsot=new L(e),this.def=new E(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.importAndExport.getMap(),exportCallBacks:new u.Z};this.runScene.exporter.gltf.module.bind(e)}setGeometryMap(e){if((0,T.validType)(e,"array"))return e.map((e=>this.setGeometryMap(e)));var t;e.geometry&&(t=e.geometry.uuid,this.geometryMap.get(t)||this.geometryMap.set(t,new Set),this.geometryMap.get(t).add((0,A.Ki)(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,T.sameArr)([...e.array],[...t.array],20),t=(0,T.sameArr)([...r.array],[...i.array],20),r=(0,T.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,T.validType)(e,"array"))return e.map((e=>this.setGeometryMap(e)));var t=q(e);(t||this.getClonedIdFromModel(e))&&(this.clonedMap.get(t)||this.clonedMap.set(t,new c.Z),this.clonedMap.get(t).add((0,A.Ki)(e)),this.setCloneMap(e.children))}removeCloneMap(e){this.clonedMap.get((0,A.Ki)(e))}replaceClonedGroup(e,t){t=q(t)||(0,A.Ki)(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:s}=t;this.remove(t,!1);const o=this.runScene.modelEx.clone(e);o.userData.id=(0,A.Ki)(t),o.position.copy(r),o.rotation.copy(n),o.scale.copy(i),o.name=a,this.add(o,s,{addUndo:!1,isClone:!0,select:!1})}})))}replaceGeometry(e,t){t=t.uuid;const r=this.geometryMap.get(t);r&&0!==r.size&&(r.forEach((t=>{const r=this.runScene.uniqueEx.model.get(t);r&&(r.geometry=e,r.updateMatrix())})),this.geometryMap.delete(t),this.geometryMap.set(e.uuid,r))}setSelectByModel(e,t){this.runScene.optionsEx.log([e,"选中的模型",(0,A.Ki)(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&&(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 r=[];Array.isArray(e)?r.push(...e):r.push(e),e=r.map((e=>new w.Z({runScene:this.runScene,model:e,parent:e.parent||this.runScene.sceneEx.get()}).execute())),t&&this.runScene.undoEx.addUndo(e)}isNavieV3(e,t){var{x:e,y:r,z:n}=e;return e===(t=t?1:0)&&r===t&&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,!1)&&this.isNavieV3(e.rotation,!1)&&this.isNavieV3(e.scale,!0)&&0===e.children.length&&!V(e)}isUnlessLevel(e){return this.isNavieV3(e.position,!1)&&this.isNavieV3(e.rotation,!1)&&this.isNavieV3(e.scale,!0)&&1===e.children.length&&!V(e)}create(){var e=n().model.getModelByType("Box");return p.ZP.parseNode(e),e}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 x({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:s,oldV3:o}=e;var l,u;if(s.isVector3||s.isEuler||(({x:c,y:l,z:u}=s),s=new a.Vector3(c,l,u)),(0,T.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:o||e[i].clone(),newV3:s}).execute(r))):new S.Z({target:n,info:i,oldV3:o||n[i].clone(),newV3:s,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:s}=e;return e=r instanceof Array?r.map((e=>new y.Z({target:e,info:i,runScene:this.runScene,oldVal:n||r[i],newVal:a,executeCb:s}).execute())):new y.Z({target:r,info:i,runScene:this.runScene,oldVal:n||r[i],newVal:a,executeCb:s}).execute(),t&&this.runScene.undoEx.addUndo(e),e}setMaterial(e,t,r=!0){var n=new y.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(this.def.create(e),void 0,{select:!0})}isModel(e){return!(e.isLight||e.isCamera)}getSphere(){var e=new a.MeshBasicMaterial,t=new a.SphereGeometry(.7,150,150);return new a.Mesh(t,e)}getIndexByModel(e){var t;return e.parent?null==(t=e.parent)?void 0:t.children.findIndex((t=>t===e)):-1}getBeTweenChildByTwoModel(e,t){if(e.parent.uuid===t.parent.uuid){var r=this.getIndexByModel(e);if(t=this.getIndexByModel(t),-1!==r&&-1!==t){const n=Math.max(r,t),i=r===n?t:r;return e.parent.children.map(((e,t)=>t>i&&t<n&&e)).filter((e=>e))}}}setMultip(e){var{model:e,typeList:t,newVal:r}=e;this.runScene.undoEx.addUndo(new g.Z({target:e,typeList:t,newVal:r}).execute())}createGroup(e,t,r){const n=t||new a.Group,i=[];i.push(new v({model:n,runScene:this.runScene,parent:r||this.runScene.assetsEx.get().scene}).execute()),e instanceof Array?i.push(...e.map((e=>new x({target:e,oldParent:e.parent,newParent:n,runScene:this.runScene}).execute()))):i.push(new x({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 x({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 w.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 s=a.map((e=>new y.Z({target:e,info:"visible",newVal:!1,runScene:this.runScene,oldVal:e.visible}).execute()));this.runScene.undoEx.addUndo(s),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 y.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 w.Z({runScene:this.runScene,model:e,parent:e.parent}).execute())})),this.runScene.undoEx.addUndo(r)}_getModel(e){var t=this.runScene.uniqueEx.model.nameMap[e];if(t)return this.runScene.uniqueEx.model.get(t)||this.runScene.assetsEx.scene.getObjectByName(e)}getModel(e,t="array"){if(!(e instanceof Array))return this._getModel(e);if("array"===t)return e.map((e=>this._getModel(e)));if("map"===t){const t={};return e.map((e=>{t[e]=this.getModel(e)})),t}}getWorldLocal(e){this.runScene.assetsEx.scene.updateMatrixWorld(!0);var t=new a.Vector3;return e.getWorldPosition(t),t}getClickObj(e,t,r=!1){let i=new a.Raycaster,s=new a.Vector2,o=(s.x=e.offsetX/this.runScene.assetsEx.engineDom.clientWidth*2-1,s.y=-e.offsetY/this.runScene.assetsEx.engineDom.clientHeight*2+1,i.setFromCamera(s,this.runScene.assetsEx.camera),i.intersectObjects(t,!0)),l={intersects:null,obj:null};if(0===o.length)return l;if(r){if(0===(e=o.filter((e=>n().model.isVisible(e.object)))).length)return l;l={intersects:e,obj:e[0].object}}else l={intersects:o,obj:o[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,T.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(),s=new a.Vector3,o=new a.Vector3;if("Mesh"===e.type||"Group"===e.type||"Object3D"===e.type){const e=this.runScene.helperEx.boxHelper;if(e.update(),!e||!e.object)return;var l=n.domElement.getBoundingClientRect();let t=l.width/l.height;const i=new a.Vector3;l=e.geometry.attributes.position.array,i.set(Math.abs(l[0]-l[3]),Math.abs(l[1]-l[7]),Math.abs(l[2]-l[14])),o.x=.5*(l[0]+l[3]),o.y=.5*(l[1]+l[7]),o.z=.5*(l[2]+l[14]);let u=new a.Vector3;u.subVectors(r.position,o),u.projectOnPlane(new a.Vector3(0,1,0)),u.normalize(),1<t&&(t=1/t),l=2*Math.tan(.5*r.fov*Math.PI/180),l=i.length()/t/l,s.addVectors(o,u.multiplyScalar(l))}else{t.updateMatrixWorld(!0),l=new a.Vector3,e.getWorldPosition(l),o.set(l.x,l.y,l.z);let n=new a.Vector3;n.subVectors(r.position,o),n.projectOnPlane(new a.Vector3(0,1,0)),n.normalize(),s.addVectors(o,n.multiplyScalar(3))}(0,T.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:s.x,positionY:s.y,positionZ:s.z,targetX:o.x,targetY:o.y,targetZ:o.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&&!Y(e)&&(r=q(e))&&(n.push(e),t[r]||(t[r]=new Set),t[r].add(e))}))})),(0,i.mapObj)(t,((e,t)=>{e=this.runScene.uniqueEx.model.get(e),t.size<2||!e||(t=z(e,[...t]),this.runScene.modelEx.add(t,void 0,{isClone:!1,select:!1,addUndo:!1}),te(e)&&this.setGlow(t,!0),this.runScene.modelEx.remove(e,!1))})),n.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=>{j(e,{remove:!1}),this.runScene.cb.model.dispose.cb(e)})),this.runScene.modelEx.selectNull(),this.geometryMap.clear()}getHoverFromModels(e,t,r){const{getOriginData:n,ignoreMove:i}=(0,T.mergeObject)({ignoreMove:!1,getOriginData:!1},r);this.runScene.cb.events.pointer.move.add("get-hover-from-models",(r=>{if(i||!this.runScene.events.mouse.isMove){const i=new a.Raycaster,c=new a.Vector2,{engineDom:h,camera:d}=this.runScene.assetsEx.get();var{top:s,left:o,width:l,height:u}=h.getBoundingClientRect(),o=r.pageX-o;r=r.pageY-s,c.x=o/l*2-1,c.y=-r/u*2+1,i.setFromCamera(c,d);const p=i.intersectObjects(e||[],!0);null!=t&&t(0===p.length?null:n?p:p.map((e=>e.object)))}}))}}const G=e=>{},N=e=>{if(l.includes(e))return e=n().model.getModelByType(e),p.ZP.parseNode(e),e;throw TypeError("")},j=(e,t)=>{t=(t||{}).remove;const{geometry:r,material:n}=e;r&&(null!=r&&r.dispose(),delete e.geometry),n&&((0,f.disposeMaterial)(e.material),e.material.dispose(),delete e.material),!1!==t&&e.parent&&e.parent.remove(e)},z=(e,t)=>{var{material:r,geometry:n}=e;const i=new h.Z.InstancedMesh(n,r,t.length+1);return[e,...t].map(((e,t)=>{e.updateMatrix(),i.setMatrixAt(t,e.matrixWorld)})),i.name=e.name,i},H=(e,t)=>{const r=[];if(t.map((e=>{e=e.geometry,r.push(e)})),t=function(e,t){for(var r,n,i=1<arguments.length&&void 0!==t&&t,o=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,p=new a.BufferGeometry,f=0,m=0;m<e.length;++m){var v,g,y=e[m],b=0;if(o!=(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(p.userData.mergedUserData=p.userData.mergedUserData||[],p.userData.mergedUserData.push(y.userData),i){var x=void 0;if(o)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}p.addGroup(f,x,m),f+=x}}if(o){for(var w=0,S=[],A=0;A<e.length;++A){for(var M=e[A].index,B=0;B<M.count;++B)S.push(M.getX(B)+w);w+=e[A].attributes.position.count}p.setIndex(S)}for(r in c){var C=s(c[r]);if(!C)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+r+" attribute."),null;p.setAttribute(r,C)}for(n in h){var E=h[n][0].length;if(0===E)break;p.morphAttributes=p.morphAttributes||{},p.morphAttributes[n]=[];for(var T=0;T<E;++T){for(var _=[],D=0;D<h[n].length;++D)_.push(h[n][D][T]);var P=s(_);if(!P)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+n+" morphAttribute."),null;p.morphAttributes[n].push(P)}}return p}(r),t)return new h.Z.Mesh(t,e)},V=e=>0!==e.animations.length,J=e=>{e&&e.userData&&(e.userData.isHelper=!0)},K=e=>null==(e=null==e?void 0:e.userData)?void 0:e.isHelper,Z=(e,t)=>{null!=t&&(0===t?e.layers.set(0):e.layers.enable(1),(0,m.M)(e,"layers",t))},W=e=>{const t=[];e.traverse((e=>{t.push(e)}))},X=e=>{let t=!1;if(e)return e.traverse((e=>{e.isSkinnedMesh&&(t=!0)})),t},Q=(e,t)=>{t?(0,m.M)(e,"isDynamic",!0):delete e.userData.isDynamic},Y=(e,t)=>e&&t?!!e.userData.isDynamic||!!e.parent&&Y(e.parent,t):null==(t=null==e?void 0:e.userData)?void 0:t.isDynamic,q=e=>e.userData.cloneId,$=(e,t)=>{(0,m.M)(e,"cloneId",t)},ee=e=>{delete e.userData.cloneId},te=e=>1===e.userData.layers,re=e=>e.isSprite,ne=e=>{},ie=e=>{var t=new a.Vector3;return(new a.Box3).setFromObject(e).getSize(t),t},ae={open(e){delete e.userData.unSelectable},close(e){e.userData.unSelectable=!0},is:e=>void 0===e.userData.unSelectable},se={set(e,t){t?delete e.userData.unNormal:e.userData.unNormal=!0},is:e=>!(0,d.RQ)(e)&&!(0,o.N)(e)&&void 0===e.userData.unNormal,hasUnNormal:e=>void 0!==(null==(e=null==e?void 0:e.userData)?void 0:e.unNormal)},oe={is:e=>null==(e=null==e?void 0:e.userData)?void 0:e.isHelper,set(e,t=!0){t?e.userData.isHelper=!0:delete e.userData.isHelper}},le={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}},ue=(e,t)=>{let r=[];Array.isArray(e)?r.push(...e):r.push(e);const n={};return r.map((e=>e.traverse((e=>{null!=t&&t(e),n[(0,A.Ki)(e)]=e})))),n},ce={is:e=>!(null==(e=null==e?void 0:e.userData)||!e.isTemp),set(e,t){t?e.userData.isTemp=t:delete e.userData.isTemp}}},228:(e,t,r)=>{r.d(t,{Q:()=>d,S:()=>p});var n=r(814),i=r(881),a=r(819),s=r(608);function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){return(l=Object.setPrototypeOf||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 r,n=c(e);if(r=t?(r=c(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===o(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var h=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&&l(t,e);var r=u(n);function n(e,t,o,l){var u;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");return(u=r.call(this)).renderScene=t,u.renderCamera=o,u.selectedObjects=void 0!==l?l:[],u.visibleEdgeColor=new i.Color(1,1,1),u.hiddenEdgeColor=new i.Color(.1,.04,.02),u.edgeGlow=0,u.usePatternTexture=!1,u.edgeThickness=1,u.edgeStrength=3,u.downSampleRatio=2,u.pulsePeriod=0,u._visibilityCache=new Map,u.resolution=void 0!==e?new i.Vector2(e.x,e.y):new i.Vector2(256,256),t=Math.round(u.resolution.x/u.downSampleRatio),o=Math.round(u.resolution.y/u.downSampleRatio),u.renderTargetMaskBuffer=new i.WebGLRenderTarget(u.resolution.x,u.resolution.y),u.renderTargetMaskBuffer.texture.name="OutlinePass.mask",u.renderTargetMaskBuffer.texture.generateMipmaps=!1,u.depthMaterial=new i.MeshDepthMaterial,u.depthMaterial.side=i.DoubleSide,u.depthMaterial.depthPacking=i.RGBADepthPacking,u.depthMaterial.blending=i.NoBlending,u.prepareMaskMaterial=u.getPrepareMaskMaterial(),u.prepareMaskMaterial.side=i.DoubleSide,u.prepareMaskMaterial.fragmentShader=function(e,t){return t=t.isPerspectiveCamera?"perspective":"orthographic",e.replace(/DEPTH_TO_VIEW_Z/g,t+"DepthToViewZ")}(u.prepareMaskMaterial.fragmentShader,u.renderCamera),u.renderTargetDepthBuffer=new i.WebGLRenderTarget(u.resolution.x,u.resolution.y),u.renderTargetDepthBuffer.texture.name="OutlinePass.depth",u.renderTargetDepthBuffer.texture.generateMipmaps=!1,u.renderTargetMaskDownSampleBuffer=new i.WebGLRenderTarget(t,o),u.renderTargetMaskDownSampleBuffer.texture.name="OutlinePass.depthDownSample",u.renderTargetMaskDownSampleBuffer.texture.generateMipmaps=!1,u.renderTargetBlurBuffer1=new i.WebGLRenderTarget(t,o),u.renderTargetBlurBuffer1.texture.name="OutlinePass.blur1",u.renderTargetBlurBuffer1.texture.generateMipmaps=!1,u.renderTargetBlurBuffer2=new i.WebGLRenderTarget(Math.round(t/2),Math.round(o/2)),u.renderTargetBlurBuffer2.texture.name="OutlinePass.blur2",u.renderTargetBlurBuffer2.texture.generateMipmaps=!1,u.edgeDetectionMaterial=u.getEdgeDetectionMaterial(),u.renderTargetEdgeBuffer1=new i.WebGLRenderTarget(t,o),u.renderTargetEdgeBuffer1.texture.name="OutlinePass.edge1",u.renderTargetEdgeBuffer1.texture.generateMipmaps=!1,u.renderTargetEdgeBuffer2=new i.WebGLRenderTarget(Math.round(t/2),Math.round(o/2)),u.renderTargetEdgeBuffer2.texture.name="OutlinePass.edge2",u.renderTargetEdgeBuffer2.texture.generateMipmaps=!1,u.separableBlurMaterial1=u.getSeperableBlurMaterial(4),u.separableBlurMaterial1.uniforms.texSize.value.set(t,o),u.separableBlurMaterial1.uniforms.kernelRadius.value=1,u.separableBlurMaterial2=u.getSeperableBlurMaterial(4),u.separableBlurMaterial2.uniforms.texSize.value.set(Math.round(t/2),Math.round(o/2)),u.separableBlurMaterial2.uniforms.kernelRadius.value=4,u.overlayMaterial=u.getOverlayMaterial(),void 0===s.C&&console.error("THREE.OutlinePass relies on CopyShader"),l=s.C,u.copyUniforms=i.UniformsUtils.clone(l.uniforms),u.copyUniforms.opacity.value=1,u.materialCopy=new i.ShaderMaterial({uniforms:u.copyUniforms,vertexShader:l.vertexShader,fragmentShader:l.fragmentShader,blending:i.NoBlending,depthTest:!1,depthWrite:!1,transparent:!0}),u.enabled=!0,u.needsSwap=!1,u._oldClearColor=new i.Color,u.oldClearAlpha=1,u.fsQuad=new a.T(null),u.tempPulseColor1=new i.Color,u.tempPulseColor2=new i.Color,u.textureMatrix=new i.Matrix4,u}return t=n,(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,s=0;s<r.length;s++)if(r[s].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,i,a){var s,o;0<this.selectedObjects.length&&(e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha(),s=e.autoClear,e.autoClear=!1,a&&e.state.buffers.stencil.setTest(!1),e.setClearColor(16777215,1),this.changeVisibilityOfSelectedObjects(!1),o=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=o,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&&(o=.625+.75*Math.cos(.01*performance.now()/this.pulsePeriod)/2,this.tempPulseColor1.multiplyScalar(o),this.tempPulseColor2.multiplyScalar(o)),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=n.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=n.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=n.BlurDirectionX,e.setRenderTarget(this.renderTargetBlurBuffer2),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetBlurBuffer2.texture,this.separableBlurMaterial2.uniforms.direction.value=n.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=s),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 i.ShaderMaterial({uniforms:{depthTexture:{value:null},cameraNearFar:{value:new i.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 i.ShaderMaterial({uniforms:{maskTexture:{value:null},texSize:{value:new i.Vector2(.5,.5)},visibleEdgeColor:{value:new i.Vector3(1,1,1)},hiddenEdgeColor:{value:new i.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 i.ShaderMaterial({defines:{MAX_RADIUS:e},uniforms:{colorTexture:{value:null},texSize:{value:new i.Vector2(.5,.5)},direction:{value:new i.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 i.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:i.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}),n}(a.w);h.BlurDirectionX=new i.Vector2(1,0),h.BlurDirectionY=new i.Vector2(0,1);class d{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.outlinePass||(this.outlinePass=new h(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 n.Sf.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))})))}clearAllOutlineObj(){this.outlinePass&&(this.outlinePass.selectedObjects=[])}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)}}const p=e=>e.userData.outline},738:(e,t,r)=>{r.d(t,{Z:()=>i,s:()=>a});var n=r(881);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()}},814:(e,t,r)=>{r.d(t,{Gc:()=>ka,al:()=>ke,ch:()=>d,Az:()=>Pe,Sf:()=>La,cQ:()=>h,ZP:()=>Fa});var n={},i=(r.r(n),r.d(n,{AsyncCompress:()=>yr,AsyncDecompress:()=>Rr,AsyncDeflate:()=>cr,AsyncGunzip:()=>Sr,AsyncGzip:()=>yr,AsyncInflate:()=>fr,AsyncUnzipInflate:()=>rn,AsyncUnzlib:()=>_r,AsyncZipDeflate:()=>qr,AsyncZlib:()=>Cr,Compress:()=>gr,DecodeUTF8:()=>Gr,Decompress:()=>Or,Deflate:()=>ur,EncodeUTF8:()=>Nr,Gunzip:()=>wr,Gzip:()=>gr,Inflate:()=>pr,Unzip:()=>nn,UnzipInflate:()=>tn,UnzipPassThrough:()=>en,Unzlib:()=>Tr,Zip:()=>$r,ZipDeflate:()=>Yr,ZipPassThrough:()=>Qr,Zlib:()=>Br,compress:()=>br,compressSync:()=>xr,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]?Ar:8!=(15&e[0])||7<e[0]>>4||(e[0]<<8|e[1])%31?mr:Dr)(e,t,r)},decompressSync:()=>function(e,t){return(31==e[0]&&139==e[1]&&8==e[2]?Mr:8!=(15&e[0])||7<e[0]>>4||(e[0]<<8|e[1])%31?vr:Pr)(e,t)},deflate:()=>hr,deflateSync:()=>dr,gunzip:()=>Ar,gunzipSync:()=>Mr,gzip:()=>br,gzipSync:()=>xr,inflate:()=>mr,inflateSync:()=>vr,strFromU8:()=>zr,strToU8:()=>jr,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!=er(e,a);--a)if(!a||65558<e.length-a)return void t("invalid zip file",null);var s=$t(e,a+8);s||t(null,{});var o=s,l=er(e,a+16),u=4294967295==l;if(u){if(a=er(e,a-12),101075792!=er(e,a))return void t("invalid zip file",null);o=s=er(e,a+32),l=er(e,a+48)}for(var c=function(a){function o(e,r){e?(n(),t(e,null)):(i[p]=r,--s||t(null,i))}var c=(m=Jr(e,l,u))[0],h=m[1],d=m[2],p=m[3],f=m[4],m=m[5];if(m=Vr(e,m),l=f,c)if(8==c)if(f=e.subarray(m,m+h),h<32e4)try{o(null,vr(f,new Qe(d)))}catch(a){o(a,null)}else r.push(mr(f,{size:d},o));else o("unknown compression type "+c,null);else o(null,At(e,m,m+h))},h=0;h<o;++h)c();return n},unzipSync:()=>function(e){for(var t={},r=e.length-22;101010256!=er(e,r);--r)if(!r||65558<e.length-r)throw"invalid zip file";var n=$t(e,r+8);if(!n)return{};var i=er(e,r+16),a=4294967295==i;if(a){if(r=er(e,r-12),101075792!=er(e,r))throw"invalid zip file";n=er(e,r+32),i=er(e,r+48)}for(var s=0;s<n;++s){var o=(d=Jr(e,i,a))[0],l=d[1],u=d[2],c=d[3],h=d[4],d=d[5];if(d=Vr(e,d),i=h,o){if(8!=o)throw"unknown compression type "+o;t[c]=vr(e.subarray(d,d+l),new Qe(u))}else t[c]=At(e,d,d+l)}return t},unzlib:()=>Dr,unzlibSync:()=>Pr,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 Qe(u+22),t=l,n=u-l,i=u=0;i<c;++i){var a=h[i];try{var s=a.c.length,o=(Wr(e,u,a,a.f,a.u,s),30+a.f.length+Zr(a.extra)),d=u+o;e.set(a.c,d),Wr(e,l,a,a.f,a.u,s,u,a.m),l+=16+o+(a.m?a.m.length:0),u=d+s}catch(e){return r(e,null)}}Xr(e,l,h.length,n,t),r(null,e)}var a={},s=(Ir(e,"",a,t),Object.keys(a)),o=s.length,l=0,u=0,c=o,h=new Array(o),d=[];o||i();for(var p=function(e){function t(t,a){t?(n(),r(t,null)):(t=a.length,h[e]=Nt(m,{size:g,crc:v.d(),c:a,f:y,m:w,u:b!=c.length||w&&x.length!=S,compression:M}),l+=30+b+A+t,u+=76+2*(b+A)+(S||0)+t,--o||i())}var c=s[e],p=a[c],f=p[0],m=p[1],v=Ft(),g=f.length,y=(v.p(f),jr(c)),b=y.length,x=m.comment,w=x&&jr(x),S=w&&w.length,A=Zr(m.extra),M=0==m.level?0:8;if(65535<b&&t("filename too long",null),M)if(g<16e4)try{t(null,dr(f,m))}catch(p){t(p,null)}else d.push(hr(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=(Ir(e,"",n,t=t||{}),0),s=0;for(r in n){var o,l=(o=n[r])[0],u=0==(o=o[1]).level?0:8,c=(x=jr(r)).length,h=o.comment,d=h&&jr(h),p=d&&d.length,f=Zr(o.extra);if(65535<c)throw"filename too long";var m=u?dr(l,o):l,v=m.length,g=Ft();g.p(l),i.push(Nt(o,{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,s+=76+2*(c+f)+(p||0)+v}for(var y=new Qe(s+22),b=(e=a,t=s-a,0);b<i.length;++b){var x=i[b],w=(Wr(y,x.o,x,x.f,x.u,x.c.length),30+x.f.length+Zr(x.extra));y.set(x.c,x.o+w),Wr(y,a,x,x.f,x.u,x.c.length,x.o,x.m),a+=16+w+(x.m?x.m.length:0)}return Xr(y,a,i.length,t,e),y},zlib:()=>function(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return qt(e,t,[Jt,Wt,function(){return[Er]}],(function(e){return Qt(Er(e.data[0],e.data[1]))}),4,r)},zlibSync:()=>Er}),t={},r.r(t),r.d(t,{FBXLoader:()=>Sn}),r(300)),a=r.n(i),s=r(1),o=r(881);class l{constructor(e){this.runScene=e}}var u=r(143),c=r(247),h=r(457),d=r(749);class p extends l{constructor(e){super(e),this.map={},this.clock=new o.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,d.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 i=e.animations.length?e.animations:u.B.parse(t),a=new o.AnimationMixer(e);for(const t of i){var r=(0,s.getId)(),n=(t.id=r,a.clipAction(t));const i={finished:()=>{},loop:()=>{}};a.addEventListener("finished",(()=>i.finished())),a.addEventListener("loop",(()=>i.loop())),this.map[r]={mixer:a,action:n,model:e,time:0,runState:"close",clip:t,eventMap:i}}i.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,h.mergeObject)({onLoop:()=>{},onProgress:()=>{},onFinished:()=>{},onClose:()=>{},onPause:()=>{},onResume:()=>{},onBeforeEnd:()=>{},loop:!1,lastFrame:!0,reset:!0},r);const{onProgress:i,onBeforeEnd:a,onLoop:s,onFinished:o,lastFrame:l,loop:u,reset:d}=t,{action:p,clip:f,eventMap:m}=(this.map[e].options=t,n);p.stop(),r=d?0:n.time,p.time=r,this.setPlayState(n,!0),d&&p.reset(),p.play();let v=!(n.runState="play");this.setUpdates(e,(()=>{var e=(0,h.getProgress)(p.time,f.duration,!0);99<=e&&!v&&(a(),v=!0),i(e)})),u?(p.loop=c.Z.LoopRepeat,m.loop=s):(l&&(p.clampWhenFinished=!0),p.loop=c.Z.LoopOnce,m.finished=()=>{this.setPlayState(n,!1),i(100),o()})}}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,s.mapObj)(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,h.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 f=r(693),m=r(699);class v{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 f.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 m.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(){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(),r=this.runScene.cameraEx.pCam,n=this.runScene.renderEx.create(e),i=this.runScene.controlsEx.create(r,e),{render2:a,render3:s}=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(s),{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 g{constructor(){this.cbs=[],this.cb=e=>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,s.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 y{constructor(){this.resize=new g,this.setSelectMaterial=new g,this.setScene=new g,this.reset=new g,this.render=new g,this.tick=new g,this.baseLog=new g,this.inited=new g,this.texture={add:new g,remove:new g,set:new g,setAnima:new g},this.model={multiSelect:{setEmpty:new g},change:new g,setSelect:new g,click:new g,add:new g,remove:new g,multipDrop:new g,focus:new g,unFocus:new g,changeName:new g,setOpen:new g,setMainStatue:new g,setVisible:new g,setParent:new g,setLayers:new g,setOutline:new g,clone:new g,dispose:new g},this.material={add:new g,remove:new g,dispose:new g,setName:new g},this.unique={material:{add:new g}},this.tranControls={changing:new g},this.undo={addUndos:new g,addRedus:new g,removeUndos:new g,undoByIndex:new g,reset:new g},this.scene={save:new g,saveNet:new g,setEnvStrength:new g},this.timeLine={setProgress:new g,playGroup:new g,setGroupMap:new g,reset:new g,closeGroup:new g},this.events={key:{down:new g,up:new g},mouse:{move:new g,down:new g,up:new g},pointer:{rightTrigger:new g,down:new g,up:new g,move:new g,trigger:new g}},this.pp={glow:{setData:new g,setStatus:new g},outline:{setData:new g,setStatus:new g},ao:{setData:new g,setStatus:new g},vignette:{setData:new g,setStatus:new g}},this.load={getJSON:new g,progress:new g,complete:new g},this.exporter={gltf:{before:new g,complete:new g}},this.loaderer={gltf:{loadNode:new g,lazyLoadedTexture:new g,loaded:new g,modelLoaded:new g,progress:new g,getJSON:new g,getArrayBuffer:new g,complete:new g}},this.custom=new Proxy({},{get:(e,t)=>(e[t]||(e[t]=new g),e[t])}),this.tags={parseJSON:new g,clear:new g},this.snapshot={create:new g,set:new g},this.clean=new g,this.objects={sky:{setState:new g}}}}var b=r(230);function x(e,t){this.orbit=t,this.object=e,this.target=new c.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,s,o,l,u,h,d,p,f,m=this,v=0,g=0,y=0,b=0,x=1,w=new c.Z.Vector3,S=!1;this.getPolarAngle=function(){return g},this.getAzimuthalAngle=function(){return v},this.setPolarAngle=function(e){g=e,this.forceUpdate()},this.setAzimuthalAngle=function(e){v=e,this.forceUpdate()},this.rotateLeft=function(e){b-=e},this.rotateUp=function(e){y-=e},this.panLeft=(r=new c.Z.Vector3,function(e){var t=this.object.matrix.elements;r.set(t[0],t[1],t[2]),r.multiplyScalar(-e),w.add(r)}),this.panUp=(n=new c.Z.Vector3,function(e,r){t.screenSpacePanning?n.setFromMatrixColumn(r,1):(n.setFromMatrixColumn(r,0),n.crossVectors(m.object.up,n)),n.multiplyScalar(e),w.add(n)}),this.pan=function(e,t,r,n){var i;m.object instanceof c.Z.PerspectiveCamera?(i=m.object.position.clone().sub(m.target).length(),i*=Math.tan(m.object.fov/2*Math.PI/180),m.panLeft(2*e*i/n),m.panUp(2*t*i/n,m.object.matrix)):m.object instanceof c.Z.OrthographicCamera?(m.panLeft(e*(m.object.right-m.object.left)/r),m.panUp(t*(m.object.top-m.object.bottom)/n)):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.")},this.dollyIn=function(e){m.object instanceof c.Z.PerspectiveCamera?x/=e:m.object instanceof c.Z.OrthographicCamera?(m.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom*e)),m.object.updateProjectionMatrix(),S=!0):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.")},this.dollyOut=function(e){m.object instanceof c.Z.PerspectiveCamera?x*=e:m.object instanceof c.Z.OrthographicCamera?(m.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/e)),m.object.updateProjectionMatrix(),S=!0):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.")},this.forceUpdate=(i=new c.Z.Vector3,a=(new c.Z.Quaternion).setFromUnitVectors(e.up,new c.Z.Vector3(0,1,0)),s=a.clone().invert(),o=new c.Z.Vector3,l=new c.Z.Quaternion,function(){var e=this.object.position,t=(i.copy(e).sub(this.target),i.applyQuaternion(a),v=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,v)),g=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,g)),g=Math.max(1e-6,Math.min(Math.PI-1e-6,g)),i.length()*x);return t=Math.max(this.minDistance,Math.min(this.maxDistance,t)),this.target.add(w),i.x=t*Math.sin(g)*Math.sin(v),i.y=t*Math.cos(g),i.z=t*Math.sin(g)*Math.cos(v),i.applyQuaternion(s),e.copy(this.target).add(i),this.object.lookAt(this.target),!0===this.enableDamping?(b*=1-this.dampingFactor,y*=1-this.dampingFactor):y=b=0,x=1,w.set(0,0,0),!(!(S||1e-6<o.distanceToSquared(this.object.position)||1e-6<8*(1-l.dot(this.object.quaternion)))||(o.copy(this.object.position),l.copy(this.object.quaternion),S=!1))}),this.update=(u=new c.Z.Vector3,h=(new c.Z.Quaternion).setFromUnitVectors(e.up,new c.Z.Vector3(0,1,0)),d=h.clone().invert(),p=new c.Z.Vector3,f=new c.Z.Quaternion,function(){var e=this.object.position,t=(u.copy(e).sub(this.target),u.applyQuaternion(h),v=Math.atan2(u.x,u.z),g=Math.atan2(Math.sqrt(u.x*u.x+u.z*u.z),u.y),v+=b,g+=y,v=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,v)),g=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,g)),g=Math.max(1e-6,Math.min(Math.PI-1e-6,g)),u.length()*x);return t=Math.max(this.minDistance,Math.min(this.maxDistance,t)),this.target.add(w),u.x=t*Math.sin(g)*Math.sin(v),u.y=t*Math.cos(g),u.z=t*Math.sin(g)*Math.cos(v),u.applyQuaternion(d),e.copy(this.target).add(u),this.object.lookAt(this.target),!0===this.enableDamping?(b*=1-this.dampingFactor,y*=1-this.dampingFactor):y=b=0,x=1,w.set(0,0,0),!(!(S||1e-6<p.distanceToSquared(this.object.position)||1e-6<8*(1-f.dot(this.object.quaternion)))||(p.copy(this.object.position),f.copy(this.object.quaternion),S=!1))})}function w(e,t){var r=new x(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:c.Z.MOUSE.LEFT,ZOOM:c.Z.MOUSE.MIDDLE,PAN:c.Z.MOUSE.RIGHT},this),i=new c.Z.Vector2,a=new c.Z.Vector2,s=new c.Z.Vector2,o=new c.Z.Vector2,l=new c.Z.Vector2,u=new c.Z.Vector2,h=new c.Z.Vector2,d=new c.Z.Vector2,p=new c.Z.Vector2,f=-1,m=f,v=(this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,{type:"change"}),g={type:"start"},y={type:"end"};function b(e,t){var i=n.domElement===document?n.domElement.body:n.domElement;r.pan(e,t,i.clientWidth,i.clientHeight)}function w(){return Math.pow(.95,n.zoomSpeed)}function S(e){if(!1!==n.enabled){if(e.preventDefault(),e.button===n.mouseButtons.ORBIT){if(!1===n.enableRotate)return;m=0,i.set(e.clientX,e.clientY)}else if(e.button===n.mouseButtons.ZOOM){if(!1===n.enableZoom)return;m=1,h.set(e.clientX,e.clientY)}else if(e.button===n.mouseButtons.PAN){if(!1===n.enablePan)return;m=2,o.set(e.clientX,e.clientY)}m!==f&&(document.addEventListener("mousemove",A,!1),document.addEventListener("mouseup",M,!1),n.dispatchEvent(g))}}function A(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===m){if(!1===n.enableRotate)return;a.set(e.clientX,e.clientY),s.subVectors(a,i),r.rotateLeft(2*Math.PI*s.x/t.clientWidth*n.rotateSpeed),r.rotateUp(2*Math.PI*s.y/t.clientHeight*n.rotateSpeed),i.copy(a)}else if(1===m){if(!1===n.enableZoom)return;d.set(e.clientX,e.clientY),p.subVectors(d,h),0<p.y?r.dollyIn(w()):p.y<0&&r.dollyOut(w()),h.copy(d)}else if(2===m){if(!1===n.enablePan)return;l.set(e.clientX,e.clientY),u.subVectors(l,o),b(u.x,u.y),o.copy(l)}m!==f&&n.update()}}function M(){!1!==n.enabled&&(document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",M),n.dispatchEvent(y),m=f)}function B(e){var t;!1!==n.enabled&&!1!==n.enableZoom&&m===f&&(e.stopPropagation(),void(t=0)!==e.wheelDelta?t=e.wheelDelta:void 0!==e.detail&&(t=-e.detail),0<t?r.dollyOut(w()):t<0&&r.dollyIn(w()),n.update(),n.dispatchEvent(g),n.dispatchEvent(y))}function C(e){if(!1!==n.enabled&&!1!==n.enableKeys&&!1!==n.enablePan)switch(e.keyCode){case n.keys.UP:b(0,n.keyPanSpeed),n.update();break;case n.keys.BOTTOM:b(0,-n.keyPanSpeed),n.update();break;case n.keys.LEFT:b(n.keyPanSpeed,0),n.update();break;case n.keys.RIGHT:b(-n.keyPanSpeed,0),n.update()}}function E(e){if(!1!==n.enabled){switch(e.touches.length){case 1:if(!1===n.enableRotate)return;m=3,i.set(e.touches[0].pageX,e.touches[0].pageY);break;case 2:if(!1===n.enableZoom)return;m=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),h.set(0,t);break;case 3:if(!1===n.enablePan)return;m=5,o.set(e.touches[0].pageX,e.touches[0].pageY);break;default:m=f}m!==f&&n.dispatchEvent(g)}}function T(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!==m)return;a.set(e.touches[0].pageX,e.touches[0].pageY),s.subVectors(a,i),r.rotateLeft(2*Math.PI*s.x/t.clientWidth*n.rotateSpeed),r.rotateUp(2*Math.PI*s.y/t.clientHeight*n.rotateSpeed),i.copy(a),n.update();break;case 2:if(!1===n.enableZoom)return;if(4!==m)return;var c=e.touches[0].pageX-e.touches[1].pageX,v=e.touches[0].pageY-e.touches[1].pageY;c=Math.sqrt(c*c+v*v),d.set(0,c),p.subVectors(d,h),0<p.y?r.dollyOut(w()):p.y<0&&r.dollyIn(w()),h.copy(d),n.update();break;case 3:if(!1===n.enablePan)return;if(5!==m)return;l.set(e.touches[0].pageX,e.touches[0].pageY),u.subVectors(l,o),b(u.x,u.y),o.copy(l),n.update();break;default:m=f}}}function _(){!1!==n.enabled&&(n.dispatchEvent(y),m=f)}function D(e){e.preventDefault()}this.update=function(){this.autoRotate&&m===f&&r.rotateLeft(2*Math.PI/60/60*n.autoRotateSpeed),!0===r.update()&&this.dispatchEvent(v)},this.reset=function(){m=f,this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(v),this.update()},this.dispose=function(){this.domElement.removeEventListener("contextmenu",D,!1),this.domElement.removeEventListener("mousedown",S,!1),this.domElement.removeEventListener("mousewheel",B,!1),this.domElement.removeEventListener("MozMousePixelScroll",B,!1),this.domElement.removeEventListener("touchstart",E,!1),this.domElement.removeEventListener("touchend",_,!1),this.domElement.removeEventListener("touchmove",T,!1),document.removeEventListener("mousemove",A,!1),document.removeEventListener("mouseup",M,!1),window.removeEventListener("keydown",C,!1)},this.domElement.addEventListener("contextmenu",D,!1),this.domElement.addEventListener("mousedown",S,!1),this.domElement.addEventListener("mousewheel",B,{passive:!0}),this.domElement.addEventListener("MozMousePixelScroll",B,!1),this.domElement.addEventListener("touchstart",E,{passive:!0}),this.domElement.addEventListener("touchend",_,!1),this.domElement.addEventListener("touchmove",T,{passive:!0}),window.addEventListener("keydown",C,!1),this.update()}c.Z.MOUSE,(w.prototype=Object.create(c.Z.EventDispatcher.prototype)).constructor=w,Object.defineProperties(w.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 S=w;class A{create(e,t){return new S(e,t)}static toJSON(e){return e.target}static setTarget(e,t,r){var{x:n,y:i,z:a}=t,{x:r,y:s,z:o}=r||e.target;this.setTargetData.anima&&(this.setTargetData.anima.kill(),this.setTargetData.anima=null,this.setTarget(e,t,this.setTargetData.nowData)),this.setTargetData.anima=(0,h.anima)({x:r,y:s,z:o},{x:n,y:i,z:a},.5,(t=>{var{x:r,y:n,z:i}=t;e.target.set(r,n,i),e.update(),this.setTargetData.nowData=t}),(()=>{this.setTargetData.anima=null}))}}A.setTargetData={anima:null,nowData:null};var M=r(794),B=function(e,t,r,n){return new(r=r||Promise)((function(i,a){function s(e){try{l(n.next(e))}catch(e){a(e)}}function o(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(s,o)}l((n=n.apply(e,t||[])).next())}))};const C=s.fnDebounce;class E{constructor(e){this.alt=!1,this.ctrl=!1,this.shift=!1,this.unExec=new M.Z,this.specialKeyDebounce=C((()=>{this.ctrl=!1,this.shift=!1,this.alt=!1}),1e3),this.allFn={s_saveScene:()=>B(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 B(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 T=r(801);class _{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),2===e.button&&(this.events.runScene.modelEx.select||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 r=e;"canvas"===t?r=e:"window"===t&&(r=window),r.addEventListener("pointerdown",this.down.bind(this)),r.addEventListener("pointerup",this.up.bind(this)),r.addEventListener("pointerdown",this.events.runScene.cb.events.pointer.down.cb),r.addEventListener("pointerup",this.events.runScene.cb.events.pointer.up.cb),r.addEventListener("pointermove",(e=>{this.moveEvent=e,this.events.runScene.cb.events.pointer.move.cb(e)})),r.addEventListener("mousemove",this.events.runScene.cb.events.mouse.move.cb),r.addEventListener("mousedown",this.events.runScene.cb.events.mouse.down.cb),r.addEventListener("mouseup",this.events.runScene.cb.events.mouse.up.cb)}getTriggerModels(e){const t=new o.Raycaster,r=new o.Vector2,{engineDom:n,camera:i,scene:a}=this.events.runScene.assetsEx.get();var{top:s,left:l,width:u,height:c}=n.getBoundingClientRect(),l=e.pageX-l,s=(e=e.pageY-s,r.x=l/u*2-1,r.y=-e/c*2+1,t.setFromCamera(r,i),a.children.filter((e=>{if((!this.events.runScene.helperEx.isHelper(e)||e.userData.id)&&!e.userData.unClick)return e})));const h=t.intersectObjects(s,!0);return this.events.runScene.cb.events.pointer.trigger.cb(h),h.map((e=>e.object))}removeHideOrLockModel(e){return e.find((e=>this.events.runScene.modelEx.deepIsVisible(e)&&!T.zf.isLock(e,!0)&&d.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)}}}function D(){D=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 s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(t){s=function(e,t,r){return e[t]=r}}function o(e,t,r,n){var i,a,s,o;return t=t&&t.prototype instanceof c?t:c,t=Object.create(t.prototype),n=new x(n||[]),t._invoke=(i=e,a=r,s=n,o="suspendedStart",function(e,t){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===e)throw t;return{value:void 0,done:!0}}for(s.method=e,s.arg=t;;){var r=s.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,s),r)){if(r===u)continue;return r}if("next"===s.method)s.sent=s._sent=s.arg;else if("throw"===s.method){if("suspendedStart"===o)throw o="completed",s.arg;s.dispatchException(s.arg)}else"return"===s.method&&s.abrupt("return",s.arg);if(o="executing","normal"===(r=l(i,a,s)).type){if(o=s.done?"completed":"suspendedYield",r.arg===u)continue;return{value:r.arg,done:s.done}}"throw"===r.type&&(o="completed",s.method="throw",s.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=o;var u={};function c(){}function h(){}function d(){}var p,f,m=(s(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){s(e,t,(function(e){return this._invoke(t,e)}))}))}function g(e,t){var n;this._invoke=function(i,a){function s(){return new t((function(n,s){!function n(i,a,s,o){var u;if("throw"!==(i=l(e[i],e,a)).type)return(a=(u=i.arg).value)&&"object"==O(a)&&r.call(a,"__await")?t.resolve(a.__await).then((function(e){n("next",e,s,o)}),(function(e){n("throw",e,s,o)})):t.resolve(a).then((function(e){u.value=e,s(u)}),(function(e){return n("throw",e,s,o)}));o(i.arg)}(i,a,n,s)}))}return n=n?n.then(s,s):s()}}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:S}}function S(){return{value:void 0,done:!0}}return s(m,"constructor",h.prototype=d),s(d,"constructor",h),h.displayName=s(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,s(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},v(g.prototype),s(g.prototype,i,(function(){return this})),e.AsyncIterator=g,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var s=new g(o(t,r,n,i),a);return e.isGeneratorFunction(r)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},v(m),s(m,a,"Generator"),s(m,n,(function(){return this})),s(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 s.type="throw",s.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],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var o=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(o&&l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(o){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 s=(a=a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc?null:a)?a.completion:{};return s.type=e,s.arg=t,a?(this.method="next",this.next=a.finallyLoc,u):this.complete(s)},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 P(e,t,r,n,i,a,s){try{var o=e[a](s),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).then(n,i)}function O(e){return(O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function R(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function I(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 k(e,t,r){t&&I(e.prototype,t),r&&I(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var L=function(){function e(){R(this,e),this.pluginCallbacks=[],this.register((function(e){return new ee(e)})),this.register((function(e){return new te(e)})),this.register((function(e){return new re(e)})),this.register((function(e){return new ie(e)})),this.register((function(e){return new ae(e)})),this.register((function(e){return new ne(e)}))}return k(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"===O(r)&&(console.warn("THREE.GLTFExporter: parse() expects options as the fourth argument now."),n=r);for(var i=new $,a=[],s=0,o=this.pluginCallbacks.length;s<o;s++)a.push(this.pluginCallbacks[s](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}(),F=5121,U=5123,G=(i=9728,9729),N=9984,j=9985,z=9986,H=9987,V=33071,J=33648,K=10497,Z={},W=(Z[o.NearestFilter]=i,Z[o.NearestMipmapNearestFilter]=N,Z[o.NearestMipmapLinearFilter]=z,Z[o.LinearFilter]=G,Z[o.LinearMipmapNearestFilter]=j,Z[o.LinearMipmapLinearFilter]=H,Z[o.ClampToEdgeWrapping]=V,Z[o.RepeatWrapping]=K,Z[o.MirroredRepeatWrapping]=J,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"});function X(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function Q(e){return 4*Math.ceil(e/4)}function Y(e,t){var r=1<arguments.length&&void 0!==t?t:0,n=Q(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 q=null,$=function(){function e(){R(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 k(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=D().mark((function e(t,r,n){var i,a,s,o,l,u,c;return D().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,s=i.json,n=i.options,e.next=11,i.options.myOptions.helper.done(s);case 11:l=i.extensionsUsed,o=new Blob(a,{type:"application/octet-stream"}),0<(l=Object.keys(l)).length&&(s.extensionsUsed=l),s.buffers&&0<s.buffers.length&&(s.buffers[0].byteLength=o.size),!0===n.binary?((u=new window.FileReader).readAsArrayBuffer(o),u.onloadend=function(){var e=Y(u.result),t=new DataView(new ArrayBuffer(8)),n=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),Y(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(s)),32)),i=new DataView(new ArrayBuffer(8)),a=(i.setUint32(0,n.byteLength,!0),i.setUint32(4,1313821514,!0),new ArrayBuffer(12)),o=((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,o,!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)}}):s.buffers&&0<s.buffers.length?((c=new window.FileReader).readAsDataURL(o),c.onloadend=function(){var e=c.result;s.buffers[0].uri=e,r(s)}):r(s);case 17:case"end":return e.stop()}}),e,this)})),r=function(){var e=this,r=arguments;return new Promise((function(n,i){var a=t.apply(e,r);function s(e){P(a,n,i,s,o,"next",e)}function o(e){P(a,n,i,s,o,"throw",e)}s(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 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 o.Vector3,r=0,n=e.count;r<n;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(),n=new o.Vector3,i=0,a=r.count;i<a;i++)n.fromBufferAttribute(r,i),0===n.x&&0===n.y&&0===n.z?n.setX(1):n.normalize(),r.setXYZ(i,n.x,n.y,n.z);return t.attributesNormalized.set(e,r),r}},{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,r=null==(r=e.roughnessMap)?void 0:r.image,n=null==(n=e.metalnessMap)?void 0:n.image;if(t===r&&r===n)return e.aoMap;if(t||r||n){e=Math.max((null==t?void 0:t.width)||0,(null==r?void 0:r.width)||0,(null==n?void 0:n.width)||0);var i=Math.max((null==t?void 0:t.height)||0,(null==r?void 0:r.height)||0,(null==n?void 0:n.height)||0),a=document.createElement("canvas"),s=(a.width=e,a.height=i,a.getContext("2d")),l=(s.fillStyle="#ffffff",s.fillRect(0,0,e,i),s.getImageData(0,0,e,i));if(t){s.drawImage(t,0,0,e,i);for(var u=s.getImageData(0,0,e,i).data,c=0;c<u.length;c+=4)l.data[c]=u[c]}if(r){s.drawImage(r,0,0,e,i);for(var h=s.getImageData(0,0,e,i).data,d=1;d<h.length;d+=4)l.data[d]=h[d]}if(n){s.drawImage(n,0,0,e,i);for(var p=s.getImageData(0,0,e,i).data,f=2;f<p.length;f+=4)l.data[f]=p[f]}return s.putImageData(l,0,0),new o.Texture(a)}}},{key:"processBuffer",value:function(e){var t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}},{key:"processBufferView",value:function(e,t,r,n,i){for(var a,s=this.json,o=(s.bufferViews||(s.bufferViews=[]),a=t===F?1:t===U?2:4,Q(n*e.itemSize*a)),l=new DataView(new ArrayBuffer(o)),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===U?l.setUint16(u,d,!0):t===F&&l.setUint8(u,d),u+=a}var p={buffer:this.processBuffer(l.buffer),byteOffset:this.byteOffset,byteLength:o};return void 0!==i&&(p.target=i),34962===i&&(p.byteStride=e.itemSize*a),this.byteOffset+=o,s.bufferViews.push(p),{id:s.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=Y(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,s=this.json;if(e.array.constructor===Float32Array)i=5126;else if(e.array.constructor===Uint32Array)i=5125;else if(e.array.constructor===Uint16Array)i=U;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");i=F}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 s=void 0;4<e.itemSize?s=e.array[i*e.itemSize+a]:0===a?s=e.getX(i):1===a?s=e.getY(i):2===a?s=e.getZ(i):3===a&&(s=e.getW(i)),n.min[a]=Math.min(n.min[a],s),n.max[a]=Math.max(n.max[a],s)}return n}(e,r,n);var o,l=(void 0!==t&&(o=e===t.index?34963:34962),this.processBufferView(e,i,r,n,o));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),s.accessors||(s.accessors=[]),s.accessors.push(t)-1}},{key:"processImage",value:function(e,t,r,n){var i=this,a=i.cache,s=i.json,l=i.options,u=i.pending,c=(a.images.has(e)||a.images.set(e,{}),a=a.images.get(e),"image/png");if(void 0!==a[r=c+":flipY/"+r.toString()])return a[r];s.images||(s.images=[]);var h={mimeType:c};if(!0===l.binary&&null!=n&&null!=(p=n.userData)&&p.blob&&(null==n||null==(p=n.userData)?void 0:p.blob)instanceof Blob)u.push(new Promise((function(e){i.processBufferViewImage(n.userData.blob).then((function(t){h.bufferView=t,e()}))})));else if(l.embedImages){var d=q=q||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!==o.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){i.processBufferViewImage(t).then((function(t){h.bufferView=t,e()}))}),c)}))):h.uri=d.toDataURL(c)}else h.uri=e.src;return t=s.images.push(h)-1,a[r]=t}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter:Z[e.magFilter],minFilter:Z[e.minFilter],wrapS:Z[e.wrapS],wrapT:Z[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,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 n,i={pbrMetallicRoughness:{}},a=(X((this.options.myOptions.helper.parseMaterial({material:e,materialDef:i,options:this}),!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."),a=e.color.toArray().concat([e.opacity])),[1,1,1,1])||(i.pbrMetallicRoughness.baseColorFactor=a),e.isMeshStandardMaterial?(i.pbrMetallicRoughness.metallicFactor=e.metalness,i.pbrMetallicRoughness.roughnessFactor=e.roughness):(i.pbrMetallicRoughness.metallicFactor=.5,i.pbrMetallicRoughness.roughnessFactor=.5),this.buildORMTexture(e));return(e.metalnessMap||e.roughnessMap)&&(a={index:this.processTexture(a)},this.applyTextureTransform(a,e.metalnessMap||e.roughnessMap),i.pbrMetallicRoughness.metallicRoughnessTexture=a),e.map&&(a={index:this.processTexture(e.map)},this.applyTextureTransform(a,e.map),i.pbrMetallicRoughness.baseColorTexture=a),e.emissive&&(a=e.emissive.clone().multiplyScalar(e.emissiveIntensity),1<(n=Math.max(a.r,a.g,a.b))&&(a.multiplyScalar(1/n),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),0<n&&(i.emissiveFactor=a.toArray()),e.emissiveMap&&(n={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(n,e.emissiveMap),i.emissiveTexture=n)),e.normalMap&&(a={index:this.processTexture(e.normalMap)},e.normalScale&&1!==e.normalScale.x&&(a.scale=e.normalScale.x),this.applyTextureTransform(a,e.normalMap),i.normalTexture=a),e.aoMap&&(n={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(n.strength=e.aoMapIntensity),this.applyTextureTransform(n,e.aoMap),i.occlusionTexture=n),e.transparent?i.alphaMode="BLEND":0<e.alphaTest&&(i.alphaMode="MASK",i.alphaCutoff=e.alphaTest),e.side===o.DoubleSide&&(i.doubleSided=!0),""!==e.name&&(i.name=e.name),this.serializeUserData(e,i),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,i)})),a=r.materials.push(i)-1,t.materials.set(e,a),a}},{key:"processMesh",value:function(e){var t=this.cache,r=this.json,n=[e.geometry.uuid];if(Array.isArray(e.material))for(var i=0,a=e.material.length;i<a;i++)n.push(e.material[i].uuid);else n.push(e.material.uuid);var s=n.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 o.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=[],S={};if(void 0!==e.morphTargetDictionary)for(var A in e.morphTargetDictionary)S[e.morphTargetDictionary[A]]=A;for(var M=0;M<e.morphTargetInfluences.length;++M){var B,C={},E=!1;for(B in l.morphAttributes)if("position"!==B&&"normal"!==B)E||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),E=!0);else{var T=l.morphAttributes[B][M],_=B.toUpperCase(),D=l.attributes[B];if(t.attributes.has(this.getUID(T)))C[_]=t.attributes.get(this.getUID(T));else{var P=T.clone();if(!l.morphTargetsRelative)for(var O=0,R=T.count;O<R;O++)P.setXYZ(O,T.getX(O)-D.getX(O),T.getY(O)-D.getY(O),T.getZ(O)-D.getZ(O));C[_]=this.processAccessor(P,l),t.attributes.set(this.getUID(D),C[_])}}v.push(C),x.push(e.morphTargetInfluences[M]),void 0!==e.morphTargetDictionary&&w.push(S[M])}p.weights=x,0<w.length&&(p.extras={},p.extras.targetNames=w)}if((y=Array.isArray(e.material))&&0===l.groups.length)return null;for(var I=y?e.material:[e.material],k=y?l.groups:[{materialIndex:0,start:void 0,count:void 0}],L=0,F=k.length;L<F;L++){var U={mode:u,attributes:f},G=(this.serializeUserData(l,U),0<v.length&&(U.targets=v),null!==l.index&&(G=this.getUID(l.index),void 0===k[L].start&&void 0===k[L].count||(G+=":"+k[L].start+":"+k[L].count),t.attributes.has(G)?U.indices=t.attributes.get(G):(U.indices=this.processAccessor(l.index,l,k[L].start,k[L].count),t.attributes.set(G,U.indices)),null===U.indices&&delete U.indices),this.processMaterial(I[k[L].materialIndex]));null!==G&&(U.material=G),m.push(U)}return p.primitives=m,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,p)})),y=r.meshes.push(p)-1,t.meshes.set(s,y),y}},{key:"processCamera",value:function(e){var t=this.json,r=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),n={type:r?"orthographic":"perspective"};return r?n.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:n.perspective={aspectRatio:e.aspect,yfov:o.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(n.name=e.type),t.cameras.push(n)-1}},{key:"processAnimation",value:function(e,t){for(var r=this.json,n=this.nodeMap,i=(r.animations||(r.animations=[]),(e=L.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),a=[],s=[],l=0;l<i.length;++l){var u=i[l],c=o.PropertyBinding.parseTrackName(u.name),h=o.PropertyBinding.findNode(t,c.nodeName),d=W[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===W.morphTargetInfluences&&(c/=h.morphTargetInfluences.length));!0===u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(p="CUBICSPLINE",c/=3):p=u.getInterpolation()===o.InterpolateDiscrete?"STEP":"LINEAR",s.push({input:this.processAccessor(new o.BufferAttribute(u.times,1)),output:this.processAccessor(new o.BufferAttribute(u.values,c)),interpolation:p}),a.push({sampler:s.length-1,target:{node:n.get(h),path:d}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:s,channels:a}),r.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,r=this.nodeMap,n=t.nodes[r.get(e)],i=e.skeleton;if(void 0===i)return null;var a=e.skeleton.bones[0];if(void 0===a)return null;for(var s=[],l=new Float32Array(16*i.bones.length),u=new o.Matrix4,c=0;c<i.bones.length;++c){var h=i.bones[c];h=this.options.myOptions.helper.getNodeMapValueWithBone(h,r),s.push(h),u.copy(i.boneInverses[c]),u.multiply(e.bindMatrix).toArray(l,16*c)}return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new o.BufferAttribute(l,16)),joints:s,skeleton:r.get(a)}),n.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,r,n=this.json,i=this.options,a=this.nodeMap,s=(n.nodes||(n.nodes=[]),{});if(e=i.myOptions.helper.parseNode({object:e,nodeDef:s,options:this}),i.trs?(r=e.quaternion.toArray(),h=e.position.toArray(),t=e.scale.toArray(),X(r,[0,0,0,1])||(s.rotation=r),X(h,[0,0,0])||(s.translation=h),X(t,[1,1,1])||(s.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===X(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(s.matrix=e.matrix.elements)),""!==e.name&&(s.name=String(e.name)),this.serializeUserData(e,s),e.isMesh||e.isLine||e.isPoints?null!==(r=this.processMesh(e))&&(s.mesh=r):e.isCamera&&(s.camera=this.processCamera(e)),e.isSkinnedMesh&&this.skins.push(e),0<e.children.length){for(var o=[],l=0,u=e.children.length;l<u;l++){var c=e.children[l];c.userData.isTemp||!c.visible&&!1!==i.onlyVisible||null!==(c=this.processNode(c))&&o.push(c)}0<o.length&&(s.children=o)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,s)}));var h=n.nodes.push(s)-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,s=e.children.length;a<s;a++){var o=e.children[a];o.userData.isTemp||!o.visible&&!1!==r.onlyVisible||null!==(o=this.processNode(o))&&i.push(o)}0<i.length&&(n.nodes=i),this.serializeUserData(e,n)}},{key:"processObjects",value:function(e){var t=new o.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,n=this.options,i=(e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)})),[]),a=0;a<e.length;a++)e[a]instanceof o.Scene?this.processScene(e[a]):i.push(e[a]);1===i.length?(t=i[0],"model"===n.myOptions.helper.type&&((r=new o.Group).name="glb_model",r.add(t),t=r),this.processScene(t)):1<i.length&&this.processObjects(i);for(var s=0;s<this.skins.length;++s)this.processSkin(this.skins[s]);for(var l=0;l<n.animations.length;++l)this.processAnimation(n.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}(),ee=function(){function e(t){R(this,e),this.writer=t,this.name="KHR_lights_punctual"}return k(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}(),te=function(){function e(t){R(this,e),this.writer=t,this.name="KHR_materials_unlit"}return k(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}(),re=function(){function e(t){R(this,e),this.writer=t,this.name="KHR_materials_pbrSpecularGlossiness"}return k(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}(),ne=function(){function e(t){R(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return k(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}(),ie=function(){function e(t){R(this,e),this.writer=t,this.name="KHR_materials_transmission"}return k(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}(),ae=function(){function e(t){R(this,e),this.writer=t,this.name="KHR_materials_volume"}return k(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 se(){se=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 s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(t){s=function(e,t,r){return e[t]=r}}function o(e,t,r,n){var i,a,s,o;return t=t&&t.prototype instanceof c?t:c,t=Object.create(t.prototype),n=new x(n||[]),t._invoke=(i=e,a=r,s=n,o="suspendedStart",function(e,t){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===e)throw t;return{value:void 0,done:!0}}for(s.method=e,s.arg=t;;){var r=s.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,s),r)){if(r===u)continue;return r}if("next"===s.method)s.sent=s._sent=s.arg;else if("throw"===s.method){if("suspendedStart"===o)throw o="completed",s.arg;s.dispatchException(s.arg)}else"return"===s.method&&s.abrupt("return",s.arg);if(o="executing","normal"===(r=l(i,a,s)).type){if(o=s.done?"completed":"suspendedYield",r.arg===u)continue;return{value:r.arg,done:s.done}}"throw"===r.type&&(o="completed",s.method="throw",s.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=o;var u={};function c(){}function h(){}function d(){}var p,f,m=(s(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){s(e,t,(function(e){return this._invoke(t,e)}))}))}function g(e,t){var n;this._invoke=function(i,a){function s(){return new t((function(n,s){!function n(i,a,s,o){var u;if("throw"!==(i=l(e[i],e,a)).type)return(a=(u=i.arg).value)&&"object"==le(a)&&r.call(a,"__await")?t.resolve(a.__await).then((function(e){n("next",e,s,o)}),(function(e){n("throw",e,s,o)})):t.resolve(a).then((function(e){u.value=e,s(u)}),(function(e){return n("throw",e,s,o)}));o(i.arg)}(i,a,n,s)}))}return n=n?n.then(s,s):s()}}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:S}}function S(){return{value:void 0,done:!0}}return s(m,"constructor",h.prototype=d),s(d,"constructor",h),h.displayName=s(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,s(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},v(g.prototype),s(g.prototype,i,(function(){return this})),e.AsyncIterator=g,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var s=new g(o(t,r,n,i),a);return e.isGeneratorFunction(r)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},v(m),s(m,a,"Generator"),s(m,n,(function(){return this})),s(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 s.type="throw",s.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],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var o=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(o&&l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(o){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 s=(a=a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc?null:a)?a.completion:{};return s.type=e,s.arg=t,a?(this.method="next",this.next=a.finallyLoc,u):this.complete(s)},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 oe(e,t,r,n,i,a,s){try{var o=e[a](s),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).then(n,i)}function le(e){return(le="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 ue(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ce(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 he(e,t,r){t&&ce(e.prototype,t),r&&ce(e,r),Object.defineProperty(e,"prototype",{writable:!1})}L.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),s=e.createInterpolant(new e.ValueBufferType(n));if(0===e.times.length){i[0]=t;for(var o=0;o<n;o++)a[o]=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(s.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(s.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(s.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 r=[],n={},i=e.tracks,a=0;a<i.length;++a){var s=i[a],l=o.PropertyBinding.parseTrackName(s.name),u=o.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(o.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===n[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,n[u.uuid]=d,r.push(d)}else{var m=s.createInterpolant(new s.ValueBufferType(1));d=n[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 de=function(){function e(){ue(this,e),this.pluginCallbacks=[],this.register((function(e){return new Ae(e)})),this.register((function(e){return new Me(e)})),this.register((function(e){return new Be(e)})),this.register((function(e){return new Ee(e)})),this.register((function(e){return new Te(e)})),this.register((function(e){return new Ce(e)}))}return he(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"===le(r)&&(console.warn("THREE.GLTFExporter: parse() expects options as the fourth argument now."),n=r);for(var i=new Se,a=[],s=0,o=this.pluginCallbacks.length;s<o;s++)a.push(this.pluginCallbacks[s](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}(),pe=5121,fe=5123,me=(i=9728,N=9729,z=9984,G=9985,j=9986,H=9987,V=33071,K=33648,J=10497,{}),ve=(me[o.NearestFilter]=i,me[o.NearestMipmapNearestFilter]=z,me[o.NearestMipmapLinearFilter]=j,me[o.LinearFilter]=N,me[o.LinearMipmapNearestFilter]=G,me[o.LinearMipmapLinearFilter]=H,me[o.ClampToEdgeWrapping]=V,me[o.RepeatWrapping]=J,me[o.MirroredRepeatWrapping]=K,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"});function ge(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function ye(e){return 4*Math.ceil(e/4)}function be(e,t){var r=1<arguments.length&&void 0!==t?t:0,n=ye(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 xe=null;function we(){return xe=xe||("undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"))}var Se=function(){function e(){ue(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 he(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=se().mark((function e(t,r,n){var i,a,s,o,l;return se().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=(s=this).buffers,i=s.json,n=s.options,s=s.extensionsUsed,a=new Blob(a,{type:"application/octet-stream"}),0<(s=Object.keys(s)).length&&(i.extensionsUsed=s),i.buffers&&0<i.buffers.length&&(i.buffers[0].byteLength=a.size),!0===n.binary?((o=new FileReader).readAsArrayBuffer(a),o.onloadend=function(){var e=be(o.result),t=new DataView(new ArrayBuffer(8)),n=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),be((n=JSON.stringify(i),(new TextEncoder).encode(n).buffer),32)),a=new DataView(new ArrayBuffer(8)),s=(a.setUint32(0,n.byteLength,!0),a.setUint32(4,1313821514,!0),new ArrayBuffer(12)),l=((u=new DataView(s)).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([s,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)})),r=function(){var e=this,r=arguments;return new Promise((function(n,i){var a=t.apply(e,r);function s(e){oe(a,n,i,s,o,"next",e)}function o(e){oe(a,n,i,s,o,"throw",e)}s(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 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 o.Vector3,r=0,n=e.count;r<n;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(),n=new o.Vector3,i=0,a=r.count;i<a;i++)n.fromBufferAttribute(r,i),0===n.x&&0===n.y&&0===n.z?n.setX(1):n.normalize(),r.setXYZ(i,n.x,n.y,n.z);return t.attributesNormalized.set(e,r),r}},{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 r=null==e?void 0:e.image,n=null==t?void 0:t.image,i=Math.max((null==r?void 0:r.width)||0,(null==n?void 0:n.width)||0),a=Math.max((null==r?void 0:r.height)||0,(null==n?void 0:n.height)||0),s=we(),l=(s.width=i,s.height=a,s.getContext("2d")),u=(l.fillStyle="#00ffff",l.fillRect(0,0,i,a),l.getImageData(0,0,i,a));if(r){l.drawImage(r,0,0,i,a);for(var c=l.getImageData(0,0,i,a).data,h=2;h<c.length;h+=4)u.data[h]=c[h]}if(n){l.drawImage(n,0,0,i,a);for(var d=l.getImageData(0,0,i,a).data,p=1;p<d.length;p+=4)u.data[p]=d[p]}return l.putImageData(u,0,0),(r=(e||t).clone()).source=new o.Source(s),r}},{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,s=this.json,o=(s.bufferViews||(s.bufferViews=[]),a=t===pe?1:t===fe?2:4,ye(n*e.itemSize*a)),l=new DataView(new ArrayBuffer(o)),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===fe?l.setUint16(u,d,!0):t===pe&&l.setUint8(u,d),u+=a}var p={buffer:this.processBuffer(l.buffer),byteOffset:this.byteOffset,byteLength:o};return void 0!==i&&(p.target=i),34962===i&&(p.byteStride=e.itemSize*a),this.byteOffset+=o,s.bufferViews.push(p),{id:s.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=be(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,s=this.json;if(e.array.constructor===Float32Array)i=5126;else if(e.array.constructor===Uint32Array)i=5125;else if(e.array.constructor===Uint16Array)i=fe;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");i=pe}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 s=void 0;4<e.itemSize?s=e.array[i*e.itemSize+a]:0===a?s=e.getX(i):1===a?s=e.getY(i):2===a?s=e.getZ(i):3===a&&(s=e.getW(i)),n.min[a]=Math.min(n.min[a],s),n.max[a]=Math.max(n.max[a],s)}return n}(e,r,n);var o,l=(void 0!==t&&(o=e===t.index?34963:34962),this.processBufferView(e,i,r,n,o));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),s.accessors||(s.accessors=[]),s.accessors.push(t)-1}},{key:"processImage",value:function(e,t,r){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"image/png",i=this,a=i.cache,s=i.json,l=i.options,u=i.pending,c=(a.images.has(e)||a.images.set(e,{}),a=a.images.get(e),n+":flipY/"+r.toString());if(void 0!==a[c])return a[c];s.images||(s.images=[]);var h={mimeType:n};if(l.embedImages){var d=we(),p=(d.width=Math.min(e.width,l.maxTextureSize),d.height=Math.min(e.height,l.maxTextureSize),d.getContext("2d"));if(!0===r&&(p.translate(0,d.height),p.scale(1,-1)),void 0!==e.data){t!==o.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?(r=void 0!==d.toBlob?new Promise((function(e){return d.toBlob(e,n)})):d.convertToBlob({type:n}),u.push(r.then((function(e){return i.processBufferViewImage(e).then((function(e){h.bufferView=e}))})))):h.uri=d.toDataURL(n)}else h.uri=e.src;return t=s.images.push(h)-1,a[c]=t}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter:me[e.magFilter],minFilter:me[e.minFilter],wrapS:me[e.wrapS],wrapT:me[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,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 n={pbrMetallicRoughness:{}},i=(!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."),e.color.toArray().concat([e.opacity])),a=(ge(i,[1,1,1,1])||(n.pbrMetallicRoughness.baseColorFactor=i),e.isMeshStandardMaterial?(n.pbrMetallicRoughness.metallicFactor=e.metalness,n.pbrMetallicRoughness.roughnessFactor=e.roughness):(n.pbrMetallicRoughness.metallicFactor=.5,n.pbrMetallicRoughness.roughnessFactor=.5),(e.metalnessMap||e.roughnessMap)&&(i=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),a={index:this.processTexture(i)},this.applyTextureTransform(a,i),n.pbrMetallicRoughness.metallicRoughnessTexture=a),e.map&&(i={index:this.processTexture(e.map)},this.applyTextureTransform(i,e.map),n.pbrMetallicRoughness.baseColorTexture=i),e.emissive&&(a=e.emissive.clone().multiplyScalar(e.emissiveIntensity),1<(i=Math.max(a.r,a.g,a.b))&&(a.multiplyScalar(1/i),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),0<i&&(n.emissiveFactor=a.toArray()),e.emissiveMap&&(i={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(i,e.emissiveMap),n.emissiveTexture=i)),e.normalMap&&(a={index:this.processTexture(e.normalMap)},e.normalScale&&1!==e.normalScale.x&&(a.scale=e.normalScale.x),this.applyTextureTransform(a,e.normalMap),n.normalTexture=a),e.aoMap&&(i={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(i.strength=e.aoMapIntensity),this.applyTextureTransform(i,e.aoMap),n.occlusionTexture=i),e.transparent?n.alphaMode="BLEND":0<e.alphaTest&&(n.alphaMode="MASK",n.alphaCutoff=e.alphaTest),e.side===o.DoubleSide&&(n.doubleSided=!0),""!==e.name&&(n.name=e.name),this.serializeUserData(e,n),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,n)})),r.materials.push(n)-1);return t.materials.set(e,a),a}},{key:"processMesh",value:function(e){var t=this.cache,r=this.json,n=[e.geometry.uuid];if(Array.isArray(e.material))for(var i=0,a=e.material.length;i<a;i++)n.push(e.material[i].uuid);else n.push(e.material.uuid);var s=n.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 o.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=[],S={};if(void 0!==e.morphTargetDictionary)for(var A in e.morphTargetDictionary)S[e.morphTargetDictionary[A]]=A;for(var M=0;M<e.morphTargetInfluences.length;++M){var B,C={},E=!1;for(B in l.morphAttributes)if("position"!==B&&"normal"!==B)E||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),E=!0);else{var T=l.morphAttributes[B][M],_=B.toUpperCase(),D=l.attributes[B];if(t.attributes.has(this.getUID(T)))C[_]=t.attributes.get(this.getUID(T));else{var P=T.clone();if(!l.morphTargetsRelative)for(var O=0,R=T.count;O<R;O++)P.setXYZ(O,T.getX(O)-D.getX(O),T.getY(O)-D.getY(O),T.getZ(O)-D.getZ(O));C[_]=this.processAccessor(P,l),t.attributes.set(this.getUID(D),C[_])}}v.push(C),x.push(e.morphTargetInfluences[M]),void 0!==e.morphTargetDictionary&&w.push(S[M])}p.weights=x,0<w.length&&(p.extras={},p.extras.targetNames=w)}if((y=Array.isArray(e.material))&&0===l.groups.length)return null;for(var I=y?e.material:[e.material],k=y?l.groups:[{materialIndex:0,start:void 0,count:void 0}],L=0,F=k.length;L<F;L++){var U={mode:u,attributes:f},G=(this.serializeUserData(l,U),0<v.length&&(U.targets=v),null!==l.index&&(G=this.getUID(l.index),void 0===k[L].start&&void 0===k[L].count||(G+=":"+k[L].start+":"+k[L].count),t.attributes.has(G)?U.indices=t.attributes.get(G):(U.indices=this.processAccessor(l.index,l,k[L].start,k[L].count),t.attributes.set(G,U.indices)),null===U.indices&&delete U.indices),this.processMaterial(I[k[L].materialIndex]));null!==G&&(U.material=G),m.push(U)}return p.primitives=m,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,p)})),y=r.meshes.push(p)-1,t.meshes.set(s,y),y}},{key:"processCamera",value:function(e){var t=this.json,r=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),n={type:r?"orthographic":"perspective"};return r?n.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:n.perspective={aspectRatio:e.aspect,yfov:o.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(n.name=e.type),t.cameras.push(n)-1}},{key:"processAnimation",value:function(e,t){for(var r=this.json,n=this.nodeMap,i=(r.animations||(r.animations=[]),(e=de.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),a=[],s=[],l=0;l<i.length;++l){var u=i[l],c=o.PropertyBinding.parseTrackName(u.name),h=o.PropertyBinding.findNode(t,c.nodeName),d=ve[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===ve.morphTargetInfluences&&(c/=h.morphTargetInfluences.length));!0===u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(p="CUBICSPLINE",c/=3):p=u.getInterpolation()===o.InterpolateDiscrete?"STEP":"LINEAR",s.push({input:this.processAccessor(new o.BufferAttribute(u.times,1)),output:this.processAccessor(new o.BufferAttribute(u.values,c)),interpolation:p}),a.push({sampler:s.length-1,target:{node:n.get(h),path:d}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:s,channels:a}),r.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,r=this.nodeMap,n=t.nodes[r.get(e)],i=e.skeleton;if(void 0===i)return null;var a=e.skeleton.bones[0];if(void 0===a)return null;for(var s=[],l=new Float32Array(16*i.bones.length),u=new o.Matrix4,c=0;c<i.bones.length;++c)s.push(r.get(i.bones[c])),u.copy(i.boneInverses[c]),u.multiply(e.bindMatrix).toArray(l,16*c);return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new o.BufferAttribute(l,16)),joints:s,skeleton:r.get(a)}),n.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,r,n=this.json,i=this.options,a=this.nodeMap,s=(n.nodes||(n.nodes=[]),{});if(i.trs?(r=e.quaternion.toArray(),h=e.position.toArray(),t=e.scale.toArray(),ge(r,[0,0,0,1])||(s.rotation=r),ge(h,[0,0,0])||(s.translation=h),ge(t,[1,1,1])||(s.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===ge(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(s.matrix=e.matrix.elements)),""!==e.name&&(s.name=String(e.name)),this.serializeUserData(e,s),e.isMesh||e.isLine||e.isPoints?null!==(r=this.processMesh(e))&&(s.mesh=r):e.isCamera&&(s.camera=this.processCamera(e)),e.isSkinnedMesh&&this.skins.push(e),0<e.children.length){for(var o=[],l=0,u=e.children.length;l<u;l++){var c=e.children[l];!c.visible&&!1!==i.onlyVisible||null!==(c=this.processNode(c))&&o.push(c)}0<o.length&&(s.children=o)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,s)}));var h=n.nodes.push(s)-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,s=e.children.length;a<s;a++){var o=e.children[a];!o.visible&&!1!==r.onlyVisible||null!==(o=this.processNode(o))&&i.push(o)}0<i.length&&(n.nodes=i),this.serializeUserData(e,n)}},{key:"processObjects",value:function(e){var t=new o.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)})),[]),n=0;n<e.length;n++)e[n]instanceof o.Scene?this.processScene(e[n]):r.push(e[n]);0<r.length&&this.processObjects(r);for(var i=0;i<this.skins.length;++i)this.processSkin(this.skins[i]);for(var a=0;a<t.animations.length;++a)this.processAnimation(t.animations[a],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}},{key:"_invokeAll",value:function(e){for(var t=0,r=this.plugins.length;t<r;t++)e(this.plugins[t])}}]),e}(),Ae=function(){function e(t){ue(this,e),this.writer=t,this.name="KHR_lights_punctual"}return he(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}(),Me=function(){function e(t){ue(this,e),this.writer=t,this.name="KHR_materials_unlit"}return he(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}(),Be=function(){function e(t){ue(this,e),this.writer=t,this.name="KHR_materials_pbrSpecularGlossiness"}return he(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}(),Ce=function(){function e(t){ue(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return he(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}(),Ee=function(){function e(t){ue(this,e),this.writer=t,this.name="KHR_materials_transmission"}return he(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}(),Te=function(){function e(t){ue(this,e),this.writer=t,this.name="KHR_materials_volume"}return he(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}(),_e=(de.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),s=e.createInterpolant(new e.ValueBufferType(n));if(0===e.times.length){i[0]=t;for(var o=0;o<n;o++)a[o]=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(s.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(s.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(s.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 r=[],n={},i=e.tracks,a=0;a<i.length;++a){var s=i[a],l=o.PropertyBinding.parseTrackName(s.name),u=o.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(o.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===n[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,n[u.uuid]=d,r.push(d)}else{var m=s.createInterpolant(new s.ValueBufferType(1));d=n[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}},r(272));class De{constructor(e){this.map=new _e.Z,this.loadMap=new M.Z,this.exportMap=new M.Z,this.runScene=e,this.loadMap}bind(e){this.processMap(e),this.map.add(e)}processMap(e){e.loadCallBacks.map(((e,t)=>{let r=this.loadMap.get(e);r||(r=new _e.Z,this.loadMap.set(e,r)),r.add(t)})),e.exportCallBacks.map(((e,t)=>{let r=this.exportMap.get(e);r||(r=new _e.Z,this.exportMap.set(e,r)),r.add(t)}))}loadCallback(e){const{type:t,json:r,data:n,config:i,core:a}=e;return null==(e=this.loadMap.get(t))?void 0:e.map((e=>e({json:r,data:n,config:i,core:a})))}}var Pe=r(625),Oe=r(330),Re=r(269),Ie=r(110),ke=r(932),Le=r(736),Fe=r(723);class Ue{constructor(e){this.materialMap={},this.textureMap={},this.modelType={Sprite:Ie.Z},this.geoDefMaterialMap=new M.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);"scene"===this.type&&this.parseScene(t),this.parseModel(e),this.materialMapToJson(),this.setMultipMaterial(t,Object.keys(this.textureMap))}createTextureGroup(e){const t=new o.Group;return t.name="back-texture-ex",t.userData.isHelper=!0,e.add(t),t}parseUnDelAbleTexture(){(0,s.mapObj)(this.runScene.uniqueEx.texture.map,((e,t)=>{t=t.texture,Pe.unDelAbleTexture.is(t)&&(this.mergeSame(t).isSame||this.parseTexture(t))}))}parseScene(e){this.helper.ex=Object.assign(Object.assign({},this.helper.ex),this._getBaseEx(e)),this.parseUnDelAbleTexture()}_getBaseEx(e){var t=this.runScene.sceneEx.get(),r=this.runScene.assetsEx.get().controls,n=this.runScene.optionsEx.exporterOptions.outTime,i=this.runScene.sceneEx.envStrength;return{version:{core:"0.0.81",editor:"0.0.2"},base64:(0,Fe.Ni)(String(n)),lights:Re.ZP.toJSON(this.runScene.lightEx.getLightsByScene()),camera:b.Z.toJSON(this.runScene),sceneEx:Object.assign(Object.assign({},Le.ZP.toJSON(t,this.runScene)),this._bindSceneTextures(e)),timeLine:this.runScene.timeLineEx.getSavedData(),envStrength:i,controls:A.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,Pe.isTexture)(t.background)||(0,Pe.isTexture)(t.environment)){this.runScene.pp.setUpdate(!1);const{background:n,environment:i}=t,a=(this.runScene.pp.setUpdate(!0),(0,d.createDefModel)("Box")),s=(0,ke.createDefMaterial)();a.material=s,e.add(a),t=s.userData.id,r.materialId=t;let o=[];(0,Pe.isTexture)(n)&&(n.userData.notCompress=!0,o.push({type:"map",texture:n}),303===(s.map=n).mapping&&(r.backgroundMapping=303)),(0,Pe.isTexture)(i)&&(i.userData.notCompress=!0,o.push({type:"envMap",texture:i}),s.envMap=i),this.materialMap[t]={normalMaterial:s,models:[],normal:{},textures:o}}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,d.withAnima)(e)&&(t=e.animations.map((e=>e.toJSON())),(0,Le.M)(e,"animations",t));let r=e;const n=this.modelType[e.type];n&&(t=n.modelTools.toNormal(e),e.parent.add(t),e.parent.remove(e),r=t),this.runScene.optionsEx.options.hideLocal&&this.compressLocal(r)}_processMaterial(e){if((0,ke.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{material:i,normal:a,textures:s}=t||this.runScene.optionsEx.exporterOptions.notMaterial?this.getMaterialFromModel(e):this.runScene.materialEx.toNromal(e.material);e.material=i,t=r.userData.id,i.userData.id=t,this.materialMap[t]={oldMaterial:r,normalMaterial:i,models:[e],normal:a,textures:s}}}materialMapToJson(){(0,s.mapObj)(this.materialMap,((e,t)=>{var{normalMaterial:t,textures:r,normal:n}=t,i=t.userData.id;this.helper.ex.materialMap[i]||(this.helper.ex.materialMap[i]={normal:n,textures:{}},this.mergeAndRemoveTexture(r,t))}))}mergeSame(e){e.userData||(e.userData={});var t=e.userData;if((0,Pe.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,Pe.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}}parseTexture(e){var t,{format:r,repeat:n,center:i,rotation:a,offset:s}=e;const o={format:r};this.runScene.modelEx.isNavieV2(n,1)||(({x:r,y:t}=n),o.repeat=r===t?r:n),this.runScene.modelEx.isNavieV2(i,0)||(({x:t,y:r}=i),o.center=t===r?t:i),this.runScene.modelEx.isNavieV2(s,0)||(({x:n,y:r}=s),o.offset=n===r?n:s),0!==a&&(o.rotation=a),this.helper.ex.textureMap[e.userData.id]=o}mergeAndRemoveTexture(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function a(e){try{o(n.next(e))}catch(e){i(e)}}function s(e){try{o(n.throw(e))}catch(e){i(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(a,s)}o((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;this.helper.ex.textureMap[n.userData.id]||this.parseTexture(n),"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,ke.createDefMaterial)();r.material=n,e.add(r);for(const e of Oe.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,ke.createDefMaterial)()),{material:this.geoDefMaterialMap.get(e),normal:{},textures:[]}):{material:this.runScene.materialEx.defMaterial,normal:{},textures:[]}}}var Ge=r(729);class Ne extends l{constructor(){super(...arguments),this.savedMap=new M.Z,this.clonedMap=new M.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,Ge.Ki)(e);e.material&&e.geometry&&((t=this.getSameNode(e))&&(0,d.setClonedModel)(e,t.id),this.savedMap.set(r,{id:r,geometryUuid:e.geometry.uuid,materialUuid:e.material.uuid}))}parseClonedModel(e){var t=(0,d.getClonedIdModel)(e),r=(0,Ge.Ki)(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,Ge.Ki)(e),n.newId=t),n.newId&&(n.newId!==r?(0,d.setClonedModel)(e,n.newId):(0,d.delClonedModel)(e)))}parseNode(e){(0,d.getClonedIdModel)(e)?this.parseClonedModel(e):this.parseUnClonedModel(e)}}class je{constructor(){this.savedMap=new M.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:s,uv:o}=e.attributes;if(r.array.length===a.array.length&&n.array.length===s.array.length&&i.array.length===o.array.length&&(a=(0,Fe.F1)([...r.array],[...a.array],20),s=(0,Fe.F1)([...n.array],[...s.array],20),o=(0,Fe.F1)([...i.array],[...o.array],20),a&&s&&o))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 ze{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 He{constructor(e){this.helperModels=[],this.mergeSameGeo=new je;var{type:e,runScene:t,model:r}=e;this.runScene=t,this.type=e,this.bindClondId=new Ne(t),this.ex={materialMap:{},textureMap:{},type:e},this.before=new Ue({helper:this,type:e,runScene:t}),this.before.parse(r)}parseNode(e){let{object:t,nodeDef:r}=e;return this.mergeSameGeo.parseNode(t),this.bindClondId.parseNode(t),(0,s.mapObj)(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),e=((null==(e=t.userData)?void 0:e.normal)||{}).type,t=e?this.runScene.modelEx.importAndExport.toNromal({type:e,model:t,runScene:this.runScene}):t}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.unDelAble=t.userData.unDelAble,r.uvScript=t.userData.uvScript,r.md5=t.userData.md5,r.id=t.userData.id,n&&(r.minFilter=n),(0,Pe.isClonedTexture)(t)&&(r.cloneSourceId=(0,Pe.getCloneIdFromTexture)(t)),r.format=t.userData.format,(0,Pe.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"]),this.runScene.cb.exporter.gltf.complete.cb({json:e})}}var Ve=function(e,t,r,n){return new(r=r||Promise)((function(i,a){function s(e){try{l(n.next(e))}catch(e){a(e)}}function o(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(s,o)}l((n=n.apply(e,t||[])).next())}))};class Je extends l{constructor(e){super(e),this._gltf=new L,this._originGltf=new de,this.options=new ze,this.module=new De(e)}getArrayBuffer(e=this.runScene.sceneEx.getClear(),t){return Ve(this,void 0,void 0,(function*(){const r=new He({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 Ve(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,t=!0){return Ve(this,void 0,void 0,(function*(){let r=e||this.runScene.modelEx.select,n=[];if(0!==(n=r?[r]:this.runScene.multipSelector.getSelectedList("value")).length){var i=(r=n[0]).name||r.type;const e=new o.Group;e.name="models",d.uselessGroup.set(e,!0),n.map((t=>e.add(this.runScene.modelEx.clone(t,!1))));var a=yield this.getArrayBuffer(e,"model");return t&&(0,s.downloadFile)(new Blob([a]),i+".glb"),a}}))}material(e){var t;return Ve(this,void 0,void 0,(function*(){if(r=e||(null==(t=this.runScene.modelEx.select)?void 0:t.material)){const e=(0,d.createDefModel)("Group");let t=r;(t=r instanceof Array?t:[r]).map((t=>{const r=(0,d.createDefModel)("Box");r.material=t,e.add(r)}));var r=r.name||"material",n=yield this.getArrayBuffer(e,"material");(0,s.downloadFile)(new Blob([n]),r+".glb")}}))}scene(e=!0,t="scene"){return Ve(this,void 0,void 0,(function*(){this.runScene.cb.exporter.gltf.before.cb(null);var r=yield this.getArrayBuffer(this.runScene.sceneEx.getClear(),t);return e&&(0,s.downloadFile)(new Blob([r]),"scene.glb"),r}))}originModel(e){return Ve(this,void 0,void 0,(function*(){var t,r;e&&(t=e.name||e.type,r=yield this.getOriginArrayBuffer(e),(0,s.downloadFile)(new Blob([r]),t+".glb"))}))}}class Ke extends l{constructor(e){super(e),this.gltf=new Je(e)}}var Ze={},We=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},Xe=function(e){return new Worker(e)};try{URL.revokeObjectURL(We(""))}catch(r){We=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)},Xe=function(e){return new Worker(e,{type:"module"})}}for(var Qe=Uint8Array,Ye=Uint16Array,qe=Uint32Array,$e=new Qe([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]),et=new Qe([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]),tt=new Qe([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),rt=(i=function(e,t){for(var r=new Ye(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];var i=new qe(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]},(z=i($e,2))[0]),nt=z[1],it=(rt[28]=258,nt[258]=28,j=i(et,0))[0],at=j[1],st=new Ye(32768),ot=0;ot<32768;++ot){var lt=(43690&ot)>>>1|(21845&ot)<<1;st[ot]=((65280&(lt=(61680&(lt=(52428<)>>>2|(13107<)<<2))>>>4|(3855<)<<4))>>>8|(255<)<<8)>>>1}var ut=function(e,t,r){for(var n=e.length,i=0,a=new Ye(t);i<n;++i)++a[e[i]-1];var s=new Ye(t);for(i=0;i<t;++i)s[i]=s[i-1]+a[i-1]<<1;if(r){var o=new Ye(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=s[e[i]-1]++<<c,d=h|(1<<c)-1;h<=d;++h)o[st[h]>>>l]=u}else for(o=new Ye(n),i=0;i<n;++i)e[i]&&(o[i]=st[s[e[i]-1]++]>>>15-e[i]);return o},ct=new Qe(288);for(ot=0;ot<144;++ot)ct[ot]=8;for(ot=144;ot<256;++ot)ct[ot]=9;for(ot=256;ot<280;++ot)ct[ot]=7;for(ot=280;ot<288;++ot)ct[ot]=8;var ht=new Qe(32);for(ot=0;ot<32;++ot)ht[ot]=5;function dt(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 pt(e,t,r,n,i){var a,s=Ht(e,n,i,(function(e,r){e?(s.terminate(),t.ondata.call(t,e)):(r[1]&&s.terminate(),t.ondata.call(t,e,r[0],r[1]))}));s.postMessage(r),t.push=function(e,r){if(a)throw"stream finished";if(!t.ondata)throw"no stream handler";s.postMessage([e,a=r],[e.buffer])},t.terminate=function(){s.terminate()}}function ft(e,t){return er(e,t)+4294967296*er(e,t+4)}var mt=ut(ct,9,0),vt=ut(ct,9,1),gt=ut(ht,5,0),yt=ut(ht,5,1),bt=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},xt=function(e,t,r){var n=t/8|0;return(e[n]|e[1+n]<<8)>>(7&t)&r},wt=function(e,t){var r=t/8|0;return(e[r]|e[1+r]<<8|e[2+r]<<16)>>(7&t)},St=function(e){return(e/8|0)+(7&e&&1)},At=function(e,t,r){(null==r||r>e.length)&&(r=e.length);var n=new(e instanceof Ye?Ye:e instanceof qe?qe:Qe)(r-(t=null==t||t<0?0:t));return n.set(e.subarray(t,r)),n},Mt=function(e,t,r){var n=e.length;if(!n||r&&!r.l&&n<5)return t||new Qe(0);function i(e){var r=t.length;r<e&&((r=new Qe(Math.max(2*r,e))).set(t),t=r)}var a=!t||r,s=!r||r.i,o=(r=r||{},t=t||new Qe(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=o=xt(e,l,1);var m=xt(e,l+1,3);if(l+=3,!m){var v=e[(B=St(l)+4)-4]|e[B-3]<<8;if(n<(S=B+v)){if(s)throw"unexpected EOF";break}a&&i(u+v),t.set(e.subarray(B,S),u),r.b=u+=v,r.p=l=8*S;continue}if(1==m)c=vt,h=yt,d=9,p=5;else{if(2!=m)throw"invalid block type";v=xt(e,l,31)+257;for(var g=xt(e,l+10,15)+4,y=v+xt(e,l+5,31)+1,b=(l+=14,new Qe(y)),x=new Qe(19),w=0;w<g;++w)x[tt[w]]=xt(e,l+3*w,7);l+=3*g;var S,A=(1<<(S=bt(x)))-1,M=ut(x,S,1);for(w=0;w<y;){var B,C=M[xt(e,l,A)];if(l+=15&C,(B=C>>>4)<16)b[w++]=B;else{var E=0,T=0;for(16==B?(T=3+xt(e,l,3),l+=2,E=b[w-1]):17==B?(T=3+xt(e,l,7),l+=3):18==B&&(T=11+xt(e,l,127),l+=7);T--;)b[w++]=E}}m=b.subarray(0,v);var _=b.subarray(v);d=bt(m),p=bt(_),c=ut(m,d,1),h=ut(_,p,1)}if(f<l){if(s)throw"unexpected EOF";break}}a&&i(u+131072);for(var D=(1<<d)-1,P=(1<<p)-1,O=l;;O=l){var R=(E=c[wt(e,l)&D])>>>4;if(f<(l+=15&E)){if(s)throw"unexpected EOF";break}if(!E)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=$e[w=R-257],k=xt(e,l,(1<<I)-1)+rt[w],l+=I),(R=h[wt(e,l)&P])>>>4);if(!R)throw"invalid distance";if(l+=15&R,_=it[L],3<L&&(I=et[L],_+=wt(e,l)&(1<<I)-1,l+=I),f<l){if(s)throw"unexpected EOF";break}a&&i(u+131072);for(var F=u+k;u<F;u+=4)t[u]=t[u-_],t[u+1]=t[u+1-_],t[u+2]=t[u+2-_],t[u+3]=t[u+3-_];u=F}}r.l=c,r.p=O,r.b=u,c&&(o=1,r.m=d,r.d=h,r.n=p)}while(!o);return u==t.length?t:At(t,0,u)},Bt=function(e,t,r){var n=t/8|0;e[n]|=r<<=7&t,e[1+n]|=r>>>8},Ct=function(e,t,r){var n=t/8|0;e[n]|=r<<=7&t,e[1+n]|=r>>>8,e[2+n]|=r>>>16},Et=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[It,0];if(1==i)return(m=new Qe(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 s=r[0],o=r[1],l=0,u=1,c=2;for(r[0]={s:-1,f:s.f+o.f,l:s,r:o};u!=i-1;)s=r[r[l].f<r[c].f?l++:c++],o=r[l!=u&&r[l].f<r[c].f?l++:c++],r[u++]={s:-1,f:s.f+o.f,l:s,r:o};var h=a[0].s;for(n=1;n<i;++n)a[n].s>h&&(h=a[n].s);var d=new Ye(h+1),p=Tt(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 Qe(d),p]},Tt=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},_t=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new Ye(++t),n=0,i=e[0],a=1,s=function(e){r[n++]=e},o=1;o<=t;++o)if(e[o]==i&&o!=t)++a;else{if(!i&&2<a){for(;138<a;a-=138)s(32754);2<a&&(s(10<a?a-11<<5|28690:a-3<<5|12305),a=0)}else if(3<a){for(s(i),--a;6<a;a-=6)s(8304);2<a&&(s(a-3<<5|8208),a=0)}for(;a--;)s(i);a=1,i=e[o]}return[r.subarray(0,n),t]},Dt=function(e,t){for(var r=0,n=0;n<t.length;++n)r+=e[n]*t[n];return r},Pt=function(e,t,r){var n=r.length,i=St(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)},Ot=function(e,t,r,n,i,a,s,o,l,u,c){Bt(t,c++,r),++i[256];for(var h=(r=Et(i,15))[0],d=(r=r[1],(p=Et(a,15))[0]),p=p[1],f=(m=_t(h))[0],m=m[1],v=(g=_t(d))[0],g=g[1],y=new Ye(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=Et(y,7))[0],w=w[1],S=19;4<S&&!x[tt[S-1]];--S);var A,M=u+5<<3,B=Dt(i,ct)+Dt(a,ht)+s;if(i=Dt(i,h)+Dt(a,d)+s+14+3*S+Dt(y,x)+(2*y[16]+3*y[17]+7*y[18]),M<=B&&M<=i)return Pt(t,c,e.subarray(l,l+u));if(Bt(t,c,1+(i<B)),c+=2,i<B){var C=ut(h,r,0),E=h,T=ut(d,p,0),_=d,D=ut(x,w,0);for(Bt(t,c,m-257),Bt(t,c+5,g-1),Bt(t,c+10,S-4),c+=14,b=0;b<S;++b)Bt(t,c+3*b,x[tt[b]]);c+=3*S;for(var P=[f,v],O=0;O<2;++O){var R=P[O];for(b=0;b<R.length;++b){var I=31&R[b];Bt(t,c,D[I]),c+=x[I],15<I&&(Bt(t,c,R[b]>>>5&127),c+=R[b]>>>12)}}}else C=mt,E=ct,T=gt,_=ht;for(b=0;b<o;++b)255<n[b]?(I=n[b]>>>18&31,Ct(t,c,C[I+257]),c+=E[I+257],7<I&&(Bt(t,c,n[b]>>>23&31),c+=$e[I]),A=31&n[b],Ct(t,c,T[A]),c+=_[A],3<A&&(Ct(t,c,n[b]>>>5&8191),c+=et[A])):(Ct(t,c,C[n[b]]),c+=E[n[b]]);return Ct(t,c,C[256]),c+E[256]},Rt=new qe([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),It=new Qe(0),kt=function(e,t,r,n,i,a){var s=e.length,o=new Qe(n+s+5*(1+Math.ceil(s/7e3))+i),l=o.subarray(n,o.length-i),u=0;if(!t||s<8)for(var c=0;c<=s;c+=65535){var h=c+65535;u=h<s?Pt(l,u,e.subarray(c,h)):(l[c]=a,Pt(l,u,e.subarray(c,s)))}else{for(var d=(t=Rt[t-1])>>>13,p=8191&t,f=(1<<r)-1,m=new Ye(32768),v=new Ye(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 qe(25e3),w=new Ye(288),S=new Ye(32),A=0,M=0,B=(c=0,0),C=0,E=0;c<s;++c){var T=b(c),_=32767&c,D=v[T];if(m[_]=D,v[T]=_,C<=c){var P=s-c;if((7e3<A||24576<B)&&423<P){u=Ot(e,l,0,x,w,S,M,B,E,c-E,u),B=A=M=0,E=c;for(var O=0;O<286;++O)w[O]=0;for(O=0;O<30;++O)S[O]=0}var R=2,I=0,k=p,L=_-D&32767;if(2<P&&T==b(c-L))for(var F=Math.min(d,P)-1,U=Math.min(32767,c),G=Math.min(258,P);L<=U&&--k&&_!=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),z=0;for(O=0;O<j;++O){var H=c-L+O+32768&32767,V=H-m[H]+32768&32767;z<V&&(z=V,D=H)}}}L+=(_=D)-(D=m[_])+32768&32767}I?(x[B++]=268435456|nt[R]<<18|at[I],T=31&nt[R],P=31&at[I],M+=$e[T]+et[P],++w[257+T],++S[P],C=c+R,++A):(x[B++]=e[c],++w[e[c]])}}u=Ot(e,l,a,x,w,S,M,B,E,c-E,u),!a&&7&u&&(u=Pt(l,u+1,It))}return At(o,0,n+St(u)+i)},Lt=function(){for(var e=new qe(256),t=0;t<256;++t){for(var r=t,n=9;--n;)r=(1&r&&3988292384)^r>>>1;e[t]=r}return e}(),Ft=function(){var e=-1;return{p:function(t){for(var r=e,n=0;n<t.length;++n)r=Lt[255&r^t[n]]^r>>>8;e=r},d:function(){return~e}}},Ut=function(){var e=1,t=0;return{p:function(r){for(var n=e,i=t,a=r.length,s=0;s!=a;){for(var o=Math.min(s+2655,a);s<o;++s)i+=n+=r[s];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}}},Gt=function(e,t,r,n,i){return kt(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)},Nt=function(e,t){var r,n={};for(r in e)n[r]=e[r];for(r in t)n[r]=t[r];return n},jt=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 s=n[a],o=i[a];if("function"==typeof s){t+=";"+o+"=";var l=s.toString();if(s.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,s.prototype)t+=";"+o+".prototype."+c+"="+s.prototype[c].toString();else t+=l}else r[o]=s}return[t,r]},zt=[],Ht=function(e,t,r,n){var i;if(!zt[r]){for(var a="",s={},o=e.length-1,l=0;l<o;++l)a=(i=jt(e[l],a,s))[0],s=i[1];zt[r]=jt(e[o],a,s)}var u=Nt({},zt[r][1]);return function(e,t,r,n,i){return(t=Xe(Ze[t]||(Ze[t]=We(e)))).onerror=function(e){return i(e.error,null)},t.onmessage=function(e){return i(null,e.data)},t.postMessage(r,n),t}(zt[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 Qe||e[t]instanceof Ye||e[t]instanceof qe)&&r.push((e[t]=new e[t].constructor(e[t])).buffer);return r}(u),n)},Vt=function(){return[Qe,Ye,qe,$e,et,tt,rt,it,vt,yt,st,ut,bt,xt,wt,St,At,Mt,vr,Qt,Yt]},Jt=function(){return[Qe,Ye,qe,$e,et,tt,nt,at,mt,ct,gt,ht,st,Rt,It,ut,Bt,Ct,Et,Tt,_t,Dt,Pt,Ot,St,At,kt,Gt,dr,Qt]},Kt=function(){return[rr,ar,tr,Ft,Lt]},Zt=function(){return[nr,ir]},Wt=function(){return[sr,tr,Ut]},Xt=function(){return[or]},Qt=function(e){return postMessage(e,[e.buffer])},Yt=function(e){return e&&e.size&&new Qe(e.size)},qt=function(e,t,r,n,i,a){var s=Ht(r,n,i,(function(e,t){s.terminate(),a(e,t)}));return s.postMessage([e,t],t.consume?[e.buffer]:[]),function(){s.terminate()}},$t=function(e,t){return e[t]|e[t+1]<<8},er=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},tr=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},rr=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&&tr(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)}},nr=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)},ir=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},ar=function(e){return 10+(e.filename&&e.filename.length+1||0)},sr=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)},or=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 lr(e,t){return t||"function"!=typeof e||(t=e,e={}),this.ondata=t,e}var ur=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(Gt(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}(),cr=function(e,t){pt([Jt,function(){return[dt,ur]}],this,lr.call(this,e,t),(function(e){e=new ur(e.data),onmessage=dt(e)}),6)};function hr(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return qt(e,t,[Jt],(function(e){return Qt(dr(e.data[0],e.data[1]))}),0,r)}function dr(e,t){return Gt(e,t||{},0,0)}var pr=function(){function e(e){this.s={},this.p=new Qe(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 Qe(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=Mt(this.p,this.o,this.s);this.ondata(At(t,e,this.s.b),this.d),this.o=At(t,this.s.b-32768),this.s.b=this.o.length,this.p=At(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),fr=function(e){this.ondata=e,pt([Vt,function(){return[dt,pr]}],this,0,(function(){var e=new pr;onmessage=dt(e)}),7)};function mr(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return qt(e,t,[Vt],(function(e){return Qt(vr(e.data[0],Yt(e.data[1])))}),1,r)}function vr(e,t){return Mt(e,t)}var gr=function(){function e(e,t){this.c=Ft(),this.l=0,this.v=1,ur.call(this,e,t)}return e.prototype.push=function(e,t){ur.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),this.l+=e.length,e=Gt(e,this.o,this.v&&ar(this.o),t&&8,!t),this.v&&(rr(e,this.o),this.v=0),t&&(tr(e,e.length-8,this.c.d()),tr(e,e.length-4,this.l)),this.ondata(e,t)},e}(),yr=function(e,t){pt([Jt,Kt,function(){return[dt,ur,gr]}],this,lr.call(this,e,t),(function(e){e=new gr(e.data),onmessage=dt(e)}),8)};function br(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return qt(e,t,[Jt,Kt,function(){return[xr]}],(function(e){return Qt(xr(e.data[0],e.data[1]))}),2,r)}function xr(e,t){t=t||{};var r=Ft(),n=e.length,i=(r.p(e),e=Gt(e,t,ar(t),8)).length;return rr(e,t),tr(e,i-8,r.d()),tr(e,i-4,n),e}var wr=function(){function e(e){this.v=1,pr.call(this,e)}return e.prototype.push=function(e,t){if(pr.prototype.e.call(this,e),this.v){if((e=3<this.p.length?nr(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)}pr.prototype.c.call(this,t)},e}(),Sr=function(e){this.ondata=e,pt([Vt,Zt,function(){return[dt,pr,wr]}],this,0,(function(){var e=new wr;onmessage=dt(e)}),9)};function Ar(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return qt(e,t,[Vt,Zt,function(){return[Mr]}],(function(e){return Qt(Mr(e.data[0]))}),3,r)}function Mr(e,t){return Mt(e.subarray(nr(e),-8),t||new Qe(ir(e)))}var Br=function(){function e(e,t){this.c=Ut(),this.v=1,ur.call(this,e,t)}return e.prototype.push=function(e,t){ur.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),e=Gt(e,this.o,this.v&&2,t&&4,!t),this.v&&(sr(e,this.o),this.v=0),t&&tr(e,e.length-4,this.c.d()),this.ondata(e,t)},e}(),Cr=function(e,t){pt([Jt,Wt,function(){return[dt,ur,Br]}],this,lr.call(this,e,t),(function(e){e=new Br(e.data),onmessage=dt(e)}),10)};function Er(e,t){t=t||{};var r=Ut();return r.p(e),e=Gt(e,t,2,4),sr(e,t),tr(e,e.length-4,r.d()),e}var Tr=function(){function e(e){this.v=1,pr.call(this,e)}return e.prototype.push=function(e,t){if(pr.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)}pr.prototype.c.call(this,t)},e}(),_r=function(e){this.ondata=e,pt([Vt,Xt,function(){return[dt,pr,Tr]}],this,0,(function(){var e=new Tr;onmessage=dt(e)}),11)};function Dr(e,t,r){if(r||(r=t,t={}),"function"!=typeof r)throw"no callback";return qt(e,t,[Vt,Xt,function(){return[Pr]}],(function(e){return Qt(Pr(e.data[0],Yt(e.data[1])))}),5,r)}function Pr(e,t){return Mt((or(e),e.subarray(2,-4)),t)}var Or=function(){function e(e){this.G=wr,this.I=pr,this.Z=Tr,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 Qe(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}(),Rr=function(){function e(e){this.G=Sr,this.I=fr,this.Z=_r,this.ondata=e}return e.prototype.push=function(e,t){Or.prototype.push.call(this,e,t)},e}(),Ir=function e(t,r,n,i){for(var a in t){var s=t[a];a=r+a,s instanceof Qe?n[a]=[s,i]:Array.isArray(s)?n[a]=[s[0],Nt(i,s[1])]:e(s,a+"/",n,i)}},kr="undefined"!=typeof TextEncoder&&new TextEncoder,Lr="undefined"!=typeof TextDecoder&&new TextDecoder,Fr=0;try{Lr.decode(It,{stream:!0}),Fr=1}catch(r){}var Ur=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,At(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)}},Gr=function(){function e(e){this.ondata=e,Fr?this.t=new TextDecoder:this.p=It}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 Qe(this.p.length+e.length)).set(this.p),r.set(e,this.p.length),e=Ur(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}(),Nr=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(jr(e),this.d=t||!1)},e}();function jr(e,t){if(t){for(var r=new Qe(e.length),n=0;n<e.length;++n)r[n]=e.charCodeAt(n);return r}if(kr)return kr.encode(e);var i=e.length,a=new Qe(e.length+(e.length>>1)),s=0,o=function(e){a[s++]=e};for(n=0;n<i;++n){s+5>a.length&&((l=new Qe(s+8+(i-n<<1))).set(a),a=l);var l=e.charCodeAt(n);l<128||t?o(l):(l<2048?o(192|l>>6):(55295<l&&l<57344?(o(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++n))>>18),o(128|l>>12&63)):o(224|l>>12),o(128|l>>6&63)),o(128|63&l))}return At(a,0,s)}function zr(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(Lr)return Lr.decode(e);var i=(t=Ur(e))[0];if(t[1].length)throw"invalid utf-8 data";return i}function Hr(e){return 1==e?3:e<6?2:9==e?1:0}var Vr=function(e,t){return t+30+$t(e,t+26)+$t(e,t+28)},Jr=function(e,t,r){var n=$t(e,t+28),i=zr(e.subarray(t+46,t+46+n),!(2048&$t(e,t+8))),a=(n=t+46+n,er(e,t+20)),s=(a=(r=r&&4294967295==a?Kr(e,n):[a,er(e,t+24),er(e,t+42)])[0],r[1]);return r=r[2],[$t(e,t+10),a,s,i,n+$t(e,t+30)+$t(e,t+32),r]},Kr=function(e,t){for(;1!=$t(e,t);t+=4+$t(e,t+2));return[ft(e,t+12),ft(e,t+4),ft(e,t+20)]},Zr=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},Wr=function(e,t,r,n,i,a,s,o){var l=n.length,u=r.extra,c=o&&o.length,h=Zr(u),d=(tr(e,t,null!=s?33639248:67324752),t+=4,null!=s&&(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(tr(e,t,d<<25|i.getMonth()+1<<21|i.getDate()<<16|i.getHours()<<11|i.getMinutes()<<5|i.getSeconds()>>>1),t+=4,null!=a&&(tr(e,t,r.crc),tr(e,t+4,a),tr(e,t+8,r.size)),tr(e,t+12,l),tr(e,t+14,h),t+=16,null!=s&&(tr(e,t,c),tr(e,t+6,r.attrs),tr(e,t+10,s),t+=14),e.set(n,t),t+=l,h)for(var p in u){var f=u[p],m=f.length;tr(e,t,+p),tr(e,t+2,m),e.set(f,t+4),t+=4+m}return c&&(e.set(o,t),t+=c),t},Xr=function(e,t,r,n,i){tr(e,t,101010256),tr(e,t+8,r),tr(e,t+10,r),tr(e,t+12,n),tr(e,t+16,i)},Qr=function(){function e(e){this.filename=e,this.c=Ft(),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}(),Yr=function(){function e(e,t){var r=this;t=t||{},Qr.call(this,e),this.d=new ur(t,(function(e,t){r.ondata(null,e,t)})),this.compression=8,this.flag=Hr(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){Qr.prototype.push.call(this,e,t)},e}(),qr=function(){function e(e,t){var r=this;t=t||{},Qr.call(this,e),this.d=new cr(t,(function(e,t,n){r.ondata(e,t,n)})),this.compression=8,this.flag=Hr(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){Qr.prototype.push.call(this,e,t)},e}(),$r=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=jr(e.filename),n=r.length,i=(a=e.comment)&&jr(a),a=n!=e.filename.length||i&&a.length!=i.length,s=n+Zr(e.extra)+30;if(65535<n)throw"filename too long";function o(){for(var e=0,r=l;e<r.length;e++){var n=r[e];t.ondata(null,n,!1)}l=[]}n=new Qe(s);var l=(Wr(n,0,e,r,a),[n]),u=this.d,c=(this.d=0,this.u.length),h=Nt(e,{f:r,u:a,o:i,t:function(){e.terminate&&e.terminate()},r:function(){var e;o(),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 Qe(16),tr(r,0,134695760),tr(r,4,e.crc),tr(r,8,d),tr(r,12,e.size),l.push(r),h.c=d,h.b=s+d+16,h.crc=e.crc,h.size=e.size,u&&h.r(),u=1):u&&o())},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+Zr(l.extra)+(l.o?l.o.length:0);for(var a=new Qe(r+22),s=0,o=this.u;s<o.length;s++){var l=o[s];Wr(a,e,l,l.f,l.u,l.c,t,l.o),e+=46+l.f.length+Zr(l.extra)+(l.o?l.o.length:0),t+=l.b}Xr(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}(),en=function(){function e(){}return e.prototype.push=function(e,t){this.ondata(null,e,t)},e.compression=0,e}(),tn=function(){function e(){var e=this;this.i=new pr((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}(),rn=function(){function e(e,t){var r=this;t<32e4?this.i=new pr((function(e,t){r.ondata(null,e,t)})):(this.i=new fr((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=At(e,0)),this.i.push(e,t)},e.compression=8,e}(),nn=function(){function e(e){this.onfile=e,this.k=[],this.o={0:en},this.p=It}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,s=0,o=void 0,l=void 0,u=(this.p.length?e.length?((l=new Qe(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);s<u-4&&"break"!==function(){var e,t,n,i,d,p,f,m,v,g,y,b=er(l,s);return 67324752==b?(a=1,o=s,h.d=null,h.c=0,n=$t(l,s+6),e=$t(l,s+8),t=2048&n,n&=8,i=$t(l,s+26),d=$t(l,s+28),s+30+i+d<u&&(h.k.unshift(p=[]),a=2,f=er(l,s+18),m=er(l,s+22),v=zr(l.subarray(s+30,s+=30+i),!t),4294967295==f?(i=n?[-2]:Kr(l,s),f=i[0],m=i[1]):n&&(f=-1),s+=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(It,!0)}else y.ondata(null,It,!0)},terminate:function(){g&&g.terminate&&g.terminate()}},0<=f&&(y.size=f,y.originalSize=m),h.onfile(y)),"break"):c?134695760==b?(o=s+=12+(-2==c&&8),a=3,h.c=0,"break"):33639248==b?(o=s-=4,a=3,h.c=0,"break"):void 0:void 0}();++s);if(this.p=It,c<0&&(n=a?l.subarray(0,o-12-(-2==c&&8)-(134695760==er(l,o-16)&&4)):l.subarray(0,s),i?i.push(n,!!a):this.k[+(2==a)].push(n)),2&a)return this.push(l.subarray(s),t);this.p=l.subarray(s)}if(t){if(this.c)throw"invalid zip file";this.p=null}},e.prototype.register=function(e){this.o[e.compression]=e},e}();function an(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,s=Math.floor((i+a)/2);t<r[s]||t>=r[s+1];)t<r[s]?a=s:i=s,s=Math.floor((i+a)/2);return s}function sn(e,t,r,n){for(var i=[],a=[],s=[],o=i[0]=1;o<=r;++o){a[o]=t-n[e+1-o],s[o]=n[e+o]-t;for(var l=0,u=0;u<o;++u){var c=s[u+1],h=a[o-u],d=i[u]/(c+h);i[u]=l+c*d,l=h*d}i[o]=l}return i}function on(e,t,r,n,i){for(var a=i<e?i:e,s=[],l=an(e,n,t),u=function(e,t,r,n,i){for(var a=[],s=0;s<=r;++s)a[s]=0;for(var o=[],l=0;l<=n;++l)o[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)o[0][b]=u[b][r];for(var x=0;x<=r;++x){for(var w=0,S=1,A=[],M=0;M<=r;++M)A[M]=a.slice(0);for(var B=A[0][0]=1;B<=n;++B){var C=0,E=x-B,T=r-B;B<=x&&(A[S][0]=A[w][0]/u[1+T][E],C=A[S][0]*u[E][T]);for(var _=x-1<=T?B-1:r-x,D=-1<=E?1:-E;D<=_;++D)A[S][D]=(A[w][D]-A[w][D-1])/u[1+T][E+D],C+=A[S][D]*u[E+D][T];x<=T&&(A[S][B]=-A[w][B-1]/u[1+T][x],C+=A[S][B]*u[x][T]),o[B][x]=C;var P=w;w=S,S=P}}for(var O=r,R=1;R<=n;++R){for(var I=0;I<=r;++I)o[R][I]*=O;O*=r-R}return o}(l,n,e,a,t),c=[],h=0;h<r.length;++h){var d=r[h].clone(),p=d.w;d.x*=p,d.y*=p,d.z*=p,c[h]=d}for(var f=0;f<=a;++f){for(var m=c[l-e].clone().multiplyScalar(u[f][0]),v=1;v<=e;++v)m.add(c[l-e+v].clone().multiplyScalar(u[f][v]));s[f]=m}for(var g=a+1;g<=i+1;++g)s[g]=new o.Vector4(0,0,0);return s}function ln(e){for(var t=e.length,r=[],n=[],i=0;i<t;++i){var a=e[i];r[i]=new o.Vector3(a.x,a.y,a.z),n[i]=a.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 r=1,n=2;n<=e;++n)r*=n;for(var i=1,a=2;a<=t;++a)i*=a;for(var s=2;s<=e-t;++s)i*=s;return r/i}(l,c)*n[c]));s[l]=u.divideScalar(n[0])}return s}function un(e){return(un="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 cn(e,t){return(cn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function hn(e){return(hn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var dn,pn,fn,mn=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&&cn(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=hn(e);if(r=t?(r=hn(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===un(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,t,i,a,s){var l;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");(l=r.call(this)).degree=e,l.knots=t,l.controlPoints=[],l.startKnot=a||0,l.endKnot=s||l.knots.length-1;for(var u=0;u<i.length;++u){var c=i[u];l.controlPoints[u]=new o.Vector4(c.x,c.y,c.z,c.w)}return l}return t=n,(e=[{key:"getPoint",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new o.Vector3;return e=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),e=function(e,t,r,n){for(var i=an(e,n,t),a=sn(i,n,e,t),s=new o.Vector4(0,0,0,0),l=0;l<=e;++l){var u=r[i-e+l],c=a[l],h=u.w*c;s.x+=u.x*h,s.y+=u.y*h,s.z+=u.z*h,s.w+=u.w*c}return s}(this.degree,this.knots,this.controlPoints,e),1!==e.w&&e.divideScalar(e.w),t.set(e.x,e.y,e.z)}},{key:"getTangent",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new o.Vector3,r=(e=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),ln(on(r=this.degree,this.knots,this.controlPoints,e,1)));return t.copy(r[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}),n}(o.Curve);function vn(e){return(vn="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 gn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yn(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 bn(e,t,r){t&&yn(e.prototype,t),r&&yn(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function xn(e,t){return(xn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function wn(e){return(wn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Sn=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&&xn(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=wn(e);if(r=t?(r=wn(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===vn(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){return gn(this,n),r.call(this,e)}return bn(n,[{key:"load",value:function(e,t,r,n){var i=this,a=""===i.path?o.LoaderUtils.extractUrlBase(e):i.path,s=new o.FileLoader(this.manager);s.setPath(i.path),s.setResponseType("arraybuffer"),s.setRequestHeader(i.requestHeader),s.setWithCredentials(i.withCredentials),s.load(e,(function(r){try{t(i.parse(r,a))}catch(r){n?n(r):console.error(r),i.manager.itemError(e)}}),r,n)}},{key:"parse",value:function(e,t){if(n="Kaydara FBX Binary \0",(r=e).byteLength>=n.length&&n===Gn(r,0,n.length))dn=(new En).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}(r=Gn(e)))throw new Error("THREE.FBXLoader: Unknown format.");if(Dn(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Dn(r));dn=(new Cn).parse(r)}var r,n=new o.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new An(n,this.manager).parse(dn)}}]),n}(o.Loader),An=function(){function e(t,r){gn(this,e),this.textureLoader=t,this.manager=r}return bn(e,[{key:"parse",value:function(){pn=this.parseConnections();var e=this.parseImages(),t=(e=this.parseTextures(e),e=this.parseMaterials(e),this.parseDeformers()),r=(new Mn).parse(t);return this.parseScene(t,r,e),fn}},{key:"parseConnections",value:function(){var e=new Map;return"Connections"in dn&&dn.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 dn.Objects){var n,i=dn.Objects.Video;for(n in i){var a,s,o=i[n];t[parseInt(n)]=o.RelativeFilename||o.Filename,"Content"in o&&(s=o.Content instanceof ArrayBuffer&&0<o.Content.byteLength,a="string"==typeof o.Content&&""!==o.Content,(s||a)&&(s=this.parseImage(i[n]),r[o.RelativeFilename||o.Filename]=s))}}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 dn.Objects){var r,n=dn.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 r=((t=this.loadTexture(e,t)).ID=e.id,t.name=e.attrName,e.WrapModeU),n=e.WrapModeV;return r=void 0!==r?r.value:0,n=void 0!==n?n.value:0,t.wrapS=0===r?o.RepeatWrapping:o.ClampToEdgeWrapping,t.wrapT=0===n?o.RepeatWrapping:o.ClampToEdgeWrapping,"Scaling"in e&&(r=e.Scaling.value,t.repeat.x=r[0],t.repeat.y=r[1]),"Translation"in e&&(n=e.Translation.value,t.offset.x=n[0],t.offset.y=n[1]),t}},{key:"loadTexture",value:function(e,t){var r,n=this.textureLoader.path,i=pn.get(e.id).children;return i="tga"===(void 0!==i&&0<i.length&&void 0!==t[i[0].ID]&&(0!==(r=t[i[0].ID]).indexOf("blob:")&&0!==r.indexOf("data:")||this.textureLoader.setPath(void 0)),t=e.FileName.slice(-3).toLowerCase())?null===(i=this.manager.getHandler(".tga"))?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),new o.Texture):(i.setPath(this.textureLoader.path),i.load(r)):"psd"===t?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),new o.Texture):this.textureLoader.load(r),this.textureLoader.setPath(n),i}},{key:"parseMaterials",value:function(e){var t=new Map;if("Material"in dn.Objects){var r,n=dn.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 r,n=e.id,i=e.attrName,a=e.ShadingModel;if("object"===vn(a)&&(a=a.value),!pn.has(n))return null;switch(e=this.parseParameters(e,t,n),a.toLowerCase()){case"phong":r=new o.MeshPhongMaterial;break;case"lambert":r=new o.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',a),r=new o.MeshPhongMaterial}return r.setValues(e),r.name=i,r}},{key:"parseParameters",value:function(e,t,r){var n={},i=(e.BumpFactor&&(n.bumpScale=e.BumpFactor.value),e.Diffuse?n.color=(new o.Color).fromArray(e.Diffuse.value):!e.DiffuseColor||"Color"!==e.DiffuseColor.type&&"ColorRGB"!==e.DiffuseColor.type||(n.color=(new o.Color).fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(n.displacementScale=e.DisplacementFactor.value),e.Emissive?n.emissive=(new o.Color).fromArray(e.Emissive.value):!e.EmissiveColor||"Color"!==e.EmissiveColor.type&&"ColorRGB"!==e.EmissiveColor.type||(n.emissive=(new o.Color).fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(n.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(n.opacity=parseFloat(e.Opacity.value)),n.opacity<1&&(n.transparent=!0),e.ReflectionFactor&&(n.reflectivity=e.ReflectionFactor.value),e.Shininess&&(n.shininess=e.Shininess.value),e.Specular?n.specular=(new o.Color).fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(n.specular=(new o.Color).fromArray(e.SpecularColor.value)),this);return pn.get(r).children.forEach((function(e){var r=e.relationship;switch(r){case"Bump":n.bumpMap=i.getTexture(t,e.ID);break;case"Maya|TEX_ao_map":n.aoMap=i.getTexture(t,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":n.map=i.getTexture(t,e.ID),void 0!==n.map&&(n.map.encoding=o.sRGBEncoding);break;case"DisplacementColor":n.displacementMap=i.getTexture(t,e.ID);break;case"EmissiveColor":n.emissiveMap=i.getTexture(t,e.ID),void 0!==n.emissiveMap&&(n.emissiveMap.encoding=o.sRGBEncoding);break;case"NormalMap":case"Maya|TEX_normal_map":n.normalMap=i.getTexture(t,e.ID);break;case"ReflectionColor":n.envMap=i.getTexture(t,e.ID),void 0!==n.envMap&&(n.envMap.mapping=o.EquirectangularReflectionMapping,n.envMap.encoding=o.sRGBEncoding);break;case"SpecularColor":n.specularMap=i.getTexture(t,e.ID),void 0!==n.specularMap&&(n.specularMap.encoding=o.sRGBEncoding);break;case"TransparentColor":case"TransparencyFactor":n.alphaMap=i.getTexture(t,e.ID),n.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",r)}})),n}},{key:"getTexture",value:function(e,t){return"LayeredTexture"in dn.Objects&&t in dn.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=pn.get(t).children[0].ID),e.get(t)}},{key:"parseDeformers",value:function(){var e={},t={};if("Deformer"in dn.Objects){var r,n=dn.Objects.Deformer;for(r in n){var i,a=n[r],s=pn.get(parseInt(r));"Skin"===a.attrType?((i=this.parseSkeleton(s,n)).ID=r,1<s.parents.length&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),i.geometryID=s.parents[0].ID,e[r]=i):"BlendShape"===a.attrType&&((i={id:r}).rawTargets=this.parseMorphTargets(s,n),i.id=r,1<s.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 r=[];return e.children.forEach((function(e){var n=t[e.ID];"Cluster"===n.attrType&&(e={ID:e.ID,indices:[],weights:[],transformLink:(new o.Matrix4).fromArray(n.TransformLink.a)},"Indexes"in n&&(e.indices=n.Indexes.a,e.weights=n.Weights.a),r.push(e))})),{rawBones:r,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],s={name:a.attrName,initialWeight:a.DeformPercent,id:a.id,fullWeights:a.FullWeights.a};if("BlendShapeChannel"!==a.attrType)return;s.geoID=pn.get(parseInt(i.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,r.push(s)}return r}},{key:"parseScene",value:function(e,t,r){fn=new o.Group;var n=this.parseModels(e.skeletons,t,r),i=dn.Objects.Model,a=this;n.forEach((function(e){var t=i[e.ID];a.setLookAtProperties(e,t),pn.get(e.ID).parents.forEach((function(t){void 0!==(t=n.get(t.ID))&&t.add(e)})),null===e.parent&&fn.add(e)})),this.bindSkeleton(e.skeletons,t,n),this.createAmbientLight(),fn.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=Ln(e.userData.transformData),e.applyMatrix4(t),e.updateWorldMatrix())})),r=(new Bn).parse(),1===fn.children.length&&fn.children[0].isGroup&&(fn.children[0].animations=r,fn=fn.children[0]),fn.animations=r}},{key:"parseModels",value:function(e,t,r){var n,i=new Map,a=dn.Objects.Model;for(n in a){var s=parseInt(n),l=a[n],u=pn.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 o.Bone;break;default:c=new o.Group}c.name=l.attrName?o.PropertyBinding.sanitizeNodeName(l.attrName):"",c.ID=s}this.getTransformData(c,l),i.set(s,c)}return i}},{key:"buildSkeleton",value:function(e,t,r,n){var i=null;return e.parents.forEach((function(e){for(var a in t)!function(a){var s=t[a];s.rawBones.forEach((function(t,a){var l;t.ID===e.ID&&(l=i,(i=new o.Bone).matrixWorld.copy(t.transformLink),i.name=n?o.PropertyBinding.sanitizeNodeName(n):"",i.ID=r,s.bones[a]=i,null!==l&&i.add(l))}))}(a)})),i}},{key:"createCamera",value:function(e){var t,r;if(e.children.forEach((function(e){void 0!==(e=dn.Objects.NodeAttribute[e.ID])&&(r=e)})),void 0===r)t=new o.Object3D;else{var n=0,i=(void 0!==r.CameraProjectionType&&1===r.CameraProjectionType.value&&(n=1),1),a=(void 0!==r.NearPlane&&(i=r.NearPlane.value/1e3),1e3),s=(void 0!==r.FarPlane&&(a=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(n){case 0:t=new o.PerspectiveCamera(c,u,i,a),null!==h&&t.setFocalLength(h);break;case 1:t=new o.OrthographicCamera(-s/2,s/2,l/2,-l/2,i,a);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+n+"."),t=new o.Object3D}}return t}},{key:"createLight",value:function(e){var t,r;if(e.children.forEach((function(e){void 0!==(e=dn.Objects.NodeAttribute[e.ID])&&(r=e)})),void 0===r)t=new o.Object3D;else{e=void 0===r.LightType?0:r.LightType.value;var n=16777215,i=(void 0!==r.Color&&(n=(new o.Color).fromArray(r.Color.value)),void 0===r.Intensity?1:r.Intensity.value/100),a=(void 0!==r.CastLightOnObject&&0===r.CastLightOnObject.value&&(i=0),0);switch(void 0!==r.FarAttenuationEnd&&(a=void 0!==r.EnableFarAttenuation&&0===r.EnableFarAttenuation.value?0:r.FarAttenuationEnd.value),e){case 0:t=new o.PointLight(n,i,a,1);break;case 1:t=new o.DirectionalLight(n,i);break;case 2:var s=Math.PI/3,l=(void 0!==r.InnerAngle&&(s=o.MathUtils.degToRad(r.InnerAngle.value)),0);void 0!==r.OuterAngle&&(l=o.MathUtils.degToRad(r.OuterAngle.value),l=Math.max(l,1)),t=new o.SpotLight(n,i,a,s,l,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+r.LightType.value+", defaulting to a PointLight."),t=new o.PointLight(n,i)}void 0!==r.CastShadows&&1===r.CastShadows.value&&(t.castShadow=!0)}return t}},{key:"createMesh",value:function(e,t,r){var n,i=null,a=null,s=[];return e.children.forEach((function(e){t.has(e.ID)&&(i=t.get(e.ID)),r.has(e.ID)&&s.push(r.get(e.ID))})),1<s.length?a=s:0<s.length?a=s[0]:(a=new o.MeshPhongMaterial({color:13421772}),s.push(a)),"color"in i.attributes&&s.forEach((function(e){e.vertexColors=!0})),i.FBX_Deformer?(n=new o.SkinnedMesh(i,a)).normalizeSkinWeights():n=new o.Mesh(i,a),n}},{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 r=new o.LineBasicMaterial({color:3342591,linewidth:1});return new o.Line(e,r)}},{key:"getTransformData",value:function(e,t){var r={};"InheritType"in t&&(r.inheritType=parseInt(t.InheritType.value)),r.eulerOrder="RotationOrder"in t?Fn(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&&pn.get(e.ID).children.forEach((function(t){"LookAtProperty"===t.relationship&&"Lcl_Translation"in(t=dn.Objects.Model[t.ID])&&(t=t.Lcl_Translation.value,void 0!==e.target?(e.target.position.fromArray(t),fn.add(e.target)):e.lookAt((new o.Vector3).fromArray(t)))}))}},{key:"bindSkeleton",value:function(e,t,r){var n,i=this.parsePoseNodes();for(n in e)!function(n){var a=e[n];pn.get(parseInt(a.ID)).parents.forEach((function(e){t.has(e.ID)&&(e=e.ID,pn.get(e).parents.forEach((function(e){r.has(e.ID)&&r.get(e.ID).bind(new o.Skeleton(a.bones),i[e.ID])})))}))}(n)}},{key:"parsePoseNodes",value:function(){var e={};if("Pose"in dn.Objects){var t,r,n=dn.Objects.Pose;for(t in n)"BindPose"===n[t].attrType&&0<n[t].NbPoseNodes&&(r=n[t].PoseNode,Array.isArray(r)?r.forEach((function(t){e[t.Node]=(new o.Matrix4).fromArray(t.Matrix.a)})):e[r.Node]=(new o.Matrix4).fromArray(r.Matrix.a))}return e}},{key:"createAmbientLight",value:function(){var e,t,r;"GlobalSettings"in dn&&"AmbientColor"in dn.GlobalSettings&&(r=(t=dn.GlobalSettings.AmbientColor.value)[0],e=t[1],t=t[2],0===r&&0===e&&0===t||(r=new o.Color(r,e,t),fn.add(new o.AmbientLight(r,1))))}}]),e}(),Mn=function(){function e(){gn(this,e)}return bn(e,[{key:"parse",value:function(e){var t=new Map;if("Geometry"in dn.Objects){var r,n=dn.Objects.Geometry;for(r in n){var i=pn.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=[],s=e.parents.map((function(e){return dn.Objects.Model[e.ID]}));if(0!==s.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=s[0],s={},"RotationOrder"in e&&(s.eulerOrder=Fn(e.RotationOrder.value)),"InheritType"in e&&(s.inheritType=parseInt(e.InheritType.value)),"GeometricTranslation"in e&&(s.translation=e.GeometricTranslation.value),"GeometricRotation"in e&&(s.rotation=e.GeometricRotation.value),"GeometricScaling"in e&&(s.scale=e.GeometricScaling.value),e=Ln(s),this.genGeometry(t,n,a,e)}},{key:"genGeometry",value:function(e,t,r,n){var i,a,s=new o.BufferGeometry,l=(e.attrName&&(s.name=e.attrName),this.parseGeoNode(e,t)),u=this.genBuffers(l),c=new o.Float32BufferAttribute(u.vertex,3);return c.applyMatrix4(n),s.setAttribute("position",c),0<u.colors.length&&s.setAttribute("color",new o.Float32BufferAttribute(u.colors,3)),t&&(s.setAttribute("skinIndex",new o.Uint16BufferAttribute(u.weightsIndices,4)),s.setAttribute("skinWeight",new o.Float32BufferAttribute(u.vertexWeights,4)),s.FBX_Deformer=t),0<u.normal.length&&(c=(new o.Matrix3).getNormalMatrix(n),(t=new o.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 o.Float32BufferAttribute(u.uvs[t],2))})),l.material&&"AllSame"!==l.material.mappingType&&(i=u.materialIndex[0],a=0,u.materialIndex.forEach((function(e,t){e!==i&&(s.addGroup(a,t-a,i),i=e,a=t)})),0<s.groups.length&&(t=(c=s.groups[s.groups.length-1]).start+c.count)!==u.materialIndex.length&&s.addGroup(t,u.materialIndex.length-t,i),0===s.groups.length&&s.addGroup(0,u.materialIndex.length,u.materialIndex[0])),this.addMorphTargets(s,e,r,n),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=[],s=[],o=[],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=Rn(p,r,d,e.color),o.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=Rn(p,r,d,e.normal),s.push(g[0],g[1],g[2])),e.material&&"AllSame"!==e.material.mappingType&&(f=Rn(p,r,d,e.material)[0]),e.uv&&e.uv.forEach((function(e,t){e=Rn(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,s,o,l,u,c,n),r++,n=0,a=[],s=[],o=[],l=[],u=[],c=[])})),t}},{key:"genFace",value:function(e,t,r,n,i,a,s,o,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(o[0]),e.vertexWeights.push(o[1]),e.vertexWeights.push(o[2]),e.vertexWeights.push(o[3]),e.vertexWeights.push(o[4*(u-1)]),e.vertexWeights.push(o[4*(u-1)+1]),e.vertexWeights.push(o[4*(u-1)+2]),e.vertexWeights.push(o[4*(u-1)+3]),e.vertexWeights.push(o[4*u]),e.vertexWeights.push(o[4*u+1]),e.vertexWeights.push(o[4*u+2]),e.vertexWeights.push(o[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(s[r][0]),e.uvs[r].push(s[r][1]),e.uvs[r].push(s[r][2*(u-1)]),e.uvs[r].push(s[r][2*(u-1)+1]),e.uvs[r].push(s[r][2*u]),e.uvs[r].push(s[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=dn.Objects.Geometry[r.geoID];void 0!==a&&i.genMorphGeometry(e,t,a,n,r.name)}))})))}},{key:"genMorphGeometry",value:function(e,t,r,n,i){t=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[];for(var a=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]=a[3*c],u[1+h]=a[3*c+1],u[2+h]=a[3*c+2]}l=this.genBuffers({vertexIndices:t,vertexPositions:u}),(t=new o.Float32BufferAttribute(l.vertex,3)).name=i||r.attrName,t.applyMatrix4(n),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===mn)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 o.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 o.BufferGeometry;for(var r=t-1,n=(t=e.KnotVector.a,[]),i=e.Points.a,a=0,s=i.length;a<s;a+=4)n.push((new o.Vector4).fromArray(i,a));if("Closed"===e.Form)n.push(n[0]);else if("Periodic"===e.Form)for(var l=r,u=t.length-1-l,c=0;c<r;++c)n.push(n[c]);return e=new mn(r,t,n,l,u).getPoints(12*n.length),(new o.BufferGeometry).setFromPoints(e)}}]),e}(),Bn=function(){function e(){gn(this,e)}return bn(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!==dn.Objects.AnimationCurve)return e=this.parseAnimationCurveNodes(),this.parseAnimationCurves(e),e=this.parseAnimationLayers(e),this.parseAnimStacks(e)}},{key:"parseAnimationCurveNodes",value:function(){var e,t=dn.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=dn.Objects.AnimationCurve;for(t in r){var n,i={id:r[t].id,times:r[t].KeyTime.a.map(Pn),values:r[t].KeyValueFloat.a},a=pn.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,r=dn.Objects.AnimationLayer,n=new Map;for(t in r)!function(t){var r=[],i=pn.get(parseInt(t));void 0!==i&&(i.children.forEach((function(t,n){if(e.has(t.ID)){var i=e.get(t.ID);if(void 0!==i.curves.x||void 0!==i.curves.y||void 0!==i.curves.z){if(void 0===r[n]){var a=pn.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID;if(void 0!==a){var s=dn.Objects.Model[a.toString()];if(void 0===s)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",t);var l={modelName:s.attrName?o.PropertyBinding.sanitizeNodeName(s.attrName):"",ID:s.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};fn.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 o.Matrix4),"PreRotation"in s&&(l.preRotation=s.PreRotation.value),"PostRotation"in s&&(l.postRotation=s.PostRotation.value),r[n]=l}}r[n]&&(r[n][i.attr]=i)}else void 0!==i.curves.morph&&(void 0===r[n]&&(a=pn.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,t=pn.get(a).parents[0].ID,t=pn.get(t).parents[0].ID,t=pn.get(t).parents[0].ID,t={modelName:(t=dn.Objects.Model[t]).attrName?o.PropertyBinding.sanitizeNodeName(t.attrName):"",morphName:dn.Objects.Deformer[a].attrName},r[n]=t),r[n][i.attr]=i)}})),n.set(parseInt(t),r))}(t);return n}},{key:"parseAnimStacks",value:function(e){var t,r=dn.Objects.AnimationStack,n={};for(t in r){var i=(1<(i=pn.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=[],r=this;return e.layer.forEach((function(e){t=t.concat(r.generateTracks(e))})),new o.AnimationClip(e.name,-1,t)}},{key:"generateTracks",value:function(e){var t=[],r=new o.Vector3,n=new o.Quaternion,i=new o.Vector3;return e.transform&&e.transform.decompose(r,n,i),r=r.toArray(),n=(new o.Euler).setFromQuaternion(n,e.eulerOrder).toArray(),i=i.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,n,e.preRotation,e.postRotation,e.eulerOrder))&&t.push(r),void 0!==e.S&&0<Object.keys(e.S.curves).length&&void 0!==(n=this.generateVectorTrack(e.modelName,e.S.curves,i,"scale"))&&t.push(n),void 0!==e.DeformPercent&&void 0!==(r=this.generateMorphTrack(e))&&t.push(r),t}},{key:"generateVectorTrack",value:function(e,t,r,n){var i=this.getTimesForAllAxes(t);return t=this.getKeyframeTrackValues(i,t,r),new o.VectorKeyframeTrack(e+"."+n,i,t)}},{key:"generateRotationTrack",value:function(e,t,r,n,i,a){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(o.MathUtils.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(o.MathUtils.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(o.MathUtils.degToRad));for(var s=this.getTimesForAllAxes(t),l=this.getKeyframeTrackValues(s,t,r),u=(void 0!==n&&((n=n.map(o.MathUtils.degToRad)).push(a),n=(new o.Euler).fromArray(n),n=(new o.Quaternion).setFromEuler(n)),void 0!==i&&((i=i.map(o.MathUtils.degToRad)).push(a),i=(new o.Euler).fromArray(i),i=(new o.Quaternion).setFromEuler(i).invert()),new o.Quaternion),c=new o.Euler,h=[],d=0;d<l.length;d+=3)c.set(l[d],l[d+1],l[d+2],a),u.setFromEuler(c),void 0!==n&&u.premultiply(n),void 0!==i&&u.multiply(i),u.toArray(h,d/3*4);return new o.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})),n=fn.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new o.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+n+"]",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 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,s=-1,o=-1;return e.forEach((function(e){t.x&&(a=t.x.times.indexOf(e)),t.y&&(s=t.y.times.indexOf(e)),t.z&&(o=t.z.times.indexOf(e)),-1!==a?(e=t.x.values[a],i.push(e),n[0]=e):i.push(n[0]),-1!==s?(e=t.y.values[s],i.push(e),n[1]=e):i.push(n[1]),-1!==o?(e=t.z.values[o],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),s=r+a,o=(n=e.times[t-1],(e.times[t]-n)/i),l=n+o,u=[],c=[];l<e.times[t];)u.push(l),l+=o,c.push(s),s+=a;e.times=Nn(e.times,t,u),e.values=Nn(e.values,t,c)}}}}]),e}(),Cn=function(){function e(){gn(this,e)}return bn(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 _n,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]*;/),s=e.match(/^[\s\t]*$/);a||s||(a=e.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),s=e.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),i=e.match("^\\t{"+(t.currentIndent-1)+"}}"),a?t.parseNodeBegin(e,a):s?t.parseNodeProperty(e,s,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(/^"/,"")}))),s=(n="connections",t=[i,e]),o=a,l=0,u=s.length,c=o.length;l<c;l++,u++)s[u]=o[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=Un(t))}}},{key:"parseNodePropertyContinued",value:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=Un(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],s=r[3],o=r[4];switch(i){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":o=parseFloat(o);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":o=Un(o)}this.getPrevNode()[n]={type:i,type2:a,flag:s,value:o},this.setCurrentProp(this.getPrevNode(),n)}}]),e}(),En=function(){function e(){gn(this,e)}return bn(e,[{key:"parse",value:function(e){var t=new Tn(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 _n;!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()),s=e.getString(a);if(0===n)return null;for(var o=[],l=0;l<i;l++)o.push(this.parseProperty(e));a=0<o.length?o[0]:"";var u=1<o.length?o[1]:"",c=2<o.length?o[2]:"";for(r.singleProperty=1===i&&e.getOffset()===n;n>e.getOffset();){var h=this.parseNode(e,t);null!==h&&this.parseSubNode(s,r,h)}return r.propertyList=o,"number"==typeof a&&(r.id=a),""!==u&&(r.attrName=u),""!==c&&(r.attrType=c),""!==s&&(r.name=s),r}},{key:"parseSubNode",value:function(e,t,r){var n,i,a,s,o;!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],s=r.propertyList[3],0===i.indexOf("Lcl ")&&(i=i.replace("Lcl ","Lcl_")),o="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:s,value:o}):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(e){var t=e.getString(1);switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return i=e.getUint32(),e.getArrayBuffer(i);case"S":return i=e.getUint32(),e.getString(i);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var r=e.getUint32(),i=e.getUint32(),a=e.getUint32();if(0===i)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}void 0===n&&console.error("THREE.FBXLoader: External library fflate.min.js required."),i=Pr(new Uint8Array(e.getArrayBuffer(a)));var s=new Tn(i.buffer);switch(t){case"b":case"c":return s.getBooleanArray(r);case"d":return s.getFloat64Array(r);case"f":return s.getFloat32Array(r);case"i":return s.getInt32Array(r);case"l":return s.getInt64Array(r)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}]),e}(),Tn=function(){function e(t,r){gn(this,e),this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===r||r}return bn(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=[],r=0;r<e;r++)t[r]=this.getUint8();var n=t.indexOf(0);return 0<=n&&(t=t.slice(0,n)),o.LoaderUtils.decodeText(new Uint8Array(t))}}]),e}(),_n=function(){function e(){gn(this,e)}return bn(e,[{key:"add",value:function(e,t){this[e]=t}}]),e}();function Dn(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 Pn(e){return e/46186158e3}var On=[];function Rn(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,s=a+n.dataSize,o=On,l=n.buffer,u=s,c=a,h=0;c<u;c++,h++)o[h]=l[c];return o}var In=new o.Euler,kn=new o.Vector3;function Ln(e){var t=new o.Matrix4,r=new o.Matrix4,n=new o.Matrix4,i=new o.Matrix4,a=new o.Matrix4,s=new o.Matrix4,l=new o.Matrix4,u=new o.Matrix4,c=new o.Matrix4,h=new o.Matrix4,d=new o.Matrix4,p=new o.Matrix4,f=e.inheritType||0,m=(e.translation&&t.setPosition(kn.fromArray(e.translation)),e.preRotation&&((m=e.preRotation.map(o.MathUtils.degToRad)).push(e.eulerOrder),r.makeRotationFromEuler(In.fromArray(m))),e.rotation&&((m=e.rotation.map(o.MathUtils.degToRad)).push(e.eulerOrder),n.makeRotationFromEuler(In.fromArray(m))),e.postRotation&&((m=e.postRotation.map(o.MathUtils.degToRad)).push(e.eulerOrder),i.makeRotationFromEuler(In.fromArray(m)),i.invert()),e.scale&&a.scale(kn.fromArray(e.scale)),e.scalingOffset&&l.setPosition(kn.fromArray(e.scalingOffset)),e.scalingPivot&&s.setPosition(kn.fromArray(e.scalingPivot)),e.rotationOffset&&u.setPosition(kn.fromArray(e.rotationOffset)),e.rotationPivot&&c.setPosition(kn.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(d.copy(e.parentMatrix),h.copy(e.parentMatrixWorld)),r.clone().multiply(n).multiply(i)),v=(((e=new o.Matrix4).extractRotation(h),v=new o.Matrix4).copyPosition(h),v.clone().invert().multiply(h)),g=(v=e.clone().invert().multiply(v),a),y=new o.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 o.Matrix4).scale((new o.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(r).multiply(n).multiply(i).multiply(v).multiply(l).multiply(s).multiply(a).multiply(f),m=(new o.Matrix4).copyPosition(e),d=h.clone().multiply(m),p.copyPosition(d),(e=p.clone().multiply(y)).premultiply(h.invert()),e}function Fn(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 Un(e){return e.split(",").map((function(e){return parseFloat(e)}))}function Gn(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=e.byteLength),o.LoaderUtils.decodeText(new Uint8Array(e,t,r))}function Nn(e,t,r){return e.slice(0,t).concat(r).concat(e.slice(t))}function jn(e){return(jn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function zn(e,t){return(zn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Hn(e){return(Hn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Vn=/^[og]\s*(.+)?/,Jn=/^mtllib /,Kn=/^usemtl /,Zn=/^usemap /,Wn=new o.Vector3,Xn=new o.Vector3,Qn=new o.Vector3,Yn=new o.Vector3,qn=new o.Vector3,$n=new o.Color;function ei(){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;Wn.fromArray(n,e),Xn.fromArray(n,t),Qn.fromArray(n,r),qn.subVectors(Qn,Xn),Yn.subVectors(Wn,Xn),qn.cross(Yn),qn.normalize(),i.push(qn.x,qn.y,qn.z),i.push(qn.x,qn.y,qn.z),i.push(qn.x,qn.y,qn.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,s,o,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!==s&&""!==s?(u=this.normals.length,e=this.parseNormalIndex(s,u),t=this.parseNormalIndex(o,u),r=this.parseNormalIndex(l,u),this.addNormal(e,t,r)):this.addFaceNormal(e,t,r),void 0!==n&&""!==n?(s=this.uvs.length,e=this.parseUVIndex(n,s),t=this.parseUVIndex(i,s),r=this.parseUVIndex(a,s),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 s=0,o=t.length;s<o;s++)this.addUVLine(this.parseUVIndex(t[s],n))}};return e.startObject("",!1),e}var ti=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&&zn(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=Hn(e);if(r=t?(r=Hn(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===jn(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)).materials=null,e;throw new TypeError("Cannot call a class as a function")}return t=n,(e=[{key:"load",value:function(e,t,r,n){var i=this,a=new o.FileLoader(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(r){try{t(i.parse(r))}catch(r){n?n(r):console.error(r),i.manager.itemError(e)}}),r,n)}},{key:"setMaterials",value:function(e){return this.materials=e,this}},{key:"parse",value:function(e){for(var t,r,n,i=new ei,a=(e=-1!==(e=-1!==e.indexOf("\r\n")?e.replace(/\r\n/g,"\n"):e).indexOf("\\\n")?e.replace(/\\\n/g,""):e).split("\n"),s="",l=[],u="function"==typeof"".trimLeft,c=0,h=a.length;c<h;c++)if(s=a[c],0!==(s=u?s.trimLeft():s.trim()).length&&"#"!==(t=s.charAt(0)))if("v"===t){var d=s.split(/\s+/);switch(d[0]){case"v":i.vertices.push(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3])),7<=d.length?($n.setRGB(parseFloat(d[4]),parseFloat(d[5]),parseFloat(d[6])).convertSRGBToLinear(),i.colors.push($n.r,$n.g,$n.b)):i.colors.push(void 0,void 0,void 0);break;case"vn":i.normals.push(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3]));break;case"vt":i.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],S=f[b+1];i.addFace(y[0],w[0],S[0],y[1],w[1],S[1],y[2],w[2],S[2])}}else if("l"===t){var A=s.substring(1).trim().split(" "),M=[],B=[];if(-1===s.indexOf("/"))M=A;else for(var C=0,E=A.length;C<E;C++){var T=A[C].split("/");""!==T[0]&&M.push(T[0]),""!==T[1]&&B.push(T[1])}i.addLineGeometry(M,B)}else"p"===t?(r=s.slice(1).trim().split(" "),i.addPointGeometry(r)):null!==(l=Vn.exec(s))?(r=(" "+l[0].slice(1).trim()).slice(1),i.startObject(r)):Kn.test(s)?i.object.startMaterial(s.substring(7).trim(),i.materialLibraries):Jn.test(s)?i.materialLibraries.push(s.substring(7).trim()):Zn.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?(n=l[1].trim().toLowerCase(),i.object.smooth="0"!==n&&"off"!==n):i.object.smooth=!0,(n=i.object.currentMaterial())&&(n.smooth=i.object.smooth)):"\0"!==s&&console.warn('THREE.OBJLoader: Unexpected line: "'+s+'"');i.finalize();var _,D=new o.Group;if(1==(D.materialLibraries=[].concat(i.materialLibraries),e=!(1===i.objects.length&&0===i.objects[0].geometry.vertices.length)))for(var P=0,O=i.objects.length;P<O;P++){var R=i.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 o.BufferGeometry,N=(G.setAttribute("position",new o.Float32BufferAttribute(I.vertices,3)),0<I.normals.length&&G.setAttribute("normal",new o.Float32BufferAttribute(I.normals,3)),0<I.colors.length&&(U=!0,G.setAttribute("color",new o.Float32BufferAttribute(I.colors,3))),!0===I.hasUVIndices&&G.setAttribute("uv",new o.Float32BufferAttribute(I.uvs,2)),[]),j=0,z=k.length;j<z;j++){var H,V=k[j],J=V.name+"_"+V.smooth+"_"+U,K=i.materials[J];null!==this.materials&&(K=this.materials.create(V.name),!L||!K||K instanceof o.LineBasicMaterial?!F||!K||K instanceof o.PointsMaterial||(H=new o.PointsMaterial({size:10,sizeAttenuation:!1}),o.Material.prototype.copy.call(H,K),H.color.copy(K.color),H.map=K.map,K=H):(H=new o.LineBasicMaterial,o.Material.prototype.copy.call(H,K),H.color.copy(K.color),K=H)),void 0===K&&((K=L?new o.LineBasicMaterial:F?new o.PointsMaterial({size:1,sizeAttenuation:!1}):new o.MeshPhongMaterial).name=V.name,K.flatShading=!V.smooth,K.vertexColors=U,i.materials[J]=K),N.push(K)}if(I=void 0,1<N.length){for(var Z=0,W=k.length;Z<W;Z++){var X=k[Z];G.addGroup(X.groupStart,X.groupCount,Z)}I=new(L?o.LineSegments:F?o.Points:o.Mesh)(G,N)}else I=new(L?o.LineSegments:F?o.Points:o.Mesh)(G,N[0]);I.name=R.name,D.add(I)}}else 0<i.vertices.length&&(e=new o.PointsMaterial({size:1,sizeAttenuation:!1}),(_=new o.BufferGeometry).setAttribute("position",new o.Float32BufferAttribute(i.vertices,3)),0<i.colors.length&&void 0!==i.colors[0]&&(_.setAttribute("color",new o.Float32BufferAttribute(i.colors,3)),e.vertexColors=!0),_=new o.Points(_,e),D.add(_));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}),n}(o.Loader),ri=function(e,t,r,n){return new(r=r||Promise)((function(i,a){function s(e){try{l(n.next(e))}catch(e){a(e)}}function o(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(s,o)}l((n=n.apply(e,t||[])).next())}))};const ni=t.FBXLoader;class ii{constructor(e){this.parses={fbx:new ni,obj:new ti,object:new o.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 ri(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 ri(this,void 0,void 0,(function*(){var t=yield(0,s.parseFile)(e,"arrayBuffer");let r="model";return t=yield this.runScene.loaderer.gltf.parse(t,{triggerCb:!0,callBack:{beforeParse:e=>{"scene"===(e=(e.asset.ex||{}).type)&&this.runScene.clean()},getJSON(e){r=(null==(e=e.asset.ex)?void 0:e.type)||"model"}}}),{type:r,result:t}}))}fbx(e){return ri(this,void 0,void 0,(function*(){var t=e instanceof ArrayBuffer?e:yield(0,s.parseFile)(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 ri(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,s.parseFile)(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 ri(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,s.parseFile)(e,"text"):e,r=JSON.parse(t);return"timeLine"===r.type?{type:"timeLine",result:r.data}:{type:"model",result:this.runScene.loaderer.json.parse(t)}}))}}class ai extends l{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.params.glow.isBloom=e}setRender2(e){this.runScene.assetsEx.setRender2(e)}setRender3(e){this.runScene.assetsEx.setRender3(e)}}class si extends r(624).Ys{constructor(e,t){super(e,t),this.transGizmo=this.children[0],this.scaleCoefficient=new o.Vector3,this.beginScale=new o.Vector3,this.posStart=new o.Vector2,this.posEnd=new o.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 oi extends o.Object3D{constructor(e){super(),this.isViewHelper=!0,this.animating=!1,this.controls=null,this.dummy=new o.Object3D,this.turnRate=2*Math.PI,this.targetPosition=new o.Vector3,this.targetQuaternion=new o.Quaternion,this.q1=new o.Quaternion,this.q2=new o.Quaternion,this.radius=0,this.clock=new o.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 o.Euler(0,.5*Math.PI,0));break;case"posY":this.targetPosition.set(0,1,0),this.targetQuaternion.setFromEuler(new o.Euler(.5*-Math.PI,0,0));break;case"posZ":this.targetPosition.set(0,0,1),this.targetQuaternion.setFromEuler(new o.Euler);break;case"negX":this.targetPosition.set(-1,0,0),this.targetQuaternion.setFromEuler(new o.Euler(0,.5*-Math.PI,0));break;case"negY":this.targetPosition.set(0,-1,0),this.targetQuaternion.setFromEuler(new o.Euler(.5*Math.PI,0,0));break;case"negZ":this.targetPosition.set(0,0,-1),this.targetQuaternion.setFromEuler(new o.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 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 li{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 o.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 c.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,scene:t,engineDom:r}=this.runScene.assetsEx.get();this.tansControls=new si(e,r),this.tansControls.addEventListener("dragging-changed",this.draggingChanged),this.tansControls.addEventListener("change",this.transChangeFn.bind(this)),this.tansControls.name="helper",t.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 oi(e),this.grid=this.createGrid(),this.init())}init(){this.transContro.init(),this.runScene.assetsEx.get().scene.add(this.grid)}createGrid(){const e=new c.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)),(0,Re.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)}}N=r(356);var ui=r.n(N),ci=r(510),hi=r(380),di=r(453);class pi{constructor(e){this.selectors={},this.boxHelperMap={},this.savedV3=new M.Z,this.tempOldval=new La.Vector3,this.runScene=e}add(e,t=!1){if("array"===(0,s.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 s=this.getSelectedList("value");var{x:i,y:o,z:l}=i;const u=i-a.x,c=o-a.y,h=l-a.z,d=[new hi.Z({target:e,info:t,oldV3:this.runScene.modelEx.cloneV3(r),newV3:n,runScene:this.runScene}).execute()];s.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 hi.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,di.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,di.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,Ge.Ki)(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 hi.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:s,z:o}=n;const l=e-i.x,u=s-i.y,c=o-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 o.Group;const t=new o.Group;this.runScene.modelEx.add(e,void 0,{addUndo:!1}),this.runScene.modelEx.add(t);var r=[...this.getSelectedList("value")],n=(this.runScene.cb.model.multipDrop.cb({models:this.getSelectedList("value"),dropModel:e}),ui().group.getCenter(e));t.position.copy(n),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 o.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:s}=e,o=this.getSelectedList("value");0!==o.length&&(e=o.map(((e,o)=>{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+(o+1)*s;return new ci.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 hi.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 fi(e){return(fi="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 mi(e,t){return(mi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function vi(e){return(vi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var gi=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&&mi(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=vi(e);if(r=t?(r=vi(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===fi(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(){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");var e=n.SkyShader;return e=new o.ShaderMaterial({name:"SkyShader",fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:o.UniformsUtils.clone(e.uniforms),side:o.BackSide,depthWrite:!1}),r.call(this,new o.BoxGeometry(1,1,1),e)}return t=n,Object.defineProperty(t,"prototype",{writable:!1}),t}(o.Mesh),yi=(gi.prototype.isSky=!0,gi.SkyShader={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new o.Vector3},up:{value:new o.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}"},r(585)),bi=r(651);const xi={color:"#000000",intensity:1};class wi{diff(e,t){const r={};return(0,s.mapObj)(xi,(n=>{var i=e[n];(0,Fe.Xq)(i,t[n])&&(r[n]=i)})),r}setConfig(e,t){var{color:t,intensity:r,shadow:n}=t,{mapSize:n,camera:i}=n||{},{far:i,near:a,scale:s}=i||{};void 0!==s&&(e.shadow.camera.scale.x=s,e.shadow.camera.scale.y=s,e.shadow.camera.scale.z=s),void 0!==a&&(e.shadow.camera.near=a),void 0!==i&&(e.shadow.camera.far=i),void 0!==n&&(e.shadow.mapSize.x=n,e.shadow.mapSize.y=n),void 0!==r&&(e.intensity=r),void 0!==t&&(e.color=(0,di.e9)(t)),e.shadow.camera.updateProjectionMatrix(),null!=(s=e.cameraHelper)&&s.update()}}class Si extends l{constructor(){super(...arguments),this.allState=["morning","noon","evening","night"],this.sun=new La.Vector3,this.light=new wi,this.sky=new gi,this.baseLightConfig={name:"天空定向光",type:"DirectionalLight",castShadow:!0},this.skyData=this.getData(),this.lastTime={index:0,name:"morning"},this.skyChangeArr=[],this.lightChangeArr=[],this.uniforms=null,this.inied=!1,this.currentLightConfig={},this.backUpSkyData=this.getData(),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.addScene(),this.initSnapshot()}initSnapshot(){this.runScene.cb.snapshot.create.add("sky",(e=>{e.data.set("sky",{state:this.skyData.currentState})})),this.runScene.cb.snapshot.set.add("sky",(e=>{(e=e.snapshot.data.get("sky"))&&e.state!==this.skyData.currentState&&this.setState(e.state)}))}initLight(){var e,t;this.directionalLight||([t]=e=new yi.Z(this.runScene).get(),this.runScene.lightEx.add(e,{addToTree:!1}),this.directionalLight=t)}addScene(){this.initLight(),ke.materialIgnore.set(this.sky.material,!0),(0,d.setHelper)(this.sky),d.selectableModel.close(this.sky),d.selectableModel.close(this.directionalLight),(0,d.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&&(this.directionalLight.visible=e,t.toneMapping=e?4:0,this.skyData.isShow=e,this.sky.visible=e)}toJSON(){var{currentState:e,effectController:t,isShow:r,lightConfig:n,size:i}=this.skyData;return{currentState:e,effectController:t,isShow:r,lightConfig:n,size:i}}parseJSON(e){var t,r,n;e&&(({isShow:t,currentState:r,size:n}=e),this.skyData.isShow=t,this.initLight(),this.parseLightConfig(e),this.inied||(this.init(),this.inied=!0),this.parseSkyConfig(r,n),this.setOpen(t))}parseLightConfig(e){var t,{isShow:r,effectController:n,currentState:i,lightConfig:a,size:s}=e;e&&a&&(e=a.shadow,t=n[i].lightConfig,yi.Z.setConfig(this.directionalLight,Object.assign(Object.assign({shadow:e},t),this.baseLightConfig)),this.directionalLight.visible=r,this.skyData.lightConfig=a,this.skyData.isShow=r,this.skyData.effectController=n,this.skyData.currentState=i,this.skyData.size=s,this.sky.visible=r,this.setLightSpecialConfig(i),this.lightAnima(i))}parseSkyConfig(e,t){this.setSkyConfig(e),this.setSkyScale(t)}setState(e){var t=this.skyData.currentState;this.doAnimaByState(e,t),this.runScene.cb.objects.sky.setState.cb({state:e}),this.saveLastTimeState({oldState:t,state:e,index:this.allState.findIndex((t=>t===e))})}saveLastTimeState(e){var{oldState:e,state:t,index:r}=e;this.lastTime.name=e,this.lastTime.index=r,this.skyData.currentState=t}getLightDataByState(e){let t=new La.Vector3,r=new La.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":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}}getIdxByState(e){return this.allState.findIndex((t=>t===e))}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=La.MathUtils.degToRad(90-this.skyData.effectController[e].elevation);e=La.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:r}=e;this.skyData.effectController[e][t]=r,this.setSkyConfig(e)}setCurrentState(e){this.skyData.currentState=e}setStateTime(e){var{info:e,time:t}=e;this.skyData.effectController[e].time=t}clean(){this.setOpen(!1),this.skyData=this.getData(),this.directionalLight&&this.runScene.modelEx.remove(this.directionalLight)}setLight(e,t){switch(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!=(r=this.directionalLight.cameraHelper)&&r.update();break;case"color":this.skyData.effectController[this.skyData.currentState].lightConfig.color=t;var r=new La.Color(t);this.directionalLight.color=r;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,di.e9)(e),this.directionalLight.intensity=t}getAnimasDataByState(e,t){e=this.getIdxByState(e);const r=[];if((t=this.getIdxByState(t))<e){this.animaIndex={begin:e,end:t};var n=e-t;let l=t;for(let e=0;e<n;e++){var{color:i,intensity:a}=this.skyData.effectController[this.allState[l]].lightConfig,{position:s,targetPosition:o}=this.getLightDataByState(this.allState[l]),{color:i,intensity:a}=(r.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[l]],color:i,intensity:a,position:s,targetPosition:o})}),l++,this.skyData.effectController[this.allState[l]].lightConfig),{position:s,targetPosition:o}=this.getLightDataByState(this.allState[l]);r.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[l]],color:i,intensity:a,position:s,targetPosition:o}),onDone:this.getNromalFn})}}else{var l=3-t;this.animaIndex={begin:t,end:e};let n=t;if(0==l)return r.push({onDone:this.getSpecialFn}),r;for(let e=0;e<l;e++){var{color:u,intensity:c}=this.skyData.effectController[this.allState[n]].lightConfig,{position:h,targetPosition:d}=this.getLightDataByState(this.allState[n]),{position:h,targetPosition:d}=(r.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[n]],color:u,intensity:c,position:h,targetPosition:d})}),n++,this.getLightDataByState(this.allState[n]));r.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[n]],color:u,intensity:c,position:h,targetPosition:d}),onDone:3===n?this.getSpecialFn:this.getNromalFn})}}return r}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 r=this.runScene.assetsEx.get().renderer;this.animaInstance=h.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:n,g:i,b:a}=e,s=(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,r.toneMappingExposure=e.exposure,La.MathUtils.degToRad(90-e.elevation)),o=La.MathUtils.degToRad(t.data.azimuth);this.sun.setFromSphericalCoords(1,s,o),this.sky.material.uniforms.sunPosition.value.copy(this.sun),s=new La.Color(n,i,a),this.directionalLight.color=s,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:r,targetPosition:n,intensity:i}=e,{x:r,y:a,z:s}=r,{x:n,y:o,z:l}=n,{r:t,g:u,b:c}=(0,Fe.fh)((0,Fe.I8)(t));return Object.assign(Object.assign({},e),{r:t,g:u,b:c,x:r,y:a,z:s,tx:n,ty:o,tz:l,intensity:i})}getData(){return{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,bi.d9)(xi)),{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,bi.d9)(xi)),{color:"#FFFFFF"})},evening:{turbidity:2,rayleigh:.3,mieCoefficient:.011,mieDirectionalG:.67,elevation:3,azimuth:0,exposure:.3762,lightConfig:Object.assign(Object.assign({},(0,bi.d9)(xi)),{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,bi.d9)(xi)),{color:"#B8A277"}),time:1}},currentState:"morning"}}}class Ai{constructor(e){this.clean=()=>{this.sky.clean()},this.sky=new Si(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 Mi(){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(),s=a,o=0,l=r(new Mi.Panel("FPS","#0ff","#002")),u=r(new Mi.Panel("MS","#0f0","#020"));return self.performance&&self.performance.memory&&(i=r(new Mi.Panel("MB","#f08","#201"))),n(0),{REVISION:16,dom:t,addPanel:r,showPanel:n,begin:function(){a=(performance||Date).now()},end:function(){o++;var e,t=(performance||Date).now();return u.update(t-a,200),s+1e3<=t&&(l.update(1e3*o/(t-s),100),s=t,o=0,i&&(e=performance.memory,i.update(e.usedJSHeapSize/1048576,e.jsHeapSizeLimit/1048576))),t},update:function(){a=this.end()},domElement:t,setMode:n}}Mi.Panel=function(e,t,r){var n=1/0,i=0,a=Math.round,s=a(window.devicePixelRatio||1),o=80*s,l=48*s,u=3*s,c=2*s,h=3*s,d=15*s,p=74*s,f=30*s,m=document.createElement("canvas"),v=(m.width=o,m.height=l,m.style.cssText="width:80px;height:48px",m.getContext("2d"));return v.font="bold "+9*s+"px Helvetica,Arial,sans-serif",v.textBaseline="top",v.fillStyle=r,v.fillRect(0,0,o,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,o,d),v.fillStyle=t,v.fillText(a(l)+" "+e+" ("+a(n)+"-"+a(i)+")",u,c),v.drawImage(m,h+s,d,p-s,f,h,d,p-s,f),v.fillRect(h+p-s,d,s,f),v.fillStyle=r,v.globalAlpha=.9,v.fillRect(h+p-s,d,s,a((1-l/g)*f))}}};const Bi=Mi;class Ci{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,h.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,this.options=(0,h.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=Bi(),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 Ei{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),this.runScene.pp.params.glow.isBloom=!0)}glowRemove(e){this.glowModelLength.delete(e.userData.id),this.glowModelLength.size<=0&&(this.runScene.cb.pp.glow.setStatus.cb(!1),this.runScene.pp.params.glow.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),this.runScene.pp.params.outline.isOutline=!0)}outlineRemove(e){this.outlineModelLength.delete(e.userData.id),this.outlineModelLength.size<=0&&(this.runScene.cb.pp.outline.setStatus.cb(!1),this.runScene.pp.params.outline.isOutline=!1)}}var Ti=r(608),_i=r(180),Di=r(819),Pi={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new o.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 Oi(e){return(Oi="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 Ri(e,t){return(Ri=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ii(e){return(Ii=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ki=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&&Ri(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=Ii(e);if(r=t?(r=Ii(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Oi(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,t,i,a){var s;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");(s=r.call(this)).strength=void 0!==t?t:1,s.radius=i,s.threshold=a,s.resolution=void 0!==e?new o.Vector2(e.x,e.y):new o.Vector2(256,256),s.clearColor=new o.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 o.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 o.WebGLRenderTarget(l,u)).texture.name="UnrealBloomPass.h"+c,h.texture.generateMipmaps=!1,s.renderTargetsHorizontal.push(h),h=new o.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)}i=Pi;for(var d=(s.highPassUniforms=o.UniformsUtils.clone(i.uniforms),s.highPassUniforms.luminosityThreshold.value=a,s.highPassUniforms.smoothWidth.value=.01,s.materialHighPassFilter=new o.ShaderMaterial({uniforms:s.highPassUniforms,vertexShader:i.vertexShader,fragmentShader:i.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 o.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 o.Vector3(1,1,1),new o.Vector3(1,1,1),new o.Vector3(1,1,1),new o.Vector3(1,1,1),new o.Vector3(1,1,1)],s.compositeMaterial.uniforms.bloomTintColors.value=s.bloomTintColors,void 0===Ti.C&&console.error("THREE.UnrealBloomPass relies on CopyShader"),e=Ti.C,s.copyUniforms=o.UniformsUtils.clone(e.uniforms),s.copyUniforms.opacity.value=1,s.materialCopy=new o.ShaderMaterial({uniforms:s.copyUniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,blending:o.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0}),s.enabled=!0,s.needsSwap=!1,s._oldClearColor=new o.Color,s.oldClearAlpha=1,s.basic=new o.MeshBasicMaterial,s.fsQuad=new Di.T(null),s}return t=n,(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),n=Math.round(t/2);this.renderTargetBright.setSize(r,n);for(var i=0;i<this.nMips;i++)this.renderTargetsHorizontal[i].setSize(r,n),this.renderTargetsVertical[i].setSize(r,n),this.separableBlurMaterials[i].uniforms.texSize.value=new o.Vector2(r,n),r=Math.round(r/2),n=Math.round(n/2)}},{key:"render",value:function(e,t,r,i,a){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();for(var s=e.autoClear,o=(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=o.texture,this.separableBlurMaterials[l].uniforms.direction.value=n.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=n.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[l]),e.clear(),this.fsQuad.render(e),o=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=s}},{key:"getSeperableBlurMaterial",value:function(e){return new o.ShaderMaterial({defines:{KERNEL_RADIUS:e,SIGMA:e},uniforms:{colorTexture:{value:null},texSize:{value:new o.Vector2(.5,.5)},direction:{value:new o.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 o.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}),n}(Di.w);ki.BlurDirectionX=new o.Vector2(1,0),ki.BlurDirectionY=new o.Vector2(0,1);class Li extends Di.w{constructor(e,t,r){super(),this.baseTextureID=void 0!==t?t:"tDiffuse",this.effectTextureID=void 0!==r?r:"tDiffuse",e instanceof o.ShaderMaterial?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=o.UniformsUtils.clone(e.uniforms),this.material=new o.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new Di.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 Fi extends Di.w{constructor(e,t,r,n,i){super(),this.scene=e,this.camera=t,this.layerIndex=0,this.overrideMaterial=r,this.clearColor=n,this.clearAlpha=void 0!==i?i:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.oldClearColor=new o.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 Ui={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 Gi{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 Fi(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 ki(this.mtuPP.rtSize,1.5,.4,.85),this.bloomPass.radius=this.mtuPP.params.glow.radius,this.bloomPass.strength=this.mtuPP.params.glow.strength,this.bloomPass.threshold=this.mtuPP.params.glow.threshold,this.mixingPass||(this.mixingPass=new Li(Ui,"baseTexture","bloomTexture"),this.mixingPass.renderToScreen=!1),this.effectCopy||(this.effectCopy=new _i.T(Ti.C),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 Ni(e){return(Ni="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 ji(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function zi(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 Hi(e,t,r){t&&zi(e.prototype,t),r&&zi(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function Vi(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&&Ji(e,t)}function Ji(e,t){return(Ji=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ki(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=Zi(e);if(r=t?(r=Zi(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Ni(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 Zi(e){return(Zi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Wi=function(){Vi(t,Di.w);var e=Ki(t);function t(r,n){var i;return ji(this,t),(i=e.call(this)).scene=r,i.camera=n,i.clear=!0,i.needsSwap=!1,i.inverse=!1,i}return Hi(t,[{key:"render",value:function(e,t,r){var n,i,a=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0),i=this.inverse?(n=0,1):(n=1,0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(a.REPLACE,a.REPLACE,a.REPLACE),s.buffers.stencil.setFunc(a.ALWAYS,n,4294967295),s.buffers.stencil.setClear(i),s.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),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(a.EQUAL,1,4294967295),s.buffers.stencil.setOp(a.KEEP,a.KEEP,a.KEEP),s.buffers.stencil.setLocked(!0)}}]),t}(),Xi=function(){Vi(t,Di.w);var e=Ki(t);function t(){var r;return ji(this,t),(r=e.call(this)).needsSwap=!1,r}return Hi(t,[{key:"render",value:function(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}]),t}();function Qi(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 Yi=function(){function e(t,r){var n;(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?(n=t.getSize(new o.Vector2),this._pixelRatio=t.getPixelRatio(),this._width=n.width,this._height=n.height,(r=new o.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===Ti.C&&console.error("THREE.EffectComposer relies on CopyShader"),void 0===_i.T&&console.error("THREE.EffectComposer relies on ShaderPass"),this.copyPass=new _i.T(Ti.C),this.clock=new o.Clock}return function(e,t,r){t&&Qi(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,s,o=this.passes[n];!1!==o.enabled&&(o.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(n),o.render(this.renderer,this.writeBuffer,this.readBuffer,e,r),o.needsSwap&&(r&&(a=this.renderer.getContext(),(s=this.renderer.state.buffers.stencil).setFunc(a.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),s.setFunc(a.EQUAL,1,4294967295)),this.swapBuffers()),void 0!==Wi&&(o instanceof Wi?r=!0:o instanceof Xi&&(r=!1)))}this.renderer.setRenderTarget(t)}},{key:"reset",value:function(e){var t;void 0===e&&(t=this.renderer.getSize(new o.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 o.OrthographicCamera(-1,1,1,-1,0,1),(G=new o.BufferGeometry).setAttribute("position",new o.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),G.setAttribute("uv",new o.Float32BufferAttribute([0,2,0,0,2,0],2));const qi="\n varying vec2 vUv;\n \n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",$i="\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 ea{constructor(e){this.mtuPP=e,this.bloomLayer=new La.Layers,this.bloomLayer.set(this.mtuPP.BLOOM_SCENE),this.darkMaterial=new La.MeshBasicMaterial({color:"black"}),this.materials={},(e=this.mtuPP.mainScene).fog&&(this.mtuPP.sceneFogColor||(this.mtuPP.sceneFogColor=new La.Color),this.mtuPP.sceneFogColor.copy(e.fog.color)),e.background&&(this.mtuPP.sceneBackground=e.background),this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.bloomPass=new ki(this.mtuPP.rtSize,1.5,.4,.85),this.bloomPass.radius=this.mtuPP.params.glow.radius,this.bloomPass.strength=this.mtuPP.params.glow.strength,this.bloomPass.threshold=this.mtuPP.params.glow.threshold,this.mtuPP.effectComposer.addPass(this.bloomPass),this.finalPass=new _i.T(new La.ShaderMaterial({uniforms:{baseTexture:{value:null},bloomTexture:{value:this.mtuPP.effectComposer.renderTarget2.texture}},vertexShader:qi,fragmentShader:$i,defines:{}}),"baseTexture"),this.finalPass.needsSwap=!0;var e=new La.WebGLRenderTarget(this.mtuPP.rtSize.x,this.mtuPP.rtSize.y,{samples:this.mtuPP.params.pp.samples});this.finalComposer=new Yi(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)}}var ta=r(228);class ra extends o.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 na extends ra{constructor(...e){super(...e),this.modifiedDefines={},this.modifiedUniforms={}}setDefine(e,t){const r=this.defines,n=this.modifiedDefines;null==t?e in r&&(e in n||(n[e]=r[e]),delete r[e]):r[e]!==t&&(e in n||(n[e]=e in r?r[e]:void 0),r[e]=t)}setTextureUniform(e,t){const r=this.uniforms,n=this.modifiedUniforms;e in n||(n[e]=r[e].value),r[e].value=t}finalize(){const e=this.modifiedDefines;var t=this.defines;for(const r in e)void 0===e[r]?r in t&&(this.needsUpdate=!0):t[r]!==e[r]&&(this.needsUpdate=!0),delete e[r];const r=this.modifiedUniforms;var n=this.uniforms;for(const e in r)r[e]!==n[e].value&&(this.needsUpdate=!0),delete r[e]}}const ia=new WeakMap;class aa{constructor(e){this._replacementMaterial=new na(e),this._replacementMaterials=new WeakMap,this.overrideUniforms={},this.overrideDefines={}}replace(e,t=!1,r=!0){const n=this;function i(e){if(!e.isHelper&&(e.isMesh||e.isSkinnedMesh)){if(!a.has(e)){const t=n.createMaterial(e);a.set(e,t)}const t=a.get(e);if(null!==t){let i=e.material;r?s.set(e,i):i=s.get(e),i||console.error("ShaderReplacement : Material for object was not cached before replacing shader.",e),n.updateUniforms(e,i,t),t.finalize&&t.finalize(),e.material=t}}}const a=this._replacementMaterials,s=ia;if(Array.isArray(e))if(t)for(let t=0,r=e.length;t<r;t++)e[t].traverse(i);else for(let t=0,r=e.length;t<r;t++)i(e[t]);else t?e.traverse(i):i(e)}reset(e,t){function r(e){e.isHelper||(n.has(e)?(e.material=n.get(e),n.delete(e)):(e.isSkinnedMesh||e.isMesh)&&console.error("ShaderReplacement : Material for object was not cached before resetting.",e))}const n=ia;if(Array.isArray(e))if(t)for(let t=0,n=e.length;t<n;t++)r(e[t]);else for(let t=0,n=e.length;t<n;t++)e[t].traverse(r);else t?e.traverse(r):r(e)}createMaterial(e){return this._replacementMaterial.clone()}updateUniforms(e,t,r){var n=this._replacementMaterial.defines,i=t.defines;const a=r.defines;if(r.side=t.side,r.flatShading=t.flatShading,r.skinning=t.skinning,i){for(const e in i)r.setDefine(e,i[e]);for(const e in a)e in i?r.setDefine(e,i[e]):r.setDefine(e,n[e])}const s=r.uniforms;if(t.isShaderMaterial){var o=t.uniforms;for(const e in s){var l=o[e];const t=s[e];l&&l.value!==t.value&&(t.value&&t.value.isTexture||l.value&&l.value.isTexture?r.setTextureUniform(e,l.value):t.value=l.value)}}else for(const e in s){const n=s[e];e in t&&t[e]!==n.value&&(n.value&&n.value.isTexture||t[e]&&t[e].isTexture?r.setTextureUniform(e,t[e]):n.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],r.needsUpdate=!0);for(const e in c)e in s&&(s[e].value=c[e].value)}dispose(){}}class sa extends aa{constructor(){super({extensions:{derivatives:!0},defines:{USE_UV:""},uniforms:Object.assign(Object.assign({},o.ShaderLib.normal.uniforms),{alphaMap:{value:null},alphaTest:{value:0},map:{value:null},opacity:{value:1}}),vertexShader:o.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,r){super.updateUniforms(e,t,r),r.setDefine("USE_NORMALMAP",this.useNormalMaps&&r.uniforms.normalMap.value?"":void 0),r.setDefine("TANGENTSPACE_NORMALMAP",this.useNormalMaps&&r.uniforms.normalMap.value?"":void 0),r.setDefine("ALPHATEST",r.uniforms.alphaTest.value||void 0),r.setDefine("USE_ALPHAMAP",0!==r.defines.ALPHATEST&&r.uniforms.alphaMap.value?"":void 0),r.setDefine("USE_MAP",0!==r.defines.ALPHATEST&&r.uniforms.map.value?"":void 0),r.setDefine("USE_UV","USE_ALPHAMAP"in r.defines||"USE_MAP"in r.defines?"":void 0)}}class oa extends aa{constructor(){super({extensions:{derivatives:!0},defines:{USE_UV:""},uniforms:Object.assign(Object.assign({},o.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===o.FrontSide?o.BackSide:o.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 la={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"},ua={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"},ca={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 o.Vector2},blueNoiseTex:{value:null},blueNoiseSize:{value:1},clipInfo:{value:new o.Vector4},projInfo:{value:new o.Vector4},params:{value:new o.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"},ha={defines:{BLUR_ITERATIONS:5,BLUR_MODE:0,AO_ONLY:0,COLOR_ONLY:0,DEPTH_THRESHOLD:"5e-1"},uniforms:{fullSize:{value:new o.Vector2},aoSize:{value:new o.Vector2},normalBuffer:{value:null},depthBuffer:{value:null},colorBuffer:{value:null},gtaoBuffer:{value:null},intensity:{value:1},blurStride:{value:1},ambientColor:{value:new o.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 da{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:r}=this;let n=1/0,i=-1;for(let a=0,s=r.length;a<s;a++)0===r[a]&&(e=t[a])<n&&(n=e,i=a);return i}findCluster(){var e,{score:t,binaryPattern:r}=this;let n=-1/0,i=-1;for(let a=0,s=r.length;a<s;a++)1===r[a]&&(e=t[a])>n&&(n=e,i=a);return i}setSigma(e){if(e!==this.sigma){var t=~~(Math.sqrt(20*Math.pow(e,2))+1),r=2*t+1;const s=new Float32Array(r*r);var n=e*e;for(let e=-t;e<=t;e++)for(let o=-t;o<=t;o++){var i=(t+o)*r+e+t,a=e*e+o*o;s[i]=Math.pow(Math.E,-a/(2*n))}this.lookupTable=s,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:r}=this;t.fill(0);for(let t=0,a=e.length;t<a;t++){var n,i;0===e[t]?(n=~~(t/r),i=t-n*r,this.updateScore(i,n,1),e[t]=1):e[t]=0}}updateScore(e,t,r){const{size:n,score:i,lookupTable:a}=this;var s=this.radius,o=2*s+1;for(let c=-s;c<=s;c++)for(let h=-s;h<=s;h++){var l=a[(s+h)*o+c+s];let d=e+c,p=(d=d<0?n+d:d%n,t+h);var u=(p=p<0?n+p:p%n)*n+d;i[u]+=r*l}}addPointIndex(e){this.binaryPattern[e]=1;var t=this.size,r=~~(e/t);this.updateScore(e-r*t,r,1),this.count++}removePointIndex(e){this.binaryPattern[e]=0;var t=this.size,r=~~(e/t);this.updateScore(e-r*t,r,-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 pa{constructor(){this.random=Math.random,this.sigma=1.5,this.size=64,this.majorityPointsRatio=.1,this.samples=new da(1),this.savedSamples=new da(1)}generate(){const{samples:e,savedSamples:t,sigma:r,majorityPointsRatio:n,size:i}=this;e.resize(i),e.setSigma(r);var a=Math.floor(i*i*n),s=e.binaryPattern,o=s,l=a;o.fill(0);for(let e=0;e<l;e++)o[e]=1;var[u,c=Math.random]=[s,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,r=s.length;t<r;t++)1===s[t]&&e.addPointIndex(t);for(;;){var p=e.findCluster(),f=(e.removePointIndex(p),e.findVoid());if(p===f){e.addPointIndex(p);break}e.addPointIndex(f)}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 fa extends Di.w{constructor(e,t){super(),this.enabled=!0,this.needsSwap=!0,this.scene=e,this.camera=t,this.debug={display:fa.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=fa.BOX_BLUR,this.blurIterations=4,this.blurStride=1,this.enableFalloff=!0,this.falloffStart=.4,this.falloffEnd=2,this.ambientColor=new o.Color,this.ambientIntensity=0,this.lightBounceIntensity=1,this._gtaoBuffer=new o.WebGLRenderTarget(1,1,{format:o.RGBAFormat}),this._depthBuffer=new o.WebGLRenderTarget(1,1,{minFilter:o.NearestFilter,magFilter:o.NearestFilter,format:o.RGBFormat,type:o.HalfFloatType}),this._depthReplacement=new oa,this._normalBuffer=new o.WebGLRenderTarget(1,1,{minFilter:o.NearestFilter,magFilter:o.NearestFilter,format:o.RGBAFormat}),this._normalReplacement=new sa,this.gtaoQuad=new Di.T(new o.ShaderMaterial(ca)),this.debugPackedQuad=new Di.T(new o.ShaderMaterial(la)),this.debugDepthQuad=new Di.T(new o.ShaderMaterial(ua)),this.compositeQuad=new Di.T(new o.ShaderMaterial(ha));const r=new pa,n=(r.size=32,new Uint8Array(4*Math.pow(32,2)));for(let e=0;e<4;e++){var i=r.generate(),a=i.data,s=i.maxValue;for(let t=0,r=a.length;t<r;t++)n[4*t+e]=a[t]/s*255}this.blueNoiseTex=new o.DataTexture(n,r.size,r.size,o.RGBAFormat),this.blueNoiseTex.wrapS=o.RepeatWrapping,this.blueNoiseTex.wrapT=o.RepeatWrapping,this.blueNoiseTex.minFilter=o.LinearFilter,this.blueNoiseTex.needsUpdate=!0}dispose(){}setSize(e,t){var r=this.renderTargetScale,n=Math.floor(e*r);r=Math.floor(t*r),this._depthBuffer.setSize(e,t),this._normalBuffer.setSize(e,t),this._gtaoBuffer.setSize(n,r)}render(e,t,r){t=this.renderToScreen?null:t;const{scene:n,camera:i,debug:a,debugPackedQuad:s,debugDepthQuad:l,compositeQuad:u,gtaoQuad:c}=this,h=c.material;fa.RendererState.copy(e,n);var d=()=>{fa.RendererState.restore(e,n),f.reset(n,!0)},p=this._depthBuffer;const f=this._depthReplacement;if(n.background=null,f.replace(n,!0,!0),e.setRenderTarget(p),e.setClearColor(fa.BlackColor,0),e.clear(),e.render(n,i),a.display===fa.DEPTH)return e.setRenderTarget(t),l.material.uniforms.texture.value=p.texture,l.render(e),void d();const m=this._normalReplacement;var v=this._normalBuffer;if(m.replace(n,!0,!1),e.setRenderTarget(v),e.clear(),e.render(n,i),a.display===fa.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=i.projectionMatrix,w=o.MathUtils.DEG2RAD*i.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(i.near,i.far,b/(2*Math.tan(.5*w))*.5,0),h.uniforms.normalBuffer.value=v.texture,h.uniforms.depthBuffer.value=p.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 S=u.material;S.uniforms.depthBuffer.value=p.texture,S.uniforms.normalBuffer.value=v.texture,S.uniforms.colorBuffer.value=r.texture,S.uniforms.gtaoBuffer.value=g.texture,S.uniforms.intensity.value=this.intensity,S.uniforms.aoSize.value.set(g.width,g.height),S.uniforms.fullSize.value.set(r.width,r.height),S.uniforms.blurStride.value=this.blurStride,S.uniforms.ambientColor.value.copy(this.ambientColor),S.uniforms.ambientIntensity.value=this.ambientIntensity,this.blurIterations!==S.defines.BLUR_ITERATIONS&&(S.defines.BLUR_ITERATIONS=this.blurIterations,S.needsUpdate=!0),this.blurMode!==S.defines.BLUR_MODE&&(S.defines.BLUR_MODE=this.blurMode,S.needsUpdate=!0),a.display===fa.AO_SAMPLE?1!==S.defines.AO_ONLY&&(S.defines.AO_ONLY=1,S.needsUpdate=!0):0!==S.defines.AO_ONLY&&(S.defines.AO_ONLY=0,S.needsUpdate=!0),a.display===fa.COLOR_SAMPLE?1!==S.defines.COLOR_ONLY&&(S.defines.COLOR_ONLY=1,S.needsUpdate=!0):0!==S.defines.COLOR_ONLY&&(S.defines.COLOR_ONLY=0,S.needsUpdate=!0),e.setRenderTarget(t),e.clear(),u.render(e),d()}}fa.NO_JITTER=0,fa.RANDOM_JITTER=1,fa.BLUENOISE_JITTER=2,fa.DEFAULT=0,fa.DEPTH=1,fa.NORMAL=2,fa.AO_SAMPLE=3,fa.COLOR_SAMPLE=4,fa.NO_BLUR=0,fa.BOX_BLUR=1,fa.CROSS_BLUR=2,fa.DIAGONAL_BLUR=3,fa.BlackColor=new o.Color(0),fa.RendererState=new class{constructor(){this.clearAlpha=0,this.clearColor=new o.Color,this.renderTarget=null,this.outputEncoding=o.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 ma{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.gtaoPass||(this.gtaoPass=new fa(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 La.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 va(e){return(va="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 ga(e,t){return(ga=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ya(e){return(ya=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ba=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&&ga(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=ya(e);if(r=t?(r=ya(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===va(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,t,i,a,s){var l;if(this instanceof n)return(l=r.call(this)).scene=e,l.camera=t,l.overrideMaterial=i,l.clearColor=a,l.clearAlpha=void 0!==s?s:0,l.clear=!0,l.clearDepth=!1,l.needsSwap=!1,l._oldClearColor=new o.Color,l;throw new TypeError("Cannot call a class as a function")}return t=n,(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}),n}(Di.w),xa={uniforms:{tDiffuse:{value:null},resolution:{value:new o.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"},wa={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}"};const Sa={radius:{type:"number",val:.6,shortKey:"r",onUpdate({type:e,data:t,runScene:r}){r.pp.setGlowData(e,t)}},strength:{type:"number",val:1.5,shortKey:"s",onUpdate({type:e,data:t,runScene:r}){r.pp.setGlowData(e,t)}},threshold:{type:"number",val:0,shortKey:"t",onUpdate({type:e,data:t,runScene:r}){r.pp.setGlowData(e,t)}}},Aa={edgeStrength:{type:"number",val:3,shortKey:"es",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},edgeGlow:{type:"number",val:0,shortKey:"eg",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},edgeThickness:{type:"number",val:1,shortKey:"et",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},pulsePeriod:{type:"number",val:0,shortKey:"pp",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},visibleEdgeColor:{type:"color_str",val:"#FFFFFF",shortKey:"vec",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},hiddenEdgeColor:{type:"color_str",val:"#190A05",shortKey:"hec",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}}},Ma={directionOffset:{type:"number",val:0,shortKey:"do",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},stepOffset:{type:"number",val:0,shortKey:"so",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},rotationJitter:{type:"other",val:"NONE",shortKey:"roj",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},radiusJitter:{type:"other",val:"NONE",shortKey:"raj",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},numSteps:{type:"number",val:8,shortKey:"ns",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},numDirections:{type:"number",val:1,shortKey:"nd",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},intensity:{type:"number",val:1,shortKey:"i",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},radius:{type:"number",val:2,shortKey:"r",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},enableFalloff:{type:"other",val:!0,shortKey:"ef",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},falloffStart:{type:"number",val:.4,shortKey:"fs",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},falloffEnd:{type:"number",val:2,shortKey:"fe",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},renderTargetScale:{type:"number",val:.5,shortKey:"rts",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},blurMode:{type:"other",val:"NO_BLUR",shortKey:"bm",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},blurIterations:{type:"number",val:5,shortKey:"bi",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},blurStride:{type:"number",val:1,shortKey:"bs",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},ambientColor:{type:"color_str",val:"#FFFFFF",shortKey:"ac",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},ambientIntensity:{type:"number",val:0,shortKey:"ai",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},lightBounceIntensity:{type:"number",val:0,shortKey:"lbi",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}}};var Ba=r(398);class Ca{constructor(e){this.params=this.getDefaultParams(),this.clean=()=>{this.resetParams(),this.reset()},this.ENTIRE_SCENE=0,this.BLOOM_SCENE=1,this.BLACK_COLOR=new La.Color(0),this.runScene=e,this.info=new Ei(this.runScene),this.isSafari=-1<navigator.userAgent.indexOf("Safari"),this.isChrome=-1<navigator.userAgent.indexOf("Chrome"),this.rtSize=new La.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&&t&&t.show&&(this.sceneFogColor?this.sceneFogColor.copy(t.color):this.sceneFogColor=new La.Color(t.color)),"background"===e&&(this.sceneBackground&&(0,Pe.isTexture)(this.sceneBackground)&&this.sceneBackground.dispose(),this.sceneBackground=t,this.isChrome&&this.mtuGlow?this.mtuGlow.setSceneBg():this.isSafari)})),this.runScene.snapshot.bind({name:"glow",target:this.params.glow,def:Sa}),this.runScene.snapshot.bind({name:"outline",target:this.params.outline,def:Aa}),this.runScene.snapshot.bind({name:"ao",target:this.params.ao,def:Ma,set:e=>{const t=e.snapshot.data.get("ao");t&&(Ba.LV.set({def:Ma,runScene:this.runScene,data:t,target:this.params.ao,map:e}),e.data.completedCbs.push((()=>{(0,s.mapObj)(Ma,((e,r)=>{var{type:r,val:n,shortKey:i}=r;"other"===r&&this.setAOData(e,void 0!==t[i]?t[i]:n)}))})))}})}getDefaultParams(){return{pp:{samples:2},glow:{isBloom:!1,radius:.6,strength:1.5,threshold:0},outline:{isOutline:!1,edgeStrength:3,edgeGlow:0,edgeThickness:1,pulsePeriod:0,visibleEdgeColor:"#FFFFFF",hiddenEdgeColor:"#190A05"},ao:{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},vignette:{isVignette:!1,offset:1,darkness:1}}}resetParams(){(0,Fe.U)(this.params,this.getDefaultParams())}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 Yi(this.renderer,this.getNewRenderTarget(this.params.pp.samples)),this.renderPass=new ba(this.mainScene,this.mainCamera),this.fxaaPass=new _i.T(xa),this.fxaaPass.uniforms.resolution.value.set(1/window.innerWidth,1/window.innerHeight),this.vignettePass=new _i.T(wa),this.effectComposer.addPass(this.renderPass),this.ppOutline(),this.ppGlow(),this.ppAO(),this.effectComposer.addPass(this.vignettePass)}getNewRenderTarget(e){const t=new La.WebGLRenderTarget(this.rtSize.x,this.rtSize.y,{samples:e});return t.depthTexture=new La.DepthTexture(this.rtSize.x,this.rtSize.y),t.depthTexture.type=La.UnsignedIntType,t.depthTexture.format=La.DepthFormat,t.texture.format=La.RGBAFormat,t.texture.encoding=La.sRGBEncoding,t}ppOutline(){this.mtOutline=new ta.Q(this)}ppGlow(){this.isChrome?(this.effectComposer.renderToScreen=!0,this.mtuGlow=new Gi(this)):this.isSafari&&(this.effectComposer.renderToScreen=!1,this.threeGlow=new ea(this))}ppAO(){this.mtAO=new ma(this)}toJSON(){const e={};var{pp:t,glow:r,outline:n,ao:i,vignette:a}=this.params;return e.ppParams=Object.assign({},t),e.bloomParams=Object.assign({},r),e.outlineParams=Object.assign({},n),e.aoParams=Object.assign({},i),e.vignetteParams=Object.assign({},a),JSON.stringify(e)}fromJSON(e){var{ppParams:e,bloomParams:t,outlineParams:r,aoParams:n,vignetteParams:i}=e;e&&(e=e.samples,this.params.pp.samples=e,this.effectComposer&&this.effectComposer.reset(this.getNewRenderTarget(this.params.pp.samples))),t&&(this.params.glow.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.params.glow)),r&&this.mtOutline&&(this.params.outline.isOutline=r.isOutline,this.setOutlineData("edgeStrength",r.edgeStrength),this.setOutlineData("edgeGlow",r.edgeGlow),this.setOutlineData("edgeThickness",r.edgeThickness),this.setOutlineData("pulsePeriod",r.pulsePeriod),this.setOutlineData("visibleEdgeColor",r.visibleEdgeColor),this.setOutlineData("hiddenEdgeColor",r.hiddenEdgeColor),this.runScene.cb.pp.outline.setData.cb(this.params.outline)),n&&this.mtAO&&(this.params.ao.isAO=n.isAO,this.setAOData("directionOffset",n.directionOffset),this.setAOData("stepOffset",n.stepOffset),this.setAOData("rotationJitter",n.rotationJitter),this.setAOData("radiusJitter",n.radiusJitter),this.setAOData("numSteps",n.numSteps),this.setAOData("numDirections",n.numDirections),this.setAOData("intensity",n.intensity),this.setAOData("radius",n.radius),this.setAOData("enableFalloff",n.enableFalloff),this.setAOData("falloffStart",n.falloffStart),this.setAOData("falloffEnd",n.falloffEnd),this.setAOData("renderTargetScale",n.renderTargetScale),this.setAOData("blurMode",n.blurMode),this.setAOData("blurIterations",n.blurIterations),this.setAOData("blurStride",n.blurStride),this.setAOData("ambientColor",n.ambientColor),this.setAOData("ambientIntensity",n.ambientIntensity),this.setAOData("lightBounceIntensity",n.lightBounceIntensity),this.runScene.cb.pp.ao.setData.cb(this.params.ao)),i&&this.vignettePass&&(this.params.vignette.isVignette=i.isVignette,this.setVignetteData("offset",i.offset),this.setVignetteData("darkness",i.darkness),this.runScene.cb.pp.vignette.setData.cb(this.params.vignette))}setUpdate(e){this.isUpdate=e}clearAllOutlineObj(){this.mtOutline.clearAllOutlineObj()}update(){this.isUpdate&&this.mainScene&&this.mainCamera&&this.renderer&&(this.params.glow.isBloom||this.params.outline.isOutline||this.params.ao.isAO||this.params.vignette.isVignette?(this.vignettePass.enabled=this.params.vignette.isVignette,this.mtAO&&this.mtAO.enablePass(this.params.ao.isAO),this.mtOutline&&this.mtOutline.enablePass(this.params.outline.isOutline),this.isChrome&&this.mtuGlow?(this.mtuGlow.enablePass(this.params.glow.isBloom),this.effectComposer.render()):this.isSafari&&this.threeGlow&&(this.threeGlow.enablePass(this.params.glow.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.params.pp[e]=t,"samples"===e&&this.effectComposer&&this.effectComposer.reset(this.getNewRenderTarget(this.params.pp.samples))}setGlowData(e,t){this.params.glow[e]=t,this.isChrome&&this.mtuGlow?this.mtuGlow.setGlowData(e,t):this.isSafari&&this.threeGlow&&this.threeGlow.setGlowData(e,t)}setOutlineData(e,t){this.params.outline[e]=t,this.mtOutline&&this.mtOutline.setOutlineData(e,t)}addOutlineObj(e,t=!0){this.mtOutline.addSelectedObject(e,t)}setAOData(e,t){this.params.ao[e]=t,this.mtAO&&this.mtAO.setAOData(e,t)}setVignetteData(e,t){this.params.vignette[e]=t,this.vignettePass&&(this.vignettePass.uniforms[e].value=t)}}var Ea=r(738);class Ta extends l{constructor(e){super(e),this.map=new M.Z,this.playLimit=new Fe.cM,this.renderName="script-texture-render",this._clock=new o.Clock,this.bindEvent()}parse(e,t){var r=(0,Ge.Ki)(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)}has(e){return void 0!==e.userData.uvScript}get(e){return e.userData.uvScript}set(e,t){t.userData.uvScript=e}}class _a extends l{constructor(e){super(e),this.runAll=!1,this.texture=new Ta(e)}playAll(){this.runAll||(this.runAll=!0,this.texture.playAll())}closeAll(){this.runAll&&(this.runAll=!1,this.texture.closeAll())}}class Da{constructor(e){this.map=new M.Z,this.clean=()=>{this.clear()},this.runScene=e,this.runScene.cb.clean.add("Tags",this.clean),this.runScene.cb.model.remove.add("Tags",(({model:e})=>{const t=(0,Ge.Ki)(e);t&&this.map.map(((e,r)=>{r.delete(t)}))}))}get(e){return this.map.get(e)}add(e){this.get(e)||this.map.set(e,new _e.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,Fe.lG)(t,"array"))return t.map((t=>{this.addModel(e,t)}));this.map.get(e).add((0,Ge.Ki)(t))}reflash(e){const t=this.map.get(e);if(t){let e=[];t.forEach((t=>{this.runScene.modelEx.getById(t)||e.push(t)})),e.map((e=>t.remove(e)))}}removeModel(e,t){if(this.map.has(e))return(0,Fe.lG)(t,"array")?t.map((t=>{this.removeModel(e,t)})):void this.map.get(e).remove((0,Ge.Ki)(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,s.mapObj)(e,((e,r)=>{t[e]=new _e.Z(r)})),this.map=M.Z.formJSON(t),this.runScene.cb.tags.parseJSON.cb(e)}}class Pa{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=Pa.isNotNow(e)?this.getAllData():e,(0,s.mapObj)(n,((r,n)=>{void 0!==e[r]&&("number"===(n=n.type)?(i[r]=t[r],a[r]=e[r]):"color"===n&&(0,s.mapObj)(e[r],((e,n)=>{var s=r+e;i[s]=t[r][e],a[s]=n})))})),!(0,s.emptyObj)(i))return{begin:i,end:a}};return(t,r,n,i=!1,a)=>{let o=i?n.time:0;const l=Object.keys(t).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t)));var u=(0,s.lastArrayEle)(l),c=i?"0.00":String(n.time);return u!==c&&(t[c]=Object.assign({},u),l.push(c)),l.map((l=>{var u=t[String(l)],c=.001*((c=i?o-l:l-o)<=0?.001:c)*n.speed;o=l;{var d=r,p=u,f=c,m=a;const t={color(e){const{animaData:t,defType:r}=e,n={};(0,s.mapObj)(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(p,d,0,m)))return n(0);var{begin:i,end:a}=i;return r=(0,h.anima)(i,a,f,(e=>{(0,s.mapObj)(m,((r,n)=>{n=n.type;var i,a=e[r];"number"===n?d[r]=a:"color"===n&&(a=t.color({animaData:e,defType:r}))&&(({r:n,g:a,b:i}=a),d[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,s.mapObj)(e,(i=>{n[i]=r?"notNow":Pa.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?ui().model.v3ToMap(e):""}static SetTargetByData(e){const{baseType:t,data:r,defType:n,target:i}=e;var a,s;"number"===t?i[n]=r:"color"===t&&(({r:e,g:a,b:s}=r),i[n].setRGB(e,a,s))}getAllData(e=!1){return Pa.getAllDefValByType(this.defOptions,this.target,e)}getData(e){return Pa.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){Pa.setTargetByBetween(e,t,r,this.defOptions,this.target)}clone(e){var{data:t,type:r}=this;const n=new(0,Ia[r])(e);return n.data=t,n}reset(){(0,s.mapObj)(this.defOptions,((e,t)=>{Pa.SetTargetByData({baseType:t.type,data:Pa.getValByType(this.beginData,e,this.defOptions),target:this.target,defType:e})}))}remove(){delete this.target.userData.isTimeLineUsed}}Pa.setTargetByBetween=(()=>{const e=(e,t,r)=>e!==t?(t-e)*r+e:e;return(t,r,n,i,a)=>{(0,s.mapObj)(i,((i,s)=>{var o,l,u,c,h,d;s=s.type,void 0!==t[i]&&void 0!==r[i]&&Pa.SetTargetByData({baseType:s,data:(o=t[i],l=r[i],u=n,"number"===s?e(o,l,u):"color"===s?(({r:s,g:o,b:c}=o),({r:l,g:h,b:d}=l),{r:e(s,l,u),g:e(o,h,u),b:e(c,d,u)}):void 0),defType:i,target:a})}))}})();const Oa=Pa;class Ra extends l{constructor(){super(...arguments),this.mount=e=>{e.core.module.set("timeline",this)},this.after=e=>{var t,{json:e,config:r}=e;"scene"===(null==(t=null==(t=e.asset)?void 0:t.ex)?void 0:t.type)&&r.module.timeline&&this.runScene.timeLineEx.parseSavedGroupMap((null==(t=e.asset.ex)?void 0:t.timeLine)||{})}}init(){var e={name:"timeline",loadCallBacks:new M.Z({afterParse:this.after,mountModule:this.mount}),exportCallBacks:new M.Z};this.runScene.exporter.gltf.module.bind(e)}}const Ia={model:class extends Oa{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:s}=t;return{x:e!==t?(t-e)*r+e:e,y:n!==a?(a-n)*r+n:n,z:i!==s?(s-i)*r+i:i}};return(t,r,n)=>{var i,{position:t,scale:a,rotation:s}=t,{position:r,scale:o,rotation:l}=r;t&&r&&(({x:t,y:r,z:i}=e(t,r,n)),this.target.position.set(t,r,i)),a&&o&&(({x:t,y:r,z:i}=e(a,o,n)),this.target.scale.set(t,r,i)),s&&l&&(({x:a,y:o,z:t}=e(s,l,n)),this.target.rotation.set(a,o,t))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,r)=>{var{position:t,scale:n,rotation:i}=t,{position:e,scale:a,rotation:s}=Oa.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}:{},s?{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}:{},s?{rx:s.x,ry:s.y,rz:s.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 l=(0,s.lastArrayEle)(o),u=i?"0.00":String(n.time)+".00";return l!==u&&(t[u]={position:"notNow",rotation:"notNow",scale:"notNow"},o.push(u)),o.map((s=>{var o,l,u,c,d=t[String(s)],p=.001*((p=i?a-s:s-a)<=0?.001:p)*n.speed;return a=s,o=r,l=d,u=p,c=n,()=>{let t;return{promise:new Promise((r=>{var{begin:n,end:i}=e(l,o,c);return t=(0,h.anima)(n,i,u,(e=>{var{px:e,py:t,pz:r,sx:n,sy:i,sz:a,rx:s,ry:u,rz:c}=e;l.position&&o.position.set(e,t,r),l.scale&&o.scale.set(n,i,a),l.rotation&&o.rotation.set(s,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 Oa{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:s}=t;return{x:e!==t?(t-e)*r+e:e,y:n!==a?(a-n)*r+n:n,z:i!==s?(s-i)*r+i:i}};return(t,r,n)=>{var i,{position:t,scale:a,rotation:s,target:o}=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)),s&&u&&(({x:a,y:l,z:t}=e(s,u,n)),this.target.rotation.set(a,l,t)),o&&c&&(({x:r,y:i,z:s}=e(o,c,n)),this.controls.target.set(r,i,s))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,r)=>{var{position:t,scale:n,rotation:i}=t,{position:e,scale:a,rotation:s,target:o}=Oa.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}:{},s?{rx:i.x,ry:i.y,rz:i.z}:{},o?{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}:{},s?{rx:s.x,ry:s.y,rz:s.z}:{},o?{tx:o.x,ty:o.y,tz:o.z}:{})}},t=(t,r,n,i)=>()=>{let a;return{promise:new Promise((s=>{var{begin:o,end:l}=e(r,t,i);return a=(0,h.anima)(o,l,n,(e=>{var{px:e,py:n,pz:i,sx:a,sy:s,sz:o,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,s,o),r.rotation&&t.rotation.set(l,u,c),r.target&&this.controls.target.set(h,d,p)}),s)})),anima:h.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 l=(0,s.lastArrayEle)(o),u=i?"0.00":String(n.time);return l!==u&&(e[u]=Object.assign({},l),o.push(u)),o.map((s=>{var o=e[String(s)],l=.001*((l=i?a-s:s-a)<=0?.001:l)*n.speed;return a=s,t(r,o,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":ui().model.v3ToMap(t),scale:e?"notNow":ui().model.v3ToMap(r),rotation:e?"notNow":ui().model.v3ToMap(n),target:e?"notNow":ui().model.v3ToMap(this.controls.target)}}getData(e){var{position:t,scale:r,rotation:n}=this.target;let i;if("position"===e)i=ui().model.v3ToMap(t);else if("scale"===e)i=ui().model.v3ToMap(r);else if("rotation"===e)i=ui().model.v3ToMap(n);else{if("target"!==e)throw TypeError("输入值不存在");i=ui().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 Oa{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)}}};r(263);class ka{constructor(){this.list={}}on(e,t){this.list[e]=t}emit(...e){if(void 0===this.list[e[0]])throw Error("请先挂载在使用---"+[e[0]]);return this.list[e[0]](...[...e].filter(((e,t)=>0!==t)))}off(e){this.list[e]&&delete this.list[e]}}const La=c.Z,Fa=class{constructor(e){this._clock=new o.Clock,this.cb=new y,this.script=new _a(this),this.uniqueEx=new Ge.ZP(this),this.fileEx=new ii(this),this.snapshot=new Ba.ZP(this),this.undoEx=new bi.ZP(this),this.textureEx=new Pe.default(this),this.controlsEx=new A,this.assetsEx=new v(this),this.renderEx=new Ea.Z(this),this.events=new class{constructor(e){this.key=new E(this),this.mouse=new _(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 pi(this),this.helperEx=null,this.materialEx=new ke.default(this),this.cameraEx=new b.Z(this),this.sceneEx=new Le.ZP(this),this.modelEx=new d.default(this),this.loaderer=new u.Z(this),this.exporter=new Ke(this),this.lightEx=new Re.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 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],s=i[r+1],o=e[a];if(e=e[s],o&&e){var l=Object.values(o)[0],u=Object.values(e)[0];if("notNow"!==l&&"notNow"!==u)return{left:o,right:e,progress:(t-Number(a))/(Number(s)-Number(a))}}}})(e.data,t);i&&(({left:i,right:r,progress:n}=i),e.setTargetByBetween(i,r,n))}))},this.runScene=e,this.runScene.cb.clean.add("TimeLine",this.clean),this.exportAndImport=new Ra(e)}init(){this.exportAndImport.init()}reset(){this.timerMap={},this.animaMap={},this.groupMap={},this.runScene.cb.timeLine.reset.cb("")}pause(e){var t,r;if(this.groupMap[e]){this.timerMap[e]&&(({setProgressTime:t,awaitRuned:r}=this.timerMap[e]),t&&clearInterval(t),r&&clearInterval(r)),this.groupMap[e].run=!1;const n=this.animaMap[e];n&&n.length&&n.map((e=>{e.controls.run=!1}))}}resume(e){const t=this.groupMap[e];if(t){this.groupMap[e].run=!0;const r=this.animaMap[e];r&&r.length&&r.map((r=>{const{controls:n,promise:i}=r;n.run=!0,i.then((()=>{if(t.run)return t.run=!1,t.loop?this.playGroup(e):void 0}))}))}}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,s.mapObj)(this.groupMap,((e,t)=>{t.run=!1})),this.groupMap}parseSavedGroupMap(e){Object.keys(e).map((t=>{const r=e[t],n={};(0,s.mapObj)(r.data,((e,t)=>{var{type:t,data:r}=t;const i=Ia[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,Fe.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,s.eachTriggerArrGetControls)(e)));let a=0;a=r?n.time*n.speed:n.time*n.speed*(n.reverse?2:1);const o=(new Date).valueOf(),l=a;let u;t=setInterval((()=>{var t=((new Date).valueOf()-o)/l;this.runScene.cb.timeLine.playGroup.cb({groupName:e,progress:t})}),16.6);const c=new Promise((e=>u=setTimeout(e,a)));return this.timerMap[e]={setProgressTime:t,awaitRuned:u},c.then((()=>{if(clearInterval(this.timerMap[e].setProgressTime),n.run)return n.run=!1,n.loop?this.playGroup(e):void 0}))}}}(this),this.anima=new p(this),this.tags=new Da(this),this.globalConfig=new ai(this),this.pp=new Ca(this),this.objects=new Ai(this),this.inited=!1,this._renderLimit=new Fe.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()}},this.optionsEx=new Ci(this,e)}initLibs(e){if(!this.inited){this.inited=!0,this.snapshot.init(),this.materialEx.init(),this.modelEx.init(),this.sceneEx.init(),this.timeLineEx.init(),this.loaderer.init(),this.assetsEx.init(e),this.events.init(e),this.globalConfig.setRenderMode(this.optionsEx.options.renderConfig.mode),this.helperEx=new li(this);const{camera:t,controls:r}=this.assetsEx.get();this.uniqueEx.model.add(t),this.renderEx.setSize(),r.update(),this.pp.init(),this.cameraEx.reset(t),this.cb.inited.cb(0)}}init(e){return this.initLibs(e),this}load(e){var{path:e,dom:t,loadConfig:r}=e;return this.init(t),this.loadScene(e,r).then((e=>{0!==(null==e?void 0:e.length)&&this.modelEx.add(e)})),this}loadScene(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,i){function a(e){try{o(n.next(e))}catch(e){i(e)}}function s(e){try{o(n.throw(e))}catch(e){i(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(a,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){const{getJSON:r,progress:n,complete:i}=this.cb.load;t=t||{};var s=Object.assign(Object.assign({},t),{callBack:Object.assign(Object.assign({},t.callBack),{getJSON:e=>{var n,i;null!=(i=null==(n=null==t?void 0:t.callBack)?void 0:n.getJSON)&&i.call(n,e),r.cb(e)},progress:e=>{var r,i;null!=(i=null==(r=null==t?void 0:t.callBack)?void 0:r.progress)&&i.call(r,e),n.cb(e)},complete:e=>{var r,n;null!=(n=null==(r=null==t?void 0:t.callBack)?void 0:r.complete)&&n.call(r,e),i.cb(e)}}),triggerCb:!1});if(e instanceof ArrayBuffer)return this.optionsEx.log("正在解析二进制文件","base","info"),this.loaderer.gltf.parse(e,s);this.optionsEx.log("正在拉取场景","base","info");var o=yield a().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 o?(this.optionsEx.log("拉取场景成功、正在解析","base","success"),this.loaderer.gltf.parse(o,s)):void 0}))}dispose(){this.assetsEx.dispose(),this.sceneEx.clean()}on(e,t){return null!=(e=this.cb.load[e])&&e.add("load-callback"+(0,s.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)}clean(){this.cb.clean.cb(0)}}},736:(e,t,r)=>{r.d(t,{ZP:()=>y,bv:()=>A,is:()=>S,UE:()=>w,M:()=>b});var n=r(1),i=r(881),a=r(932),s=r(749),o=r(738),l=r(794),u=r(625);class c{constructor(e){this.mount=e=>{e.core.module.set("scene",this)},this.parse={before:e=>{var t,r,n,i,a,s,{json:e,config:o,core:l}=e;"scene"===(null==(t=null==(t=e.asset)?void 0:t.ex)?void 0:t.type)&&(({camera:t,lights:e,options:r,controls:n,tags:i,envStrength:a,objects:s}=e.asset.ex),void 0!==a&&this.runScene.sceneEx.setEnvStrength(a),this.parse.camera(t,o),this.parse.light(e,o,l),this.parse.controls(n,o),o.module.tags&&this.runScene.tags.parseJSON(i||{}),this.parse.options(r),s&&this.runScene.objects.parseJSON(s))},after:e=>{const{core:t,json:r,data:n,config:i}=e;if("scene"===(null==(e=null==(e=r.asset)?void 0:e.ex)?void 0:e.type)){var{options:e,json:a}=n;if(e=e.models,!t.loadConfig.module.model)return[];const s=e[0];if(t.module.get("model").data.map.map(((e,t)=>{this.runScene.uniqueEx.model.add(t)})),e=s.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(r,i,t),t.models.push(...e)}},controls:(e,t)=>{var r;t.module.controls&&(({x:t,y:e,z:r}=e),this.runScene.assetsEx.controls.target.set(t,e,r),this.runScene.assetsEx.controls.update())},camera:(e,t)=>{if(t.module.camera){let o=e;e.temp&&(o=e.camera,this.runScene.cameraEx.temp=l.Z.formJSON(e.temp));var{position:t,far:e,near:r,fov:n,name:i,userData:a,rotation:s}=this.runScene.loaderer.object.parse(o);const u=this.runScene.assetsEx.get().camera;u.position.copy(t),u.far=e,u.near=r,u.fov=n,u.name=i,u.updateProjectionMatrix(),u.userData.id=a.id,this.runScene.uniqueEx.model.add(u),u.rotation.copy(s),this.runScene.assetsEx.get().controls.update()}},light:(e,t,r)=>{if(t.module.light){const t=[];e.map((e=>{var r=e.type;t.push(...this.runScene.lightEx.lightExMap[r].parseJSON(e))})),r.models.push(...t)}},scene:(e,t,r)=>{if(t.module.sceneConfig){const s=this.runScene.sceneEx.get();t=r.module.get("material").data.materialIns;var{materialId:r,backgroundMapping:e,backgroundColor:n,fog:a}=e.asset.ex.sceneEx;if(r&&(r=null==(t=t[r])?void 0:t.material)){const{map:t,envMap:n}=r;t&&(t.mapping=e||300,t.needsUpdate=!0,this.runScene.sceneEx.setBackground(t,!1),t.userData.isBackgroud=!0),n&&(s.environment=(0,u.setTextureMapping)(n))}if(n&&this.runScene.sceneEx.setBackground(new i.Color("#"+n)),a){const{color:e,far:t,near:r,show:n}=a,o=new i.Fog(e.includes("#")?e:"#"+e,r,t);!1===n?this.runScene.sceneEx.oldFog=o:s.fog=o,o.show=n,this.runScene.cb.setScene.cb({scene:s,type:"fog",val:o})}this.runScene.cb.setScene.cb({scene:s,type:"any",val:"any"})}},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)}))}},this.toJSON=()=>{},this.runScene=e}init(){this.bindEvent()}bindEvent(){var e={name:"sceneConfig",loadCallBacks:new l.Z({beforeParse:this.parse.before,afterParse:this.parse.after,mountModule:this.mount}),exportCallBacks:new l.Z};this.runScene.exporter.gltf.module.bind(e)}}var h=r(453);class d{constructor(e){this.create=e=>{e.data.set("scene",this.getDiff())},this.set=e=>{const t=e.snapshot.data.get("scene");if(t){const{fog:c,bgc:d,env:p,bgcm:f,envS:m}=t,v=this.runScene.assetsEx.get().scene,{animas:g,completedCbs:y}=e.data;let b=v.background;if(this.runScene.sceneEx.setEnvStrength(void 0!==m?m:1),d){const{type:t,data:r}=d;if("color"===t)(0,a.isColor)(b)||null===b?(e=null===b?"#000000":(0,h.J6)(b),null===b&&this.runScene.sceneEx.setBackground(new i.Color("#000000")),e!==d.data&&g.push({target:v,label:"background",type:"color",isUpdate:!0,begin:e,end:r})):(0,u.isTexture)(b)&&y.push((()=>{this.runScene.sceneEx.setBackground(new i.Color(r))}));else if("texture"===t){const e=this.runScene.uniqueEx.texture.get(d.data);e&&(0,u.setTextureMapping)(e,303===f?"repeat":"normal"),y.push((()=>{this.runScene.sceneEx.setBackground(e)}))}}else(0,a.isColor)(b)&&(b||(b=new i.Color,this.runScene.sceneEx.setBackground(b)),g.push({target:v,label:"background",type:"color",isUpdate:!0,begin:(0,h.J6)(b),end:"#000000"})),y.push((()=>{this.runScene.sceneEx.setBackground(null)}));var r,n,s,o,l;y.push((()=>{v.environment=this.runScene.uniqueEx.texture.get(null==p?void 0:p.data)})),v.fog&&c?(({color:e,near:r,far:n}=c),({color:l,near:s,far:o}=v.fog),e!==(l=(0,h.J6)(l))&&g.push({target:v,label:["fog","color"],begin:l,end:e,type:"color",isUpdate:!0}),s!==r&&g.push({target:v,label:["fog","near"],begin:s,end:r,type:"number",isUpdate:!0}),o!==n&&g.push({target:v,label:["fog","far"],begin:o,end:n,type:"number",isUpdate:!0})):y.push((()=>{v.fog=c?w(c):null})),y.push((()=>{this.runScene.cb.setScene.cb({scene:this.runScene.assetsEx.get().scene,type:"any",val:"any"})}))}},this.runScene=e,this.runScene.cb.snapshot.create.add("scene",this.create),this.runScene.cb.snapshot.set.add("scene",this.set)}getDiff(){let e={};var t=((t=this.runScene.sceneEx.getJson("fog"))&&(e.fog=t),this.runScene.sceneEx.getJson("background")),r=this.runScene.assetsEx.scene;return void 0!==(t&&"texture"===(e.bgc=t).type&&303===r.background.mapping&&(e.bgcm=303),(t=this.runScene.sceneEx.getJson("environment"))&&(e.env=t),r=this.runScene.sceneEx.getEnvStrength())&&1!==r&&(e.envS=r),e}}var p=r(735),f=r(510),m=r(169),v=r(729),g=function(e,t,r,n){return new(r=r||Promise)((function(i,a){function s(e){try{l(n.next(e))}catch(e){a(e)}}function o(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(s,o)}l((n=n.apply(e,t||[])).next())}))};class y{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.envStrength=1,this.runScene=e,this.exportAndImport=new c(e),this.snapshot=new d(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,r)=>(e[t]=r,!0)})}getNromal(){return this.get().children.filter((e=>!this.runScene.helperEx.isHelper(e)))}getEnvStrength(){return this.envStrength}remove(e){if(e){if(e instanceof Array){const t=[];return e.map((e=>{for(const r in this.removeMap){const{valid:i,remove:a}=this.removeMap[r];if(i(e))return t.push(...(0,n.multiArrToArr)(a(e)))}t.push(new m.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 i.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){this.setBackground(null).then(),this.setEnv(null).then(),e.fog=null,this.runScene.cb.setScene.cb({scene:e,type:"any",val:null})}setBackground(e,t=!0){return g(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 f.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}dispose(){const{renderer:e,controls:t}=this.runScene.assetsEx.get();this.clean(),(0,o.s)(e),t.dispose(),this.runScene.pp.dispose(),i.Cache.clear()}render(){}create(){return new i.Scene}setEnv(e){return g(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 f.Z({target:e,info:r,oldVal:e[r],newVal:n,runScene:this.runScene}).execute(),t&&this.runScene.undoEx.addUndo(e)}setRealReflection(){const{scene:e,renderer:t}=this.runScene.assetsEx;this.cubeRT||(this.cubeRT=new i.WebGLCubeRenderTarget(1024)),this.realReflectionCamera||(this.realReflectionCamera=new i.CubeCamera(.1,5e3,this.cubeRT),e.add(this.realReflectionCamera),this.runScene.cb.render.add("RealReflection-update",(()=>{this.realReflectionCamera.update(t,e)}))),this.isRealReflection?(this.preEnvMap=e.environment,this.setEnv(null).then(),this.setNormal({model:e,info:"environment",val:this.cubeRT.texture})):this.preEnvMap&&this.setEnv(this.preEnvMap).then(),this.testSphere||(this.testSphere=new i.Mesh(new i.SphereGeometry(15,32,16),new i.MeshStandardMaterial),e.add(this.testSphere),this.testSphere.scale.set(10,10,10),this.testSphere.position.set(0,600,0),this.testSphere.getWorldPosition(this.realReflectionCamera.position),this.testSphere.material.roughness=0,this.testSphere.material.metalness=1)}setFogShow(e){var t=this.runScene.assetsEx.scene,{show:e,color:r}=e;if(e){let e=this.oldFog||new i.Fog(r||"#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:r,cb:n}=e;t=new p.Z({target:t,typeList:["fog",e],newVal:r,cb:n}).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;return this.runScene.pp.setSize(e,t),this.runScene.renderEx.setSize(e,t),this.runScene.pp.update(),e=a.toDataURL("image/png",1),t=(0,n.base64ToFile)(e,"screenShot.png"),this.runScene.pp.setSize(r,i),this.runScene.renderEx.setSize(),this.runScene.pp.update(),t}getJson(e){let t;var r=this.runScene.assetsEx.scene;if("fog"===e){var n=r.fog;n&&(t=x(n,null!==r.fog))}else if("background"===e){if(!r.background)return;t={type:(n=(0,a.isColor)(r.background))?"color":"texture",data:(n?h.J6:v.Ki)(r.background)}}else if("environment"===e){if(!r.environment)return;t={type:"texture",data:(0,v.Ki)(r.environment)}}return t}static toJSON(e,t){const r={};let n=!1,i=e.fog;return i?n=!0:i=t.sceneEx.oldFog,i&&(r.fog=x(i,n)),(0,a.isColor)(e.background)&&(r.backgroundColor=e.background.getHexString()),r}setEnvStrength(e){this.runScene.cb.scene.setEnvStrength.cb({val:e}),this.runScene.uniqueEx.material.each((t=>this.runScene.materialEx.setEnvStrength(t,e))),this.envStrength=e}}const b=(e,t,r)=>{e.userData[t]=r},x=(e,t)=>{var{color:e,far:r,near:n}=e;return{color:(0,h.J6)(e),show:t,far:r,near:n}},w=e=>{var{color:e,far:t,near:r}=e;return new i.Fog(e,r,t)},S=(e,t)=>(null==(e=null==e?void 0:e.userData)?void 0:e[t])||"",A=(e,t)=>{delete e.userData[t]}},398:(e,t,r)=>{r.d(t,{LV:()=>p,ZP:()=>d});var n=r(1),i=r(263),a=r(794),s=r(201),o=r(625),l=r(729),u=r(457),c=r(453);const h=["number","color","color_obj","color_str","v2","v3"];class d{constructor(e){this.map=new a.Z,this.playing={data:void 0,animaIns:void 0},this.unique={set:()=>{},get:()=>{}},this.toJSON=()=>JSON.stringify(this.map.toJSON()),this.parseJSON=e=>{const t=a.Z.formJSON(JSON.parse(e));t.map(((e,t)=>{t.data=a.Z.formJSON(t.data)})),this.map=t},this.clean=()=>{this.map.clear()},this.trans={set:(e,t)=>{var r,n,i,a,s,o=e.label instanceof Array?e.label.join("."):e.label;const l={begin:[],end:[]};return"color"===e.type||"color_obj"===e.type||"color_str"===e.type?(i=(0,c.sS)(e.begin),r=(0,c.sS)(e.end),a=o+"_"+t+"_r",s=o+"_"+t+"_g",n=o+"_"+t+"_b",l.begin.push({type:a,data:i.r}),l.begin.push({type:s,data:i.g}),l.begin.push({type:n,data:i.b}),l.end.push({type:a,data:r.r}),l.end.push({type:s,data:r.g}),l.end.push({type:n,data:r.b})):"number"===e.type?(l.begin.push({type:o+"_"+t,data:e.begin}),l.end.push({type:o+"_"+t,data:e.end})):"v2"!==e.type&&"v3"!==e.type||(i=o+"_"+t+"_x",a=o+"_"+t+"_y",s=o+"_"+t+"_z",l.begin.push({type:i,data:e.begin.x}),l.begin.push({type:a,data:e.begin.y}),"v3"===e.type&&(l.begin.push({type:s,data:e.begin.z}),l.end.push({type:s,data:e.end.z})),l.end.push({type:i,data:e.end.x}),l.end.push({type:a,data:e.end.y})),l},getKey(e){let t=[];var{unique:r,type:n}=e;return e=e.label instanceof Array?e.label.join("."):e.label,"v2"===n||"v3"===n?(t.push(e+"_"+r+"_x"),t.push(e+"_"+r+"_y"),t.push(e+"_"+r+"_z")):"color"===n||"color_obj"===n||"color_str"===n?(t.push(e+"_"+r+"_r"),t.push(e+"_"+r+"_g"),t.push(e+"_"+r+"_b")):"number"===n&&t.push(e+"_"+r),t},update:(e,t)=>{var r;const i=this.trans.getKey(e);let a=e.target,s=e.label,o=(e.label instanceof Array&&(s=(0,n.lastArrayEle)(e.label),a=(0,n.objLastMap)(e.target,e.label)),t[i[0]]),l=s;"color"===e.type||"color_obj"===e.type?(o={r:0,g:0,b:0},i.map((e=>{var[,,r]=e.split("_");e=t[e]/255,o[r]=e}))):"color_str"===e.type?o="#"+i.map((e=>Number(Number(t[e]).toFixed(0)).toString(16).padStart(2,"0"))).join(""):"v2"!==e.type&&"v3"!==e.type||(o={x:0,y:0,z:0},i.map((e=>{var[,,r]=e.split("_");o[r]=t[e]}))),null!=(r=e.onUpdate)&&r.call(e,{target:a,data:o,type:l,runScene:this.runScene})},exec:(e,t)=>{const r=this.trans.getKey(e);let i=e.target,a=e.label;e.label instanceof Array&&(a=(0,n.lastArrayEle)(e.label),i=(0,n.objLastMap)(e.target,e.label)),"color"===e.type||"color_str"===e.type||"color_obj"===e.type?r.map((e=>{var[,,r]=e.split("_");e=1<t[e]?t[e]/255:t[e],i[a][r]=e})):"number"===e.type?i[a]=t[r[0]]:"v2"!==e.type&&"v3"!==e.type||r.map((e=>{var[,,r]=e.split("_");i[a][r]=t[e]}))}},this.runScene=e}init(){this.runScene.exporter.gltf.options.addOption({type:"snapshot",process:this.toJSON,parse:this.parseJSON}),this.runScene.cb.clean.add("snapshrot",this.clean)}create(e){var{name:e,time:t}=e;return e={name:e,time:t,data:new a.Z},this.runScene.cb.snapshot.create.cb(e),e}add(e){var t=this.create(e);return this.map.set(e.name,t),t}set(e,t){if(this.runScene.modelEx.selectNull(),e=this.map.get(e),t=Object.assign({animaTime:-1},t).animaTime,e){const r={animas:[],completedCbs:[]};this.runScene.cb.snapshot.set.cb({snapshot:e,data:r}),0===r.animas.length?0!==r.completedCbs.length&&r.completedCbs.map((e=>e())):this.anima(r,{animaTime:-1===t?e.time:t})}}del(e){this.map.delete(e)}anima(e,t){if(this.runScene.modelEx.selectNull(),!this.playing.animaIns){const r=new a.Z,i={},s={};t=t.animaTime,this.playing.data=e,this.playing.data.animas.map(((e,t)=>{t=String(t);const{begin:n,end:a}=this.trans.set(e,t);n.map((e=>i[e.type]=e.data)),a.map((e=>s[e.type]=e.data)),r.set(t,Object.assign({unique:t},e))})),this.playing.animaIns=(0,u.anima)(i,s,t,(e=>{(0,n.mapObj)(e,(t=>{var[,t]=t.split("_");(t=r.get(t))&&(t.isUpdate?this.trans.exec(t,e):this.trans.update(t,e))}))}),(()=>{this.playing.animaIns.kill(),this.playing.animaIns=null,this.playing.data.completedCbs.map((e=>e()))}))}}parseNromal(e,t){const{animas:r,completedCbs:i}=t.data,{target:a,type:s,begin:o,end:l,set:c,label:d,onUpdate:p}=e;if((0,u.isDef)(o,l))if(h.includes(s))r.push({target:a,type:s,begin:o,end:l,label:d,isUpdate:void 0===p,onUpdate:p});else if(c)c({target:a,begin:o,end:l});else{let e=a,t=d;d instanceof Array&&(e=(0,n.objLastMap)(a,d),t=(0,n.lastArrayEle)(d)),"texture"===s?e[t]=l:i.push((()=>{e[t]=l}))}}bind(e){const{name:t,def:r,target:n,create:i,set:a}=e;this.runScene.cb.snapshot.create.add(t,i||(e=>{e.data.set(t,p.getDiff(r,n))})),this.runScene.cb.snapshot.set.add(t,a||(e=>{var i=e.snapshot.data.get(t);i&&p.set({def:r,runScene:this.runScene,data:i,target:n,map:e})}))}}const p={toNormal(e){var t,{type:e,val:r}=e;let n=r;return"color"===e?n=(0,c.Lv)(r):"color_obj"===e?n=r:"color_str"===e?n=(0,u.MyHextoRgb)(r,!0):"texture"===e?(0,o.isTexture)(r)&&(n=(0,l.Ki)(r)):"v3"!==e&&"v2"!==e||(({x:e,y:r,z:t}=r),n={x:e,y:r,z:t}),n},parse(e){const{type:t,val:r,runScene:n}=e;let a=r;return"color"===t?a=i.YD.is(r)?r:(0,u.HextoRgb)(r,!0):"color_obj"===t?a=r:"color_str"===t&&(a=i.YD.is(r)?r:(0,u.HextoRgb)(r,!0)),"texture"===t&&null!==r?n.uniqueEx.texture.get(r):a},getDiff(e,t){let r={};return(0,n.mapObj)(e,((e,i)=>{const{label:a,get:s}=i;let o=t[e];s?o=s(t):a&&(o=(0,n.objLastMap)(t,a)[(0,n.lastArrayEle)(a)]),r[e]=o})),(0,s.replaceKVForObj)((0,u.getDiff)((0,s.replaceValForObj)(e,((e,t)=>t.val)),r),((t,r)=>{var{shortKey:t,type:n}=e[t];return{k:t,v:p.toNormal({type:n,val:r})}}))},set(e){const{def:t,data:r,target:i,runScene:a,map:s}=e;(0,n.mapObj)(t,((e,t)=>{const{type:o,val:l,shortKey:c,before:h,label:d,onUpdate:f,get:m,set:v}=t;let g=i,y=e;d&&(g=(0,n.objLastMap)(i,d),y=(0,n.lastArrayEle)(d)),t=p.toNormal({type:o,val:m?m(g):g[y]}),e=p.parse({type:o,val:void 0!==r[c]?r[c]:l,runScene:a}),(0,u.isDef)(t,e)&&(null!=h&&h({target:g,begin:t,end:e}),a.snapshot.parseNromal({target:g,label:y,type:o,set:v,begin:t,end:e,onUpdate:f},s))}))}}},625:(e,t,r)=>{r.r(t),r.d(t,{bindTextureBaseData:()=>A,default:()=>y,disposeTexture:()=>S,getBlobByTexture:()=>M,getCloneIdFromTexture:()=>R,getMimeByTexture:()=>x,getSizeByTexture:()=>D,getTextureGpuMemory:()=>w,getTextureMinFilter:()=>F,getUrlByTexture:()=>T,initTexture:()=>B,isClonedTexture:()=>O,isTexture:()=>P,loadTexture:()=>E,parseImageBitMapByBlob:()=>C,setTextureCloneId:()=>I,setTextureMapping:()=>_,setTextureMinFilter:()=>L,textureNameMap:()=>b,unDelAbleTexture:()=>G,updateTexture:()=>k});var n=r(1),i=r(881),a=r(247),s=r(24),o=r(457),l=r(729),u=r(510);class c extends r(616).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 h=c;var d=r(932),p=r(398);const f={repeat:{type:"v2",val:{x:1,y:1},shortKey:"re"},offset:{type:"v2",val:{x:0,y:0},shortKey:"of"},rotation:{type:"number",val:0,shortKey:"ro"},center:{type:"v2",val:{x:0,y:0},shortKey:"ce"}};class m{constructor(e){this.getDiff=()=>{let e={};return this.runScene.uniqueEx.texture.getAll().map((({texture:t})=>{var r=(0,l.Ki)(t);r&&(e[r]=p.LV.getDiff(f,t),(t=this.runScene.script.texture.get(t))&&(e[r].uvScript=Object.assign({},t)))})),e},this.create=e=>{e.data.set("texture",this.getDiff())},this.set=e=>{var t=e.snapshot.data.get("texture");t&&(0,n.mapObj)(t,((t,r)=>{(t=this.runScene.uniqueEx.texture.get(t))&&(p.LV.set({def:f,data:r,runScene:this.runScene,map:e,target:t}),this.runScene.script.texture.parse(r.uvScript,t),this.runScene.script.texture.set(r.uvScript,t))}))},this.runScene=e,this.runScene.cb.snapshot.create.add("texture",this.create),this.runScene.cb.snapshot.set.add("texture",this.set)}}var v=r(736),g=function(e,t,r,n){return new(r=r||Promise)((function(i,a){function s(e){try{l(n.next(e))}catch(e){a(e)}}function o(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(s,o)}l((n=n.apply(e,t||[])).next())}))};class y{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,this.snapshot=new m(e)}load(e,t){return g(this,void 0,void 0,(function*(){var r=yield(0,o.urlToBlob)(e);return this.parse(r,t)}))}parse(e,t){return g(this,void 0,void 0,(function*(){t=(0,o.mergeObject)({flipY:!0},t);var r="Blob"===(0,o.getType)(e)?e:yield(0,o.fileToBlob)(e);return this.afterLoad(yield E(r,t),r)}))}clone(e){const t=new i.Texture(e.image);return t.userData=Object.assign(Object.assign({},e.userData),{id:(0,n.getId)(),cloneSourceId:(0,l.Ki)(e)}),(0,v.bv)(t,"minFilter"),A(t),this.getSameAndAddtoAll(t)}getDef(e){return e=new i.Texture(e),A(e),this.getSameAndAddtoAll(e)}getSameAndAddtoAll(e){var t=e.userData.md5;return(t=this.getSameTexture(t,e))?(S(e),t):(this.initTextureAndAddtoAll(e),e)}afterLoad(e,t){return g(this,void 0,void 0,(function*(){return this.getSameAndAddtoAll(yield A(e,t))}))}getSameTexture(e,t){if(!O(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 g(this,void 0,void 0,(function*(){return B(e),A(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,o.imgBitMapToBlobAndBase64)(e)}coverByImage(e,t){return g(this,void 0,void 0,(function*(){let r;r=P(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.mapObj)(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,l.Ki)(e);var r=this.runScene.uniqueEx.texture.map[t];if(r){const i=[];r=r.materialMap,(0,n.mapObj)(r,((e,t)=>{const r=this.runScene.uniqueEx.material.get(e);r&&(t.forEach((e=>{i.push(new u.Z({target:r,info:e,oldVal:r[e],newVal:null,runScene:this.runScene,cb(){(0,d.updateMaterial)(r)}}).execute())})),(0,d.updateMaterial)(r))}));const a=this.runScene.uniqueEx.texture.map[t];i.push(new h({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 h({undo:()=>{this.runScene.uniqueEx.texture.map[t]=a},redo:()=>{delete this.runScene.uniqueEx.texture.map[t]}}).execute()),this.runScene.undoEx.addUndo(i)}}delete(e){this.runScene.cb.texture.remove.cb(e),this.runScene.uniqueEx.texture.remove(e),S(e)}reverseImageBitMapTexture(e){return g(this,void 0,void 0,(function*(){var{canvas:t,imageBitMap:r}=yield(0,o.reverseImageBitMap)(e.image);const a=new i.Texture(r);return a.needsUpdate=!0,r=this.runScene.uniqueEx.texture.map[e.userData.id],(0,n.mapObj)(r.materialMap,((e,t)=>{const r=this.runScene.uniqueEx.material.get(e);t.forEach((e=>{r[e]=a,this.runScene.uniqueEx.texture.addMaterial(a,{material:r,type:e})}))})),B(a),yield A(a),this.runScene.cb.texture.add.cb(a),this.delete(e),(0,o.disposeCanvas)(t),a}))}setUnDelAble(e,t){G.set(e,t),this.runScene.cb.texture.set.cb({type:"unDelAble",texture:e,data:t})}}const b={环境遮蔽:"aoMap",法线:"normalMap",金属度:"metalnessMap",粗糙度:"roughnessMap",自发光:"emissiveMap",颜色:"map",置换:"displacementMap",光照贴图:"lightMap",环境:"envMap",透明度:"alphaMap"},x=e=>1023===e.format?"image/png":"image/jpeg",w=e=>{var{width:e,height:t}=e.image;return e*t*4*1.33},S=e=>{var t,r;e&&(t=e.image,r=e.userData.url,t instanceof ImageBitmap?(0,o.disposeImageBitMap)(t):t instanceof HTMLCanvasElement&&(0,o.disposeCanvas)(t),URL.revokeObjectURL(r),e.dispose())},A=(e,t)=>g(void 0,void 0,void 0,(function*(){var r=(0,o.isBlob)(e.userData.blob)?e.userData.blob:null;const n=t||r||(yield M(e));e.userData.blob=n;var{md5:r,url:i}=e.userData;return r||(e.userData.md5=(0,o.getMd5)(yield n.arrayBuffer())),i||(e.userData.url=URL.createObjectURL(n)),e.userData.gm=w(e),e.format=e.userData.format||-1!==n.type.indexOf("png")?1023:1022,e})),M=e=>(0,o.isBlob)(e.userData.blob)?e.userData.blob:(0,o.imgBitMapToBlob)(e.image),B=e=>(e.magFilter=1003,e.wrapS=a.Z.RepeatWrapping,e.wrapT=a.Z.RepeatWrapping,e.encoding=3e3,e.version=3,e.flipY=!1,"nearest"!==F(e)&&(e.minFilter=a.Z.LinearMipmapLinearFilter),e.needsUpdate=!0,e),C=(e,t)=>{let r={resizeQuality:"pixelated"};return null!=t&&t.flipY&&(r.imageOrientation="flipY"),createImageBitmap(e,r)},E=(e,t)=>g(void 0,void 0,void 0,(function*(){var r=yield C(e instanceof Blob?e:yield(0,o.urlToBlob)(e),t);return new i.Texture(r)})),T=e=>null==(e=e.userData)?void 0:e.url,_=(e,t="repeat")=>(e.mapping="repeat"===t?a.Z.EquirectangularReflectionMapping:300,e.needsUpdate=!0,e),D=e=>{var{width:e,height:t}=e.image;return{width:e,height:t}},P=e=>null==e?void 0:e.isTexture,O=e=>0<(null==(e=e.userData.cloneSourceId)?void 0:e.length),R=e=>e.userData.cloneSourceId,I=(e,t)=>{e.userData.cloneSourceId=t},k=e=>{e.needsUpdate=!0},L=(e,t)=>{e.minFilter=a.Z["linear"===t?"LinearMipmapLinearFilter":"NearestFilter"],(0,v.M)(e,"minFilter",t),k(e)},F=e=>(0,v.is)(e,"minFilter"),U="unDelAble",G={is:e=>(0,v.is)(e,U),set(e,t){t?(0,v.M)(e,U,t):delete e.userData[U]}}},651:(e,t,r)=>{r.d(t,{ZP:()=>n,d9:()=>i});class n{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,r,n=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(r=i(e[t]),n[t]=r);return n}}},773:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(269);class i{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:i,isClone:a,runScene:s}=e;r.add(t),i&&s.uniqueEx.model.add(t),i&&s.cb.model.add.cb({model:t,parent:r,isClone:a}),this.cb(t,"add"),s.uniqueEx.material.addModel(t,t.material),(0,n.RQ)(t)&&setTimeout((()=>{this.runScene.lightEx.update(t)}))}}},616:(e,t,r)=>{r.d(t,{Z:()=>n});class n{}},24:(e,t,r)=>{r.d(t,{Z:()=>a});var n=r(330);class i extends r(616).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},735:(e,t,r)=>{r.d(t,{Z:()=>a});var n=r(1);class i extends r(616).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,n.objLastMap)(e.target,this.typeList)[(0,n.lastArrayEle)(e.typeList)]}execute(){return this.redo(),this}_execute(e){const t=(0,n.objLastMap)(this.target,this.typeList);t[(0,n.lastArrayEle)(this.typeList)]=e,this.cb&&this.cb(t),"shadow"!==this.typeList[0]&&this.typeList[1]}undo(){this._execute(this.old)}redo(){this._execute(this.new)}}const a=i},510:(e,t,r)=>{r.d(t,{Z:()=>i});class n extends r(616).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:s}=e;this.runScene=i,this.target=e,this.info=t,this.newVal=n,this.oldVal=r,a&&(this.cb=a),s&&(this.executeCb=s)}_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},169:(e,t,r)=>{r.d(t,{Z:()=>n});class n extends r(773).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}}},380:(e,t,r)=>{r.d(t,{Z:()=>i});class n extends r(616).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},729:(e,t,r)=>{r.d(t,{ZP:()=>d,Ki:()=>p,x:()=>f});var n=r(1),i=r(272),a=r(932);class s{constructor(e){this.map={},this.removes=[],this.unique=e}add(e,t,r){if(null!=e&&e.userData&&!a.materialIgnore.is(e)){let a=e.userData.id;if(a||(a=(0,n.getId)(),e.userData.id=a),this.map[a]){if(this.map[a].material.name!==e.name){const t=(0,n.getId)();e.userData.id=t,this.map[t]={material:e,models:new i.Z},this.unique.runScene.cb.unique.material.add.cb(e)}}else this.map[a]={material:e,models:new i.Z},this.unique.runScene.cb.unique.material.add.cb(e);t&&this.addModel(t,e,r)}}addModel(e,t,r){r&&t&&p(r)===p(t)||(null!=t&&t.userData&&(t=p(t),null!=(t=this.map[t])&&t.models.add(e)),r&&null!=(t=this.map[p(r)])&&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,n.mapObj)(this.map,((e,t)=>{t.material.dispose()})),this.map={}}}var o=r(269),l=r(749),u=r(158);class c 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,n.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),n.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)),i=["PerspectiveCamera"];return n=>{if(i.includes(n.type))return n.name=n.type;let a=n.name;if(a=a||n.type,!this.nameMap[a])return s=this.unique.getId(n),(o=r(s))&&delete this.nameMap[o],void(this.nameMap[a]=s);var s,o=this.nameMap[a];return this.unique.model.get(o)!==n?(s=e(a),s=t(a,o=-1===s?0:s),this.nameMap[s]=this.unique.getId(n),n.name=s):void 0}})()}add(e,t){var{reset:r,hasReset:i}=t||{ignoreMaterial:!1};if(e instanceof Array)return e.map((e=>this.add(e,t)));if(e&&!(0,l.isHelper)(e)){let a=e.userData.id;if(a&&!r||(a=(0,n.getId)(),e.userData.id=a),this.map[a]){if(!(i||(0,u.An)(this.unique.runScene)&&(0,u.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,n.getId)(),e.userData.id=a}return this.map[a]=e,this.parseName(e),e.material&&(this.unique.runScene.materialEx.parse(e.material),this.unique.material.add(e.material,e)),!e.children.length||(0,o.RQ)(e)||(0,l.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 r=t.toLowerCase();return r===(t=e.toLowerCase())||-1!==r.indexOf(t)}));return t=this.getIdByNames(t),this.getModelsWithIds(t)}}class h{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,n.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,i=e.userData.id||this.add(e);t&&(({material:t,type:n}=t),this.map[i]||(this.map[i]={materialMap:{},texture:e}),this.map[i].materialMap[t.userData.id]||(this.map[i].materialMap[t.userData.id]=new Set),this.map[i].materialMap[t.userData.id].add(n)),r&&(({material:e,type:t}=r),this.map[i].materialMap[e.userData.id]&&this.map[i].materialMap[e.userData.id].delete(t))}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.mapObj)(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.mapObj)(this.map,((e,t)=>{t.texture.dispose()})),this.map={}}getAll(){return Object.values(this.map)}}class d{constructor(e){this.clean=()=>{this.dispose()},this.runScene=e,this.model=new c(this),this.material=new s(this),this.texture=new h(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 p=e=>(null==(e=null==e?void 0:e.userData)?void 0:e.id)||"",f=(e,t)=>{e.userData&&(e.userData.id=t)}},457:(e,t,r)=>{r.r(t),r.d(t,{HextoRgb:()=>i.I8,LimitCb:()=>i.cM,MyHextoRgb:()=>i.Dn,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,colorToRgb:()=>a.sS,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,getColorByHex:()=>a.e9,getCurve:()=>a.kG,getDiff:()=>i.ad,getDistance:()=>a.Sp,getEmptyImageData:()=>n.mH,getFilesByDataTransfer:()=>i.xl,getFilesFromFileList:()=>i.kk,getHexByColor:()=>a.J6,getIdxInParent:()=>o,getImg:()=>n.Pk,getImgPixels:()=>n.BW,getImgPixels1:()=>n.Cm,getLine2:()=>a.SI,getMacro:()=>i.Ls,getMapByRgb:()=>i.fh,getMd5:()=>i.ZM,getModelMap:()=>a.yT,getNamesByNum:()=>i.nR,getOptions:()=>s.FW,getProgress:()=>i.xC,getRGBByHex:()=>a.OR,getRandomColor:()=>i.mr,getRes:()=>i.sR,getResultFromCanvas:()=>n.xK,getTime:()=>i.hK,getTruthBase64:()=>i.Mh,getType:()=>i.oL,getTypeByBase64:()=>i.Op,getTypeFromGlb:()=>s.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,isDef:()=>i.Xq,isEditor:()=>s.hz,isEmpty:()=>i.xb,isRunning:()=>s.An,longestCommonPrefix:()=>i.GG,mergeObject:()=>i.Gm,removeUnLess:()=>a.hs,reverseImageBitMap:()=>n.Fs,reverseImg:()=>n.rx,rgbToHex:()=>a.vq,rgbToHsl:()=>n.lC,rgbToStr:()=>a.$W,rgbaToRgb:()=>a.Di,rmArrEle:()=>i.J9,rmPartOfString:()=>i.h3,sameArr:()=>i.F1,sameV3:()=>a.x$,strToNum:()=>i.LC,tColorToRgb:()=>a.Lv,textureToThreeD:()=>a.vp,toCode:()=>i.Ni,toTimeString:()=>i.U9,transByte:()=>i.iM,typeAnima:()=>c,urlToBlob:()=>i.pX,urlToCanvas:()=>i.o4,validType:()=>i.lG,vector:()=>a.xr});var n=r(137),i=r(723),a=r(453),s=r(158);const o=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)};var u=r(881);const c=(e,t,r)=>{const{}=r||{},n={},a={};e.map(((e,t)=>{const{begin:r,end:s,type:o,label:l}=e,c="_"+o+"_"+l+"_"+String(t);if("color"===o&&r instanceof u.Color&&s instanceof u.Color){const e=(0,i.I8)("#"+r.getHexString(),!0),t=(0,i.I8)("#"+s.getHexString(),!0);["r","g","b"].map((r=>{var i=r+c;n[i]=e[r],a[i]=t[r]}))}"number"===o&&(n[e=l+c]=r,a[e]=s),"vector3"===o&&["x","y","z"].map((e=>{var t=e+c;n[t]=r[e],a[t]=s[e]})),"vector2"===o&&["x","y"].map((e=>{var t=e+c;n[t]=r[e],a[t]=s[e]}))}))};c([{begin:new u.Color(.5,.5,.5),end:new u.Color(0,0,0),label:"color",type:"color"},{begin:1,end:2,label:"a",type:"number"},{begin:new u.Vector3(1,1,1),end:new u.Vector3(2,2,2),label:"b",type:"vector3"},{begin:new u.Vector2(1,1),end:new u.Vector2(2,2),label:"c",type:"vector2"}],1)},137:(e,t,r)=>{r.d(t,{BW:()=>f,Cm:()=>p,Fs:()=>x,Pk:()=>y,Rd:()=>m,eZ:()=>w,gW:()=>l,jH:()=>d,lC:()=>v,lU:()=>h,mH:()=>A,oZ:()=>S,rx:()=>u,s4:()=>o,v1:()=>c,ve:()=>g,xK:()=>b});var n=r(247),i=r(625),a=r(723),s=function(e,t,r,n){return new(r=r||Promise)((function(i,a){function s(e){try{l(n.next(e))}catch(e){a(e)}}function o(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(s,o)}l((n=n.apply(e,t||[])).next())}))};const o=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=>s(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=>s(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=>s(void 0,void 0,void 0,(function*(){var{bitmap:t,texture:r}=e;const{ctx:i,canvas:s}=yield(0,a.OE)(URL.createObjectURL(r.userData.blob),{width:t.width,height:t.height});for(var o=i.getImageData(0,0,t.width,t.height,{colorSpace:"srgb"}),l=0,u=o.data.length;l<u;l+=4){var c=(d=v(o.data[l],o.data[l+1],o.data[l+2]))[0]/100,h=d[1]/100,d=d[2]/100;c=g(c,h,d),o.data[l]=c[0],o.data[l+1]=c[1],o.data[l+2]=c[2]}return i.putImageData(o,0,0),new n.Z.Texture(s)})),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),s=(i+a)/2;if(i==a)n=l=0;else{var o=i-a,l=.5<s?o/(2-i-a):o/(i+a);switch(i){case e:n=(t-r)/o+(t<r?6:0);break;case t:n=(r-e)/o+2;break;case r:n=(e-t)/o+4}n/=6}return[100*n,100*l,100*s]},g=(e,t,r)=>{var n,i,a,s;return 0==t?i=a=s=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),s=n(t,r,e-1/3)),[255*i,255*a,255*s]},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=>s(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()},S=e=>{e.close()},A=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}},723:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{B1:()=>getArrIndexByItem,Dn:()=>MyHextoRgb,F1:()=>sameArr,GG:()=>longestCommonPrefix,Gm:()=>mergeObject,I8:()=>HextoRgb,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,ad:()=>getDiff,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__(129),_allex_md5__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(_allex_md5__WEBPACK_IMPORTED_MODULE_0__),axios__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(300),axios__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(axios__WEBPACK_IMPORTED_MODULE_1__),js_funcs__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(1),js_funcs__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__.n(js_funcs__WEBPACK_IMPORTED_MODULE_2__),_libs_Anima__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(958),_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(263),_UtilsImage__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(137),__awaiter=function(e,t,r,n){return new(r=r||Promise)((function(i,a){function s(e){try{l(n.next(e))}catch(e){a(e)}}function o(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(s,o)}l((n=n.apply(e,t||[])).next())}))};const anima=(e,t,r,n,i)=>{let a=Object.assign({},e),s=new _libs_Anima__WEBPACK_IMPORTED_MODULE_3__.Q3(a,r,t).eventCallback("onUpdate",(e=>n&&n(a))).eventCallback("onComplete",(e=>{i&&i(),_libs_Anima__WEBPACK_IMPORTED_MODULE_3__.Q3.killTweensOf(s)}));return s},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__WEBPACK_IMPORTED_MODULE_2__.parseFile)(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=>null==e?void 0:e.toString().replace(/(\[object )([a-zA-Z]+)(])/,"$2"),deepMergeObject=(e,t)=>((0,js_funcs__WEBPACK_IMPORTED_MODULE_2__.mapObj)(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="",s=0;s<e.length;s++)a+=i[((r=((r=e.charCodeAt(s))-(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 s=Math.floor(a/r);for(const n of new Array(r).fill("").map(((e,t)=>(t+1)*s)))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},isDef=(e,t)=>e instanceof Array?_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__.F6.isDef(e,t):_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__.YD.is(e)?_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__.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 r={r:0,g:0,b:0};for(let e=0;e<rgbArr.length;e++){var n=rgbArr[e],i=t[e];if(!i)return;i=strToNum(i),r[n]=i}return r};function HextoRgb(e,t){if(-1!==e.toLocaleLowerCase().indexOf("rgb"))return e;if(/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(e)){if(4===e.length){for(var r="#",n=1;n<4;n+=1)r+=e.slice(n,n+1).concat(e.slice(n,n+1));e=r}var i,a,s=[];for(n=1;n<7;n+=2)s.push(parseInt("0x"+e.slice(n,n+2)));return t?([t,i,a]=s,{r:t,g:i,b:a}):"RGB("+s.join(",")+")"}return e}const getDiff=(e,t,r=0)=>{const n={};return(0,js_funcs__WEBPACK_IMPORTED_MODULE_2__.mapObj)(e,((e,r)=>{var i=t[e];isDef(r,i)&&(n[e]=i)})),n};function MyHextoRgb(e,t){if(-1!==(e=e.toLocaleLowerCase().slice(1)).indexOf("rgb"))return e;var[e,r,n,i,a,s]=e.split(""),r=(e=parseInt("0x"+e+r),parseInt("0x"+n+i)),n=parseInt("0x"+a+s);return t?{r:e,g:r,b:n}:"RGB("+e+","+r+","+n+")"}},158:(e,t,r)=>{r.d(t,{An:()=>a,FW:()=>s,hz:()=>i,te:()=>n});const n=e=>{},i=e=>"editor"===e.optionsEx.options.mode,a=e=>"running"===e.optionsEx.options.mode,s=e=>e.optionsEx.options},453:(e,t,r)=>{r.d(t,{Zv:()=>de,F:()=>ce,Hg:()=>ie,Z7:()=>ae,sS:()=>Ae,UZ:()=>re,YG:()=>ne,ol:()=>te,A2:()=>me,Gm:()=>fe,aM:()=>ve,e9:()=>ge,kG:()=>ue,Sp:()=>ee,J6:()=>ye,SI:()=>he,yT:()=>pe,OR:()=>be,hX:()=>le,VU:()=>q,hs:()=>oe,vq:()=>Be,$W:()=>we,Di:()=>Me,x$:()=>xe,Lv:()=>Se,vp:()=>se,xr:()=>$});var n=r(881);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 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=o(e);if(r=t?(r=o(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 o(e){return(o=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=s(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,s=e.count;a<s;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,S,A=new n.Vector3,M=new n.Vector3,B=new n.Vector4,C=new n.Vector4,E=new n.Vector4,T=new n.Vector3,_=new n.Matrix4,D=new n.Line3,P=new n.Vector3,O=new n.Box3,R=new n.Sphere,I=new n.Vector4;function k(e,t,r){return I.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),I.multiplyScalar(1/I.w),I.x=S/r.width,I.y=S/r.height,I.applyMatrix4(e.projectionMatrixInverse),I.multiplyScalar(1/I.w),Math.abs(Math.max(I.x,I.y))}var L=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&g(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=y(e);if(r=t?(r=y(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===v(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new c,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new m({color:16777215*Math.random()}),n=this,a=i;if(n instanceof a)return(n=r.call(this,e,t)).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,s=0,o=t.count;a<o;a++,s+=2)A.fromBufferAttribute(t,a),M.fromBufferAttribute(r,a),i[s]=0===s?0:i[s-1],i[s+1]=i[s]+A.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),s=(b=e.ray,e=this.matrixWorld,this.geometry),o=this.material;if(S=o.linewidth+a,x=s.attributes.instanceStart,w=s.attributes.instanceEnd,null===s.boundingSphere&&s.computeBoundingSphere(),R.copy(s.boundingSphere).applyMatrix4(e),a=r?.5*S:k(i,Math.max(i.near,R.distanceToPoint(b.origin)),o.resolution),R.radius+=a,!1!==b.intersectsSphere(R)&&(null===s.boundingBox&&s.computeBoundingBox(),O.copy(s.boundingBox).applyMatrix4(e),a=r?.5*S:k(i,Math.max(i.near,O.distanceToPoint(b.origin)),o.resolution),O.expandByScalar(a),!1!==b.intersectsBox(O)))if(r)for(var l=t,u=0,c=x.count;u<c;u++){D.start.fromBufferAttribute(x,u),D.end.fromBufferAttribute(w,u);var h=new n.Vector3,d=new n.Vector3;b.distanceSqToSegment(D.start,D.end,d,h),d.distanceTo(h)<.5*S&&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=(s=i).projectionMatrix,v=p.material.resolution,g=p.matrixWorld,y=(e=p.geometry).attributes.instanceStart,A=e.attributes.instanceEnd,M=-s.near;b.at(1,E),E.w=1,E.applyMatrix4(s.matrixWorldInverse),E.applyMatrix4(m),E.multiplyScalar(1/E.w),E.x*=v.x/2,E.y*=v.y/2,E.z=0,T.copy(E),_.multiplyMatrices(s.matrixWorldInverse,g);for(var I,L,F,U,G=0,N=y.count;G<N;G++)B.fromBufferAttribute(y,G),C.fromBufferAttribute(A,G),B.w=1,C.w=1,B.applyMatrix4(_),C.applyMatrix4(_),B.z>M&&C.z>M||(B.z>M?(I=B.z-C.z,I=(B.z-M)/I,B.lerp(C,I)):C.z>M&&(I=C.z-B.z,L=(C.z-M)/I,C.lerp(B,L)),B.applyMatrix4(m),C.applyMatrix4(m),B.multiplyScalar(1/B.w),C.multiplyScalar(1/C.w),B.x*=v.x/2,B.y*=v.y/2,C.x*=v.x/2,C.y*=v.y/2,D.start.copy(B),D.start.z=0,D.end.copy(C),D.end.z=0,L=D.closestPointToPointParameter(T,!0),D.at(L,P),F=-1<=(F=n.MathUtils.lerp(B.z,C.z,L))&&F<=1,U=T.distanceTo(P)<.5*S,F&&U&&(D.start.fromBufferAttribute(y,G),D.end.fromBufferAttribute(A,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=N(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 N(e){return(N=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}L.prototype.isLineSegments2=!0;var j=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=N(e);if(r=t?(r=N(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(N(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(N(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 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 H(e,t){return(H=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)}j.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&&H(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"===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")}}(n);function n(){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=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(693),W=r(263),X=r(247),Q=r(932),Y=r(723);const q=(e,t)=>(t.updateMatrixWorld(!0),t=new X.Z.Vector3,e.getWorldPosition(t),t),$={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}}},ee=(e,t)=>e.distanceTo(t),te=e=>new Z.cp(e),re=e=>new K.j(e),ne=e=>new Z.P7(e),ie=(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)},ae=(e,t,r)=>{"Group"===e.type||"Object3D"===e.type?e.children.forEach((e=>ae(e,t,r))):ie(e,t,r)},se=e=>(e.mapping=n.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)},le=(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)},ue=(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}},ce=e=>{let t=0;const r=[],i={},a={0:"x",1:"y",2:"z"};return e.map((e=>{var s,o,l;3===t&&(t=0,({x:s,y:o,z:l}=i),r.push(new n.Vector3(s,o,l))),i[a[t]]=e,t++})),r},he=e=>{var{pointArray:e,material:t,lineWidth:r,colorArray:i}=e;const a=new j,s=(a.setPositions(e),t||new m({transparent:!0,side:n.DoubleSide,linewidth:r||5,vertexColors:!0})),o=(a.setColors(i||[1,1,1]),s.resolution.set(window.innerWidth,window.innerHeight),new J(a,s));return o.name="gw",o.computeLineDistances(),o},de=e=>3.1415926*e/180,pe=(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},fe=(e,t,r,n,i,a)=>({cx:e,cy:t,cz:r,tx:n,ty:i,tz:a}),me=(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}},ve=()=>new X.Z.Clock,ge=e=>{var{r:e,g:t,b:r}=(0,Y.fh)((0,Y.I8)(e.includes("#")?e:"#"+e));return new X.Z.Color(e,t,r)},ye=e=>"#"+e.getHexString(),be=e=>e.r?e:(0,Y.fh)((0,Y.I8)(e.includes("#")?e:"#"+e)),xe=(e,t)=>e.x===t.x&&e.y===t.y&&e.z===t.z,we=e=>{const{r:t,g:r,b:n}=e;return"rgb("+[t,r,n].map((e=>1<e?e:255*e)).join(",")+")"},Se=e=>{var{r:e,g:t,b:r}=e;return{r:e,g:t,b:r}},Ae=e=>{let t=e;return(0,Q.isColor)(e)?t=Se(e):W.YD.is(e)||(t=(0,Y.I8)(e,!0)),t},Me=e=>-1===e.toLocaleLowerCase().indexOf("rgba")?e:e.replace(/[a]/,"").split(",").slice(0,-1)+")",Be=e=>{if(-1!==(e=e.toLocaleLowerCase()).indexOf("#"))return e;if(e=Me(e),/^(rgb|RGB)/.test(e)){for(var t="#",r=e.replace(/(?:\(|\)|rgb|RGB)*/g,"").split(","),n=0;n<r.length;n++){var i=Number(r[n]).toString(16);"0"===i&&(i+=i),t+=i}return t}return String(e)}},129:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__129__},300:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__300__},1:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__1__},356:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__356__},881:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__881__},624:(e,t,r)=>{r.d(t,{Ys:()=>A});var n=r(881);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 s(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&&s(e.prototype,t),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1})}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=p(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=p(e);if(r=t?(r=p(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");return d(n)}}function d(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:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var f=new n.Raycaster,m=new n.Vector3,v=new n.Vector3,g=new n.Quaternion,y={X:new n.Vector3(1,0,0),Y:new n.Vector3(0,1,0),Z:new n.Vector3(0,0,1)},b={type:"change"},x={type:"mouseDown"},w={type:"mouseUp",mode:null},S={type:"objectChange"},A=function(){u(t,n.Object3D);var e=h(t);function t(r,i){a(this,t),s=e.call(this),void 0===i&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),i=document),s.visible=!1,s.domElement=i,s.domElement.style.touchAction="none";var s,o=new G,l=(s._gizmo=o,s.add(o),new N),u=(s._plane=l,s.add(l),d(s));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,o[e]=t,u.dispatchEvent({type:e+"-changed",value:t}),u.dispatchEvent(b))}}),u[e]=t,l[e]=t,o[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),i=new n.Vector3,r=new n.Vector3;var h=new n.Quaternion,p=new n.Quaternion,f=new n.Vector3,m=new n.Quaternion,v=new n.Vector3,g=new n.Vector3,y=new n.Vector3,x=new n.Vector3;return c("worldPosition",i),c("worldPositionStart",r),c("worldQuaternion",h),c("worldQuaternionStart",p),c("cameraPosition",f),c("cameraQuaternion",m),c("pointStart",v),c("pointEnd",g),c("rotationAxis",y),c("rotationAngle",0),c("eye",x),s._offset=new n.Vector3,s._startNorm=new n.Vector3,s._endNorm=new n.Vector3,s._cameraScale=new n.Vector3,s._parentPosition=new n.Vector3,s._parentQuaternion=new n.Quaternion,s._parentQuaternionInv=new n.Quaternion,s._parentScale=new n.Vector3,s._worldScaleStart=new n.Vector3,s._worldQuaternionInv=new n.Quaternion,s._worldScale=new n.Vector3,s._positionStart=new n.Vector3,s._quaternionStart=new n.Quaternion,s._scaleStart=new n.Vector3,s._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(d(s)),s._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(d(s)),s._onPointerHover=function(e){if(this.enabled)switch(e.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(e))}}.bind(d(s)),s._onPointerMove=function(e){this.enabled&&this.pointerMove(this._getPointer(e))}.bind(d(s)),s._onPointerUp=function(e){this.enabled&&(this.domElement.releasePointerCapture(e.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(e)))}.bind(d(s)),s.domElement.addEventListener("pointerdown",s._onPointerDown),s.domElement.addEventListener("pointermove",s._onPointerHover),s.domElement.addEventListener("pointerup",s._onPointerUp),s}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(),l(p(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=M(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=M(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,x.mode=this.mode,this.dispatchEvent(x))}},{key:"pointerMove",value:function(e){var t=this.axis,r=this.mode,n=this.object,i=this.space;"scale"===r?i="local":"E"!==t&&"XYZE"!==t&&"XYZ"!==t||(i="world"),void 0!==n&&null!==t&&!1!==this.dragging&&-1===e.button&&(f.setFromCamera(e,this.camera),(e=M(this._plane,f,!0))&&(this.pointEnd.copy(e.point).sub(this.worldPositionStart),"translate"===r?(this._offset.copy(this.pointEnd).sub(this.pointStart),"local"===i&&"XYZ"!==t&&this._offset.applyQuaternion(this._worldQuaternionInv),-1===t.indexOf("X")&&(this._offset.x=0),-1===t.indexOf("Y")&&(this._offset.y=0),-1===t.indexOf("Z")&&(this._offset.z=0),("local"===i&&"XYZ"!==t?this._offset.applyQuaternion(this._quaternionStart):this._offset.applyQuaternion(this._parentQuaternionInv)).divide(this._parentScale),n.position.copy(this._offset).add(this._positionStart),this.translationSnap&&("local"===i&&(n.position.applyQuaternion(g.copy(this._quaternionStart).invert()),-1!==t.search("X")&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.position.applyQuaternion(this._quaternionStart)),"world"===i&&(n.parent&&n.position.add(m.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(m.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),v.set(e,e,e)):(m.copy(this.pointStart),v.copy(this.pointEnd),m.applyQuaternion(this._worldQuaternionInv),v.applyQuaternion(this._worldQuaternionInv),v.divide(m),-1===t.search("X")&&(v.x=1),-1===t.search("Y")&&(v.y=1),-1===t.search("Z")&&(v.z=1)),n.scale.copy(this._scaleStart).multiply(v),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(m.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(m.copy(this.rotationAxis).cross(this.eye))*e):"X"!==t&&"Y"!==t&&"Z"!==t||(this.rotationAxis.copy(y[t]),m.copy(y[t]),"local"===i&&m.applyQuaternion(this.worldQuaternion),this.rotationAngle=this._offset.dot(m.cross(this.eye).normalize())*e),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),"local"===i&&"E"!==t&&"XYZE"!==t?(n.quaternion.copy(this._quaternionStart),n.quaternion.multiply(g.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),n.quaternion.copy(g.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),n.quaternion.multiply(this._quaternionStart).normalize())),this.dispatchEvent(b),this.dispatchEvent(S)))}},{key:"pointerUp",value:function(e){0===e.button&&(this.dragging&&null!==this.axis&&(w.mode=this.mode,this.dispatchEvent(w)),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(b),this.dispatchEvent(S),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 M(e,t,r){for(var n=t.intersectObject(e,!0),i=0;i<n.length;i++)if(n[i].object.visible||r)return n[i];return!1}A.prototype.isTransformControls=!0;var B=new n.Euler,C=new n.Vector3(0,1,0),E=new n.Vector3(0,0,0),T=new n.Matrix4,_=new n.Quaternion,D=new n.Quaternion,P=new n.Vector3,O=new n.Matrix4,R=new n.Vector3(1,0,0),I=new n.Vector3(0,1,0),k=new n.Vector3(0,0,1),L=new n.Vector3,F=new n.Vector3,U=new n.Vector3,G=function(){u(t,n.Object3D);var e=h(t);function t(){a(this,t),(r=e.call(this)).type="TransformControlsGizmo";var r,i=new n.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),s=new n.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),o=i.clone(),l=((((o.opacity=.15,s=s.clone()).opacity=.5,w=i.clone()).color.setHex(16711680),S=i.clone()).color.setHex(65280),i.clone()),u=(l.color.setHex(255),i.clone()),c=(u.color.setHex(16711680),u.opacity=.5,i.clone()),h=(c.color.setHex(65280),c.opacity=.5,i.clone()),d=(h.color.setHex(255),h.opacity=.5,i.clone());(d.opacity=.25,b=i.clone()).color.setHex(16776960),b.opacity=.25,i.clone().color.setHex(16776960);var p=(((i=i.clone()).color.setHex(7895160),v=new n.CylinderGeometry(0,.04,.1,12)).translate(0,.05,0),new n.BoxGeometry(.08,.08,.08)),f=(p.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}(f.setAttribute("position",new n.Float32BufferAttribute([0,0,0,1,0,0],3)),A=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(A,w),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new n.Mesh(v,S),[0,.5,0]],[new n.Mesh(v,S),[0,-.5,0],[Math.PI,0,0]],[new n.Mesh(A,S)]],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(A,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),o),[.3,0,0],[0,0,-Math.PI/2]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new n.Mesh(new n.OctahedronGeometry(.2,0),o)]],XY:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]]},y={START:[[new n.Mesh(new n.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],END:[[new n.Mesh(new n.OctahedronGeometry(.01,2),s),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),s),null,null,null,"helper"]],X:[[new n.Line(f,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new n.Line(f,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new n.Line(f,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},b=(i={XYZE:[[new n.Mesh(m(.5,1),i),null,[0,Math.PI/2,0]]],X:[[new n.Mesh(m(.5,.5),w)]],Y:[[new n.Mesh(m(.5,.5),S),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(f,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]}),x={XYZE:[[new n.Mesh(new n.SphereGeometry(.25,10,8),o)]],X:[[new n.Mesh(new n.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new n.Mesh(new n.TorusGeometry(.5,.1,4,24),o),[0,0,0],[Math.PI/2,0,0]]],Z:[[new n.Mesh(new n.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,0,-Math.PI/2]]],E:[[new n.Mesh(new n.TorusGeometry(.75,.1,2,24),o)]]},w={X:[[new n.Mesh(p,w),[.5,0,0],[0,0,-Math.PI/2]],[new n.Mesh(A,w),[0,0,0],[0,0,-Math.PI/2]],[new n.Mesh(p,w),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new n.Mesh(p,S),[0,.5,0]],[new n.Mesh(A,S)],[new n.Mesh(p,S),[0,-.5,0],[0,0,Math.PI]]],Z:[[new n.Mesh(p,l),[0,0,.5],[Math.PI/2,0,0]],[new n.Mesh(A,l),[0,0,0],[Math.PI/2,0,0]],[new n.Mesh(p,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())]]},S={X:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.2),o),[0,0,0]]]},A={X:[[new n.Line(f,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new n.Line(f,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new n.Line(f,s.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(),s=e[t][i][1],o=e[t][i][2],l=e[t][i][3],u=e[t][i][4];(a.name=t,a.tag=u,s&&a.position.set(s[0],s[1],s[2]),o&&a.rotation.set(o[0],o[1],o[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(i)),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(S)),r.add(r.helper.translate=M(y)),r.add(r.helper.rotate=M(b)),r.add(r.helper.scale=M(A)),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 r=this,n="local"===("scale"===this.mode?"local":this.space)?this.worldQuaternion:D,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&&(g.setFromEuler(B.set(0,0,0)),t.quaternion.copy(n).multiply(g),.9<Math.abs(C.copy(R).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"Y"===r.axis&&(g.setFromEuler(B.set(0,0,Math.PI/2)),t.quaternion.copy(n).multiply(g),.9<Math.abs(C.copy(I).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"Z"===r.axis&&(g.setFromEuler(B.set(0,Math.PI/2,0)),t.quaternion.copy(n).multiply(g),.9<Math.abs(C.copy(k).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"XYZE"===r.axis&&(g.setFromEuler(B.set(0,Math.PI/2,0)),C.copy(r.rotationAxis),t.quaternion.setFromRotationMatrix(T.lookAt(E,C,I)),t.quaternion.multiply(g),t.visible=r.dragging),"E"===r.axis&&(t.visible=!1)):"START"===t.name?(t.position.copy(r.worldPositionStart),t.visible=r.dragging):"END"===t.name?(t.position.copy(r.worldPosition),t.visible=r.dragging):"DELTA"===t.name?(t.position.copy(r.worldPositionStart),t.quaternion.copy(r.worldQuaternionStart),m.set(1e-10,1e-10,1e-10).add(r.worldPositionStart).sub(r.worldPosition).multiplyScalar(-1),m.applyQuaternion(r.worldQuaternionStart.clone().invert()),t.scale.copy(m),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(R).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(I).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(k).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XY"===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),"YZ"===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),"XZ"===t.name&&Math.abs(C.copy(I).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1)):"rotate"===r.mode&&(_.copy(n),C.copy(r.eye).applyQuaternion(g.copy(n).invert()),-1!==t.name.search("E")&&t.quaternion.setFromRotationMatrix(T.lookAt(r.eye,E,I)),"X"===t.name&&(g.setFromAxisAngle(R,Math.atan2(-C.y,C.z)),g.multiplyQuaternions(_,g),t.quaternion.copy(g)),"Y"===t.name&&(g.setFromAxisAngle(I,Math.atan2(C.x,C.z)),g.multiplyQuaternions(_,g),t.quaternion.copy(g)),"Z"===t.name&&(g.setFromAxisAngle(k,Math.atan2(C.y,C.x)),g.multiplyQuaternions(_,g),t.quaternion.copy(g))),t.visible=t.visible&&(-1===t.name.indexOf("X")||r.showX),t.visible=t.visible&&(-1===t.name.indexOf("Y")||r.showY),t.visible=t.visible&&(-1===t.name.indexOf("Z")||r.showZ),t.visible=t.visible&&(-1===t.name.indexOf("E")||r.showX&&r.showY&&r.showZ),t.material._color=t.material._color||t.material.color.clone(),t.material._opacity=t.material._opacity||t.material.opacity,t.material.color.copy(t.material._color),t.material.opacity=t.material._opacity,r.enabled&&r.axis&&(t.name===r.axis||r.axis.split("").some((function(e){return t.name===e})))&&(t.material.color.setHex(16776960),t.material.opacity=1)}(a);l(p(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}(),N=(G.prototype.isTransformControlsGizmo=!0,function(){u(t,n.Mesh);var e=h(t);function t(){var r;return a(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 r=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(r="local"),L.copy(R).applyQuaternion("local"===r?this.worldQuaternion:D),F.copy(I).applyQuaternion("local"===r?this.worldQuaternion:D),U.copy(k).applyQuaternion("local"===r?this.worldQuaternion:D),C.copy(F),this.mode){case"translate":case"scale":switch(this.axis){case"X":C.copy(this.eye).cross(L),P.copy(L).cross(C);break;case"Y":C.copy(this.eye).cross(F),P.copy(F).cross(C);break;case"Z":C.copy(this.eye).cross(U),P.copy(U).cross(C);break;case"XY":P.copy(U);break;case"YZ":P.copy(L);break;case"XZ":C.copy(U),P.copy(F);break;case"XYZ":case"E":P.set(0,0,0)}break;default:P.set(0,0,0)}0===P.length()?this.quaternion.copy(this.cameraQuaternion):(O.lookAt(m.set(0,0,0),P,C),this.quaternion.setFromRotationMatrix(O)),l(p(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}());N.prototype.isTransformControlsPlane=!0},819:(e,t,r)=>{r.d(t,{T:()=>c,w:()=>o});var n=r(881);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 s(e,t,r){t&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var o=function(){function e(){i(this,e),this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}return s(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 s(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}())},180:(e,t,r)=>{r.d(t,{T:()=>u});var n=r(881),i=r(819);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 s(e,t){return(s=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"===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&&s(t,e);var r=o(a);function a(e,t){var s;if(this instanceof a)return(s=r.call(this)).textureID=void 0!==t?t:"tDiffuse",e instanceof n.ShaderMaterial?(s.uniforms=e.uniforms,s.material=e):e&&(s.uniforms=n.UniformsUtils.clone(e.uniforms),s.material=new n.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:s.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),s.fsQuad=new i.T(s.material),s;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)=>{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 s(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(){return(o="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 s(a,[{key:"copy",value:function(e,t){return o(u(a.prototype),"copy",this).call(this,e,t),this.element=e.element.cloneNode(!0),this}}]),a}((t=r(881)).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=s((function e(){var t,r,n,a,s=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},o=(i(this,e),this),l={objects:new WeakMap},u=void 0!==s.element?s.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 s;t.isCSS2DObject&&(h.setFromMatrixPosition(t.matrixWorld),h.applyMatrix4(p),s=!0===t.visible&&-1<=h.z&&h.z<=1&&!0===t.layers.test(i.layers),t.element.style.display=1==s?"":"none",1==s&&(t.onBeforeRender(o,r,i),s=t.element,/apple/i.test(navigator.vendor)?s.style.transform="translate(-50%,-50%) translate("+Math.round(h.x*n+n)+"px,"+Math.round(-h.y*a+a)+"px)":s.style.transform="translate(-50%,-50%) translate("+(h.x*n+n)+"px,"+(-h.y*a+a)+"px)",s.parentNode!==u&&u.appendChild(s),t.onAfterRender(o,r,i)),s={distanceToCameraSquared:c(i,t)},l.objects.set(t,s));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,s=0,f=r.length;s<f;s++)r[s].element.style.zIndex=i-s},this.setSize=function(e,i){n=(t=e)/2,a=(r=i)/2,u.style.width=e+"px",u.style.height=i+"px"}}))},693:(e,t,r)=>{r.d(t,{P7:()=>g,cp:()=>v,lX:()=>x});var n=r(881);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 s(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&&s(e.prototype,t),r&&s(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 o(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 o(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=o((function e(){var t,r,n,i,s=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},o=(a(this,e),this),l={camera:{fov:0,style:""},objects:new WeakMap},u=void 0!==s.element?s.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,s=(t.top+t.bottom)/2),t.isOrthographicCamera?"scale("+r+")translate("+h(a)+"px,"+h(s)+"px)"+d(t.matrixWorldInverse):"translateZ("+r+"px)"+d(t.matrixWorldInverse)),s=a+"translate("+n+"px,"+i+"px)";l.camera.style!==s&&(c.style.transform=s,l.camera.style=s),function e(t,r,n,i){var a,s,u;t.isCSS3DObject&&(a=!0===t.visible&&!0===t.layers.test(n.layers),t.element.style.display=1==a?"":"none",1==a&&(t.onBeforeRender(o,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),s=t.element,void 0!==(u=l.objects.get(t))&&u.style===a||(u={style:s.style.transform=a},l.objects.set(t,u)),s.parentNode!==c&&c.appendChild(s),t.onAfterRender(o,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"}}))},608:(e,t,r)=>{r.d(t,{C:()=>n});var n={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}"}}},__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](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(()=>{__webpack_require__.d(__webpack_exports__,{default:()=>r});var e=__webpack_require__(624),t=__webpack_require__(814);const r={RunScene:t.ZP,Utils:t.cQ,ModelEx:t.ch,MaterialEx:t.al,TextureEx:t.Az,Three:t.Sf,ThreeEx:{TransformControls:e.Ys},Bus:t.Gc}})(),__webpack_exports__=__webpack_exports__.default,__webpack_exports__})()));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("axios"),require("js-funcs"),require("three"),require("@allex/md5")):"function"==typeof define&&define.amd?define(["axios","js-funcs","three","@allex/md5"],t):"object"==typeof exports?exports.RunScene=t(require("axios"),require("js-funcs"),require("three"),require("@allex/md5")):e.RunScene=t(e.axios,e["js-funcs"],e.three,e["@allex/md5"])}(self,((__WEBPACK_EXTERNAL_MODULE__3300__,__WEBPACK_EXTERNAL_MODULE__6001__,__WEBPACK_EXTERNAL_MODULE__8881__,__WEBPACK_EXTERNAL_MODULE__1129__)=>(()=>{"use strict";var __webpack_modules__={2958:(e,t,r)=>{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 a(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&&i(e,t)}function i(e,t){return(i=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"===f(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return o(n)}}function o(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 c(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 u(e,t,r){return t&&c(e.prototype,t),r&&c(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(r="Object"===r&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?p(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function f(e){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e){return void 0===e}function g(){return"undefined"!=typeof window}function v(e){return Ge(e)||Ve(e)}function b(e){return(nt=k(e,rt))&&Sr}function y(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 S(e,t,r){return(r=e[t])&&Ge(r)?e[t]():m(r)&&e.getAttribute&&e.getAttribute(t)||r}function M(e,t){(e=e.split(",")).forEach(t)}function T(e,t,r,n){st.length&>(),e.render(t,r,n),st.length&>()}function _(e){var t=parseFloat(e);return(t||0===t)&&(e+"").match(et).length<2?t:Ve(e)?e.trim():e}function E(e){return e}function k(e,t){for(var r in t)e[r]=t[r];return e}function D(e,t){for(var r in t)"__proto__"!==r&&"constructor"!==r&&"prototype"!==r&&(e[r]=We(t[r])?D(e[r]||(e[r]={}),t[r]):t[r]);return e}function P(e){var t,r=e.parent||le,n=e.keyframes?(t=Ze(e.keyframes),function(e,r){for(var n in r)n in e||"duration"===n&&t||"ease"===n||(e[n]=r[n])}):vt;if(qe(e.inherit))for(;r;)n(e,r.vars.defaults),r=r.parent||r._dp;return e}function A(e){return!e||e._ts&&A(e.parent)}function O(e){return e._repeat?C(e._tTime,e=e.duration()+e._rDelay)*e:0}function C(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 L(e,t){var r;if((t._time||t._initted&&!t._dur)&&(r=R(e.rawTime(),t),(!t._dur||H(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((He(r)?r:r||e!==le?V(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",a=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"_last",i=4<arguments.length?arguments[4]:void 0,s=e[a];if(i)for(r=t[i];s&&s[i]>r;)s=s._prev;s?(t._next=s._next,s._next=t):(t._next=e[n],e[n]=t),t._next?t._next._prev=t:e[a]=t,t._prev=s,t.parent=t._dp=e}(e,t,"_first","_last",e._sort?"_start":0),F(t)||(e._recent=t),n||L(e,t),e}function B(e,t){(rt.ScrollTrigger||at("scrollTrigger",t))&&rt.ScrollTrigger.create(t,e)}function U(e,t,r,n){return Kt(e,t),e._initted?!r&&e._pt&&(e._dur&&!1!==e.vars.lazy||!e._dur&&e.vars.lazy)&&pe!==jt.frame?(st.push(e),e._lazy=[t,n]):void 0:1}function j(e){return(e=e.parent)&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||j(e))}function F(e){return"isFromStart"===(e=e.data)||"isStart"===e}function N(e,t,r,n){var a=e._repeat,i=mt(t)||0;return(t=e._tTime/e._tDur)&&!n&&(e._time*=i/e._dur),e._dur=i,e._tDur=a?a<0?1e10:mt(i*(a+1)+e._rDelay*a):i,0<t&&!n?Mt(e,e._tTime=e._tDur*t):e.parent&&St(e),r||wt(e.parent,e),e}function z(e){return e instanceof ir?wt(e):N(e,e._dur)}function V(e,t,r){var n,a,i,s=e.labels,o=e._recent||Tt,l=e.duration()>=Le?o.endTime(!1):e._dur;return Ve(t)&&(isNaN(t)||t in s)?(a=t.charAt(0),i="%"===t.substr(-1),n=t.indexOf("="),"<"===a||">"===a?(0<=n&&(t=t.replace(/=/,"")),("<"===a?o._start:o.endTime(0<=o._repeat))+(parseFloat(t.substr(1))||0)*(i?(n<0?o:r).totalDuration()/100:1)):n<0?(t in s||(s[t]=l),s[t]):(a=parseFloat(t.charAt(n-1)+t.substr(n+1)),i&&r&&(a=a/100*(Ze(r)?r[0]:r).totalDuration()),1<n?V(e,t.substr(0,n-1),r)+a:l+a)):null==t?l:+t}function G(e,t,r){var n,a,i=He(t[1]),s=(i?2:1)+(e<2?0:1),o=t[s];if(i&&(o.duration=t[1]),o.parent=r,e){for(n=o,a=r;a&&!("immediateRender"in n);)n=a.vars.defaults||{},a=qe(a.vars.inherit)&&a.parent;o.immediateRender=qe(n.immediateRender),e<2?o.runBackwards=1:o.startAt=t[s-1]}return new hr(t[0],o,t[1+s])}function H(e,t,r){return r<e?e:t<r?t:r}function W(e){if(Ge(e))return e;var t=We(e)?e:{each:e},r=Ht(t.ease),n=t.from||0,a=parseFloat(t.base)||0,i={},s=(e=0<n&&n<1,isNaN(n)||e),o=t.axis,l=n,c=n;return Ve(n)?l=c={center:.5,edges:.5,end:1}[n]||0:!e&&s&&(l=n[0],c=n[1]),function(e,u,h){var d,p,f,m,g,v,b,y,x=(h||t).length,w=i[x];if(!w){if(!(y="auto"===t.grid?0:(t.grid||[1,Le])[1])){for(v=-Le;v<(v=h[y++].getBoundingClientRect().left)&&y<x;);y--}for(w=i[x]=[],d=s?Math.min(y,x)*l-.5:n%y,p=y===Le?0:s?x*c/y-.5:n/y|0,b=Le,g=v=0;g<x;g++)m=g%y-d,f=p-(g/y|0),w[g]=m=o?Math.abs("y"===o?f:m):Fe(m*m+f*f),v<m&&(v=m),m<b&&(b=m);"random"===n&&At(w),w.max=v-b,w.min=b,w.v=x=(parseFloat(t.amount)||parseFloat(t.each)*(x<y?x-1:o?"y"===o?x/y:y:Math.max(y,x/y))||0)*("edges"===n?-1:1),w.b=x<0?a-x:a,w.u=Et(t.amount||t.each)||0,r=r&&x<0?Gt(r):r}return x=(w[e]-w.min)/w.max||0,mt(w.b+(r?r(x):x)*w.v)+w.u}}function q(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+(He(r)?0:Et(r))}}function K(e,t){var r,n,a=Ze(e);return!a&&We(e)&&(r=a=e.radius||Le,e.values?(e=Pt(e.values),(n=!He(e[0]))&&(r*=r)):e=q(e.increment)),_t(t,a?Ge(e)?function(t){return n=e(t),Math.abs(n-t)<=r?n:t}:function(t){for(var a,i,s=parseFloat(n?t.x:t),o=parseFloat(n?t.y:0),l=Le,c=0,u=e.length;u--;)(a=n?(a=e[u].x-s)*a+(i=e[u].y-o)*i:Math.abs(e[u]-s))<l&&(l=a,c=u);return c=!r||l<=r?e[c]:t,n||c===t||He(t)?c:c+Et(t)}:q(e))}function Z(e,t,r,n){return _t(Ze(e)?!t:!0===r?!!(r=0):!n,(function(){return Ze(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 _t(r,(function(r){return e[~~t(r)]}))}function Q(e,t,r,n,a){var i=t-e,s=n-r;return _t(a,(function(t){return r+((t-e)/i*s||0)}))}function Y(e,t,r){var n,a,i,s=e.labels,o=Le;for(n in s)(a=s[n]-t)<0==!!r&&a&&o>(a=Math.abs(a))&&(i=n,o=a);return i}function J(e,t,r){var n=e.vars,a=n[t];a&&(t=n[t+"Params"],n=n.callbackScope||e,r&&st.length&>(),t?a.apply(n,t):a.call(n))}function $(e){return xt(e),e.scrollTrigger&&e.scrollTrigger.kill(!1),e.progress()<1&&J(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)*Ct+.5|0}function te(e,t,r){var n,a,i,s,o="",l=(e+o).match(Bt),c=t?"hsla(":"rgba(",u=0;if(!l)return e;if(l=l.map((function(e){return(e=Lt(e,t,1))&&c+(t?e[0]+","+e[1]+"%,"+e[2]+"%,"+e[3]:e.join(","))+")"})),r&&(i=It(e),(n=r.c).join(o)!==i.c.join(o)))for(s=(a=e.replace(Bt,"1").split(Ye)).length-1;u<s;u++)o+=a[u]+(~n.indexOf(u)?l.shift()||c+"0,0,0,0)":(i.length?i:l.length?l:r).shift());if(!a)for(s=(a=e.split(Bt)).length-1;u<s;u++)o+=a[u]+l[u];return o+a[s]}function re(e,t){for(var r,n=e._first;n;)n instanceof ir?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)},a={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}};M(e,(function(e){for(var t in Nt[e]=rt[e]=a,Nt[r=e.toLowerCase()]=n,a)Nt[r+("easeIn"===t?".in":"easeOut"===t?".out":".inOut")]=Nt[e+"."+t]=a[t]}))}function ae(e){return function(t){return t<.5?(1-e(1-2*t))/2:.5+e(2*(t-.5))/2}}function ie(e,t,r){function n(e){return 1===e?1:a*Math.pow(2,-10*e)*ze((e-i)*s)+1}var a=1<=t?t:1,i=(s=(r||(e?.3:.45))/(t<1?t:1))/Be*(Math.asin(1/a)||0),s=(r="out"===e?n:"in"===e?function(e){return 1-n(1-e)}:ae(n),Be/s);return r.config=function(t,r){return ie(e,t,r)},r}function se(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)}:ae(t);return n.config=function(t){return se(e,t)},n}r.d(t,{Q3:()=>hr});var oe,le,ce,ue,he,de,pe,fe,me,ge,ve,be,ye,xe,we,Se,Me,Te,_e,Ee,ke,De,Pe,Ae,Oe,Ce={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Re={duration:.5,overwrite:!1,delay:0},Le=1e8,Ie=1/Le,Be=2*Math.PI,Ue=Be/4,je=0,Fe=Math.sqrt,Ne=Math.cos,ze=Math.sin,Ve=function(e){return"string"==typeof e},Ge=function(e){return"function"==typeof e},He=function(e){return"number"==typeof e},We=function(e){return"object"==f(e)},qe=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,Je=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,$e=/[+-]=-?[.\d]+/,et=/[^,'"\[\]\s]+/gi,tt=/[\d.+\-=]+(?:e[-+]\d*)*/i,rt={},nt={},at=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},it={},st=[],ot={},lt={},ct={},ut=30,ht=[],dt="",pt=function(e){var t,r,n=e[0];if(We(n)||Ge(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(Pt(e))[0]._gsap},mt=function(e){return Math.round(1e7*e)/1e7||0},gt=function(){var e,t,r=st.length,n=st.slice(0);for(ot={},e=st.length=0;e<r;e++)(t=n[e])&&t._lazy&&(t.render(t._lazy[0],t._lazy[1],!0)._lazy=0)},vt=function(e,t){for(var r in t)r in e||(e[r]=t[r]);return e},bt=function(e,t){var r,n={};for(r in e)r in t||(n[r]=e[r]);return n},yt=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",a=t._prev,i=t._next;a?a._next=i:e[r]===t&&(e[r]=i),i?i._prev=a:e[n]===t&&(e[n]=a),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},St=function(e){return e._end=mt(e._start+(e._tDur/Math.abs(e._ts||e._rts||Ie)||0))},Mt=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)),St(e),r._dirty||wt(r,e)),e},Tt={_start:0,endTime:w,totalDuration:w},_t=function(e,t){return e||0===e?t(e):t},Et=function(e,t){return Ve(e)&&(t=tt.exec(e))?e.substr(t.index+t[0].length):""},kt=[].slice,Dt=function(e,t){return e&&We(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&We(e[0]))&&!e.nodeType&&e!==ce},Pt=function(e,t,r){return!Ve(e)||r||!ue&&Ft()?Ze(e)?function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[];return e.forEach((function(e){return Ve(e)&&!t||Dt(e,1)?r.push.apply(r,d(Pt(e))):r.push(e)}))||r}(e,r):Dt(e)?kt.call(e,0):e?[e]:[]:kt.call((t||he).querySelectorAll(e),0)},At=function(e){return e.sort((function(){return.5-Math.random()}))},Ot=function(e){for(var t,r,n,a,i=0,s="";~(t=e.indexOf("random(",i));)n=e.indexOf(")",t),a="["===e.charAt(t+7),r=e.substr(t+7,n-t-7).match(a?et:Xe),s+=e.substr(i,t-i)+Z(a?r:+r[0],a?0:+r[1],+r[2]||1e-5),i=n+1;return s+e.substr(i,e.length-i)},Ct=255,Rt={aqua:[0,Ct,Ct],lime:[0,Ct,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Ct],navy:[0,0,128],white:[Ct,Ct,Ct],olive:[128,128,0],yellow:[Ct,Ct,0],orange:[Ct,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Ct,0,0],pink:[Ct,192,203],cyan:[0,Ct,Ct],transparent:[Ct,Ct,Ct,0]},Lt=function(e,t,r){var n,a,i,s,o,l,c,u=e?He(e)?[e>>16,e>>8&Ct,e&Ct]:0:Rt.black;if(!u){if(","===e.substr(-1)&&(e=e.substr(0,e.length-1)),Rt[e])u=Rt[e];else if("#"===e.charAt(0)){if(9===(e=e.length<6?"#"+(n=e.charAt(1))+n+(a=e.charAt(2))+a+(i=e.charAt(3))+i+(5===e.length?e.charAt(4)+e.charAt(4):""):e).length)return[(u=parseInt(e.substr(1,6),16))>>16,u>>8&Ct,u&Ct,parseInt(e.substr(7),16)/255];u=[(e=parseInt(e.substr(1),16))>>16,e>>8&Ct,e&Ct]}else if("hsl"===e.substr(0,3))if(u=c=e.match(Xe),t){if(~e.indexOf("="))return u=e.match(Qe),r&&u.length<4&&(u[3]=1),u}else s=+u[0]%360/360,o=+u[1]/100,n=2*(l=+u[2]/100)-(a=l<=.5?l*(o+1):l+o-l*o),3<u.length&&(u[3]*=1),u[0]=ee(s+1/3,n,a),u[1]=ee(s,n,a),u[2]=ee(s-1/3,n,a);else u=e.match(Xe)||Rt.transparent;u=u.map(Number)}return t&&!c&&(n=u[0]/Ct,a=u[1]/Ct,i=u[2]/Ct,l=((e=Math.max(n,a,i))+(t=Math.min(n,a,i)))/2,e===t?s=o=0:(c=e-t,o=.5<l?c/(2-e-t):c/(e+t),s=e===n?(a-i)/c+(a<i?6:0):e===a?(i-n)/c+2:(n-a)/c+4,s*=60),u[0]=~~(s+.5),u[1]=~~(100*o+.5),u[2]=~~(100*l+.5)),r&&u.length<4&&(u[3]=1),u},It=function(e){var t=[],r=[],n=-1;return e.split(Bt).forEach((function(e){e=e.match(Ye)||[],t.push.apply(t,d(e)),r.push(n+=e.length+1)})),t.c=r,t},Bt=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")}(),Ut=/hsl[a]?\(/,jt=(we=Date.now,Se=500,Me=33,Te=we(),_e=Te,ke=Ee=1e3/240,Pe={time:0,frame:0,tick:function(){Wt(!0)},deltaRatio:function(e){return ye/(1e3/(e||60))},wake:function(){de&&(!ue&&g()&&(ce=ue=window,he=ce.document||{},rt.gsap=Sr,(ce.gsapVersions||(ce.gsapVersions=[])).push(Sr.version),b(nt||ce.GreenSockGlobals||!ce.gsap&&ce||{}),be=ce.requestAnimationFrame),ge&&Pe.sleep(),ve=be||function(e){return setTimeout(e,ke-1e3*Pe.time+1|0)},me=1,Wt(2))},sleep:function(){(be?ce.cancelAnimationFrame:clearTimeout)(ge),me=0,ve=w},lagSmoothing:function(e,t){Se=e||1/Ie,Me=Math.min(t,Se,0)},fps:function(e){Ee=1e3/(e||240),ke=1e3*Pe.time+Ee},add:function(e){De.indexOf(e)<0&&De.push(e),Ft()},remove:function(e,t){~(t=De.indexOf(e))&&De.splice(t,1)&&t<=xe&&xe--},_listeners:De=[]}),Ft=function(){return!me&&jt.wake()},Nt={},zt=/^[\d.\-M][\d.\-,\s]/,Vt=/["']/g,Gt=function(e){return function(t){return 1-e(1-t)}},Ht=function(e,t){return e&&(Ge(e)?e:Nt[e]||function(e){var t,r,n,a=(e+"").split("("),i=Nt[a[0]];return i&&1<a.length&&i.config?i.config.apply(null,~e.indexOf("{")?[function(e){for(var t,r,n,a={},i=e.substr(1,e.length-3).split(":"),s=i[0],o=1,l=i.length;o<l;o++)r=i[o],t=o!==l-1?r.lastIndexOf(","):r.length,n=r.substr(0,t),a[s]=isNaN(n)?n.replace(Vt,"").trim():+n,s=r.substr(t+1).trim();return a}(a[1])]:(t=(a=e).indexOf("(")+1,r=a.indexOf(")"),n=a.indexOf("(",t),a.substring(t,~n&&n<r?a.indexOf(")",r+1):r).split(",").map(_))):Nt._CE&&zt.test(e)?Nt._CE("",e):i}(e))||t};function Wt(e){var t,r,n,a=we()-_e,i=!0===e;if(Se<a&&(Te+=a-Me),(0<(a=(r=(_e+=a)-Te)-ke)||i)&&(n=++Pe.frame,ye=r-1e3*Pe.time,Pe.time=r/=1e3,ke+=a+(Ee<=a?4:Ee-a),t=1),i||(ge=ve(Wt)),t)for(xe=0;xe<De.length;xe++)De[xe](r,ye,n,e)}function qt(e){return e<Oe?Ae*e*e:e<.7272727272727273?Ae*Math.pow(e-1.5/2.75,2)+.75:e<.9090909090909092?Ae*(e-=2.25/2.75)*e+.9375:Ae*Math.pow(e-2.625/2.75,2)+.984375}function Kt(e,t){var r,n,a,i,s,o,l,c,u,h,d,p,f,m=e.vars,g=m.ease,v=m.startAt,b=m.immediateRender,y=m.lazy,x=m.onUpdate,w=m.onUpdateParams,S=m.callbackScope,M=m.runBackwards,T=m.yoyoEase,_=m.keyframes,E=m.autoRevert,k=e._dur,D=e._startAt,P=e._targets,A=e.parent,O=A&&"nested"===A.data?A.parent._targets:P,C="auto"===e._overwrite&&!oe,R=e.timeline;if(e._ease=Ht(g=!R||_&&g?g:"none",Re.ease),e._yEase=T?Gt(Ht(!0===T?g:T,Re.ease)):0,T&&e._yoyo&&!e._repeat&&(T=e._yEase,e._yEase=e._ease,e._ease=T),e._from=!R&&!!m.runBackwards,!R||_&&!m.stagger){if(p=(c=P[0]?ft(P[0]).harness:0)&&m[c.prop],r=bt(m,it),D&&xt(D.render(-1,!0)),v)if(xt(e._startAt=hr.set(P,vt({data:"isStart",overwrite:!1,parent:A,immediateRender:!0,lazy:qe(y),startAt:null,delay:0,onUpdate:x,onUpdateParams:w,callbackScope:S,stagger:0},v))),t<0&&!b&&!E&&e._startAt.render(-1,!0),b){if(0<t&&!E&&(e._startAt=0),k&&t<=0)return void(t&&(e._zTime=t))}else!1===E&&(e._startAt=0);else if(M&&k)if(D)E||(e._startAt=0);else if(a=vt({overwrite:!1,data:"isFromStart",lazy:(b=!t&&b)&&qe(y),immediateRender:b,stagger:0,parent:A},r),p&&(a[c.prop]=p),xt(e._startAt=hr.set(P,a)),t<0&&e._startAt.render(-1,!0),e._zTime=t,b){if(!t)return}else Kt(e._startAt,Ie);for(e._pt=0,y=k&&qe(y)||y&&!k,n=0;n<P.length;n++){if(l=(s=P[n])._gsap||pt(P)[n]._gsap,e._ptLookup[n]=h={},ot[l.id]&&st.length&>(),d=O===P?n:O.indexOf(s),c&&!1!==(u=new c).init(s,p||r,e,d,O)&&(e._pt=i=new yr(e._pt,s,u.name,0,1,u.render,u,0,u.priority),u._props.forEach((function(e){h[e]=i})),u.priority&&(o=1)),!c||p)for(a in r)lt[a]&&(u=lr(a,r,e,d,s,O))?u.priority&&(o=1):h[a]=i=or.call(e,s,a,"get",r[a],d,O,0,m.stringFilter);e._op&&e._op[n]&&e.kill(s,e._op[n]),C&&e._pt&&(rr=e,le.killTweensOf(s,h,e.globalTime(t)),f=!e.parent,rr=0),e._pt&&y&&(ot[l.id]=1)}o&&br(e),e._onInit&&e._onInit(e)}e._onUpdate=x,e._initted=(!e._op||e._pt)&&!f,_&&t<=0&&R.render(Le,!0,!0)}function Zt(e,t,r,n,a){return Ge(e)?e.call(t,r,n,a):Ve(e)&&~e.indexOf("random(")?Ot(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 Jt(e,t,r,n){for(var a,i=this._pt;i;)a=i._next,i.p===n&&i.modifier(e,t,r),i=a}function $t(e){for(var t,r,n=this._pt;n;)r=n._next,n.p===e&&!n.op||n.op===e?yt(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,a;if(Ve(r)&&(n={},M(r,(function(e){return n[e]=1})),r=n),t){for(a in n={},r)n[a]=t(r[a]);r=n}var i,s,o,l=e,c=r,u=l._targets;for(i in c)for(s=u.length;s--;)(o=(o=l._ptLookup[s][i])&&o.d)&&(o=o._pt?wr(o,i):o)&&o.modifier&&o.modifier(c[i],l,u[s],i)}}}}M("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}))})),Nt.Linear.easeNone=Nt.none=Nt.Linear.easeIn,ne("Elastic",ie("in"),ie("out"),ie()),Ae=7.5625,Oe=1/2.75,ne("Bounce",(function(e){return 1-qt(1-e)}),qt),ne("Expo",(function(e){return e?Math.pow(2,10*(e-1)):0})),ne("Circ",(function(e){return-(Fe(1-e*e)-1)})),ne("Sine",(function(e){return 1===e?1:1-Ne(e*Ue)})),ne("Back",se("in"),se("out"),se()),Nt.SteppedEase=Nt.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),a=t?1:0,i=1-Ie;return function(e){return((n*H(0,i,e)|0)+a)*r}}},Re.ease=Nt["quad.out"],M("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",(function(e){return dt+=e+","+e+"Params,"}));var rr,nr=u((function e(t,r){h(this,e),this.id=je++,(t._gsap=this).target=t,this.harness=r,this.get=r?r.get:S,this.set=r?r.getSetter:mr})),ar=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||jt.wake()}return u(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(Ft(),!arguments.length)return this._tTime;var r=this._dp;if(r&&r.smoothChildTiming&&this._ts){for(Mt(this,e),r._dp&&!r.parent&&L(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),T(this,e,t)),this}},{key:"time",value:function(e,t){return arguments.length?this.totalTime(Math.min(this.totalDuration(),e+O(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)+O(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?C(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?R(this.parent._time,this):this._tTime,r=(this._rts=+e||0,this._ts=this._ps||e===-Ie?0:this._rts,e=this.totalTime(H(-this._delay,this._tDur,t),!0)).parent;r&&r.parent;)r._dirty=1,r.totalDuration(),r=r.parent;return St(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):(Ft(),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+(qe(e)?this.totalDuration():this.duration())/Math.abs(this._ts||1)}},{key:"rawTime",value:function(e){var t=this.parent||this._dp;return t?e&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?R(t.rawTime(e),this):this._tTime:this._tTime}},{key:"globalTime",value:function(e){for(var t=this,r=arguments.length?e:t.rawTime();t;)r=t._start+r/(t._ts||1),t=t._dp;return r}},{key:"repeat",value:function(e){return arguments.length?(this._repeat=e===1/0?-2:e,z(this)):-2===this._repeat?1/0:this._repeat}},{key:"repeatDelay",value:function(e){var t;return arguments.length?(t=this._time,this._rDelay=e,z(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(V(this,e),qe(t))}},{key:"restart",value:function(e,t){return this.play().totalTime(e?-this._delay:0,qe(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,Ge(a)&&(a=a(t))&&(a.then||a===t)&&(t.then=e),r(a),t.then=e}var a=Ge(e)?e:E;t._initted&&1===t.totalProgress()&&0<=t._ts||!t._tTime&&t._ts<0?n():t._prom=n}))}},{key:"kill",value:function(){$(this)}}]),e}(),ir=(vt(ar.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(){a(t,ar);var e=s(t);function t(){var r,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},a=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=qe(n.sortChildren),le&&I(n.parent||le,o(r),a),n.reversed&&r.reverse(),n.paused&&r.paused(!0),n.scrollTrigger&&B(o(r),n.scrollTrigger),r}return u(t,[{key:"to",value:function(e,t,r){return G(0,arguments,this),this}},{key:"from",value:function(e,t,r){return G(1,arguments,this),this}},{key:"fromTo",value:function(e,t,r,n){return G(2,arguments,this),this}},{key:"set",value:function(e,t,r){return t.duration=0,t.parent=this,P(t).repeatDelay||(t.repeat=0),t.immediateRender=!!t.immediateRender,new hr(e,t,V(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,a,i,s){return r.duration=t,r.stagger=r.stagger||n,r.onComplete=i,r.onCompleteParams=s,r.parent=this,new hr(e,r,V(this,a)),this}},{key:"staggerFrom",value:function(e,t,r,n,a,i,s){return r.runBackwards=1,P(r).immediateRender=qe(r.immediateRender),this.staggerTo(e,t,r,n,a,i,s)}},{key:"staggerFromTo",value:function(e,t,r,n,a,i,s,o){return n.startAt=r,P(n).immediateRender=qe(n.immediateRender),this.staggerTo(e,t,n,a,i,s,o)}},{key:"render",value:function(e,t,r){var n,a,i,s,o,l,c,u,h,d,p=this._time,f=this._dirty?this.totalDuration():this._tDur,m=this._dur,g=e<=0?0:mt(e),v=this._zTime<0!=e<0&&(this._initted||!m);if((g=this!==le&&f<g&&0<=e?f:g)!==this._tTime||r||v){if(p!==this._time&&m&&(g+=this._time-p,e+=this._time-p),n=g,u=this._start,o=!(c=this._ts),v&&(m||(p=this._zTime),!e&&t||(this._zTime=e)),this._repeat){if(v=this._yoyo,s=m+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*s+e,t,r);if(n=mt(g%s),g===f?(i=this._repeat,n=m):((i=~~(g/s))&&i===g/s&&(n=m,i--),m<n&&(n=m)),h=C(this._tTime,s),v&&1&i&&(n=m-n,d=1),i!==(h=!p&&this._tTime&&h!==i?i:h)&&!this._lock){var b=v&&1&h;if(v=b===(v&&1&i),p=(b=i<h?!b:b)?0:m,this._lock=1,this.render(p||(d?0:mt(i*s)),t,!m)._lock=0,this._tTime=g,!t&&this.parent&&J(this,"onRepeat"),this.vars.repeatRefresh&&!d&&(this.invalidate()._lock=1),p&&p!==this._time||o!=!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(m=this._dur,f=this._tDur,v&&(this._lock=2,this.render(p=b?m:-1e-4,!0),this.vars.repeatRefresh&&!d&&this.invalidate()),this._lock=0,!this._ts&&!o)return this;re(this,d)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(l=function(e,t,r){var n;if(t<r)for(n=e._first;n&&n._start<=r;){if("isPause"===n.data&&n._start>t)return n;n=n._next}else for(n=e._last;n&&n._start>=r;){if("isPause"===n.data&&n._start<t)return n;n=n._prev}}(this,mt(p),mt(n)))&&(g-=n-(n=l._start)),this._tTime=g,this._time=n,this._act=!c,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=e,p=0),!p&&n&&!t&&(J(this,"onStart"),this._tTime!==g))return this;if(p<=n&&0<=e)for(y=this._first;y;){if(a=y._next,(y._act||n>=y._start)&&y._ts&&l!==y){if(y.parent!==this)return this.render(e,t,r);if(y.render(0<y._ts?(n-y._start)*y._ts:(y._dirty?y.totalDuration():y._tDur)+(n-y._start)*y._ts,t,r),n!==this._time||!this._ts&&!o){l=0,a&&(g+=this._zTime=-Ie);break}}y=a}else for(var y=this._last,x=e<0?e:n;y;){if(a=y._prev,(y._act||x<=y._end)&&y._ts&&l!==y){if(y.parent!==this)return this.render(e,t,r);if(y.render(0<y._ts?(x-y._start)*y._ts:(y._dirty?y.totalDuration():y._tDur)+(x-y._start)*y._ts,t,r),n!==this._time||!this._ts&&!o){l=0,a&&(g+=this._zTime=x?-Ie:Ie);break}}y=a}if(l&&!t&&(this.pause(),l.render(p<=n?0:-Ie)._zTime=p<=n?1:-1,this._ts))return this._start=u,St(this),this.render(e,t,r);this._onUpdate&&!t&&J(this,"onUpdate",!0),!(g===f&&f>=this.totalDuration()||!g&&p)||u!==this._start&&Math.abs(c)===Math.abs(this._ts)||this._lock||(!e&&m||!(g===f&&0<this._ts||!g&&this._ts<0)||xt(this,1),t||e<0&&!p||!g&&!p&&f||(J(this,g===f&&0<=e?"onComplete":"onReverseComplete",!0),!this._prom||g<f&&0<this.timeScale()||this._prom()))}return this}},{key:"add",value:function(e,t){var r=this;if(He(t)||(t=V(this,t,e)),!(e instanceof ar)){if(Ze(e))return e.forEach((function(e){return r.add(e,t)})),this;if(Ve(e))return this.addLabel(e,t);if(!Ge(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]:-Le,a=[],i=this._first;i;)i._start>=n&&(i instanceof hr?t&&a.push(i):(r&&a.push(i),e&&a.push.apply(a,d(i.getChildren(!0,t,r))))),i=i._next;return a}},{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 Ve(e)?this.removeLabel(e):Ge(e)?this.killTweensOf(e):(yt(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(jt.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]=V(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,V(this,e))}},{key:"removePause",value:function(e){var t=this._first;for(e=V(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),a=n.length;a--;)rr!==n[a]&&n[a].kill(e,t);return this}},{key:"getTweensOf",value:function(e,t){for(var r,n=[],a=Pt(e),i=this._first,s=He(t);i;)i instanceof hr?function(e,t){for(var r=t.length,n=0;e.indexOf(t[n])<0&&++n<r;);return n<r}(i._targets,a)&&(s?(!rr||i._initted&&i._ts)&&i.globalTime(0)<=t&&i.globalTime(i.totalDuration())>t:!t||i.isActive())&&n.push(i):(r=i.getTweensOf(a,t)).length&&n.push.apply(n,d(r)),i=i._next;return n}},{key:"tweenTo",value:function(e,t){t=t||{};var r,n=this,a=V(n,e),i=(e=t).startAt,s=e.onStart,o=e.onStartParams,l=(e=e.immediateRender,hr.to(n,vt({ease:t.ease||"none",lazy:!1,immediateRender:!1,time:a,overwrite:"auto",duration:t.duration||Math.abs((a-(i&&"time"in i?i.time:n._time))/n.timeScale())||Ie,onStart:function(){var e;n.pause(),r||(e=t.duration||Math.abs((a-(i&&"time"in i?i.time:n._time))/n.timeScale()),l._dur!==e&&N(l,e,0,1).render(l._time,!0,!0),r=1),s&&s.apply(l,o||[])}},t)));return e?l.render(0):l}},{key:"tweenFromTo",value:function(e,t,r){return this.tweenTo(t,vt({startAt:{time:V(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,V(this,e))}},{key:"previousLabel",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._time;return Y(this,V(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,a=this._first,i=this.labels;a;)a._start>=n&&(a._start+=e,a._end+=e),a=a._next;if(t)for(r in i)i[r]>=n&&(i[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,a=0,i=this,s=i._last,o=Le;if(arguments.length)return i.timeScale((i._repeat<0?i.duration():i.totalDuration())/(i.reversed()?-e:e));if(i._dirty){for(n=i.parent;s;)t=s._prev,s._dirty&&s.totalDuration(),(r=s._start)>o&&i._sort&&s._ts&&!i._lock?(i._lock=1,I(i,s,r-s._delay,1)._lock=0):o=r,r<0&&s._ts&&(a-=r,(!n&&!i._dp||n&&n.smoothChildTiming)&&(i._start+=r/i._ts,i._time-=r,i._tTime-=r),i.shiftChildren(-r,!1,-1/0),o=0),s._end>a&&s._ts&&(a=s._end),s=t;N(i,i===le&&i._time>a?i._time:a,1,1),i._dirty=0}return i._tDur}}],[{key:"updateRoot",value:function(e){if(le._ts&&(T(le,R(e,le)),pe=jt.frame),jt.frame>=ut){ut+=Ce.autoSleep||120;var t=le._first;if((!t||!t._ts)&&Ce.autoSleep&&jt._listeners.length<2){for(;t&&!t._ts;)t=t._next;t||jt.sleep()}}}}]),t}()),sr=(vt(ir.prototype,{_lock:0,_hasPause:0,_forcing:0}),function(e,t,r,n,a,i,s){var o,l,c,u,h,d=new yr(this._pt,e,t,0,1,Qt,null,a),p=0,f=0;for(d.b=r,d.e=n,r+="",(a=~(n+="").indexOf("random("))&&(n=Ot(n)),i&&(i(i=[r,n],e,t),r=i[0],n=i[1]),o=r.match(Je)||[];u=Je.exec(n);)c=u[0],u=n.substring(p,u.index),l?l=(l+1)%5:"rgba("===u.substr(-5)&&(l=1),c!==o[f++]&&(h=parseFloat(o[f-1])||0,d._pt={_next:d._pt,p:u||1===f?u:",",s:h,c:"="===c.charAt(1)?parseFloat(c.substr(2))*("-"===c.charAt(0)?-1:1):parseFloat(c)-h,m:l&&l<4?Math.round:0},p=Je.lastIndex);return d.c=p<n.length?n.substring(p,n.length):"",d.fp=s,($e.test(n)||a)&&(d.e=0),this._pt=d}),or=function(e,t,r,n,a,i,s,o,l){var c;if(Ge(n)&&(n=n(a||0,e,i)),a=e[t],i="get"!==r?r:Ge(a)?l?e[t.indexOf("set")||!Ge(e["get"+t.substr(3)])?t:"get"+t.substr(3)](l):e[t]():a,r=Ge(a)?l?fr:pr:dr,Ve(n)&&"="===(n=~n.indexOf("random(")?Ot(n):n).charAt(1)&&(!(c=parseFloat(i)+parseFloat(n.substr(2))*("-"===n.charAt(0)?-1:1)+(Et(i)||0))&&0!==c||(n=c)),i!==n)return isNaN(i*n)||""===n?(a||t in e||at(t,n),sr.call(this,e,t,i,n,r,o||Ce.stringFilter,l)):(c=new yr(this._pt,e,t,+i||0,n-(i||0),"boolean"==typeof a?vr:gr,0,r),l&&(c.fp=l),s&&c.modifier(s,this,e),this._pt=c)},lr=function(e,t,r,n,a,i){var s,o,l,c;if(lt[e]&&!1!==(s=new lt[e]).init(a,s.rawVars?t[e]:function(e,t,r,n,a){if(Ge(e)&&(e=Zt(e,a,t,r,n)),!We(e)||e.style&&e.nodeType||Ze(e)||Ke(e))return Ve(e)?Zt(e,a,t,r,n):e;var i,s={};for(i in e)s[i]=Zt(e[i],a,t,r,n);return s}(t[e],n,a,i,r),r,n,i)&&(r._pt=o=new yr(r._pt,a,e,0,1,s.render,s,0,s.priority),r!==fe))for(l=r._ptLookup[r._targets.indexOf(a)],c=s._props.length;c--;)l[s._props[c]]=o;return s},cr=dt+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase",ur={},hr=(M(cr+",id,stagger,delay,duration,paused,scrollTrigger",(function(e){return ur[e]=1})),function(){a(t,ar);var e=s(t);function t(r,n,a,i){h(this,t),"number"==typeof n&&(a.duration=n,n=a,a=null);var s,l,c,u,d,p,f,m,g,b=(i=(s=e.call(this,i?n:P(n))).vars).duration,x=i.delay,w=i.immediateRender,S=i.stagger,M=i.overwrite,T=i.keyframes,_=i.defaults,E=i.scrollTrigger,D=i.yoyoEase,O=(i=n.parent||le,(Ze(r)||Ke(r)?He(r[0]):"length"in n)?[r]:Pt(r));if(s._targets=O.length?pt(O):y("GSAP target "+r+" not found. https://greensock.com",!Ce.nullTargetWarn)||[],s._ptLookup=[],s._overwrite=M,T||S||v(b)||v(x)){if(n=s.vars,(l=s.timeline=new ir({data:"nested",defaults:_||{}})).kill(),l.parent=l._dp=o(s),l._start=0,S||v(b)||v(x)){if(d=O.length,m=S&&W(S),We(S))for(p in S)~cr.indexOf(p)&&((g=g||{})[p]=S[p]);for(c=0;c<d;c++)(u=bt(n,ur)).stagger=0,D&&(u.yoyoEase=D),g&&k(u,g),f=O[c],u.duration=+Zt(b,o(s),c,f,O),u.delay=(+Zt(x,o(s),c,f,O)||0)-s._delay,!S&&1===d&&u.delay&&(s._delay=x=u.delay,s._start+=x,u.delay=0),l.to(f,u,m?m(c,f,O):0),l._ease=Nt.none;l.duration()?b=x=0:s.timeline=0}else if(T){P(vt(l.vars.defaults,{ease:"none"})),l._ease=Ht(T.ease||n.ease||"none");var C,R,L,U=0;if(Ze(T))T.forEach((function(e){return l.to(O,e,">")}));else{for(p in u={},T)"ease"!==p&&"easeEach"!==p&&function(e,t,r,n){var a,i,s=t.ease||n||"power1.inOut";if(Ze(t))i=r[e]||(r[e]=[]),t.forEach((function(e,r){return i.push({t:r/(t.length-1)*100,v:e,e:s})}));else for(a in t)i=r[a]||(r[a]=[]),"ease"!==a&&i.push({t:parseFloat(e),v:t[a],e:s})}(p,T[p],u,T.easeEach);for(p in u)for(C=u[p].sort((function(e,t){return e.t-t.t})),c=U=0;c<C.length;c++)(L={ease:(R=C[c]).e,duration:(R.t-(c?C[c-1].t:0))/100*b})[p]=R.v,l.to(O,L,U),U+=L.duration;l.duration()<b&&l.to({},{duration:b-l.duration()})}}b||s.duration(b=l.duration())}else s.timeline=0;return!0!==M||oe||(rr=o(s),le.killTweensOf(O),rr=0),I(i,o(s),a),n.reversed&&s.reverse(),n.paused&&s.paused(!0),(w||!b&&!T&&s._start===mt(i._time)&&qe(w)&&A(o(s))&&"nested"!==i.data)&&(s._tTime=-Ie,s.render(Math.max(0,-x))),E&&B(o(s),E),s}return u(t,[{key:"render",value:function(e,t,r){var n,a,i=this._time,s=this._tDur,o=this._dur,l=s-Ie<e&&0<=e?s:e<Ie?0:e;if(o){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=o+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*h+e,t,r);if(m=mt(l%h),l===s?(v=this._repeat,m=o):((v=~~(l/h))&&v===l/h&&(m=o,v--),o<m&&(m=o)),(p=this._yoyo&&1&v)&&(d=this._yEase,m=o-m),b=C(this._tTime,h),m===i&&!r&&this._initted)return this;v!==b&&(f&&this._yEase&&re(f,p),!this.vars.repeatRefresh||p||this._lock||(this._lock=r=1,this.render(mt(h*v),!0).invalidate()._lock=0))}if(!this._initted){if(U(this,e<0?e:m,r,t))return this._tTime=0,this;if(o!==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=a=(d||this._ease)(m/o),this._from&&(this.ratio=a=1-a),m&&!i&&!t&&(J(this,"onStart"),this._tTime!==l))return this;for(n=this._pt;n;)n.r(a,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),J(this,"onUpdate")),this._repeat&&v!==b&&this.vars.onRepeat&&!t&&this.parent&&J(this,"onRepeat"),l!==this._tDur&&l||this._tTime!==l||(e<0&&this._startAt&&!this._onUpdate&&this._startAt.render(e,!0,!0),!e&&o||!(l===this._tDur&&0<this._ts||!l&&this._ts<0)||xt(this,1),t||e<0&&!i||!l&&!i||(J(this,l===s?"onComplete":"onReverseComplete",!0),!this._prom||l<s&&0<this.timeScale()||this._prom()))}}else{var c,u,h=this,d=e,p=t,f=r,m=h.ratio,g=d<0||!d&&(!h._start&&j(h)&&(h._initted||!F(h))||(h._ts<0||h._dp._ts<0)&&!F(h))?0:1,v=h._rDelay,b=0;if(v&&h._repeat&&(u=C(b=H(0,h._tDur,d),v),h._yoyo&&1&u&&(g=1-g),u!==C(h._tTime,v)&&(m=1-g,h.vars.repeatRefresh&&h._initted&&h.invalidate())),g!==m||f||h._zTime===Ie||!d&&h._zTime){if(h._initted||!U(h,d,f,p)){for(u=h._zTime,h._zTime=d||(p?Ie:0),p=p||d&&!u,h.ratio=g,h._from&&(g=1-g),h._time=0,h._tTime=b,c=h._pt;c;)c.r(g,c.d),c=c._next;h._startAt&&d<0&&h._startAt.render(d,!0,!0),h._onUpdate&&!p&&J(h,"onUpdate"),b&&h._repeat&&!p&&h.parent&&J(h,"onRepeat"),(d>=h._tDur||d<0)&&h.ratio===g&&(g&&xt(h,1),p||(J(h,g?"onComplete":"onReverseComplete",!0),h._prom&&h._prom()))}}else h._zTime||(h._zTime=d)}return this}},{key:"targets",value:function(){return this._targets}},{key:"invalidate",value:function(){return this._pt=this._op=this._startAt=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(),n(l(t.prototype),"invalidate",this).call(this)}},{key:"kill",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"all";if(!(e||t&&"all"!==t))return this._lazy=this._pt=0,this.parent?$(this):this;if(this.timeline)return d=this.timeline.totalDuration(),this.timeline.killTweensOf(e,t,rr&&!0!==rr.vars.overwrite)._first||$(this),this.parent&&d!==this.timeline.totalDuration()&&N(this,this._dur*this.timeline._tDur/d,0,1),this;var r,n,a,i,s,o,l,c=this._targets,u=e?Pt(e):c,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}(c,u))return"all"===t&&(this._pt=0),$(this);for(r=this._op=this._op||[],"all"!==t&&(Ve(t)&&(s={},M(t,(function(e){return s[e]=1})),t=s),t=function(e,t){var r,n,a,i,s=(e=e[0]?ft(e[0]).harness:0)&&e.aliases;if(!s)return t;for(n in r=k({},t),s)if(n in r)for(a=(i=s[n].split(",")).length;a--;)r[i[a]]=r[n];return r}(c,t)),l=c.length;l--;)if(~u.indexOf(c[l]))for(s in n=h[l],"all"===t?(r[l]=t,i=n,a={}):(a=r[l]=r[l]||{},i=t),i)(o=n&&n[s])&&("kill"in o.d&&!0!==o.d.kill(s)||yt(this,o,"_pt"),delete n[s]),"all"!==a&&(a[s]=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 G(1,arguments)}},{key:"delayedCall",value:function(e,r,n,a){return new t(r,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:e,onComplete:r,onReverseComplete:r,onCompleteParams:n,onReverseCompleteParams:n,callbackScope:a})}},{key:"fromTo",value:function(e,t,r){return G(2,arguments)}},{key:"set",value:function(e,r){return r.duration=0,r.repeatDelay||(r.repeat=0),new t(e,r)}},{key:"killTweensOf",value:function(e,t,r){return le.killTweensOf(e,t,r)}}]),t}()),dr=(vt(hr.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),M("staggerTo,staggerFrom,staggerFromTo",(function(e){hr[e]=function(){var t=new ir,r=kt.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 Ge(e[t])?pr:m(e[t])&&e.setAttribute?Xt:dr},gr=function(e,t){return t.set(t.t,t.p,Math.round(1e6*(t.s+t.c*e))/1e6,t)},vr=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},br=function(e){for(var t,r,n,a,i=e._pt;i;){for(t=i._next,r=n;r&&r.pr>i.pr;)r=r._next;(i._prev=r?r._prev:a)?i._prev._next=i:n=i,(i._next=r)?r._prev=i:a=i,i=t}e._pt=n},yr=function(){function e(t,r,n,a,i,s,o,l,c){h(this,e),this.t=r,this.s=a,this.c=i,this.p=n,this.r=s||gr,this.d=o||this,this.set=l||dr,this.pr=c||0,(this._next=t)&&(t._prev=this)}return u(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=(M(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 it[e]=1})),rt.TweenMax=rt.TweenLite=hr,rt.TimelineLite=rt.TimelineMax=ir,le=new ir({sortChildren:!1,defaults:Re,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Ce.stringFilter=function(e){var t=e.join(" ");if(Bt.lastIndex=0,Bt.test(t))return t=Ut.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=Ge(e),n=(r=t&&!r&&e.init?function(){this._props=[]}:e,{init:w,render:Yt,add:or,kill:$t,modifier:Jt,rawVars:0}),a={targetTest:0,get:0,getSetter:mr,aliases:{},register:0};if(Ft(),e!==r){if(lt[t])return;vt(r,vt(bt(e,n),a)),k(r.prototype,k(n,bt(e,a))),lt[r.prop=t]=r,e.targetTest&&(ht.push(r),it[t]=1),t=("css"===t?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}x(t,r),e.register&&e.register(Sr,r,yr)}))},timeline:function(e){return new ir(e)},getTweensOf:function(e,t){return le.getTweensOf(e,t)},getProperty:function(e,t,r,n){Ve(e)&&(e=Pt(e)[0]);var a=ft(e||{}).get,i=r?E:_;return"native"===r&&(r=""),e&&(t?i((lt[t]&<[t].get||a)(e,t,r,n)):function(t,r,n){return i((lt[t]&<[t].get||a)(e,t,r,n))})},quickSetter:function(e,t,r){var n,a;if(1<(e=Pt(e)).length)return n=e.map((function(e){return Sr.quickSetter(e,t,r)})),a=n.length,function(e){for(var t=a;t--;)n[t](e)};e=e[0]||{};var i=lt[t],s=ft(e),o=s.harness&&(s.harness.aliases||{})[t]||t,l=i?function(t){var n=new i;fe._pt=0,n.init(e,r?t+r:t,fe,0,[e]),n.render(1,n),fe._pt&&Yt(1,fe)}:s.set(e,o);return i?l:function(t){return l(e,o,r?t+r:t,s,1)}},isTweening:function(e){return 0<le.getTweensOf(e,!0).length},defaults:function(e){return e&&e.ease&&(e.ease=Ht(e.ease,Re.ease)),D(Re,e||{})},config:function(e){return D(Ce,e||{})},registerEffect:function(e){var t=e.name,r=e.effect,n=e.plugins,a=e.defaults;e=e.extendTimeline,(n||"").split(",").forEach((function(e){return e&&!lt[e]&&!rt[e]&&y(t+" effect requires "+e+" plugin.")})),ct[t]=function(e,t,n){return r(Pt(e),vt(t||{},a),n)},e&&(ir.prototype[t]=function(e,r,n){return this.add(ct[t](e,We(r)?r:(n=r)&&{},this),n)})},registerEase:function(e,t){Nt[e]=Ht(t)},parseEase:function(e,t){return arguments.length?Ht(e,t):Nt},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,a=new ir(r);for(a.smoothChildTiming=qe(r.smoothChildTiming),le.remove(a),a._dp=0,a._time=a._tTime=le._time,e=le._first;e;)t=e._next,!n&&!e._dur&&e instanceof hr&&e.vars.onComplete===e._targets[0]||I(a,e,e._start-e._delay),e=t;return I(le,a,0),a},utils:{wrap:function e(t,r,n){var a=r-t;return Ze(t)?X(t,e(0,t.length),r):_t(n,(function(e){return(a+(e-t)%a)%a+t}))},wrapYoyo:function e(t,r,n){var a=r-t,i=2*a;return Ze(t)?X(t,e(0,t.length-1),r):_t(n,(function(e){return t+(a<(e=(i+(e-t)%i)%i||0)?i-e:e)}))},distribute:W,random:Z,snap:K,normalize:function(e,t,r){return Q(e,t,0,1,r)},getUnit:Et,clamp:function(e,t,r){return _t(r,(function(r){return H(e,t,r)}))},splitColor:Lt,toArray:Pt,selector:function(e){return e=Pt(e)[0]||y("Invalid scope")||{},function(t){var r=e.current||e.nativeElement||e;return Pt(t,r.querySelectorAll?r:r===e?y("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||Et(r))}},interpolate:function e(t,r,n,a){var i=isNaN(t+r)?0:function(e){return(1-e)*t+e*r};if(!i){var s,o,l,c,u,h=Ve(t),d={};if(!0===n&&(a=1)&&(n=null),h)t={p:t},r={p:r};else if(Ze(t)&&!Ze(r)){for(l=[],c=t.length,u=c-2,o=1;o<c;o++)l.push(e(t[o-1],t[o]));c--,i=function(e){e*=c;var t=Math.min(u,~~e);return l[t](e-t)},n=r}else a||(t=k(Ze(t)?[]:{},t));if(!l){for(s in r)or.call(d,t,s,"get",r[s]);i=function(e){return Yt(e,d),h?t.p:t}}}return _t(n,i)},shuffle:At},install:b,effects:ct,ticker:jt,updateRoot:ir.updateRoot,plugins:lt,globalTimeline:le,core:{PropTween:yr,globals:x,Tween:hr,Timeline:ir,Animation:ar,getCache:ft,_removeLinkedListItem:yt,suppressOverwrites:function(e){return oe=e}}}),wr=(M("to,from,fromTo,delayedCall,set,killTweensOf",(function(e){return xr[e]=hr[e]})),jt.add(ir.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}),Sr=xr.registerPlugin({name:"attr",init:function(e,t,r,n,a){var i,s;for(i in t)(s=this.add(e,"setAttribute",(e.getAttribute(i)||0)+"",t[i],n,a,0,0,i))&&(s.op=i),this._props.push(i)}},{name:"endArray",init:function(e,t){for(var r=t.length;r--;)this.add(e,r,e[r]||0,t[r])}},tr("roundProps",q),tr("modifiers"),tr("snap",K))||xr;hr.version=ir.version=Sr.version="3.9.1",de=1,g()&&Ft(),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},4230:(e,t,r)=>{r.d(t,{N:()=>o,Z:()=>s});var n=r(8881),a=r(1794),i=r(6272);class s{constructor(e){this.mode="PerspectiveCamera",this.oCam=this.createOrthographic(),this.pCam=this.create(),this.onInited=()=>{this.runScene.cb.events.model.addOptions.cb({name:"camera",map:{parse:e=>{e.childs.map((e=>{this.setTemp(e)}))}}})},this.clean=()=>{this.temp.clear()},this.backgroudDom=null,this.temp=new a.Z,this.pointerDown=()=>{var e;null!=(e=this.animaIns)&&e.kill()},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")})),this.runScene.cb.events.pointer.down.add("camera",this.pointerDown),this.runScene.cb.clean.add("camera",this.clean),this.runScene.cb.inited.add("camera",this.onInited)}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;e.near=.1,e.far=1e3,e.fov=50,t.target.set(0,0,0),t.update(),e.updateProjectionMatrix()}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()}addTemp(e){var{name:e,data:t}=e;this.temp.set(e,{name:e,data:t})}delTemp(e){this.temp.delete(e)}getLocal(){var{camera:e,controls:t}=this.runScene.assetsEx,{x:e,y:r,z:n}=e.position,{x:t,y:a,z:i}=t.target;return{x:e,y:r,z:n,tx:t,ty:a,tz:i}}setTemp(e,t){return(e=this.temp.get(e))?this.anima(e.data,t):Promise.resolve()}anima(e,t){return new Promise((r=>{const{time:n,onComplete:a,onUpdate:s}=t||{},{camera:o,controls:l}=this.runScene.assetsEx;this.animaIns&&(this.animaIns.kill(),this.animaIns=null),this.animaIns=(0,i.gY)(this.getLocal(),e,n||.5,(e=>{var{x:t,y:r,z:n,tx:a,ty:i,tz:c}=e;o.position.set(t,r,n),l.target.set(a,i,c),l.update(),null!=s&&s(e)}),(()=>{null!=a&&a(),r(0)}))}))}static toJSON(e){const t=e.assetsEx.camera;return{temp:e.cameraEx.temp.toJSON(),camera:t.toJSON()}}}const o=e=>null==e?void 0:e.isCamera},4330:(e,t,r)=>{r.d(t,{sG:()=>n,zX:()=>a});const n=["map","normalMap","aoMap"],a=["map","metalnessMap","roughnessMap","normalMap","aoMap","emissiveMap","alphaMap","lightMap","envMap","displacementMap"]},3263:(e,t,r)=>{r.d(t,{F6:()=>n,YD:()=>c});var n={};r.r(n),r.d(n,{filter:()=>a,isDef:()=>l,isEmpty:()=>i,notEmpty:()=>s,random:()=>o});const a=e=>e.filter((e=>e)),i=e=>0===e.length,s=e=>0!==e.length,o=e=>{var t=Math.random()*e.length;return e[Math.floor(t)]},l=(e,t)=>{for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!0;return!1};r(1794),r(272);var c=r(7201)},1794:(e,t,r)=>{r.d(t,{Z:()=>a});var n=r(6001);class a extends Map{constructor(e){e?super((0,n.mapObj)(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[r]=t})),e}toString(){return JSON.stringify(this.map)}filter(e,t){let r=[];for(var[n,a]of this.entries())e(n,a)&&r.push("key"===t?n:a);return r}find(e){for(var[t,r]of this.entries())if(e(t,r))return r}static formJSON(e){return new a(e)}copy(e){e.map(((e,t)=>this.set(e,t)))}}},7201:(e,t,r)=>{r.r(t),r.d(t,{is:()=>i,isDef:()=>a,logObj:()=>u,objToStr:()=>c,replaceKVForObj:()=>o,replaceKeyForObj:()=>l,replaceValForObj:()=>s});var n=r(6001);const a=(e,t)=>{if(!i(e))return!0;var r=Object.keys(e);for(let o=0;o<r.length;o++){var n=r[o],s=e[n];if(n=t[n],i(s))return!i(n)||a(s,n);if(s!==n)return!0}return!1},i=e=>(null==e?void 0:e.constructor)===Object,s=(e,t)=>{let r={};return Object.keys(e).map(((n,a)=>{var i=e[n];r[n]=t(n,i,a)})),r},o=(e,t)=>{let r={};return Object.keys(e).map(((n,a)=>{var i=e[n],{k:n,v:i}=t(n,i,a);r[n]=i})),r},l=(e,t)=>{let r={};return Object.keys(e).map(((n,a)=>{var i=e[n];r[t(n,i,a)]=i})),r},c=e=>{let t="";return(0,n.mapObj)(e,((e,r)=>{t=(t+=e+":")+(i(r)?c(r):r)})),t},u=e=>{console.log(c(e))}},272:(e,t,r)=>{r.d(t,{Z:()=>n});class n extends Set{constructor(e){super(),this.isSet=!0,null!=e&&e.map((e=>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}toJSON(){return this.toArray()}}},5247:(e,t,r)=>{r.d(t,{Z:()=>n});const n=t=r(8881)},7625:(e,t,r)=>{r.d(t,{Z:()=>n});class n{constructor(e){this.runScene=e}}},7585:(e,t,r)=>{r.d(t,{Z:()=>u});var n=r(5247),a=r(3736),i=r(1398),s=r(3729),o=r(4457);t=r(7625);const l={far:1e5,near:.5,mapSizeX:512,scaleX:1,targetPosition:{x:0,y:-10,z:0}},c={position:{type:"v3",val:{x:0,y:10,z:0},shortKey:"p"},intensity:{type:"number",val:1,shortKey:"i"},visible:{type:"other",val:!0,shortKey:"v"},color:{type:"color",val:{r:1,g:1,b:1},shortKey:"c"}};class u extends t.Z{static toJSON(e){const{intensity:t,name:r,type:n,position:a,visible:i,color:o,castShadow:l,shadow:c,rotation:u,target:h}=e;var{mapSize:d,camera:p}=c,{scale:p,near:f,far:m}=p;return{type:n,intensity:t,name:r,visible:i,color:o.getHexString(),castShadow:l,shadow:{mapSize:d.x,camera:{near:f,far:m,scale:p.x}},id:(0,s.Ki)(e),position:{x:a.x,y:a.y,z:a.z},rotation:{x:u.x,y:u.y,z:u.z},targetPosition:{x:h.position.x,y:h.position.y,z:h.position.z}}}parseJSON(e,t){t=this.runScene.lightEx.get("DirectionalLight",t);var[r]=t;return u.setConfig(r,e),(0,a.M)(r,"id",e.id),t}get(e){return this.runScene.lightEx.get("DirectionalLight",e)}static setConfig(e,t){const{intensity:r,position:a,rotation:i,targetPosition:s,name:o,visible:l,color:c,castShadow:u,shadow:h}=t;var{mapSize:t,camera:d}=h,{scale:d,near:p,far:f}=d;e.intensity=r,e.name=o,e.visible=l,e.castShadow=u,e.color=new n.Z.Color(c.includes(c)?c:"#"+c),a&&e.position.set(a.x,a.y,a.z),i&&e.rotation.set(i.x,i.y,i.z),s&&e.target.position.set(s.x,s.y,s.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=p,e.shadow.camera.far=f,e.shadow.camera.updateProjectionMatrix(),null!=(t=e.cameraHelper)&&t.update()}}u.snapshot={create:e=>{const t=i.LV.getDiff(c,e);var r=e.shadow,{mapSize:r,camera:n}=r,{scale:n,near:a,far:s}=n,{x:e,y:u,z:h}=e.target.position;return(0,o.isDef)(r.x,l.mapSizeX)&&(t.m=r.x),(0,o.isDef)({x:e,y:u,z:h},l.targetPosition)&&(t.tp={x:e,y:u,z:h}),(0,o.isDef)(n.x,l.scaleX)&&(t.s=n.x),(0,o.isDef)(a,l.near)&&(t.n=a),(0,o.isDef)(s,l.far)&&(t.f=s),t},set:e=>{const{map:t,light:r,runScene:n,data:a}=e,{m:s,tp:o,s:u,n:h,f:d}=(i.LV.set({def:c,data:a,runScene:n,map:t,target:r}),a);t.data.completedCbs.push((()=>{var{far:e,near:t,mapSizeX:n,scaleX:a,targetPosition:i}=l,{x:i,y:c,z:p}=o||i,i=(r.target.position.set(i,c,p),s||n),c=(r.shadow.mapSize.x=i,r.shadow.mapSize.y=i,u||a);r.shadow.camera.scale.x=c,r.shadow.camera.scale.y=c,r.shadow.camera.scale.z=c,r.shadow.camera.near=h||t,r.shadow.camera.far=d||e,r.shadow.camera.updateProjectionMatrix(),null!=(p=r.cameraHelper)&&p.update()}))}}},1269:(e,t,r)=>{r.d(t,{ZP:()=>k,RQ:()=>D});var n=r(6001),a=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 s(e,t){return(s=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"===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 l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c=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&&s(t,e);var r=o(n);function n(e,t){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");var i=new a.BufferGeometry,s=(i.setAttribute("position",new a.Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),i.computeBoundingSphere(),new a.LineBasicMaterial({fog:!1}));return((i=r.call(this,i,s)).light=e,i.color=t,i.type="RectAreaLightHelper",s=new a.BufferGeometry).setAttribute("position",new a.Float32BufferAttribute([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),s.computeBoundingSphere(),i.add(new a.Mesh(s,new a.MeshBasicMaterial({side:a.BackSide,fog:!1}))),i}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}(a.Line),u=r(5247),h=r(3736),d=r(1398),p=r(3729);t=r(7625);const f={intensity:{type:"number",val:1,shortKey:"i"},visible:{type:"other",val:!0,shortKey:"v"},color:{type:"color",val:{r:1,g:1,b:1},shortKey:"c"}};class m extends t.Z{get(){}static toJSON(e){const{type:t,intensity:r,name:n,visible:a,color:i}=e;return{type:t,intensity:r,name:n,visible:a,id:(0,p.Ki)(e),color:i.getHexString()}}parseJSON(e){var t=this.runScene.lightEx.get("AmbientLight");const[r]=t;var{type:e,intensity:n,name:a,visible:i,color:s,id:o}=e;return r.intensity=n,r.type=e,r.name=a,r.visible=i,r.color=new u.Z.Color("#"+s),(0,h.M)(r,"id",o),t}}m.snapshot={create:e=>d.LV.getDiff(f,e),set:e=>{var{map:e,light:t,runScene:r,data:n}=e;d.LV.set({def:f,data:n,runScene:r,map:e,target:t})}};var g=r(7585);class v extends t.Z{get(){throw new Error("Method not implemented.")}static toJSON(e){const{type:t,intensity:r,name:n,visible:a,color:i,groundColor:s,position:o}=e;return{name:n,id:(0,p.Ki)(e),type:t,intensity:r,visible:a,position:{x:o.x,y:o.y,z:o.z},groundColor:s.getHexString(),color:i.getHexString()}}parseJSON(e){var t=this.runScene.lightEx.get("HemisphereLight");const[r]=t;var{type:e,intensity:n,name:a,visible:i,color:s,groundColor:o,id:l,position:c}=e;return r.type=e,r.intensity=n,r.name=a,r.visible=i,r.color=new u.Z.Color("#"+s),r.groundColor=new u.Z.Color("#"+o),r.position.set(c.x,c.y,c.z),(0,h.M)(r,"id",l),t}}class b extends t.Z{get(){throw new Error("Method not implemented.")}static toJSON(e){const{name:t,type:r,intensity:n,distance:a,decay:i,renderOrder:s,color:o,visible:l,castShadow:c,shadow:u,position:h}=e;var{mapSize:d,camera:f,bias:m,radius:g}=u,{scale:f,near:v,far:b}=f;return{name:t,type:r,intensity:n,visible:l,color:o.getHexString(),castShadow:c,id:(0,p.Ki)(e),distance:a,decay:i,renderOrder:s,shadow:{mapSize:d.x,camera:{near:v,far:b,scale:f.x},radius:g,bias:m},position:{x:h.x,y:h.y,z:h.z}}}parseJSON(e){var t=this.runScene.lightEx.get("PointLight");const[r]=t;var{name:e,type:n,intensity:a,distance:i,decay:s,renderOrder:o,color:l,visible:c,castShadow:d,shadow:p,position:f,id:m}=e,{mapSize:p,camera:g,bias:v,radius:b}=p,{scale:g,near:y,far:x}=g;return r.intensity=a,r.type=n,r.name=e,r.visible=c,r.castShadow=d,r.distance=i,r.renderOrder=o,r.color=new u.Z.Color("#"+l),r.position.set(f.x,f.y,f.z),r.shadow.mapSize.x=p,r.shadow.mapSize.y=p,r.shadow.bias=v,r.decay=s,r.shadow.radius=b,r.shadow.camera.scale.x=g,r.shadow.camera.scale.y=g,r.shadow.camera.scale.z=g,r.shadow.camera.near=y,(0,h.M)(r,"id",m),r.shadow.camera.far=x,r.shadow.camera.updateProjectionMatrix(),t}}class y{constructor(e){this.runScene=e}static toJSON(e){const{type:t,intensity:r,name:n,visible:a,color:i,position:s}=e;return{name:n,type:t,intensity:r,id:(0,p.Ki)(e),visible:a,position:{x:s.x,y:s.y,z:s.z},color:i.getHexString()}}parseJSON(e){var t=this.runScene.lightEx.get("RectAreaLight");const[r]=t;var{type:e,intensity:n,name:a,visible:i,color:s,position:o,id:l}=e;return r.type=e,(0,h.M)(r,"id",l),r.intensity=n,r.name=a,r.visible=i,r.color=new u.Z.Color("#"+s),r.position.set(o.x,o.y,o.z),t}}class x{constructor(e){this.runScene=e}static toJSON(e){const{name:t,type:r,color:n,distance:a,decay:i,intensity:s,angle:o,penumbra:l,visible:c,castShadow:u,shadow:h,renderOrder:d,position:f,target:m}=e;var{bias:g,camera:v,normalBias:b,mapSize:y,radius:x}=h,v=v.near;return{type:r,intensity:s,name:t,visible:c,distance:a,angle:o,id:(0,p.Ki)(e),decay:i,penumbra:l,renderOrder:d,color:n.getHexString(),castShadow:u,shadow:{bias:g,normalBias:b,mapSize:y.x,camera:{near:v},radius:x},position:{x:f.x,y:f.y,z:f.z},targetPosition:{x:m.position.x,y:m.position.y,z:m.position.z}}}parseJSON(e){var t=this.runScene.lightEx.get("SpotLight");const[r]=t;var{name:e,type:n,color:a,distance:i,decay:s,intensity:o,angle:l,penumbra:c,visible:d,castShadow:p,shadow:f,renderOrder:m,id:g,position:v,targetPosition:b}=e,{bias:f,camera:y,normalBias:x,mapSize:w,radius:S}=f,y=y.near;return r.intensity=o,r.type=n,r.name=e,r.visible=d,r.distance=i,r.decay=s,r.angle=l,r.penumbra=c,r.renderOrder=m,r.castShadow=p,r.color=new u.Z.Color("#"+a),r.position.set(v.x,v.y,v.z),r.shadow.mapSize.x=w,r.shadow.mapSize.y=w,r.shadow.camera.near=y,r.target.position.set(b.x,b.y,b.z),r.shadow.bias=f,r.shadow.normalBias=x,r.shadow.radius=S,(0,h.M)(r,"id",g),r.shadow.camera.updateProjectionMatrix(),t}}var w=r(8715),S=r(3735),M=r(2510),T=r(7169),_=r(4457);const E={DirectionalLight:g.Z,PointLight:b,SpotLight:x,RectAreaLight:y,HemisphereLight:v,AmbientLight:m};class k{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.snapshot={create:e=>{const t=this.runScene.assetsEx.scene.children.filter((e=>this.isLight(e)&&!(0,w.isHelper)(e))),r={};t.map((e=>{var t=e.type,n=(0,p.Ki)(e),a=null==(a=null==(t=E[t].snapshot)?void 0:t.create)?void 0:a.call(t,e);a&&n&&(r[n]=a)})),e.data.set("light",r)},set:e=>{var t=e.snapshot.data.get("light");t&&(0,n.mapObj)(t,((t,r)=>{var n,a=((t=this.runScene.modelEx.getById(t))||{}).type;a&&null!=(n=null==(a=E[a].snapshot)?void 0:a.set)&&n.call(a,{data:r,runScene:this.runScene,light:t,map:e})}))}},this.runScene=e,this.lightExMap={DirectionalLight:new g.Z(e),PointLight:new b(e),SpotLight:new x(e),RectAreaLight:new y(e),HemisphereLight:new v(e),AmbientLight:new m(e)},e.cb.snapshot.create.add("light",this.snapshot.create),e.cb.snapshot.set.add("light",this.snapshot.set)}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:!!D(e)&&t.select,addUndo:!1})))),t.addUndo&&this.runScene.undoEx.addUndo(e)}get(e,t){t=(0,_.mergeObject)({id:(0,n.getId)()},t).id;let r=new u.Z[e],a=[r];return r.position.y=10,r.name=e,r.userData.id=t,this.shadowList.includes(e)&&(r.castShadow=!0),this.setLight(r),a.push(...this.setLightHelper(r)),null!=(t=null==r?void 0:r.lightHelper)&&t.update(),a}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 r;return this.runScene.helperEx.unfocus(),r="DirectionalLight"===e.type||"SpotLight"===e.type?[e,e.cameraHelper,e.helper].map((t=>{if(t)return new T.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 T.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=(0,p.Ki)(t);let n,a=[];switch(e){case"RectAreaLight":n=new c(t,16773120);break;case"DirectionalLight":if(n=new u.Z.DirectionalLightHelper(t,1,16711680),t.children[0])t.target=t.children[0];else{let e=new u.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 u.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,e.visible=!1,t.cameraHelper=e,a.push(e);break;case"PointLight":n=new u.Z.PointLightHelper(t,1,16711935);break;case"SpotLight":n=new u.Z.SpotLightHelper(t);let i=new u.Z.Object3D;(t.target=i).name="helperModel",i.userData.isLightTarget=!0,i.userData.light=t,i.position.y=-10,t.shadow.autoUpdate=!0,t.add(i);const s=new u.Z.CameraHelper(t.shadow.camera);t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(s,!0,(e=>{e.userData.id=r})),s.userData.id=r,s.visible=!1,t.cameraHelper=s,a.push(s);break;case"HemisphereLight":n=new u.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,this.update(t),a.push(n),a}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:r,val:n,cb:a}=e;return new M.Z({target:e,runScene:this.runScene,info:r,oldVal:e[r],newVal:n,cb:a}).execute()}setMultip(e,t,r=!0,n=!0){if(e instanceof Array)return a=e.map((e=>{var{model:e,typeList:n,newVal:a}=e;const i=new S.Z({target:e,typeList:n,newVal:a,cb:t});return r?i.execute():i})),n&&this.runScene.undoEx.addUndo(a),a;{var{model:a,typeList:e,newVal:i}=e;const s=new S.Z({target:a,typeList:e,newVal:i,cb:t});return n&&this.runScene.undoEx.addUndo(s),r?s.execute():s}}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,w.isHelper)(e))).map((e=>{var t=e.type;return E[t].toJSON(e)}))}}const D=e=>null==(e=null==e?void 0:e.userData)?void 0:e.isLight},2353:(e,t,r)=>{r.d(t,{B:()=>Le,Z:()=>Re});var n=r(8881),a=(t=r(3300),r.n(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)}r(6001);var s=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,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!==("undefined"==typeof WebAssembly?"undefined":i(WebAssembly)))return{supported:!1};var r,n=WebAssembly.validate(e)?"b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgohAaoclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb":"b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb",a=WebAssembly.instantiate(s(n),{}).then((function(e){(r=e.instance).exports.__wasm_call_ctors()}));function s(e){for(var r=new Uint8Array(e.length),n=0;n<e.length;++n){var a=e.charCodeAt(n);r[n]=96<a?a-97:64<a?a-39:a+4}var i=0;for(n=0;n<e.length;++n)r[i++]=r[n]<60?t[r[n]]:64*(r[n]-60)+r[++n];return r.buffer.slice(0,i)}function o(e,t,n,a,i,s){var o=r.exports.sbrk,l=n+3&-4,c=o(l*a),u=o(i.length),h=new Uint8Array(r.exports.memory.buffer);if(0==(h.set(i,u),e=e(c,n,a,u,i.length))&&s&&s(c,l,a),t.set(h.subarray(c,c+n*a)),o(c-o(0)),0!=e)throw new Error("Malformed buffer data: "+e)}var l={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},c={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},u=[],h=0;return{ready:a,supported:!0,useWorkers:function(e){!function(e){for(var t="var instance; var ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(s(n))+"]), {}).then(function(result) { instance = result.instance; instance.exports.__wasm_call_ctors(); });self.onmessage = workerProcess;"+o.toString()+function(e){a.then((function(){var t=e.data;try{var n=new Uint8Array(t.count*t.size);o(r.exports[t.mode],n,t.count,t.size,t.source,r.exports[t.filter]),self.postMessage({id:t.id,count:t.count,action:"resolve",value:n},[n.buffer])}catch(n){self.postMessage({id:t.id,count:t.count,action:"reject",value:n})}}))}.toString(),i=(t=new Blob([t],{type:"text/javascript"}),URL.createObjectURL(t)),l=0;l<e;++l)u[l]=function(e){var t={object:new Worker(e),pending:0,requests:{}};return t.object.onmessage=function(e){e=e.data,t.pending-=e.count,t.requests[e.id][e.action](e.value),delete t.requests[e.id]},t}(i);URL.revokeObjectURL(i)}(e)},decodeVertexBuffer:function(e,t,n,a,i){o(r.exports.meshopt_decodeVertexBuffer,e,t,n,a,r.exports[l[i]])},decodeIndexBuffer:function(e,t,n,a){o(r.exports.meshopt_decodeIndexBuffer,e,t,n,a)},decodeIndexSequence:function(e,t,n,a){o(r.exports.meshopt_decodeIndexSequence,e,t,n,a)},decodeGltfBuffer:function(e,t,n,a,i,s){o(r.exports[c[i]],e,t,n,a,r.exports[l[s]])},decodeGltfBufferAsync:function(e,t,n,i,s){if(0<u.length){for(var d=e,p=t,f=n,m=c[i],g=l[s],v=u[0],b=1;b<u.length;++b)u[b].pending<v.pending&&(v=u[b]);return new Promise((function(e,t){var r=new Uint8Array(f),n=h++;v.pending+=d,v.requests[n]={resolve:e,reject:t},v.object.postMessage({id:n,count:d,size:p,source:r,mode:m,filter:g},[r.buffer])}))}return a.then((function(){var a=new Uint8Array(e*t);return o(r.exports[c[i]],a,e,t,n,r.exports[l[s]]),a}))}}}();function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){return(l=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,n=u(e);if(r=t?(r=u(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===o(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var h=new WeakMap,d=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=c(a);function a(e){if(this instanceof a)return(e=r.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=a,(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,r,a){var i=this,s=new n.FileLoader(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(e){i.decodeDracoFile(e,t).catch(a)}),r,a)}},{key:"decodeDracoFile",value:function(e,t,r,n){return 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,a=JSON.stringify(t);if(h.has(e)){if((s=h.get(e)).key===a)return s.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 i=this.workerNextTaskID++,s=e.byteLength;return s=this._getWorker(i,s).then((function(n){return r=n,new Promise((function(n,a){r._callbacks[i]={resolve:n,reject:a},r.postMessage({type:"decode",id:i,taskConfig:t,buffer:e},[e])}))})).then((function(e){return n._createGeometry(e.geometry)})),s.catch((function(){return!0})).then((function(){r&&i&&n._releaseTask(r,i)})),h.set(e,{key:a,promise:s}),s}},{key:"_createGeometry",value:function(e){var t=new n.BufferGeometry;e.index&&t.setIndex(new n.BufferAttribute(e.index.array,1));for(var r=0;r<e.attributes.length;r++){var a=(s=e.attributes[r]).name,i=s.array,s=s.itemSize;t.setAttribute(a,new n.BufferAttribute(i,s))}return t}},{key:"_loadLibrary",value:function(e,t){var r=new n.FileLoader(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise((function(t,n){r.load(e,t,void 0,n)}))}},{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":o(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 a=n.buffer,i=n.taskConfig;t.then((function(e){var t=new(e=e.draco).Decoder,r=new e.DecoderBuffer;r.Init(new Int8Array(a),a.byteLength);try{var s=function(e,t,r,n){var a,i=n.attributeIDs,s=n.attributeTypes,o=t.GetEncodedGeometryType(r);if(o===e.TRIANGULAR_MESH)a=new e.Mesh,v=t.DecodeBufferToMesh(r,a);else{if(o!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");a=new e.PointCloud,v=t.DecodeBufferToPointCloud(r,a)}if(!v.ok()||0===a.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+v.error_msg());var l,c,u,h,d,p,f,m,g,v,b,y,x,w={index:null,attributes:[]};for(l in i){var S=self[s[l]],M=void 0,T=void 0;if(n.useUniqueIDs)T=i[l],M=t.GetAttributeByUniqueId(a,T);else{if(-1===(T=t.GetAttributeId(a,e[i[l]])))continue;M=t.GetAttribute(a,T)}w.attributes.push((T=e,c=t,u=a,h=l,d=M.num_components(),f=(p=u.num_points()*d)*S.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}}(T,S),g=T._malloc(f),c.GetAttributeDataArrayForAllPoints(u,M,m,f,g),c=new S(T.HEAPF32.buffer,g,p).slice(),T._free(g),{name:h,array:c,itemSize:d}))}return o===e.TRIANGULAR_MESH&&(w.index=(r=e,v=t,y=4*(b=3*(o=a).num_faces()),x=r._malloc(y),v.GetTrianglesUInt32Array(o,y,x),v=new Uint32Array(r.HEAPF32.buffer,x,b).slice(),r._free(x),{array:v,itemSize:1})),e.destroy(a),w}(e,t,r,i),o=s.attributes.map((function(e){return e.array.buffer}));s.index&&o.push(s.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:s},o)}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,a=r.workerPool[r.workerPool.length-1];return a._taskCosts[e]=t,a._taskLoad+=t,a}))}},{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.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),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}),a}(n.Loader),p=r(4091),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 m=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 a=this,i=!1,s=0,o=0,l=void 0,c=[];this.onStart=void 0,this.onLoad=t,this.onProgress=r,this.onError=n,this.itemStart=function(e){o++,!1===i&&void 0!==a.onStart&&a.onStart(e,s,o),i=!0},this.itemEnd=function(e){s++,void 0!==a.onProgress&&a.onProgress(e,s,o),s===o&&(i=!1,void 0!==a.onLoad&&a.onLoad())},this.itemError=function(e){void 0!==a.onError&&a.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 c.push(e,t),this},this.removeHandler=function(e){return-1!==(e=c.indexOf(e))&&c.splice(e,2),this},this.getHandler=function(e){for(var t=0,r=c.length;t<r;t+=2){var n=c[t],a=c[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return a}return null}})));var g=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.manager=void 0!==t?t:m,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,a){r.load(e,n,t,a)}))}},{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 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 b(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 y(e,t){return(y=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 w=function(){var e=n,t=g;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 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=x(e);if(r=t?(r=x(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")}}(n);function n(e){if(this instanceof n)return(e=r.call(this,e)).isImageBitmapLoader=!0,"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,a){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,s=f.get(e);if(void 0!==s)return i.manager.itemStart(e),setTimeout((function(){t&&t(s),i.manager.itemEnd(e)}),0),s;var o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader,fetch(e,o).then((function(e){return e.blob()})).then((function(e){return Promise.all([new Promise((function(t){var r=(n=i.options).textureQuality,n=n.reverseTexture,s=a.notCompress,o=a.size,l=0===e.size?new ImageData(1,1):e;t(o&&1!==r?(o=(t=a.size).w,t=t.h,s=s?1:r,createImageBitmap(l,Object.assign(i.options,{imageOrientation:n?"none":"flipY",resizeHeight:t*s,resizeWidth:o*s}))):createImageBitmap(l,Object.assign(i.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,a,i=[],s=!0,o=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(i.push(n.value),2!==i.length);s=!0);}catch(e){o=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(o)throw a}}return i}}(e)||function(e,t){if(e){if("string"==typeof e)return b(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)?b(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],f.add(e,n),t&&t(n,r),i.manager.itemEnd(e)})).catch((function(t){console.log(t,"e"),n&&n(t),i.manager.itemError(e),i.manager.itemEnd(e)})),i.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}(),S=r(4457),M=r(6422);function T(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,a,i=[],s=!0,o=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(i.push(n.value),!t||i.length!==t);s=!0);}catch(e){o=!0,a=e}finally{try{s||null==r.return||r.return()}finally{if(o)throw a}}return i}}(e,t)||D(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 _(e){return(_="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:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=B(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 k(e,t){var r,n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=D(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 a,i=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){s=!0,a=e},f:function(){try{i||null==n.return||n.return()}finally{if(s)throw a}}}}function D(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}}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 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 C(e,t,r){return t&&O(e.prototype,t),r&&O(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function R(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&&L(e,t)}function L(e,t){return(L=Object.setPrototypeOf||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 r,n=B(e);if(r=t?(r=B(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===_(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 B(e){return(B=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var U=function(){R(t,n.Loader);var e=I(t);function t(r){return A(this,t),(r=e.call(this,r)).dracoLoader=null,r.ktx2Loader=null,r.meshoptDecoder=null,r.pluginCallbacks=[],r.register((function(e){return new G(e)})),r.register((function(e){return new Q(e)})),r.register((function(e){return new Y(e)})),r.register((function(e){return new W(e)})),r.register((function(e){return new q(e)})),r.register((function(e){return new K(e)})),r.register((function(e){return new Z(e)})),r.register((function(e){return new V(e)})),r.register((function(e){return new X(e)})),r.register((function(e){return new H(e)})),r.register((function(e){return new N(e)})),r.register((function(e){return new J(e)})),r.register((function(e){return new $(e)})),r}return C(t,[{key:"load",value:function(e,t,r,a){function i(t){a?a(t):console.error(t),s.manager.itemError(e),s.manager.itemEnd(e)}var s=this,o=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:n.LoaderUtils.extractUrlBase(e),l=(this.manager.itemStart(e),new n.FileLoader(this.manager));l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,(function(r){try{s.parse(r,o,(function(r){t(r),s.manager.itemEnd(e)}),i)}catch(r){i(r)}}),r,i)}},{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,r,n,a){var i,s={},o={},l=new TextDecoder;if("string"==typeof e)i=JSON.parse(e);else if(e instanceof ArrayBuffer)if(l.decode(new Uint8Array(e,0,4))===ee){try{s[F.KHR_BINARY_GLTF]=new te(e)}catch(e){return void(n&&n(e))}i=JSON.parse(s[F.KHR_BINARY_GLTF].content)}else i=JSON.parse(l.decode(e));else i=e;if(void 0===i.asset||i.asset.version[0]<2)n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else if(a.valid(i)){var c=new we(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder,ex:a});c.fileLoader.setRequestHeader(this.requestHeader);for(var u=0;u<this.pluginCallbacks.length;u++){var h=this.pluginCallbacks[u](c);s[(o[h.name]=h).name]=!0}if(i.extensionsUsed)for(var d=0;d<i.extensionsUsed.length;++d){var p=i.extensionsUsed[d],f=i.extensionsRequired||[];switch(p){case F.KHR_MATERIALS_UNLIT:s[p]=new z;break;case F.KHR_DRACO_MESH_COMPRESSION:s[p]=new re(i,this.dracoLoader);break;case F.KHR_TEXTURE_TRANSFORM:s[p]=new ne;break;case F.KHR_MESH_QUANTIZATION:s[p]=new ae;break;default:0<=f.indexOf(p)&&void 0===o[p]&&console.warn('THREE.GLTFLoader: Unknown extension "'+p+'".')}}c.setExtensions(s),c.setPlugins(o),c.parse(r,n)}}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,a){r.parse(e,t,n,a)}))}}]),t}();function j(){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 F={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"},N=function(){function e(t){A(this,e),this.parser=t,this.name=F.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return C(e,[{key:"_markDefs",value:function(){for(var e=this.parser,t=this.parser.json.nodes||[],r=0,n=t.length;r<n;r++){var a=t[r];a.extensions&&a.extensions[this.name]&&void 0!==a.extensions[this.name].light&&e._addNodeRef(this.cache,a.extensions[this.name].light)}}},{key:"_loadLight",value:function(e){var t=this.parser,r="light:"+e,a=t.cache.get(r);if(a)return a;var i,s=t.json,o=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e],l=new n.Color(16777215),c=(void 0!==o.color&&l.fromArray(o.color),void 0!==o.range?o.range:0);switch(o.type){case"directional":(i=new n.DirectionalLight(l)).target.position.set(0,0,-1),i.add(i.target);break;case"point":(i=new n.PointLight(l)).distance=c;break;case"spot":(i=new n.SpotLight(l)).distance=c,o.spot=o.spot||{},o.spot.innerConeAngle=void 0!==o.spot.innerConeAngle?o.spot.innerConeAngle:0,o.spot.outerConeAngle=void 0!==o.spot.outerConeAngle?o.spot.outerConeAngle:Math.PI/4,i.angle=o.spot.outerConeAngle,i.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,i.target.position.set(0,0,-1),i.add(i.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return i.position.set(0,0,0),i.decay=2,ve(i,o),void 0!==o.intensity&&(i.intensity=o.intensity),i.name=t.createUniqueName(o.name||"light_"+e),a=Promise.resolve(i),t.cache.add(r,a),a}},{key:"getDependency",value:function(e,t){if("light"===e)return this._loadLight(t)}},{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}(),z=function(){function e(){A(this,e),this.name=F.KHR_MATERIALS_UNLIT}return C(e,[{key:"getMaterialType",value:function(){return n.MeshBasicMaterial}},{key:"extendParams",value:function(e,t,r){var a,i=[];return e.color=new n.Color(1,1,1),e.opacity=1,(t=t.pbrMetallicRoughness)&&(Array.isArray(t.baseColorFactor)&&(a=t.baseColorFactor,e.color.fromArray(a),e.opacity=a[3]),void 0!==t.baseColorTexture&&i.push(r.assignTexture(e,"map",t.baseColorTexture,n.sRGBEncoding))),Promise.all(i)}}]),e}(),V=function(){function e(t){A(this,e),this.parser=t,this.name=F.KHR_MATERIALS_EMISSIVE_STRENGTH}return C(e,[{key:"extendMaterialParams",value:function(e,t){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?(void 0!==(e=e.extensions[this.name].emissiveStrength)&&(t.emissiveIntensity=e),Promise.resolve()):Promise.resolve()}}]),e}(),G=function(){function e(t){A(this,e),this.parser=t,this.name=F.KHR_MATERIALS_CLEARCOAT}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.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 a=[];return void 0!==(e=e.extensions[this.name]).clearcoatFactor&&(t.clearcoat=e.clearcoatFactor),void 0!==e.clearcoatTexture&&a.push(r.assignTexture(t,"clearcoatMap",e.clearcoatTexture)),void 0!==e.clearcoatRoughnessFactor&&(t.clearcoatRoughness=e.clearcoatRoughnessFactor),void 0!==e.clearcoatRoughnessTexture&&a.push(r.assignTexture(t,"clearcoatRoughnessMap",e.clearcoatRoughnessTexture)),void 0!==e.clearcoatNormalTexture&&(a.push(r.assignTexture(t,"clearcoatNormalMap",e.clearcoatNormalTexture)),void 0!==e.clearcoatNormalTexture.scale&&(r=e.clearcoatNormalTexture.scale,t.clearcoatNormalScale=new n.Vector2(r,r))),Promise.all(a)}}]),e}(),H=function(){function e(t){A(this,e),this.parser=t,this.name=F.KHR_MATERIALS_IRIDESCENCE}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.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]).iridescenceFactor&&(t.iridescence=e.iridescenceFactor),void 0!==e.iridescenceTexture&&n.push(r.assignTexture(t,"iridescenceMap",e.iridescenceTexture)),void 0!==e.iridescenceIor&&(t.iridescenceIOR=e.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==e.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=e.iridescenceThicknessMinimum),void 0!==e.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=e.iridescenceThicknessMaximum),void 0!==e.iridescenceThicknessTexture&&n.push(r.assignTexture(t,"iridescenceThicknessMap",e.iridescenceThicknessTexture)),Promise.all(n)}}]),e}(),W=function(){function e(t){A(this,e),this.parser=t,this.name=F.KHR_MATERIALS_SHEEN}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.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 a=[];return void 0!==(t.sheenColor=new n.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&&a.push(r.assignTexture(t,"sheenColorMap",e.sheenColorTexture,n.sRGBEncoding)),void 0!==e.sheenRoughnessTexture&&a.push(r.assignTexture(t,"sheenRoughnessMap",e.sheenRoughnessTexture)),Promise.all(a)}}]),e}(),q=function(){function e(t){A(this,e),this.parser=t,this.name=F.KHR_MATERIALS_TRANSMISSION}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.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}(),K=function(){function e(t){A(this,e),this.parser=t,this.name=F.KHR_MATERIALS_VOLUME}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){if(!(e=(a=this.parser).json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var r=[],a=(e=e.extensions[this.name],t.thickness=void 0!==e.thicknessFactor?e.thicknessFactor:0,void 0!==e.thicknessTexture&&r.push(a.assignTexture(t,"thicknessMap",e.thicknessTexture)),t.attenuationDistance=e.attenuationDistance||1/0,e.attenuationColor||[1,1,1]);return t.attenuationColor=new n.Color(a[0],a[1],a[2]),Promise.all(r)}}]),e}(),Z=function(){function e(t){A(this,e),this.parser=t,this.name=F.KHR_MATERIALS_IOR}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.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}(),X=function(){function e(t){A(this,e),this.parser=t,this.name=F.KHR_MATERIALS_SPECULAR}return C(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?n.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 a=[],i=(e=e.extensions[this.name],t.specularIntensity=void 0!==e.specularFactor?e.specularFactor:1,void 0!==e.specularTexture&&a.push(r.assignTexture(t,"specularIntensityMap",e.specularTexture)),e.specularColorFactor||[1,1,1]);return t.specularColor=new n.Color(i[0],i[1],i[2]),void 0!==e.specularColorTexture&&a.push(r.assignTexture(t,"specularColorMap",e.specularColorTexture,n.sRGBEncoding)),Promise.all(a)}}]),e}(),Q=function(){function e(t){A(this,e),this.parser=t,this.name=F.KHR_TEXTURE_BASISU}return C(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],a=t.options.ktx2Loader;if(a)return t.loadTextureImage(e,n.source,a);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}(),Y=function(){function e(t){A(this,e),this.parser=t,this.name=F.EXT_TEXTURE_WEBP,this.isSupported=null}return C(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 a=i.extensions[t],i=n.images[a.source],s=r.textureLoader;return i.uri&&null!==(i=r.options.manager.getHandler(i.uri))&&(s=i),this.detectSupport().then((function(i){if(i)return r.loadTextureImage(e,a.source,s);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}(),J=function(){function e(t){A(this,e),this.name=F.EXT_MESHOPT_COMPRESSION,this.parser=t}return C(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 e.then((function(e){var t=r.byteOffset||0,a=r.byteLength||0,i=r.count,s=r.byteStride,o=new Uint8Array(e,t,a);return n.decodeGltfBufferAsync?n.decodeGltfBufferAsync(i,s,o,r.mode,r.filter).then((function(e){return e.buffer})):n.ready.then((function(){var e=new ArrayBuffer(i*s);return n.decodeGltfBuffer(new Uint8Array(e),i,s,o,r.mode,r.filter),e}))}));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}(),$=function(){function e(t){A(this,e),this.name=F.EXT_MESH_GPU_INSTANCING,this.parser=t}return C(e,[{key:"createNodeMesh",value:function(e){var t=this,r=this.parser.json,a=r.nodes[e];if(!a.extensions||!a.extensions[this.name]||void 0===a.mesh)return null;var i,s=k(r.meshes[a.mesh].primitives);try{for(s.s();!(i=s.n()).done;){var o=i.value;if(o.mode!==le.TRIANGLES&&o.mode!==le.TRIANGLE_STRIP&&o.mode!==le.TRIANGLE_FAN&&void 0!==o.mode)return null}}catch(e){s.e(e)}finally{s.f()}var l,c=a.extensions[this.name].attributes,u=[],h={};for(l in c)!function(e){u.push(t.parser.getDependency("accessor",c[e]).then((function(t){return h[e]=t,h[e]})))}(l);return u.length<1?null:(u.push(this.parser.createNodeMesh(e)),Promise.all(u).then((function(e){var r,a=e.pop(),i=a.isGroup?a.children:[a],s=e[0].count,o=[],l=k(i);try{for(l.s();!(r=l.n()).done;){for(var c,u=r.value,d=new n.Matrix4,p=new n.Vector3,f=new n.Quaternion,m=new n.Vector3(1,1,1),g=new n.InstancedMesh(u.geometry,u.material,s),v=0;v<s;v++)h.TRANSLATION&&p.fromBufferAttribute(h.TRANSLATION,v),h.ROTATION&&f.fromBufferAttribute(h.ROTATION,v),h.SCALE&&m.fromBufferAttribute(h.SCALE,v),g.setMatrixAt(v,d.compose(p,f,m));for(c in h)"TRANSLATION"!==c&&"ROTATION"!==c&&"SCALE"!==c&&u.geometry.setAttribute(c,h[c]);n.Object3D.prototype.copy.call(g,u),g.frustumCulled=!1,t.parser.assignFinalMaterial(g),o.push(g)}}catch(e){l.e(e)}finally{l.f()}return a.isGroup?(a.clear(),a.add.apply(a,o),a):o[0]})))}}]),e}(),ee="glTF",te=C((function e(t){A(this,e),this.name=F.KHR_BINARY_GLTF,this.content=null,this.body=null;var r=new DataView(t,0,12),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(t.slice(0,4))),version:r.getUint32(4,!0),length:r.getUint32(8,!0)},this.header.magic!==ee)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 a=this.header.length-12,i=new DataView(t,12),s=0;s<a;){var o,l=i.getUint32(s,!0),c=(s+=4,i.getUint32(s,!0));s+=4,1313821514===c?(o=new Uint8Array(t,12+s,l),this.content=n.decode(o)):5130562===c&&(this.body=t.slice(o=12+s,o+l)),s+=l}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")})),re=function(){function e(t,r){if(A(this,e),!r)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=F.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=r,this.dracoLoader.preload()}return C(e,[{key:"decodePrimitive",value:function(e,t){var r,n,a=this.json,i=this.dracoLoader,s=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,l={},c={},u={};for(r in o){var h=pe[r]||r.toLowerCase();l[h]=o[r]}for(n in e.attributes){var d,p,f=pe[n]||n.toLowerCase();void 0!==o[n]&&(d=a.accessors[e.attributes[n]],p=ce[d.componentType],u[f]=p.name,c[f]=!0===d.normalized)}return t.getDependency("bufferView",s).then((function(e){return new Promise((function(t){i.decodeDracoFile(e,(function(e){for(var r in e.attributes){var n=e.attributes[r];void 0!==(r=c[r])&&(n.normalized=r)}t(e)}),l,u)}))}))}}]),e}(),ne=function(){function e(){A(this,e),this.name=F.KHR_TEXTURE_TRANSFORM}return C(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}(),ae=C((function e(){A(this,e),this.name=F.KHR_MESH_QUANTIZATION})),ie=function(){R(t,n.Interpolant);var e=I(t);function t(r,n,a,i){return A(this,t),e.call(this,r,n,a,i)}return C(t,[{key:"copySampleValue_",value:function(e){for(var t=this.resultBuffer,r=this.sampleValues,n=this.valueSize,a=e*n*3+n,i=0;i!==n;i++)t[i]=r[a+i];return t}},{key:"interpolate_",value:function(e,t,r,n){for(var a=this.resultBuffer,i=this.sampleValues,s=this.valueSize,o=2*s,l=3*s,c=n-t,u=e*l,h=u-l,d=-2*(t=(r=(n=(r-t)/c)*n)*n)+3*r,p=t-r,f=1-d,m=p-r+n,g=0;g!==s;g++){var v=i[h+g+s],b=i[h+g+o]*c,y=i[u+g+s],x=i[u+g]*c;a[g]=f*v+m*b+d*y+p*x}return a}}]),t}(),se=new n.Quaternion,oe=function(){R(t,ie);var e=I(t);function t(){return A(this,t),e.apply(this,arguments)}return C(t,[{key:"interpolate_",value:function(e,r,n,a){return e=E(B(t.prototype),"interpolate_",this).call(this,e,r,n,a),se.fromArray(e).normalize().toArray(e),e}}]),t}(),le={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},ce={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},ue={9728:n.NearestFilter,9729:n.LinearFilter,9984:n.NearestMipmapNearestFilter,9985:n.LinearMipmapNearestFilter,9986:n.NearestMipmapLinearFilter,9987:n.LinearMipmapLinearFilter},he={33071:n.ClampToEdgeWrapping,33648:n.MirroredRepeatWrapping,10497:n.RepeatWrapping},de={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},pe={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},fe={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},me={CUBICSPLINE:void 0,LINEAR:n.InterpolateLinear,STEP:n.InterpolateDiscrete};function ge(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 ve(e,t){void 0!==t.extras&&("object"===_(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function be(e){for(var t="",r=Object.keys(e).sort(),n=0,a=r.length;n<a;n++)t+=r[n]+":"+e[r[n]]+";";return t}function ye(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 xe=new n.Matrix4,we=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},a=(A(this,e),this.json=t,this.extensions={},this.plugins={},this.options=r,this.cache=new j,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},t=!(this.nodeNamesUsed={}),r=!1,-1);"undefined"!=typeof navigator&&(t=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),a=(r=-1<navigator.userAgent.indexOf("Firefox"))?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||t||r&&a<98?this.textureLoader=new n.TextureLoader(this.options.manager):this.textureLoader=new w(this.options.manager),this.options.ex.setTextureLoader(this.textureLoader),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new n.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.rgbeLoader=new M.x(this.options.manager),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}return C(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,a=this.extensions;this.cache.removeAll(),this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(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 i={scene:t[0][n.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:n.asset,parser:r,userData:{}};ge(a,i,n),ve(i,n),Promise.all(r._invokeAll((function(e){return e.afterRoot&&e.afterRoot(i)}))).then((function(){e(i)}))})).catch(t)}},{key:"_markDefs",value:function(){for(var e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[],n=0,a=t.length;n<a;n++)for(var i=t[n].joints,s=0,o=i.length;s<o;s++)e[i[s]].isBone=!0;for(var l=0,c=e.length;l<c;l++){var u=e[l];void 0!==u.mesh&&(this._addNodeRef(this.meshCache,u.mesh),void 0!==u.skin&&(r[u.mesh].isSkinnedMesh=!0)),void 0!==u.camera&&this._addNodeRef(this.cameraCache,u.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 a=r.clone();return function e(t,r){var a,i=n.associations.get(t),s=(null!=i&&n.associations.set(r,i),k(t.children.entries()));try{for(s.s();!(a=s.n()).done;){var o=T(a.value,2),l=o[0];e(o[1],r.children[l])}}catch(e){s.e(e)}finally{s.f()}}(r,a),a.name+="_instance_"+e.uses[t]++,a}},{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 a=e(t[n]);a&&r.push(a)}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._invokeOne((function(e){return e.loadNode&&e.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._invokeOne((function(e){return e.loadAnimation&&e.loadAnimation(t)}));break;case"camera":n=this.loadCamera(t);break;default:if(n=this._invokeOne((function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)})))break;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],r=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[F.KHR_BINARY_GLTF].body);var a=this.options;return new Promise((function(e,i){r.load(n.LoaderUtils.resolveURL(t.uri,a.path),e,void 0,(function(){i(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,r=this,a=this.json,i=this.json.accessors[e];if(void 0===i.bufferView&&void 0===i.sparse)return e=de[i.type],s=ce[i.componentType],t=!0===i.normalized,s=new s(i.count*e),Promise.resolve(new n.BufferAttribute(s,e,t));var s=[];return void 0!==i.bufferView?s.push(this.getDependency("bufferView",i.bufferView)):s.push(null),void 0!==i.sparse&&(s.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(s).then((function(e){var t,s=e[0],o=de[i.type],l=ce[i.componentType],c=l.BYTES_PER_ELEMENT,u=i.byteOffset||0,h=void 0!==i.bufferView?a.bufferViews[i.bufferView].byteStride:void 0,d=!0===i.normalized,p=h&&h!==c*o?(f=Math.floor(u/h),m="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+f+":"+i.count,(g=r.cache.get(m))||(t=new l(s,f*h,i.count*h/c),g=new n.InterleavedBuffer(t,h/c),r.cache.add(m,g)),new n.InterleavedBufferAttribute(g,o,u%h/c,d)):(t=null===s?new l(i.count*o):new l(s,u,i.count*o),new n.BufferAttribute(t,o,d));if(void 0!==i.sparse){var f=ce[i.sparse.indices.componentType],m=i.sparse.indices.byteOffset||0,g=i.sparse.values.byteOffset||0,v=new f(e[1],m,i.sparse.count*de.SCALAR),b=new l(e[2],g,i.sparse.count*o);null!==s&&(p=new n.BufferAttribute(p.array.slice(),p.itemSize,p.normalized));for(var y=0,x=v.length;y<x;y++){var w=v[y];if(p.setX(w,b[y*o]),2<=o&&p.setY(w,b[y*o+1]),3<=o&&p.setZ(w,b[y*o+2]),4<=o&&p.setW(w,b[y*o+3]),5<=o)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,a=(t=t.images[n],this.textureLoader);return t.uri&&null!==(r=r.manager.getHandler(t.uri))&&(a=r),this.loadTextureImage(e,n,a)}},{key:"loadTextureImage",value:function(e,t,r){var a=this,i=this.json,s=i.textures[e],o=i.images[t],l=(o.uri||o.bufferView)+":"+s.sampler;return this.textureCache[l]?this.textureCache[l]:(t=this.loadImageSource(t,r,e).then((function(t){t.flipY=!1,t.name=s.name||o.name||"";var r=(i.samplers||{})[s.sampler]||{};return t.magFilter=ue[r.magFilter]||n.LinearFilter,t.minFilter=ue[r.minFilter]||n.LinearMipmapLinearFilter,t.wrapS=he[r.wrapS]||n.RepeatWrapping,t.wrapT=he[r.wrapT]||n.RepeatWrapping,a.associations.set(t,{textures:e}),a.options.ex.loadTexture({texture:t,textureDef:s}),t})).catch((function(){return null})),this.textureCache[l]=t)}},{key:"loadImageSource",value:function(e,t,r){var a=this,i=this.json,s=this.options,o=i.textures[r];if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((function(e){return e.clone()}));var l=i.images[e],c=self.URL||self.webkitURL,u=l.uri||"";if(void 0!==l.bufferView)u=a.getDependency("bufferView",l.bufferView).then((function(e){var t=new Blob([e],{type:l.mimeType});return{sourceURI:u=c.createObjectURL(t),blob:t,bufferView:e}}));else if(void 0===l.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");return r=Promise.resolve(u).then((function(e){var r=e.sourceURI,i=e.blob;return e.bufferView,new Promise((function(e,l){var c,u;o.isHdr?((c=new FileReader).readAsDataURL(i),c.addEventListener("load",(function(t){t=t.target.result,a.rgbeLoader.loadAsync(t).then((function(t){t.userData.blob=i,e({texture:t,blob:i})}))}))):!0===t.isImageBitmapLoader?(c=function(t,r){(t=new n.Texture(t)).needsUpdate=!0,e({texture:t,blob:r})},t.load(n.LoaderUtils.resolveURL(r,s.path),c,void 0,l,o)):(u=s.ex.loadConfig.reverseTexture,(0,S.urlToCanvas)(r).then((function(t){var r=t.ctx,a=t.canvas,s=(t=t.img,new n.Texture(a));u?e(s):(r.clearRect(0,0,a.width,a.height),r.translate(0,a.height),r.scale(1,-1),r.drawImage(t,0,0,a.width,a.height),e({texture:s,blob:i}))})).catch(l))}))})).then((function(e){var t=e.texture;return e=e.blob,t.userData.url=u,t.userData.blob=e,t.userData.mimeType=l.mimeType||(0<(e=l.uri||"").search(/\.jpe?g($|\?)/i)||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":0<e.search(/\.webp($|\?)/i)||0===e.search(/^data\:image\/webp/)?"image/webp":"image/png"),t})).catch((function(e){throw console.log(e,"error"),console.error("THREE.GLTFLoader: Couldn't loadImageSource texture",u),e})),this.sourceCache[e]=r}},{key:"assignTexture",value:function(e,t,r,n){var a=this;return this.getDependency("texture",r.index).then((function(i){return i?(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."),a.extensions[F.KHR_TEXTURE_TRANSFORM]&&(s=void 0!==r.extensions?r.extensions[F.KHR_TEXTURE_TRANSFORM]:void 0)&&(o=a.associations.get(i),i=a.extensions[F.KHR_TEXTURE_TRANSFORM].extendTexture(i,s),a.associations.set(i,o)),void 0!==n&&(i.encoding=n),e[t]=i):null;var s,o}))}},{key:"assignFinalMaterial",value:function(e){var t,r,a=e.geometry,i=e.material,s=void 0===a.attributes.tangent,o=void 0!==a.attributes.color,l=void 0===a.attributes.normal;e.isPoints?(t="PointsMaterial:"+i.uuid,(r=this.cache.get(t))||(r=new n.PointsMaterial,n.Material.prototype.copy.call(r,i),r.color.copy(i.color),r.map=i.map,r.sizeAttenuation=!1,this.cache.add(t,r)),i=r):e.isLine&&(t="LineBasicMaterial:"+i.uuid,(r=this.cache.get(t))||(r=new n.LineBasicMaterial,n.Material.prototype.copy.call(r,i),r.color.copy(i.color),this.cache.add(t,r)),i=r),(s||o||l)&&(t="ClonedMaterial:"+i.uuid+":",s&&(t+="derivative-tangents:"),o&&(t+="vertex-colors:"),l&&(t+="flat-shading:"),(r=this.cache.get(t))||(r=i.clone(),o&&(r.vertexColors=!0),l&&(r.flatShading=!0),s&&(r.normalScale&&(r.normalScale.y*=-1),r.clearcoatNormalScale&&(r.clearcoatNormalScale.y*=-1)),this.cache.add(t,r),this.associations.set(r,this.associations.get(i)))),i.aoMap&&void 0===a.attributes.uv2&&void 0!==a.attributes.uv&&a.setAttribute("uv2",a.attributes.uv),this.options.ex.loadMaterial({material:i,materialDef:i.userData,model:e}),e.material=i}},{key:"getMaterialType",value:function(){return n.MeshStandardMaterial}},{key:"loadMaterial",value:function(e){var t,r,a=this,i=this.json,s=this.extensions,o=i.materials[e],l={},c=(i=[],(o.extensions||{})[F.KHR_MATERIALS_UNLIT]?(r=s[F.KHR_MATERIALS_UNLIT],t=r.getMaterialType(),i.push(r.extendParams(l,o,a))):(r=o.pbrMetallicRoughness||{},l.color=new n.Color(1,1,1),l.opacity=1,Array.isArray(r.baseColorFactor)&&(c=r.baseColorFactor,l.color.fromArray(c),l.opacity=c[3]),void 0!==r.baseColorTexture&&i.push(a.assignTexture(l,"map",r.baseColorTexture,n.sRGBEncoding)),l.metalness=void 0!==r.metallicFactor?r.metallicFactor:1,l.roughness=void 0!==r.roughnessFactor?r.roughnessFactor:1,void 0!==r.metallicRoughnessTexture&&(i.push(a.assignTexture(l,"metalnessMap",r.metallicRoughnessTexture)),i.push(a.assignTexture(l,"roughnessMap",r.metallicRoughnessTexture))),t=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),i.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,l)}))))),!0===o.doubleSided&&(l.side=n.DoubleSide),o.alphaMode||"OPAQUE");return"BLEND"===c?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,"MASK"===c&&(l.alphaTest=void 0!==o.alphaCutoff?o.alphaCutoff:.5)),void 0!==o.normalTexture&&t!==n.MeshBasicMaterial&&(i.push(a.assignTexture(l,"normalMap",o.normalTexture)),l.normalScale=new n.Vector2(1,1),void 0!==o.normalTexture.scale&&(r=o.normalTexture.scale,l.normalScale.set(r,r))),void 0!==o.occlusionTexture&&t!==n.MeshBasicMaterial&&(i.push(a.assignTexture(l,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(l.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&t!==n.MeshBasicMaterial&&(l.emissive=(new n.Color).fromArray(o.emissiveFactor)),void 0!==o.emissiveTexture&&t!==n.MeshBasicMaterial&&i.push(a.assignTexture(l,"emissiveMap",o.emissiveTexture,n.sRGBEncoding)),Promise.all(i).then((function(){var r=new t(l);return o.name&&(r.name=o.name),ve(r,o),a.associations.set(r,{materials:e}),o.extensions&&ge(s,r,o),r}))}},{key:"createUniqueName",value:function(e){for(var t=n.PropertyBinding.sanitizeNodeName(e||""),r=t,a=1;this.nodeNamesUsed[r];++a)r=t+"_"+a;return this.nodeNamesUsed[r]=!0,r}},{key:"loadGeometries",value:function(e){for(var t=this,r=this.extensions,a=this.primitiveCache,i=[],s=0,o=e.length;s<o;s++){var l=e[s],c=(u=void 0,u=(u=(c=l).extensions&&c.extensions[F.KHR_DRACO_MESH_COMPRESSION])?"draco:"+u.bufferView+":"+u.indices+":"+be(u.attributes):c.indices+":"+be(c.attributes)+":"+c.mode),u=a[c];u?i.push(u.promise):(u=void 0,u=l.extensions&&l.extensions[F.KHR_DRACO_MESH_COMPRESSION]?function(e){return r[F.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(r){return Se(r,e,t)}))}(l):Se(new n.BufferGeometry,l,t),a[c]={primitive:l,promise:u},i.push(u))}return Promise.all(i)}},{key:"loadMesh",value:function(e){for(var t=this,r=this.json,a=this.extensions,i=r.meshes[e],s=i.primitives,o=[],l=0,c=s.length;l<c;l++){var u=void 0===s[l].material?(void 0===(u=this.cache).DefaultMaterial&&(u.DefaultMaterial=new n.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:n.FrontSide})),u.DefaultMaterial):this.getDependency("material",s[l].material);o.push(u)}return o.push(t.loadGeometries(s)),Promise.all(o).then((function(r){for(var o=r.slice(0,r.length-1),l=r[r.length-1],c=[],u=0,h=l.length;u<h;u++){var d=l[u],f=s[u],m=void 0,g=o[u];if(f.mode===le.TRIANGLES||f.mode===le.TRIANGLE_STRIP||f.mode===le.TRIANGLE_FAN||void 0===f.mode)!0!==(m=new(!0===i.isSkinnedMesh?n.SkinnedMesh:n.Mesh)(d,g)).isSkinnedMesh||m.geometry.attributes.skinWeight.normalized||m.normalizeSkinWeights(),f.mode===le.TRIANGLE_STRIP?m.geometry=(0,p.Vs)(m.geometry,n.TriangleStripDrawMode):f.mode===le.TRIANGLE_FAN&&(m.geometry=(0,p.Vs)(m.geometry,n.TriangleFanDrawMode));else if(f.mode===le.LINES)m=new n.LineSegments(d,g);else if(f.mode===le.LINE_STRIP)m=new n.Line(d,g);else if(f.mode===le.LINE_LOOP)m=new n.LineLoop(d,g);else{if(f.mode!==le.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+f.mode);m=new n.Points(d,g)}if(0<Object.keys(m.geometry.morphAttributes).length){M=S=w=x=y=v=void 0;var v=m,b=i;if(v.updateMorphTargets(),void 0!==b.weights)for(var y=0,x=b.weights.length;y<x;y++)v.morphTargetInfluences[y]=b.weights[y];if(b.extras&&Array.isArray(b.extras.targetNames)){var w=b.extras.targetNames;if(v.morphTargetInfluences.length===w.length){v.morphTargetDictionary={};for(var S=0,M=w.length;S<M;S++)v.morphTargetDictionary[w[S]]=S}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}m.name=t.createUniqueName(i.name||"mesh_"+e),ve(m,i),f.extensions&&ge(a,m,f),t.assignFinalMaterial(m),c.push(m)}for(var T=0,_=c.length;T<_;T++)t.associations.set(c[T],{meshes:e,primitives:T});if(1===c.length)return c[0];var E=new n.Group;t.associations.set(E,{meshes:e});for(var k=0,D=c.length;k<D;k++)E.add(c[k]);return E}))}},{key:"loadCamera",value:function(e){var t,r=(e=this.json.cameras[e])[e.type];if(r)return"perspective"===e.type?t=new n.PerspectiveCamera(n.MathUtils.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===e.type&&(t=new n.OrthographicCamera(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),e.name&&(t.name=this.createUniqueName(e.name)),ve(t,e),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}},{key:"loadSkin",value:function(e){for(var t=this.json.skins[e],r=[],a=0,i=t.joints.length;a<i;a++)r.push(this.getDependency("node",t.joints[a]));return void 0!==t.inverseBindMatrices?r.push(this.getDependency("accessor",t.inverseBindMatrices)):r.push(null),Promise.all(r).then((function(e){for(var r=e.pop(),a=e,i=[],s=[],o=0,l=a.length;o<l;o++){var c=a[o];c?(i.push(c),c=new n.Matrix4,null!==r&&c.fromArray(r.array,16*o),s.push(c)):console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[o])}return new n.Skeleton(i,s)}))}},{key:"loadAnimation",value:function(e){for(var t=this.json.animations[e],r=[],a=[],i=[],s=[],o=[],l=0,c=t.channels.length;l<c;l++){var u=t.channels[l],h=t.samplers[u.sampler],d=(u=u.target).node,p=void 0!==t.parameters?t.parameters[h.input]:h.input,f=void 0!==t.parameters?t.parameters[h.output]:h.output;r.push(this.getDependency("node",d)),a.push(this.getDependency("accessor",p)),i.push(this.getDependency("accessor",f)),s.push(h),o.push(u)}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(i),Promise.all(s),Promise.all(o)]).then((function(r){for(var a=r[0],i=r[1],s=r[2],o=r[3],l=r[4],c=[],u=0,h=a.length;u<h;u++)!function(e){var t=a[e],r=i[e],u=s[e],h=o[e],d=l[e];if(void 0!==t){t.updateMatrix();var p=void 0;switch(fe[d.path]){case fe.weights:p=n.NumberKeyframeTrack;break;case fe.rotation:p=n.QuaternionKeyframeTrack;break;default:p=n.VectorKeyframeTrack}e=t.name||t.uuid;var f=void 0!==h.interpolation?me[h.interpolation]:n.InterpolateLinear,m=[],g=(fe[d.path]===fe.weights?t.traverse((function(e){e.morphTargetInfluences&&m.push(e.name||e.uuid)})):m.push(e),u.array);if(u.normalized){for(var v=ye(g.constructor),b=new Float32Array(g.length),y=0,x=g.length;y<x;y++)b[y]=g[y]*v;g=b}for(var w=0,S=m.length;w<S;w++){var M=new p(m[w]+"."+fe[d.path],r.array,g,f);"CUBICSPLINE"===h.interpolation&&(M.createInterpolant=function(e){return new(this instanceof n.QuaternionKeyframeTrack?oe:ie)(this.times,this.values,this.getValueSize()/3,e)},M.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),c.push(M)}}}(u);return r=t.name||"animation_"+e,new n.AnimationClip(r,void 0,c)}))}},{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=this.json,r=this.extensions,a=this,i=t.nodes[e],s=i.name?a.createUniqueName(i.name):"";return function(){for(var t=[],r=a._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)})),n=(r&&t.push(r),void 0!==i.camera&&t.push(a.getDependency("camera",i.camera).then((function(e){return a._getNodeRef(a.cameraCache,i.camera,e)}))),a._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){t.push(e)})),[]),s=i.children||[],o=0,l=s.length;o<l;o++)n.push(a.getDependency("node",s[o]));return r=void 0===i.skin?Promise.resolve(null):a.getDependency("skin",i.skin),Promise.all([Promise.all(t),Promise.all(n),r])}().then((function(t){var o=t[0],l=t[1],c=t[2],u=!0===i.isBone?new n.Bone:1<o.length?new n.Group:1===o.length?o[0]:new n.Object3D;if(u!==o[0])for(var h=0,d=o.length;h<d;h++)u.add(o[h]);i.name&&(u.userData.name=i.name,u.name=s),ve(u,i),i.extensions&&ge(r,u,i),void 0!==i.matrix?((t=new n.Matrix4).fromArray(i.matrix),u.applyMatrix4(t)):(void 0!==i.translation&&u.position.fromArray(i.translation),void 0!==i.rotation&&u.quaternion.fromArray(i.rotation),void 0!==i.scale&&u.scale.fromArray(i.scale)),a.associations.has(u)||a.associations.set(u,{}),a.associations.get(u).nodes=e,null!==c&&u.traverse((function(e){e.isSkinnedMesh&&e.bind(c,xe)}));for(var p=0,f=l.length;p<f;p++)u.add(l[p]);return a.options.ex.loadNode({node:u,nodeDef:i})||u}))}},{key:"loadScene",value:function(e){for(var t=this.extensions,r=(e=this.json.scenes[e],this),a=new n.Group,i=(e.name&&(a.name=r.createUniqueName(e.name)),ve(a,e),e.extensions&&ge(t,a,e),e.nodes||[]),s=[],o=0,l=i.length;o<l;o++)s.push(r.getDependency("node",i[o]));return Promise.all(s).then((function(e){for(var t=0,i=e.length;t<i;t++)a.add(e[t]);return r.options.ex.loadScene(a),r.associations=function(e){var t,a=new Map,i=k(r.associations);try{for(i.s();!(t=i.n()).done;){var s=T(t.value,2),o=s[0],l=s[1];(o instanceof n.Material||o instanceof n.Texture)&&a.set(o,l)}}catch(e){i.e(e)}finally{i.f()}return e.traverse((function(e){var t=r.associations.get(e);null!=t&&a.set(e,t)})),a}(a),a}))}}]),e}();function Se(e,t,r){var a,i=t.attributes,s=[];for(a in i){var o=pe[a]||a.toLowerCase();o in e.attributes||s.push(function(t,n){return r.getDependency("accessor",t).then((function(t){e.setAttribute(n,t)}))}(i[a],o))}void 0===t.indices||e.index||(l=r.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)})),s.push(l)),ve(e,t);var l=e,c=t,u=r,h=c.attributes,d=new n.Box3;if(void 0!==h.POSITION){var p=(h=u.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 n.Vector3(p[0],p[1],p[2]),new n.Vector3(f[0],f[1],f[2])),h.normalized&&(p=ye(ce[h.componentType]),d.min.multiplyScalar(p),d.max.multiplyScalar(p));var m=c.targets;if(void 0!==m){for(var g=new n.Vector3,v=new n.Vector3,b=0,y=m.length;b<y;b++){var x,w,S=m[b];void 0!==S.POSITION&&(w=(S=u.json.accessors[S.POSITION]).min,x=S.max,void 0!==w&&void 0!==x?(v.setX(Math.max(Math.abs(w[0]),Math.abs(x[0]))),v.setY(Math.max(Math.abs(w[1]),Math.abs(x[1]))),v.setZ(Math.max(Math.abs(w[2]),Math.abs(x[2]))),S.normalized&&(w=ye(ce[S.componentType]),v.multiplyScalar(w)),g.max(v)):console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION."))}d.expandByVector(g)}l.boundingBox=d,f=new n.Sphere,d.getCenter(f.center),f.radius=d.min.distanceTo(d.max)/2,l.boundingSphere=f}}return Promise.all(s).then((function(){if(void 0===t.targets)return e;for(var n=e,a=t.targets,i=r,s=!1,o=!1,l=!1,c=0,u=a.length;c<u;c++){var h=a[c];if(void 0!==h.POSITION&&(s=!0),void 0!==h.NORMAL&&(o=!0),void 0!==h.COLOR_0&&(l=!0),s&&o&&l)break}if(!s&&!o&&!l)return Promise.resolve(n);for(var d=[],p=[],f=[],m=0,g=a.length;m<g;m++){var v,b=a[m];s&&(v=void 0!==b.POSITION?i.getDependency("accessor",b.POSITION):n.attributes.position,d.push(v)),o&&(v=void 0!==b.NORMAL?i.getDependency("accessor",b.NORMAL):n.attributes.normal,p.push(v)),l&&(b=void 0!==b.COLOR_0?i.getDependency("accessor",b.COLOR_0):n.attributes.color,f.push(b))}return Promise.all([Promise.all(d),Promise.all(p),Promise.all(f)]).then((function(e){var t=e[0],r=e[1];return e=e[2],s&&(n.morphAttributes.position=t),o&&(n.morphAttributes.normal=r),l&&(n.morphAttributes.color=e),n.morphTargetsRelative=!0,n}))}))}var Me=r(1794),Te=r(6272);class _e{constructor(e,t){this.runScene=e,this.helper=t}setTextureLoader(e){this.textureLoader=e,this.initTextureLoader(e)}initTextureLoader(e){e instanceof w&&e.setOptions({reverseTexture:this.helper.loadConfig.reverseTexture,textureQuality:this.runScene.optionsEx.options.texture.quality})}}class Ee{constructor(e,t){this.pending=[],this.models=[],this.module=new Me.Z,this.runScene=e,this.loadConfig=t,this.options=new _e(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){if(null==(t=e.asset)||!t.ex)return!0;var t=e.asset.ex.base64;return!t||!!(e=(0,Te.Ne)(t))&&(t=Number(e),!isNaN(t)&&(new Date).getTime()<t)}callback(e,t){var r,n;return this.loadConfig.triggerCb&&null!=(r=null==(n=this.runScene.cb.loaderer.gltf[e])?void 0:n.cb)&&r.call(n,t),null!=(n=null==(r=this.loadConfig.callBack)?void 0:r[e])&&n.call(r,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]}}class ke{constructor(e,t){this.options=e,this.runScene=t}static getGltfLoader(e){let t=this._gltf;if(!t){t=this._gltf=new U;const r=new d;r.setDecoderPath(e),this._gltf.setMeshoptDecoder(s),this._gltf.setDRACOLoader(r)}return t}parse(e){var{arrayBuffer:e,onDone:t,onError:r}=e;ke.getGltfLoader(this.runScene.optionsEx.options.decodePath).parse(e,"",t,r,this)}valid(e){return this.options.core.beforeLoader(e)}loadTexture(e){return this.options.core.loadTexture(e)}loadMaterial(e){return this.options.core.loadMaterial(e)}loadNode(e){return this.options.core.loadNode(e)}setTextureLoader(e){this.options.core.options.setTextureLoader(e)}loadScene(e){this.scene=e,this.options.models.push(e)}onBuildNodeHierarchy(e){const{nodeId:t,parentObject:r,node:n,idMap:a,children:i}=e;a&&a.set(t,n);try{if(void 0!==i&&(null==i?void 0:i.length)===r.children.length){let e=!0;i.forEach((t=>{a.get(t)||(e=!1)})),e&&(r.children=[...a.entries()].sort(((e,t)=>e[0]-t[0])).map((e=>{var[,e]=e;return e})),a.clear())}}catch(e){console.log(e,"e")}}}class De{constructor(e){this.dracoPath="./draco/",this._gltf=new U,this.runScene=e}init(){const e=new d;e.setDecoderPath(this.runScene.optionsEx.options.decodePath),this._gltf.setMeshoptDecoder(s),this._gltf.setDRACOLoader(e)}load(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){var r=yield a().get(e,{responseType:"arraybuffer",onDownloadProgress:e=>{var r,{total:e,loaded:n}=e;let a=n/e;1<(a=a<0?0:a)&&(a=1);var n=Number(a.toFixed(2));e=Math.floor(100*n),null!=(r=null==(n=null==t?void 0:t.callBack)?void 0:n.progress)&&r.call(n,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){const r=(0,S.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||{}),n=new Ee(this.runScene,r);return n.callback("getArrayBuffer",e),new Promise((t=>{new ke({rootModel:this.runScene.assetsEx.get().scene,models:[],core:n,runScene:this.runScene,loadConfig:r},this.runScene).parse({arrayBuffer:e,onDone:e=>{n.callback("loadedGltf",e);try{this.afterParse(e.parser.options.ex.options,e,r)}catch(e){this.runScene.cb.error.cb({tip:"加载glb出错",msg:e}),console.log(e,"e")}t(n.models)},onError:e=>{console.log(e,"_a")}})}))}afterParse(e,t,r){var n;const a=e.core;a.callback("afterParse",{options:e,json:t,loadConfig:r});var{cleanJSON:r,callBack:i}=r;if(!t.asset.ex){const{models:r,core:n}=e,a=this.runScene.sceneEx.cleanUnlessLevel(r[0]);n.models.push(a),0<t.animations.length&&(a.animations=[...t.animations])}this.runScene.optionsEx.log(t,"detail"),Promise.all(a.pending).then((()=>{a.callback("complete",{models:e.models,json:t})})),null!=(n=null==i?void 0:i.getJSON)&&n.call(i,t),r&&this.disposeJSON(t)}disposeJSON(e){}}var Pe=r(3736),Ae=r(110);class Oe{constructor(e){this._objectLoader=new n.ObjectLoader,this.runScene=e,this._parser=new Ce(e)}parse(e){return function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((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 Ce{constructor(e){this.runScene=e}parseModel(e){e.material&&this.parseMaterial(e)}parseMaterial(e){var t=e.material;"SpriteMaterial"===t.type&&(0,Pe.M)(t,"type",Ae.Z.tools.type),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 Re{constructor(e){this.imgBitMap=new n.ImageBitmapLoader,this.object=new n.ObjectLoader,this.runScene=e,this.gltf=new De(e),this.json=new Oe(e)}init(){this.gltf.init()}}const Le=new class{constructor(){this.load=new n.AnimationLoader}parse(e){return this.load.parse(e)}}},7880:(e,t,r)=>{r.d(t,{Ws:()=>Q,ZP:()=>Y,ee:()=>J});var n,a,i,s=r(4707),o=r(8881),l=r(932),c=r(6651),u=r(3735),h=r(3736);class d{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new u.Z({target:e,typeList:["uniforms",...t],newVal:r}).execute())}}(n=d).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],d.TextureNames=["sideWallTex","backWallTex","floorTex","ceilingTex"],d.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},create:(e,t)=>{var r=new o.ShaderMaterial({uniforms:(0,c.d9)(p.uniforms),vertexShader:p.vertexShader,fragmentShader:p.fragmentShader});return n.tools.bind(r),r},parseData:e=>{const{texture:t,normal:r,material:a}=e,{data:i,load:s}=t,l=new o.ShaderMaterial({uniforms:(0,c.d9)(p.uniforms),vertexShader:p.vertexShader,fragmentShader:p.fragmentShader}),u=[];return s&&u.push(...i.map((e=>()=>{"ceilingTex"===e.type?l.uniforms.ceilingTex.value=e.texture||null:"floorTex"===e.type?l.uniforms.floorTex.value=e.texture||null:"sideWallTex"===e.type?l.uniforms.sideWallTex.value=e.texture||null:"backWallTex"===e.type&&(l.uniforms.backWallTex.value=e.texture||null)}))),Object.keys(r.uniforms).filter((e=>!d.TextureNames.includes(e))).map((e=>{var t=r.uniforms[e];l.uniforms[e].value="roomsXYZPropsW"===e||"positionOffsetRoomsXYZPropsW"===e||"roomColorTint"===e?new o.Vector4(t.x,t.y,t.z,t.w):t})),l.name=r.name,l.userData.id=a.userData.id,n.tools.bind(l),{material:l,setTextureFns:u}},toNormal:e=>{const t=(0,l.createDefMaterial)(),r=(t.userData=Object.assign({},t.userData),{}),a=e.uniforms,i=p.uniforms;return Object.keys(a).filter((e=>!d.TextureNames.includes(e))).map((e=>{var t,n,s,l,c,u,h=a[e].value,d=i[e].value;h instanceof o.Vector4?(({x:t,y:n,z:s}=h),({x:l,y:c,z:u}=d),t===l&&n===c&&s===u||(r[e]=h)):h!==d&&(r[e]=h)})),{material:t,normal:{type:n.tools.type,uniforms:r,name:e.name},textures:n.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=n.tools.create(t);return Object.keys(r).filter((e=>!d.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,h.M)(e,"type",n.tools.type)},validType:e=>"FakeInterior"===e.userData.type};const p={uniforms:{roomIntensity:{value:1},roomColorTint:{value:new o.Vector4(1,1,1,1)},sideWallTex:{value:null},backWallTex:{value:null},floorTex:{value:null},ceilingTex:{value:null},sideWallTexTiling:{value:.097},backWallTexTiling:{value:.097},floorTexTiling:{value:.15},ceilingTexTiling:{value:.15},roomTile:{value:.3},roomsXYZPropsW:{value:new o.Vector4(.35,.65,.1,1)},positionOffsetRoomsXYZPropsW:{value:new o.Vector4(4.7,2,-11,-3)},depthTest:{value:!0},depthWrite:{value:!0}},vertexShader:"\n varying vec2 vUv;\n varying vec3 vPos;\n varying mat4 vModelMatrix;\n \n void main() {\n vUv = uv;\n vPos = position;\n vModelMatrix = modelMatrix;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform float roomIntensity;\n uniform vec4 roomColorTint;\n \n uniform sampler2D sideWallTex;\n uniform sampler2D backWallTex;\n uniform sampler2D floorTex;\n uniform sampler2D ceilingTex;\n \n uniform float sideWallTexTiling;\n uniform float backWallTexTiling;\n uniform float floorTexTiling;\n uniform float ceilingTexTiling;\n \n uniform float roomTile;\n uniform vec4 roomsXYZPropsW;\n uniform vec4 positionOffsetRoomsXYZPropsW;\n \n varying vec2 vUv;\n varying vec3 vPos;\n varying mat4 vModelMatrix;\n \n void main() {\n vec4 interpVertexPos = vec4(vPos.xyz, vPos.z);\n // 将相机世界空间坐标转换为对象空间坐标\n vec4 cameraObjectPos = inverse(vModelMatrix) * vec4(cameraPosition, 1.0);\n vec4 transCameraPos = vec4(cameraObjectPos.xyz, cameraObjectPos.z);\n \n vec4 temp1 = (interpVertexPos - positionOffsetRoomsXYZPropsW);\n vec4 temp2 = ((roomsXYZPropsW + vec4(-1E-05, -1E-05, -1E-05, -1E-05)) * roomTile);\n vec4 V2 = transCameraPos - positionOffsetRoomsXYZPropsW;\n vec4 V1 = temp1 - V2;\n vec4 middleman = ((floor(temp2 * temp1) + step(vec4(0, 0, 0, 0), V1)) / temp2 - V2) / V1;\n \n // Side Walls\n vec2 sideWallUv = (middleman.x * V1 + V2).zy * sideWallTexTiling;\n vec4 sideWallColor = texture2D(sideWallTex, sideWallUv);\n \n // Back Wall\n vec2 backWallUv = (middleman.z * V1 + V2).xy * backWallTexTiling;\n vec4 backWallColor = texture2D(backWallTex, backWallUv);\n \n // Floor Ceiling\n vec2 floorUv = ((middleman.y * V1) + V2).xz * floorTexTiling;\n vec2 ceilingUv = ((middleman.y * V1) + V2).xz * ceilingTexTiling;\n vec4 floorColor = texture2D(floorTex, floorUv);\n vec4 ceilingColor = texture2D(ceilingTex, ceilingUv);\n vec4 cfColor = mix(floorColor, ceilingColor, step(0.0, V1.y));\n \n // Mix\n float compareXZ = 0.0;\n float stepXZ = step(middleman.z, middleman.x);\n if(stepXZ <= 0.0)\n compareXZ = middleman.x;\n else\n compareXZ = middleman.z;\n \n vec4 wallColor = vec4(0);\n if(stepXZ <= 0.0)\n wallColor = sideWallColor;\n else\n wallColor = backWallColor;\n \n vec4 finalColor = vec4(0);\n if(middleman.y <= compareXZ)\n finalColor = cfColor;\n else\n finalColor = wallColor;\n \n // Tint Room\n vec4 tintColor = roomColorTint * finalColor * roomIntensity;\n \n gl_FragColor = tintColor;\n }\n "};class f{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new u.Z({target:e,typeList:[...t],newVal:r}).execute())}}(a=f).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],f.TextureNames=["envMap","displacementMap"],f.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},create:(e,t)=>{const r=new m(void 0,void 0,e);return r.insertFresnelShader(),a.tools.bind(r),(t=t||e.modelEx.select)&&(r.name=t.name),r},parseData:(e,t)=>{const{texture:r,normal:n,material:i}=e,{data:s,load:o}=r,c=(0,l.mergeMaterial)(i,new m(void 0,void 0,t)),u=[];return o&&u.push(...s.map((e=>()=>{c[e.type]=e.texture}))),Object.keys(n.uniforms).filter((e=>!f.TextureNames.includes(e))).map((e=>{c[e]=n.uniforms[e]})),c.insertFresnelShader(),c.name=n.name,c.userData.id=i.userData.id,a.tools.bind(c),{material:c,setTextureFns:u}},toNormal:e=>{const t=(0,l.mergeMaterial)(e,(0,l.createDefMaterial)()),r=(t.userData=Object.assign({},t.userData),t.name=e.name,{}),n=g.uniforms;return Object.keys(n).filter((e=>!f.TextureNames.includes(e))).map((t=>{var a=e[t],i=n[t].value;"fresnelBias"===t||"fresnelScale"===t||"fresnelPower"===t||"isSurge"===t?a.value!==i&&(r[t]=a):a!==i&&(r[t]=a)})),{material:t,normal:{type:a.tools.type,uniforms:r,name:e.name},textures:a.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=a.tools.create(t);return Object.keys(r).filter((e=>!f.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,h.M)(e,"type",a.tools.type)},validType:e=>"Fresnel"===e.userData.type};class m extends o.MeshPhysicalMaterial{constructor(e,t,r){if(e?super(e):(super(),this.emissive=new o.Color(65535),this.envMap=null,this.displacementMap=null,this.metalness=0,this.roughness=0,this.ior=1.5,this.transmission=1,this.opacity=1,this.transparent=!0,this.thickness=0),this.runScene=r,this.isSpecialMaterial=!0,t?(this.fresnelBias=new o.Uniform(t.fresnelBias),this.fresnelScale=new o.Uniform(t.fresnelScale),this.fresnelPower=new o.Uniform(t.fresnelPower)):(this.fresnelBias=new o.Uniform(g.uniforms.fresnelBias.value),this.fresnelScale=new o.Uniform(g.uniforms.fresnelScale.value),this.fresnelPower=new o.Uniform(g.uniforms.fresnelPower.value)),this.clock=new o.Clock,this.isSurge=new o.Uniform(!1),this.deltaTime=new o.Uniform(0),!this.cubeCamera){const e=new o.WebGLCubeRenderTarget(2048);e.texture.mapping=o.CubeRefractionMapping,this.cubeCamera=new o.CubeCamera(.1,1e5,e),this.runScene.assetsEx.scene.add(this.cubeCamera),this.runScene.cb.render.add("Fresnel",(()=>{this.update()}))}}insertFresnelShader(){this.onBeforeCompile=e=>{e.uniforms.isSurge=this.isSurge,e.uniforms.deltaTime=this.deltaTime,e.uniforms.fresnelBias=this.fresnelBias,e.uniforms.fresnelScale=this.fresnelScale,e.uniforms.fresnelPower=this.fresnelPower,e.vertexShader=e.vertexShader.replace(/varying vec3 vWorldPosition;/g,g.vertexParas),e.vertexShader=e.vertexShader.replace(/#include <begin_vertex>/g,g.vertexShader1),e.vertexShader=e.vertexShader.replace(/vWorldPosition = worldPosition.xyz;/g,g.vertexShader2),e.fragmentShader=e.fragmentShader.replace(/#include <transmission_pars_fragment>/g,g.fragmentParas),e.fragmentShader=e.fragmentShader.replace(/vec3 totalEmissiveRadiance = emissive;/g,g.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 g={uniforms:{depthTest:new o.Uniform(!0),depthWrite:new o.Uniform(!0),isSurge:new o.Uniform(!1),deltaTime:new o.Uniform(0),fresnelBias:new o.Uniform(0),fresnelScale:new o.Uniform(1),fresnelPower:new o.Uniform(3)},vertexParas:"\n uniform bool isSurge;\n uniform float deltaTime;\n varying vec3 vWorldPosition;\n varying vec3 vWorldNormal;\n ",vertexShader1:"\n vec3 transformed = vec3(position);\n if(isSurge) {\n // 0.15作为系数控制气泡表面波纹的稀疏程度,数值越大越密\n float wobbleValue = 0.15 * transformed.y + deltaTime;\n // 三角函数的系数控制气泡表面波纹的波动幅度,数值越大波幅越大\n vec3 wobblePos = vec3(0.75 * cos(wobbleValue) + 0.25 * sin(wobbleValue));\n transformed += wobblePos;\n }\n ",vertexShader2:"\n vWorldPosition = worldPosition.xyz;\n vWorldNormal = normalize(vec3(modelMatrix * vec4(normal, 0.0)));\n ",fragmentParas:"\n #include <transmission_pars_fragment>\n varying vec3 vWorldNormal;\n uniform float fresnelBias;\n uniform float fresnelScale;\n uniform float fresnelPower;\n ",fragmentShaderEmissive:"\n vec3 viewDir = normalize(cameraPosition - vWorldPosition);\n float fresnelNdot = dot(viewDir, vWorldNormal);\n float fresnelValue = fresnelBias + fresnelScale * pow(1.0 - fresnelNdot, fresnelPower);\n // fresnelValue = [0, 1], 0=center,1=edge\n \n vec3 totalEmissiveRadiance = emissive * fresnelValue;\n "};class v{constructor(e){this.runScene=e}undo(e){const{material:t,list:r,val:n}=e;this.runScene.undoEx.addUndo(new u.Z({target:t,typeList:[...r],newVal:n,cb:()=>{t.needsUpdate=!0}}).execute())}}(i=v).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],v.TextureNames=["alphaMap","bumpMap","displacementMap","map","normalMap","matcap"],v.tools={type:"Matcap",getTextures:e=>{const t=[];return v.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},create:(e,t)=>{const r=new o.MeshMatcapMaterial;return i.tools.bind(r),(t=t||e.modelEx.select)&&(r.name="Matcap-"+t.name),r},parseData:e=>{const{normal:t,texture:r,material:n}=e,{data:a,load:s}=r,c=(0,l.mergeMaterial)(n,new o.MeshMatcapMaterial),u=(delete c.emissive,[]);return s&&u.push(...a.map((e=>()=>{c[e.type]=e.texture}))),Object.keys(t.uniforms).filter((e=>!v.IgnoredAttributes.includes(e))).map((e=>{c[e]="normalScale"===e?new o.Vector2(t.uniforms[e].x,t.uniforms[e].y):t.uniforms[e]})),c.name=t.name,c.userData.id=n.userData.id,i.tools.bind(c),{material:c,setTextureFns:u}},toNormal:e=>{var t=i.tools.getTextures(e);const r=(0,l.mergeMaterial)(e,(0,l.createDefMaterial)()),n=(r.userData=Object.assign({},r.userData),r.name=e.name,{}),a=new o.MeshMatcapMaterial;return Object.keys(e).filter((e=>!v.TextureNames.includes(e))).filter((e=>!v.IgnoredAttributes.includes(e))).map((t=>{var r=e[t],i=a[t];"bumpScale"===t||"displacementScale"===t||"displacementBias"===t||"depthTest"===t||"depthWrite"===t||"transparent"===t||"opacity"===t?r!==i&&(n[t]=r):"normalScale"!==t||r.x===i.x&&r.y===i.y||(n[t]=r)})),{material:r,normal:{type:i.tools.type,uniforms:n,name:e.name},textures:t}},clone:(e,t)=>e,copy:(e,t)=>{const r=i.tools.create(t);return Object.keys(r).filter((e=>!v.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,h.M)(e,"type",i.tools.type)},validType:e=>"Matcap"===e.userData.type};const b="\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 ",x={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 o.Matrix3,new o.Matrix3,new o.Matrix3,new o.Matrix3,new o.Matrix3,new o.Matrix3]},maskUvTransArray:{value:[new o.Matrix3,new o.Matrix3,new o.Matrix3,new o.Matrix3,new o.Matrix3]},diffuse:{value:new o.Color(16777215)},uvTransform:{value:new o.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 "};var w,S=r(1398),M=r(3729);const T={diffuse:{type:"color",label:["uniforms","diffuse","value"],val:{r:1,g:1,b:1},shortKey:"df"},shadowShade:{type:"number",label:["uniforms","shadowShade","value"],val:.6,shortKey:"ss"},terrainMap0:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[0])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[0]=r},shortKey:"p0"},terrainMap1:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[1])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[1]=r},shortKey:"p1"},terrainMap2:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[2])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[2]=r},shortKey:"p2"},terrainMap3:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[3])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[3]=r},shortKey:"p3"},terrainMap4:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[4])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[4]=r},shortKey:"p4"},terrainMap5:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[5])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[5]=r},shortKey:"p5"},terrainMap6:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[6])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[6]=r},shortKey:"p6"},terrainMap7:{type:"texture",val:null,get:e=>(e=e.uniforms.mapArray.value[7])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.mapArray.value[7]=r},shortKey:"p7"},terrainMask0:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[0])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[0]=r},shortKey:"k0"},terrainMask1:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[1])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[1]=r},shortKey:"k1"},terrainMask2:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[2])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[2]=r},shortKey:"k2"},terrainMask3:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[3])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[3]=r},shortKey:"k3"},terrainMask4:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[4])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[4]=r},shortKey:"k4"},terrainMask5:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[5])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[5]=r},shortKey:"k5"},terrainMask6:{type:"texture",val:null,get:e=>(e=e.uniforms.maskArray.value[6])?(0,M.Ki)(e):null,set:e=>{const{target:t,end:r}=e;t.uniforms.maskArray.value[6]=r},shortKey:"k6"}};class _{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new u.Z({target:e,typeList:["uniforms",...t],newVal:r}).execute())}insertShader(e){e&&(e.onBeforeCompile=t=>{t.defines=x.defines,this.mergeUniforms(e.uniforms,t.uniforms),t.vertexShader=x.vertex,t.fragmentShader=x.fragment,t.fragmentShader=t.fragmentShader.replace(/\/\/ Insert Noise2D/g,b)})}mergeUniforms(e,t){if(e&&t)for(const r in e)t[r]=e[r]}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)))}}(w=_).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],_.TextureNames=["terrainMap0","terrainMap1","terrainMap2","terrainMap3","terrainMap4","terrainMap5","terrainMap6","terrainMap7","terrainMask0","terrainMask1","terrainMask2","terrainMask3","terrainMask4","terrainMask5","terrainMask6"],_.tools={type:"MixTexture",getTextures:e=>{const t=[];return _.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},create:(e,t)=>{const r=new o.ShadowMaterial({color:0,opacity:1});return r.uniforms=o.UniformsUtils.clone(x.uniforms),e.materialEx.def.map.MixTexture.insertShader(r),w.tools.bind(r),r},parseData:(e,t)=>{const{texture:r,normal:n,material:a}=e,{data:i,load:s}=r,l=new o.ShadowMaterial({color:0,opacity:1}),c=(l.uniforms=o.UniformsUtils.clone(x.uniforms),t.materialEx.def.map.MixTexture.insertShader(l),[]);return s&&c.push(...i.map((e=>()=>{var r=parseInt(e.type.slice(-1));e.type.startsWith("terrainMap")?(l.uniforms.mapArray.value[r]=e.texture,t.materialEx.def.map.MixTexture.onTexRepeatChange(l,r,!0)):e.type.startsWith("terrainMask")&&(l.uniforms.maskArray.value[r]=e.texture,t.materialEx.def.map.MixTexture.onTexRepeatChange(l,r,!1))}))),Object.keys(n.uniforms).filter((e=>!_.TextureNames.includes(e))).map((e=>{var t=n.uniforms[e];"diffuse"===e?l.uniforms[e].value=new o.Color(parseInt(t,16)):"uvTransform"!==e&&(l.uniforms[e].value=t)})),l.name=n.name,l.userData.id=a.userData.id,w.tools.bind(l),{material:l,setTextureFns:c}},toNormal:e=>{const t=(0,l.createDefMaterial)(),r=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:w.tools.type,uniforms:{},name:e.name},textures:w.tools.getTextures(e)}),{}),n=e.uniforms,a=x.uniforms;return Object.keys(n).filter((e=>"mapArray"!==e&&"maskArray"!==e&&"mapUvTransArray"!==e&&"maskUvTransArray"!==e)).map((e=>{const t=n[e].value,i=a[e].value;"diffuse"===e?t.getHexString()!==i.getHexString()&&(r[e]=t.getHexString()):"uvTransform"!==e&&t!==i&&(r[e]=t)})),{material:t,normal:{type:w.tools.type,uniforms:r,name:e.name},textures:w.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=w.tools.create(t);return Object.keys(r).filter((e=>!_.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,h.M)(e,"type",w.tools.type)},validType:e=>"MixTexture"===e.userData.type,snapshot:{getDiff:e=>S.LV.getDiff(T,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;S.LV.set({def:T,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,l.updateMaterial)(r)}))}}};var E,k=r(110);class D{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new u.Z({target:e,typeList:[...t],newVal:r}).execute())}}(E=D).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],D.TextureNames=["alphaMap","aoMap","bumpMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap","clearcoatMap","clearcoatNormalMap","clearcoatRoughnessMap","sheenRoughnessMap","sheenColorMap","specularIntensityMap","specularColorMap","thicknessMap","transmissionMap"],D.tools={type:"Physical",getTextures:e=>{const t=[];return D.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},create:(e,t)=>{const r=new o.MeshPhysicalMaterial;return E.tools.bind(r),(t=t||e.modelEx.select)&&(r.name="MeshPhysicalMaterial-"+t.name),r},parseData:e=>{const{normal:t,texture:r,material:n}=e,{data:a,load:i}=r,s=(0,l.mergeMaterial)(n,new o.MeshPhysicalMaterial),c=[];return i&&c.push(...a.map((e=>()=>{s[e.type]=e.texture}))),Object.keys(t.uniforms).filter((e=>!D.IgnoredAttributes.includes(e))).map((e=>{var r=t.uniforms[e];s[e]="attenuationColor"===e||"sheenColor"===e||"specularColor"===e?new o.Color(r):"clearcoatNormalScale"===e?new o.Vector2(r.x,r.y):r})),s.name=t.name,s.userData.id=n.userData.id,E.tools.bind(s),{material:s,setTextureFns:c}},toNormal:e=>{const t=(0,l.mergeMaterial)(e,(0,l.createDefMaterial)()),r=(t.userData=Object.assign({},t.userData),t.name=e.name,{}),n=new o.MeshPhysicalMaterial;return Object.keys(e).filter((e=>!D.TextureNames.includes(e))).filter((e=>!D.IgnoredAttributes.includes(e))).filter((e=>void 0===t[e])).map((t=>{const a=e[t],i=n[t];"attenuationColor"===t||"sheenColor"===t||"specularColor"===t?a.getHexString()!==i.getHexString()&&(r[t]=a.getHexString()):"clearcoatNormalScale"===t?a.x===i.x&&a.y===i.y||(r[t]=a):a!==i&&(r[t]=a)})),{material:t,normal:{type:E.tools.type,uniforms:r,name:e.name},textures:E.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=E.tools.create(t);return Object.keys(r).filter((e=>!D.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,h.M)(e,"type",E.tools.type)},validType:e=>"MeshPhysicalMaterial"===e.type};var P=r(6001),A=r(5180);const O={uniforms:{tDiffuse:new o.Uniform(null),h:new o.Uniform(1/512)},vertexShader:"\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}",fragmentShader:"\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float h;\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvec4 sum = vec4( 0.0 );\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\t\n\t\t\tgl_FragColor = sum;\n\t\t}"},C={uniforms:{tDiffuse:new o.Uniform(null),v:new o.Uniform(1/512)},vertexShader:"\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}",fragmentShader:"\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float v;\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\t\t\tvec4 sum = vec4( 0.0 );\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\t\t\t\n\t\t\tgl_FragColor = sum;\n\t\t}"};var R,L;new o.Uniform(null),new o.Uniform(null),new o.Uniform(0),new o.Uniform(0),new o.Uniform(0),new o.Uniform(new o.Vector2),new o.Uniform(.1),new o.Uniform(1e3);class I{constructor(e){this.materials={},this.render=()=>{(0,P.mapObj)(this.materials,((e,t)=>{const{model:r,material:n}=t;n.update(r)}))},this.runScene=e,this.init(),this.runScene.cb.material.dispose.add("Reflector",this.dispose.bind(this))}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,P.getId)();t.userData.id=r,this.materials[r]=e}undo(e){var{material:e,list:t,val:r}=e;this.runScene.undoEx.addUndo(new u.Z({target:e,typeList:[...t],newVal:r}).execute())}dispose(){this.materials={}}}(R=I).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],I.TextureNames=["map","normalMap","roughnessMap","metalnessMap","tDiffuse","tDiffuseBlur"],I.tools={type:"Reflector",getTextures:e=>(0,l.getTexturesByMaterial)(e),create:(e,t)=>{const r=new B(void 0,void 0,e);return r.insertReflectorShader(),R.tools.bind(r),(t=t||e.modelEx.select)&&(r.name=t.name),e.materialEx.def.map.Reflector.bindData({model:t,material:r}),r},parseData:(e,t)=>{const{texture:r,normal:n,models:a,material:i}=e,{data:s,load:c}=r,u=(0,l.mergeMaterial)(i,new B(void 0,void 0,t)),h=[];return c&&h.push(...s.map((e=>()=>{u[e.type]=e.texture}))),Object.keys(n.uniforms).filter((e=>!I.TextureNames.includes(e))).map((e=>{u[e]="normalScale"===e?new o.Vector2(n.uniforms[e].x,n.uniforms[e].y):n.uniforms[e]})),u.setRTSize(u.resolution),u.setBlurPass(u.blurSize),u.insertReflectorShader(),t.materialEx.def.map.Reflector.bindData({model:a[0],material:u}),u.name=n.name,u.userData.id=i.userData.id,R.tools.bind(u),{material:u,setTextureFns:h}},toNormal:e=>{const t=(0,l.mergeMaterial)(e,(0,l.createDefMaterial)()),r=(t.userData=Object.assign({},t.userData),t.name=e.name,{}),n=U.uniforms;return Object.keys(n).filter((e=>!I.TextureNames.includes(e))).map((t=>{var a=e[t],i=n[t].value;"mirror"===t||"mixBlur"===t||"mixStrength"===t||"mixContrast"===t?a.value!==i&&(r[t]=a):a!==i&&(r[t]=a)})),t.normalScale&&(r.normalScale=t.normalScale),{material:t,normal:{type:R.tools.type,uniforms:r,name:e.name},textures:R.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const r=R.tools.create(t);return Object.keys(r).filter((e=>!I.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,h.M)(e,"type",R.tools.type)},validType:e=>"Reflector"===e.userData.type};class B extends o.MeshStandardMaterial{constructor(e,t,r){e?super(e):(super(),this.opacity=U.uniforms.opacity.value,this.transparent=U.uniforms.transparent.value,this.roughness=U.uniforms.roughness.value,this.metalness=U.uniforms.metalness.value),this.runScene=r,this.isSpecialMaterial=!0,t?(this.resolution=t.resolution,this.blurSize=t.blurSize,this.mirror=new o.Uniform(t.mirror),this.mixBlur=new o.Uniform(t.mixBlur),this.mixStrength=new o.Uniform(t.mixStrength),this.mixContrast=new o.Uniform(t.mixContrast)):(this.resolution=U.uniforms.resolution.value,this.blurSize=U.uniforms.blurSize.value,this.mirror=new o.Uniform(U.uniforms.mirror.value),this.mixBlur=new o.Uniform(U.uniforms.mixBlur.value),this.mixStrength=new o.Uniform(U.uniforms.mixStrength.value),this.mixContrast=new o.Uniform(U.uniforms.mixContrast.value)),this.textureMatrix=new o.Uniform(new o.Matrix4),this.reflectorWorldPosition=new o.Vector3,this.cameraWorldPosition=new o.Vector3,this.rotationMatrix=new o.Matrix4,this.normal=new o.Vector3,this.view=new o.Vector3,this.lookAtPosition=new o.Vector3,this.target=new o.Vector3,this.tempQuaternion=new o.Vector4,this.virtualCamera=new o.PerspectiveCamera,this.reflectorPlane=new o.Plane,this.clipPlane=new o.Vector4,e={minFilter:o.LinearFilter,magFilter:o.LinearFilter,type:o.HalfFloatType,encoding:this.runScene.assetsEx.get().renderer.outputEncoding},this.glRT1=new o.WebGLRenderTarget(this.resolution,this.resolution,e),this.glRT2=new o.WebGLRenderTarget(this.resolution,this.resolution,e),this.tDiffuse=new o.Uniform(this.glRT1.texture),this.tDiffuseBlur=new o.Uniform(this.glRT2.texture),this.hBlurPass=new A.T(O),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(C),this.vBlurPass.uniforms.v.value=1/this.blurSize,this.vBlurPass.clear=!1,this.vBlurPass.renderToScreen=!1,this.vBlurPass.enabled=0<this.blurSize,this.vBlurPass.material.depthWrite=!1}insertReflectorShader(){this.onBeforeCompile=e=>{var t;null!=(t=e.defines)&&t.USE_UV||(e.defines.USE_UV=""),null!=(t=e.defines)&&t.USE_BLUR||(e.defines.USE_BLUR=""),e.uniforms.tDiffuse=this.tDiffuse,e.uniforms.tDiffuseBlur=this.tDiffuseBlur,e.uniforms.textureMatrix=this.textureMatrix,e.uniforms.mirror=this.mirror,e.uniforms.mixBlur=this.mixBlur,e.uniforms.mixStrength=this.mixStrength,e.uniforms.mixContrast=this.mixContrast,e.vertexShader=U.vertexParas+""+e.vertexShader,e.vertexShader=e.vertexShader.replace("#include <project_vertex>",U.vertexShader),e.fragmentShader=U.fragmentParas+""+e.fragmentShader,e.fragmentShader=e.fragmentShader.replace("#include <emissivemap_fragment>",U.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 U={uniforms:{opacity:new o.Uniform(1),transparent:new o.Uniform(!1),roughness:new o.Uniform(1),metalness:new o.Uniform(.6),resolution:new o.Uniform(1024),blurSize:new o.Uniform(1024),mirror:new o.Uniform(0),mixBlur:new o.Uniform(10),mixStrength:new o.Uniform(2),mixContrast:new o.Uniform(1),depthTest:new o.Uniform(!0),depthWrite:new o.Uniform(!0)},vertexParas:"\n uniform mat4 textureMatrix;\n varying vec4 my_vUv;\n ",vertexShader:"\n #include <project_vertex>\n my_vUv = textureMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n ",fragmentParas:"\n uniform sampler2D tDiffuse;\n uniform sampler2D tDiffuseBlur;\n uniform sampler2D tDepth;\n uniform sampler2D distortionMap;\n uniform float distortion;\n uniform float mirror;\n uniform float mixBlur;\n uniform float mixStrength;\n uniform float mixContrast;\n uniform float minDepthThreshold;\n uniform float maxDepthThreshold;\n uniform float depthScale;\n uniform float depthToBlurRatioBias;\n varying vec4 my_vUv;\n ",fragmentShader:"\n #include <emissivemap_fragment>\n float distortionFactor = 0.0;\n #ifdef USE_DISTORTION\n distortionFactor = texture2D(distortionMap, vUv).r * distortion;\n #endif\n \n vec4 new_vUv = my_vUv;\n new_vUv.x += distortionFactor;\n new_vUv.y += distortionFactor;\n \n vec4 base = texture2DProj(tDiffuse, new_vUv);\n vec4 blur = texture2DProj(tDiffuseBlur, new_vUv);\n \n vec4 merge = base;\n \n #ifdef USE_NORMALMAP\n vec2 normal_uv = vec2(0.0);\n vec4 normalColor = texture2D(normalMap, vUv * normalScale);\n vec3 my_normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) );\n vec3 coord = new_vUv.xyz / new_vUv.w;\n normal_uv = coord.xy + coord.z * my_normal.xz * 0.05;\n vec4 base_normal = texture2D(tDiffuse, normal_uv);\n vec4 blur_normal = texture2D(tDiffuseBlur, normal_uv);\n merge = base_normal;\n blur = blur_normal;\n #endif\n \n float blurFactor = 0.0;\n float depthFactor = 0.0001;\n \n #ifdef USE_DEPTH\n vec4 depth = texture2DProj(tDepth, new_vUv);\n depthFactor = smoothstep(minDepthThreshold, maxDepthThreshold, 1.0-(depth.r * depth.a));\n depthFactor *= depthScale;\n depthFactor = max(0.0001, min(1.0, depthFactor));\n #ifdef USE_BLUR\n blur = blur * min(1.0, depthFactor + depthToBlurRatioBias);\n merge = merge * min(1.0, depthFactor + 0.5);\n #else\n merge = merge * depthFactor;\n #endif\n #endif\n \n float reflectorRoughnessFactor = roughness;\n #ifdef USE_ROUGHNESSMAP\n vec4 reflectorTexelRoughness = texture2D( roughnessMap, vUv );\n reflectorRoughnessFactor *= reflectorTexelRoughness.g;\n #endif\n \n #ifdef USE_BLUR\n blurFactor = min(1.0, mixBlur * reflectorRoughnessFactor);\n merge = mix(merge, blur, blurFactor);\n #endif\n \n vec4 newMerge = vec4(0.0, 0.0, 0.0, 1.0);\n newMerge.r = (merge.r - 0.5) * mixContrast + 0.5;\n newMerge.g = (merge.g - 0.5) * mixContrast + 0.5;\n newMerge.b = (merge.b - 0.5) * mixContrast + 0.5;\n \n diffuseColor.rgb = diffuseColor.rgb * ((1.0 - min(1.0, mirror)) + newMerge.rgb * mixStrength);\n "},j="\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 ",F="\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 ",N={emissive:s.Gf.emissive,alphaTest:{type:"number",val:0,shortKey:"at"},colorGradient:{type:"color",label:["uniforms","colorGradient","value"],val:{r:0,g:1,b:0},shortKey:"cg"}};class z{constructor(e){this.runScene=e}undo(e){const{material:t,list:r,val:n}=e;this.runScene.undoEx.addUndo(new u.Z({target:t,typeList:[...r],newVal:n,cb:()=>{t.needsUpdate=!0}}).execute())}}(L=z).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines","onBeforeCompile"],z.TextureNames=["alphaMap","aoMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap"],z.tools={type:"TreeLeaf",getTextures:e=>{const t=[];return z.TextureNames.forEach((r=>{e[r]&&t.push({type:r,texture:e[r]})})),t},create:(e,t)=>{const r=new G(e);return L.tools.bind(r),(t=t||e.modelEx.select)&&(r.name=t.name,r.setSize(t),r.setWorldPos(t)),r},parseData:(e,t)=>{const{normal:r,texture:n,material:a,models:i}=e,{data:s,load:c}=n,u=(0,l.mergeMaterial)(a,new G(t)),h=(u.setSize(i[0]),u.setWorldPos(i[0]),[]);return c&&h.push(...s.map((e=>()=>{u[e.type]=e.texture}))),Object.keys(r.uniforms).filter((e=>!z.IgnoredAttributes.includes(e))).map((e=>{var t=r.uniforms[e];"color"!==e&&"emissive"!==e&&("normalScale"===e?u[e]=new o.Vector2(t.x,t.y):"windForce"===e||"windSpeed"===e||"windWaveScale"===e||"colorLevel"===e||"colorFade"===e||"leavesCore"===e?u.uniforms[e]=new o.Uniform(t):"colorGradient"===e?u.uniforms[e]=new o.Uniform(new o.Color(parseInt(t,16))):u[e]=r.uniforms[e])})),u.name=r.name,u.userData.id=a.userData.id,L.tools.bind(u),{material:u,setTextureFns:h}},toNormal:(e,t)=>{var r=L.tools.getTextures(e);const n=(0,l.mergeMaterial)(e,(0,l.createDefMaterial)()),a=(n.name=e.name,{}),i=new G(t);return Object.keys(e).filter((e=>!z.TextureNames.includes(e))).filter((e=>!z.IgnoredAttributes.includes(e))).map((t=>{var r=e[t],n=i[t];"color"!==t&&"emissive"!==t&&("normalScale"===t?r.x===n.x&&r.y===n.y||(a[t]=r):"uniforms"===t?Object.keys(r).map((t=>{const r=e.uniforms[t].value,n=i.uniforms[t].value;"windForce"===t||"windSpeed"===t||"windWaveScale"===t||"colorLevel"===t||"colorFade"===t||"leavesCore"===t?r!==n&&(a[t]=r):"colorGradient"===t&&r.getHexString()!==n.getHexString()&&(a[t]=r.getHexString())})):r!==n&&(a[t]=r))})),{material:n,normal:{type:L.tools.type,uniforms:a,name:e.name},textures:r}},clone:(e,t)=>e,copy:(e,t)=>{const r=L.tools.create(t);return Object.keys(r).filter((e=>!z.IgnoredAttributes.includes(e))).map((t=>{r[t]=e[t]})),r},bind:e=>{(0,h.M)(e,"type",L.tools.type)},validType:e=>"TreeLeaf"===e.userData.type,snapshot:{getDiff:e=>S.LV.getDiff(N,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;S.LV.set({def:N,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,l.updateMaterial)(r)}))}}};const V=new o.Clock;class G extends o.MeshStandardMaterial{constructor(e){super(),this.isSpecialMaterial=!0,this.uniforms={time:new o.Uniform(0),windForce:new o.Uniform(.3),windSpeed:new o.Uniform(.5),windWaveScale:new o.Uniform(.25),colorGradient:new o.Uniform(new o.Color(65280)),colorLevel:new o.Uniform(-.5),colorFade:new o.Uniform(-.25),leavesCore:new o.Uniform(.3),leavesSize:new o.Uniform(new o.Vector3),leavesPos:new o.Uniform(new o.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=j,e.fragmentShader=F,e.vertexShader=e.vertexShader.replace(/\/\/ Insert Noise3D/g,y)}}update(){this.uniforms.time.value=V.getElapsedTime()}setSize(e){var t=new o.Vector3;e.getWorldScale(t),t=new o.Vector3,(new o.Box3).setFromObject(e).getSize(t),this.uniforms.leavesSize.value=t}setWorldPos(e){var t=new o.Vector3;e.getWorldPosition(t),this.uniforms.leavesPos.value=t}}var H,W,q=r(3263);const K={color:s.Gf.color,opacity:s.Gf.opacity};class Z{constructor(e){this.runScene=e}}(H=Z).tools={type:"LineBasicMaterial",bind(e){(0,h.M)(e,"type","LineBasicMaterial")},create:()=>{var e=new o.LineBasicMaterial;return H.tools.bind(e),e},parseData:e=>{const{texture:t,normal:r,core:n,material:a}=e,{data:i,load:s}=t,o=[];return s&&o.push(...q.F6.filter(i.map((e=>{const{type:t,texture:r}=e;if(r)return()=>{n.runScene.uniqueEx.texture.addMaterial(r,{material:a,type:t})}})))),n.runScene.materialEx.parseNromals(r,a),H.tools.bind(a),{material:a,setTextureFns:o}},toNormal:e=>({material:e.clone(),normal:{type:H.tools.type},textures:[]}),clone:(e,t)=>e,copy:e=>e.clone(),getTextures:()=>[],snapshot:{getDiff:e=>S.LV.getDiff(K,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;S.LV.set({def:K,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,l.updateMaterial)(r)}))}},validType:e=>e.type===H.tools.type};class X{constructor(e){this.runScene=e}}(W=X).tools={type:"MyPointsMaterial",bind(e){(0,h.M)(e,"type","MyPointsMaterial")},getTextures:e=>["map","alphaMap"].map((t=>{var r=e[t];if(r)return{type:t,texture:r}})).filter((e=>e)),create:(e,t)=>(t=t.modelEx.def.vertices.rain.createMaterial(e),W.tools.bind(t),t),parseData:(e,t)=>{var{texture:e,material:r,normal:n}=e;const{data:a,load:i}=e,s=[];var{name:e,size:n}=n;const o=X.tools.create({size:n},t);return(0,M.x)(o,(0,M.Ki)(r)),e&&(o.name=e),i&&s.push(...a.map((e=>{const{type:t,texture:r}=e;return()=>{o[t]=r,(0,l.updateMaterial)(o)}}))),{material:o,setTextureFns:s}},toNormal:e=>{const t=(0,l.createDefMaterial)();var r={type:X.tools.type,name:e.name,size:e.size};return t.map=e.map,t.userData=Object.assign({},t.userData),{normal:r,textures:X.tools.getTextures(e),material:t}},clone:e=>e,copy:e=>{const t=e.clone();return t.userData.type=X.tools.type,t}};const Q={SpriteMaterial:k.Z,FakeInterior:d,Fresnel:f,Matcap:v,MixTexture:_,Physical:D,Reflector:I,TreeLeaf:z,BasicMaterial:s.ZP,LineBasicMaterial:Z,MyPointsMaterial:X};class Y{constructor(e){this.runScene=e,this.map={SpriteMaterial:new k.Z(e),FakeInterior:new d(e),Fresnel:new f(e),Matcap:new v(e),MixTexture:new _(e),Physical:new D(e),Reflector:new I(e),TreeLeaf:new z(e),BasicMaterial:new s.ZP(e)}}static create(e,t){return Q[e].tools.create(t)}static copy(e,t,r){return Q[e].tools.copy(t,r)}static clone(e,t){return Q[e].tools.clone(t)}static toNromal(e,t,r){return Q[e].tools.toNormal(t,r)}static parseData(e,t,r){var n=t.material;let a=e;return Q.LineBasicMaterial.tools.validType(n)&&(a=Q.LineBasicMaterial.tools.type),Q[a].tools.parseData(t,r)}static bind(e){e.material&&("MeshStandardMaterial"===e.material.type?s.ZP.tools.bind(e):"SpriteMaterial"===e.material.type&&k.Z.tools.bind(e))}static getTextures(e){var t=J(e);if(t)return Q[t].tools.getTextures(e);throw TypeError("该材质没有类型")}static parseNode(e){e.material&&(e=e.material,(0,l.isBaseMaterial)(e)&&s.ZP.tools.bind(e),e.isSpriteMaterial&&k.Z.tools.bind(e))}static validType(e,t){return!Q[e].tools.validType||Q[e].tools.validType(t)}}Y.snapshot={getDiff:e=>{var t=J(e);if(Q[t])return Q[t].tools.snapshot.getDiff(e);throw TypeError("该材质没有类型")},set:e=>{var t=e.material;if(t=J(t),Q[t])return Q[t].tools.snapshot.set(e);throw TypeError("该材质没有类型")}};const J=e=>{var t=e.userData.type;if(t)return Y.validType(t,e)?t:void 0}},932:(e,t,r)=>{r.r(t),r.d(t,{SpecialMaterial:()=>L,createDefMaterial:()=>w,defAllMaterialMap:()=>y,defBaseMaterialMap:()=>b,default:()=>x,disposeMaterial:()=>M,getBaseTextures:()=>E,getMaterialType:()=>I,getTextures:()=>_,getTexturesByMaterial:()=>T,initMaterial:()=>D,isBaseMaterial:()=>R,isColor:()=>P,isMaterial:()=>O,materialIgnore:()=>B,mergeMaterial:()=>S,setDefMaterialForSameGeo:()=>C,setMaterialTexture:()=>k,updateMaterial:()=>A});var n=r(6001),a=r(8881),i=r(4330),s=r(1794),o=r(3736),l=r(3625),c=r(8024),u=r(2510),h=r(3729),d=r(6272),p=r(4707);class f{constructor(e){this.data=this.getData(),this.pending=[],this.clonedTextures=[],this.mount=e=>{e.core.module.set("material",this)},this.complete=()=>{this.reset()},this.load=e=>{e=e.data;var{materialDef:e,material:t,model:r}=e;D(t),this.data.materialIns[e.id]||(this.data.materialIns[e.id]={material:t,models:[]}),this.data.materialIns[e.id].models.push(r)},this.done=e=>{const{json:t,core:r}=e;var{materialMap:e,textureMap:n}=(null==(e=t.asset)?void 0:e.ex)||{};this.processTextureMap(n||{}),this.processMaterialMap(e||{},t),this.processClonedTextures(),this.pending.push(this.loadTextures(r)),r.pending.push(Promise.all(this.pending))},this.parser=null,this.loadTexture=e=>{e=e.data;const{textureDef:t,texture:r}=e;var{md5:e,format:n,size:a,uvScript:i,unDelAble:s,unDelAbleRef:c,id:u,cloneSourceId:h,minFilter:d,isHdr:p}=t;r.userData.md5=e,r.userData.isHdr=p,n&&(r.format=n,r.userData.format=n),i&&(r.userData.uvScript=i),h&&((0,l.setTextureCloneId)(r,h),this.clonedTextures.push(r)),"nearest"===d&&((0,l.setTextureMinFilter)(r,"nearest"),(0,o.M)(r,"minFilter",d)),s&&l.unDelAbleTexture.set(r,s,c),r.userData.id=u,r.userData.size=a,this.data.textureIns[t.id]=this.runScene.textureEx.getSameTexture(e,r)||r},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,n.mapObj)(t,((t,r)=>{var{format:r,center:n,rotation:a,offset:i,repeat:s}=r;const o=this.data.textureIns[t];o&&(o.format=r,e({target:o.repeat,data:s}),e({target:o.center,data:n}),e({target:o.offset,data:i}),a&&(o.rotation=a),this.runScene.textureEx.initTextureAndAddtoAll(o))}))}})(),this.processMaterialMap=(()=>{const e=e=>{const{textures:t,normal:r,models:a,material:i}=e;e=(0,n.mapObj)(t,((e,t)=>({type:e,texture:this.data.textureIns[t]})));const{material:s,setTextureFns:o}=this.runScene.materialEx.parseData(r.type,{normal:r,texture:{data:e,load:this.runScene.optionsEx.options.texture.load},core:this,models:a,material:i});s&&(0<o.length&&this.lazyLoadFns.push(...o),a.map((e=>e.material=s)))};return(t,r)=>{(0,n.mapObj)(t,((t,a)=>{if(t=this.data.materialIns[t]){const{material:i,models:s}=t;if(i){const{normal:o,textures:l}=a;o.type||(o.type=p.ZP.tools.type),"scene"===(null==(a=null==(t=r.asset)?void 0:t.ex)?void 0:a.type)&&r.asset.ex.sceneEx.materialId===i.userData.id&&(0,n.mapObj)(l,((e,t)=>{t=this.data.textureIns[t],k({material:i,type:e,texture:t})})),e({textures:l,models:s,material:i,normal:o}),i.needsUpdate=!0}}}))}})(),this.lazyLoadFns=[],this.loadTextures=(()=>{const e=e=>{e.callback("lazyLoadedTexture",""),this.runScene.optionsEx.log("贴图懒加载完毕","base","success")},t=(r,n,a)=>{const i=this.lazyLoadFns[r];if(!i)return n(0),e(a);i(),setTimeout((()=>t(++r,n,a)),this.runScene.optionsEx.options.texture.lazyLoad.intervalTime)};return e=>new Promise((r=>{this.runScene.optionsEx.options.texture.lazyLoad.open?t(0,r,e):(this.lazyLoadFns.map((e=>e())),r(0))}))})(),this.afterParse=e=>{const{data:t,core:r,json:n}=e;if("material"===(null==(e=null==(e=n.asset)?void 0:e.ex)?void 0:e.type)){e=t.options.models;const[n]=e,a=[];n.material?(this.runScene.materialEx.add(n.material),a.push(n.material)):n.children.map((e=>{e.material&&(a.push(e.material),this.runScene.materialEx.add(e.material))})),r.models.push(...a)}},this.runScene=e}getData(){return{materialMap:{},textureMap:{},materialIns:{},textureIns:{}}}getMap(){return new s.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,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){this.parser=t}))}processClonedTextures(){this.clonedTextures.map((e=>{var t=(0,l.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,l.bindTextureBaseData)(e)):(this.runScene.textureEx.delete(e),(0,o.bv)(e,"cloneSourceId"),(0,l.disposeTexture)(e))}))}reset(){this.clonedTextures=[],this.data=this.getData(),this.pending=[]}}var m=r(7880);t=r(110);class g{constructor(e){this.resetItem=e=>{"material"===e.type&&e.datas.map((t=>{const r=t.data.get("material")||{};e.targets.map((e=>{var t=(0,m.ee)(e);t&&m.Ws[t].tools.snapshot&&(t=(0,h.Ki)(e))&&(r[t]=this.getItem(e))}))}))},this.getDiff=()=>{let e={};return this.runScene.uniqueEx.material.getAll("values").map((t=>{t=t.material;var r=(0,m.ee)(t);r&&m.Ws[r].tools.snapshot&&(r=(0,h.Ki)(t))&&(e[r]=this.getItem(t))})),e},this.create=e=>{e.data.set("material",this.getDiff())},this.set=e=>{var t=e.snapshot.data.get("material");t&&(0,n.mapObj)(t,((t,r)=>{(t=this.runScene.uniqueEx.material.get(t))&&m.ZP.snapshot.set({material:t,data:r,runScene:this.runScene,map:e})}))},this.runScene=e,this.runScene.cb.snapshot.create.add("material",this.create),this.runScene.cb.snapshot.set.add("material",this.set),this.runScene.cb.snapshot.resetItem.add("material",this.resetItem)}getItem(e){return m.ZP.snapshot.getDiff(e)}}var v=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const b={depthTest:!0,depthWrite:!0,alphaTest:0,side:0,displacementScale:1,visible:!0,normalScale:{x:1,y:1},aoMapIntensity:1,lightMapIntensity:1,envMapIntensity:1,fog:!0},y=["color","emissive","roughness","metalness","normalScale","aoMapIntensity","displacementScale","transparent","lightMapIntensity","envMapIntensity","opacity","alphaTest","fog"];class x{constructor(e){this.clean=()=>{this.dispose()},this.defMaterial=w(),this.addCb=e=>{this.runScene.cb.material.add.cb(e)},this.runScene=e,this.def=new m.ZP(e),this.snaphot=new g(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 f(e)}init(){var e={name:"material",loadCallBacks:this.import.getMap(),exportCallBacks:new s.Z};this.runScene.exporter.gltf.module.bind(e)}parse(e){m.Ws.LineBasicMaterial.tools.validType(e)&&m.Ws.LineBasicMaterial.tools.bind(e),this.setEnvStrength(e,this.runScene.sceneEx.envStrength)}add(e,t,r){B.is(e)||this.runScene.uniqueEx.material.add(e,t,r)}setEnvStrength(e,t,r=!1){void 0===e.envMapIntensity||e.envMapIntensity===t||!r&&e.envMapIntensity!==this.runScene.sceneEx.envStrength||(e.envMapIntensity=t,A(e))}create(e="BasicMaterial"){return e=m.ZP.create(e,this.runScene),this.add(e),e}toArray(){return(0,n.mapObj)(this.runScene.uniqueEx.material.map,((e,t)=>t.material))}copy(e){var t=I(e);if(t){const r=m.ZP.copy(t,e,this.runScene);return r.userData.id=(0,n.getId)(),r}}clone(e){var t=I(e);if(t){const r=m.ZP.clone(t,e);return r.userData.id=(0,n.getId)(),r}}setNormals(e,t=!0){const{info:r,newVal:n,materials:a,oldval:i,cb:s}=e;let o=n;return o.isVector2&&(o=o.clone()),e=a.map((e=>new c.Z({info:r,target:e,newVal:o,oldVal:i||e[r],runScene:this.runScene,cb:s}).execute())),t&&this.runScene.undoEx.addUndo(e),e}setNormal(e,t=!0){return e=new c.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:a,oldVal:i}=e;n instanceof File&&(e.newVal=yield this.runScene.textureEx.parse(n)),"envMap"===r&&(0,l.setTextureMapping)(e.newVal);var s=a.map((t=>new c.Z({info:r,target:t,newVal:e.newVal,oldVal:i||t[r],runScene:this.runScene}).execute()));return t&&this.runScene.undoEx.addUndo(s),a[0][r]}))}setTexture(e,t=!0){return v(this,void 0,void 0,(function*(){var{info:r,newVal:n,target:a}=e,n=(n instanceof File&&(e.newVal=yield this.runScene.textureEx.parse(n)),"envMap"===r&&(0,l.setTextureMapping)(e.newVal),new c.Z(Object.assign(Object.assign({},e),{oldVal:a[r],runScene:this.runScene})).execute());return t&&this.runScene.undoEx.addUndo(n),e.newVal}))}resetMaterial(e,t,r){const{addUndo:n,includeChild:a}=r=(0,d.Gm)({addUndo:!0,includeChild:!1},r);if(e&&t){const r=new Set;((0,d.lG)(e,"array")?e:[e]).map((e=>{a?e.traverse((e=>{R(e.material)&&r.add(e)})):e.material&&r.add(e)}));const i=[];r.forEach((e=>{i.push(new u.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(i)}}toNromal(e){var t=I(e);if(t){const r=m.ZP.toNromal(t,e,this.runScene);return r.material.userData=Object.assign(Object.assign({},r.material.userData),e.userData),r}}setSelect(e){this.select=e,this.runScene.cb.setSelectMaterial.cb(e)}parseData(e,t){return m.ZP.parseData(e,t,this.runScene)}dispose(){this.runScene.cb.material.dispose.cb("")}remove(e){const t=this.runScene.uniqueEx.material.getModels((0,h.Ki)(e));t&&(this.resetMaterial(t.toArray(),w()),this.runScene.cb.material.remove.cb(e))}getDefNromals(e){var t;return"BasicMaterial"!==(null==(t=e.userData)?void 0:t.type)?{}:(0,d.ad)(b,e)}parseNromals(e,t){(0,n.mapObj)(e,((e,r)=>{var n,a,i,s,o;void 0!==b[e]&&("object"==typeof r?(({x:i,y:s,z:o}=r),null!=(a=null==(n=t[e])?void 0:n.set)&&a.call(n,i,s,o)):t[e]=r)}))}isBaseMaterial(e){return"MeshStandardMaterial"===e.type&&"BasicMaterial"===e.userData.type&&!e.userData.isTimeLineUsed&&p.ZP.isDefVal(e)}setByType(e,t){"SpriteMaterial"===e&&!t.isSprite||(e=this.create(e))&&(this.add(e),this.runScene.modelEx.setMaterial(t,e))}}const w=e=>{const t=new a.MeshStandardMaterial(e);return t.userData.id=(0,n.getId)(),p.ZP.tools.bind(t),t},S=(e,t)=>(y.map((r=>{const n=e[r];"object"==typeof n&&(t[r]=n.clone()),t[r]=n})),t),M=e=>{e.dispose();const t=T(e);0!==t.length&&t.map((e=>{e=e.texture,(0,l.disposeTexture)(e)}))},T=e=>E(e),_=e=>m.ZP.getTextures(e)||E(e),E=e=>i.zX.map((t=>({type:t,texture:e[t]}))).filter((e=>e.texture)),k=e=>{const{material:t,type:r,texture:n}=e;"envMap"===r&&(0,l.setTextureMapping)(n),t[r]=n,t.needsUpdate=!0},D=e=>{e.vertexColors=!1,e.depthWrite=!0,e.needsUpdate=!1},P=e=>null==e?void 0:e.isColor,A=e=>{e.needsUpdate=!0},O=e=>null==e?void 0:e.isMaterial,C=e=>{},R=e=>(null==e?void 0:e.isMeshStandardMaterial)&&!e.isSpecialMaterial,L={Sprite:t.Z},I=e=>{var t;return(null==(t=null==e?void 0:e.userData)?void 0:t.type)||(null==e?void 0:e.type)},B={set(e,t){t?(0,o.M)(e,"ignore",!0):delete e.userData.ignore},is:e=>!0===(0,o.is)(e,"ignore")}},4707:(e,t,r)=>{r.d(t,{ZP:()=>v,Gf:()=>g});var n=r(8881),a=r(4330),i=r(3263),s=r(3736);const o="\n#define STANDARD\nuniform int uvCount;\n ",l="\nattribute vec2 uv2;\nvarying vec2 vUv2;\nuniform mat3 uv2Transform;\n ",c="\nvUv2 = (uv2Transform * vec3(uv2, 1)).xy;\n ",u="\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 ";var p,f=r(1398),m=r(932);const g={color:{type:"color",val:{r:1,g:1,b:1},shortKey:"clr"},map:{type:"texture",val:null,shortKey:"map"},emissiveMap:{type:"texture",val:null,shortKey:"em"},roughnessMap:{type:"texture",val:null,shortKey:"rm"},emissive:{type:"color",val:{r:0,g:0,b:0},shortKey:"emi"},roughness:{type:"number",val:1,shortKey:"rgh"},metalness:{type:"number",val:0,shortKey:"meta"},metalnessMap:{type:"texture",val:null,shortKey:"mm"},lightMap:{type:"texture",val:null,shortKey:"lm"},lightMapIntensity:{type:"number",val:1,shortKey:"lmi"},envMap:{type:"texture",val:null,shortKey:"envm"},envMapIntensity:{type:"number",val:1,shortKey:"envI"},opacity:{type:"number",val:1,shortKey:"opc",before:({target:e,end:t})=>{t<1&&!e.transparent&&(e.transparent=!0,(0,m.updateMaterial)(e))}},depthTest:{type:"other",val:!0,shortKey:"dt"},depthWrite:{type:"other",val:!0,shortKey:"dw"},fog:{type:"other",val:!0,shortKey:"fo"},wireframe:{type:"other",val:!1,shortKey:"wf"},alphaMap:{type:"texture",val:null,shortKey:"alpm"}};class v{constructor(e){this.init(e)}init(e){e.cb.material.add.add("base-material",(e=>{(0,m.isBaseMaterial)(e)&&"MeshPhysicalMaterial"!==e.type&&(v.tools.bind(e),e.userData.uvCount||(e.userData.uvCount=new n.Uniform(1)),e.onBeforeCompile=t=>{t.uniforms.uvCount=e.userData.uvCount,t.vertexShader=t.vertexShader.replace(/#include <uv2_pars_vertex>/g,l),t.vertexShader=t.vertexShader.replace(/#include <uv2_vertex>/g,c),t.fragmentShader=t.fragmentShader.replace(/#define STANDARD/g,o),t.fragmentShader=t.fragmentShader.replace(/#include <uv2_pars_fragment>/g,u),t.fragmentShader=t.fragmentShader.replace(/#include <map_fragment>/g,h),t.fragmentShader=t.fragmentShader.replace(/#include <emissivemap_fragment>/g,d)})}))}static isDefVal(e){for(const t in this.defVal){const r=this.defVal[t],a=e[t];if(r instanceof n.Color){if(r.getHexString()!==a.getHexString())return!1}else if("object"==typeof r){if(a.x!==r.x)return!1}else if(a!==r)return!1}for(const t of a.zX)if(e[t])return!1;return!0}create(){return(0,m.createDefMaterial)()}}(p=v).tools={type:"BasicMaterial",bind(e){(0,s.M)(e,"type","BasicMaterial")},create:()=>{var e=new n.MeshStandardMaterial;return p.tools.bind(e),e},parseData:e=>{const{texture:t,normal:r,core:n,material:a}=e,{data:s,load:o}=t,l=[];return o&&l.push(...i.F6.filter(s.map((e=>{const{type:t,texture:r}=e;if(r)return()=>{n.runScene.uniqueEx.texture.addMaterial(r,{material:a,type:t}),(0,m.setMaterialTexture)({material:a,type:t,texture:r})}})))),n.runScene.materialEx.parseNromals(r,a),{material:a,setTextureFns:l}},toNormal:e=>({material:e.clone(),normal:{type:v.tools.type},textures:(0,m.getBaseTextures)(e)}),clone:(e,t)=>e,copy:e=>e.clone(),getTextures:e=>(0,m.getBaseTextures)(e),snapshot:{getDiff:e=>f.LV.getDiff(g,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;f.LV.set({def:g,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,m.updateMaterial)(r)}))}},validType:e=>"MeshStandardMaterial"===e.type},v.defVal={color:new n.Color(16777215),emissive:new n.Color(0),roughness:1,metalness:0,lightMapIntensity:1,aoMapIntensity:1,emissiveIntensity:1,bumpScale:1,normalScale:new n.Vector2(1,1),displacementScale:1,envMapIntensity:1,wireframe:!1,transparent:!1,depthTest:!0,depthWrite:!0,opacity:1,fog:!0}},110:(e,t,r)=>{r.d(t,{Z:()=>h});var n,a=r(8881),i=r(8715),s=r(3736),o=r(1398),l=r(3729),c=r(932);const u={color:(t=r(4707)).Gf.color,map:t.Gf.map,opacity:t.Gf.opacity};class h{constructor(e){this.modelParse={toNormal:e=>{e=e.model;const t=(0,i.createDefModel)("Box");return t.userData.normal=Object.assign({type:"MySpriteMaterial"},e.userData),t.material=e.material,h.modelTools.merge(e,t),t},parse:e=>{var{model:e,normal:t}=e;const r=(0,i.createDefModel)("Sprite");var n=e.userData.layers;return(0,i.setLayers)(r,n),r.userData=Object.assign(Object.assign({},t),r.userData),h.modelTools.merge(e,r),r.material=e.material,r}},this.runScene=e;const t=h.modelTools.type,{parse:r,toNormal:n}=this.modelParse;e.cb.inited.add("MySpriteMaterial",(()=>{e.modelEx.importAndExport.addParses(t,{parse:r,toNormal:n})}))}}(n=h).tools={type:"SpriteMaterial",bind(e){(0,s.M)(e,"type","SpriteMaterial")},getTextures:e=>["map","alphaMap"].map((t=>{var r=e[t];if(r)return{type:t,texture:r}})).filter((e=>e)),create:()=>{var e=new a.SpriteMaterial;return n.tools.bind(e),e},parseData:(e,t)=>{var{texture:e,material:r,normal:n}=e;const{data:a,load:i}=e,s=[],o=(0,c.mergeMaterial)(r,h.tools.create(t));(0,l.x)(o,(0,l.Ki)(r));var{depthWrite:e,depthTest:t,name:r,fog:n}=n;return!1===n&&(o.fog=!1),void 0!==e&&(o.depthWrite=e),void 0!==t&&(o.depthTest=t),r&&(o.name=r),i&&s.push(...a.map((e=>{const{type:t,texture:r}=e;return()=>{o[t]=r}}))),{material:o,setTextureFns:s}},toNormal:e=>{const t=(0,c.mergeMaterial)(e,(0,c.createDefMaterial)());var r=Object.assign({},t.userData);const n={type:h.tools.type,name:e.name};return e.fog||(n.fog=!1),e.depthWrite!==c.defBaseMaterialMap.depthWrite&&(n.depthWrite=e.depthWrite),e.depthTest!==c.defBaseMaterialMap.depthTest&&(n.depthTest=e.depthTest),t.userData=r,{normal:n,textures:h.tools.getTextures(e),material:t}},clone:e=>e,copy:e=>{const t=e.clone();return t.userData.type=h.tools.type,t},snapshot:{getDiff:e=>o.LV.getDiff(u,e),set:e=>{const{map:t,material:r,runScene:n,data:a}=e;o.LV.set({def:u,data:a,runScene:n,map:t,target:r}),t.data.completedCbs.push((()=>{(0,c.updateMaterial)(r)}))}}},h.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,t.name=e.name,(0,s.M)(e,"name",e.name),(0,i.setLayers)(t,1===e.layers.mask?0:1)},toNormal:e=>{const t=(0,i.createDefModel)("Box");return t.userData.normal=Object.assign({type:"MySpriteMaterial"},e.userData),t.material=e.material,h.modelTools.merge(e,t),t},parseData:(e,t)=>{const r=(0,i.createDefModel)("Sprite");var n=e.userData.layers;return(0,i.setLayers)(r,n),r.userData=Object.assign(Object.assign({},t),r.userData),h.modelTools.merge(e,r),r.material=e.material,r},type:"MySpriteMaterial"}},3801:(e,t,r)=>{r.d(t,{Ju:()=>i,t9:()=>a,zf:()=>s});var n=r(3736);const a={isDynamic:()=>{}},i={isDeleted(e,t=!1){var r;return!!e&&(!(null==(r=null==e?void 0:e.userData)||!r.isDeleted)||!!t&&i.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)}},s={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||s.isLock(e.parent,t):void 0!==r&&r}}},8715:(e,t,r)=>{r.r(t),r.d(t,{createDefModel:()=>N,createSpecialModel:()=>F,default:()=>j,delClonedModel:()=>ee,deletedModel:()=>U.Ju,disposeModel:()=>z,dynamicModel:()=>U.t9,getClonedIdModel:()=>J,getDeepModels:()=>Z,getIdMapByModel:()=>ce,getModelSize:()=>ae,hasSkeleton:()=>X,helperModel:()=>oe,instanceModel:()=>V,isDynamicModel:()=>Y,isGLowModel:()=>te,isGroup:()=>ne,isHelper:()=>q,isSprite:()=>re,lockModel:()=>U.zf,mergeModel:()=>G,normalModel:()=>se,selectableModel:()=>ie,setClonedModel:()=>$,setDynamicModel:()=>Q,setHelper:()=>W,setLayers:()=>K,tempModel:()=>ue,uselessGroup:()=>le,withAnima:()=>H});var n=r(6001),a=r(8881),i=r(4091),s=r(4230);const o=["Group","Box","Circle","Cylinder","Dodecahedron","Icosahedron","Lathe","Octahedron","Plane","Ring","Sphere","Sprite","Tetrahedron","Torus","TorusKnot","Tube","Reflector","VerticesRain"];var l=r(1794),c=r(272),u=r(5247),h=r(1269),d=r(7880),p=r(932),f=r(3736);class m 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}}var g=r(3735),v=r(2510);class b 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 y=b;var x=r(7169),w=r(4380),S=r(3729),M=r(8089),T=r(5857);class _{constructor(e){this.definfo={speed:1,size:10,length:2e3},this.map=new l.Z,this.modelParse={toNormal:e=>{const{model:t,runScene:r}=e,n=N("Box");e=(0,S.Ki)(t);var a=r.modelEx.def.vertices.rain.map.get(e);if(n.material=t.material,!e||!a)throw TypeError("缺少属性");var{length:e,size:a,speed:i}=a;return n.userData.normal={type:_.modelTools.type,length:e,size:a,speed:i,materialId:(0,S.Ki)(t.material)},n},parse:e=>{const{runScene:t,normal:r,model:n}=e,a=t.modelEx.def.create(_.modelTools.type,r);return a.material=n.material,a.material.userData.id=r.materialId,a}},this.update=()=>{const e=this.runScene.assetsEx.get().camera;this.map.map(((t,r)=>{const{model:n,length:a,speed:i,del:s}=r;if(!s){n.position.set(e.position.x,e.position.y,e.position.z);for(let e=0;e<a;e++)n.geometry.attributes.position.setY(e,n.geometry.attributes.position.getY(e)-i),0<=i?n.geometry.attributes.position.getY(e)<=-1e3&&n.geometry.attributes.position.setY(e,1e3):1e3<=n.geometry.attributes.position.getY(e)&&n.geometry.attributes.position.setY(e,-1e3),n.geometry.attributes.position.needsUpdate=!0}}))},this.tools={type:"VerticesRain",merge:function(e,t){},toNormal:function(e){const t=N("Box");var r=(0,S.Ki)(e),n=this.map.get(r);if(t.material.map=e.material.map,r&&n)return t.userData.normal=Object.assign({type:this.tools.type},n),t;throw TypeError("缺少属性")},parseData:function(e,t){}},(this.runScene=e).cb.render.add("verticesRain",this.update),e.cb.model.add.add("verticesRain",(({model:e})=>{var t;if((null==(t=e.userData.normal)?void 0:t.type)===this.tools.type){const t=this.map.get((0,S.Ki)(e));t&&(t.del=!1)}})),e.cb.model.remove.add("verticesRain",(({model:e})=>{var t;if((null==(t=e.userData.normal)?void 0:t.type)===this.tools.type){const t=this.map.get((0,S.Ki)(e));t&&(t.del=!0)}})),e.cb.clean.add("verticesRain",(()=>{this.map.clear()}));const{toNormal:t,parse:r}=this.modelParse;e.cb.inited.add("VerticesRain",(()=>{e.modelEx.importAndExport.addParses(_.modelTools.type,{toNormal:t,parse:r})}))}bindMaterial(e,t){(0,f.M)(e,"id",t||(0,n.getId)()),(0,f.M)(e,"type","MyPointsMaterial")}create(e){var t=(e=e||this.definfo).length;const r=new T.Sf.Points(this.createGeo(t),this.createMaterial(e));return r.name="雨雪",r.renderOrder=1,t=(0,n.getId)(),(0,f.M)(r,"id",t),this.bindMaterial(r.material),(0,f.M)(r,"type",this.tools.type),(0,f.M)(r,"normal",{type:this.tools.type}),this.map.set(t,{model:r,length:e.length,size:e.size,speed:e.speed,del:!1}),r}createGeo(e){let t=[];const r=new a.BufferGeometry;for(let r=0;r<e;r++){var n=2e3*Math.random()-1e3,i=2e3*Math.random()-1e3,s=2e3*Math.random()-1e3;t.push(n,i,s)}return r.setAttribute("position",new a.Float32BufferAttribute(t,3)),r}createMaterial(e){var{size:e,map:t}=e;return new T.Sf.PointsMaterial({blending:T.Sf.AdditiveBlending,depthTest:!1,transparent:!0,size:e,map:t})}setForModel(e){var{model:e,type:t,data:r}=e;(e=(0,S.Ki)(e))&&this.set(e,t,r)}set(e,t,r){const n=this.map.get(e);if(n){const{model:e,size:i}=n;switch(t){case"show":e.visible=r;break;case"length":e.geometry=this.createGeo(r),n[t]=r;break;case"size":var a=e.material;e.material=this.createMaterial({map:e.material.map,size:r}),this.bindMaterial(e.material,(0,S.Ki)(a)),n[t]=r;break;case"speed":n[t]=r;break;case"texture":a=e.material,e.material=this.createMaterial({map:r,size:i}),this.bindMaterial(e.material,(0,S.Ki)(a))}}}}_.modelTools={type:"VerticesRain",parseData:function(e,t,r){const n=r.modelEx.def.create(_.modelTools.type,t);return n.material=e.material,n.material.userData.id=t.materialId,n},toNormal:(e,t,r)=>{const n=N("Box");var a=(0,S.Ki)(e);if(t=t.modelEx.def.vertices.rain.map.get(a),n.material=e.material,!a||!t)throw TypeError("缺少属性");var{length:a,size:t,speed:i}=t;return n.userData.normal={type:_.modelTools.type,length:a,size:t,speed:i,materialId:(0,S.Ki)(e.material)},n}};class E{constructor(e){this.runScene=e,this.rain=new _(e)}}class k{constructor(e){this.runScene=e,this.vertices=new E(e)}create(e,t){let r;return"VerticesRain"===e?r=this.vertices.rain.create(t):o.includes(e)&&(r=(0,M.Py)(e,t)),d.ZP.parseNode(r),r}}var D=r(4457);class P{constructor(e){this.runScene=e}init(){this.bindEvent()}bindEvent(){}}var A=r(2353),O=r(110);class C{constructor(e){this.data=this.getData(),this.parses=new l.Z,this.nodeType={MySpriteMaterial:O.Z,VerticesRain:_},this.mount=e=>{e.core.module.set("model",this)},this.complete=()=>{this.data=this.getData()},this.loadNodeDef=e=>{let{node:t,nodeDef:r}=e;(0,n.mapObj)(this.runScene.modelEx.defNodeMap,((e,n)=>{var a=r[e];null!=a&&(t[e]=a)})),r.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=>{const{config:t,data:r,json:n,core:a}=e;if("model"===(null==(e=null==(e=n.asset)?void 0:e.ex)?void 0:e.type)){if(null==(e=t.module)||!e.model)return[];let n=["glb_model"===(e=(e=r.options).models[0]).name&&(null==e?void 0:e.children[0])||e];var[e]=n;le.is(e)&&(n=[...e.children]),a.models.push(...n),this.mergeClone()}},this.toNromal=e=>{var t=e.type;const r=this.parses.get(t);if(r)return r.toNormal(e)},this.parse=e=>{var t=e.type;const r=this.parses.get(t);if(r)return r.parse(e)},this.runScene=e}getData(){return{map:new l.Z,clonedMap:{},instancedMap:{},helperModels:[]}}getMap(){return new l.Z({loadNode:this.load,loadedGltf:this.done,afterParse:this.afterParse,complete:this.complete,mountModule:this.mount})}addParses(e,t){this.parses.set(e,t)}loadExtras(e,t){let{node:r,nodeDef:n}=e;if(n.extras){const{layers:o,normal:l,local:c,cloneId:u,id:h,animations:d,isDynamic:p}=n.extras;var a,i=Y(r,!0),s=("running"!==this.runScene.optionsEx.options.mode||i||null!=(s=this.runScene.optionsEx.options.renderConfig)&&s.matrixAutoUpdate||(r.matrixAutoUpdate=!1),d&&(r.animations=A.B.parse(d)),p&&(r.userData.isDynamic=!0),!u||i||(this.data.instancedMap[u]||(this.data.instancedMap[u]=new Set),this.data.instancedMap[u].add(r)),c&&([s,i,a]=c.split(","),r.position.set(s,i,a)),o&&(r.layers.enable(1),this.runScene.cb.model.setLayers.cb({model:r,val:1})),n.extras.isHelper&&this.data.helperModels.push(r),l&&(e.node=this.parse({type:l.type,model:e.node,normal:l,runScene:this.runScene})),h&&this.data.map.set(h,e.node),null==(a=null==(i=null==(s=e.node)?void 0:s.material)?void 0:i.userData)?void 0:a.id);if(s){const r=t.module.get("material").data.materialIns[s];r&&r.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,n.mapObj)(e,((e,t)=>{var r,n=this.runScene.uniqueEx.model.map[e];t.size<2||!n||!n.geometry||Y(n,!0)||(r=V(n,[...t]),this.runScene.modelEx.add(r,void 0,{isClone:!1,select:!1,addUndo:!1}),te(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.data.instancedMap[e])}))),this.data.instancedMap={}}mergeGeometry(){}}var R=r(228),L=r(1398);const I={position:{type:"v3",val:{x:0,y:0,z:0},shortKey:"po"},rotation:{type:"v3",val:{x:0,y:0,z:0},shortKey:"ro"},scale:{type:"v3",val:{x:1,y:1,z:1},shortKey:"scl"},visible:{type:"other",val:!0,shortKey:"vi"},castShadow:{type:"other",val:!1,shortKey:"ca"},receiveShadow:{type:"other",val:!1,shortKey:"rec"},renderOrder:{type:"other",val:0,shortKey:"ren"}};class B{constructor(e){this.resetItem=e=>{"model"===e.type&&e.datas.map((t=>{const r=t.data.get("model")||{},n=new c.Z;if(e.targets.map((e=>{var t=(0,S.Ki)(e);t&&(e.material&&n.add(e.material),r[t]=this.getItem(e))})),0!==n.size){const t=new c.Z;n.map((e=>{const r=d.ZP.getTextures(e);0!==r.length&&t.add(r.map((e=>e.texture)))})),this.runScene.cb.snapshot.resetItem.cb({type:"texture",datas:e.datas,targets:t.toArray()}),this.runScene.cb.snapshot.resetItem.cb({type:"material",datas:e.datas,targets:n.toArray()})}}))},this.create=e=>{e.data.set("model",this.getDiff())},this.set=e=>{var t=e.snapshot.data.get("model");if(t){const r=e.data.completedCbs;this.runScene.pp.clearAllOutlineObj(),(0,n.mapObj)(t,((t,n)=>{const a=this.runScene.uniqueEx.model.get(t);a&&(L.LV.set({def:I,runScene:this.runScene,data:n,target:a,map:e}),t=n[I.visible.shortKey],a.visible=void 0===t,r.push((()=>{var e;this.runScene.modelEx.setGlow(a,!!n.isGLow),n.isOutline&&this.runScene.pp.addOutlineObj(a),this.runScene.cb.model.change.cb({model:a,type:"visible",val:a.visible}),n.materialId&&(e=this.runScene.uniqueEx.material.get(n.materialId))&&this.runScene.materialEx.resetMaterial(a,e,{addUndo:!1,includeChild:!1})})))}))}},this.runScene=e,this.runScene.cb.snapshot.create.add("scene",this.create),this.runScene.cb.snapshot.set.add("scene",this.set),this.runScene.cb.snapshot.resetItem.add("scene",this.resetItem)}getItem(e){const t=L.LV.getDiff(I,e);return te(e)&&(t.isGLow=!0),(0,R.S)(e)&&(t.isOutline=!0),e.material&&(t.materialId=(0,S.Ki)(e.material)),t}getDiff(){const e={};return this.runScene.sceneEx.getClearModels().map((t=>{t.traverse((t=>{var r=(0,S.Ki)(t);r&&(e[r]=this.getItem(t))}))})),e}getData(){}}var U=r(3801);class j{constructor(e){this._selectModel=void 0,this.geometryMap=new l.Z,this.clonedMap=new l.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,r,n)=>{var{addUndo:a,isClone:i,select:s,addToTree:o}=(0,D.mergeObject)({addUndo:!0,isClone:!1,select:!1,addToTree:!0},n);return t instanceof Array?t.map((e=>this.add(e,r,n))):(e(t,i),this.setGeometryMap(t),this.setCloneMap(t),o=new m({model:t,parent:r||this.runScene.sceneEx.get(),isClone:i,addTree:o,runScene:this.runScene}).execute(),!0===a&&this.runScene.undoEx.addUndo(o),s&&this.setSelectByModel(t,{isDomTreeActive:!1,isClone:i}),o)}})(),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 a,i,s=X(t),o=(e=>{const t={};return(0,D.getModelMap)(e,"id",(e=>{0<e.animations.length&&(t[(0,S.Ki)(e)]=e.animations)})),t})(t),l=(s=s?function(e){var t=new Map,r=new Map,n=e.clone();return function e(t,r,n){n(t,r);for(var a=0;a<t.children.length;a++)e(t.children[a],r.children[a],n)}(e,n,(function(e,n){t.set(n,e),r.set(e,n)})),n.traverse((function(e){var n,a;e.isSkinnedMesh&&(a=(n=t.get(e)).skeleton.bones,e.skeleton=n.skeleton.clone(),e.bindMatrix.copy(n.bindMatrix),e.skeleton.bones=a.map((function(e){return r.get(e)})),e.bind(e.skeleton,e.bindMatrix))})),n}(t):t.clone(),l=t,(0,f.M)(s,"cloneId",J(l)||l.userData.id),(0,f.is)(t,"isDynamic")&&Q(s,!0),(0,D.getModelMap)(s,"id"));c=s,(i=null==t?void 0:t.material)&&(a=d.ZP.clone((0,d.ee)(i),i))&&a.uuid!==i.uuid&&(e.materialEx.resetMaterial(c,a,{addUndo:!0}),e.materialEx.add(a,t,i));{var c={newModel:s,newModelMap:l,animaMap:o};const{animaMap:t,newModelMap:r}=c;(0,n.mapObj)(t,((t,a)=>{const i=r[t],s={};i&&(i.animations=[...a.map((e=>{const t=e.clone();return t.tracks.map((e=>{var[t]=e.name.split(".");s[t]||(s[t]=[]),s[t].push(e)})),t}))],(0,n.mapObj)(s,((t,r)=>{var a=i.getObjectByName(t);if(a){(0,f.M)(a,"id",(0,n.getId)());const i=e.uniqueEx.model.parseName(a);r.map((e=>{e.name=i+e.name.slice(t.length)}))}})))}))}return r&&e.uniqueEx.model.add(s,{hasReset:!0}),s})(e),this.runScene.cb.clean.add("EngineModel",this.clean),this.export=new P(e),this.importAndExport=new C(e),this.snapsot=new B(e),this.def=new k(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.importAndExport.getMap(),exportCallBacks:new l.Z};this.runScene.exporter.gltf.module.bind(e)}setGeometryMap(e){if((0,D.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,S.Ki)(e))),this.setGeometryMap(e.children)}isSameGeo(e,t){var{normal:e,position:r,uv:n}=e.attributes,{normal:t,position:a,uv:i}=t.attributes;return e.array.length===t.array.length&&r.array.length===a.array.length&&n.array.length===i.array.length&&(e=(0,D.sameArr)([...e.array],[...t.array],20),t=(0,D.sameArr)([...r.array],[...a.array],20),r=(0,D.sameArr)([...n.array],[...i.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,D.validType)(e,"array"))return e.map((e=>this.setGeometryMap(e)));var t=J(e);(t||this.getClonedIdFromModel(e))&&(this.clonedMap.get(t)||this.clonedMap.set(t,new c.Z),this.clonedMap.get(t).add((0,S.Ki)(e)),this.setCloneMap(e.children))}removeCloneMap(e){this.clonedMap.get((0,S.Ki)(e))}replaceClonedGroup(e,t){t=J(t)||(0,S.Ki)(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:a,name:i,parent:s}=t;this.remove(t,!1);const o=this.runScene.modelEx.clone(e);o.userData.id=(0,S.Ki)(t),o.position.copy(r),o.rotation.copy(n),o.scale.copy(a),o.name=i,this.add(o,s,{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,S.Ki)(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&&(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 r=[];Array.isArray(e)?r.push(...e):r.push(e),e=r.map((e=>new x.Z({runScene:this.runScene,model:e,parent:e.parent||this.runScene.sceneEx.get()}).execute())),t&&this.runScene.undoEx.addUndo(e)}isNavieV3(e,t){var{x:e,y:r,z:n}=e;return e===(t=t?1:0)&&r===t&&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,!1)&&this.isNavieV3(e.rotation,!1)&&this.isNavieV3(e.scale,!0)&&0===e.children.length&&!H(e)}isUnlessLevel(e){return this.isNavieV3(e.position,!1)&&this.isNavieV3(e.rotation,!1)&&this.isNavieV3(e.scale,!0)&&1===e.children.length&&!H(e)}create(){var e=(0,D.getModelByType)("Box");return d.ZP.parseNode(e),e}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 y({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:s,oldV3:o}=e;var l,c;if(s.isVector3||s.isEuler||(({x:u,y:l,z:c}=s),s=new a.Vector3(u,l,c)),(0,D.isRunning)(this.runScene))return this._setV3(e);var u=n instanceof Array?n.map((e=>new w.Z({target:e,info:i,runScene:this.runScene,oldV3:o||e[i].clone(),newV3:s}).execute(r))):new w.Z({target:n,info:i,oldV3:o||n[i].clone(),newV3:s,runScene:this.runScene}).execute(r);t&&this.runScene.undoEx.addUndo(u)}setNormal(e,t=!0){const{model:r,oldVal:n,info:a,val:i,executeCb:s}=e;return e=r instanceof Array?r.map((e=>new v.Z({target:e,info:a,runScene:this.runScene,oldVal:n||r[a],newVal:i,executeCb:s}).execute())):new v.Z({target:r,info:a,runScene:this.runScene,oldVal:n||r[a],newVal:i,executeCb:s}).execute(),t&&this.runScene.undoEx.addUndo(e),e}setMaterial(e,t,r=!0){var n=new v.Z({target:e,info:"material",runScene:this.runScene,oldVal:e.material,newVal:t}).execute();this.select===e&&this.runScene.cb.setSelectMaterial.cb(t),e.material.needsUpdate=!0,r&&this.runScene.undoEx.addUndo(n)}addDef(e){this.add(this.def.create(e),void 0,{select:!0})}isModel(e){return!(e.isLight||e.isCamera)}getSphere(){var e=new a.MeshBasicMaterial,t=new a.SphereGeometry(.7,150,150);return new a.Mesh(t,e)}getIndexByModel(e){var t;return e.parent?null==(t=e.parent)?void 0:t.children.findIndex((t=>t===e)):-1}getBeTweenChildByTwoModel(e,t){if(e.parent.uuid===t.parent.uuid){var r=this.getIndexByModel(e);if(t=this.getIndexByModel(t),-1!==r&&-1!==t){const n=Math.max(r,t),a=r===n?t:r;return e.parent.children.map(((e,t)=>t>a&&t<n&&e)).filter((e=>e))}}}setMultip(e){var{model:e,typeList:t,newVal:r}=e;this.runScene.undoEx.addUndo(new g.Z({target:e,typeList:t,newVal:r}).execute())}createGroup(e,t,r){const n=t||new a.Group,i=[];i.push(new m({model:n,runScene:this.runScene,parent:r||this.runScene.assetsEx.get().scene}).execute()),e instanceof Array?i.push(...e.map((e=>new y({target:e,oldParent:e.parent,newParent:n,runScene:this.runScene}).execute()))):i.push(new y({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,n.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 y({target:e,oldParent:e.parent,newParent:e.parent.parent,runScene:this.runScene})})).filter((e=>e));return r.push(...n.map((e=>e.execute()))),r.push(new x.Z({runScene:this.runScene,model:e,parent:e.parent}).execute()),t&&this.runScene.undoEx.addUndo(r),r}}hideOther(e){const t=e.uuid,r=0<e.children.length,n=this.runScene.sceneEx.getClearModels(),a=[];n.map((n=>{n.traverse((n=>{r?!1===(0,D.deepFindParentByUuid)(n,t)&&n.uuid!==e.uuid&&a.push(n):n.uuid!==e.uuid&&a.push(n)}))}));var i=a.map((e=>new v.Z({target:e,info:"visible",newVal:!1,runScene:this.runScene,oldVal:e.visible}).execute()));this.runScene.undoEx.addUndo(i),(0,D.setParentVisible)(e,!0)}showAll(){const e=this.runScene.sceneEx.getClearModels(),t=[];e.map((e=>{e.traverse((e=>{"materialHelper"!==e.name&&!1===e.visible&&t.push(e)}))}));var r=t.map((e=>new v.Z({target:e,info:"visible",runScene:this.runScene,newVal:!0,oldVal:e.visible}).execute()));this.runScene.undoEx.addUndo(r)}removeHide(){const e=this.runScene.sceneEx.getClearModels(),t=new Set,r=[];e.map((e=>{e.traverse((e=>{e.visible||t.add(e)}))})),t.forEach((e=>{r.push(new x.Z({runScene:this.runScene,model:e,parent:e.parent}).execute())})),this.runScene.undoEx.addUndo(r)}_getModel(e){var t=this.runScene.uniqueEx.model.nameMap[e];if(t)return this.runScene.uniqueEx.model.get(t)||this.runScene.assetsEx.scene.getObjectByName(e)}getModel(e,t="array"){if(!(e instanceof Array))return this._getModel(e);if("array"===t)return e.map((e=>this._getModel(e)));if("map"===t){const t={};return e.map((e=>{t[e]=this.getModel(e)})),t}}getWorldLocal(e){this.runScene.assetsEx.scene.updateMatrixWorld(!0);var t=new a.Vector3;return e.getWorldPosition(t),t}getClickObj(e,t,r=!1){let n=new a.Raycaster,i=new a.Vector2,s=(i.x=e.offsetX/this.runScene.assetsEx.engineDom.clientWidth*2-1,i.y=-e.offsetY/this.runScene.assetsEx.engineDom.clientHeight*2+1,n.setFromCamera(i,this.runScene.assetsEx.camera),n.intersectObjects(t,!0)),o={intersects:null,obj:null};if(0===s.length)return o;if(r){if(0===(e=s.filter((e=>(0,D.isVisible)(e.object)))).length)return o;o={intersects:e,obj:e[0].object}}else o={intersects:s,obj:s[0].object};return o}getCamLocal(){var{x:e,y:t,z:r}=this.runScene.assetsEx.camera.position,{x:n,y:a,z:i}=this.runScene.assetsEx.controls.target;return{cx:e,cy:t,cz:r,tx:n,ty:a,tz:i}}camAnima(e,t,r=1,n,a){return(0,D.anima)(e,t,r,(e=>{a&&a(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(),s=new a.Vector3,o=new a.Vector3;if("Mesh"===e.type||"Group"===e.type||"Object3D"===e.type){const e=this.runScene.helperEx.boxHelper;if(e.update(),!e||!e.object)return;var l=n.domElement.getBoundingClientRect();let t=l.width/l.height;const i=new a.Vector3;l=e.geometry.attributes.position.array,i.set(Math.abs(l[0]-l[3]),Math.abs(l[1]-l[7]),Math.abs(l[2]-l[14])),o.x=.5*(l[0]+l[3]),o.y=.5*(l[1]+l[7]),o.z=.5*(l[2]+l[14]);let c=new a.Vector3;c.subVectors(r.position,o),c.projectOnPlane(new a.Vector3(0,1,0)),c.normalize(),1<t&&(t=1/t),l=2*Math.tan(.5*r.fov*Math.PI/180),l=i.length()/t/l,s.addVectors(o,c.multiplyScalar(l))}else{t.updateMatrixWorld(!0),l=new a.Vector3,e.getWorldPosition(l),o.set(l.x,l.y,l.z);let n=new a.Vector3;n.subVectors(r.position,o),n.projectOnPlane(new a.Vector3(0,1,0)),n.normalize(),s.addVectors(o,n.multiplyScalar(3))}(0,D.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:s.x,positionY:s.y,positionZ:s.z,targetX:o.x,targetY:o.y,targetZ:o.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],a=[];r.map((e=>{e.traverse((e=>{var r;e.geometry&&!Y(e)&&(r=J(e))&&(a.push(e),t[r]||(t[r]=new Set),t[r].add(e))}))})),(0,n.mapObj)(t,((e,t)=>{e=this.runScene.uniqueEx.model.get(e),t.size<2||!e||(t=V(e,[...t]),this.runScene.modelEx.add(t,void 0,{isClone:!1,select:!1,addUndo:!1}),te(e)&&this.setGlow(t,!0),this.runScene.modelEx.remove(e,!1))})),a.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=>{z(e,{remove:!1}),this.runScene.cb.model.dispose.cb(e)})),this.runScene.modelEx.selectNull(),this.geometryMap.clear()}getHoverFromModels(e,t,r){const{getOriginData:n,ignoreMove:i}=(0,D.mergeObject)({ignoreMove:!1,getOriginData:!1},r);this.runScene.cb.events.pointer.move.add("get-hover-from-models",(r=>{if(i||!this.runScene.events.mouse.isMove){const i=new a.Raycaster,u=new a.Vector2,{engineDom:h,camera:d}=this.runScene.assetsEx.get();var{top:s,left:o,width:l,height:c}=h.getBoundingClientRect(),o=r.pageX-o;r=r.pageY-s,u.x=o/l*2-1,u.y=-r/c*2+1,i.setFromCamera(u,d);const p=i.intersectObjects(e||[],!0);null!=t&&t(0===p.length?null:n?p:p.map((e=>e.object)))}}))}}const F=e=>{},N=e=>{if(o.includes(e))return e=(0,D.getModelByType)(e),d.ZP.parseNode(e),e;throw TypeError("")},z=(e,t)=>{t=(t||{}).remove;const{geometry:r,material:n}=e;r&&(null!=r&&r.dispose(),delete e.geometry),n&&((0,p.disposeMaterial)(e.material),e.material.dispose(),delete e.material),!1!==t&&e.parent&&e.parent.remove(e)},V=(e,t)=>{var{material:r,geometry:n}=e;const a=new u.Z.InstancedMesh(n,r,t.length+1);return[e,...t].map(((e,t)=>{e.updateMatrix(),a.setMatrixAt(t,e.matrixWorld)})),a.name=e.name,a},G=(e,t)=>{const r=[];if(t.map((e=>{e=e.geometry,r.push(e)})),t=i.qf(r))return new u.Z.Mesh(t,e)},H=e=>0!==e.animations.length,W=e=>{e&&e.userData&&(e.userData.isHelper=!0)},q=e=>null==(e=null==e?void 0:e.userData)?void 0:e.isHelper,K=(e,t)=>{null!=t&&(0===t?e.layers.set(0):e.layers.enable(1),(0,f.M)(e,"layers",t))},Z=e=>{const t=[];e.traverse((e=>{t.push(e)}))},X=e=>{let t=!1;if(e)return e.traverse((e=>{e.isSkinnedMesh&&(t=!0)})),t},Q=(e,t)=>{t?(0,f.M)(e,"isDynamic",!0):delete e.userData.isDynamic},Y=(e,t)=>e&&t?!!e.userData.isDynamic||!!e.parent&&Y(e.parent,t):null==(t=null==e?void 0:e.userData)?void 0:t.isDynamic,J=e=>e.userData.cloneId,$=(e,t)=>{(0,f.M)(e,"cloneId",t)},ee=e=>{delete e.userData.cloneId},te=e=>1===e.userData.layers,re=e=>e.isSprite,ne=e=>{},ae=e=>{var t=new a.Vector3;return(new a.Box3).setFromObject(e).getSize(t),t},ie={open(e){delete e.userData.unSelectable},close(e){e.userData.unSelectable=!0},is:e=>void 0===e.userData.unSelectable},se={set(e,t){t?delete e.userData.unNormal:e.userData.unNormal=!0},is:e=>!(0,h.RQ)(e)&&!(0,s.N)(e)&&void 0===e.userData.unNormal,hasUnNormal:e=>void 0!==(null==(e=null==e?void 0:e.userData)?void 0:e.unNormal)},oe={is:e=>null==(e=null==e?void 0:e.userData)?void 0:e.isHelper,set(e,t=!0){t?e.userData.isHelper=!0:delete e.userData.isHelper}},le={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}},ce=(e,t)=>{let r=[];Array.isArray(e)?r.push(...e):r.push(e);const n={};return r.map((e=>e.traverse((e=>{null!=t&&t(e),n[(0,S.Ki)(e)]=e})))),n},ue={is:e=>!(null==(e=null==e?void 0:e.userData)||!e.isTemp),set(e,t){t?e.userData.isTemp=t:delete e.userData.isTemp}}},228:(e,t,r)=>{r.d(t,{Q:()=>d,S:()=>p});var n=r(5857),a=r(8881),i=r(4819),s=r(6608);function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){return(l=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,n=u(e);if(r=t?(r=u(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===o(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var h=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&&l(t,e);var r=c(n);function n(e,t,o,l){var c;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");return(c=r.call(this)).renderScene=t,c.renderCamera=o,c.selectedObjects=void 0!==l?l:[],c.visibleEdgeColor=new a.Color(1,1,1),c.hiddenEdgeColor=new a.Color(.1,.04,.02),c.edgeGlow=0,c.usePatternTexture=!1,c.edgeThickness=1,c.edgeStrength=3,c.downSampleRatio=2,c.pulsePeriod=0,c._visibilityCache=new Map,c.resolution=void 0!==e?new a.Vector2(e.x,e.y):new a.Vector2(256,256),t=Math.round(c.resolution.x/c.downSampleRatio),o=Math.round(c.resolution.y/c.downSampleRatio),c.renderTargetMaskBuffer=new a.WebGLRenderTarget(c.resolution.x,c.resolution.y),c.renderTargetMaskBuffer.texture.name="OutlinePass.mask",c.renderTargetMaskBuffer.texture.generateMipmaps=!1,c.depthMaterial=new a.MeshDepthMaterial,c.depthMaterial.side=a.DoubleSide,c.depthMaterial.depthPacking=a.RGBADepthPacking,c.depthMaterial.blending=a.NoBlending,c.prepareMaskMaterial=c.getPrepareMaskMaterial(),c.prepareMaskMaterial.side=a.DoubleSide,c.prepareMaskMaterial.fragmentShader=function(e,t){return t=t.isPerspectiveCamera?"perspective":"orthographic",e.replace(/DEPTH_TO_VIEW_Z/g,t+"DepthToViewZ")}(c.prepareMaskMaterial.fragmentShader,c.renderCamera),c.renderTargetDepthBuffer=new a.WebGLRenderTarget(c.resolution.x,c.resolution.y),c.renderTargetDepthBuffer.texture.name="OutlinePass.depth",c.renderTargetDepthBuffer.texture.generateMipmaps=!1,c.renderTargetMaskDownSampleBuffer=new a.WebGLRenderTarget(t,o),c.renderTargetMaskDownSampleBuffer.texture.name="OutlinePass.depthDownSample",c.renderTargetMaskDownSampleBuffer.texture.generateMipmaps=!1,c.renderTargetBlurBuffer1=new a.WebGLRenderTarget(t,o),c.renderTargetBlurBuffer1.texture.name="OutlinePass.blur1",c.renderTargetBlurBuffer1.texture.generateMipmaps=!1,c.renderTargetBlurBuffer2=new a.WebGLRenderTarget(Math.round(t/2),Math.round(o/2)),c.renderTargetBlurBuffer2.texture.name="OutlinePass.blur2",c.renderTargetBlurBuffer2.texture.generateMipmaps=!1,c.edgeDetectionMaterial=c.getEdgeDetectionMaterial(),c.renderTargetEdgeBuffer1=new a.WebGLRenderTarget(t,o),c.renderTargetEdgeBuffer1.texture.name="OutlinePass.edge1",c.renderTargetEdgeBuffer1.texture.generateMipmaps=!1,c.renderTargetEdgeBuffer2=new a.WebGLRenderTarget(Math.round(t/2),Math.round(o/2)),c.renderTargetEdgeBuffer2.texture.name="OutlinePass.edge2",c.renderTargetEdgeBuffer2.texture.generateMipmaps=!1,c.separableBlurMaterial1=c.getSeperableBlurMaterial(4),c.separableBlurMaterial1.uniforms.texSize.value.set(t,o),c.separableBlurMaterial1.uniforms.kernelRadius.value=1,c.separableBlurMaterial2=c.getSeperableBlurMaterial(4),c.separableBlurMaterial2.uniforms.texSize.value.set(Math.round(t/2),Math.round(o/2)),c.separableBlurMaterial2.uniforms.kernelRadius.value=4,c.overlayMaterial=c.getOverlayMaterial(),l=s.C,c.copyUniforms=a.UniformsUtils.clone(l.uniforms),c.copyUniforms.opacity.value=1,c.materialCopy=new a.ShaderMaterial({uniforms:c.copyUniforms,vertexShader:l.vertexShader,fragmentShader:l.fragmentShader,blending:a.NoBlending,depthTest:!1,depthWrite:!1,transparent:!0}),c.enabled=!0,c.needsSwap=!1,c._oldClearColor=new a.Color,c.oldClearAlpha=1,c.fsQuad=new i.T(null),c.tempPulseColor1=new a.Color,c.tempPulseColor2=new a.Color,c.textureMatrix=new a.Matrix4,c}return t=n,(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(),this.depthMaterial.dispose(),this.prepareMaskMaterial.dispose(),this.edgeDetectionMaterial.dispose(),this.separableBlurMaterial1.dispose(),this.separableBlurMaterial2.dispose(),this.overlayMaterial.dispose(),this.materialCopy.dispose(),this.fsQuad.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 a=0;a<this.selectedObjects.length;a++)this.selectedObjects[a].traverse(n);this.renderScene.traverse((function(n){if(n.isMesh||n.isSprite){for(var a,i=!1,s=0;s<r.length;s++)if(r[s].id===n.id){i=!0;break}!1===i&&(a=n.visible,!1!==e&&!0!==t.get(n)||(n.visible=e),t.set(n,a))}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,a,i){var s,o;0<this.selectedObjects.length&&(e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha(),s=e.autoClear,e.autoClear=!1,i&&e.state.buffers.stencil.setTest(!1),e.setClearColor(16777215,1),this.changeVisibilityOfSelectedObjects(!1),o=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=o,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&&(o=.625+.75*Math.cos(.01*performance.now()/this.pulsePeriod)/2,this.tempPulseColor1.multiplyScalar(o),this.tempPulseColor2.multiplyScalar(o)),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=n.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=n.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=n.BlurDirectionX,e.setRenderTarget(this.renderTargetBlurBuffer2),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetBlurBuffer2.texture,this.separableBlurMaterial2.uniforms.direction.value=n.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,i&&e.state.buffers.stencil.setTest(!0),e.setRenderTarget(r),this.fsQuad.render(e),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=s),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 a.ShaderMaterial({uniforms:{depthTexture:{value:null},cameraNearFar:{value:new a.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\n\t\t\t\t\tvec4 worldPosition = vec4( transformed, 1.0 );\n\n\t\t\t\t\t#ifdef USE_INSTANCING\n\n\t\t\t\t\t\tworldPosition = instanceMatrix * worldPosition;\n\n\t\t\t\t\t#endif\n\t\t\t\t\t\n\t\t\t\t\tworldPosition = modelMatrix * worldPosition;\n\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 a.ShaderMaterial({uniforms:{maskTexture:{value:null},texSize:{value:new a.Vector2(.5,.5)},visibleEdgeColor:{value:new a.Vector3(1,1,1)},hiddenEdgeColor:{value:new a.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 a.ShaderMaterial({defines:{MAX_RADIUS:e},uniforms:{colorTexture:{value:null},texSize:{value:new a.Vector2(.5,.5)},direction:{value:new a.Vector2(.5,.5)},kernelRadius:{value:1}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec2 direction;\n\t\t\t\tuniform float kernelRadius;\n\n\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\n\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tfloat sigma = kernelRadius/2.0;\n\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, sigma);\n\t\t\t\t\tvec4 diffuseSum = texture2D( colorTexture, vUv) * weightSum;\n\t\t\t\t\tvec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS);\n\t\t\t\t\tvec2 uvOffset = delta;\n\t\t\t\t\tfor( int i = 1; i <= MAX_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = kernelRadius * float(i) / float(MAX_RADIUS);\n\t\t\t\t\t\tfloat w = gaussianPdf(x, sigma);\n\t\t\t\t\t\tvec4 sample1 = texture2D( colorTexture, vUv + uvOffset);\n\t\t\t\t\t\tvec4 sample2 = texture2D( colorTexture, vUv - uvOffset);\n\t\t\t\t\t\tdiffuseSum += ((sample1 + sample2) * w);\n\t\t\t\t\t\tweightSum += (2.0 * w);\n\t\t\t\t\t\tuvOffset += delta;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = diffuseSum/weightSum;\n\t\t\t\t}"})}},{key:"getOverlayMaterial",value:function(){return new a.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:a.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}),n}(i.w);h.BlurDirectionX=new a.Vector2(1,0),h.BlurDirectionY=new a.Vector2(0,1);class d{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.outlinePass||(this.outlinePass=new h(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 n.Sf.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))})))}clearAllOutlineObj(){this.outlinePass&&(this.outlinePass.selectedObjects=[])}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)}}const p=e=>e.userData.outline},7738:(e,t,r)=>{r.d(t,{Z:()=>a,s:()=>i});var n=r(8881);class a{constructor(e){this.setSize=(e,t)=>{var{width:r,height:n}=this.getDomSize();this.runScene.setSize(e||r,t||n),this.runScene.cb.renderEx.setSize.cb({width:r,height:n})},this.runScene=e,this.runScene.cb.resize.add("render-ex-resize",(()=>{this.setSize()}))}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{width:e,height:t}=this.runScene.assetsEx.get().engineDom.getBoundingClientRect();return{width:e,height:t}}}const i=(e,t)=>{t=(t||{}).removeDom,!(e.render=()=>{})!==t&&e.domElement.remove(),e.setAnimationLoop(null),e.dispose(),e.renderLists&&e.renderLists.dispose()}},5857:(e,t,r)=>{r.d(t,{Gc:()=>ca,al:()=>et,ch:()=>h,Az:()=>Ye,Sf:()=>ua,cQ:()=>u,ZP:()=>ha}),t={};var n=(r.r(t),r.d(t,{FBXLoader:()=>Qt}),r(3300)),a=r.n(n),i=r(6001),s=r(8881);class o{constructor(e){this.runScene=e}}var l=r(2353),c=r(5247),u=r(4457),h=r(8715);class d extends o{constructor(e){super(e),this.map={},this.clock=new s.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,h.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:l.B.parse(t),o=new s.AnimationMixer(e);for(const t of a){var r=(0,i.getId)(),n=(t.id=r,o.clipAction(t));const a={finished:()=>{},loop:()=>{}};o.addEventListener("finished",(()=>a.finished())),o.addEventListener("loop",(()=>a.loop())),this.map[r]={mixer:o,action:n,model:e,time:0,runState:"close",clip:t,eventMap:a}}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,u.mergeObject)({onLoop:()=>{},onProgress:()=>{},onFinished:()=>{},onClose:()=>{},onPause:()=>{},onResume:()=>{},onBeforeEnd:()=>{},loop:!1,lastFrame:!0,reset:!0},r);const{onProgress:a,onBeforeEnd:i,onLoop:s,onFinished:o,lastFrame:l,loop:h,reset:d}=t,{action:p,clip:f,eventMap:m}=(this.map[e].options=t,n);p.stop(),r=d?0:n.time,p.time=r,this.setPlayState(n,!0),d&&p.reset(),p.play();let g=!(n.runState="play");this.setUpdates(e,(()=>{var e=(0,u.getProgress)(p.time,f.duration,!0);99<=e&&!g&&(i(),g=!0),a(e)})),h?(p.loop=c.Z.LoopRepeat,m.loop=s):(l&&(p.clampWhenFinished=!0),p.loop=c.Z.LoopOnce,m.finished=()=>{this.setPlayState(n,!1),a(100),o()})}}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:a}=this.map[r];a.play(),a.time=e,n.update(t)}))}getDetal(){return this.clock.getDelta()}update(e){const t=e||this.getDetal();(0,i.mapObj)(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,u.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:a}=e;e=this.findId(e,t);const i=this.map[e];i&&(t=this.findId(r,n),(e=this.map[t])&&i.action.crossFadeTo(e.action,a,!0))}resetTime(e,t){const r=this.getItem(e,t);r&&(r.action.time=0)}}var p=r(3693),f=r(699);class m{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 p.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 f.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(){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(),r=this.runScene.cameraEx.pCam,n=this.runScene.renderEx.create(e),a=this.runScene.controlsEx.create(r,e),{render2:i,render3:s}=this.runScene.optionsEx.options;return this.camera=r,this.scene=t,this.renderer=n,this.controls=a,this.engineDom=e,this.runScene.renderEx.setSize(),this.setRender2(i),this.setRender3(s),{scene:t,camera:r,render:n,controls:a,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 g{constructor(){this.cbs=[],this.cb=e=>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,i.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 v{constructor(){this.resize=new g,this.renderEx={setSize:new g},this.setSelectMaterial=new g,this.setScene=new g,this.reset=new g,this.render=new g,this.tick=new g,this.baseLog=new g,this.inited=new g,this.texture={add:new g,remove:new g,set:new g,setAnima:new g},this.model={multiSelect:{setEmpty:new g},change:new g,setSelect:new g,click:new g,add:new g,remove:new g,multipDrop:new g,focus:new g,unFocus:new g,changeName:new g,setOpen:new g,setMainStatue:new g,setVisible:new g,setParent:new g,setLayers:new g,setOutline:new g,clone:new g,dispose:new g},this.material={add:new g,remove:new g,dispose:new g,setName:new g},this.unique={material:{add:new g}},this.tranControls={changing:new g},this.undo={addUndos:new g,addRedus:new g,removeUndos:new g,undoByIndex:new g,reset:new g},this.scene={save:new g,saveNet:new g,setEnvStrength:new g},this.timeLine={setProgress:new g,playGroup:new g,setGroupMap:new g,reset:new g,closeGroup:new g},this.events={key:{down:new g,up:new g},mouse:{move:new g,down:new g,up:new g},pointer:{rightTrigger:new g,down:new g,up:new g,move:new g,trigger:new g},model:{addOptions:new g}},this.pp={glow:{setData:new g,setStatus:new g},outline:{setData:new g,setStatus:new g},ao:{setData:new g,setStatus:new g},vignette:{setData:new g,setStatus:new g}},this.load={getJSON:new g,progress:new g,complete:new g},this.exporter={gltf:{before:new g,complete:new g}},this.loaderer={gltf:{loadNode:new g,lazyLoadedTexture:new g,loaded:new g,modelLoaded:new g,progress:new g,getJSON:new g,getArrayBuffer:new g,complete:new g}},this.custom=new Proxy({},{get:(e,t)=>(e[t]||(e[t]=new g),e[t])}),this.tags={parseJSON:new g,clear:new g},this.snapshot={create:new g,set:new g,resetItem:new g,delete:new g},this.clean=new g,this.objects={sky:{setState:new g}},this.error=new g}}var b=r(4230);function y(e,t){this.orbit=t,this.object=e,this.target=new c.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,a,i,s,o,l,u,h,d,p,f,m=this,g=0,v=0,b=0,y=0,x=1,w=new c.Z.Vector3,S=!1;this.getPolarAngle=function(){return v},this.getAzimuthalAngle=function(){return g},this.setPolarAngle=function(e){v=e,this.forceUpdate()},this.setAzimuthalAngle=function(e){g=e,this.forceUpdate()},this.rotateLeft=function(e){y-=e},this.rotateUp=function(e){b-=e},this.panLeft=(r=new c.Z.Vector3,function(e){var t=this.object.matrix.elements;r.set(t[0],t[1],t[2]),r.multiplyScalar(-e),w.add(r)}),this.panUp=(n=new c.Z.Vector3,function(e,r){t.screenSpacePanning?n.setFromMatrixColumn(r,1):(n.setFromMatrixColumn(r,0),n.crossVectors(m.object.up,n)),n.multiplyScalar(e),w.add(n)}),this.pan=function(e,t,r,n){var a;m.object instanceof c.Z.PerspectiveCamera?(a=m.object.position.clone().sub(m.target).length(),a*=Math.tan(m.object.fov/2*Math.PI/180),m.panLeft(2*e*a/n),m.panUp(2*t*a/n,m.object.matrix)):m.object instanceof c.Z.OrthographicCamera?(m.panLeft(e*(m.object.right-m.object.left)/r),m.panUp(t*(m.object.top-m.object.bottom)/n)):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.")},this.dollyIn=function(e){m.object instanceof c.Z.PerspectiveCamera?x/=e:m.object instanceof c.Z.OrthographicCamera?(m.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom*e)),m.object.updateProjectionMatrix(),S=!0):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.")},this.dollyOut=function(e){m.object instanceof c.Z.PerspectiveCamera?x*=e:m.object instanceof c.Z.OrthographicCamera?(m.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/e)),m.object.updateProjectionMatrix(),S=!0):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.")},this.forceUpdate=(a=new c.Z.Vector3,i=(new c.Z.Quaternion).setFromUnitVectors(e.up,new c.Z.Vector3(0,1,0)),s=i.clone().invert(),o=new c.Z.Vector3,l=new c.Z.Quaternion,function(){var e=this.object.position,t=(a.copy(e).sub(this.target),a.applyQuaternion(i),g=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,g)),v=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,v)),v=Math.max(1e-6,Math.min(Math.PI-1e-6,v)),a.length()*x);return t=Math.max(this.minDistance,Math.min(this.maxDistance,t)),this.target.add(w),a.x=t*Math.sin(v)*Math.sin(g),a.y=t*Math.cos(v),a.z=t*Math.sin(v)*Math.cos(g),a.applyQuaternion(s),e.copy(this.target).add(a),this.object.lookAt(this.target),!0===this.enableDamping?(y*=1-this.dampingFactor,b*=1-this.dampingFactor):b=y=0,x=1,w.set(0,0,0),!(!(S||1e-6<o.distanceToSquared(this.object.position)||1e-6<8*(1-l.dot(this.object.quaternion)))||(o.copy(this.object.position),l.copy(this.object.quaternion),S=!1))}),this.update=(u=new c.Z.Vector3,h=(new c.Z.Quaternion).setFromUnitVectors(e.up,new c.Z.Vector3(0,1,0)),d=h.clone().invert(),p=new c.Z.Vector3,f=new c.Z.Quaternion,function(){var e=this.object.position,t=(u.copy(e).sub(this.target),u.applyQuaternion(h),g=Math.atan2(u.x,u.z),v=Math.atan2(Math.sqrt(u.x*u.x+u.z*u.z),u.y),g+=y,v+=b,g=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,g)),v=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,v)),v=Math.max(1e-6,Math.min(Math.PI-1e-6,v)),u.length()*x);return t=Math.max(this.minDistance,Math.min(this.maxDistance,t)),this.target.add(w),u.x=t*Math.sin(v)*Math.sin(g),u.y=t*Math.cos(v),u.z=t*Math.sin(v)*Math.cos(g),u.applyQuaternion(d),e.copy(this.target).add(u),this.object.lookAt(this.target),!0===this.enableDamping?(y*=1-this.dampingFactor,b*=1-this.dampingFactor):b=y=0,x=1,w.set(0,0,0),!(!(S||1e-6<p.distanceToSquared(this.object.position)||1e-6<8*(1-f.dot(this.object.quaternion)))||(p.copy(this.object.position),f.copy(this.object.quaternion),S=!1))})}function x(e,t){var r=new y(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:c.Z.MOUSE.LEFT,ZOOM:c.Z.MOUSE.MIDDLE,PAN:c.Z.MOUSE.RIGHT},this),a=new c.Z.Vector2,i=new c.Z.Vector2,s=new c.Z.Vector2,o=new c.Z.Vector2,l=new c.Z.Vector2,u=new c.Z.Vector2,h=new c.Z.Vector2,d=new c.Z.Vector2,p=new c.Z.Vector2,f=-1,m=f,g=(this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,{type:"change"}),v={type:"start"},b={type:"end"};function x(e,t){var a=n.domElement===document?n.domElement.body:n.domElement;r.pan(e,t,a.clientWidth,a.clientHeight)}function w(){return Math.pow(.95,n.zoomSpeed)}function S(e){if(!1!==n.enabled){if(e.preventDefault(),e.button===n.mouseButtons.ORBIT){if(!1===n.enableRotate)return;m=0,a.set(e.clientX,e.clientY)}else if(e.button===n.mouseButtons.ZOOM){if(!1===n.enableZoom)return;m=1,h.set(e.clientX,e.clientY)}else if(e.button===n.mouseButtons.PAN){if(!1===n.enablePan)return;m=2,o.set(e.clientX,e.clientY)}m!==f&&(document.addEventListener("mousemove",M,!1),document.addEventListener("mouseup",T,!1),n.dispatchEvent(v))}}function M(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===m){if(!1===n.enableRotate)return;i.set(e.clientX,e.clientY),s.subVectors(i,a),r.rotateLeft(2*Math.PI*s.x/t.clientWidth*n.rotateSpeed),r.rotateUp(2*Math.PI*s.y/t.clientHeight*n.rotateSpeed),a.copy(i)}else if(1===m){if(!1===n.enableZoom)return;d.set(e.clientX,e.clientY),p.subVectors(d,h),0<p.y?r.dollyIn(w()):p.y<0&&r.dollyOut(w()),h.copy(d)}else if(2===m){if(!1===n.enablePan)return;l.set(e.clientX,e.clientY),u.subVectors(l,o),x(u.x,u.y),o.copy(l)}m!==f&&n.update()}}function T(){!1!==n.enabled&&(document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",T),n.dispatchEvent(b),m=f)}function _(e){var t;!1!==n.enabled&&!1!==n.enableZoom&&m===f&&(e.stopPropagation(),void(t=0)!==e.wheelDelta?t=e.wheelDelta:void 0!==e.detail&&(t=-e.detail),0<t?r.dollyOut(w()):t<0&&r.dollyIn(w()),n.update(),n.dispatchEvent(v),n.dispatchEvent(b))}function E(e){if(!1!==n.enabled&&!1!==n.enableKeys&&!1!==n.enablePan)switch(e.keyCode){case n.keys.UP:x(0,n.keyPanSpeed),n.update();break;case n.keys.BOTTOM:x(0,-n.keyPanSpeed),n.update();break;case n.keys.LEFT:x(n.keyPanSpeed,0),n.update();break;case n.keys.RIGHT:x(-n.keyPanSpeed,0),n.update()}}function k(e){if(!1!==n.enabled){switch(e.touches.length){case 1:if(!1===n.enableRotate)return;m=3,a.set(e.touches[0].pageX,e.touches[0].pageY);break;case 2:if(!1===n.enableZoom)return;m=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),h.set(0,t);break;case 3:if(!1===n.enablePan)return;m=5,o.set(e.touches[0].pageX,e.touches[0].pageY);break;default:m=f}m!==f&&n.dispatchEvent(v)}}function D(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!==m)return;i.set(e.touches[0].pageX,e.touches[0].pageY),s.subVectors(i,a),r.rotateLeft(2*Math.PI*s.x/t.clientWidth*n.rotateSpeed),r.rotateUp(2*Math.PI*s.y/t.clientHeight*n.rotateSpeed),a.copy(i),n.update();break;case 2:if(!1===n.enableZoom)return;if(4!==m)return;var c=e.touches[0].pageX-e.touches[1].pageX,g=e.touches[0].pageY-e.touches[1].pageY;c=Math.sqrt(c*c+g*g),d.set(0,c),p.subVectors(d,h),0<p.y?r.dollyOut(w()):p.y<0&&r.dollyIn(w()),h.copy(d),n.update();break;case 3:if(!1===n.enablePan)return;if(5!==m)return;l.set(e.touches[0].pageX,e.touches[0].pageY),u.subVectors(l,o),x(u.x,u.y),o.copy(l),n.update();break;default:m=f}}}function P(){!1!==n.enabled&&(n.dispatchEvent(b),m=f)}function A(e){e.preventDefault()}this.update=function(){this.autoRotate&&m===f&&r.rotateLeft(2*Math.PI/60/60*n.autoRotateSpeed),!0===r.update()&&this.dispatchEvent(g)},this.reset=function(){m=f,this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(g),this.update()},this.dispose=function(){this.domElement.removeEventListener("contextmenu",A,!1),this.domElement.removeEventListener("mousedown",S,!1),this.domElement.removeEventListener("mousewheel",_,!1),this.domElement.removeEventListener("MozMousePixelScroll",_,!1),this.domElement.removeEventListener("touchstart",k,!1),this.domElement.removeEventListener("touchend",P,!1),this.domElement.removeEventListener("touchmove",D,!1),document.removeEventListener("mousemove",M,!1),document.removeEventListener("mouseup",T,!1),window.removeEventListener("keydown",E,!1)},this.domElement.addEventListener("contextmenu",A,!1),this.domElement.addEventListener("mousedown",S,!1),this.domElement.addEventListener("mousewheel",_,{passive:!0}),this.domElement.addEventListener("MozMousePixelScroll",_,!1),this.domElement.addEventListener("touchstart",k,{passive:!0}),this.domElement.addEventListener("touchend",P,!1),this.domElement.addEventListener("touchmove",D,{passive:!0}),window.addEventListener("keydown",E,!1),this.update()}c.Z.MOUSE,(x.prototype=Object.create(c.Z.EventDispatcher.prototype)).constructor=x,Object.defineProperties(x.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 w=x;class S{create(e,t){return new w(e,t)}static toJSON(e){return e.target}static setTarget(e,t,r){var{x:n,y:a,z:i}=t,{x:r,y:s,z:o}=r||e.target;this.setTargetData.anima&&(this.setTargetData.anima.kill(),this.setTargetData.anima=null,this.setTarget(e,t,this.setTargetData.nowData)),this.setTargetData.anima=(0,u.anima)({x:r,y:s,z:o},{x:n,y:a,z:i},.5,(t=>{var{x:r,y:n,z:a}=t;e.target.set(r,n,a),e.update(),this.setTargetData.nowData=t}),(()=>{this.setTargetData.anima=null}))}}S.setTargetData={anima:null,nowData:null};var M=r(1794),T=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const _=i.fnDebounce;class E{constructor(e){this.alt=!1,this.ctrl=!1,this.shift=!1,this.unExec=new M.Z,this.specialKeyDebounce=_((()=>{this.ctrl=!1,this.shift=!1,this.alt=!1}),1e3),this.allFn={s_saveScene:()=>T(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 T(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 k=r(3801);class D{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,a;this.isMove=!1,1===e.button||null!=(t=this.events.runScene.helperEx.transContro)&&t.isDraggingChange||(t=e.offsetX,r=e.offsetY,({x:n,y:a}=this.downPosition[e.button]),t===n&&r===a&&(0===e.button&&this.trigger(e),2===e.button&&(this.events.runScene.modelEx.select||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 r=e;"dom"===t?r=e:"canvas"===t?r=this.events.runScene.assetsEx.renderer.domElement:"window"===t&&(r=window),r.addEventListener("pointerdown",this.down.bind(this)),r.addEventListener("pointerup",this.up.bind(this)),r.addEventListener("pointerdown",this.events.runScene.cb.events.pointer.down.cb),r.addEventListener("pointerup",this.events.runScene.cb.events.pointer.up.cb),r.addEventListener("pointermove",(e=>{this.moveEvent=e,this.events.runScene.cb.events.pointer.move.cb(e)})),r.addEventListener("mousemove",this.events.runScene.cb.events.mouse.move.cb),r.addEventListener("mousedown",this.events.runScene.cb.events.mouse.down.cb),r.addEventListener("mouseup",this.events.runScene.cb.events.mouse.up.cb)}getTriggerModels(e){const t=new s.Raycaster,r=new s.Vector2,{engineDom:n,camera:a,scene:i}=this.events.runScene.assetsEx.get();var{top:o,left:l,width:c,height:u}=n.getBoundingClientRect(),l=e.pageX-l,o=(e=e.pageY-o,r.x=l/c*2-1,r.y=-e/u*2+1,t.setFromCamera(r,a),i.children.filter((e=>{if((!this.events.runScene.helperEx.isHelper(e)||e.userData.id)&&!e.userData.unClick)return e})));const h=t.intersectObjects(o,!0);return this.events.runScene.cb.events.pointer.trigger.cb(h),h.map((e=>e.object))}removeHideOrLockModel(e){return e.find((e=>this.events.runScene.modelEx.deepIsVisible(e)&&!k.zf.isLock(e,!0)&&h.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 P=r(272),A=r(3729);class O{constructor(e){this.options=new M.Z,this.addOptions=e=>{var{name:e,map:t}=e;this.options.set(e,t)},this.map={click:new M.Z},this.onClick=e=>{var t=(0,A.Ki)(e);if(t){const r=this.map.click.get(t);r&&r.map(((t,r)=>{const n=this.options.get(t);n&&n.parse({model:e,childs:r.toArray()})}))}},this.events=e}init(){this.events.runScene.cb.model.click.add("event-model",this.onClick),this.events.runScene.cb.events.model.addOptions.add("event-model",this.addOptions)}set(e){var t,{model:t,type:r,child:n,method:a}=e;if(t=(0,A.Ki)(t)){let i=this.map[a],s=i.get(t),o=(s||(s=new M.Z,i.set(t,s)),s.get(r));o||(o=new P.Z,s.set(r,o)),o.add(n),this.bindDataForModel(e)}}bindDataForModel(e){const{model:t,type:r,child:n,method:a}=e;let i=t.userData.events;i||(t.userData.events=i=[]),i.push(a+"-"+r+"-"+n)}}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 R(){R=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=(p="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",a=p.asyncIterator||"@@asyncIterator",i=p.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(t){s=function(e,t,r){return e[t]=r}}function o(e,t,r,n){var a,i,s,o;return t=t&&t.prototype instanceof u?t:u,t=Object.create(t.prototype),n=new x(n||[]),t._invoke=(a=e,i=r,s=n,o="suspendedStart",function(e,t){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===e)throw t;return{value:void 0,done:!0}}for(s.method=e,s.arg=t;;){var r=s.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 c;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}return"throw"===(n=l(n,t.iterator,r.arg)).type?(r.method="throw",r.arg=n.arg,r.delegate=null,c):(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,c):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,c)}(r,s),r)){if(r===c)continue;return r}if("next"===s.method)s.sent=s._sent=s.arg;else if("throw"===s.method){if("suspendedStart"===o)throw o="completed",s.arg;s.dispatchException(s.arg)}else"return"===s.method&&s.abrupt("return",s.arg);if(o="executing","normal"===(r=l(a,i,s)).type){if(o=s.done?"completed":"suspendedYield",r.arg===c)continue;return{value:r.arg,done:s.done}}"throw"===r.type&&(o="completed",s.method="throw",s.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=o;var c={};function u(){}function h(){}function d(){}var p,f,m=(s(p={},n,(function(){return this})),(f=(f=Object.getPrototypeOf)&&f(f(w([]))))&&f!==t&&r.call(f,n)&&(p=f),d.prototype=u.prototype=Object.create(p));function g(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function v(e,t){var n;this._invoke=function(a,i){function s(){return new t((function(n,s){!function n(a,i,s,o){var c;if("throw"!==(a=l(e[a],e,i)).type)return(i=(c=a.arg).value)&&"object"==C(i)&&r.call(i,"__await")?t.resolve(i.__await).then((function(e){n("next",e,s,o)}),(function(e){n("throw",e,s,o)})):t.resolve(i).then((function(e){c.value=e,s(c)}),(function(e){return n("throw",e,s,o)}));o(a.arg)}(a,i,n,s)}))}return n=n?n.then(s,s):s()}}function b(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 y(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function w(e){if(e){var t,a=e[n];if(a)return a.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(a=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=a}return{next:S}}function S(){return{value:void 0,done:!0}}return s(m,"constructor",h.prototype=d),s(d,"constructor",h),h.displayName=s(d,i,"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,s(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},g(v.prototype),s(v.prototype,a,(function(){return this})),e.AsyncIterator=v,e.async=function(t,r,n,a,i){void 0===i&&(i=Promise);var s=new v(o(t,r,n,a),i);return e.isGeneratorFunction(r)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},g(m),s(m,i,"Generator"),s(m,n,(function(){return this})),s(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(y),!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 s.type="throw",s.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var a=this.tryEntries.length-1;0<=a;--a){var i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var o=r.call(i,"catchLoc"),l=r.call(i,"finallyLoc");if(o&&l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var i=a;break}}var s=(i=i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc?null:i)?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,c):this.complete(s)},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),c},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),y(r),c}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,a=this.tryEntries[t];if(a.tryLoc===e)return"throw"===(r=a.completion).type&&(n=r.arg,y(a)),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),c}},e}function L(e,t,r,n,a,i,s){try{var o=e[i](s),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).then(n,a)}function I(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function B(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 U(e,t,r){t&&B(e.prototype,t),r&&B(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var j={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]},F=function(){function e(){I(this,e),this.pluginCallbacks=[],this.register((function(e){return new le(e)})),this.register((function(e){return new ce(e)})),this.register((function(e){return new de(e)})),this.register((function(e){return new pe(e)})),this.register((function(e){return new fe(e)})),this.register((function(e){return new me(e)})),this.register((function(e){return new ue(e)})),this.register((function(e){return new he(e)})),this.register((function(e){return new ge(e)})),this.register((function(e){return new ve(e)}))}return U(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){for(var a=new oe,i=[],s=0,o=this.pluginCallbacks.length;s<o;s++)i.push(this.pluginCallbacks[s](a));a.setPlugins(i),a.write(e,t,n).catch(r)}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,a){r.parse(e,n,a,t)}))}}]),e}(),N=5120,z=5121,V=5122,G=5123,H=(n=9728,9729),W=9984,q=9985,K=9986,Z=9987,X=33071,Q=33648,Y=10497,J="KHR_mesh_quantization",$={},ee=($[s.NearestFilter]=n,$[s.NearestMipmapNearestFilter]=W,$[s.NearestMipmapLinearFilter]=K,$[s.LinearFilter]=H,$[s.LinearMipmapNearestFilter]=q,$[s.LinearMipmapLinearFilter]=Z,$[s.ClampToEdgeWrapping]=X,$[s.RepeatWrapping]=Y,$[s.MirroredRepeatWrapping]=Q,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"}),te=new s.Color;function re(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function ne(e){return 4*Math.ceil(e/4)}function ae(e,t){var r=1<arguments.length&&void 0!==t?t:0,n=ne(e.byteLength);if(n===e.byteLength)return e;var a=new Uint8Array(n);if(a.set(new Uint8Array(e)),0!==r)for(var i=e.byteLength;i<n;i++)a[i]=r;return a.buffer}function ie(){return"undefined"==typeof document&&"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}function se(e,t){return void 0!==e.toBlob?new Promise((function(r){return e.toBlob(r,t)})):("image/jpeg"===t?r=.92:"image/webp"===t&&(r=.8),e.convertToBlob({type:t,quality:r}));var r}var oe=function(){function e(){I(this,e),this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},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 U(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=R().mark((function e(t,r){var n,a,i,s,o,l,c,u,h,d=arguments;return R().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=2<d.length&&void 0!==d[2]?d[2]:{},this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(t),e.next=6,Promise.all(this.pending);case 6:return i=(a=this).buffers,s=a.json,n=a.options,e.next=12,a.options.myOptions.helper.done(s);case 12:l=a.extensionsUsed,c=a.extensionsRequired,o=new Blob(i,{type:"application/octet-stream"}),l=Object.keys(l),c=Object.keys(c),0<l.length&&(s.extensionsUsed=l),0<c.length&&(s.extensionsRequired=c),s.buffers&&0<s.buffers.length&&(s.buffers[0].byteLength=o.size),!0===n.binary?((u=new FileReader).readAsArrayBuffer(o),u.onloadend=function(){var e=ae(u.result),t=new DataView(new ArrayBuffer(8)),n=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),ae((n=JSON.stringify(s),(new TextEncoder).encode(n).buffer),32)),a=new DataView(new ArrayBuffer(8)),i=(a.setUint32(0,n.byteLength,!0),a.setUint32(4,1313821514,!0),new ArrayBuffer(12)),o=((l=new DataView(i)).setUint32(0,1179937895,!0),l.setUint32(4,2,!0),12+a.byteLength+n.byteLength+t.byteLength+e.byteLength),l=(l.setUint32(8,o,!0),new Blob([i,a,n,t,e],{type:"application/octet-stream"})),c=new FileReader;c.readAsArrayBuffer(l),c.onloadend=function(){r(c.result)}}):s.buffers&&0<s.buffers.length?((h=new FileReader).readAsDataURL(o),h.onloadend=function(){var e=h.result;s.buffers[0].uri=e,r(s)}):r(s);case 21:case"end":return e.stop()}}),e,this)})),r=function(){var e=this,r=arguments;return new Promise((function(n,a){var i=t.apply(e,r);function s(e){L(i,n,a,s,o,"next",e)}function o(e){L(i,n,a,s,o,"throw",e)}s(void 0)}))},function(e,t){return r.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 a=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&a.gltfExtensions){for(var i in void 0===t.extensions&&(t.extensions={}),a.gltfExtensions)t.extensions[i]=a.gltfExtensions[i],n[i]=!0;delete a.gltfExtensions}0<Object.keys(a).length&&(t.extras=a)}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){var t,r=1<arguments.length&&void 0!==arguments[1]&&arguments[1];return!1===this.uids.has(e)&&((t=new Map).set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)),this.uids.get(e).get(r)}},{key:"isNormalizedNormalAttribute",value:function(e){if(this.cache.attributesNormalized.has(e))return!1;for(var t=new s.Vector3,r=0,n=e.count;r<n;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(),n=new s.Vector3,a=0,i=r.count;a<i;a++)n.fromBufferAttribute(r,a),0===n.x&&0===n.y&&0===n.z?n.setX(1):n.normalize(),r.setXYZ(a,n.x,n.y,n.z);return t.attributesNormalized.set(e,r),r}},{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;function r(e){return e.encoding===s.sRGBEncoding?function(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function(e){return e}}console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures.");var n=e?e.image:null,a=t?t.image:null,i=Math.max(n?n.width:0,a?a.width:0),o=Math.max(n?n.height:0,a?a.height:0),l=ie(),c=(l.width=i,l.height=o,l.getContext("2d")),u=(c.fillStyle="#00ffff",c.fillRect(0,0,i,o),c.getImageData(0,0,i,o));if(n){c.drawImage(n,0,0,i,o);for(var h=r(e),d=c.getImageData(0,0,i,o).data,p=2;p<d.length;p+=4)u.data[p]=256*h(d[p]/256)}if(a){c.drawImage(a,0,0,i,o);for(var f=r(t),m=c.getImageData(0,0,i,o).data,g=1;g<m.length;g+=4)u.data[g]=256*f(m[g]/256)}return c.putImageData(u,0,0),(n=(e||t).clone()).source=new s.Source(l),n.encoding=s.LinearEncoding,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,a){var i,o=this.json;switch(o.bufferViews||(o.bufferViews=[]),t){case N:case z:i=1;break;case V:case G:i=2;break;default:i=4}for(var l=ne(n*e.itemSize*i),c=new DataView(new ArrayBuffer(l)),u=0,h=r;h<r+n;h++)for(var d=0;d<e.itemSize;d++){var p=void 0;4<e.itemSize?p=e.array[h*e.itemSize+d]:(0===d?p=e.getX(h):1===d?p=e.getY(h):2===d?p=e.getZ(h):3===d&&(p=e.getW(h)),!0===e.normalized&&(p=s.MathUtils.normalize(p,e.array))),5126===t?c.setFloat32(u,p,!0):5124===t?c.setInt32(u,p,!0):5125===t?c.setUint32(u,p,!0):t===V?c.setInt16(u,p,!0):t===G?c.setUint16(u,p,!0):t===N?c.setInt8(u,p):t===z&&c.setUint8(u,p),u+=i}var f={buffer:this.processBuffer(c.buffer),byteOffset:this.byteOffset,byteLength:l};return void 0!==a&&(f.target=a),34962===a&&(f.byteStride=e.itemSize*i),this.byteOffset+=l,o.bufferViews.push(f),{id:o.bufferViews.length-1,byteLength:0}}},{key:"processBufferViewImage",value:function(e){var t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(n){var a=new FileReader;a.readAsArrayBuffer(e),a.onloadend=function(){var e=ae(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 a,i=this.json;if(e.array.constructor===Float32Array)a=5126;else if(e.array.constructor===Int32Array)a=5124;else if(e.array.constructor===Uint32Array)a=5125;else if(e.array.constructor===Int16Array)a=V;else if(e.array.constructor===Uint16Array)a=G;else if(e.array.constructor===Int8Array)a=N;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");a=z}if(0===(n=void 0===n?e.count:n))return null;var o,l=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)},a=t;a<t+r;a++)for(var i=0;i<e.itemSize;i++){var o=void 0;4<e.itemSize?o=e.array[a*e.itemSize+i]:(0===i?o=e.getX(a):1===i?o=e.getY(a):2===i?o=e.getZ(a):3===i&&(o=e.getW(a)),!0===e.normalized&&(o=s.MathUtils.normalize(o,e.array))),n.min[i]=Math.min(n.min[i],o),n.max[i]=Math.max(n.max[i],o)}return n}(e,r=void 0===r?0:r,n);return r={bufferView:(void 0!==t&&(o=e===t.index?34963:34962),t=this.processBufferView(e,a,r,n,o)).id,byteOffset:t.byteOffset,componentType:a,count:n,max:l.max,min:l.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]},!0===e.normalized&&(r.normalized=!0),i.accessors||(i.accessors=[]),i.accessors.push(r)-1}},{key:"processImage",value:function(e,t,r,n){var a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:"image/png";if(null===e)throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.");var i=this,o=i.cache,l=i.json,c=i.options,u=i.pending;if(void 0!==(o.images.has(e)||o.images.set(e,{}),o=o.images.get(e))[r=a+":flipY/"+r.toString()])return o[r];l.images||(l.images=[]);var h={mimeType:a},d=ie(),p=(d.width=Math.min(e.width,c.maxTextureSize),d.height=Math.min(e.height,c.maxTextureSize),d.getContext("2d"));if(void 0!==e.data){t!==s.RGBAFormat&&console.error("GLTFExporter: Only RGBAFormat is supported."),(e.width>c.maxTextureSize||e.height>c.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);return!0===c.binary?(null==n||null==(t=n.userData)?void 0:t.blob)instanceof Blob?u.push(new Promise((function(e){i.processBufferViewImage(n.userData.blob).then((function(t){h.bufferView=t,e()}))}))):u.push(se(d,a).then((function(e){return i.processBufferViewImage(e)})).then((function(e){h.bufferView=e}))):void 0!==d.toDataURL?h.uri=d.toDataURL(a):u.push(se(d,a).then((function(e){return(new FileReader).readAsDataURL(e)})).then((function(e){h.uri=e}))),p=l.images.push(h)-1,o[r]=p}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter:$[e.magFilter],minFilter:$[e.minFilter],wrapS:$[e.wrapS],wrapT:$[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"===(a=e.userData.mimeType)&&(a="image/png"),{sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,e,a)}),a=(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,a),this.options.myOptions.helper.parseTexture({texture:e,textureDef:n}),a}},{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 n={pbrMetallicRoughness:{}},a=(this.options.myOptions.helper.parseMaterial({material:e,materialDef:n,options:this}),!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."),e.color.toArray().concat([e.opacity])),i=(re(a,[1,1,1,1])||(n.pbrMetallicRoughness.baseColorFactor=a),e.isMeshStandardMaterial?(n.pbrMetallicRoughness.metallicFactor=e.metalness,n.pbrMetallicRoughness.roughnessFactor=e.roughness):(n.pbrMetallicRoughness.metallicFactor=.5,n.pbrMetallicRoughness.roughnessFactor=.5),(e.metalnessMap||e.roughnessMap)&&(a=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),i={index:this.processTexture(a)},this.applyTextureTransform(i,a),n.pbrMetallicRoughness.metallicRoughnessTexture=i),e.map&&(a={index:this.processTexture(e.map)},this.applyTextureTransform(a,e.map),n.pbrMetallicRoughness.baseColorTexture=a),e.emissive&&(i=e.emissive,0<Math.max(i.r,i.g,i.b)&&(n.emissiveFactor=e.emissive.toArray()),e.emissiveMap&&(a={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(a,e.emissiveMap),n.emissiveTexture=a)),e.normalMap&&(i={index:this.processTexture(e.normalMap)},e.normalScale&&1!==e.normalScale.x&&(i.scale=e.normalScale.x),this.applyTextureTransform(i,e.normalMap),n.normalTexture=i),e.aoMap&&(a={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),n.occlusionTexture=a),e.transparent?n.alphaMode="BLEND":0<e.alphaTest&&(n.alphaMode="MASK",n.alphaCutoff=e.alphaTest),e.side===s.DoubleSide&&(n.doubleSided=!0),""!==e.name&&(n.name=e.name),this.serializeUserData(e,n),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,n)})),r.materials.push(n)-1);return t.materials.set(e,i),i}},{key:"processMesh",value:function(e){var t=this.cache,r=this.json,n=[e.geometry.uuid];if(Array.isArray(e.material))for(var a=0,i=e.material.length;a<i;a++)n.push(e.material[a].uuid);else n.push(e.material.uuid);var o=n.join(":");if(t.meshes.has(o))return t.meshes.get(o);var l,c,u,h=e.geometry,d=e.isLineSegments?1:e.isLineLoop?2:e.isLine?3:e.isPoints?0:e.material.wireframe?1:4,p={},f={},m=[],g=[],v={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},b=h.getAttribute("normal"),y=(void 0===b||this.isNormalizedNormalAttribute(b)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),h.setAttribute("normal",this.createNormalizedNormalAttribute(b))),null);for(c in h.attributes)"morph"!==c.slice(0,5)&&(l=h.attributes[c],c=v[c]||c.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(c)||(c="_"+c),t.attributes.has(this.getUID(l))?f[c]=t.attributes.get(this.getUID(l)):(y=null,u=l.array,"JOINTS_0"!==c||u instanceof Uint16Array||u instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),y=new s.BufferAttribute(new Uint16Array(u),l.itemSize,l.normalized)),null!==(u=this.processAccessor(y||l,h))&&(c.startsWith("_")||this.detectMeshQuantization(c,l),f[c]=u,t.attributes.set(this.getUID(l),u))));if(void 0!==b&&h.setAttribute("normal",b),0===Object.keys(f).length)return null;if(void 0!==e.morphTargetInfluences&&0<e.morphTargetInfluences.length){var x=[],w=[],S={};if(void 0!==e.morphTargetDictionary)for(var M in e.morphTargetDictionary)S[e.morphTargetDictionary[M]]=M;for(var T=0;T<e.morphTargetInfluences.length;++T){var _,E={},k=!1;for(_ in h.morphAttributes)if("position"!==_&&"normal"!==_)k||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),k=!0);else{var D=h.morphAttributes[_][T],P=_.toUpperCase(),A=h.attributes[_];if(t.attributes.has(this.getUID(D,!0)))E[P]=t.attributes.get(this.getUID(D,!0));else{var O=D.clone();if(!h.morphTargetsRelative)for(var C=0,R=D.count;C<R;C++)for(var L=0;L<D.itemSize;L++)0===L&&O.setX(C,D.getX(C)-A.getX(C)),1===L&&O.setY(C,D.getY(C)-A.getY(C)),2===L&&O.setZ(C,D.getZ(C)-A.getZ(C)),3===L&&O.setW(C,D.getW(C)-A.getW(C));E[P]=this.processAccessor(O,h),t.attributes.set(this.getUID(A,!0),E[P])}}g.push(E),x.push(e.morphTargetInfluences[T]),void 0!==e.morphTargetDictionary&&w.push(S[T])}p.weights=x,0<w.length&&(p.extras={},p.extras.targetNames=w)}if((b=Array.isArray(e.material))&&0===h.groups.length)return null;for(var I=b?e.material:[e.material],B=b?h.groups:[{materialIndex:0,start:void 0,count:void 0}],U=0,j=B.length;U<j;U++){var F={mode:d,attributes:f},N=(this.serializeUserData(h,F),0<g.length&&(F.targets=g),null!==h.index&&(N=this.getUID(h.index),void 0===B[U].start&&void 0===B[U].count||(N+=":"+B[U].start+":"+B[U].count),t.attributes.has(N)?F.indices=t.attributes.get(N):(F.indices=this.processAccessor(h.index,h,B[U].start,B[U].count),t.attributes.set(N,F.indices)),null===F.indices&&delete F.indices),this.processMaterial(I[B[U].materialIndex]));null!==N&&(F.material=N),m.push(F)}return p.primitives=m,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,p)})),b=r.meshes.push(p)-1,t.meshes.set(o,b),b}},{key:"detectMeshQuantization",value:function(e,t){if(!this.extensionsUsed[J]){var r=void 0;switch(t.array.constructor){case Int8Array:r="byte";break;case Uint8Array:r="unsigned byte";break;case Int16Array:r="short";break;case Uint16Array:r="unsigned short";break;default:return}t.normalized&&(r+=" normalized"),t=e.split("_",1)[0],null!=(e=j[t])&&e.includes(r)&&(this.extensionsUsed[J]=!0,this.extensionsRequired[J]=!0)}}},{key:"processCamera",value:function(e){var t=this.json,r=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),n={type:r?"orthographic":"perspective"};return r?n.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:n.perspective={aspectRatio:e.aspect,yfov:s.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(n.name=e.type),t.cameras.push(n)-1}},{key:"processAnimation",value:function(e,t){for(var r=this.json,n=this.nodeMap,a=(r.animations||(r.animations=[]),(e=F.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),i=[],o=[],l=0;l<a.length;++l){var c=a[l],u=s.PropertyBinding.parseTrackName(c.name),h=s.PropertyBinding.findNode(t,u.nodeName),d=ee[u.propertyName];if(!(h="bones"===u.objectName?!0===h.isSkinnedMesh?h.skeleton.getBoneByName(u.objectIndex):void 0:h)||!d)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',c.name),null;u=c.values.length/c.times.length;var p=void(d===ee.morphTargetInfluences&&(u/=h.morphTargetInfluences.length));!0===c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(p="CUBICSPLINE",u/=3):p=c.getInterpolation()===s.InterpolateDiscrete?"STEP":"LINEAR",o.push({input:this.processAccessor(new s.BufferAttribute(c.times,1)),output:this.processAccessor(new s.BufferAttribute(c.values,u)),interpolation:p}),i.push({sampler:o.length-1,target:{node:n.get(h),path:d}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:o,channels:i}),r.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,r=this.nodeMap,n=t.nodes[r.get(e)],a=e.skeleton;if(void 0===a)return null;var i=e.skeleton.bones[0];if(void 0===i)return null;for(var o=[],l=new Float32Array(16*a.bones.length),c=new s.Matrix4,u=0;u<a.bones.length;++u){var h=a.bones[u];h=this.options.myOptions.helper.getNodeMapValueWithBone(h,r),o.push(h),c.copy(a.boneInverses[u]),c.multiply(e.bindMatrix).toArray(l,16*u)}return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new s.BufferAttribute(l,16)),joints:o,skeleton:r.get(i)}),n.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,r,n=this.json,a=this.options,i=this.nodeMap,s=(n.nodes||(n.nodes=[]),{});if(e=a.myOptions.helper.parseNode({object:e,nodeDef:s,options:this}),a.trs?(r=e.quaternion.toArray(),h=e.position.toArray(),t=e.scale.toArray(),re(r,[0,0,0,1])||(s.rotation=r),re(h,[0,0,0])||(s.translation=h),re(t,[1,1,1])||(s.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])&&(s.matrix=e.matrix.elements)),""!==e.name&&(s.name=String(e.name)),this.serializeUserData(e,s),e.isMesh||e.isLine||e.isPoints?null!==(r=this.processMesh(e))&&(s.mesh=r):e.isCamera&&(s.camera=this.processCamera(e)),e.isSkinnedMesh&&this.skins.push(e),0<e.children.length){for(var o=[],l=0,c=e.children.length;l<c;l++){var u=e.children[l];u.userData.isTemp||!u.visible&&!1!==a.onlyVisible||null!==(u=this.processNode(u))&&o.push(u)}0<o.length&&(s.children=o)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,s)}));var h=n.nodes.push(s)-1;return i.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),{}),a=(""!==e.name&&(n.name=e.name),t.scenes.push(n),[]),i=0,s=e.children.length;i<s;i++){var o=e.children[i];o.userData.isTemp||!o.visible&&!1!==r.onlyVisible||null!==(o=this.processNode(o))&&a.push(o)}0<a.length&&(n.nodes=a),this.serializeUserData(e,n)}},{key:"processObjects",value:function(e){var t=new s.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,n=this.options,a=(e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)})),[]),i=0;i<e.length;i++)e[i]instanceof s.Scene?this.processScene(e[i]):a.push(e[i]);1===a.length?(t=a[0],"model"===n.myOptions.helper.type&&((r=new s.Group).name="glb_model",r.add(t),t=r),this.processScene(t)):1<a.length&&this.processObjects(a);for(var o=0;o<this.skins.length;++o)this.processSkin(this.skins[o]);for(var l=0;l<n.animations.length;++l)this.processAnimation(n.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}(),le=function(){function e(t){I(this,e),this.writer=t,this.name="KHR_lights_punctual"}return U(e,[{key:"writeNode",value:function(e,t){var r,n,a;e.isLight&&(e.isDirectionalLight||e.isPointLight||e.isSpotLight?(r=(a=this.writer).json,a=a.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."),a[this.name]||(r.extensions=r.extensions||{},r.extensions[this.name]={lights:[]},a[this.name]=!0),(a=r.extensions[this.name].lights).push(n),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}):console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e))}}]),e}(),ce=function(){function e(t){I(this,e),this.writer=t,this.name="KHR_materials_unlit"}return U(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}(),ue=function(){function e(t){I(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return U(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.clearcoat&&(n=(r=this.writer).extensionsUsed,(a={}).clearcoatFactor=e.clearcoat,e.clearcoatMap&&(i={index:r.processTexture(e.clearcoatMap)},r.applyTextureTransform(i,e.clearcoatMap),a.clearcoatTexture=i),a.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap&&(i={index:r.processTexture(e.clearcoatRoughnessMap)},r.applyTextureTransform(i,e.clearcoatRoughnessMap),a.clearcoatRoughnessTexture=i),e.clearcoatNormalMap&&(i={index:r.processTexture(e.clearcoatNormalMap)},r.applyTextureTransform(i,e.clearcoatNormalMap),a.clearcoatNormalTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),he=function(){function e(t){I(this,e),this.writer=t,this.name="KHR_materials_iridescence"}return U(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.iridescence&&(n=(r=this.writer).extensionsUsed,(a={}).iridescenceFactor=e.iridescence,e.iridescenceMap&&(i={index:r.processTexture(e.iridescenceMap)},r.applyTextureTransform(i,e.iridescenceMap),a.iridescenceTexture=i),a.iridescenceIor=e.iridescenceIOR,a.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],a.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap&&(i={index:r.processTexture(e.iridescenceThicknessMap)},r.applyTextureTransform(i,e.iridescenceThicknessMap),a.iridescenceThicknessTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),de=function(){function e(t){I(this,e),this.writer=t,this.name="KHR_materials_transmission"}return U(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(a={}).transmissionFactor=e.transmission,e.transmissionMap&&(i={index:r.processTexture(e.transmissionMap)},r.applyTextureTransform(i,e.transmissionMap),a.transmissionTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),pe=function(){function e(t){I(this,e),this.writer=t,this.name="KHR_materials_volume"}return U(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(a={}).thicknessFactor=e.thickness,e.thicknessMap&&(i={index:r.processTexture(e.thicknessMap)},r.applyTextureTransform(i,e.thicknessMap),a.thicknessTexture=i),a.attenuationDistance=e.attenuationDistance,a.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),fe=function(){function e(t){I(this,e),this.writer=t,this.name="KHR_materials_ior"}return U(e,[{key:"writeMaterial",value:function(e,t){var r,n;e.isMeshPhysicalMaterial&&1.5!==e.ior&&(r=this.writer.extensionsUsed,(n={}).ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0)}}]),e}(),me=function(){function e(t){I(this,e),this.writer=t,this.name="KHR_materials_specular"}return U(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&(1!==e.specularIntensity||!e.specularColor.equals(te)||e.specularIntensityMap||e.specularColorTexture)&&(n=(r=this.writer).extensionsUsed,a={},e.specularIntensityMap&&(i={index:r.processTexture(e.specularIntensityMap)},r.applyTextureTransform(i,e.specularIntensityMap),a.specularTexture=i),e.specularColorMap&&(i={index:r.processTexture(e.specularColorMap)},r.applyTextureTransform(i,e.specularColorMap),a.specularColorTexture=i),a.specularFactor=e.specularIntensity,a.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),ge=function(){function e(t){I(this,e),this.writer=t,this.name="KHR_materials_sheen"}return U(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!=e.sheen&&(n=(r=this.writer).extensionsUsed,a={},e.sheenRoughnessMap&&(i={index:r.processTexture(e.sheenRoughnessMap)},r.applyTextureTransform(i,e.sheenRoughnessMap),a.sheenRoughnessTexture=i),e.sheenColorMap&&(i={index:r.processTexture(e.sheenColorMap)},r.applyTextureTransform(i,e.sheenColorMap),a.sheenColorTexture=i),a.sheenRoughnessFactor=e.sheenRoughness,a.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),ve=function(){function e(t){I(this,e),this.writer=t,this.name="KHR_materials_emissive_strength"}return U(e,[{key:"writeMaterial",value:function(e,t){var r,n;e.isMeshStandardMaterial&&1!==e.emissiveIntensity&&(r=this.writer.extensionsUsed,(n={}).emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0)}}]),e}();function be(e){return(be="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ye(){ye=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=(p="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",a=p.asyncIterator||"@@asyncIterator",i=p.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(t){s=function(e,t,r){return e[t]=r}}function o(e,t,r,n){var a,i,s,o;return t=t&&t.prototype instanceof u?t:u,t=Object.create(t.prototype),n=new x(n||[]),t._invoke=(a=e,i=r,s=n,o="suspendedStart",function(e,t){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===e)throw t;return{value:void 0,done:!0}}for(s.method=e,s.arg=t;;){var r=s.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 c;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return c}return"throw"===(n=l(n,t.iterator,r.arg)).type?(r.method="throw",r.arg=n.arg,r.delegate=null,c):(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,c):n:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,c)}(r,s),r)){if(r===c)continue;return r}if("next"===s.method)s.sent=s._sent=s.arg;else if("throw"===s.method){if("suspendedStart"===o)throw o="completed",s.arg;s.dispatchException(s.arg)}else"return"===s.method&&s.abrupt("return",s.arg);if(o="executing","normal"===(r=l(a,i,s)).type){if(o=s.done?"completed":"suspendedYield",r.arg===c)continue;return{value:r.arg,done:s.done}}"throw"===r.type&&(o="completed",s.method="throw",s.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=o;var c={};function u(){}function h(){}function d(){}var p,f,m=(s(p={},n,(function(){return this})),(f=(f=Object.getPrototypeOf)&&f(f(w([]))))&&f!==t&&r.call(f,n)&&(p=f),d.prototype=u.prototype=Object.create(p));function g(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function v(e,t){var n;this._invoke=function(a,i){function s(){return new t((function(n,s){!function n(a,i,s,o){var c;if("throw"!==(a=l(e[a],e,i)).type)return(i=(c=a.arg).value)&&"object"==be(i)&&r.call(i,"__await")?t.resolve(i.__await).then((function(e){n("next",e,s,o)}),(function(e){n("throw",e,s,o)})):t.resolve(i).then((function(e){c.value=e,s(c)}),(function(e){return n("throw",e,s,o)}));o(a.arg)}(a,i,n,s)}))}return n=n?n.then(s,s):s()}}function b(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 y(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function w(e){if(e){var t,a=e[n];if(a)return a.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(a=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=a}return{next:S}}function S(){return{value:void 0,done:!0}}return s(m,"constructor",h.prototype=d),s(d,"constructor",h),h.displayName=s(d,i,"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,s(e,i,"GeneratorFunction")),e.prototype=Object.create(m),e},e.awrap=function(e){return{__await:e}},g(v.prototype),s(v.prototype,a,(function(){return this})),e.AsyncIterator=v,e.async=function(t,r,n,a,i){void 0===i&&(i=Promise);var s=new v(o(t,r,n,a),i);return e.isGeneratorFunction(r)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},g(m),s(m,i,"Generator"),s(m,n,(function(){return this})),s(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(y),!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 s.type="throw",s.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var a=this.tryEntries.length-1;0<=a;--a){var i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var o=r.call(i,"catchLoc"),l=r.call(i,"finallyLoc");if(o&&l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;0<=n;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var i=a;break}}var s=(i=i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc?null:i)?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,c):this.complete(s)},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),c},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),y(r),c}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r,n,a=this.tryEntries[t];if(a.tryLoc===e)return"throw"===(r=a.completion).type&&(n=r.arg,y(a)),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),c}},e}function xe(e,t,r,n,a,i,s){try{var o=e[i](s),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).then(n,a)}function we(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Se(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Me(e,t,r){t&&Se(e.prototype,t),r&&Se(e,r),Object.defineProperty(e,"prototype",{writable:!1})}F.Utils={insertKeyframe:function(e,t){var r,n=e.getValueSize(),a=new e.TimeBufferType(e.times.length+1),i=new e.ValueBufferType(e.values.length+n),s=e.createInterpolant(new e.ValueBufferType(n));if(0===e.times.length){a[0]=t;for(var o=0;o<n;o++)i[o]=0;r=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<.001)return 0;a[0]=t,a.set(e.times,1),i.set(s.evaluate(t),0),i.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;a[a.length-1]=t,a.set(e.times,0),i.set(e.values,0),i.set(s.evaluate(t),e.values.length),r=a.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){a.set(e.times.slice(0,l+1),0),a[l+1]=t,a.set(e.times.slice(l+1),l+2),i.set(e.values.slice(0,(l+1)*n),0),i.set(s.evaluate(t),(l+1)*n),i.set(e.values.slice((l+1)*n),(l+2)*n),r=l+1;break}}return e.times=a,e.values=i,r},mergeMorphTargetTracks:function(e,t){for(var r=[],n={},a=e.tracks,i=0;i<a.length;++i){var o=a[i],l=s.PropertyBinding.parseTrackName(o.name),c=s.PropertyBinding.findNode(t,l.nodeName);if("morphTargetInfluences"!==l.propertyName||void 0===l.propertyIndex)r.push(o);else{if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.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."),(o=o.clone()).setInterpolation(s.InterpolateLinear)}var u=c.morphTargetInfluences.length,h=c.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===n[c.uuid]){for(var p=new((d=o.clone()).ValueBufferType)(u*d.times.length),f=0;f<d.times.length;f++)p[f*u+h]=d.values[f];d.name=(l.nodeName||"")+".morphTargetInfluences",d.values=p,n[c.uuid]=d,r.push(d)}else{var m=o.createInterpolant(new o.ValueBufferType(1));d=n[c.uuid];for(var g=0;g<d.times.length;g++)d.values[g*u+h]=m.evaluate(d.times[g]);for(var v=0;v<o.times.length;v++){var b=this.insertKeyframe(d,o.times[v]);d.values[b*u+h]=o.values[v]}}}}return e.tracks=r,e}};var Te={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]},_e=function(){function e(){we(this,e),this.pluginCallbacks=[],this.register((function(e){return new Ne(e)})),this.register((function(e){return new ze(e)})),this.register((function(e){return new He(e)})),this.register((function(e){return new We(e)})),this.register((function(e){return new qe(e)})),this.register((function(e){return new Ke(e)})),this.register((function(e){return new Ve(e)})),this.register((function(e){return new Ge(e)})),this.register((function(e){return new Ze(e)})),this.register((function(e){return new Xe(e)}))}return Me(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){for(var a=new Fe,i=[],s=0,o=this.pluginCallbacks.length;s<o;s++)i.push(this.pluginCallbacks[s](a));a.setPlugins(i),a.write(e,t,n).catch(r)}},{key:"parseAsync",value:function(e,t){var r=this;return new Promise((function(n,a){r.parse(e,n,a,t)}))}}]),e}(),Ee=5120,ke=5121,De=5122,Pe=5123,Ae=(n=9728,W=9729,K=9984,H=9985,q=9986,Z=9987,X=33071,Y=33648,Q=10497,"KHR_mesh_quantization"),Oe={},Ce=(Oe[s.NearestFilter]=n,Oe[s.NearestMipmapNearestFilter]=K,Oe[s.NearestMipmapLinearFilter]=q,Oe[s.LinearFilter]=W,Oe[s.LinearMipmapNearestFilter]=H,Oe[s.LinearMipmapLinearFilter]=Z,Oe[s.ClampToEdgeWrapping]=X,Oe[s.RepeatWrapping]=Q,Oe[s.MirroredRepeatWrapping]=Y,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"}),Re=new s.Color;function Le(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function Ie(e){return 4*Math.ceil(e/4)}function Be(e,t){var r=1<arguments.length&&void 0!==t?t:0,n=Ie(e.byteLength);if(n===e.byteLength)return e;var a=new Uint8Array(n);if(a.set(new Uint8Array(e)),0!==r)for(var i=e.byteLength;i<n;i++)a[i]=r;return a.buffer}function Ue(){return"undefined"==typeof document&&"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}function je(e,t){return void 0!==e.toBlob?new Promise((function(r){return e.toBlob(r,t)})):("image/jpeg"===t?r=.92:"image/webp"===t&&(r=.8),e.convertToBlob({type:t,quality:r}));var r}var Fe=function(){function e(){we(this,e),this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},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 Me(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=ye().mark((function e(t,r){var n,a,i,s,o,l,c,u=arguments;return ye().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=2<u.length&&void 0!==u[2]?u[2]:{},this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(t),e.next=6,Promise.all(this.pending);case 6:i=(o=this).buffers,a=o.json,n=o.options,s=o.extensionsUsed,o=o.extensionsRequired,i=new Blob(i,{type:"application/octet-stream"}),s=Object.keys(s),o=Object.keys(o),0<s.length&&(a.extensionsUsed=s),0<o.length&&(a.extensionsRequired=o),a.buffers&&0<a.buffers.length&&(a.buffers[0].byteLength=i.size),!0===n.binary?((l=new FileReader).readAsArrayBuffer(i),l.onloadend=function(){var e=Be(l.result),t=new DataView(new ArrayBuffer(8)),n=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),Be((n=JSON.stringify(a),(new TextEncoder).encode(n).buffer),32)),i=new DataView(new ArrayBuffer(8)),s=(i.setUint32(0,n.byteLength,!0),i.setUint32(4,1313821514,!0),new ArrayBuffer(12)),o=((c=new DataView(s)).setUint32(0,1179937895,!0),c.setUint32(4,2,!0),12+i.byteLength+n.byteLength+t.byteLength+e.byteLength),c=(c.setUint32(8,o,!0),new Blob([s,i,n,t,e],{type:"application/octet-stream"})),u=new FileReader;u.readAsArrayBuffer(c),u.onloadend=function(){r(u.result)}}):a.buffers&&0<a.buffers.length?((c=new FileReader).readAsDataURL(i),c.onloadend=function(){var e=c.result;a.buffers[0].uri=e,r(a)}):r(a);case 19:case"end":return e.stop()}}),e,this)})),r=function(){var e=this,r=arguments;return new Promise((function(n,a){var i=t.apply(e,r);function s(e){xe(i,n,a,s,o,"next",e)}function o(e){xe(i,n,a,s,o,"throw",e)}s(void 0)}))},function(e,t){return r.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 a=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&a.gltfExtensions){for(var i in void 0===t.extensions&&(t.extensions={}),a.gltfExtensions)t.extensions[i]=a.gltfExtensions[i],n[i]=!0;delete a.gltfExtensions}0<Object.keys(a).length&&(t.extras=a)}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){var t,r=1<arguments.length&&void 0!==arguments[1]&&arguments[1];return!1===this.uids.has(e)&&((t=new Map).set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)),this.uids.get(e).get(r)}},{key:"isNormalizedNormalAttribute",value:function(e){if(this.cache.attributesNormalized.has(e))return!1;for(var t=new s.Vector3,r=0,n=e.count;r<n;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(),n=new s.Vector3,a=0,i=r.count;a<i;a++)n.fromBufferAttribute(r,a),0===n.x&&0===n.y&&0===n.z?n.setX(1):n.normalize(),r.setXYZ(a,n.x,n.y,n.z);return t.attributesNormalized.set(e,r),r}},{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;function r(e){return e.encoding===s.sRGBEncoding?function(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function(e){return e}}console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures.");var n=e?e.image:null,a=t?t.image:null,i=Math.max(n?n.width:0,a?a.width:0),o=Math.max(n?n.height:0,a?a.height:0),l=Ue(),c=(l.width=i,l.height=o,l.getContext("2d")),u=(c.fillStyle="#00ffff",c.fillRect(0,0,i,o),c.getImageData(0,0,i,o));if(n){c.drawImage(n,0,0,i,o);for(var h=r(e),d=c.getImageData(0,0,i,o).data,p=2;p<d.length;p+=4)u.data[p]=256*h(d[p]/256)}if(a){c.drawImage(a,0,0,i,o);for(var f=r(t),m=c.getImageData(0,0,i,o).data,g=1;g<m.length;g+=4)u.data[g]=256*f(m[g]/256)}return c.putImageData(u,0,0),(n=(e||t).clone()).source=new s.Source(l),n.encoding=s.LinearEncoding,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,a){var i,o=this.json;switch(o.bufferViews||(o.bufferViews=[]),t){case Ee:case ke:i=1;break;case De:case Pe:i=2;break;default:i=4}for(var l=Ie(n*e.itemSize*i),c=new DataView(new ArrayBuffer(l)),u=0,h=r;h<r+n;h++)for(var d=0;d<e.itemSize;d++){var p=void 0;4<e.itemSize?p=e.array[h*e.itemSize+d]:(0===d?p=e.getX(h):1===d?p=e.getY(h):2===d?p=e.getZ(h):3===d&&(p=e.getW(h)),!0===e.normalized&&(p=s.MathUtils.normalize(p,e.array))),5126===t?c.setFloat32(u,p,!0):5124===t?c.setInt32(u,p,!0):5125===t?c.setUint32(u,p,!0):t===De?c.setInt16(u,p,!0):t===Pe?c.setUint16(u,p,!0):t===Ee?c.setInt8(u,p):t===ke&&c.setUint8(u,p),u+=i}var f={buffer:this.processBuffer(c.buffer),byteOffset:this.byteOffset,byteLength:l};return void 0!==a&&(f.target=a),34962===a&&(f.byteStride=e.itemSize*i),this.byteOffset+=l,o.bufferViews.push(f),{id:o.bufferViews.length-1,byteLength:0}}},{key:"processBufferViewImage",value:function(e){var t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(n){var a=new FileReader;a.readAsArrayBuffer(e),a.onloadend=function(){var e=Be(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 a,i=this.json;if(e.array.constructor===Float32Array)a=5126;else if(e.array.constructor===Int32Array)a=5124;else if(e.array.constructor===Uint32Array)a=5125;else if(e.array.constructor===Int16Array)a=De;else if(e.array.constructor===Uint16Array)a=Pe;else if(e.array.constructor===Int8Array)a=Ee;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");a=ke}if(0===(n=void 0===n?e.count:n))return null;var o,l=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)},a=t;a<t+r;a++)for(var i=0;i<e.itemSize;i++){var o=void 0;4<e.itemSize?o=e.array[a*e.itemSize+i]:(0===i?o=e.getX(a):1===i?o=e.getY(a):2===i?o=e.getZ(a):3===i&&(o=e.getW(a)),!0===e.normalized&&(o=s.MathUtils.normalize(o,e.array))),n.min[i]=Math.min(n.min[i],o),n.max[i]=Math.max(n.max[i],o)}return n}(e,r=void 0===r?0:r,n);return r={bufferView:(void 0!==t&&(o=e===t.index?34963:34962),t=this.processBufferView(e,a,r,n,o)).id,byteOffset:t.byteOffset,componentType:a,count:n,max:l.max,min:l.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]},!0===e.normalized&&(r.normalized=!0),i.accessors||(i.accessors=[]),i.accessors.push(r)-1}},{key:"processImage",value:function(e,t,r){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"image/png";if(null===e)throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.");var a=this,i=a.cache,o=a.json,l=a.options,c=a.pending,u=(i.images.has(e)||i.images.set(e,{}),i=i.images.get(e),n+":flipY/"+r.toString());if(void 0!==i[u])return i[u];o.images||(o.images=[]);var h={mimeType:n},d=Ue(),p=(d.width=Math.min(e.width,l.maxTextureSize),d.height=Math.min(e.height,l.maxTextureSize),d.getContext("2d"));if(!0===r&&(p.translate(0,d.height),p.scale(1,-1)),void 0!==e.data){t!==s.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);return!0===l.binary?c.push(je(d,n).then((function(e){return a.processBufferViewImage(e)})).then((function(e){h.bufferView=e}))):void 0!==d.toDataURL?h.uri=d.toDataURL(n):c.push(je(d,n).then((function(e){return(new FileReader).readAsDataURL(e)})).then((function(e){h.uri=e}))),r=o.images.push(h)-1,i[u]=r}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter:Oe[e.magFilter],minFilter:Oe[e.minFilter],wrapS:Oe[e.wrapS],wrapT:Oe[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"===(a=e.userData.mimeType)&&(a="image/png"),{sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,a)}),a=(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,a),a}},{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 n={pbrMetallicRoughness:{}},a=(!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."),e.color.toArray().concat([e.opacity])),i=(Le(a,[1,1,1,1])||(n.pbrMetallicRoughness.baseColorFactor=a),e.isMeshStandardMaterial?(n.pbrMetallicRoughness.metallicFactor=e.metalness,n.pbrMetallicRoughness.roughnessFactor=e.roughness):(n.pbrMetallicRoughness.metallicFactor=.5,n.pbrMetallicRoughness.roughnessFactor=.5),(e.metalnessMap||e.roughnessMap)&&(a=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),i={index:this.processTexture(a)},this.applyTextureTransform(i,a),n.pbrMetallicRoughness.metallicRoughnessTexture=i),e.map&&(a={index:this.processTexture(e.map)},this.applyTextureTransform(a,e.map),n.pbrMetallicRoughness.baseColorTexture=a),e.emissive&&(i=e.emissive,0<Math.max(i.r,i.g,i.b)&&(n.emissiveFactor=e.emissive.toArray()),e.emissiveMap&&(a={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(a,e.emissiveMap),n.emissiveTexture=a)),e.normalMap&&(i={index:this.processTexture(e.normalMap)},e.normalScale&&1!==e.normalScale.x&&(i.scale=e.normalScale.x),this.applyTextureTransform(i,e.normalMap),n.normalTexture=i),e.aoMap&&(a={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),n.occlusionTexture=a),e.transparent?n.alphaMode="BLEND":0<e.alphaTest&&(n.alphaMode="MASK",n.alphaCutoff=e.alphaTest),e.side===s.DoubleSide&&(n.doubleSided=!0),""!==e.name&&(n.name=e.name),this.serializeUserData(e,n),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,n)})),r.materials.push(n)-1);return t.materials.set(e,i),i}},{key:"processMesh",value:function(e){var t=this.cache,r=this.json,n=[e.geometry.uuid];if(Array.isArray(e.material))for(var a=0,i=e.material.length;a<i;a++)n.push(e.material[a].uuid);else n.push(e.material.uuid);var o=n.join(":");if(t.meshes.has(o))return t.meshes.get(o);var l,c,u,h=e.geometry,d=e.isLineSegments?1:e.isLineLoop?2:e.isLine?3:e.isPoints?0:e.material.wireframe?1:4,p={},f={},m=[],g=[],v={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},b=h.getAttribute("normal"),y=(void 0===b||this.isNormalizedNormalAttribute(b)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),h.setAttribute("normal",this.createNormalizedNormalAttribute(b))),null);for(c in h.attributes)"morph"!==c.slice(0,5)&&(l=h.attributes[c],c=v[c]||c.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(c)||(c="_"+c),t.attributes.has(this.getUID(l))?f[c]=t.attributes.get(this.getUID(l)):(y=null,u=l.array,"JOINTS_0"!==c||u instanceof Uint16Array||u instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),y=new s.BufferAttribute(new Uint16Array(u),l.itemSize,l.normalized)),null!==(u=this.processAccessor(y||l,h))&&(c.startsWith("_")||this.detectMeshQuantization(c,l),f[c]=u,t.attributes.set(this.getUID(l),u))));if(void 0!==b&&h.setAttribute("normal",b),0===Object.keys(f).length)return null;if(void 0!==e.morphTargetInfluences&&0<e.morphTargetInfluences.length){var x=[],w=[],S={};if(void 0!==e.morphTargetDictionary)for(var M in e.morphTargetDictionary)S[e.morphTargetDictionary[M]]=M;for(var T=0;T<e.morphTargetInfluences.length;++T){var _,E={},k=!1;for(_ in h.morphAttributes)if("position"!==_&&"normal"!==_)k||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),k=!0);else{var D=h.morphAttributes[_][T],P=_.toUpperCase(),A=h.attributes[_];if(t.attributes.has(this.getUID(D,!0)))E[P]=t.attributes.get(this.getUID(D,!0));else{var O=D.clone();if(!h.morphTargetsRelative)for(var C=0,R=D.count;C<R;C++)for(var L=0;L<D.itemSize;L++)0===L&&O.setX(C,D.getX(C)-A.getX(C)),1===L&&O.setY(C,D.getY(C)-A.getY(C)),2===L&&O.setZ(C,D.getZ(C)-A.getZ(C)),3===L&&O.setW(C,D.getW(C)-A.getW(C));E[P]=this.processAccessor(O,h),t.attributes.set(this.getUID(A,!0),E[P])}}g.push(E),x.push(e.morphTargetInfluences[T]),void 0!==e.morphTargetDictionary&&w.push(S[T])}p.weights=x,0<w.length&&(p.extras={},p.extras.targetNames=w)}if((b=Array.isArray(e.material))&&0===h.groups.length)return null;for(var I=b?e.material:[e.material],B=b?h.groups:[{materialIndex:0,start:void 0,count:void 0}],U=0,j=B.length;U<j;U++){var F={mode:d,attributes:f},N=(this.serializeUserData(h,F),0<g.length&&(F.targets=g),null!==h.index&&(N=this.getUID(h.index),void 0===B[U].start&&void 0===B[U].count||(N+=":"+B[U].start+":"+B[U].count),t.attributes.has(N)?F.indices=t.attributes.get(N):(F.indices=this.processAccessor(h.index,h,B[U].start,B[U].count),t.attributes.set(N,F.indices)),null===F.indices&&delete F.indices),this.processMaterial(I[B[U].materialIndex]));null!==N&&(F.material=N),m.push(F)}return p.primitives=m,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,p)})),b=r.meshes.push(p)-1,t.meshes.set(o,b),b}},{key:"detectMeshQuantization",value:function(e,t){if(!this.extensionsUsed[Ae]){var r=void 0;switch(t.array.constructor){case Int8Array:r="byte";break;case Uint8Array:r="unsigned byte";break;case Int16Array:r="short";break;case Uint16Array:r="unsigned short";break;default:return}t.normalized&&(r+=" normalized"),t=e.split("_",1)[0],null!=(e=Te[t])&&e.includes(r)&&(this.extensionsUsed[Ae]=!0,this.extensionsRequired[Ae]=!0)}}},{key:"processCamera",value:function(e){var t=this.json,r=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),n={type:r?"orthographic":"perspective"};return r?n.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:n.perspective={aspectRatio:e.aspect,yfov:s.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(n.name=e.type),t.cameras.push(n)-1}},{key:"processAnimation",value:function(e,t){for(var r=this.json,n=this.nodeMap,a=(r.animations||(r.animations=[]),(e=_e.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),i=[],o=[],l=0;l<a.length;++l){var c=a[l],u=s.PropertyBinding.parseTrackName(c.name),h=s.PropertyBinding.findNode(t,u.nodeName),d=Ce[u.propertyName];if(!(h="bones"===u.objectName?!0===h.isSkinnedMesh?h.skeleton.getBoneByName(u.objectIndex):void 0:h)||!d)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',c.name),null;u=c.values.length/c.times.length;var p=void(d===Ce.morphTargetInfluences&&(u/=h.morphTargetInfluences.length));!0===c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(p="CUBICSPLINE",u/=3):p=c.getInterpolation()===s.InterpolateDiscrete?"STEP":"LINEAR",o.push({input:this.processAccessor(new s.BufferAttribute(c.times,1)),output:this.processAccessor(new s.BufferAttribute(c.values,u)),interpolation:p}),i.push({sampler:o.length-1,target:{node:n.get(h),path:d}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:o,channels:i}),r.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,r=this.nodeMap,n=t.nodes[r.get(e)],a=e.skeleton;if(void 0===a)return null;var i=e.skeleton.bones[0];if(void 0===i)return null;for(var o=[],l=new Float32Array(16*a.bones.length),c=new s.Matrix4,u=0;u<a.bones.length;++u)o.push(r.get(a.bones[u])),c.copy(a.boneInverses[u]),c.multiply(e.bindMatrix).toArray(l,16*u);return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new s.BufferAttribute(l,16)),joints:o,skeleton:r.get(i)}),n.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,r,n=this.json,a=this.options,i=this.nodeMap,s=(n.nodes||(n.nodes=[]),{});if(a.trs?(r=e.quaternion.toArray(),h=e.position.toArray(),t=e.scale.toArray(),Le(r,[0,0,0,1])||(s.rotation=r),Le(h,[0,0,0])||(s.translation=h),Le(t,[1,1,1])||(s.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===Le(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(s.matrix=e.matrix.elements)),""!==e.name&&(s.name=String(e.name)),this.serializeUserData(e,s),e.isMesh||e.isLine||e.isPoints?null!==(r=this.processMesh(e))&&(s.mesh=r):e.isCamera&&(s.camera=this.processCamera(e)),e.isSkinnedMesh&&this.skins.push(e),0<e.children.length){for(var o=[],l=0,c=e.children.length;l<c;l++){var u=e.children[l];!u.visible&&!1!==a.onlyVisible||null!==(u=this.processNode(u))&&o.push(u)}0<o.length&&(s.children=o)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,s)}));var h=n.nodes.push(s)-1;return i.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),{}),a=(""!==e.name&&(n.name=e.name),t.scenes.push(n),[]),i=0,s=e.children.length;i<s;i++){var o=e.children[i];!o.visible&&!1!==r.onlyVisible||null!==(o=this.processNode(o))&&a.push(o)}0<a.length&&(n.nodes=a),this.serializeUserData(e,n)}},{key:"processObjects",value:function(e){var t=new s.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)})),[]),n=0;n<e.length;n++)e[n]instanceof s.Scene?this.processScene(e[n]):r.push(e[n]);0<r.length&&this.processObjects(r);for(var a=0;a<this.skins.length;++a)this.processSkin(this.skins[a]);for(var i=0;i<t.animations.length;++i)this.processAnimation(t.animations[i],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}(),Ne=function(){function e(t){we(this,e),this.writer=t,this.name="KHR_lights_punctual"}return Me(e,[{key:"writeNode",value:function(e,t){var r,n,a;e.isLight&&(e.isDirectionalLight||e.isPointLight||e.isSpotLight?(r=(a=this.writer).json,a=a.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."),a[this.name]||(r.extensions=r.extensions||{},r.extensions[this.name]={lights:[]},a[this.name]=!0),(a=r.extensions[this.name].lights).push(n),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}):console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e))}}]),e}(),ze=function(){function e(t){we(this,e),this.writer=t,this.name="KHR_materials_unlit"}return Me(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}(),Ve=function(){function e(t){we(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return Me(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.clearcoat&&(n=(r=this.writer).extensionsUsed,(a={}).clearcoatFactor=e.clearcoat,e.clearcoatMap&&(i={index:r.processTexture(e.clearcoatMap)},r.applyTextureTransform(i,e.clearcoatMap),a.clearcoatTexture=i),a.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap&&(i={index:r.processTexture(e.clearcoatRoughnessMap)},r.applyTextureTransform(i,e.clearcoatRoughnessMap),a.clearcoatRoughnessTexture=i),e.clearcoatNormalMap&&(i={index:r.processTexture(e.clearcoatNormalMap)},r.applyTextureTransform(i,e.clearcoatNormalMap),a.clearcoatNormalTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),Ge=function(){function e(t){we(this,e),this.writer=t,this.name="KHR_materials_iridescence"}return Me(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.iridescence&&(n=(r=this.writer).extensionsUsed,(a={}).iridescenceFactor=e.iridescence,e.iridescenceMap&&(i={index:r.processTexture(e.iridescenceMap)},r.applyTextureTransform(i,e.iridescenceMap),a.iridescenceTexture=i),a.iridescenceIor=e.iridescenceIOR,a.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],a.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap&&(i={index:r.processTexture(e.iridescenceThicknessMap)},r.applyTextureTransform(i,e.iridescenceThicknessMap),a.iridescenceThicknessTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),He=function(){function e(t){we(this,e),this.writer=t,this.name="KHR_materials_transmission"}return Me(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(a={}).transmissionFactor=e.transmission,e.transmissionMap&&(i={index:r.processTexture(e.transmissionMap)},r.applyTextureTransform(i,e.transmissionMap),a.transmissionTexture=i),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),We=function(){function e(t){we(this,e),this.writer=t,this.name="KHR_materials_volume"}return Me(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!==e.transmission&&(n=(r=this.writer).extensionsUsed,(a={}).thicknessFactor=e.thickness,e.thicknessMap&&(i={index:r.processTexture(e.thicknessMap)},r.applyTextureTransform(i,e.thicknessMap),a.thicknessTexture=i),a.attenuationDistance=e.attenuationDistance,a.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),qe=function(){function e(t){we(this,e),this.writer=t,this.name="KHR_materials_ior"}return Me(e,[{key:"writeMaterial",value:function(e,t){var r,n;e.isMeshPhysicalMaterial&&1.5!==e.ior&&(r=this.writer.extensionsUsed,(n={}).ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0)}}]),e}(),Ke=function(){function e(t){we(this,e),this.writer=t,this.name="KHR_materials_specular"}return Me(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&(1!==e.specularIntensity||!e.specularColor.equals(Re)||e.specularIntensityMap||e.specularColorTexture)&&(n=(r=this.writer).extensionsUsed,a={},e.specularIntensityMap&&(i={index:r.processTexture(e.specularIntensityMap)},r.applyTextureTransform(i,e.specularIntensityMap),a.specularTexture=i),e.specularColorMap&&(i={index:r.processTexture(e.specularColorMap)},r.applyTextureTransform(i,e.specularColorMap),a.specularColorTexture=i),a.specularFactor=e.specularIntensity,a.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),Ze=function(){function e(t){we(this,e),this.writer=t,this.name="KHR_materials_sheen"}return Me(e,[{key:"writeMaterial",value:function(e,t){var r,n,a,i;e.isMeshPhysicalMaterial&&0!=e.sheen&&(n=(r=this.writer).extensionsUsed,a={},e.sheenRoughnessMap&&(i={index:r.processTexture(e.sheenRoughnessMap)},r.applyTextureTransform(i,e.sheenRoughnessMap),a.sheenRoughnessTexture=i),e.sheenColorMap&&(i={index:r.processTexture(e.sheenColorMap)},r.applyTextureTransform(i,e.sheenColorMap),a.sheenColorTexture=i),a.sheenRoughnessFactor=e.sheenRoughness,a.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,n[this.name]=!0)}}]),e}(),Xe=function(){function e(t){we(this,e),this.writer=t,this.name="KHR_materials_emissive_strength"}return Me(e,[{key:"writeMaterial",value:function(e,t){var r,n;e.isMeshStandardMaterial&&1!==e.emissiveIntensity&&(r=this.writer.extensionsUsed,(n={}).emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=n,r[this.name]=!0)}}]),e}();_e.Utils={insertKeyframe:function(e,t){var r,n=e.getValueSize(),a=new e.TimeBufferType(e.times.length+1),i=new e.ValueBufferType(e.values.length+n),s=e.createInterpolant(new e.ValueBufferType(n));if(0===e.times.length){a[0]=t;for(var o=0;o<n;o++)i[o]=0;r=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<.001)return 0;a[0]=t,a.set(e.times,1),i.set(s.evaluate(t),0),i.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;a[a.length-1]=t,a.set(e.times,0),i.set(e.values,0),i.set(s.evaluate(t),e.values.length),r=a.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){a.set(e.times.slice(0,l+1),0),a[l+1]=t,a.set(e.times.slice(l+1),l+2),i.set(e.values.slice(0,(l+1)*n),0),i.set(s.evaluate(t),(l+1)*n),i.set(e.values.slice((l+1)*n),(l+2)*n),r=l+1;break}}return e.times=a,e.values=i,r},mergeMorphTargetTracks:function(e,t){for(var r=[],n={},a=e.tracks,i=0;i<a.length;++i){var o=a[i],l=s.PropertyBinding.parseTrackName(o.name),c=s.PropertyBinding.findNode(t,l.nodeName);if("morphTargetInfluences"!==l.propertyName||void 0===l.propertyIndex)r.push(o);else{if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.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."),(o=o.clone()).setInterpolation(s.InterpolateLinear)}var u=c.morphTargetInfluences.length,h=c.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===n[c.uuid]){for(var p=new((d=o.clone()).ValueBufferType)(u*d.times.length),f=0;f<d.times.length;f++)p[f*u+h]=d.values[f];d.name=(l.nodeName||"")+".morphTargetInfluences",d.values=p,n[c.uuid]=d,r.push(d)}else{var m=o.createInterpolant(new o.ValueBufferType(1));d=n[c.uuid];for(var g=0;g<d.times.length;g++)d.values[g*u+h]=m.evaluate(d.times[g]);for(var v=0;v<o.times.length;v++){var b=this.insertKeyframe(d,o.times[v]);d.values[b*u+h]=o.values[v]}}}}return e.tracks=r,e}};class Qe{constructor(e){this.map=new P.Z,this.loadMap=new M.Z,this.exportMap=new M.Z,this.runScene=e,this.loadMap}bind(e){this.processMap(e),this.map.add(e)}processMap(e){e.loadCallBacks.map(((e,t)=>{let r=this.loadMap.get(e);r||(r=new P.Z,this.loadMap.set(e,r)),r.add(t)})),e.exportCallBacks.map(((e,t)=>{let r=this.exportMap.get(e);r||(r=new P.Z,this.exportMap.set(e,r)),r.add(t)}))}loadCallback(e){const{type:t,json:r,data:n,config:a,core:i}=e;return null==(e=this.loadMap.get(t))?void 0:e.map((e=>e({json:r,data:n,config:a,core:i})))}}var Ye=r(3625),Je=r(4330),$e=r(1269),et=r(932),tt=r(110),rt=r(3736),nt=r(6272);class at{constructor(e){this.materialMap={},this.textureMap={},this.modelType={Sprite:tt.Z},this.geoDefMaterialMap=new M.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);"scene"===this.type&&this.parseScene(t),this.parseModel(e),this.materialMapToJson(),this.setMultipMaterial(t,Object.keys(this.textureMap))}createTextureGroup(e){const t=new s.Group;return t.name="back-texture-ex",t.userData.isHelper=!0,e.add(t),t}parseUnDelAbleTexture(){(0,i.mapObj)(this.runScene.uniqueEx.texture.map,((e,t)=>{t=t.texture,Ye.unDelAbleTexture.is(t)&&(this.mergeSame(t).isSame||this.parseTexture(t))}))}parseScene(e){this.helper.ex=Object.assign(Object.assign({},this.helper.ex),this._getBaseEx(e)),this.parseUnDelAbleTexture()}_getBaseEx(e){var t=this.runScene.sceneEx.get(),r=this.runScene.assetsEx.get().controls,n=this.runScene.optionsEx.exporterOptions.outTime,a=this.runScene.sceneEx.envStrength;return{version:{core:"0.0.83",editor:"0.0.2"},base64:(0,nt.Ni)(String(n)),lights:$e.ZP.toJSON(this.runScene.lightEx.getLightsByScene()),camera:b.Z.toJSON(this.runScene),sceneEx:Object.assign(Object.assign({},rt.ZP.toJSON(t,this.runScene)),this._bindSceneTextures(e)),timeLine:this.runScene.timeLineEx.getSavedData(),envStrength:a,controls:S.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,Ye.isTexture)(t.background)||(0,Ye.isTexture)(t.environment)){this.runScene.pp.setUpdate(!1);const{background:n,environment:a}=t,i=(this.runScene.pp.setUpdate(!0),(0,h.createDefModel)("Box")),s=(0,et.createDefMaterial)();i.material=s,e.add(i),t=s.userData.id,r.materialId=t;let o=[];(0,Ye.isTexture)(n)&&(n.userData.notCompress=!0,o.push({type:"map",texture:n}),303===(s.map=n).mapping&&(r.backgroundMapping=303)),(0,Ye.isTexture)(a)&&(a.userData.notCompress=!0,o.push({type:"envMap",texture:a}),s.envMap=a),this.materialMap[t]={normalMaterial:s,models:[],normal:{},textures:o}}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,h.withAnima)(e)&&(t=e.animations.map((e=>e.toJSON())),(0,rt.M)(e,"animations",t));let r=e;const n=this.modelType[e.type];n&&(t=n.modelTools.toNormal(e),e.parent.add(t),e.parent.remove(e),r=t),this.runScene.optionsEx.options.hideLocal&&this.compressLocal(r)}_processMaterial(e){if((0,et.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{material:a,normal:i,textures:s}=t||this.runScene.optionsEx.exporterOptions.notMaterial?this.getMaterialFromModel(e):this.runScene.materialEx.toNromal(e.material);e.material=a,t=r.userData.id,a.userData.id=t,this.materialMap[t]={oldMaterial:r,normalMaterial:a,models:[e],normal:i,textures:s}}}materialMapToJson(){(0,i.mapObj)(this.materialMap,((e,t)=>{var{normalMaterial:t,textures:r,normal:n}=t,a=t.userData.id;this.helper.ex.materialMap[a]||(this.helper.ex.materialMap[a]={normal:n,textures:{}},this.mergeAndRemoveTexture(r,t))}))}mergeSame(e){e.userData||(e.userData={});var t=e.userData;if((0,Ye.isClonedTexture)(e))e=this.parseCloneTexture(e);else for(const i in this.textureMap){var r=this.textureMap[i],{md5:n,texture:a}=r;if(t.md5===n&&e.mapping===a.mapping&&!(0,Ye.isClonedTexture)(r.texture))return{isSame:!0,texture:a}}return this.textureMap[e.userData.id]=Object.assign(Object.assign({},t),{texture:e}),{isSame:!1,texture:e}}parseTexture(e){var t,{format:r,repeat:n,center:a,rotation:i,offset:s}=e;const o={format:r};this.runScene.modelEx.isNavieV2(n,1)||(({x:r,y:t}=n),o.repeat=r===t?r:n),this.runScene.modelEx.isNavieV2(a,0)||(({x:t,y:r}=a),o.center=t===r?t:a),this.runScene.modelEx.isNavieV2(s,0)||(({x:n,y:r}=s),o.offset=n===r?n:s),0!==i&&(o.rotation=i),this.helper.ex.textureMap[e.userData.id]=o}mergeAndRemoveTexture(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((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;this.helper.ex.textureMap[n.userData.id]||this.parseTexture(n),"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,et.createDefMaterial)();r.material=n,e.add(r);for(const e of Je.sG){if(!t.length)return;var a=t.pop();if(!a)return;n[e]=this.textureMap[a].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,et.createDefMaterial)()),{material:this.geoDefMaterialMap.get(e),normal:{},textures:[]}):{material:this.runScene.materialEx.defMaterial,normal:{},textures:[]}}}class it extends o{constructor(){super(...arguments),this.savedMap=new M.Z,this.clonedMap=new M.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,A.Ki)(e);e.material&&e.geometry&&((t=this.getSameNode(e))&&(0,h.setClonedModel)(e,t.id),this.savedMap.set(r,{id:r,geometryUuid:e.geometry.uuid,materialUuid:e.material.uuid}))}parseClonedModel(e){var t=(0,h.getClonedIdModel)(e),r=(0,A.Ki)(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,A.Ki)(e),n.newId=t),n.newId&&(n.newId!==r?(0,h.setClonedModel)(e,n.newId):(0,h.delClonedModel)(e)))}parseNode(e){(0,h.getClonedIdModel)(e)?this.parseClonedModel(e):this.parseUnClonedModel(e)}}class st{constructor(){this.savedMap=new M.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:a}=e.attributes;for(const e of t){var{normal:i,position:s,uv:o}=e.attributes;if(r.array.length===i.array.length&&n.array.length===s.array.length&&a.array.length===o.array.length&&(i=(0,nt.F1)([...r.array],[...i.array],20),s=(0,nt.F1)([...n.array],[...s.array],20),o=(0,nt.F1)([...a.array],[...o.array],20),i&&s&&o))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 a=this.getSameCount(r);if(a){var n=this.getSameGeo(t,a.map((e=>e.geometry)));if(n)return this.setSameNode(e,n)}this.savedMap.set(t.uuid,{count:r,geometry:t})}}}class ot{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 lt{constructor(e){this.helperModels=[],this.mergeSameGeo=new st;var{type:e,runScene:t,model:r}=e;this.runScene=t,this.type=e,this.bindClondId=new it(t),this.ex={materialMap:{},textureMap:{},type:e},this.before=new at({helper:this,type:e,runScene:t}),this.before.parse(r)}parseNode(e){let{object:t,nodeDef:r}=e;return this.mergeSameGeo.parseNode(t),this.bindClondId.parseNode(t),(0,i.mapObj)(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),e=((null==(e=t.userData)?void 0:e.normal)||{}).type,t=e?this.runScene.modelEx.importAndExport.toNromal({type:e,model:t,runScene:this.runScene}):t}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.unDelAble=t.userData.unDelAble,r.unDelAbleRef=t.userData.unDelAbleRef,r.uvScript=t.userData.uvScript,r.md5=t.userData.md5,r.id=t.userData.id,r.isHdr=t.userData.isHdr,n&&(r.minFilter=n),(0,Ye.isClonedTexture)(t)&&(r.cloneSourceId=(0,Ye.getCloneIdFromTexture)(t)),r.format=t.userData.format,(0,Ye.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"]),this.runScene.cb.exporter.gltf.complete.cb({json:e})}}var ct=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};class ut extends o{constructor(e){super(e),this._gltf=new F,this._originGltf=new _e,this.options=new ot,this.module=new Qe(e)}getArrayBuffer(e=this.runScene.sceneEx.getClear(),t){return ct(this,void 0,void 0,(function*(){const r=new lt({type:t,runScene:this.runScene,model:e});return new Promise((t=>{this._gltf.parse(e,(e=>{t(e)}),(e=>{console.log(e,"e")}),{binary:!0,onlyVisible:!1,includeCustomExtensions:!0,myOptions:{helper:r,optionsEx:this.runScene.optionsEx}})}))}))}getOriginArrayBuffer(e){return ct(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,t=!0){return ct(this,void 0,void 0,(function*(){let r=e||this.runScene.modelEx.select,n=[];if(0!==(n=r?[r]:this.runScene.multipSelector.getSelectedList("value")).length){var a=(r=n[0]).name||r.type;const e=new s.Group;e.name="models",h.uselessGroup.set(e,!0),n.map((t=>e.add(this.runScene.modelEx.clone(t,!1))));var o=yield this.getArrayBuffer(e,"model");return t&&(0,i.downloadFile)(new Blob([o]),a+".glb"),o}}))}material(e){var t;return ct(this,void 0,void 0,(function*(){if(r=e||(null==(t=this.runScene.modelEx.select)?void 0:t.material)){const e=(0,h.createDefModel)("Group");let t=r;(t=r instanceof Array?t:[r]).map((t=>{const r=(0,h.createDefModel)("Box");r.material=t,e.add(r)}));var r=r.name||"material",n=yield this.getArrayBuffer(e,"material");(0,i.downloadFile)(new Blob([n]),r+".glb")}}))}scene(e=!0,t="scene"){return ct(this,void 0,void 0,(function*(){this.runScene.cb.exporter.gltf.before.cb(null);var r=yield this.getArrayBuffer(this.runScene.sceneEx.getClear(),t);return e&&(0,i.downloadFile)(new Blob([r]),"scene.glb"),r}))}originModel(e){return ct(this,void 0,void 0,(function*(){var t,r;e&&(t=e.name||e.type,r=yield this.getOriginArrayBuffer(e),(0,i.downloadFile)(new Blob([r]),t+".glb"))}))}}class ht extends o{constructor(e){super(e),this.gltf=new ut(e)}}n=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};try{URL.revokeObjectURL(n(""))}catch(r){n=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)}}for(var dt=Uint8Array,pt=Uint16Array,ft=Uint32Array,mt=new dt([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]),gt=new dt([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]),vt=new dt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),bt=(K=function(e,t){for(var r=new pt(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];var a=new ft(r[30]);for(n=1;n<30;++n)for(var i=r[n];i<r[n+1];++i)a[i]=i-r[n]<<5|n;return[r,a]},(q=K(mt,2))[0]),yt=(W=q[1],(bt[28]=258,W[258]=28,H=K(gt,0))[0]),xt=(H[1],new pt(32768)),wt=0;wt<32768;++wt){var St=(43690&wt)>>>1|(21845&wt)<<1;xt[wt]=((65280&(St=(61680&(St=(52428&St)>>>2|(13107&St)<<2))>>>4|(3855&St)<<4))>>>8|(255&St)<<8)>>>1}var Mt=function(e,t,r){for(var n=e.length,a=0,i=new pt(t);a<n;++a)++i[e[a]-1];var s=new pt(t);for(a=0;a<t;++a)s[a]=s[a-1]+i[a-1]<<1;if(r){var o=new pt(1<<t),l=15-t;for(a=0;a<n;++a)if(e[a])for(var c=a<<4|e[a],u=t-e[a],h=s[e[a]-1]++<<u,d=h|(1<<u)-1;h<=d;++h)o[xt[h]>>>l]=c}else for(o=new pt(n),a=0;a<n;++a)e[a]&&(o[a]=xt[s[e[a]-1]++]>>>15-e[a]);return o},Tt=new dt(288);for(wt=0;wt<144;++wt)Tt[wt]=8;for(wt=144;wt<256;++wt)Tt[wt]=9;for(wt=256;wt<280;++wt)Tt[wt]=7;for(wt=280;wt<288;++wt)Tt[wt]=8;var _t=new dt(32);for(wt=0;wt<32;++wt)_t[wt]=5;var Et=Mt(Tt,9,1),kt=Mt(_t,5,1),Dt=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},Pt=function(e,t,r){var n=t/8|0;return(e[n]|e[1+n]<<8)>>(7&t)&r},At=function(e,t){var r=t/8|0;return(e[r]|e[1+r]<<8|e[2+r]<<16)>>(7&t)},Ot=function(e){return(e/8|0)+(7&e&&1)},Ct=function(e,t,r){(null==r||r>e.length)&&(r=e.length);var n=new(e instanceof pt?pt:e instanceof ft?ft:dt)(r-(t=null==t||t<0?0:t));return n.set(e.subarray(t,r)),n};Z=new dt(0),X="undefined"!=typeof TextDecoder&&new TextDecoder;try{X.decode(Z,{stream:!0})}catch(r){}function Rt(e,t,r){var n=r.length-e-1;if(t>=r[n])return n-1;if(t<=r[e])return e;for(var a=e,i=n,s=Math.floor((a+i)/2);t<r[s]||t>=r[s+1];)t<r[s]?i=s:a=s,s=Math.floor((a+i)/2);return s}function Lt(e,t,r,n){for(var a=[],i=[],s=[],o=a[0]=1;o<=r;++o){i[o]=t-n[e+1-o],s[o]=n[e+o]-t;for(var l=0,c=0;c<o;++c){var u=s[c+1],h=i[o-c],d=a[c]/(u+h);a[c]=l+u*d,l=h*d}a[o]=l}return a}function It(e,t,r,n,a){for(var i=a<e?a:e,o=[],l=Rt(e,n,t),c=function(e,t,r,n,a){for(var i=[],s=0;s<=r;++s)i[s]=0;for(var o=[],l=0;l<=n;++l)o[l]=i.slice(0);for(var c=[],u=0;u<=r;++u)c[u]=i.slice(0);c[0][0]=1;for(var h=i.slice(0),d=i.slice(0),p=1;p<=r;++p){h[p]=t-a[e+1-p],d[p]=a[e+p]-t;for(var f=0,m=0;m<p;++m){var g=d[m+1],v=h[p-m],b=(c[p][m]=g+v,c[m][p-1]/c[p][m]);c[m][p]=f+g*b,f=v*b}c[p][p]=f}for(var y=0;y<=r;++y)o[0][y]=c[y][r];for(var x=0;x<=r;++x){for(var w=0,S=1,M=[],T=0;T<=r;++T)M[T]=i.slice(0);for(var _=M[0][0]=1;_<=n;++_){var E=0,k=x-_,D=r-_;_<=x&&(M[S][0]=M[w][0]/c[1+D][k],E=M[S][0]*c[k][D]);for(var P=x-1<=D?_-1:r-x,A=-1<=k?1:-k;A<=P;++A)M[S][A]=(M[w][A]-M[w][A-1])/c[1+D][k+A],E+=M[S][A]*c[k+A][D];x<=D&&(M[S][_]=-M[w][_-1]/c[1+D][x],E+=M[S][_]*c[x][D]),o[_][x]=E;var O=w;w=S,S=O}}for(var C=r,R=1;R<=n;++R){for(var L=0;L<=r;++L)o[R][L]*=C;C*=r-R}return o}(l,n,e,i,t),u=[],h=0;h<r.length;++h){var d=r[h].clone(),p=d.w;d.x*=p,d.y*=p,d.z*=p,u[h]=d}for(var f=0;f<=i;++f){for(var m=u[l-e].clone().multiplyScalar(c[f][0]),g=1;g<=e;++g)m.add(u[l-e+g].clone().multiplyScalar(c[f][g]));o[f]=m}for(var v=i+1;v<=a+1;++v)o[v]=new s.Vector4(0,0,0);return o}function Bt(e){for(var t=e.length,r=[],n=[],a=0;a<t;++a){var i=e[a];r[a]=new s.Vector3(i.x,i.y,i.z),n[a]=i.w}for(var o=[],l=0;l<t;++l){for(var c=r[l].clone(),u=1;u<=l;++u)c.sub(o[l-u].clone().multiplyScalar(function(e,t){for(var r=1,n=2;n<=e;++n)r*=n;for(var a=1,i=2;i<=t;++i)a*=i;for(var s=2;s<=e-t;++s)a*=s;return r/a}(l,u)*n[u]));o[l]=c.divideScalar(n[0])}return o}function Ut(e){return(Ut="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function jt(e,t){return(jt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ft(e){return(Ft=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Nt,zt,Vt,Gt=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&&jt(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=Ft(e);if(r=t?(r=Ft(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Ut(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(e,t,a,i,o){var l;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");(l=r.call(this)).degree=e,l.knots=t,l.controlPoints=[],l.startKnot=i||0,l.endKnot=o||l.knots.length-1;for(var c=0;c<a.length;++c){var u=a[c];l.controlPoints[c]=new s.Vector4(u.x,u.y,u.z,u.w)}return l}return t=n,(e=[{key:"getPoint",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new s.Vector3;return e=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),e=function(e,t,r,n){for(var a=Rt(e,n,t),i=Lt(a,n,e,t),o=new s.Vector4(0,0,0,0),l=0;l<=e;++l){var c=r[a-e+l],u=i[l],h=c.w*u;o.x+=c.x*h,o.y+=c.y*h,o.z+=c.z*h,o.w+=c.w*u}return o}(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 s.Vector3,r=(e=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),Bt(It(r=this.degree,this.knots,this.controlPoints,e,1)));return t.copy(r[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}),n}(s.Curve);function Ht(e){return(Ht="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 Wt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qt(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 Kt(e,t,r){t&&qt(e.prototype,t),r&&qt(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function Zt(e,t){return(Zt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Xt(e){return(Xt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Qt=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&&Zt(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=Xt(e);if(r=t?(r=Xt(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Ht(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){return Wt(this,n),r.call(this,e)}return Kt(n,[{key:"load",value:function(e,t,r,n){var a=this,i=""===a.path?s.LoaderUtils.extractUrlBase(e):a.path,o=new s.FileLoader(this.manager);o.setPath(a.path),o.setResponseType("arraybuffer"),o.setRequestHeader(a.requestHeader),o.setWithCredentials(a.withCredentials),o.load(e,(function(r){try{t(a.parse(r,i))}catch(r){n?n(r):console.error(r),a.manager.itemError(e)}}),r,n)}},{key:"parse",value:function(e,t){if(n="Kaydara FBX Binary \0",(r=e).byteLength>=n.length&&n===pr(r,0,n.length))Nt=(new tr).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}(r=pr(e)))throw new Error("THREE.FBXLoader: Unknown format.");if(ar(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+ar(r));Nt=(new er).parse(r)}var r,n=new s.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new Yt(n,this.manager).parse(Nt)}}]),n}(s.Loader),Yt=function(){function e(t,r){Wt(this,e),this.textureLoader=t,this.manager=r}return Kt(e,[{key:"parse",value:function(){zt=this.parseConnections();var e=this.parseImages(),t=(e=this.parseTextures(e),e=this.parseMaterials(e),this.parseDeformers()),r=(new Jt).parse(t);return this.parseScene(t,r,e),Vt}},{key:"parseConnections",value:function(){var e=new Map;return"Connections"in Nt&&Nt.Connections.connections.forEach((function(t){var r=t[0],n=t[1],a=(t=t[2],e.has(r)||e.set(r,{parents:[],children:[]}),{ID:n,relationship:t});e.get(r).parents.push(a),e.has(n)||e.set(n,{parents:[],children:[]}),a={ID:r,relationship:t},e.get(n).children.push(a)})),e}},{key:"parseImages",value:function(){var e,t={},r={};if("Video"in Nt.Objects){var n,a=Nt.Objects.Video;for(n in a){var i,s,o=a[n];t[parseInt(n)]=o.RelativeFilename||o.Filename,"Content"in o&&(s=o.Content instanceof ArrayBuffer&&0<o.Content.byteLength,i="string"==typeof o.Content&&""!==o.Content,(s||i)&&(s=this.parseImage(a[n]),r[o.RelativeFilename||o.Filename]=s))}}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,a=n.slice(n.lastIndexOf(".")+1).toLowerCase();switch(a){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 "'+a+'" 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 Nt.Objects){var r,n=Nt.Objects.Texture;for(r in n){var a=this.parseTexture(n[r],e);t.set(parseInt(r),a)}}return t}},{key:"parseTexture",value:function(e,t){var r=((t=this.loadTexture(e,t)).ID=e.id,t.name=e.attrName,e.WrapModeU),n=e.WrapModeV;return r=void 0!==r?r.value:0,n=void 0!==n?n.value:0,t.wrapS=0===r?s.RepeatWrapping:s.ClampToEdgeWrapping,t.wrapT=0===n?s.RepeatWrapping:s.ClampToEdgeWrapping,"Scaling"in e&&(r=e.Scaling.value,t.repeat.x=r[0],t.repeat.y=r[1]),"Translation"in e&&(n=e.Translation.value,t.offset.x=n[0],t.offset.y=n[1]),t}},{key:"loadTexture",value:function(e,t){var r,n=this.textureLoader.path,a=zt.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 s.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 s.Texture):this.textureLoader.load(r),this.textureLoader.setPath(n),a}},{key:"parseMaterials",value:function(e){var t=new Map;if("Material"in Nt.Objects){var r,n=Nt.Objects.Material;for(r in n){var a=this.parseMaterial(n[r],e);null!==a&&t.set(parseInt(r),a)}}return t}},{key:"parseMaterial",value:function(e,t){var r,n=e.id,a=e.attrName,i=e.ShadingModel;if("object"===Ht(i)&&(i=i.value),!zt.has(n))return null;switch(e=this.parseParameters(e,t,n),i.toLowerCase()){case"phong":r=new s.MeshPhongMaterial;break;case"lambert":r=new s.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',i),r=new s.MeshPhongMaterial}return r.setValues(e),r.name=a,r}},{key:"parseParameters",value:function(e,t,r){var n={},a=(e.BumpFactor&&(n.bumpScale=e.BumpFactor.value),e.Diffuse?n.color=(new s.Color).fromArray(e.Diffuse.value):!e.DiffuseColor||"Color"!==e.DiffuseColor.type&&"ColorRGB"!==e.DiffuseColor.type||(n.color=(new s.Color).fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(n.displacementScale=e.DisplacementFactor.value),e.Emissive?n.emissive=(new s.Color).fromArray(e.Emissive.value):!e.EmissiveColor||"Color"!==e.EmissiveColor.type&&"ColorRGB"!==e.EmissiveColor.type||(n.emissive=(new s.Color).fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(n.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(n.opacity=parseFloat(e.Opacity.value)),n.opacity<1&&(n.transparent=!0),e.ReflectionFactor&&(n.reflectivity=e.ReflectionFactor.value),e.Shininess&&(n.shininess=e.Shininess.value),e.Specular?n.specular=(new s.Color).fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(n.specular=(new s.Color).fromArray(e.SpecularColor.value)),this);return zt.get(r).children.forEach((function(e){var r=e.relationship;switch(r){case"Bump":n.bumpMap=a.getTexture(t,e.ID);break;case"Maya|TEX_ao_map":n.aoMap=a.getTexture(t,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":n.map=a.getTexture(t,e.ID),void 0!==n.map&&(n.map.encoding=s.sRGBEncoding);break;case"DisplacementColor":n.displacementMap=a.getTexture(t,e.ID);break;case"EmissiveColor":n.emissiveMap=a.getTexture(t,e.ID),void 0!==n.emissiveMap&&(n.emissiveMap.encoding=s.sRGBEncoding);break;case"NormalMap":case"Maya|TEX_normal_map":n.normalMap=a.getTexture(t,e.ID);break;case"ReflectionColor":n.envMap=a.getTexture(t,e.ID),void 0!==n.envMap&&(n.envMap.mapping=s.EquirectangularReflectionMapping,n.envMap.encoding=s.sRGBEncoding);break;case"SpecularColor":n.specularMap=a.getTexture(t,e.ID),void 0!==n.specularMap&&(n.specularMap.encoding=s.sRGBEncoding);break;case"TransparentColor":case"TransparencyFactor":n.alphaMap=a.getTexture(t,e.ID),n.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",r)}})),n}},{key:"getTexture",value:function(e,t){return"LayeredTexture"in Nt.Objects&&t in Nt.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=zt.get(t).children[0].ID),e.get(t)}},{key:"parseDeformers",value:function(){var e={},t={};if("Deformer"in Nt.Objects){var r,n=Nt.Objects.Deformer;for(r in n){var a,i=n[r],s=zt.get(parseInt(r));"Skin"===i.attrType?((a=this.parseSkeleton(s,n)).ID=r,1<s.parents.length&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),a.geometryID=s.parents[0].ID,e[r]=a):"BlendShape"===i.attrType&&((a={id:r}).rawTargets=this.parseMorphTargets(s,n),a.id=r,1<s.parents.length&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[r]=a)}}return{skeletons:e,morphTargets:t}}},{key:"parseSkeleton",value:function(e,t){var r=[];return e.children.forEach((function(e){var n=t[e.ID];"Cluster"===n.attrType&&(e={ID:e.ID,indices:[],weights:[],transformLink:(new s.Matrix4).fromArray(n.TransformLink.a)},"Indexes"in n&&(e.indices=n.Indexes.a,e.weights=n.Weights.a),r.push(e))})),{rawBones:r,bones:[]}}},{key:"parseMorphTargets",value:function(e,t){for(var r=[],n=0;n<e.children.length;n++){var a=e.children[n],i=t[a.ID],s={name:i.attrName,initialWeight:i.DeformPercent,id:i.id,fullWeights:i.FullWeights.a};if("BlendShapeChannel"!==i.attrType)return;s.geoID=zt.get(parseInt(a.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,r.push(s)}return r}},{key:"parseScene",value:function(e,t,r){Vt=new s.Group;var n=this.parseModels(e.skeletons,t,r),a=Nt.Objects.Model,i=this;n.forEach((function(e){var t=a[e.ID];i.setLookAtProperties(e,t),zt.get(e.ID).parents.forEach((function(t){void 0!==(t=n.get(t.ID))&&t.add(e)})),null===e.parent&&Vt.add(e)})),this.bindSkeleton(e.skeletons,t,n),this.createAmbientLight(),Vt.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=ur(e.userData.transformData),e.applyMatrix4(t),e.updateWorldMatrix())})),r=(new $t).parse(),1===Vt.children.length&&Vt.children[0].isGroup&&(Vt.children[0].animations=r,Vt=Vt.children[0]),Vt.animations=r}},{key:"parseModels",value:function(e,t,r){var n,a=new Map,i=Nt.Objects.Model;for(n in i){var o=parseInt(n),l=i[n],c=zt.get(o),u=this.buildSkeleton(c,e,o,l.attrName);if(!u){switch(l.attrType){case"Camera":u=this.createCamera(c);break;case"Light":u=this.createLight(c);break;case"Mesh":u=this.createMesh(c,t,r);break;case"NurbsCurve":u=this.createCurve(c,t);break;case"LimbNode":case"Root":u=new s.Bone;break;default:u=new s.Group}u.name=l.attrName?s.PropertyBinding.sanitizeNodeName(l.attrName):"",u.ID=o}this.getTransformData(u,l),a.set(o,u)}return a}},{key:"buildSkeleton",value:function(e,t,r,n){var a=null;return e.parents.forEach((function(e){for(var i in t)!function(i){var o=t[i];o.rawBones.forEach((function(t,i){var l;t.ID===e.ID&&(l=a,(a=new s.Bone).matrixWorld.copy(t.transformLink),a.name=n?s.PropertyBinding.sanitizeNodeName(n):"",a.ID=r,o.bones[i]=a,null!==l&&a.add(l))}))}(i)})),a}},{key:"createCamera",value:function(e){var t,r;if(e.children.forEach((function(e){void 0!==(e=Nt.Objects.NodeAttribute[e.ID])&&(r=e)})),void 0===r)t=new s.Object3D;else{var n=0,a=(void 0!==r.CameraProjectionType&&1===r.CameraProjectionType.value&&(n=1),1),i=(void 0!==r.NearPlane&&(a=r.NearPlane.value/1e3),1e3),o=(void 0!==r.FarPlane&&(i=r.FarPlane.value/1e3),window.innerWidth),l=window.innerHeight,c=(void 0!==r.AspectWidth&&void 0!==r.AspectHeight&&(o=r.AspectWidth.value,l=r.AspectHeight.value),o/l),u=45,h=(void 0!==r.FieldOfView&&(u=r.FieldOfView.value),r.FocalLength?r.FocalLength.value:null);switch(n){case 0:t=new s.PerspectiveCamera(u,c,a,i),null!==h&&t.setFocalLength(h);break;case 1:t=new s.OrthographicCamera(-o/2,o/2,l/2,-l/2,a,i);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+n+"."),t=new s.Object3D}}return t}},{key:"createLight",value:function(e){var t,r;if(e.children.forEach((function(e){void 0!==(e=Nt.Objects.NodeAttribute[e.ID])&&(r=e)})),void 0===r)t=new s.Object3D;else{e=void 0===r.LightType?0:r.LightType.value;var n=16777215,a=(void 0!==r.Color&&(n=(new s.Color).fromArray(r.Color.value)),void 0===r.Intensity?1:r.Intensity.value/100),i=(void 0!==r.CastLightOnObject&&0===r.CastLightOnObject.value&&(a=0),0);switch(void 0!==r.FarAttenuationEnd&&(i=void 0!==r.EnableFarAttenuation&&0===r.EnableFarAttenuation.value?0:r.FarAttenuationEnd.value),e){case 0:t=new s.PointLight(n,a,i,1);break;case 1:t=new s.DirectionalLight(n,a);break;case 2:var o=Math.PI/3,l=(void 0!==r.InnerAngle&&(o=s.MathUtils.degToRad(r.InnerAngle.value)),0);void 0!==r.OuterAngle&&(l=s.MathUtils.degToRad(r.OuterAngle.value),l=Math.max(l,1)),t=new s.SpotLight(n,a,i,o,l,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+r.LightType.value+", defaulting to a PointLight."),t=new s.PointLight(n,a)}void 0!==r.CastShadows&&1===r.CastShadows.value&&(t.castShadow=!0)}return t}},{key:"createMesh",value:function(e,t,r){var n,a=null,i=null,o=[];return e.children.forEach((function(e){t.has(e.ID)&&(a=t.get(e.ID)),r.has(e.ID)&&o.push(r.get(e.ID))})),1<o.length?i=o:0<o.length?i=o[0]:(i=new s.MeshPhongMaterial({color:13421772}),o.push(i)),"color"in a.attributes&&o.forEach((function(e){e.vertexColors=!0})),a.FBX_Deformer?(n=new s.SkinnedMesh(a,i)).normalizeSkinWeights():n=new s.Mesh(a,i),n}},{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 r=new s.LineBasicMaterial({color:3342591,linewidth:1});return new s.Line(e,r)}},{key:"getTransformData",value:function(e,t){var r={};"InheritType"in t&&(r.inheritType=parseInt(t.InheritType.value)),r.eulerOrder="RotationOrder"in t?hr(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&&zt.get(e.ID).children.forEach((function(t){"LookAtProperty"===t.relationship&&"Lcl_Translation"in(t=Nt.Objects.Model[t.ID])&&(t=t.Lcl_Translation.value,void 0!==e.target?(e.target.position.fromArray(t),Vt.add(e.target)):e.lookAt((new s.Vector3).fromArray(t)))}))}},{key:"bindSkeleton",value:function(e,t,r){var n,a=this.parsePoseNodes();for(n in e)!function(n){var i=e[n];zt.get(parseInt(i.ID)).parents.forEach((function(e){t.has(e.ID)&&(e=e.ID,zt.get(e).parents.forEach((function(e){r.has(e.ID)&&r.get(e.ID).bind(new s.Skeleton(i.bones),a[e.ID])})))}))}(n)}},{key:"parsePoseNodes",value:function(){var e={};if("Pose"in Nt.Objects){var t,r,n=Nt.Objects.Pose;for(t in n)"BindPose"===n[t].attrType&&0<n[t].NbPoseNodes&&(r=n[t].PoseNode,Array.isArray(r)?r.forEach((function(t){e[t.Node]=(new s.Matrix4).fromArray(t.Matrix.a)})):e[r.Node]=(new s.Matrix4).fromArray(r.Matrix.a))}return e}},{key:"createAmbientLight",value:function(){var e,t,r;"GlobalSettings"in Nt&&"AmbientColor"in Nt.GlobalSettings&&(r=(t=Nt.GlobalSettings.AmbientColor.value)[0],e=t[1],t=t[2],0===r&&0===e&&0===t||(r=new s.Color(r,e,t),Vt.add(new s.AmbientLight(r,1))))}}]),e}(),Jt=function(){function e(){Wt(this,e),this.negativeMaterialIndices=!1}return Kt(e,[{key:"parse",value:function(e){var t=new Map;if("Geometry"in Nt.Objects){var r,n=Nt.Objects.Geometry;for(r in n){var a=zt.get(parseInt(r));a=this.parseGeometry(a,n[r],e),t.set(parseInt(r),a)}}return!0===this.negativeMaterialIndices&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),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,a=r.skeletons,i=[],s=e.parents.map((function(e){return Nt.Objects.Model[e.ID]}));if(0!==s.length)return n=e.children.reduce((function(e,t){return void 0!==a[t.ID]?a[t.ID]:e}),null),e.children.forEach((function(e){void 0!==r.morphTargets[e.ID]&&i.push(r.morphTargets[e.ID])})),e=s[0],s={},"RotationOrder"in e&&(s.eulerOrder=hr(e.RotationOrder.value)),"InheritType"in e&&(s.inheritType=parseInt(e.InheritType.value)),"GeometricTranslation"in e&&(s.translation=e.GeometricTranslation.value),"GeometricRotation"in e&&(s.rotation=e.GeometricRotation.value),"GeometricScaling"in e&&(s.scale=e.GeometricScaling.value),e=ur(s),this.genGeometry(t,n,i,e)}},{key:"genGeometry",value:function(e,t,r,n){var a,i,o=new s.BufferGeometry,l=(e.attrName&&(o.name=e.attrName),this.parseGeoNode(e,t)),c=this.genBuffers(l),u=new s.Float32BufferAttribute(c.vertex,3);return u.applyMatrix4(n),o.setAttribute("position",u),0<c.colors.length&&o.setAttribute("color",new s.Float32BufferAttribute(c.colors,3)),t&&(o.setAttribute("skinIndex",new s.Uint16BufferAttribute(c.weightsIndices,4)),o.setAttribute("skinWeight",new s.Float32BufferAttribute(c.vertexWeights,4)),o.FBX_Deformer=t),0<c.normal.length&&(u=(new s.Matrix3).getNormalMatrix(n),(t=new s.Float32BufferAttribute(c.normal,3)).applyNormalMatrix(u),o.setAttribute("normal",t)),c.uvs.forEach((function(e,t){var r="uv"+(t+1).toString();o.setAttribute(r=0===t?"uv":r,new s.Float32BufferAttribute(c.uvs[t],2))})),l.material&&"AllSame"!==l.material.mappingType&&(a=c.materialIndex[0],i=0,c.materialIndex.forEach((function(e,t){e!==a&&(o.addGroup(i,t-i,a),a=e,i=t)})),0<o.groups.length&&(t=(u=o.groups[o.groups.length-1]).start+u.count)!==c.materialIndex.length&&o.addGroup(t,c.materialIndex.length-t,a),0===o.groups.length&&o.addGroup(0,c.materialIndex.length,c.materialIndex[0])),this.addMorphTargets(o,e,r,n),o}},{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,a){void 0===r.weightTable[n]&&(r.weightTable[n]=[]),r.weightTable[n].push({id:t,weight:e.weights[a]})}))})),r}},{key:"genBuffers",value:function(e){var t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},r=0,n=0,a=!1,i=[],s=[],o=[],l=[],c=[],u=[],h=this;return e.vertexIndices.forEach((function(d,p){var f,m,g,v,b=!1,y=(d<0&&(d^=-1,b=!0),[]),x=[];if(i.push(3*d,3*d+1,3*d+2),e.color&&(v=or(p,r,d,e.color),o.push(v[0],v[1],v[2])),e.skeleton){for(void 0!==e.weightTable[d]&&e.weightTable[d].forEach((function(e){x.push(e.weight),y.push(e.id)})),4<x.length&&(a||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),a=!0),m=[0,0,0,0],g=[0,0,0,0],x.forEach((function(e,t){var r=e,n=y[t];g.forEach((function(e,t,a){e<r&&(a[t]=r,r=e,a=m[t],m[t]=n,n=a)}))})),y=m,x=g);x.length<4;)x.push(0),y.push(0);for(var w=0;w<4;++w)c.push(x[w]),u.push(y[w])}e.normal&&(v=or(p,r,d,e.normal),s.push(v[0],v[1],v[2])),e.material&&"AllSame"!==e.material.mappingType&&(f=or(p,r,d,e.material)[0])<0&&(h.negativeMaterialIndices=!0,f=0),e.uv&&e.uv.forEach((function(e,t){e=or(p,r,d,e),void 0===l[t]&&(l[t]=[]),l[t].push(e[0]),l[t].push(e[1])})),n++,b&&(4<n&&console.warn("THREE.FBXLoader: Polygons with more than four sides are not supported. Make sure to triangulate the geometry during export."),h.genFace(t,e,i,f,s,o,l,c,u,n),r++,n=0,i=[],s=[],o=[],l=[],c=[],u=[])})),t}},{key:"genFace",value:function(e,t,r,n,a,i,s,o,l,c){for(var u=2;u<c;u++)!function(c){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*(c-1)]]),e.vertex.push(t.vertexPositions[r[3*(c-1)+1]]),e.vertex.push(t.vertexPositions[r[3*(c-1)+2]]),e.vertex.push(t.vertexPositions[r[3*c]]),e.vertex.push(t.vertexPositions[r[3*c+1]]),e.vertex.push(t.vertexPositions[r[3*c+2]]),t.skeleton&&(e.vertexWeights.push(o[0]),e.vertexWeights.push(o[1]),e.vertexWeights.push(o[2]),e.vertexWeights.push(o[3]),e.vertexWeights.push(o[4*(c-1)]),e.vertexWeights.push(o[4*(c-1)+1]),e.vertexWeights.push(o[4*(c-1)+2]),e.vertexWeights.push(o[4*(c-1)+3]),e.vertexWeights.push(o[4*c]),e.vertexWeights.push(o[4*c+1]),e.vertexWeights.push(o[4*c+2]),e.vertexWeights.push(o[4*c+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*(c-1)]),e.weightsIndices.push(l[4*(c-1)+1]),e.weightsIndices.push(l[4*(c-1)+2]),e.weightsIndices.push(l[4*(c-1)+3]),e.weightsIndices.push(l[4*c]),e.weightsIndices.push(l[4*c+1]),e.weightsIndices.push(l[4*c+2]),e.weightsIndices.push(l[4*c+3])),t.color&&(e.colors.push(i[0]),e.colors.push(i[1]),e.colors.push(i[2]),e.colors.push(i[3*(c-1)]),e.colors.push(i[3*(c-1)+1]),e.colors.push(i[3*(c-1)+2]),e.colors.push(i[3*c]),e.colors.push(i[3*c+1]),e.colors.push(i[3*c+2])),t.material&&"AllSame"!==t.material.mappingType&&(e.materialIndex.push(n),e.materialIndex.push(n),e.materialIndex.push(n)),t.normal&&(e.normal.push(a[0]),e.normal.push(a[1]),e.normal.push(a[2]),e.normal.push(a[3*(c-1)]),e.normal.push(a[3*(c-1)+1]),e.normal.push(a[3*(c-1)+2]),e.normal.push(a[3*c]),e.normal.push(a[3*c+1]),e.normal.push(a[3*c+2])),t.uv&&t.uv.forEach((function(t,r){void 0===e.uvs[r]&&(e.uvs[r]=[]),e.uvs[r].push(s[r][0]),e.uvs[r].push(s[r][1]),e.uvs[r].push(s[r][2*(c-1)]),e.uvs[r].push(s[r][2*(c-1)+1]),e.uvs[r].push(s[r][2*c]),e.uvs[r].push(s[r][2*c+1])}))}(u)}},{key:"addMorphTargets",value:function(e,t,r,n){var a;0!==r.length&&(e.morphTargetsRelative=!0,e.morphAttributes.position=[],a=this,r.forEach((function(r){r.rawTargets.forEach((function(r){var i=Nt.Objects.Geometry[r.geoID];void 0!==i&&a.genMorphGeometry(e,t,i,n,r.name)}))})))}},{key:"genMorphGeometry",value:function(e,t,r,n,a){t=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[];for(var i=void 0!==r.Vertices?r.Vertices.a:[],o=void 0!==r.Indexes?r.Indexes.a:[],l=3*e.attributes.position.count,c=new Float32Array(l),u=0;u<o.length;u++){var h=3*o[u];c[h]=i[3*u],c[1+h]=i[3*u+1],c[2+h]=i[3*u+2]}l=this.genBuffers({vertexIndices:t,vertexPositions:c}),(t=new s.Float32BufferAttribute(l.vertex,3)).name=a||r.attrName,t.applyMatrix4(n),e.morphAttributes.position.push(t)}},{key:"parseNormals",value:function(e){var t=e.MappingInformationType,r=e.ReferenceInformationType,n=e.Normals.a,a=[];return"IndexToDirect"===r&&("NormalIndex"in e?a=e.NormalIndex.a:"NormalsIndex"in e&&(a=e.NormalsIndex.a)),{dataSize:3,buffer:n,indices:a,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,a=[],i=0;i<n.length;++i)a.push(i);return{dataSize:1,buffer:n,indices:a,mappingType:t,referenceType:r}}},{key:"parseNurbsGeometry",value:function(e){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 s.BufferGeometry;for(var r=t-1,n=(t=e.KnotVector.a,[]),a=e.Points.a,i=0,o=a.length;i<o;i+=4)n.push((new s.Vector4).fromArray(a,i));if("Closed"===e.Form)n.push(n[0]);else if("Periodic"===e.Form)for(var l=r,c=t.length-1-l,u=0;u<r;++u)n.push(n[u]);return e=new Gt(r,t,n,l,c).getPoints(12*n.length),(new s.BufferGeometry).setFromPoints(e)}}]),e}(),$t=function(){function e(){Wt(this,e)}return Kt(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!==Nt.Objects.AnimationCurve)return e=this.parseAnimationCurveNodes(),this.parseAnimationCurves(e),e=this.parseAnimationLayers(e),this.parseAnimStacks(e)}},{key:"parseAnimationCurveNodes",value:function(){var e,t=Nt.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=Nt.Objects.AnimationCurve;for(t in r){var n,a={id:r[t].id,times:r[t].KeyTime.a.map(ir),values:r[t].KeyValueFloat.a},i=zt.get(a.id);void 0!==i&&(n=i.parents[0].ID,(i=i.parents[0].relationship).match(/X/)?e.get(n).curves.x=a:i.match(/Y/)?e.get(n).curves.y=a:i.match(/Z/)?e.get(n).curves.z=a:i.match(/d|DeformPercent/)&&e.has(n)&&(e.get(n).curves.morph=a))}}},{key:"parseAnimationLayers",value:function(e){var t,r=Nt.Objects.AnimationLayer,n=new Map;for(t in r)!function(t){var r=[],a=zt.get(parseInt(t));void 0!==a&&(a.children.forEach((function(t,n){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[n]){var i=zt.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID;if(void 0!==i){var o=Nt.Objects.Model[i.toString()];if(void 0===o)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",t);var l={modelName:o.attrName?s.PropertyBinding.sanitizeNodeName(o.attrName):"",ID:o.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};Vt.traverse((function(e){e.ID===o.id&&(l.transform=e.matrix,e.userData.transformData&&(l.eulerOrder=e.userData.transformData.eulerOrder))})),l.transform||(l.transform=new s.Matrix4),"PreRotation"in o&&(l.preRotation=o.PreRotation.value),"PostRotation"in o&&(l.postRotation=o.PostRotation.value),r[n]=l}}r[n]&&(r[n][a.attr]=a)}else void 0!==a.curves.morph&&(void 0===r[n]&&(i=zt.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,t=zt.get(i).parents[0].ID,t=zt.get(t).parents[0].ID,t=zt.get(t).parents[0].ID,t={modelName:(t=Nt.Objects.Model[t]).attrName?s.PropertyBinding.sanitizeNodeName(t.attrName):"",morphName:Nt.Objects.Deformer[i].attrName},r[n]=t),r[n][a.attr]=a)}})),n.set(parseInt(t),r))}(t);return n}},{key:"parseAnimStacks",value:function(e){var t,r=Nt.Objects.AnimationStack,n={};for(t in r){var a=(1<(a=zt.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(a[0].ID));n[t]={name:r[t].attrName,layer:a}}return n}},{key:"addClip",value:function(e){var t=[],r=this;return e.layer.forEach((function(e){t=t.concat(r.generateTracks(e))})),new s.AnimationClip(e.name,-1,t)}},{key:"generateTracks",value:function(e){var t=[],r=new s.Vector3,n=new s.Quaternion,a=new s.Vector3;return e.transform&&e.transform.decompose(r,n,a),r=r.toArray(),n=(new s.Euler).setFromQuaternion(n,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,n,e.preRotation,e.postRotation,e.eulerOrder))&&t.push(r),void 0!==e.S&&0<Object.keys(e.S.curves).length&&void 0!==(n=this.generateVectorTrack(e.modelName,e.S.curves,a,"scale"))&&t.push(n),void 0!==e.DeformPercent&&void 0!==(r=this.generateMorphTrack(e))&&t.push(r),t}},{key:"generateVectorTrack",value:function(e,t,r,n){var a=this.getTimesForAllAxes(t);return t=this.getKeyframeTrackValues(a,t,r),new s.VectorKeyframeTrack(e+"."+n,a,t)}},{key:"generateRotationTrack",value:function(e,t,r,n,a,i){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(s.MathUtils.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(s.MathUtils.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(s.MathUtils.degToRad));for(var o=this.getTimesForAllAxes(t),l=this.getKeyframeTrackValues(o,t,r),c=(void 0!==n&&((n=n.map(s.MathUtils.degToRad)).push(i),n=(new s.Euler).fromArray(n),n=(new s.Quaternion).setFromEuler(n)),void 0!==a&&((a=a.map(s.MathUtils.degToRad)).push(i),a=(new s.Euler).fromArray(a),a=(new s.Quaternion).setFromEuler(a).invert()),new s.Quaternion),u=new s.Euler,h=[],d=0;d<l.length;d+=3)u.set(l[d],l[d+1],l[d+2],i),c.setFromEuler(u),void 0!==n&&c.premultiply(n),void 0!==a&&c.multiply(a),c.toArray(h,d/3*4);return new s.QuaternionKeyframeTrack(e+".quaternion",o,h)}},{key:"generateMorphTrack",value:function(e){var t=e.DeformPercent.curves.morph,r=t.values.map((function(e){return e/100})),n=Vt.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new s.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+n+"]",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 r=1,n=t[0],a=1;a<t.length;a++){var i=t[a];i!==n&&(n=t[r]=i,r++)}t=t.slice(0,r)}return t}},{key:"getKeyframeTrackValues",value:function(e,t,r){var n=r,a=[],i=-1,s=-1,o=-1;return e.forEach((function(e){t.x&&(i=t.x.times.indexOf(e)),t.y&&(s=t.y.times.indexOf(e)),t.z&&(o=t.z.times.indexOf(e)),-1!==i?(e=t.x.values[i],a.push(e),n[0]=e):a.push(n[0]),-1!==s?(e=t.y.values[s],a.push(e),n[1]=e):a.push(n[1]),-1!==o?(e=t.z.values[o],a.push(e),n[2]=e):a.push(n[2])})),a}},{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<=(a=Math.abs(n))){for(var a,i=n/(a/=180),s=r+i,o=(n=e.times[t-1],(e.times[t]-n)/a),l=n+o,c=[],u=[];l<e.times[t];)c.push(l),l+=o,u.push(s),s+=i;e.times=fr(e.times,t,c),e.values=fr(e.values,t,u)}}}}]),e}(),er=function(){function e(){Wt(this,e)}return Kt(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 nr,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var t=this,r=e.split(/[\r\n]+/);return r.forEach((function(e,n){var a,i=e.match(/^[\s\t]*;/),s=e.match(/^[\s\t]*$/);i||s||(i=e.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),s=e.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),a=e.match("^\\t{"+(t.currentIndent-1)+"}}"),i?t.parseNodeBegin(e,i):s?t.parseNodeProperty(e,s,r[++n]):a?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}),a=(t=this.parseNodeAttr(t),this.getCurrentNode());0===this.currentIndent?this.allNodes.add(r,n):r in a?("PoseNode"===r?a.PoseNode.push(n):void 0!==a[r].id&&(a[r]={},a[r][a[r].id]=a[r]),""!==t.id&&(a[r][t.id]=n)):"number"==typeof t.id?(a[r]={},a[r][t.id]=n):"Properties70"!==r&&(a[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 a=parseInt(e[0]),i=(e=parseInt(e[1]),(i=t.split(",").slice(3)).map((function(e){return e.trim().replace(/^"/,"")}))),s=(n="connections",t=[a,e]),o=i,l=0,c=s.length,u=o.length;l<u;l++,c++)s[c]=o[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=dr(t))}}},{key:"parseNodePropertyContinued",value:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=dr(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],a=r[1],i=r[2],s=r[3],o=r[4];switch(a){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":o=parseFloat(o);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":o=dr(o)}this.getPrevNode()[n]={type:a,type2:i,flag:s,value:o},this.setCurrentProp(this.getPrevNode(),n)}}]),e}(),tr=function(){function e(){Wt(this,e)}return Kt(e,[{key:"parse",value:function(e){var t=new rr(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 nr;!this.endOfContent(t);){var a=this.parseNode(t,r);null!==a&&n.add(a.name,a)}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(),a=7500<=t?e.getUint64():e.getUint32(),i=(7500<=t?e.getUint64():e.getUint32(),e.getUint8()),s=e.getString(i);if(0===n)return null;for(var o=[],l=0;l<a;l++)o.push(this.parseProperty(e));i=0<o.length?o[0]:"";var c=1<o.length?o[1]:"",u=2<o.length?o[2]:"";for(r.singleProperty=1===a&&e.getOffset()===n;n>e.getOffset();){var h=this.parseNode(e,t);null!==h&&this.parseSubNode(s,r,h)}return r.propertyList=o,"number"==typeof i&&(r.id=i),""!==c&&(r.attrName=c),""!==u&&(r.attrType=u),""!==s&&(r.name=s),r}},{key:"parseSubNode",value:function(e,t,r){var n,a,i,s,o;!0===r.singleProperty?(a=r.propertyList[0],Array.isArray(a)?(t[r.name]=r).a=a:t[r.name]=a):"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?(a=r.propertyList[0],e=r.propertyList[1],i=r.propertyList[2],s=r.propertyList[3],0===a.indexOf("Lcl ")&&(a=a.replace("Lcl ","Lcl_")),o="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[a]={type:e,type2:i,flag:s,value:o}):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(e){var t=e.getString(1);switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var r=e.getUint32(),n=e.getUint32(),a=e.getUint32();if(0===n)switch(t){case"b":case"c":return e.getBooleanArray(r);case"d":return e.getFloat64Array(r);case"f":return e.getFloat32Array(r);case"i":return e.getInt32Array(r);case"l":return e.getInt64Array(r)}n=function(e,t){return function(e,t,r){var n=e.length;if(!n||r&&!r.l&&n<5)return t||new dt(0);function a(e){var r=t.length;r<e&&((r=new dt(Math.max(2*r,e))).set(t),t=r)}var i=!t||r,s=!r||r.i,o=(r=r||{},t=t||new dt(3*n),r.f||0),l=r.p||0,c=r.b||0,u=r.l,h=r.d,d=r.m,p=r.n,f=8*n;do{if(!u){r.f=o=Pt(e,l,1);var m=Pt(e,l+1,3);if(l+=3,!m){var g=e[(_=Ot(l)+4)-4]|e[_-3]<<8;if(n<(S=_+g)){if(s)throw"unexpected EOF";break}i&&a(c+g),t.set(e.subarray(_,S),c),r.b=c+=g,r.p=l=8*S;continue}if(1==m)u=Et,h=kt,d=9,p=5;else{if(2!=m)throw"invalid block type";g=Pt(e,l,31)+257;for(var v=Pt(e,l+10,15)+4,b=g+Pt(e,l+5,31)+1,y=(l+=14,new dt(b)),x=new dt(19),w=0;w<v;++w)x[vt[w]]=Pt(e,l+3*w,7);l+=3*v;var S,M=(1<<(S=Dt(x)))-1,T=Mt(x,S,1);for(w=0;w<b;){var _,E=T[Pt(e,l,M)];if(l+=15&E,(_=E>>>4)<16)y[w++]=_;else{var k=0,D=0;for(16==_?(D=3+Pt(e,l,3),l+=2,k=y[w-1]):17==_?(D=3+Pt(e,l,7),l+=3):18==_&&(D=11+Pt(e,l,127),l+=7);D--;)y[w++]=k}}m=y.subarray(0,g);var P=y.subarray(g);d=Dt(m),p=Dt(P),u=Mt(m,d,1),h=Mt(P,p,1)}if(f<l){if(s)throw"unexpected EOF";break}}i&&a(c+131072);for(var A=(1<<d)-1,O=(1<<p)-1,C=l;;C=l){var R=(k=u[At(e,l)&A])>>>4;if(f<(l+=15&k)){if(s)throw"unexpected EOF";break}if(!k)throw"invalid length/literal";if(R<256)t[c++]=R;else{if(256==R){C=l,u=null;break}var L,I=R-254,B=(264<R&&(L=mt[w=R-257],I=Pt(e,l,(1<<L)-1)+bt[w],l+=L),(R=h[At(e,l)&O])>>>4);if(!R)throw"invalid distance";if(l+=15&R,P=yt[B],3<B&&(L=gt[B],P+=At(e,l)&(1<<L)-1,l+=L),f<l){if(s)throw"unexpected EOF";break}i&&a(c+131072);for(var U=c+I;c<U;c+=4)t[c]=t[c-P],t[c+1]=t[c+1-P],t[c+2]=t[c+2-P],t[c+3]=t[c+3-P];c=U}}r.l=u,r.p=C,r.b=c,u&&(o=1,r.m=d,r.d=h,r.n=p)}while(!o);return c==t.length?t:Ct(t,0,c)}((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"}(e),e.subarray(2,-4)),t)}(new Uint8Array(e.getArrayBuffer(a)));var i=new rr(n.buffer);switch(t){case"b":case"c":return i.getBooleanArray(r);case"d":return i.getFloat64Array(r);case"f":return i.getFloat32Array(r);case"i":return i.getInt32Array(r);case"l":return i.getInt64Array(r)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}]),e}(),rr=function(){function e(t,r){Wt(this,e),this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===r||r,this._textDecoder=new TextDecoder}return Kt(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){var t=this.offset,r=new Uint8Array(this.dv.buffer,t,e);return 0<=(this.skip(e),e=r.indexOf(0))&&(r=new Uint8Array(this.dv.buffer,t,e)),this._textDecoder.decode(r)}}]),e}(),nr=function(){function e(){Wt(this,e)}return Kt(e,[{key:"add",value:function(e,t){this[e]=t}}]),e}();function ar(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 ir(e){return e/46186158e3}var sr=[];function or(e,t,r,n){var a;switch(n.mappingType){case"ByPolygonVertex":a=e;break;case"ByPolygon":a=t;break;case"ByVertice":a=r;break;case"AllSame":a=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}for(var i=(a="IndexToDirect"===n.referenceType?n.indices[a]:a)*n.dataSize,s=i+n.dataSize,o=sr,l=n.buffer,c=s,u=i,h=0;u<c;u++,h++)o[h]=l[u];return o}var lr=new s.Euler,cr=new s.Vector3;function ur(e){var t=new s.Matrix4,r=new s.Matrix4,n=new s.Matrix4,a=new s.Matrix4,i=new s.Matrix4,o=new s.Matrix4,l=new s.Matrix4,c=new s.Matrix4,u=new s.Matrix4,h=new s.Matrix4,d=new s.Matrix4,p=new s.Matrix4,f=e.inheritType||0,m=(e.translation&&t.setPosition(cr.fromArray(e.translation)),e.preRotation&&((m=e.preRotation.map(s.MathUtils.degToRad)).push(e.eulerOrder||s.Euler.DEFAULT_ORDER),r.makeRotationFromEuler(lr.fromArray(m))),e.rotation&&((m=e.rotation.map(s.MathUtils.degToRad)).push(e.eulerOrder||s.Euler.DEFAULT_ORDER),n.makeRotationFromEuler(lr.fromArray(m))),e.postRotation&&((m=e.postRotation.map(s.MathUtils.degToRad)).push(e.eulerOrder||s.Euler.DEFAULT_ORDER),a.makeRotationFromEuler(lr.fromArray(m)),a.invert()),e.scale&&i.scale(cr.fromArray(e.scale)),e.scalingOffset&&l.setPosition(cr.fromArray(e.scalingOffset)),e.scalingPivot&&o.setPosition(cr.fromArray(e.scalingPivot)),e.rotationOffset&&c.setPosition(cr.fromArray(e.rotationOffset)),e.rotationPivot&&u.setPosition(cr.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(d.copy(e.parentMatrix),h.copy(e.parentMatrixWorld)),r.clone().multiply(n).multiply(a)),g=(((e=new s.Matrix4).extractRotation(h),g=new s.Matrix4).copyPosition(h),g.clone().invert().multiply(h)),v=(g=e.clone().invert().multiply(g),i),b=new s.Matrix4;return 0===f?b.copy(e).multiply(m).multiply(g).multiply(v):1===f?b.copy(e).multiply(g).multiply(m).multiply(v):(f=(new s.Matrix4).scale((new s.Vector3).setFromMatrixScale(d)).clone().invert(),d=g.clone().multiply(f),b.copy(e).multiply(m).multiply(d).multiply(v)),g=u.clone().invert(),f=o.clone().invert(),e=t.clone().multiply(c).multiply(u).multiply(r).multiply(n).multiply(a).multiply(g).multiply(l).multiply(o).multiply(i).multiply(f),m=(new s.Matrix4).copyPosition(e),d=h.clone().multiply(m),p.copyPosition(d),(e=p.clone().multiply(b)).premultiply(h.invert()),e}function hr(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 dr(e){return e.split(",").map((function(e){return parseFloat(e)}))}function pr(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=e.byteLength),(new TextDecoder).decode(new Uint8Array(e,t,r))}function fr(e,t,r){return e.slice(0,t).concat(r).concat(e.slice(t))}function mr(e){return(mr="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 gr(e,t){return(gr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function vr(e){return(vr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var br=/^[og]\s*(.+)?/,yr=/^mtllib /,xr=/^usemtl /,wr=/^usemap /,Sr=/\s+/,Mr=new s.Vector3,Tr=new s.Vector3,_r=new s.Vector3,Er=new s.Vector3,kr=new s.Vector3,Dr=new s.Color;function Pr(){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,a=this.object.geometry.vertices;a.push(n[e+0],n[e+1],n[e+2]),a.push(n[t+0],n[t+1],n[t+2]),a.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,a=this.object.geometry.normals;a.push(n[e+0],n[e+1],n[e+2]),a.push(n[t+0],n[t+1],n[t+2]),a.push(n[r+0],n[r+1],n[r+2])},addFaceNormal:function(e,t,r){var n=this.vertices,a=this.object.geometry.normals;Mr.fromArray(n,e),Tr.fromArray(n,t),_r.fromArray(n,r),kr.subVectors(_r,Tr),Er.subVectors(Mr,Tr),kr.cross(Er),kr.normalize(),a.push(kr.x,kr.y,kr.z),a.push(kr.x,kr.y,kr.z),a.push(kr.x,kr.y,kr.z)},addColor:function(e,t,r){var n=this.colors,a=this.object.geometry.colors;void 0!==n[e]&&a.push(n[e+0],n[e+1],n[e+2]),void 0!==n[t]&&a.push(n[t+0],n[t+1],n[t+2]),void 0!==n[r]&&a.push(n[r+0],n[r+1],n[r+2])},addUV:function(e,t,r){var n=this.uvs,a=this.object.geometry.uvs;a.push(n[e+0],n[e+1]),a.push(n[t+0],n[t+1]),a.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,a,i,s,o,l){var c=this.vertices.length;e=this.parseVertexIndex(e,c),t=this.parseVertexIndex(t,c),r=this.parseVertexIndex(r,c),this.addVertex(e,t,r),this.addColor(e,t,r),void 0!==s&&""!==s?(c=this.normals.length,e=this.parseNormalIndex(s,c),t=this.parseNormalIndex(o,c),r=this.parseNormalIndex(l,c),this.addNormal(e,t,r)):this.addFaceNormal(e,t,r),void 0!==n&&""!==n?(s=this.uvs.length,e=this.parseUVIndex(n,s),t=this.parseUVIndex(a,s),r=this.parseUVIndex(i,s),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 a=this.parseVertexIndex(e[r],t);this.addVertexPoint(a),this.addColor(a)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";for(var r=this.vertices.length,n=this.uvs.length,a=0,i=e.length;a<i;a++)this.addVertexLine(this.parseVertexIndex(e[a],r));for(var s=0,o=t.length;s<o;s++)this.addUVLine(this.parseUVIndex(t[s],n))}};return e.startObject("",!1),e}var Ar=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&&gr(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=vr(e);if(r=t?(r=vr(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===mr(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)).materials=null,e;throw new TypeError("Cannot call a class as a function")}return t=n,(e=[{key:"load",value:function(e,t,r,n){var a=this,i=new s.FileLoader(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,(function(r){try{t(a.parse(r))}catch(r){n?n(r):console.error(r),a.manager.itemError(e)}}),r,n)}},{key:"setMaterials",value:function(e){return this.materials=e,this}},{key:"parse",value:function(e){for(var t=new Pr,r=(e=-1!==(e=-1!==e.indexOf("\r\n")?e.replace(/\r\n/g,"\n"):e).indexOf("\\\n")?e.replace(/\\\n/g,""):e).split("\n"),n=[],a=0,i=r.length;a<i;a++){var o=r[a].trimStart();if(0!==o.length){var l,c=o.charAt(0);if("#"!==c)if("v"===c){var u=o.split(Sr);switch(u[0]){case"v":t.vertices.push(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3])),7<=u.length?(Dr.setRGB(parseFloat(u[4]),parseFloat(u[5]),parseFloat(u[6])).convertSRGBToLinear(),t.colors.push(Dr.r,Dr.g,Dr.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3]));break;case"vt":t.uvs.push(parseFloat(u[1]),parseFloat(u[2]))}}else if("f"===c){for(var h=o.slice(1).trim().split(Sr),d=[],p=0,f=h.length;p<f;p++){var m=h[p];0<m.length&&(m=m.split("/"),d.push(m))}for(var g=d[0],v=1,b=d.length-1;v<b;v++){var y=d[v],x=d[v+1];t.addFace(g[0],y[0],x[0],g[1],y[1],x[1],g[2],y[2],x[2])}}else if("l"===c){var w=o.substring(1).trim().split(" "),S=[],M=[];if(-1===o.indexOf("/"))S=w;else for(var T=0,_=w.length;T<_;T++){var E=w[T].split("/");""!==E[0]&&S.push(E[0]),""!==E[1]&&M.push(E[1])}t.addLineGeometry(S,M)}else"p"===c?(l=o.slice(1).trim().split(" "),t.addPointGeometry(l)):null!==(n=br.exec(o))?(l=(" "+n[0].slice(1).trim()).slice(1),t.startObject(l)):xr.test(o)?t.object.startMaterial(o.substring(7).trim(),t.materialLibraries):yr.test(o)?t.materialLibraries.push(o.substring(7).trim()):wr.test(o)?console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.'):"s"===c?(1<(n=o.split(" ")).length?(c=n[1].trim().toLowerCase(),t.object.smooth="0"!==c&&"off"!==c):t.object.smooth=!0,(c=t.object.currentMaterial())&&(c.smooth=t.object.smooth)):"\0"!==o&&console.warn('THREE.OBJLoader: Unexpected line: "'+o+'"')}}t.finalize();var k,D=new s.Group;if(1==(D.materialLibraries=[].concat(t.materialLibraries),e=!(1===t.objects.length&&0===t.objects[0].geometry.vertices.length)))for(var P=0,A=t.objects.length;P<A;P++){var O=t.objects[P],C=O.geometry,R=O.materials,L="Line"===C.type,I="Points"===C.type,B=!1;if(0!==C.vertices.length){for(var U=new s.BufferGeometry,j=(U.setAttribute("position",new s.Float32BufferAttribute(C.vertices,3)),0<C.normals.length&&U.setAttribute("normal",new s.Float32BufferAttribute(C.normals,3)),0<C.colors.length&&(B=!0,U.setAttribute("color",new s.Float32BufferAttribute(C.colors,3))),!0===C.hasUVIndices&&U.setAttribute("uv",new s.Float32BufferAttribute(C.uvs,2)),[]),F=0,N=R.length;F<N;F++){var z,V=R[F],G=V.name+"_"+V.smooth+"_"+B,H=t.materials[G];null!==this.materials&&(H=this.materials.create(V.name),!L||!H||H instanceof s.LineBasicMaterial?!I||!H||H instanceof s.PointsMaterial||(z=new s.PointsMaterial({size:10,sizeAttenuation:!1}),s.Material.prototype.copy.call(z,H),z.color.copy(H.color),z.map=H.map,H=z):(z=new s.LineBasicMaterial,s.Material.prototype.copy.call(z,H),z.color.copy(H.color),H=z)),void 0===H&&((H=L?new s.LineBasicMaterial:I?new s.PointsMaterial({size:1,sizeAttenuation:!1}):new s.MeshPhongMaterial).name=V.name,H.flatShading=!V.smooth,H.vertexColors=B,t.materials[G]=H),j.push(H)}if(C=void 0,1<j.length){for(var W=0,q=R.length;W<q;W++){var K=R[W];U.addGroup(K.groupStart,K.groupCount,W)}C=new(L?s.LineSegments:I?s.Points:s.Mesh)(U,j)}else C=new(L?s.LineSegments:I?s.Points:s.Mesh)(U,j[0]);C.name=O.name,D.add(C)}}else 0<t.vertices.length&&(e=new s.PointsMaterial({size:1,sizeAttenuation:!1}),(k=new s.BufferGeometry).setAttribute("position",new s.Float32BufferAttribute(t.vertices,3)),0<t.colors.length&&void 0!==t.colors[0]&&(k.setAttribute("color",new s.Float32BufferAttribute(t.colors,3)),e.vertexColors=!0),k=new s.Points(k,e),D.add(k));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}),n}(s.Loader),Or=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const Cr=t.FBXLoader;class Rr{constructor(e){this.parses={fbx:new Cr,obj:new Ar,object:new s.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 Or(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 Or(this,void 0,void 0,(function*(){var t=yield(0,i.parseFile)(e,"arrayBuffer");let r="model";return t=yield this.runScene.loaderer.gltf.parse(t,{triggerCb:!0,callBack:{beforeParse:e=>{"scene"===(e=(e.asset.ex||{}).type)&&this.runScene.clean()},getJSON(e){r=(null==(e=e.asset.ex)?void 0:e.type)||"model"}}}),{type:r,result:t}}))}fbx(e){return Or(this,void 0,void 0,(function*(){var t=e instanceof ArrayBuffer?e:yield(0,i.parseFile)(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 Or(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,i.parseFile)(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 Or(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,i.parseFile)(e,"text"):e,r=JSON.parse(t);return"timeLine"===r.type?{type:"timeLine",result:r.data}:{type:"model",result:this.runScene.loaderer.json.parse(t)}}))}}class Lr extends o{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.params.glow.isBloom=e}setRender2(e){this.runScene.assetsEx.setRender2(e)}setRender3(e){this.runScene.assetsEx.setRender3(e)}}class Ir extends r(8624).Ys{constructor(e,t){super(e,t),this.transGizmo=this.children[0],this.scaleCoefficient=new s.Vector3,this.beginScale=new s.Vector3,this.posStart=new s.Vector2,this.posEnd=new s.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 Br extends s.Object3D{constructor(e){super(),this.isViewHelper=!0,this.animating=!1,this.controls=null,this.dummy=new s.Object3D,this.turnRate=2*Math.PI,this.targetPosition=new s.Vector3,this.targetQuaternion=new s.Quaternion,this.q1=new s.Quaternion,this.q2=new s.Quaternion,this.radius=0,this.clock=new s.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 s.Euler(0,.5*Math.PI,0));break;case"posY":this.targetPosition.set(0,1,0),this.targetQuaternion.setFromEuler(new s.Euler(.5*-Math.PI,0,0));break;case"posZ":this.targetPosition.set(0,0,1),this.targetQuaternion.setFromEuler(new s.Euler);break;case"negX":this.targetPosition.set(-1,0,0),this.targetQuaternion.setFromEuler(new s.Euler(0,.5*-Math.PI,0));break;case"negY":this.targetPosition.set(0,-1,0),this.targetQuaternion.setFromEuler(new s.Euler(.5*Math.PI,0,0));break;case"negZ":this.targetPosition.set(0,0,-1),this.targetQuaternion.setFromEuler(new s.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 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 Ur{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 s.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 c.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,scene:t,engineDom:r}=this.runScene.assetsEx.get();this.tansControls=new Ir(e,r),this.tansControls.addEventListener("dragging-changed",this.draggingChanged),this.tansControls.addEventListener("change",this.transChangeFn.bind(this)),this.tansControls.name="helper",t.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 Br(e),this.grid=this.createGrid(),this.init())}init(){this.transContro.init(),this.runScene.assetsEx.get().scene.add(this.grid)}createGrid(){const e=new c.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)),(0,$e.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)}}var jr=r(2510),Fr=r(4380),Nr=r(8089);class zr{constructor(e){this.selectors={},this.boxHelperMap={},this.savedV3=new M.Z,this.tempOldval=new ua.Vector3,this.runScene=e}add(e,t=!1){if("array"===(0,i.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,a,i){"position"!==t&&(a=n,i=r);const s=this.getSelectedList("value");var{x:a,y:o,z:l}=a;const c=a-i.x,u=o-i.y,h=l-i.z,d=[new Fr.Z({target:e,info:t,oldV3:this.runScene.modelEx.cloneV3(r),newV3:n,runScene:this.runScene}).execute()];s.map((r=>{if(r!==e){var{x:n,y:a,z:i}=r[t],n=n+=c,a=a+=u,i=i+=h;let e=r[t].clone();e.x=n,e.y=a,e.z=i,n=new Fr.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,Nr.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,Nr.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,A.Ki)(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 Fr.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:a}=e,i=this.getSelectedList("value");var{x:e,y:s,z:o}=n;const l=e-a.x,c=s-a.y,u=o-a.z;t[r].copy(n),i.map((e=>{if(e!==t){var{x:n,y:a,z:i}=e[r],n=n+=l,a=a+=c,i=i+=u;let t=e[r].clone();t.x=n,t.y=a,t.z=i,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 s.Group;const t=new s.Group;this.runScene.modelEx.add(e,void 0,{addUndo:!1}),this.runScene.modelEx.add(t);var r=[...this.getSelectedList("value")],n=(this.runScene.cb.model.multipDrop.cb({models:this.getSelectedList("value"),dropModel:e}),(0,Nr.qg)(e));t.position.copy(n),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 s.Group;return e.forEach((e=>t.add(e.clone()))),this.setEmpty(),t}rename(e){const{prefix:t,rmPrefixLength:r,back:n,rmBackLength:a,fullName:i,step:s}=e,o=this.getSelectedList("value");0!==o.length&&(e=o.map(((e,o)=>{let l=e.name;if(0===i.length){if(0!==r){if(r>l.length)return;l=l.substring(r)}if(0!==a){if(a>l.length)return;l=l.substring(0,l.length-a)}0<t.length&&(l=t+l),0<n.length&&(l+=n)}else l=i+(o+1)*s;return new jr.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 a=("all"===e?n:t).position.clone();return"all"!==e&&(a[e]=n.position[e]),new Fr.Z({target:t,info:"position",oldV3:r,newV3:a,runScene:this.runScene}).execute()}));this.runScene.multipSelector.add(t,!0),this.runScene.undoEx.addUndo(r)}}}function Vr(e){return(Vr="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 Gr(e,t){return(Gr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Hr(e){return(Hr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Wr=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&&Gr(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=Hr(e);if(r=t?(r=Hr(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Vr(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(){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");var e=n.SkyShader;return e=new s.ShaderMaterial({name:"SkyShader",fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:s.UniformsUtils.clone(e.uniforms),side:s.BackSide,depthWrite:!1}),(e=r.call(this,new s.BoxGeometry(1,1,1),e)).isSky=!0,e}return t=n,Object.defineProperty(t,"prototype",{writable:!1}),t}(s.Mesh),qr=(Wr.SkyShader={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new s.Vector3},up:{value:new s.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}"},r(7585)),Kr=r(6651);const Zr={color:"#000000",intensity:1};class Xr{diff(e,t){const r={};return(0,i.mapObj)(Zr,(n=>{var a=e[n];(0,nt.Xq)(a,t[n])&&(r[n]=a)})),r}setConfig(e,t){var{color:t,intensity:r,shadow:n}=t,{mapSize:n,camera:a}=n||{},{far:a,near:i,scale:s}=a||{};void 0!==s&&(e.shadow.camera.scale.x=s,e.shadow.camera.scale.y=s,e.shadow.camera.scale.z=s),void 0!==i&&(e.shadow.camera.near=i),void 0!==a&&(e.shadow.camera.far=a),void 0!==n&&(e.shadow.mapSize.x=n,e.shadow.mapSize.y=n),void 0!==r&&(e.intensity=r),void 0!==t&&(e.color=(0,Nr.e9)(t)),e.shadow.camera.updateProjectionMatrix(),null!=(s=e.cameraHelper)&&s.update()}}class Qr extends o{constructor(){super(...arguments),this.allState=["morning","noon","evening","night"],this.sun=new ua.Vector3,this.light=new Xr,this.sky=new Wr,this.baseLightConfig={name:"天空定向光",type:"DirectionalLight",castShadow:!0},this.skyData=this.getData(),this.lastTime={index:0,name:"morning"},this.skyChangeArr=[],this.lightChangeArr=[],this.uniforms=null,this.inied=!1,this.currentLightConfig={},this.backUpSkyData=this.getData(),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.addScene(),this.initSnapshot()}initSnapshot(){this.runScene.cb.snapshot.create.add("sky",(e=>{e.data.set("sky",{state:this.skyData.currentState})})),this.runScene.cb.snapshot.set.add("sky",(e=>{(e=e.snapshot.data.get("sky"))&&e.state!==this.skyData.currentState&&this.setState(e.state)}))}initLight(){if(!this.directionalLight){var e=new qr.Z(this.runScene).get();const[t]=e;this.runScene.lightEx.add(e,{addToTree:!1}),(this.directionalLight=t).name="skyLight"}}addScene(){this.initLight(),et.materialIgnore.set(this.sky.material,!0),(0,h.setHelper)(this.sky),h.selectableModel.close(this.sky),h.selectableModel.close(this.directionalLight),(0,h.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&&(this.directionalLight.visible=e,t.toneMapping=e?4:0,this.skyData.isShow=e,this.sky.visible=e)}toJSON(){var{currentState:e,effectController:t,isShow:r,lightConfig:n,size:a}=this.skyData;return{currentState:e,effectController:t,isShow:r,lightConfig:n,size:a}}parseJSON(e){var t,r,n;e&&(({isShow:t,currentState:r,size:n}=e),this.skyData.isShow=t,this.initLight(),this.parseLightConfig(e),this.inied||(this.init(),this.inied=!0),this.parseSkyConfig(r,n),this.setOpen(t))}parseLightConfig(e){var t,{isShow:r,effectController:n,currentState:a,lightConfig:i,size:s}=e;e&&i&&(e=i.shadow,t=n[a].lightConfig,qr.Z.setConfig(this.directionalLight,Object.assign(Object.assign({shadow:e},t),this.baseLightConfig)),this.directionalLight.visible=r,this.skyData.lightConfig=i,this.skyData.isShow=r,this.skyData.effectController=n,this.skyData.currentState=a,this.skyData.size=s,this.sky.visible=r,this.setLightSpecialConfig(a),this.lightAnima(a))}parseSkyConfig(e,t){this.setSkyConfig(e),this.setSkyScale(t)}setState(e){var t=this.skyData.currentState;this.doAnimaByState(e,t),this.runScene.cb.objects.sky.setState.cb({state:e}),this.saveLastTimeState({oldState:t,state:e,index:this.allState.findIndex((t=>t===e))})}saveLastTimeState(e){var{oldState:e,state:t,index:r}=e;this.lastTime.name=e,this.lastTime.index=r,this.skyData.currentState=t}getLightDataByState(e){let t=new ua.Vector3,r=new ua.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":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}}getIdxByState(e){return this.allState.findIndex((t=>t===e))}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 a=ua.MathUtils.degToRad(90-this.skyData.effectController[e].elevation);e=ua.MathUtils.degToRad(this.skyData.effectController[e].azimuth),this.sun.setFromSphericalCoords(1,a,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:r}=e;this.skyData.effectController[e][t]=r,this.setSkyConfig(e)}setCurrentState(e){this.skyData.currentState=e}setStateTime(e){var{info:e,time:t}=e;this.skyData.effectController[e].time=t}clean(){this.setOpen(!1),this.skyData=this.getData(),this.directionalLight&&this.runScene.modelEx.remove(this.directionalLight)}setLight(e,t){switch(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!=(r=this.directionalLight.cameraHelper)&&r.update();break;case"color":this.skyData.effectController[this.skyData.currentState].lightConfig.color=t;var r=new ua.Color(t);this.directionalLight.color=r;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,Nr.e9)(e),this.directionalLight.intensity=t}getAnimasDataByState(e,t){e=this.getIdxByState(e);const r=[];if((t=this.getIdxByState(t))<e){this.animaIndex={begin:e,end:t};var n=e-t;let l=t;for(let e=0;e<n;e++){var{color:a,intensity:i}=this.skyData.effectController[this.allState[l]].lightConfig,{position:s,targetPosition:o}=this.getLightDataByState(this.allState[l]),{color:a,intensity:i}=(r.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[l]],color:a,intensity:i,position:s,targetPosition:o})}),l++,this.skyData.effectController[this.allState[l]].lightConfig),{position:s,targetPosition:o}=this.getLightDataByState(this.allState[l]);r.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[l]],color:a,intensity:i,position:s,targetPosition:o}),onDone:this.getNromalFn})}}else{var l=3-t;this.animaIndex={begin:t,end:e};let n=t;if(0==l)return r.push({onDone:this.getSpecialFn}),r;for(let e=0;e<l;e++){var{color:c,intensity:u}=this.skyData.effectController[this.allState[n]].lightConfig,{position:h,targetPosition:d}=this.getLightDataByState(this.allState[n]),{position:h,targetPosition:d}=(r.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[n]],color:c,intensity:u,position:h,targetPosition:d})}),n++,this.getLightDataByState(this.allState[n]));r.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[n]],color:c,intensity:u,position:h,targetPosition:d}),onDone:3===n?this.getSpecialFn:this.getNromalFn})}}return r}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 r=this.runScene.assetsEx.get().renderer;this.animaInstance=u.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:n,g:a,b:i}=e,s=(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,r.toneMappingExposure=e.exposure,ua.MathUtils.degToRad(90-e.elevation)),o=ua.MathUtils.degToRad(t.data.azimuth);this.sun.setFromSphericalCoords(1,s,o),this.sky.material.uniforms.sunPosition.value.copy(this.sun),s=new ua.Color(n,a,i),this.directionalLight.color=s,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:r,targetPosition:n,intensity:a}=e,{x:r,y:i,z:s}=r,{x:n,y:o,z:l}=n,{r:t,g:c,b:u}=(0,nt.fh)((0,nt.I8)(t));return Object.assign(Object.assign({},e),{r:t,g:c,b:u,x:r,y:i,z:s,tx:n,ty:o,tz:l,intensity:a})}getData(){return{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,Kr.d9)(Zr)),{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,Kr.d9)(Zr)),{color:"#FFFFFF"})},evening:{turbidity:2,rayleigh:.3,mieCoefficient:.011,mieDirectionalG:.67,elevation:3,azimuth:0,exposure:.3762,lightConfig:Object.assign(Object.assign({},(0,Kr.d9)(Zr)),{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,Kr.d9)(Zr)),{color:"#B8A277"}),time:1}},currentState:"morning"}}}class Yr{constructor(e){this.clean=()=>{this.sky.clean()},this.sky=new Qr(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 Jr(){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 a,i=(performance||Date).now(),s=i,o=0,l=r(new Jr.Panel("FPS","#0ff","#002")),c=r(new Jr.Panel("MS","#0f0","#020"));return self.performance&&self.performance.memory&&(a=r(new Jr.Panel("MB","#f08","#201"))),n(0),{REVISION:16,dom:t,addPanel:r,showPanel:n,begin:function(){i=(performance||Date).now()},end:function(){o++;var e,t=(performance||Date).now();return c.update(t-i,200),s+1e3<=t&&(l.update(1e3*o/(t-s),100),s=t,o=0,a&&(e=performance.memory,a.update(e.usedJSHeapSize/1048576,e.jsHeapSizeLimit/1048576))),t},update:function(){i=this.end()},domElement:t,setMode:n}}Jr.Panel=function(e,t,r){var n=1/0,a=0,i=Math.round,s=i(window.devicePixelRatio||1),o=80*s,l=48*s,c=3*s,u=2*s,h=3*s,d=15*s,p=74*s,f=30*s,m=document.createElement("canvas"),g=(m.width=o,m.height=l,m.style.cssText="width:80px;height:48px",m.getContext("2d"));return g.font="bold "+9*s+"px Helvetica,Arial,sans-serif",g.textBaseline="top",g.fillStyle=r,g.fillRect(0,0,o,l),g.fillStyle=t,g.fillText(e,c,u),g.fillRect(h,d,p,f),g.fillStyle=r,g.globalAlpha=.9,g.fillRect(h,d,p,f),{dom:m,update:function(l,v){n=Math.min(n,l),a=Math.max(a,l),g.fillStyle=r,g.globalAlpha=1,g.fillRect(0,0,o,d),g.fillStyle=t,g.fillText(i(l)+" "+e+" ("+i(n)+"-"+i(a)+")",c,u),g.drawImage(m,h+s,d,p-s,f,h,d,p-s,f),g.fillRect(h+p-s,d,s,f),g.fillStyle=r,g.globalAlpha=.9,g.fillRect(h+p-s,d,s,i((1-l/v)*f))}}};const $r=Jr;class en{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:"dom"},texture:{load:!0,lazyLoad:{open:!1,intervalTime:16.6},quality:1}},this.exporterOptions={compressTexture:!1,notMaterial:!1,outTime:(0,u.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,this.options=(0,u.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=$r(),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 tn{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),this.runScene.pp.params.glow.isBloom=!0)}glowRemove(e){this.glowModelLength.delete(e.userData.id),this.glowModelLength.size<=0&&(this.runScene.cb.pp.glow.setStatus.cb(!1),this.runScene.pp.params.glow.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),this.runScene.pp.params.outline.isOutline=!0)}outlineRemove(e){this.outlineModelLength.delete(e.userData.id),this.outlineModelLength.size<=0&&(this.runScene.cb.pp.outline.setStatus.cb(!1),this.runScene.pp.params.outline.isOutline=!1)}}var rn=r(6608),nn=r(5180),an=r(4819),sn={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new s.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 on(e){return(on="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 ln(e,t){return(ln=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function cn(e){return(cn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var un=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&&ln(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=cn(e);if(r=t?(r=cn(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===on(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,t,a,i){var o;if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");(o=r.call(this)).strength=void 0!==t?t:1,o.radius=a,o.threshold=i,o.resolution=void 0!==e?new s.Vector2(e.x,e.y):new s.Vector2(256,256),o.clearColor=new s.Color(0,0,0),o.renderTargetsHorizontal=[],o.renderTargetsVertical=[],o.nMips=5;var l=Math.round(o.resolution.x/2),c=Math.round(o.resolution.y/2);o.renderTargetBright=new s.WebGLRenderTarget(l,c),o.renderTargetBright.texture.name="UnrealBloomPass.bright",o.renderTargetBright.texture.generateMipmaps=!1;for(var u=0;u<o.nMips;u++){var h;((h=new s.WebGLRenderTarget(l,c)).texture.name="UnrealBloomPass.h"+u,h.texture.generateMipmaps=!1,o.renderTargetsHorizontal.push(h),h=new s.WebGLRenderTarget(l,c)).texture.name="UnrealBloomPass.v"+u,h.texture.generateMipmaps=!1,o.renderTargetsVertical.push(h),l=Math.round(l/2),c=Math.round(c/2)}a=sn;for(var d=(o.highPassUniforms=s.UniformsUtils.clone(a.uniforms),o.highPassUniforms.luminosityThreshold.value=i,o.highPassUniforms.smoothWidth.value=.01,o.materialHighPassFilter=new s.ShaderMaterial({uniforms:o.highPassUniforms,vertexShader:a.vertexShader,fragmentShader:a.fragmentShader,defines:{}}),o.separableBlurMaterials=[],[3,5,7,9,11]),p=(l=Math.round(o.resolution.x/2),c=Math.round(o.resolution.y/2),0);p<o.nMips;p++)o.separableBlurMaterials.push(o.getSeperableBlurMaterial(d[p])),o.separableBlurMaterials[p].uniforms.texSize.value=new s.Vector2(l,c),l=Math.round(l/2),c=Math.round(c/2);return o.compositeMaterial=o.getCompositeMaterial(o.nMips),o.compositeMaterial.uniforms.blurTexture1.value=o.renderTargetsVertical[0].texture,o.compositeMaterial.uniforms.blurTexture2.value=o.renderTargetsVertical[1].texture,o.compositeMaterial.uniforms.blurTexture3.value=o.renderTargetsVertical[2].texture,o.compositeMaterial.uniforms.blurTexture4.value=o.renderTargetsVertical[3].texture,o.compositeMaterial.uniforms.blurTexture5.value=o.renderTargetsVertical[4].texture,o.compositeMaterial.uniforms.bloomStrength.value=t,o.compositeMaterial.uniforms.bloomRadius.value=.1,o.compositeMaterial.needsUpdate=!0,o.compositeMaterial.uniforms.bloomFactors.value=[1,.8,.6,.4,.2],o.bloomTintColors=[new s.Vector3(1,1,1),new s.Vector3(1,1,1),new s.Vector3(1,1,1),new s.Vector3(1,1,1),new s.Vector3(1,1,1)],o.compositeMaterial.uniforms.bloomTintColors.value=o.bloomTintColors,e=rn.C,o.copyUniforms=s.UniformsUtils.clone(e.uniforms),o.copyUniforms.opacity.value=1,o.materialCopy=new s.ShaderMaterial({uniforms:o.copyUniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,blending:s.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0}),o.enabled=!0,o.needsSwap=!1,o._oldClearColor=new s.Color,o.oldClearAlpha=1,o.basic=new s.MeshBasicMaterial,o.fsQuad=new an.T(null),o}return t=n,(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();for(var r=0;r<this.separableBlurMaterials.length;r++)this.separableBlurMaterials[r].dispose();this.compositeMaterial.dispose(),this.materialCopy.dispose(),this.basic.dispose(),this.fsQuad.dispose()}},{key:"setSize",value:function(e,t){var r=Math.round(e/2),n=Math.round(t/2);this.renderTargetBright.setSize(r,n);for(var a=0;a<this.nMips;a++)this.renderTargetsHorizontal[a].setSize(r,n),this.renderTargetsVertical[a].setSize(r,n),this.separableBlurMaterials[a].uniforms.texSize.value=new s.Vector2(r,n),r=Math.round(r/2),n=Math.round(n/2)}},{key:"render",value:function(e,t,r,a,i){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();for(var s=e.autoClear,o=(e.autoClear=!1,e.setClearColor(this.clearColor,0),i&&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=o.texture,this.separableBlurMaterials[l].uniforms.direction.value=n.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=n.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[l]),e.clear(),this.fsQuad.render(e),o=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,i&&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=s}},{key:"getSeperableBlurMaterial",value:function(e){return new s.ShaderMaterial({defines:{KERNEL_RADIUS:e,SIGMA:e},uniforms:{colorTexture:{value:null},texSize:{value:new s.Vector2(.5,.5)},direction:{value:new s.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 s.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}),n}(an.w);un.BlurDirectionX=new s.Vector2(1,0),un.BlurDirectionY=new s.Vector2(0,1);class hn extends an.w{constructor(e,t,r){super(),this.baseTextureID=void 0!==t?t:"tDiffuse",this.effectTextureID=void 0!==r?r:"tDiffuse",e instanceof s.ShaderMaterial?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=s.UniformsUtils.clone(e.uniforms),this.material=new s.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new an.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 dn extends an.w{constructor(e,t,r,n,a){super(),this.scene=e,this.camera=t,this.layerIndex=0,this.overrideMaterial=r,this.clearColor=n,this.clearAlpha=void 0!==a?a:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.oldClearColor=new s.Color,this.oldCameraLayer=t.layers.mask}render(e,t,r){var n=e.autoClear;let a,i;e.autoClear=!1,void 0!==this.overrideMaterial&&(i=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this.oldClearColor),a=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,a),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=i),this.scene.background=this.sceneBg,e.autoClear=n}}const pn={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 fn{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 dn(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 un(this.mtuPP.rtSize,1.5,.4,.85),this.bloomPass.radius=this.mtuPP.params.glow.radius,this.bloomPass.strength=this.mtuPP.params.glow.strength,this.bloomPass.threshold=this.mtuPP.params.glow.threshold,this.mixingPass||(this.mixingPass=new hn(pn,"baseTexture","bloomTexture"),this.mixingPass.renderToScreen=!1),this.effectCopy||(this.effectCopy=new nn.T(rn.C),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 mn(e){return(mn="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 gn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vn(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 bn(e,t,r){t&&vn(e.prototype,t),r&&vn(e,r),Object.defineProperty(e,"prototype",{writable:!1})}function yn(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&&xn(e,t)}function xn(e,t){return(xn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function wn(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=Sn(e);if(r=t?(r=Sn(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===mn(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 Sn(e){return(Sn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Mn=function(){yn(t,an.w);var e=wn(t);function t(r,n){var a;return gn(this,t),(a=e.call(this)).scene=r,a.camera=n,a.clear=!0,a.needsSwap=!1,a.inverse=!1,a}return bn(t,[{key:"render",value:function(e,t,r){var n,a,i=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0),a=this.inverse?(n=0,1):(n=1,0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(i.REPLACE,i.REPLACE,i.REPLACE),s.buffers.stencil.setFunc(i.ALWAYS,n,4294967295),s.buffers.stencil.setClear(a),s.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),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(i.EQUAL,1,4294967295),s.buffers.stencil.setOp(i.KEEP,i.KEEP,i.KEEP),s.buffers.stencil.setLocked(!0)}}]),t}(),Tn=function(){yn(t,an.w);var e=wn(t);function t(){var r;return gn(this,t),(r=e.call(this)).needsSwap=!1,r}return bn(t,[{key:"render",value:function(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}]),t}();var _n=function(){function e(t,r){var n;if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.renderer=t,void 0===r?(n=t.getSize(new s.Vector2),this._pixelRatio=t.getPixelRatio(),this._width=n.width,this._height=n.height,(r=new s.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=[],this.copyPass=new nn.T(rn.C),this.clock=new s.Clock}var t,r;return t=e,(r=[{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,a=this.passes.length;n<a;n++){var i,s,o=this.passes[n];!1!==o.enabled&&(o.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(n),o.render(this.renderer,this.writeBuffer,this.readBuffer,e,r),o.needsSwap&&(r&&(i=this.renderer.getContext(),(s=this.renderer.state.buffers.stencil).setFunc(i.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),s.setFunc(i.EQUAL,1,4294967295)),this.swapBuffers()),void 0!==Mn&&(o instanceof Mn?r=!0:o instanceof Tn&&(r=!1)))}this.renderer.setRenderTarget(t)}},{key:"reset",value:function(e){var t;void 0===e&&(t=this.renderer.getSize(new s.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 a=0;a<this.passes.length;a++)this.passes[a].setSize(r,n)}},{key:"setPixelRatio",value:function(e){this._pixelRatio=e,this.setSize(this._width,this._height)}},{key:"dispose",value:function(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.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,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();const En="\n varying vec2 vUv;\n \n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",kn="\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 Dn{constructor(e){this.mtuPP=e,this.bloomLayer=new ua.Layers,this.bloomLayer.set(this.mtuPP.BLOOM_SCENE),this.darkMaterial=new ua.MeshBasicMaterial({color:"black"}),this.materials={},(e=this.mtuPP.mainScene).fog&&(this.mtuPP.sceneFogColor||(this.mtuPP.sceneFogColor=new ua.Color),this.mtuPP.sceneFogColor.copy(e.fog.color)),e.background&&(this.mtuPP.sceneBackground=e.background),this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.bloomPass=new un(this.mtuPP.rtSize,1.5,.4,.85),this.bloomPass.radius=this.mtuPP.params.glow.radius,this.bloomPass.strength=this.mtuPP.params.glow.strength,this.bloomPass.threshold=this.mtuPP.params.glow.threshold,this.mtuPP.effectComposer.addPass(this.bloomPass),this.finalPass=new nn.T(new ua.ShaderMaterial({uniforms:{baseTexture:{value:null},bloomTexture:{value:this.mtuPP.effectComposer.renderTarget2.texture}},vertexShader:En,fragmentShader:kn,defines:{}}),"baseTexture"),this.finalPass.needsSwap=!0;var e=new ua.WebGLRenderTarget(this.mtuPP.rtSize.x,this.mtuPP.rtSize.y,{samples:this.mtuPP.params.pp.samples});this.finalComposer=new _n(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)}}var Pn=r(228);class An extends s.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 On extends An{constructor(...e){super(...e),this.modifiedDefines={},this.modifiedUniforms={}}setDefine(e,t){const r=this.defines,n=this.modifiedDefines;null==t?e in r&&(e in n||(n[e]=r[e]),delete r[e]):r[e]!==t&&(e in n||(n[e]=e in r?r[e]:void 0),r[e]=t)}setTextureUniform(e,t){const r=this.uniforms,n=this.modifiedUniforms;e in n||(n[e]=r[e].value),r[e].value=t}finalize(){const e=this.modifiedDefines;var t=this.defines;for(const r in e)void 0===e[r]?r in t&&(this.needsUpdate=!0):t[r]!==e[r]&&(this.needsUpdate=!0),delete e[r];const r=this.modifiedUniforms;var n=this.uniforms;for(const e in r)r[e]!==n[e].value&&(this.needsUpdate=!0),delete r[e]}}const Cn=new WeakMap;class Rn{constructor(e){this._replacementMaterial=new On(e),this._replacementMaterials=new WeakMap,this.overrideUniforms={},this.overrideDefines={}}replace(e,t=!1,r=!0){const n=this;function a(e){if(!e.isHelper&&(e.isMesh||e.isSkinnedMesh)){if(!i.has(e)){const t=n.createMaterial(e);i.set(e,t)}const t=i.get(e);if(null!==t){let a=e.material;r?s.set(e,a):a=s.get(e),a||console.error("ShaderReplacement : Material for object was not cached before replacing shader.",e),n.updateUniforms(e,a,t),t.finalize&&t.finalize(),e.material=t}}}const i=this._replacementMaterials,s=Cn;if(Array.isArray(e))if(t)for(let t=0,r=e.length;t<r;t++)e[t].traverse(a);else for(let t=0,r=e.length;t<r;t++)a(e[t]);else t?e.traverse(a):a(e)}reset(e,t){function r(e){e.isHelper||(n.has(e)?(e.material=n.get(e),n.delete(e)):(e.isSkinnedMesh||e.isMesh)&&console.error("ShaderReplacement : Material for object was not cached before resetting.",e))}const n=Cn;if(Array.isArray(e))if(t)for(let t=0,n=e.length;t<n;t++)r(e[t]);else for(let t=0,n=e.length;t<n;t++)e[t].traverse(r);else t?e.traverse(r):r(e)}createMaterial(e){return this._replacementMaterial.clone()}updateUniforms(e,t,r){var n=this._replacementMaterial.defines,a=t.defines;const i=r.defines;if(r.side=t.side,r.flatShading=t.flatShading,r.skinning=t.skinning,a){for(const e in a)r.setDefine(e,a[e]);for(const e in i)e in a?r.setDefine(e,a[e]):r.setDefine(e,n[e])}const s=r.uniforms;if(t.isShaderMaterial){var o=t.uniforms;for(const e in s){var l=o[e];const t=s[e];l&&l.value!==t.value&&(t.value&&t.value.isTexture||l.value&&l.value.isTexture?r.setTextureUniform(e,l.value):t.value=l.value)}}else for(const e in s){const n=s[e];e in t&&t[e]!==n.value&&(n.value&&n.value.isTexture||t[e]&&t[e].isTexture?r.setTextureUniform(e,t[e]):n.value=t[e])}var{overrideDefines:c,overrideUniforms:u}=this;for(const e in c)null===c[e]||void 0===c[e]?delete i[e]:i[e]!==c[e]&&(i[e]=c[e],r.needsUpdate=!0);for(const e in u)e in s&&(s[e].value=u[e].value)}dispose(){}}class Ln extends Rn{constructor(){super({extensions:{derivatives:!0},defines:{USE_UV:""},uniforms:Object.assign(Object.assign({},s.ShaderLib.normal.uniforms),{alphaMap:{value:null},alphaTest:{value:0},map:{value:null},opacity:{value:1}}),vertexShader:s.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,r){super.updateUniforms(e,t,r),r.setDefine("USE_NORMALMAP",this.useNormalMaps&&r.uniforms.normalMap.value?"":void 0),r.setDefine("TANGENTSPACE_NORMALMAP",this.useNormalMaps&&r.uniforms.normalMap.value?"":void 0),r.setDefine("ALPHATEST",r.uniforms.alphaTest.value||void 0),r.setDefine("USE_ALPHAMAP",0!==r.defines.ALPHATEST&&r.uniforms.alphaMap.value?"":void 0),r.setDefine("USE_MAP",0!==r.defines.ALPHATEST&&r.uniforms.map.value?"":void 0),r.setDefine("USE_UV","USE_ALPHAMAP"in r.defines||"USE_MAP"in r.defines?"":void 0)}}class In extends Rn{constructor(){super({extensions:{derivatives:!0},defines:{USE_UV:""},uniforms:Object.assign(Object.assign({},s.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===s.FrontSide?s.BackSide:s.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 Bn={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"},Un={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"},jn={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 s.Vector2},blueNoiseTex:{value:null},blueNoiseSize:{value:1},clipInfo:{value:new s.Vector4},projInfo:{value:new s.Vector4},params:{value:new s.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"},Fn={defines:{BLUR_ITERATIONS:5,BLUR_MODE:0,AO_ONLY:0,COLOR_ONLY:0,DEPTH_THRESHOLD:"5e-1"},uniforms:{fullSize:{value:new s.Vector2},aoSize:{value:new s.Vector2},normalBuffer:{value:null},depthBuffer:{value:null},colorBuffer:{value:null},gtaoBuffer:{value:null},intensity:{value:1},blurStride:{value:1},ambientColor:{value:new s.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 Nn{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:r}=this;let n=1/0,a=-1;for(let i=0,s=r.length;i<s;i++)0===r[i]&&(e=t[i])<n&&(n=e,a=i);return a}findCluster(){var e,{score:t,binaryPattern:r}=this;let n=-1/0,a=-1;for(let i=0,s=r.length;i<s;i++)1===r[i]&&(e=t[i])>n&&(n=e,a=i);return a}setSigma(e){if(e!==this.sigma){var t=~~(Math.sqrt(20*Math.pow(e,2))+1),r=2*t+1;const s=new Float32Array(r*r);var n=e*e;for(let e=-t;e<=t;e++)for(let o=-t;o<=t;o++){var a=(t+o)*r+e+t,i=e*e+o*o;s[a]=Math.pow(Math.E,-i/(2*n))}this.lookupTable=s,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:r}=this;t.fill(0);for(let t=0,i=e.length;t<i;t++){var n,a;0===e[t]?(n=~~(t/r),a=t-n*r,this.updateScore(a,n,1),e[t]=1):e[t]=0}}updateScore(e,t,r){const{size:n,score:a,lookupTable:i}=this;var s=this.radius,o=2*s+1;for(let u=-s;u<=s;u++)for(let h=-s;h<=s;h++){var l=i[(s+h)*o+u+s];let d=e+u,p=(d=d<0?n+d:d%n,t+h);var c=(p=p<0?n+p:p%n)*n+d;a[c]+=r*l}}addPointIndex(e){this.binaryPattern[e]=1;var t=this.size,r=~~(e/t);this.updateScore(e-r*t,r,1),this.count++}removePointIndex(e){this.binaryPattern[e]=0;var t=this.size,r=~~(e/t);this.updateScore(e-r*t,r,-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 zn{constructor(){this.random=Math.random,this.sigma=1.5,this.size=64,this.majorityPointsRatio=.1,this.samples=new Nn(1),this.savedSamples=new Nn(1)}generate(){const{samples:e,savedSamples:t,sigma:r,majorityPointsRatio:n,size:a}=this;e.resize(a),e.setSigma(r);var i=Math.floor(a*a*n),s=e.binaryPattern,o=s,l=i;o.fill(0);for(let e=0;e<l;e++)o[e]=1;var[c,u=Math.random]=[s,this.random];for(let e=c.length-1;0<e;e--){var h=~~((u()-1e-6)*e),d=c[e];c[e]=c[h],c[h]=d}for(let t=0,r=s.length;t<r;t++)1===s[t]&&e.addPointIndex(t);for(;;){var p=e.findCluster(),f=(e.removePointIndex(p),e.findVoid());if(p===f){e.addPointIndex(p);break}e.addPointIndex(f)}const m=new Uint32Array(a*a);let g;for(t.copy(e),g=e.count-1;0<=g;){var v=e.findCluster();e.removePointIndex(v),m[v]=g,g--}var b=a*a;for(g=t.count;g<b/2;){var y=t.findVoid();t.addPointIndex(y),m[y]=g,g++}for(t.invert();g<b;){var x=t.findCluster();t.removePointIndex(x),m[x]=g,g++}return{data:m,maxValue:b}}}class Vn extends an.w{constructor(e,t){super(),this.enabled=!0,this.needsSwap=!0,this.scene=e,this.camera=t,this.debug={display:Vn.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=Vn.BOX_BLUR,this.blurIterations=4,this.blurStride=1,this.enableFalloff=!0,this.falloffStart=.4,this.falloffEnd=2,this.ambientColor=new s.Color,this.ambientIntensity=0,this.lightBounceIntensity=1,this._gtaoBuffer=new s.WebGLRenderTarget(1,1,{format:s.RGBAFormat}),this._depthBuffer=new s.WebGLRenderTarget(1,1,{minFilter:s.NearestFilter,magFilter:s.NearestFilter,format:s.RGBAFormat,type:s.HalfFloatType}),this._depthReplacement=new In,this._normalBuffer=new s.WebGLRenderTarget(1,1,{minFilter:s.NearestFilter,magFilter:s.NearestFilter,format:s.RGBAFormat}),this._normalReplacement=new Ln,this.gtaoQuad=new an.T(new s.ShaderMaterial(jn)),this.debugPackedQuad=new an.T(new s.ShaderMaterial(Bn)),this.debugDepthQuad=new an.T(new s.ShaderMaterial(Un)),this.compositeQuad=new an.T(new s.ShaderMaterial(Fn));const r=new zn,n=(r.size=32,new Uint8Array(4*Math.pow(32,2)));for(let e=0;e<4;e++){var a=r.generate(),i=a.data,o=a.maxValue;for(let t=0,r=i.length;t<r;t++)n[4*t+e]=i[t]/o*255}this.blueNoiseTex=new s.DataTexture(n,r.size,r.size,s.RGBAFormat),this.blueNoiseTex.wrapS=s.RepeatWrapping,this.blueNoiseTex.wrapT=s.RepeatWrapping,this.blueNoiseTex.minFilter=s.LinearFilter,this.blueNoiseTex.needsUpdate=!0}dispose(){}setSize(e,t){var r=this.renderTargetScale,n=Math.floor(e*r);r=Math.floor(t*r),this._depthBuffer.setSize(e,t),this._normalBuffer.setSize(e,t),this._gtaoBuffer.setSize(n,r)}render(e,t,r){t=this.renderToScreen?null:t;const{scene:n,camera:a,debug:i,debugPackedQuad:o,debugDepthQuad:l,compositeQuad:c,gtaoQuad:u}=this,h=u.material;Vn.RendererState.copy(e,n);var d=()=>{Vn.RendererState.restore(e,n),f.reset(n,!0)},p=this._depthBuffer;const f=this._depthReplacement;if(n.background=null,f.replace(n,!0,!0),e.setRenderTarget(p),e.setClearColor(Vn.BlackColor,0),e.clear(),e.render(n,a),i.display===Vn.DEPTH)return e.setRenderTarget(t),l.material.uniforms.texture.value=p.texture,l.render(e),void d();const m=this._normalReplacement;var g=this._normalBuffer;if(m.replace(n,!0,!1),e.setRenderTarget(g),e.clear(),e.render(n,a),i.display===Vn.NORMAL)return e.setRenderTarget(t),e.clear(),o.material.uniforms.displayRoughness.value=0,o.material.uniforms.texture.value=g.texture,o.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 v=this._gtaoBuffer,b=Math.floor(v.texture.image.width),y=Math.floor(v.texture.image.height),x=a.projectionMatrix,w=s.MathUtils.DEG2RAD*a.fov;h.uniforms.params.value.set(this.directionOffset,this.stepOffset),h.uniforms.projInfo.value.set(2/(b*x.elements[0]),2/(y*x.elements[5]),-1/x.elements[0],-1/x.elements[5]),h.uniforms.clipInfo.value.set(a.near,a.far,y/(2*Math.tan(.5*w))*.5,0),h.uniforms.normalBuffer.value=g.texture,h.uniforms.depthBuffer.value=p.texture,h.uniforms.colorBuffer.value=r.texture,h.uniforms.lightBounceIntensity.value=this.lightBounceIntensity,h.uniforms.renderSize.value.set(Math.floor(v.texture.image.width),Math.floor(v.texture.image.height)),h.uniforms.blueNoiseTex.value=this.blueNoiseTex,h.uniforms.blueNoiseSize.value=this.blueNoiseTex.image.width,e.setRenderTarget(v),e.clear(),u.render(e);const S=c.material;S.uniforms.depthBuffer.value=p.texture,S.uniforms.normalBuffer.value=g.texture,S.uniforms.colorBuffer.value=r.texture,S.uniforms.gtaoBuffer.value=v.texture,S.uniforms.intensity.value=this.intensity,S.uniforms.aoSize.value.set(v.width,v.height),S.uniforms.fullSize.value.set(r.width,r.height),S.uniforms.blurStride.value=this.blurStride,S.uniforms.ambientColor.value.copy(this.ambientColor),S.uniforms.ambientIntensity.value=this.ambientIntensity,this.blurIterations!==S.defines.BLUR_ITERATIONS&&(S.defines.BLUR_ITERATIONS=this.blurIterations,S.needsUpdate=!0),this.blurMode!==S.defines.BLUR_MODE&&(S.defines.BLUR_MODE=this.blurMode,S.needsUpdate=!0),i.display===Vn.AO_SAMPLE?1!==S.defines.AO_ONLY&&(S.defines.AO_ONLY=1,S.needsUpdate=!0):0!==S.defines.AO_ONLY&&(S.defines.AO_ONLY=0,S.needsUpdate=!0),i.display===Vn.COLOR_SAMPLE?1!==S.defines.COLOR_ONLY&&(S.defines.COLOR_ONLY=1,S.needsUpdate=!0):0!==S.defines.COLOR_ONLY&&(S.defines.COLOR_ONLY=0,S.needsUpdate=!0),e.setRenderTarget(t),e.clear(),c.render(e),d()}}Vn.NO_JITTER=0,Vn.RANDOM_JITTER=1,Vn.BLUENOISE_JITTER=2,Vn.DEFAULT=0,Vn.DEPTH=1,Vn.NORMAL=2,Vn.AO_SAMPLE=3,Vn.COLOR_SAMPLE=4,Vn.NO_BLUR=0,Vn.BOX_BLUR=1,Vn.CROSS_BLUR=2,Vn.DIAGONAL_BLUR=3,Vn.BlackColor=new s.Color(0),Vn.RendererState=new class{constructor(){this.clearAlpha=0,this.clearColor=new s.Color,this.renderTarget=null,this.outputEncoding=s.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 Gn{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.gtaoPass||(this.gtaoPass=new Vn(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 ua.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 Hn(e){return(Hn="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 Wn(e,t){return(Wn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function qn(e){return(qn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Kn=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&&Wn(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=qn(e);if(r=t?(r=qn(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===Hn(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,t,a,i,o){var l;if(this instanceof n)return(l=r.call(this)).scene=e,l.camera=t,l.overrideMaterial=a,l.clearColor=i,l.clearAlpha=void 0!==o?o:0,l.clear=!0,l.clearDepth=!1,l.needsSwap=!1,l._oldClearColor=new s.Color,l;throw new TypeError("Cannot call a class as a function")}return t=n,(e=[{key:"render",value:function(e,t,r){var n,a,i=e.autoClear;e.autoClear=!1,void 0!==this.overrideMaterial&&(a=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=a),e.autoClear=i}}])&&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}(an.w),Zn={uniforms:{tDiffuse:{value:null},resolution:{value:new s.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"},Xn={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}"};const Qn={radius:{type:"number",val:.6,shortKey:"r",onUpdate({type:e,data:t,runScene:r}){r.pp.setGlowData(e,t)}},strength:{type:"number",val:1.5,shortKey:"s",onUpdate({type:e,data:t,runScene:r}){r.pp.setGlowData(e,t)}},threshold:{type:"number",val:0,shortKey:"t",onUpdate({type:e,data:t,runScene:r}){r.pp.setGlowData(e,t)}}},Yn={edgeStrength:{type:"number",val:3,shortKey:"es",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},edgeGlow:{type:"number",val:0,shortKey:"eg",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},edgeThickness:{type:"number",val:1,shortKey:"et",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},pulsePeriod:{type:"number",val:0,shortKey:"pp",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},visibleEdgeColor:{type:"color_str",val:"#FFFFFF",shortKey:"vec",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}},hiddenEdgeColor:{type:"color_str",val:"#190A05",shortKey:"hec",onUpdate({type:e,data:t,runScene:r}){r.pp.setOutlineData(e,t)}}},Jn={directionOffset:{type:"number",val:0,shortKey:"do",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},stepOffset:{type:"number",val:0,shortKey:"so",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},rotationJitter:{type:"other",val:"NONE",shortKey:"roj",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},radiusJitter:{type:"other",val:"NONE",shortKey:"raj",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},numSteps:{type:"number",val:8,shortKey:"ns",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},numDirections:{type:"number",val:1,shortKey:"nd",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},intensity:{type:"number",val:1,shortKey:"i",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},radius:{type:"number",val:2,shortKey:"r",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},enableFalloff:{type:"other",val:!0,shortKey:"ef",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},falloffStart:{type:"number",val:.4,shortKey:"fs",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},falloffEnd:{type:"number",val:2,shortKey:"fe",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},renderTargetScale:{type:"number",val:.5,shortKey:"rts",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},blurMode:{type:"other",val:"NO_BLUR",shortKey:"bm",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},blurIterations:{type:"number",val:5,shortKey:"bi",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},blurStride:{type:"number",val:1,shortKey:"bs",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},ambientColor:{type:"color_str",val:"#FFFFFF",shortKey:"ac",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},ambientIntensity:{type:"number",val:0,shortKey:"ai",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}},lightBounceIntensity:{type:"number",val:0,shortKey:"lbi",onUpdate({type:e,data:t,runScene:r}){r.pp.setAOData(e,t)}}};var $n=r(1398);class ea{constructor(e){this.params=this.getDefaultParams(),this.clean=()=>{this.resetParams(),this.reset()},this.ENTIRE_SCENE=0,this.BLOOM_SCENE=1,this.BLACK_COLOR=new ua.Color(0),this.runScene=e,this.info=new tn(this.runScene),this.isSafari=-1<navigator.userAgent.indexOf("Safari"),this.isChrome=-1<navigator.userAgent.indexOf("Chrome"),this.rtSize=new ua.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&&t&&t.show&&(this.sceneFogColor?this.sceneFogColor.copy(t.color):this.sceneFogColor=new ua.Color(t.color)),"background"===e&&(this.sceneBackground&&(0,Ye.isTexture)(this.sceneBackground)&&this.sceneBackground.dispose(),this.sceneBackground=t,this.isChrome&&this.mtuGlow?this.mtuGlow.setSceneBg():this.isSafari)})),this.runScene.snapshot.bind({name:"glow",target:this.params.glow,def:Qn}),this.runScene.snapshot.bind({name:"outline",target:this.params.outline,def:Yn}),this.runScene.snapshot.bind({name:"ao",target:this.params.ao,def:Jn,set:e=>{const t=e.snapshot.data.get("ao");t&&($n.LV.set({def:Jn,runScene:this.runScene,data:t,target:this.params.ao,map:e}),e.data.completedCbs.push((()=>{(0,i.mapObj)(Jn,((e,r)=>{var{type:r,val:n,shortKey:a}=r;"other"===r&&this.setAOData(e,void 0!==t[a]?t[a]:n)}))})))}})}getDefaultParams(){return{pp:{samples:2},glow:{isBloom:!1,radius:.6,strength:1.5,threshold:0},outline:{isOutline:!1,edgeStrength:3,edgeGlow:0,edgeThickness:1,pulsePeriod:0,visibleEdgeColor:"#FFFFFF",hiddenEdgeColor:"#190A05"},ao:{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},vignette:{isVignette:!1,offset:1,darkness:1}}}resetParams(){(0,nt.U)(this.params,this.getDefaultParams())}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 _n(this.renderer,this.getNewRenderTarget(this.params.pp.samples)),this.renderPass=new Kn(this.mainScene,this.mainCamera),this.fxaaPass=new nn.T(Zn),this.fxaaPass.uniforms.resolution.value.set(1/window.innerWidth,1/window.innerHeight),this.vignettePass=new nn.T(Xn),this.effectComposer.addPass(this.renderPass),this.ppOutline(),this.ppGlow(),this.ppAO(),this.effectComposer.addPass(this.vignettePass)}getNewRenderTarget(e){const t=new ua.WebGLRenderTarget(this.rtSize.x,this.rtSize.y,{samples:e});return t.depthTexture=new ua.DepthTexture(this.rtSize.x,this.rtSize.y),t.depthTexture.type=ua.UnsignedIntType,t.depthTexture.format=ua.DepthFormat,t.texture.format=ua.RGBAFormat,t.texture.encoding=ua.sRGBEncoding,t}ppOutline(){this.mtOutline=new Pn.Q(this)}ppGlow(){this.isChrome?(this.effectComposer.renderToScreen=!0,this.mtuGlow=new fn(this)):this.isSafari&&(this.effectComposer.renderToScreen=!1,this.threeGlow=new Dn(this))}ppAO(){this.mtAO=new Gn(this)}toJSON(){const e={};var{pp:t,glow:r,outline:n,ao:a,vignette:i}=this.params;return e.ppParams=Object.assign({},t),e.bloomParams=Object.assign({},r),e.outlineParams=Object.assign({},n),e.aoParams=Object.assign({},a),e.vignetteParams=Object.assign({},i),JSON.stringify(e)}fromJSON(e){var{ppParams:e,bloomParams:t,outlineParams:r,aoParams:n,vignetteParams:a}=e;e&&(e=e.samples,this.params.pp.samples=e,this.effectComposer&&this.effectComposer.reset(this.getNewRenderTarget(this.params.pp.samples))),t&&(this.params.glow.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.params.glow)),r&&this.mtOutline&&(this.params.outline.isOutline=r.isOutline,this.setOutlineData("edgeStrength",r.edgeStrength),this.setOutlineData("edgeGlow",r.edgeGlow),this.setOutlineData("edgeThickness",r.edgeThickness),this.setOutlineData("pulsePeriod",r.pulsePeriod),this.setOutlineData("visibleEdgeColor",r.visibleEdgeColor),this.setOutlineData("hiddenEdgeColor",r.hiddenEdgeColor),this.runScene.cb.pp.outline.setData.cb(this.params.outline)),n&&this.mtAO&&(this.params.ao.isAO=n.isAO,this.setAOData("directionOffset",n.directionOffset),this.setAOData("stepOffset",n.stepOffset),this.setAOData("rotationJitter",n.rotationJitter),this.setAOData("radiusJitter",n.radiusJitter),this.setAOData("numSteps",n.numSteps),this.setAOData("numDirections",n.numDirections),this.setAOData("intensity",n.intensity),this.setAOData("radius",n.radius),this.setAOData("enableFalloff",n.enableFalloff),this.setAOData("falloffStart",n.falloffStart),this.setAOData("falloffEnd",n.falloffEnd),this.setAOData("renderTargetScale",n.renderTargetScale),this.setAOData("blurMode",n.blurMode),this.setAOData("blurIterations",n.blurIterations),this.setAOData("blurStride",n.blurStride),this.setAOData("ambientColor",n.ambientColor),this.setAOData("ambientIntensity",n.ambientIntensity),this.setAOData("lightBounceIntensity",n.lightBounceIntensity),this.runScene.cb.pp.ao.setData.cb(this.params.ao)),a&&this.vignettePass&&(this.params.vignette.isVignette=a.isVignette,this.setVignetteData("offset",a.offset),this.setVignetteData("darkness",a.darkness),this.runScene.cb.pp.vignette.setData.cb(this.params.vignette))}setUpdate(e){this.isUpdate=e}clearAllOutlineObj(){this.mtOutline.clearAllOutlineObj()}update(){this.isUpdate&&this.mainScene&&this.mainCamera&&this.renderer&&(this.params.glow.isBloom||this.params.outline.isOutline||this.params.ao.isAO||this.params.vignette.isVignette?(this.vignettePass.enabled=this.params.vignette.isVignette,this.mtAO&&this.mtAO.enablePass(this.params.ao.isAO),this.mtOutline&&this.mtOutline.enablePass(this.params.outline.isOutline),this.isChrome&&this.mtuGlow?(this.mtuGlow.enablePass(this.params.glow.isBloom),this.effectComposer.render()):this.isSafari&&this.threeGlow&&(this.threeGlow.enablePass(this.params.glow.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.params.pp[e]=t,"samples"===e&&this.effectComposer&&this.effectComposer.reset(this.getNewRenderTarget(this.params.pp.samples))}setGlowData(e,t){this.params.glow[e]=t,this.isChrome&&this.mtuGlow?this.mtuGlow.setGlowData(e,t):this.isSafari&&this.threeGlow&&this.threeGlow.setGlowData(e,t)}setOutlineData(e,t){this.params.outline[e]=t,this.mtOutline&&this.mtOutline.setOutlineData(e,t)}addOutlineObj(e,t=!0){this.mtOutline.addSelectedObject(e,t)}setAOData(e,t){this.params.ao[e]=t,this.mtAO&&this.mtAO.setAOData(e,t)}setVignetteData(e,t){this.params.vignette[e]=t,this.vignettePass&&(this.vignettePass.uniforms[e].value=t)}}var ta=r(7738);class ra extends o{constructor(e){super(e),this.map=new M.Z,this.playLimit=new nt.cM,this.renderName="script-texture-render",this._clock=new s.Clock,this.bindEvent()}parse(e,t){var r=(0,A.Ki)(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:a}=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),a&&(t.rotation+=a)}))}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,a=0;t.userData.scriptTextre&&(r=(e=t.userData.scriptTextre).offsetX,n=e.offsetY,a=e.rotation,delete t.userData.scriptTextre),t.offset.x=r,t.offset.y=n,t.rotation=a})),this.runScene.cb.render.delete(this.renderName)}has(e){return void 0!==e.userData.uvScript}get(e){return e.userData.uvScript}set(e,t){t.userData.uvScript=e}}class na extends o{constructor(e){super(e),this.runAll=!1,this.texture=new ra(e)}playAll(){this.runAll||(this.runAll=!0,this.texture.playAll())}closeAll(){this.runAll&&(this.runAll=!1,this.texture.closeAll())}}class aa{constructor(e){this.map=new M.Z,this.clean=()=>{this.clear()},this.runScene=e,this.runScene.cb.clean.add("Tags",this.clean),this.runScene.cb.model.remove.add("Tags",(({model:e})=>{const t=(0,A.Ki)(e);t&&this.map.map(((e,r)=>{r.delete(t)}))}))}get(e){return this.map.get(e)}add(e){this.get(e)||this.map.set(e,new P.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,nt.lG)(t,"array"))return t.map((t=>{this.addModel(e,t)}));this.map.get(e).add((0,A.Ki)(t))}reflash(e){const t=this.map.get(e);if(t){let e=[];t.forEach((t=>{this.runScene.modelEx.getById(t)||e.push(t)})),e.map((e=>t.remove(e)))}}removeModel(e,t){if(this.map.has(e))return(0,nt.lG)(t,"array")?t.map((t=>{this.removeModel(e,t)})):void this.map.get(e).remove((0,A.Ki)(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,i.mapObj)(e,((e,r)=>{t[e]=new P.Z(r)})),this.map=M.Z.formJSON(t),this.runScene.cb.tags.parseJSON.cb(e)}}class ia{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 a={},s={};if(e=ia.isNotNow(e)?this.getAllData():e,(0,i.mapObj)(n,((r,n)=>{void 0!==e[r]&&("number"===(n=n.type)?(a[r]=t[r],s[r]=e[r]):"color"===n&&(0,i.mapObj)(e[r],((e,n)=>{var i=r+e;a[i]=t[r][e],s[i]=n})))})),!(0,i.emptyObj)(a))return{begin:a,end:s}};return(t,r,n,a=!1,s)=>{let o=a?n.time:0;const l=Object.keys(t).sort(((e,t)=>a?Number(t)-Number(e):Number(e)-Number(t)));var c=(0,i.lastArrayEle)(l),h=a?"0.00":String(n.time);return c!==h&&(t[h]=Object.assign({},c),l.push(h)),l.map((l=>{var c=t[String(l)],h=.001*((h=a?o-l:l-o)<=0?.001:h)*n.speed;o=l;{var d=r,p=c,f=h,m=s;const t={color(e){const{animaData:t,defType:r}=e,n={};(0,i.mapObj)(t,(e=>{var a;-1!==e.indexOf(r)&&(a=e.substring(r.length),["r","g","b"].includes(a)&&(n[a]=t[e]))}));var{r:e,g:a,b:s}=n;if(e&&a&&s)return n}};return()=>{let r;return{promise:new Promise((n=>{var a;if(!(a=e(p,d,0,m)))return n(0);var{begin:a,end:s}=a;return r=(0,u.anima)(a,s,f,(e=>{(0,i.mapObj)(m,((r,n)=>{n=n.type;var a,i=e[r];"number"===n?d[r]=i:"color"===n&&(i=t.color({animaData:e,defType:r}))&&(({r:n,g:i,b:a}=i),d[r].setRGB(n,i,a))}))}),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,i.mapObj)(e,(a=>{n[a]=r?"notNow":ia.getValByType(t,a,e)})),n}static getValByType(e,t,r){var n,a;return r=r[t].type,e=e[t],"number"===r?e:"color"===r?(({r:t,g:n,b:a}=e),{r:t,g:n,b:a}):"V3"===r?(0,u.v3ToMap)(e):""}static SetTargetByData(e){const{baseType:t,data:r,defType:n,target:a}=e;var i,s;"number"===t?a[n]=r:"color"===t&&(({r:e,g:i,b:s}=r),a[n].setRGB(e,i,s))}getAllData(e=!1){return ia.getAllDefValByType(this.defOptions,this.target,e)}getData(e){return ia.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){ia.setTargetByBetween(e,t,r,this.defOptions,this.target)}clone(e){var{data:t,type:r}=this;const n=new(0,la[r])(e);return n.data=t,n}reset(){(0,i.mapObj)(this.defOptions,((e,t)=>{ia.SetTargetByData({baseType:t.type,data:ia.getValByType(this.beginData,e,this.defOptions),target:this.target,defType:e})}))}remove(){delete this.target.userData.isTimeLineUsed}}ia.setTargetByBetween=(()=>{const e=(e,t,r)=>e!==t?(t-e)*r+e:e;return(t,r,n,a,s)=>{(0,i.mapObj)(a,((a,i)=>{var o,l,c,u,h,d;i=i.type,void 0!==t[a]&&void 0!==r[a]&&ia.SetTargetByData({baseType:i,data:(o=t[a],l=r[a],c=n,"number"===i?e(o,l,c):"color"===i?(({r:i,g:o,b:u}=o),({r:l,g:h,b:d}=l),{r:e(i,l,c),g:e(o,h,c),b:e(u,d,c)}):void 0),defType:a,target:s})}))}})();const sa=ia;class oa extends o{constructor(){super(...arguments),this.mount=e=>{e.core.module.set("timeline",this)},this.after=e=>{var t,{json:e,config:r}=e;"scene"===(null==(t=null==(t=e.asset)?void 0:t.ex)?void 0:t.type)&&r.module.timeline&&this.runScene.timeLineEx.parseSavedGroupMap((null==(t=e.asset.ex)?void 0:t.timeLine)||{})}}init(){var e={name:"timeline",loadCallBacks:new M.Z({afterParse:this.after,mountModule:this.mount}),exportCallBacks:new M.Z};this.runScene.exporter.gltf.module.bind(e)}}const la={model:class extends sa{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:a}=e,{x:t,y:i,z:s}=t;return{x:e!==t?(t-e)*r+e:e,y:n!==i?(i-n)*r+n:n,z:a!==s?(s-a)*r+a:a}};return(t,r,n)=>{var a,{position:t,scale:i,rotation:s}=t,{position:r,scale:o,rotation:l}=r;t&&r&&(({x:t,y:r,z:a}=e(t,r,n)),this.target.position.set(t,r,a)),i&&o&&(({x:t,y:r,z:a}=e(i,o,n)),this.target.scale.set(t,r,a)),s&&l&&(({x:i,y:o,z:t}=e(s,l,n)),this.target.rotation.set(i,o,t))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,r)=>{var{position:t,scale:n,rotation:a}=t,{position:e,scale:i,rotation:s}=sa.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},i?{sx:n.x,sy:n.y,sz:n.z}:{},s?{rx:a.x,ry:a.y,rz:a.z}:{}),end:Object.assign({},r.curve?{ease:"none"}:{},e?{px:e.x,py:e.y,pz:e.z}:{},i?{sx:i.x,sy:i.y,sz:i.z}:{},s?{rx:s.x,ry:s.y,rz:s.z}:{})}};return(t,r,n,a=!1)=>{let s=a?n.time:0;const o=Object.keys(t).sort(((e,t)=>a?Number(t)-Number(e):Number(e)-Number(t)));var l=(0,i.lastArrayEle)(o),c=a?"0.00":String(n.time)+".00";return l!==c&&(t[c]={position:"notNow",rotation:"notNow",scale:"notNow"},o.push(c)),o.map((i=>{var o,l,c,h,d=t[String(i)],p=.001*((p=a?s-i:i-s)<=0?.001:p)*n.speed;return s=i,o=r,l=d,c=p,h=n,()=>{let t;return{promise:new Promise((r=>{var{begin:n,end:a}=e(l,o,h);return t=(0,u.anima)(n,a,c,(e=>{var{px:e,py:t,pz:r,sx:n,sy:a,sz:i,rx:s,ry:c,rz:u}=e;l.position&&o.position.set(e,t,r),l.scale&&o.scale.set(n,a,i),l.rotation&&o.rotation.set(s,c,u)}),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 sa{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:a}=e,{x:t,y:i,z:s}=t;return{x:e!==t?(t-e)*r+e:e,y:n!==i?(i-n)*r+n:n,z:a!==s?(s-a)*r+a:a}};return(t,r,n)=>{var a,{position:t,scale:i,rotation:s,target:o}=t,{position:r,scale:l,rotation:c,target:u}=r;t&&r&&(({x:t,y:r,z:a}=e(t,r,n)),this.target.position.set(t,r,a)),i&&l&&(({x:t,y:r,z:a}=e(i,l,n)),this.target.scale.set(t,r,a)),s&&c&&(({x:i,y:l,z:t}=e(s,c,n)),this.target.rotation.set(i,l,t)),o&&u&&(({x:r,y:a,z:s}=e(o,u,n)),this.controls.target.set(r,a,s))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,r)=>{var{position:t,scale:n,rotation:a}=t,{position:e,scale:i,rotation:s,target:o}=sa.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},i?{sx:n.x,sy:n.y,sz:n.z}:{},s?{rx:a.x,ry:a.y,rz:a.z}:{},o?{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}:{},i?{sx:i.x,sy:i.y,sz:i.z}:{},s?{rx:s.x,ry:s.y,rz:s.z}:{},o?{tx:o.x,ty:o.y,tz:o.z}:{})}},t=(t,r,n,a)=>()=>{let i;return{promise:new Promise((s=>{var{begin:o,end:l}=e(r,t,a);return i=(0,u.anima)(o,l,n,(e=>{var{px:e,py:n,pz:a,sx:i,sy:s,sz:o,rx:l,ry:c,rz:u,tx:h,ty:d,tz:p}=e;r.position&&t.position.set(e,n,a),r.scale&&t.scale.set(i,s,o),r.rotation&&t.rotation.set(l,c,u),r.target&&this.controls.target.set(h,d,p)}),s)})),anima:u.anima}};return(e,r,n,a=!1)=>{let s=a?n.time:0;const o=Object.keys(e).sort(((e,t)=>a?Number(t)-Number(e):Number(e)-Number(t)));var l=(0,i.lastArrayEle)(o),c=a?"0.00":String(n.time);return l!==c&&(e[c]=Object.assign({},l),o.push(c)),o.map((i=>{var o=e[String(i)],l=.001*((l=a?s-i:i-s)<=0?.001:l)*n.speed;return s=i,t(r,o,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":(0,u.v3ToMap)(t),scale:e?"notNow":(0,u.v3ToMap)(r),rotation:e?"notNow":(0,u.v3ToMap)(n),target:e?"notNow":(0,u.v3ToMap)(this.controls.target)}}getData(e){var{position:t,scale:r,rotation:n}=this.target;let a;if("position"===e)a=(0,u.v3ToMap)(t);else if("scale"===e)a=(0,u.v3ToMap)(r);else if("rotation"===e)a=(0,u.v3ToMap)(n);else{if("target"!==e)throw TypeError("输入值不存在");a=(0,u.v3ToMap)(this.controls.target)}return a}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 sa{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)}}};r(3263);class ca{constructor(){this.list={}}on(e,t){this.list[e]=t}emit(...e){if(void 0===this.list[e[0]])throw Error("请先挂载在使用---"+[e[0]]);return this.list[e[0]](...[...e].filter(((e,t)=>0!==t)))}off(e){this.list[e]&&delete this.list[e]}}const ua=c.Z,ha=class{constructor(e){this._clock=new s.Clock,this.cb=new v,this.script=new na(this),this.uniqueEx=new A.ZP(this),this.fileEx=new Rr(this),this.snapshot=new $n.ZP(this),this.undoEx=new Kr.ZP(this),this.textureEx=new Ye.default(this),this.controlsEx=new S,this.assetsEx=new m(this),this.renderEx=new ta.Z(this),this.events=new class{constructor(e){this.key=new E(this),this.mouse=new D(this),this.model=new O(this),this.runScene=e}init(e){this.key.init(e),this.mouse.init(e),this.model.init(),window.addEventListener("resize",(()=>{this.runScene.cb.resize.cb(this.runScene.renderEx.getDomSize())}))}}(this),this.multipSelector=new zr(this),this.helperEx=null,this.materialEx=new et.default(this),this.cameraEx=new b.Z(this),this.sceneEx=new rt.ZP(this),this.modelEx=new h.default(this),this.loaderer=new l.Z(this),this.exporter=new ht(this),this.lightEx=new $e.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 r,n,a=((e,t)=>{let r=-1,n=1e3;const a=Object.keys(e).sort(((e,t)=>Number(e)-Number(t)));if(1!==a.length&&(a.map(((e,a)=>{e=Number(e),0<(e=t-e)&&e<n&&(n=e,r=a)})),-1!==r)){var i=a[r],s=a[r+1],o=e[i];if(e=e[s],o&&e){var l=Object.values(o)[0],c=Object.values(e)[0];if("notNow"!==l&&"notNow"!==c)return{left:o,right:e,progress:(t-Number(i))/(Number(s)-Number(i))}}}})(e.data,t);a&&(({left:a,right:r,progress:n}=a),e.setTargetByBetween(a,r,n))}))},this.runScene=e,this.runScene.cb.clean.add("TimeLine",this.clean),this.exportAndImport=new oa(e)}init(){this.exportAndImport.init()}reset(){this.timerMap={},this.animaMap={},this.groupMap={},this.runScene.cb.timeLine.reset.cb("")}pause(e){var t,r;if(this.groupMap[e]){this.timerMap[e]&&(({setProgressTime:t,awaitRuned:r}=this.timerMap[e]),t&&clearInterval(t),r&&clearInterval(r)),this.groupMap[e].run=!1;const n=this.animaMap[e];n&&n.length&&n.map((e=>{e.controls.run=!1}))}}resume(e){const t=this.groupMap[e];if(t){this.groupMap[e].run=!0;const r=this.animaMap[e];r&&r.length&&r.map((r=>{const{controls:n,promise:a}=r;n.run=!0,a.then((()=>{if(t.run)return t.run=!1,t.loop?this.playGroup(e):void 0}))}))}}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,i.mapObj)(this.groupMap,((e,t)=>{t.run=!1})),this.groupMap}parseSavedGroupMap(e){Object.keys(e).map((t=>{const r=e[t],n={};(0,i.mapObj)(r.data,((e,t)=>{var{type:t,data:r}=t;const a=la[t];if(t=a.getTarget(e,this.runScene)){const i=new a(t,this.runScene);i.data=r,n[e]=i}})),r.data=n,this.groupMap[t]=r,this.runScene.cb.timeLine.setGroupMap.cb({group:r,groupName:t})}))}playGroup(e,t){const r=(0,nt.Gm)({onlyReverse:!1},t).onlyReverse,n=(this.runScene.helperEx.unfocus(),this.groupMap[e]);if(n&&!n.run){n.run=!0;const a=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 a=t.getAnima(n);return n.reverse&&(e=t.getAnima(n,!0),a.push(...e)),a}));this.animaMap[e]||(this.animaMap[e]=[]),this.animaMap[e]=a.map((e=>(0,i.eachTriggerArrGetControls)(e)));let s=0;s=r?n.time*n.speed:n.time*n.speed*(n.reverse?2:1);const o=(new Date).valueOf(),l=s;let c;t=setInterval((()=>{var t=((new Date).valueOf()-o)/l;this.runScene.cb.timeLine.playGroup.cb({groupName:e,progress:t})}),16.6);const u=new Promise((e=>c=setTimeout(e,s)));return this.timerMap[e]={setProgressTime:t,awaitRuned:c},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 d(this),this.tags=new aa(this),this.globalConfig=new Lr(this),this.pp=new ea(this),this.objects=new Yr(this),this.inited=!1,this._renderLimit=new nt.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()}},this.optionsEx=new en(this,e)}initLibs(e){if(!this.inited){this.inited=!0,this.snapshot.init(),this.materialEx.init(),this.modelEx.init(),this.sceneEx.init(),this.timeLineEx.init(),this.loaderer.init(),this.assetsEx.init(e),this.events.init(e),this.globalConfig.setRenderMode(this.optionsEx.options.renderConfig.mode),this.helperEx=new Ur(this);const{camera:t,controls:r}=this.assetsEx.get();this.uniqueEx.model.add(t),this.renderEx.setSize(),r.update(),this.pp.init(),this.cameraEx.reset(t),this.cb.inited.cb(0)}}init(e){return this.initLibs(e),this}load(e){var{path:e,dom:t,loadConfig:r}=e;return this.init(t),this.loadScene(e,r).then((e=>{0!==(null==e?void 0:e.length)&&this.modelEx.add(e)})),this}loadScene(e,t){return function(e,t,r,n){return new(r=r||Promise)((function(t,a){function i(e){try{o(n.next(e))}catch(e){a(e)}}function s(e){try{o(n.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof r?n:new r((function(e){e(n)}))).then(i,s)}o((n=n.apply(e,[])).next())}))}(this,0,void 0,(function*(){const{getJSON:r,progress:n,complete:i}=this.cb.load;t=t||{};var s=Object.assign(Object.assign({},t),{callBack:Object.assign(Object.assign({},t.callBack),{getJSON:e=>{var n,a;null!=(a=null==(n=null==t?void 0:t.callBack)?void 0:n.getJSON)&&a.call(n,e),r.cb(e)},progress:e=>{var r,a;null!=(a=null==(r=null==t?void 0:t.callBack)?void 0:r.progress)&&a.call(r,e),n.cb(e)},complete:e=>{var r,n;null!=(n=null==(r=null==t?void 0:t.callBack)?void 0:r.complete)&&n.call(r,e),i.cb(e)}}),triggerCb:!1});if(e instanceof ArrayBuffer)return this.optionsEx.log("正在解析二进制文件","base","info"),this.loaderer.gltf.parse(e,s);this.optionsEx.log("正在拉取场景","base","info");var o=yield a().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 o?(this.optionsEx.log("拉取场景成功、正在解析","base","success"),this.loaderer.gltf.parse(o,s)):void 0}))}dispose(){this.assetsEx.dispose(),this.sceneEx.clean()}on(e,t){return null!=(e=this.cb.load[e])&&e.add("load-callback"+(0,i.getId)(),t),this}setSize(e,t){const{render2:r,render3:n}=this.assetsEx,a=this.assetsEx.get().renderer;this.cameraEx.setSize(),null!=n&&n.setSize(e,t),null!=r&&r.setSize(e,t),a.setSize(e,t,!0),this.pp.setSize(e,t)}clean(){this.cb.clean.cb(0)}}},3736:(e,t,r)=>{r.d(t,{ZP:()=>b,bv:()=>M,is:()=>S,UE:()=>w,M:()=>y});var n=r(6001),a=r(8881),i=r(932),s=r(8715),o=r(7738),l=r(1794),c=r(3625);class u{constructor(e){this.mount=e=>{e.core.module.set("scene",this)},this.parse={before:e=>{var t,r,n,a,i,s,{json:e,config:o,core:l}=e;"scene"===(null==(t=null==(t=e.asset)?void 0:t.ex)?void 0:t.type)&&(({camera:t,lights:e,options:r,controls:n,tags:a,envStrength:i,objects:s}=e.asset.ex),void 0!==i&&this.runScene.sceneEx.setEnvStrength(i),this.parse.camera(t,o),this.parse.light(e,o,l),this.parse.controls(n,o),o.module.tags&&this.runScene.tags.parseJSON(a||{}),this.parse.options(r),s&&this.runScene.objects.parseJSON(s))},after:e=>{const{core:t,json:r,data:n,config:a}=e;if("scene"===(null==(e=null==(e=r.asset)?void 0:e.ex)?void 0:e.type)){var{options:e,json:i}=n;if(e=e.models,!t.loadConfig.module.model)return[];const s=e[0];if(t.module.get("model").data.map.map(((e,t)=>{this.runScene.uniqueEx.model.add(t)})),e=s.children.filter((e=>this.runScene.modelEx.isUnless(e)?void 0:e)),1===e.length){const[t]=e;t.animations=[...t.animations,...i.animations]}t.callback("loaded",""),this.runScene.optionsEx.sceneOptions.loaded=!0,this.parse.scene(r,a,t),t.models.push(...e)}},controls:(e,t)=>{var r;t.module.controls&&(({x:t,y:e,z:r}=e),this.runScene.assetsEx.controls.target.set(t,e,r),this.runScene.assetsEx.controls.update())},camera:(e,t)=>{if(t.module.camera){let o=e;e.temp&&(o=e.camera,this.runScene.cameraEx.temp=l.Z.formJSON(e.temp));var{position:t,far:e,near:r,fov:n,name:a,userData:i,rotation:s}=this.runScene.loaderer.object.parse(o);const c=this.runScene.assetsEx.get().camera;c.position.copy(t),c.far=e,c.near=r,c.fov=n,c.name=a,c.updateProjectionMatrix(),c.userData.id=i.id,this.runScene.uniqueEx.model.add(c),c.rotation.copy(s),this.runScene.assetsEx.get().controls.update()}},light:(e,t,r)=>{if(t.module.light){const t=[];e.map((e=>{var r=e.type;t.push(...this.runScene.lightEx.lightExMap[r].parseJSON(e))})),r.models.push(...t)}},scene:(e,t,r)=>{if(t.module.sceneConfig){const s=this.runScene.sceneEx.get();t=r.module.get("material").data.materialIns;var{materialId:r,backgroundMapping:e,backgroundColor:n,fog:i}=e.asset.ex.sceneEx;if(r&&(r=null==(t=t[r])?void 0:t.material)){const{map:t,envMap:n}=r;t&&(t.mapping=e||300,t.needsUpdate=!0,this.runScene.sceneEx.setBackground(t,!1),t.userData.isBackgroud=!0),n&&(s.environment=(0,c.setTextureMapping)(n))}if(n&&this.runScene.sceneEx.setBackground(new a.Color("#"+n)),i){const{color:e,far:t,near:r,show:n}=i,o=new a.Fog(e.includes("#")?e:"#"+e,r,t);!1===n?this.runScene.sceneEx.oldFog=o:s.fog=o,o.show=n,this.runScene.cb.setScene.cb({scene:s,type:"fog",val:o})}this.runScene.cb.setScene.cb({scene:s,type:"any",val:"any"})}},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)}))}},this.toJSON=()=>{},this.runScene=e}init(){this.bindEvent()}bindEvent(){var e={name:"sceneConfig",loadCallBacks:new l.Z({beforeParse:this.parse.before,afterParse:this.parse.after,mountModule:this.mount}),exportCallBacks:new l.Z};this.runScene.exporter.gltf.module.bind(e)}}var h=r(8089);class d{constructor(e){this.create=e=>{e.data.set("scene",this.getDiff())},this.set=e=>{const t=e.snapshot.data.get("scene");if(t){const{fog:u,bgc:d,env:p,bgcm:f,envS:m}=t,g=this.runScene.assetsEx.get().scene,{animas:v,completedCbs:b}=e.data;let y=g.background;if(this.runScene.sceneEx.setEnvStrength(void 0!==m?m:1),d){const{type:t,data:r}=d;if("color"===t)(0,i.isColor)(y)||null===y?(e=null===y?"#000000":(0,h.J6)(y),null===y&&this.runScene.sceneEx.setBackground(new a.Color("#000000")),e!==d.data&&v.push({target:g,label:"background",type:"color",isUpdate:!0,begin:e,end:r})):(0,c.isTexture)(y)&&b.push((()=>{this.runScene.sceneEx.setBackground(new a.Color(r))}));else if("texture"===t){const e=this.runScene.uniqueEx.texture.get(d.data);e&&(0,c.setTextureMapping)(e,303===f?"repeat":"normal"),b.push((()=>{this.runScene.sceneEx.setBackground(e)}))}}else(0,i.isColor)(y)&&(y||(y=new a.Color,this.runScene.sceneEx.setBackground(y)),v.push({target:g,label:"background",type:"color",isUpdate:!0,begin:(0,h.J6)(y),end:"#000000"})),b.push((()=>{this.runScene.sceneEx.setBackground(null)}));var r,n,s,o,l;b.push((()=>{g.environment=this.runScene.uniqueEx.texture.get(null==p?void 0:p.data)})),g.fog&&u?(({color:e,near:r,far:n}=u),({color:l,near:s,far:o}=g.fog),e!==(l=(0,h.J6)(l))&&v.push({target:g,label:["fog","color"],begin:l,end:e,type:"color",isUpdate:!0}),s!==r&&v.push({target:g,label:["fog","near"],begin:s,end:r,type:"number",isUpdate:!0}),o!==n&&v.push({target:g,label:["fog","far"],begin:o,end:n,type:"number",isUpdate:!0})):b.push((()=>{g.fog=u?w(u):null})),b.push((()=>{this.runScene.cb.setScene.cb({scene:this.runScene.assetsEx.get().scene,type:"any",val:"any"})}))}},this.runScene=e,this.runScene.cb.snapshot.create.add("scene",this.create),this.runScene.cb.snapshot.set.add("scene",this.set)}getDiff(){let e={};var t=((t=this.runScene.sceneEx.getJson("fog"))&&(e.fog=t),this.runScene.sceneEx.getJson("background")),r=this.runScene.assetsEx.scene;return void 0!==(t&&"texture"===(e.bgc=t).type&&303===r.background.mapping&&(e.bgcm=303),(t=this.runScene.sceneEx.getJson("environment"))&&(e.env=t),r=this.runScene.sceneEx.getEnvStrength())&&1!==r&&(e.envS=r),e}}var p=r(3735),f=r(2510),m=r(7169),g=r(3729),v=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};class b{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.envStrength=1,this.runScene=e,this.exportAndImport=new u(e),this.snapshot=new d(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,r)=>(e[t]=r,!0)})}getNromal(){return this.get().children.filter((e=>!this.runScene.helperEx.isHelper(e)))}getEnvStrength(){return this.envStrength}remove(e){if(e){if(e instanceof Array){const t=[];return e.map((e=>{for(const r in this.removeMap){const{valid:a,remove:i}=this.removeMap[r];if(a(e))return t.push(...(0,n.multiArrToArr)(i(e)))}t.push(new m.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){this.setBackground(null).then(),this.setEnv(null).then(),e.fog=null,this.runScene.cb.setScene.cb({scene:e,type:"any",val:null})}setBackground(e,t=!0){return v(this,void 0,void 0,(function*(){e instanceof String&&(e=yield this.runScene.textureEx.load(e)),(0,c.isTexture)(e)&&(e.userData.isBackgroud=!0);var r=this.get(),n=new f.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}dispose(){const{renderer:e,controls:t}=this.runScene.assetsEx.get();this.clean(),(0,o.s)(e),t.dispose(),this.runScene.pp.dispose(),a.Cache.clear()}render(){}create(){return new a.Scene}setEnv(e){return v(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,c.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 f.Z({target:e,info:r,oldVal:e[r],newVal:n,runScene:this.runScene}).execute(),t&&this.runScene.undoEx.addUndo(e)}setRealReflection(){const{scene:e,renderer:t}=this.runScene.assetsEx;this.cubeRT||(this.cubeRT=new a.WebGLCubeRenderTarget(1024)),this.realReflectionCamera||(this.realReflectionCamera=new a.CubeCamera(.1,5e3,this.cubeRT),e.add(this.realReflectionCamera),this.runScene.cb.render.add("RealReflection-update",(()=>{this.realReflectionCamera.update(t,e)}))),this.isRealReflection?(this.preEnvMap=e.environment,this.setEnv(null).then(),this.setNormal({model:e,info:"environment",val:this.cubeRT.texture})):this.preEnvMap&&this.setEnv(this.preEnvMap).then(),this.testSphere||(this.testSphere=new a.Mesh(new a.SphereGeometry(15,32,16),new a.MeshStandardMaterial),e.add(this.testSphere),this.testSphere.scale.set(10,10,10),this.testSphere.position.set(0,600,0),this.testSphere.getWorldPosition(this.realReflectionCamera.position),this.testSphere.material.roughness=0,this.testSphere.material.metalness=1)}setFogShow(e){var t=this.runScene.assetsEx.scene,{show:e,color:r}=e;if(e){let e=this.oldFog||new a.Fog(r||"#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:r,cb:n}=e;t=new p.Z({target:t,typeList:["fog",e],newVal:r,cb:n}).execute(),this.runScene.undoEx.addUndo(t)}sreenShotDefFile(e,t){e=e||Number(prompt("请输入截图的宽"))||1920,t=t||Number(prompt("请输入截图的高"))||1080;var{width:r,height:a}=(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,n.base64ToFile)(e,"screenShot.png"),this.runScene.pp.setSize(r,a),this.runScene.renderEx.setSize(),this.runScene.pp.update(),t}getJson(e){let t;var r=this.runScene.assetsEx.scene;if("fog"===e){var n=r.fog;n&&(t=x(n,null!==r.fog))}else if("background"===e){if(!r.background)return;t={type:(n=(0,i.isColor)(r.background))?"color":"texture",data:(n?h.J6:g.Ki)(r.background)}}else if("environment"===e){if(!r.environment)return;t={type:"texture",data:(0,g.Ki)(r.environment)}}return t}static toJSON(e,t){const r={};let n=!1,a=e.fog;return a?n=!0:a=t.sceneEx.oldFog,a&&(r.fog=x(a,n)),(0,i.isColor)(e.background)&&(r.backgroundColor=e.background.getHexString()),r}setEnvStrength(e){this.runScene.cb.scene.setEnvStrength.cb({val:e}),this.runScene.uniqueEx.material.each((t=>this.runScene.materialEx.setEnvStrength(t,e))),this.envStrength=e}}const y=(e,t,r)=>{e.userData[t]=r},x=(e,t)=>{var{color:e,far:r,near:n}=e;return{color:(0,h.J6)(e),show:t,far:r,near:n}},w=e=>{var{color:e,far:t,near:r}=e;return new a.Fog(e,r,t)},S=(e,t)=>(null==(e=null==e?void 0:e.userData)?void 0:e[t])||"",M=(e,t)=>{delete e.userData[t]}},1398:(e,t,r)=>{r.d(t,{LV:()=>p,ZP:()=>d});var n=r(6001),a=r(3263),i=r(1794),s=r(7201),o=r(3625),l=r(3729),c=r(4457),u=r(8089);const h=["number","color","color_obj","color_str","v2","v3"];class d{constructor(e){this.map=new i.Z,this.playing=new i.Z,this.unique={set:()=>{},get:()=>{}},this.toJSON=()=>JSON.stringify(this.map.toJSON()),this.parseJSON=e=>{const t=i.Z.formJSON(JSON.parse(e));t.map(((e,t)=>{t.data=i.Z.formJSON(t.data)})),this.map=t},this.clean=()=>{this.map.clear()},this.trans={set:(e,t)=>{var r,n,a,i,s,o=e.label instanceof Array?e.label.join("."):e.label;const l={begin:[],end:[]};return"color"===e.type||"color_obj"===e.type||"color_str"===e.type?(a=(0,u.sS)(e.begin),r=(0,u.sS)(e.end),i=o+"_"+t+"_r",s=o+"_"+t+"_g",n=o+"_"+t+"_b",l.begin.push({type:i,data:a.r}),l.begin.push({type:s,data:a.g}),l.begin.push({type:n,data:a.b}),l.end.push({type:i,data:r.r}),l.end.push({type:s,data:r.g}),l.end.push({type:n,data:r.b})):"number"===e.type?(l.begin.push({type:o+"_"+t,data:e.begin}),l.end.push({type:o+"_"+t,data:e.end})):"v2"!==e.type&&"v3"!==e.type||(a=o+"_"+t+"_x",i=o+"_"+t+"_y",s=o+"_"+t+"_z",l.begin.push({type:a,data:e.begin.x}),l.begin.push({type:i,data:e.begin.y}),"v3"===e.type&&(l.begin.push({type:s,data:e.begin.z}),l.end.push({type:s,data:e.end.z})),l.end.push({type:a,data:e.end.x}),l.end.push({type:i,data:e.end.y})),l},getKey(e){let t=[];var{unique:r,type:n}=e;return e=e.label instanceof Array?e.label.join("."):e.label,"v2"===n||"v3"===n?(t.push(e+"_"+r+"_x"),t.push(e+"_"+r+"_y"),t.push(e+"_"+r+"_z")):"color"===n||"color_obj"===n||"color_str"===n?(t.push(e+"_"+r+"_r"),t.push(e+"_"+r+"_g"),t.push(e+"_"+r+"_b")):"number"===n&&t.push(e+"_"+r),t},update:(e,t)=>{var r;const a=this.trans.getKey(e);let i=e.target,s=e.label,o=(e.label instanceof Array&&(s=(0,n.lastArrayEle)(e.label),i=(0,n.objLastMap)(e.target,e.label)),t[a[0]]),l=s;"color"===e.type||"color_obj"===e.type?(o={r:0,g:0,b:0},a.map((e=>{var[,,r]=e.split("_");e=t[e]/255,o[r]=e}))):"color_str"===e.type?o="#"+a.map((e=>Number(Number(t[e]).toFixed(0)).toString(16).padStart(2,"0"))).join(""):"v2"!==e.type&&"v3"!==e.type||(o={x:0,y:0,z:0},a.map((e=>{var[,,r]=e.split("_");o[r]=t[e]}))),null!=(r=e.onUpdate)&&r.call(e,{target:i,data:o,type:l,runScene:this.runScene})},exec:(e,t)=>{const r=this.trans.getKey(e);let a=e.target,i=e.label;e.label instanceof Array&&(i=(0,n.lastArrayEle)(e.label),a=(0,n.objLastMap)(e.target,e.label)),"color"===e.type||"color_str"===e.type||"color_obj"===e.type?r.map((e=>{var[,,r]=e.split("_");e=1<t[e]?t[e]/255:t[e],a[i][r]=e})):"number"===e.type?a[i]=t[r[0]]:"v2"!==e.type&&"v3"!==e.type||r.map((e=>{var[,,r]=e.split("_");a[i][r]=t[e]}))}},this.runScene=e}init(){this.runScene.exporter.gltf.options.addOption({type:"snapshot",process:this.toJSON,parse:this.parseJSON}),this.runScene.cb.clean.add("snapshrot",this.clean)}create(e){var{name:e,time:t}=e;return e={name:e,time:t,data:new i.Z},this.runScene.cb.snapshot.create.cb(e),e}resetItem(e){const{targets:t,names:r,type:n}=e;e=r.map((e=>this.map.get(e))).filter((e=>e)),this.runScene.cb.snapshot.resetItem.cb({targets:t,datas:e,type:n})}add(e){var t=this.create(e);return this.map.set(e.name,t),t}set(e,t){this.runScene.modelEx.selectNull();var r=this.map.get(e),{animaTime:t,isLinear:n}=Object.assign({animaTime:-1},t);if(r){const a={animas:[],completedCbs:[]};this.runScene.cb.snapshot.set.cb({snapshot:r,data:a}),0===a.animas.length?0!==a.completedCbs.length&&a.completedCbs.map((e=>e())):this.anima(e,a,{animaTime:-1===t?r.time:t,isLinear:n})}}del(e){var t=this.map.get(e);t&&this.runScene.cb.snapshot.delete.cb({name:e,data:t})}anima(e,t,r){if(this.runScene.modelEx.selectNull(),null==(a=this.playing.get(e))||!a.animaIns){const s=new i.Z,o={},l={};var{animaTime:a,isLinear:r}=r;const u={data:t,animaIns:null};t.animas.map(((e,t)=>{t=String(t);const{begin:r,end:n}=this.trans.set(e,t);r.map((e=>o[e.type]=e.data)),n.map((e=>l[e.type]=e.data)),s.set(t,Object.assign({unique:t},e))})),u.animaIns=(0,c.anima)(o,Object.assign(Object.assign({},l),{ease:r?"none":"easeOut"}),a,(e=>{(0,n.mapObj)(e,(t=>{var[,t]=t.split("_");(t=s.get(t))&&(t.isUpdate?this.trans.exec(t,e):this.trans.update(t,e))}))}),(()=>{u.animaIns.kill(),u.animaIns=null,u.data.completedCbs.map((e=>e()))})),this.playing.set(e,u)}}close(e){const t=this.playing.get(e);return!(!t||(t.animaIns.kill(),t.animaIns=null))}closeAll(){this.playing.map(((e,t)=>{t&&t.animaIns.kill(),t.animaIns=null}))}parseNromal(e,t){const{animas:r,completedCbs:a}=t.data,{target:i,type:s,begin:o,end:l,set:u,label:d,onUpdate:p}=e;if((0,c.isDef)(o,l))if(h.includes(s))r.push({target:i,type:s,begin:o,end:l,label:d,isUpdate:void 0===p,onUpdate:p});else if(u)u({target:i,begin:o,end:l});else{let e=i,t=d;d instanceof Array&&(e=(0,n.objLastMap)(i,d),t=(0,n.lastArrayEle)(d)),"texture"===s?e[t]=l:a.push((()=>{e[t]=l}))}}bind(e){const{name:t,def:r,target:n,create:a,set:i}=e;this.runScene.cb.snapshot.create.add(t,a||(e=>{e.data.set(t,p.getDiff(r,n))})),this.runScene.cb.snapshot.set.add(t,i||(e=>{var a=e.snapshot.data.get(t);a&&p.set({def:r,runScene:this.runScene,data:a,target:n,map:e})}))}}const p={toNormal(e){var t,{type:e,val:r}=e;let n=r;return"color"===e?n=(0,u.Lv)(r):"color_obj"===e?n=r:"color_str"===e?n=(0,c.MyHextoRgb)(r,!0):"texture"===e?(0,o.isTexture)(r)&&(n=(0,l.Ki)(r)):"v3"!==e&&"v2"!==e||(({x:e,y:r,z:t}=r),n={x:e,y:r,z:t}),n},parse(e){const{type:t,val:r,runScene:n}=e;let i=r;return"color"===t?i=a.YD.is(r)?r:(0,c.HextoRgb)(r,!0):"color_obj"===t?i=r:"color_str"===t&&(i=a.YD.is(r)?r:(0,c.HextoRgb)(r,!0)),"texture"===t&&null!==r?n.uniqueEx.texture.get(r):i},getDiff(e,t){let r={};return(0,n.mapObj)(e,((e,a)=>{const{label:i,get:s}=a;let o=t[e];s?o=s(t):i&&(o=(0,n.objLastMap)(t,i)[(0,n.lastArrayEle)(i)]),r[e]=o})),(0,s.replaceKVForObj)((0,c.getDiff)((0,s.replaceValForObj)(e,((e,t)=>t.val)),r),((t,r)=>{var{shortKey:t,type:n}=e[t];return{k:t,v:p.toNormal({type:n,val:r})}}))},set(e){const{def:t,data:r,target:a,runScene:i,map:s}=e;(0,n.mapObj)(t,((e,t)=>{const{type:o,val:l,shortKey:u,before:h,label:d,onUpdate:f,get:m,set:g}=t;let v=a,b=e;d&&(v=(0,n.objLastMap)(a,d),b=(0,n.lastArrayEle)(d)),t=p.toNormal({type:o,val:m?m(v):v[b]}),e=p.parse({type:o,val:void 0!==r[u]?r[u]:l,runScene:i}),(0,c.isDef)(t,e)&&(null!=h&&h({target:v,begin:t,end:e}),i.snapshot.parseNromal({target:v,label:b,type:o,set:g,begin:t,end:e,onUpdate:f},s))}))}}},3625:(e,t,r)=>{r.r(t),r.d(t,{bindTextureBaseData:()=>T,default:()=>y,disposeTexture:()=>M,getBlobByTexture:()=>_,getCloneIdFromTexture:()=>L,getImageDomByUrl:()=>V,getMimeByTexture:()=>w,getSizeByTexture:()=>O,getTextureGpuMemory:()=>S,getTextureMinFilter:()=>j,getUrlByTexture:()=>P,initTexture:()=>E,isClonedTexture:()=>R,isInvalidTexture:()=>G,isTexture:()=>C,loadTexture:()=>D,parseImageBitMapByBlob:()=>k,setTextureCloneId:()=>I,setTextureMapping:()=>A,setTextureMinFilter:()=>U,textureNameMap:()=>x,unDelAbleTexture:()=>z,updateTexture:()=>B});var n=r(6001),a=r(8881),i=r(6422),s=r(5247),o=r(932),l=r(3736);class c 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 u=c;var h=r(8024),d=r(2510),p=r(3729),f=r(4457),m=r(1398);const g={repeat:{type:"v2",val:{x:1,y:1},shortKey:"re"},offset:{type:"v2",val:{x:0,y:0},shortKey:"of"},rotation:{type:"number",val:0,shortKey:"ro"},center:{type:"v2",val:{x:0,y:0},shortKey:"ce"}};class v{constructor(e){this.onDeleteSnapshot=e=>{const{data:t,name:r}=e;(e=t.data.get("texture"))&&(0,n.mapObj)(e,(e=>{(e=this.runScene.uniqueEx.texture.get(e))&&this.setUnDel(e,!1,r)}))},this.resetItem=e=>{"texture"===e.type&&e.datas.map((t=>{const{data:r,name:n}=t,a=r.get("texture")||{};e.targets.map((e=>{var t=(0,p.Ki)(e);t&&(a[t]=this.getItem(e,n))}))}))},this.setUnDel=(e,t,r)=>{if(t){if(z.is(e))return}else if(z.getRef(e)!=="snapshot_"+r)return;z.set(e,t,"snapshot_"+r)},this.getItem=(e,t)=>{this.setUnDel(e,!0,t);const r=m.LV.getDiff(g,e);return(t=this.runScene.script.texture.get(e))&&(r.uvScript=Object.assign({},t)),r},this.getDiff=e=>{let t={};return this.runScene.uniqueEx.texture.getAll().map((({texture:r})=>{var n=(0,p.Ki)(r);n&&(t[n]=this.getItem(r,e))})),t},this.create=e=>{e.data.set("texture",this.getDiff(e.name))},this.set=e=>{var t=e.snapshot.data.get("texture");t&&(0,n.mapObj)(t,((t,r)=>{(t=this.runScene.uniqueEx.texture.get(t))&&(m.LV.set({def:g,data:r,runScene:this.runScene,map:e,target:t}),this.runScene.script.texture.parse(r.uvScript,t),this.runScene.script.texture.set(r.uvScript,t))}))},this.runScene=e,this.runScene.cb.snapshot.create.add("texture",this.create),this.runScene.cb.snapshot.set.add("texture",this.set),this.runScene.cb.snapshot.delete.add("texture",this.onDeleteSnapshot),this.runScene.cb.snapshot.resetItem.add("texture",this.resetItem)}}var b=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};class y{constructor(e){this.allTextures=new Set,this.rgbeLoader=new i.x,this.spcielBack=["hdr","pic"],this.setAnima=e=>{const{texture:t,type:r,val:n}=e,a=t.userData.uvScript||{};t.userData.uvScript||(t.userData.uvScript=a),0===n?delete a[r]:a[r]=n,this.runScene.cb.texture.setAnima.cb({texture:t,uvScript:a})},this.runScene=e,this.snapshot=new v(e)}load(e,t){return b(this,void 0,void 0,(function*(){var r=yield(0,f.urlToBlob)(e);return this.parse(r,t)}))}parse(e,t){return b(this,void 0,void 0,(function*(){let r;return t=(0,f.mergeObject)({flipY:!0},t),e instanceof File&&this.spcielBack.includes(e.name.substring(e.name.lastIndexOf(".")+1))?(r=yield this.parseHdr(e)).userData.isHdr=!0:r=yield D(e,t),this.afterLoad(r,e)}))}parseHdr(e){return this.rgbeLoader.loadAsync(URL.createObjectURL(e))}clone(e){const t=new a.Texture(e.image);return t.userData=Object.assign(Object.assign({},e.userData),{id:(0,n.getId)(),cloneSourceId:(0,p.Ki)(e)}),(0,l.bv)(t,"minFilter"),T(t),this.getSameAndAddtoAll(t)}getDef(e){return e=new a.Texture(e),T(e),this.getSameAndAddtoAll(e)}getSameAndAddtoAll(e){var t=e.userData.md5;return(t=this.getSameTexture(t,e))?(M(e),t):(this.initTextureAndAddtoAll(e),e)}afterLoad(e,t){return b(this,void 0,void 0,(function*(){return this.getSameAndAddtoAll(yield T(e,t))}))}getSameTexture(e,t){if(!R(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 b(this,void 0,void 0,(function*(){return E(e),T(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,f.imgBitMapToBlobAndBase64)(e)}coverByImage(e,t){return b(this,void 0,void 0,(function*(){let r;r=C(t)?t:t?yield this.parse(t):null;var a=this.runScene.uniqueEx.texture.getMaterials(this.runScene.uniqueEx.getId(e));if(a){const t=[];(0,n.mapObj)(a,((n,a)=>{const i=this.runScene.uniqueEx.material.get(n);i&&a.forEach((n=>{t.push(new h.Z({target:i,info:n,newVal:r,oldVal:e,runScene:this.runScene}).execute())}))})),this.runScene.undoEx.addUndo(t)}}))}remove(e){const t=(0,p.Ki)(e);var r=this.runScene.uniqueEx.texture.map[t];if(r){const a=[];r=r.materialMap,(0,n.mapObj)(r,((e,t)=>{const r=this.runScene.uniqueEx.material.get(e);r&&(t.forEach((e=>{a.push(new d.Z({target:r,info:e,oldVal:r[e],newVal:null,runScene:this.runScene,cb(){(0,o.updateMaterial)(r)}}).execute())})),(0,o.updateMaterial)(r))}));const i=this.runScene.uniqueEx.texture.map[t];a.push(new u({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 u({undo:()=>{this.runScene.uniqueEx.texture.map[t]=i},redo:()=>{delete this.runScene.uniqueEx.texture.map[t]}}).execute()),this.runScene.undoEx.addUndo(a)}}delete(e){this.runScene.cb.texture.remove.cb(e),this.runScene.uniqueEx.texture.remove(e),M(e)}reverseImageBitMapTexture(e){return b(this,void 0,void 0,(function*(){var{canvas:t,imageBitMap:r}=yield(0,f.reverseImageBitMap)(e.image);const i=new a.Texture(r);return i.needsUpdate=!0,r=this.runScene.uniqueEx.texture.map[e.userData.id],(0,n.mapObj)(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})}))})),E(i),yield T(i),this.runScene.cb.texture.add.cb(i),this.delete(e),(0,f.disposeCanvas)(t),i}))}setUnDelAble(e,t,r="custom",n){z.set(e,t,r,n),this.runScene.cb.texture.set.cb({type:"unDelAble",texture:e,data:t})}getUsedModel(e,t=!0){if(e=(0,p.Ki)(e)){const r=[];if((e=this.runScene.uniqueEx.texture.map[e])&&((0,n.mapObj)(e.materialMap,(e=>{const t=this.runScene.uniqueEx.material.map[e];t&&r.push(...t.models.toArray())})),0!==r.length))return t&&this.runScene.multipSelector.add(r,!0),r}}getUsedMaterial(e){if((e=(0,p.Ki)(e))&&(e=this.runScene.uniqueEx.texture.map[e]))return(0,n.mapObj)(e.materialMap,(e=>null==(e=this.runScene.uniqueEx.material.map[e])?void 0:e.material)).filter((e=>e))}}const x={环境遮蔽:"aoMap",法线:"normalMap",金属度:"metalnessMap",粗糙度:"roughnessMap",自发光:"emissiveMap",颜色:"map",置换:"displacementMap",光照贴图:"lightMap",环境:"envMap",透明度:"alphaMap"},w=e=>1023===e.format?"image/png":"image/jpeg",S=e=>{var{width:e,height:t}=e.image;return e*t*4*1.33},M=e=>{var t,r;e&&(t=e.image,r=e.userData.url,t instanceof ImageBitmap?(0,f.disposeImageBitMap)(t):t instanceof HTMLCanvasElement&&(0,f.disposeCanvas)(t),URL.revokeObjectURL(r),e.dispose())},T=(e,t)=>b(void 0,void 0,void 0,(function*(){var r=(0,f.isBlob)(e.userData.blob)?e.userData.blob:null;const n=t||r||(yield _(e));e.userData.blob=n,e.userData.mimeType=n.type;var{md5:r,url:a}=e.userData;return r||(e.userData.md5=(0,f.getMd5)(yield n.arrayBuffer())),a||(e.userData.url=URL.createObjectURL(n)),e.userData.isHdr&&(e.flipY=!0),e.userData.gm=S(e),e.needsUpdate=!0,e})),_=e=>(0,f.isBlob)(e.userData.blob)?e.userData.blob:(0,f.imgBitMapToBlob)(e.image),E=e=>{if(!e.userData.isHdr)return e.magFilter=1003,e.wrapS=s.Z.RepeatWrapping,e.wrapT=s.Z.RepeatWrapping,e.encoding=3e3,e.version=3,e.flipY=!1,"nearest"!==j(e)&&(e.minFilter=s.Z.LinearMipmapLinearFilter),e.needsUpdate=!0,e},k=(e,t)=>{let r={resizeQuality:"pixelated"};return null!=t&&t.flipY&&(r.imageOrientation="flipY"),createImageBitmap(e,r)},D=(e,t)=>b(void 0,void 0,void 0,(function*(){var r=yield k(yield V(e instanceof Blob?URL.createObjectURL(e):e),t);const n=new a.Texture(r);return n.needsUpdate=!0,n})),P=e=>null==(e=e.userData)?void 0:e.url,A=(e,t="repeat")=>(e.mapping="repeat"===t?s.Z.EquirectangularReflectionMapping:300,e.needsUpdate=!0,e),O=e=>{var{width:e,height:t}=e.image;return{width:e,height:t}},C=e=>null==e?void 0:e.isTexture,R=e=>0<(null==(e=e.userData.cloneSourceId)?void 0:e.length),L=e=>e.userData.cloneSourceId,I=(e,t)=>{e.userData.cloneSourceId=t},B=e=>{e.needsUpdate=!0},U=(e,t)=>{e.minFilter=s.Z["linear"===t?"LinearMipmapLinearFilter":"NearestFilter"],(0,l.M)(e,"minFilter",t),B(e)},j=e=>(0,l.is)(e,"minFilter"),F="unDelAble",N="unDelAbleRef",z={is:e=>(0,l.is)(e,F),getRef:e=>(0,l.is)(e,N),set(e,t,r="custom",n){if(t)(0,l.M)(e,F,t),(0,l.M)(e,N,r);else{let t=!1;(t=!(!n&&(0,l.is)(e,N)!==r)||t)&&(delete e.userData[F],delete e.userData[N])}}},V=e=>{const t=document.createElement("img");return t.src=e,new Promise((e=>{t.addEventListener("load",(()=>{e(t)}))}))},G=e=>{var t;if(void 0!==(null==(t=e.source)?void 0:t.data.width)&&(0===(null==(t=e.source)?void 0:t.data.width)||0===e.source.data.height))return!0}},6651:(e,t,r)=>{r.d(t,{ZP:()=>n,d9:()=>a});class n{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 a=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=a(e[t]),n[t]=r);return n}}},4773:(e,t,r)=>{r.d(t,{Z:()=>a});var n=r(1269);class a{constructor(e){this.addTree=!0,this.isClone=!1,this.cb=(e,t)=>{};var{model:e,parent:t,cb:r,addTree:n,isClone:a,runScene:i}=e;this.runScene=i,this.model=e,this.parent=t,!1===n&&(this.addTree=n),!0===a&&(this.isClone=a),r&&(this.cb=r)}remove(e){const{model:t,parent:r,addTree:n,runScene:a}=e;a.modelEx.select===t&&a.modelEx.selectNull(),r.remove(t),n&&a.uniqueEx.model.remove(t),n&&a.cb.model.remove.cb({model:t,parent:r}),this.cb(t,"remove"),a.uniqueEx.material.addModel(t,void 0,t.material)}add(e){const{model:t,parent:r,addTree:a,isClone:i,runScene:s}=e;r.add(t),a&&s.uniqueEx.model.add(t),a&&s.cb.model.add.cb({model:t,parent:r,isClone:i}),this.cb(t,"add"),s.uniqueEx.material.addModel(t,t.material),(0,n.RQ)(t)&&setTimeout((()=>{this.runScene.lightEx.update(t)}))}}},4616:(e,t,r)=>{r.d(t,{Z:()=>n});class n{}},8024:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(4330);class a extends r(4616).Z{constructor(e){super(),this.isUndoMaterial=!0,this.type="修改材质";var{target:e,info:t,newVal:r,oldVal:n,runScene:a,cb:i}=e;this.runScene=a,this.target=e,this.info=t,this.newVal=r,this.oldVal=n,this.cb=i}_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 i=a},3735:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(6001);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,n.objLastMap)(e.target,this.typeList)[(0,n.lastArrayEle)(e.typeList)]}execute(){return this.redo(),this}_execute(e){const t=(0,n.objLastMap)(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 i=a},2510:(e,t,r)=>{r.d(t,{Z:()=>a});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:a,cb:i,executeCb:s}=e;this.runScene=a,this.target=e,this.info=t,this.newVal=n,this.oldVal=r,i&&(this.cb=i),s&&(this.executeCb=s)}_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 a=n},7169:(e,t,r)=>{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)=>{r.d(t,{Z:()=>a});class n extends r(4616).Z{constructor(e){super(),this.isUndoV3=!0,this.type="三维矩阵修改";var{target:e,info:t,newV3:r,oldV3:n,runScene:a}=e;this.target=e,this.info=t,this.runScene=a,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 a=n},3729:(e,t,r)=>{r.d(t,{ZP:()=>d,Ki:()=>p,x:()=>f});var n=r(6001),a=r(272),i=r(932);class s{constructor(e){this.map={},this.removes=[],this.unique=e}add(e,t,r){if(null!=e&&e.userData&&!i.materialIgnore.is(e)){let i=e.userData.id;if(i||(i=(0,n.getId)(),e.userData.id=i),this.map[i]){if(this.map[i].material.name!==e.name){const t=(0,n.getId)();e.userData.id=t,this.map[t]={material:e,models:new a.Z},this.unique.runScene.cb.unique.material.add.cb(e)}}else this.map[i]={material:e,models:new a.Z},this.unique.runScene.cb.unique.material.add.cb(e);t&&this.addModel(t,e,r)}}addModel(e,t,r){r&&t&&p(r)===p(t)||(null!=t&&t.userData&&(t=p(t),null!=(t=this.map[t])&&t.models.add(e)),r&&null!=(t=this.map[p(r)])&&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,n.mapObj)(this.map,((e,t)=>{t.material.dispose()})),this.map={}}}var o=r(1269),l=r(8715),c=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,n.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),n.type.isNumber(e)?Number.parseInt(e):-1)},t=(r,n)=>{var a=(t=>{if(-1===e(t))return t;var r=t.lastIndexOf("_");return-1===r?t:t.slice(0,r)})(r)+"_"+n++;return this.nameMap[a]?t(r,n):a},r=e=>Object.keys(this.nameMap).find((t=>this.nameMap[t]===e)),a=["PerspectiveCamera"];return n=>{if(a.includes(n.type))return n.name=n.type;let i=n.name;if(i=i||n.type,!this.nameMap[i])return s=this.unique.getId(n),(o=r(s))&&delete this.nameMap[o],void(this.nameMap[i]=s);var s,o=this.nameMap[i];return this.unique.model.get(o)!==n?(s=e(i),s=t(i,o=-1===s?0:s),this.nameMap[s]=this.unique.getId(n),n.name=s):void 0}})()}add(e,t){var{reset:r,hasReset:a}=t||{ignoreMaterial:!1};if(e instanceof Array)return e.map((e=>this.add(e,t)));if(e&&!(0,l.isHelper)(e)){let i=e.userData.id;if(i&&!r||(i=(0,n.getId)(),e.userData.id=i),this.map[i]){if(!(a||(0,c.An)(this.unique.runScene)&&(0,c.FW)(this.unique.runScene).coverSameId))return void(e.name!==this.map[i].name&&this.unique.runScene.optionsEx.log(`解析模型出错,${e.name} 与 ${this.map[i].name} 拥有相同的id,请选择任意一个模型导出并删除,并重新导入。`,"base","error"));i=(0,n.getId)(),e.userData.id=i}return this.map[i]=e,this.parseName(e),e.material&&(this.unique.runScene.materialEx.parse(e.material),this.unique.material.add(e.material,e)),!e.children.length||(0,o.RQ)(e)||(0,l.isHelper)(e)?i: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 r=t.toLowerCase();return r===(t=e.toLowerCase())||-1!==r.indexOf(t)}));return t=this.getIdByNames(t),this.getModelsWithIds(t)}}class h{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,n.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,a=e.userData.id||this.add(e);t&&(({material:t,type:n}=t),this.map[a]||(this.map[a]={materialMap:{},texture:e}),this.map[a].materialMap[t.userData.id]||(this.map[a].materialMap[t.userData.id]=new Set),this.map[a].materialMap[t.userData.id].add(n)),r&&(({material:e,type:t}=r),this.map[a].materialMap[e.userData.id]&&this.map[a].materialMap[e.userData.id].delete(t))}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.mapObj)(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.mapObj)(this.map,((e,t)=>{t.texture.dispose()})),this.map={}}getAll(){return Object.values(this.map)}}class d{constructor(e){this.clean=()=>{this.dispose()},this.runScene=e,this.model=new u(this),this.material=new s(this),this.texture=new h(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 p=e=>(null==(e=null==e?void 0:e.userData)?void 0:e.id)||"",f=(e,t)=>{e.userData&&(e.userData.id=t)}},4457:(e,t,r)=>{r.r(t),r.d(t,{HextoRgb:()=>a.I8,LimitCb:()=>a.cM,MyHextoRgb:()=>a.Dn,addElesFromIndexToArr:()=>a.Rn,angleToNum:()=>i.Zv,anima:()=>a.gY,arrayBufferToBase64:()=>a.sM,arrayBufferToBlobUr:()=>a.oo,arrayToVector3:()=>i.F,base64ToArrayBuffer:()=>a.RG,base64ToBlob:()=>a.Jr,bitMapToCanvas:()=>n.Rd,blobToFile:()=>a.hl,bufferToArrayBuffer:()=>a.cO,canvasToBlob:()=>a._c,changeModelOpc:()=>i.Hg,changeModelOpcs:()=>i.Z7,clone:()=>a.d9,colorToRgb:()=>i.sS,compressImgToUrl:()=>n.jH,deepFindParentByUuid:()=>i.Q3,deepMergeObject:()=>a.U,disposeCanvas:()=>n.eZ,disposeImageBitMap:()=>n.oZ,domTo2Dui:()=>i.UZ,domTo3DSprite:()=>i.YG,domTo3Dui:()=>i.ol,fileAndBlobToCanvas:()=>a.OE,fileToBlob:()=>a.a_,filterFiles:()=>a.Rz,fromCode:()=>a.Ne,getArrIndexByItem:()=>a.B1,getBetweenByV3:()=>i.A2,getBetweenDomByIdx:()=>l,getCamAnimaData:()=>i.Gm,getCenter:()=>i.qg,getClock:()=>i.aM,getColorByHex:()=>i.e9,getCurve:()=>i.kG,getDate:()=>a._3,getDiff:()=>a.ad,getDistance:()=>i.Sp,getEmptyImageData:()=>n.mH,getFilesByDataTransfer:()=>a.xl,getFilesFromFileList:()=>a.kk,getHexByColor:()=>i.J6,getIdxInParent:()=>o,getImg:()=>n.Pk,getImgPixels:()=>n.BW,getImgPixels1:()=>n.Cm,getLine2:()=>i.SI,getMacro:()=>a.Ls,getMapByRgb:()=>a.fh,getMd5:()=>a.ZM,getModelByType:()=>i.Py,getModelMap:()=>i.yT,getNamesByNum:()=>a.nR,getOptions:()=>s.FW,getProgress:()=>a.xC,getRGBByHex:()=>i.OR,getRandomColor:()=>a.mr,getRes:()=>a.sR,getResultFromCanvas:()=>n.xK,getTime:()=>a.hK,getTruthBase64:()=>a.Mh,getType:()=>a.oL,getTypeByBase64:()=>a.Op,getTypeFromGlb:()=>s.te,getVideoTexture:()=>i.hX,getWorldLocal:()=>i.VU,hslToRgb:()=>n.ve,imgArrayBufferToBlobUrl:()=>n.lU,imgBitMapToBase64:()=>n.s4,imgBitMapToBlob:()=>n.gW,imgBitMapToBlobAndBase64:()=>n.v1,isBlob:()=>a.Lj,isDef:()=>a.Xq,isEditor:()=>s.hz,isEmpty:()=>a.xb,isRunning:()=>s.An,isVisible:()=>i.pn,longestCommonPrefix:()=>a.GG,mergeObject:()=>a.Gm,removeUnLess:()=>i.hs,resetCenter:()=>i.cm,reverseImageBitMap:()=>n.Fs,reverseImg:()=>n.rx,rgbToHex:()=>i.vq,rgbToHsl:()=>n.lC,rgbToStr:()=>i.$W,rgbaToRgb:()=>i.Di,rmArrEle:()=>a.J9,rmPartOfString:()=>a.h3,sameArr:()=>a.F1,sameV3:()=>i.x$,setParentVisible:()=>i.FT,strToNum:()=>a.LC,tColorToRgb:()=>i.Lv,textureToThreeD:()=>i.vp,toCode:()=>a.Ni,toTimeString:()=>a.U9,transByte:()=>a.iM,typeAnima:()=>u,urlToBlob:()=>a.pX,urlToCanvas:()=>a.o4,v3ToMap:()=>i.ln,validType:()=>a.lG,vector:()=>i.xr});var n=r(5137),a=r(6272),i=r(8089),s=r(158);const o=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)};var c=r(8881);const u=(e,t,r)=>{const{}=r||{},n={},i={};e.map(((e,t)=>{const{begin:r,end:s,type:o,label:l}=e,u="_"+o+"_"+l+"_"+String(t);if("color"===o&&r instanceof c.Color&&s instanceof c.Color){const e=(0,a.I8)("#"+r.getHexString(),!0),t=(0,a.I8)("#"+s.getHexString(),!0);["r","g","b"].map((r=>{var a=r+u;n[a]=e[r],i[a]=t[r]}))}"number"===o&&(n[e=l+u]=r,i[e]=s),"vector3"===o&&["x","y","z"].map((e=>{var t=e+u;n[t]=r[e],i[t]=s[e]})),"vector2"===o&&["x","y"].map((e=>{var t=e+u;n[t]=r[e],i[t]=s[e]}))}))};u([{begin:new c.Color(.5,.5,.5),end:new c.Color(0,0,0),label:"color",type:"color"},{begin:1,end:2,label:"a",type:"number"},{begin:new c.Vector3(1,1,1),end:new c.Vector3(2,2,2),label:"b",type:"vector3"},{begin:new c.Vector2(1,1),end:new c.Vector2(2,2),label:"c",type:"vector2"}],1)},5137:(e,t,r)=>{r.d(t,{BW:()=>f,Cm:()=>p,Fs:()=>x,Pk:()=>b,Rd:()=>m,eZ:()=>w,gW:()=>l,jH:()=>d,lC:()=>g,lU:()=>h,mH:()=>M,oZ:()=>S,rx:()=>c,s4:()=>o,v1:()=>u,ve:()=>v,xK:()=>y});var n=r(5247),a=r(3625),i=r(6272),s=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const o=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=>s(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)}))}))})),c=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)},u=e=>s(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")),i=(0,a.getMimeByTexture)(e);return n.drawImage(t,0,0,r.width,r.height),new Promise((e=>{r.toBlob((t=>{e({blob:t,base64:r.toDataURL(i)})}),i)}))})),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=>s(void 0,void 0,void 0,(function*(){var{bitmap:t,texture:r}=e;const{ctx:a,canvas:s}=yield(0,i.OE)(URL.createObjectURL(r.userData.blob),{width:t.width,height:t.height});for(var o=a.getImageData(0,0,t.width,t.height,{colorSpace:"srgb"}),l=0,c=o.data.length;l<c;l+=4){var u=(d=g(o.data[l],o.data[l+1],o.data[l+2]))[0]/100,h=d[1]/100,d=d[2]/100;u=v(u,h,d),o.data[l]=u[0],o.data[l+1]=u[1],o.data[l+2]=u[2]}return a.putImageData(o,0,0),new n.Z.Texture(s)})),f=e=>{for(var t=(e=e.bitmap).width,r=e.height,n=m(e).ctx.getImageData(0,0,t,r).data,a=[],i=0;i<n/4;i+=1)a.push(n.slice(4*i,4*(i+1)))},m=e=>{const t=document.createElement("canvas"),r=t.getContext("2d");return r.drawImage(e,0,0,e.width,e.height),{ctx:r,canvas:t}},g=(e,t,r)=>{e/=255,t/=255,r/=255;var n,a=Math.max(e,t,r),i=Math.min(e,t,r),s=(a+i)/2;if(a==i)n=l=0;else{var o=a-i,l=.5<s?o/(2-a-i):o/(a+i);switch(a){case e:n=(t-r)/o+(t<r?6:0);break;case t:n=(r-e)/o+2;break;case r:n=(e-t)/o+4}n/=6}return[100*n,100*l,100*s]},v=(e,t,r)=>{var n,a,i,s;return 0==t?a=i=s=r:(a=(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),i=n(t,r,e),s=n(t,r,e-1/3)),[255*a,255*i,255*s]},b=e=>{const t=new Image;return t.src=e,new Promise((e=>{t.onload=()=>{e(t)}}))},y=(e,t,r)=>{const n=(0,i.Gm)({base64Type:"webp"},r).base64Type;return new Promise(((r,a)=>{"blob"===t?e.toBlob((e=>{(e?r:a)(e)})):"base64"===t&&r(e.toDataURL("image/"+n))}))},x=e=>s(void 0,void 0,void 0,(function*(){var{width:t,height:r}=e;const n=document.createElement("canvas"),a=(n.width=t,n.height=r,n.getContext("2d"));if(a)return a.translate(0,r),a.scale(1,-1),a.drawImage(e,0,0,t,r),{imageBitMap:yield createImageBitmap(a.getImageData(0,0,t,r)),canvas:n}})),w=e=>{e.remove()},S=e=>{e.close()},M=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__)=>{__webpack_require__.d(__webpack_exports__,{B1:()=>getArrIndexByItem,Dn:()=>MyHextoRgb,F1:()=>sameArr,GG:()=>longestCommonPrefix,Gm:()=>mergeObject,I8:()=>HextoRgb,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,_3:()=>getDate,_c:()=>canvasToBlob,a_:()=>fileToBlob,ad:()=>getDiff,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__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(6001),js_funcs__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__.n(js_funcs__WEBPACK_IMPORTED_MODULE_2__),_libs_Anima__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(2958),_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(3263),_UtilsImage__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(5137),__awaiter=function(e,t,r,n){return new(r=r||Promise)((function(a,i){function s(e){try{l(n.next(e))}catch(e){i(e)}}function o(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r((function(e){e(t)}))).then(s,o)}l((n=n.apply(e,t||[])).next())}))};const anima=(e,t,r,n,a)=>{let i=Object.assign({},e),s=new _libs_Anima__WEBPACK_IMPORTED_MODULE_3__.Q3(i,r,t).eventCallback("onUpdate",(e=>n&&n(i))).eventCallback("onComplete",(e=>{a&&a(),_libs_Anima__WEBPACK_IMPORTED_MODULE_3__.Q3.killTweensOf(s)}));return s},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]),a=n.length,i=new Uint8Array(a);for(;a--;)i[a]=n.charCodeAt(a);return new Blob([i],{type:r})},fileToBlob=e=>__awaiter(void 0,void 0,void 0,(function*(){return base64ToBlob(yield(0,js_funcs__WEBPACK_IMPORTED_MODULE_2__.parseFile)(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,a=(n.src=e,n.width=t,n.height=r,document.createElement("canvas")),i=(a.width=t,a.height=r,a.getContext("2d"));return new Promise((e=>{n.onload=function(){i.drawImage(n,0,0,a.width,a.height),e({canvas:a,ctx:i})}}))},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,a)=>e+(a+r)+(n||""))),getType=e=>null==e?void 0:e.toString().replace(/(\[object )([a-zA-Z]+)(])/,"$2"),deepMergeObject=(e,t)=>((0,js_funcs__WEBPACK_IMPORTED_MODULE_2__.mapObj)(e,((r,n)=>{let a=t[r];void 0!==a&&("Object"===getType(n)&&"Object"===getType(a)&&(a=deepMergeObject(n,a)),e[r]=a)})),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,a=key.split(""),i="",s=0;s<e.length;s++)i+=a[((r=((r=e.charCodeAt(s))-(t=r%n))/n)-(r%=n))/n%n]+a[r]+a[t];return i},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,a]of e)if(n!==t[a])return!1;return!0}var i=e.length;const s=Math.floor(i/r);for(const n of new Array(r).fill("").map(((e,t)=>(t+1)*s)))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 a=0;a<=e[n].length;a++){if(t[a]!=e[n][a]){t=r;break}r+=t[a]}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},isDef=(e,t)=>e instanceof Array?_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__.F6.isDef(e,t):_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__.YD.is(e)?_Ex_Ex__WEBPACK_IMPORTED_MODULE_4__.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 r={r:0,g:0,b:0};for(let e=0;e<rgbArr.length;e++){var n=rgbArr[e],a=t[e];if(!a)return;a=strToNum(a),r[n]=a}return r};function HextoRgb(e,t){if(-1!==e.toLocaleLowerCase().indexOf("rgb"))return e;if(/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(e)){if(4===e.length){for(var r="#",n=1;n<4;n+=1)r+=e.slice(n,n+1).concat(e.slice(n,n+1));e=r}var a,i,s=[];for(n=1;n<7;n+=2)s.push(parseInt("0x"+e.slice(n,n+2)));return t?([t,a,i]=s,{r:t,g:a,b:i}):"RGB("+s.join(",")+")"}return e}const getDiff=(e,t,r=0)=>{const n={};return(0,js_funcs__WEBPACK_IMPORTED_MODULE_2__.mapObj)(e,((e,r)=>{var a=t[e];isDef(r,a)&&(n[e]=a)})),n};function MyHextoRgb(e,t){if(-1!==(e=e.toLocaleLowerCase().slice(1)).indexOf("rgb"))return e;var[e,r,n,a,i,s]=e.split(""),r=(e=parseInt("0x"+e+r),parseInt("0x"+n+a)),n=parseInt("0x"+i+s);return t?{r:e,g:r,b:n}:"RGB("+e+","+r+","+n+")"}const getDate=e=>{const t=new Date(e);return t.getFullYear()+"/"+String(t.getMonth()+1).padStart(2,"0")+"/"+String(t.getDate()).padStart(2,"0")}},158:(e,t,r)=>{r.d(t,{An:()=>i,FW:()=>s,hz:()=>a,te:()=>n});const n=e=>{},a=e=>"editor"===e.optionsEx.options.mode,i=e=>"running"===e.optionsEx.options.mode,s=e=>e.optionsEx.options},8089:(e,t,r)=>{r.d(t,{Zv:()=>he,F:()=>ce,Hg:()=>ne,Z7:()=>ae,sS:()=>Se,Q3:()=>Pe,UZ:()=>te,YG:()=>re,ol:()=>ee,A2:()=>fe,Gm:()=>pe,qg:()=>Ee,aM:()=>me,e9:()=>ge,kG:()=>le,Sp:()=>$,J6:()=>ve,SI:()=>ue,Py:()=>De,yT:()=>de,OR:()=>be,hX:()=>oe,VU:()=>Y,pn:()=>Oe,hs:()=>se,cm:()=>Ce,vq:()=>Te,$W:()=>xe,Di:()=>Me,x$:()=>ye,FT:()=>Ae,Lv:()=>we,vp:()=>ie,ln:()=>_e,xr:()=>J});var n=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 i(e,t){return(i=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=o(e);if(r=t?(r=o(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 o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var l=new n.Box3,c=new n.Vector3,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&&i(t,e);var r=s(a);function a(){var e;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");return(e=r.call(this)).isLineSegmentsGeometry=!0,e.type="LineSegmentsGeometry",e.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),e.setAttribute("position",new n.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),e.setAttribute("uv",new n.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),e}return t=a,(e=[{key:"applyMatrix4",value:function(e){var t=this.attributes.instanceStart,r=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),r.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"setPositions",value:function(e){var t;return e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e)),e=new n.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceStart",new n.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceEnd",new n.InterleavedBufferAttribute(e,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}},{key:"setColors",value:function(e){var t;return e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e)),e=new n.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceColorStart",new n.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceColorEnd",new n.InterleavedBufferAttribute(e,3,3)),this}},{key:"fromWireframeGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromEdgesGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromMesh",value:function(e){return this.fromWireframeGeometry(new n.WireframeGeometry(e.geometry)),this}},{key:"fromLineSegments",value:function(e){return e=e.geometry,this.setPositions(e.attributes.position.array),this}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new n.Box3);var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),l.setFromBufferAttribute(t),this.boundingBox.union(l))}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new n.Sphere),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){for(var r=this.boundingSphere.center,a=(this.boundingBox.getCenter(r),0),i=0,s=e.count;i<s;i++)c.fromBufferAttribute(e,i),a=Math.max(a,r.distanceToSquared(c)),c.fromBufferAttribute(t,i),a=Math.max(a,r.distanceToSquared(c));this.boundingSphere.radius=Math.sqrt(a),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}),a}(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)}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=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&&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)}}(a);function a(e){var t;if(this instanceof a)return(t=r.call(this,{type:"LineMaterial",uniforms:n.UniformsUtils.clone(n.ShaderLib.line.uniforms),vertexShader:n.ShaderLib.line.vertexShader,fragmentShader:n.ShaderLib.line.fragmentShader,clipping:!0})).isLineMaterial=!0,Object.defineProperties(p(t),{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(e){!0===e?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashed:{enumerable:!0,get:function(){return Boolean("USE_DASH"in this.defines)},set:function(e){Boolean(e)!==Boolean("USE_DASH"in this.defines)&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},alphaToCoverage:{enumerable:!0,get:function(){return Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)},set:function(e){Boolean(e)!==Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),!0===e?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),t.setValues(e),t;throw new TypeError("Cannot call a class as a function")}return t=a,Object.defineProperty(t,"prototype",{writable:!1}),t}(n.ShaderMaterial);function g(e){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var y,x,w=new n.Vector3,S=new n.Vector3,M=new n.Vector4,T=new n.Vector4,_=new n.Vector4,E=new n.Vector3,k=new n.Matrix4,D=new n.Line3,P=new n.Vector3,A=new n.Box3,O=new n.Sphere,C=new n.Vector4;function R(e,t,r){return C.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),C.multiplyScalar(1/C.w),C.x=x/r.width,C.y=x/r.height,C.applyMatrix4(e.projectionMatrixInverse),C.multiplyScalar(1/C.w),Math.abs(Math.max(C.x,C.y))}var L=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&&v(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=b(e);if(r=t?(r=b(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===g(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(a);function a(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new u,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new m({color:16777215*Math.random()}),n=this,i=a;if(n instanceof i)return(n=r.call(this,e,t)).isLineSegments2=!0,n.type="LineSegments2",n;throw new TypeError("Cannot call a class as a function")}return t=a,(e=[{key:"computeLineDistances",value:function(){for(var e=this.geometry,t=e.attributes.instanceStart,r=e.attributes.instanceEnd,a=new Float32Array(2*t.count),i=0,s=0,o=t.count;i<o;i++,s+=2)w.fromBufferAttribute(t,i),S.fromBufferAttribute(r,i),a[s]=0===s?0:a[s-1],a[s+1]=a[s]+w.distanceTo(S);var l=new n.InstancedInterleavedBuffer(a,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,a=e.camera,i=(null!==a||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),s=(y=e.ray,e=this.matrixWorld,this.geometry),o=this.material;if(x=o.linewidth+i,null===s.boundingSphere&&s.computeBoundingSphere(),O.copy(s.boundingSphere).applyMatrix4(e),i=r?.5*x:R(a,Math.max(a.near,O.distanceToPoint(y.origin)),o.resolution),O.radius+=i,!1!==y.intersectsSphere(O)&&(null===s.boundingBox&&s.computeBoundingBox(),A.copy(s.boundingBox).applyMatrix4(e),i=r?.5*x:R(a,Math.max(a.near,A.distanceToPoint(y.origin)),o.resolution),A.expandByScalar(i),!1!==y.intersectsBox(A)))if(r)for(var l=this,c=t,u=l.matrixWorld,h=(s=l.geometry).attributes.instanceStart,d=s.attributes.instanceEnd,p=0,f=Math.min(s.instanceCount,h.count);p<f;p++){D.start.fromBufferAttribute(h,p),D.end.fromBufferAttribute(d,p),D.applyMatrix4(u);var m=new n.Vector3,g=new n.Vector3;y.distanceSqToSegment(D.start,D.end,g,m),g.distanceTo(m)<.5*x&&c.push({point:g,pointOnLine:m,distance:y.origin.distanceTo(g),object:l,face:null,faceIndex:p,uv:null,uv2:null})}else{var v=this,b=t,w=(e=a).projectionMatrix,S=v.material.resolution,C=v.matrixWorld,L=(o=v.geometry).attributes.instanceStart,I=o.attributes.instanceEnd,B=(o=Math.min(o.instanceCount,L.count),-e.near);y.at(1,_),_.w=1,_.applyMatrix4(e.matrixWorldInverse),_.applyMatrix4(w),_.multiplyScalar(1/_.w),_.x*=S.x/2,_.y*=S.y/2,_.z=0,E.copy(_),k.multiplyMatrices(e.matrixWorldInverse,C);for(var U,j,F,N,z=0,V=o;z<V;z++)M.fromBufferAttribute(L,z),T.fromBufferAttribute(I,z),M.w=1,T.w=1,M.applyMatrix4(k),T.applyMatrix4(k),M.z>B&&T.z>B||(M.z>B?(U=M.z-T.z,U=(M.z-B)/U,M.lerp(T,U)):T.z>B&&(U=T.z-M.z,j=(T.z-B)/U,T.lerp(M,j)),M.applyMatrix4(w),T.applyMatrix4(w),M.multiplyScalar(1/M.w),T.multiplyScalar(1/T.w),M.x*=S.x/2,M.y*=S.y/2,T.x*=S.x/2,T.y*=S.y/2,D.start.copy(M),D.start.z=0,D.end.copy(T),D.end.z=0,j=D.closestPointToPointParameter(E,!0),D.at(j,P),F=-1<=(F=n.MathUtils.lerp(M.z,T.z,j))&&F<=1,N=E.distanceTo(P)<.5*x,F&&N&&(D.start.fromBufferAttribute(L,z),D.end.fromBufferAttribute(I,z),D.start.applyMatrix4(C),D.end.applyMatrix4(C),F=new n.Vector3,N=new n.Vector3,y.distanceSqToSegment(D.start,D.end,N,F),b.push({point:N,pointOnLine:F,distance:y.origin.distanceTo(N),object:v,face:null,faceIndex:z,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}),a}(n.Mesh);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 B(){return(B="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 U(e,t){return(U=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)}var F=function(){var e=n,t=u;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);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"===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")}}(n);function n(){var e;if(this instanceof n)return(e=r.call(this)).isLineGeometry=!0,e.type="LineGeometry",e;throw new TypeError("Cannot call a class as a function")}return e=n,(t=[{key:"setPositions",value:function(e){for(var t=e.length-3,r=new Float32Array(2*t),a=0;a<t;a+=3)r[2*a]=e[a],r[2*a+1]=e[a+1],r[2*a+2]=e[a+2],r[2*a+3]=e[a+3],r[2*a+4]=e[a+4],r[2*a+5]=e[a+5];return B(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),a=0;a<t;a+=3)r[2*a]=e[a],r[2*a+1]=e[a+1],r[2*a+2]=e[a+2],r[2*a+3]=e[a+3],r[2*a+4]=e[a+4],r[2*a+5]=e[a+5];return B(j(n.prototype),"setColors",this).call(this,r),this}},{key:"fromLine",value:function(e){return e=e.geometry,this.setPositions(e.attributes.position.array),this}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),n}();function N(e){return(N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function z(e,t){return(z=Object.setPrototypeOf||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)}var G=function(){var e=n,t=L;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&z(e,t);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=V(e);if(r=t?(r=V(this).constructor,Reflect.construct(n,arguments,r)):n.apply(this,arguments),n=this,r&&("object"===N(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(n);function n(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new F,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new m({color:16777215*Math.random()}),a=this,i=n;if(a instanceof i)return(a=r.call(this,e,t)).isLine2=!0,a.type="Line2",a;throw new TypeError("Cannot call a class as a function")}return e=n,Object.defineProperty(e,"prototype",{writable:!1}),e}(),H=r(699),W=r(3693),q=r(3263),K=(t=r(5247),r(932)),Z=r(6272);const X={uniforms:{uSeaFreq:{value:.16},uSeaHeight:{value:.6},uSeaChoppy:{value:4},uTime:{value:0},uCamPosition:{value:new n.Vector3(0,0,0)},uDirection:{value:null}},vertexShader:"\n const mat2 octave_m = mat2(1.6, 1.2, -1.2, 1.6);\n \n uniform float uSeaFreq;\n uniform float uSeaHeight;\n uniform float uSeaChoppy;\n uniform float uTime;\n \n varying vec2 vUv;\n varying vec3 vPosition;\n varying vec3 vWorldPos;\n \n float hash(vec2 p) {\n float h = dot(p, vec2(127.1, 311.7));\n return fract(sin(h) * 43758.5453123);\n }\n float noise(in vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n vec2 u = f * f * (3.0 - 2.0 * f);\n float xMix1 = mix(hash(i + vec2(0.0)), hash(i + vec2(1.0, 0.0)), u.x);\n float xMix2 = mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0)), u.x);\n return -1.0 + 2.0 * mix(xMix1, xMix2, u.y);\n }\n \n float sea_octave(vec2 uv, float choppy) {\n uv += noise(uv);\n vec2 wv = 1.0 - abs(sin(uv));\n vec2 swv = abs(cos(uv));\n wv = mix(wv, swv, wv);\n return pow(1.0 - pow(wv.x * wv.y, 0.65), choppy);\n }\n float getWave(vec2 uv) {\n float freq = uSeaFreq;\n float amp = uSeaHeight;\n float choppy = uSeaChoppy;\n float d, h = 0.0;\n \n for(int i = 0; i < 5; i++) {\n d = sea_octave((uv + uTime) * freq, choppy);\n d += sea_octave((uv - uTime) * freq, choppy);\n h += d * amp;\n uv *= octave_m;\n freq *= 1.9;\n amp *= 0.22;\n choppy = mix(choppy, 1.0, 0.2);\n }\n \n return h;\n }\n \n void main() {\n vec4 pos = vec4(position, 1.0);\n //模型空间坐标,z轴是高度,xy轴是平面\n vUv = pos.xy * 1.0;\n pos.z += getWave(vUv) * 1.0;\n vPosition = vec3(pos.x, pos.z, pos.y);\n vWorldPos = (modelMatrix * pos).xyz;\n \n gl_Position = projectionMatrix * modelViewMatrix * pos;\n }\n ",fragmentShader:"\n #define PI 3.14159265359\n #define invPI 0.3183098861837697\n #define invTWO_PI 0.15915494309\n \n const vec3 SEA_BASE = vec3(0.1, 0.19, 0.22);\n const vec3 SEA_WATER_COLOR = vec3(0.8, 0.9, 0.6);\n const mat2 octave_m = mat2(1.6, 1.2, -1.2, 1.6);\n \n uniform float uSeaFreq;\n uniform float uSeaHeight;\n uniform float uSeaChoppy;\n uniform float uTime;\n uniform vec3 uCamPosition;\n uniform vec3 uDirection;\n \n varying vec2 vUv;\n varying vec3 vPosition;\n varying vec3 vWorldPos;\n \n // Math\n float hash(vec2 p) {\n float h = dot(p, vec2(127.1, 311.7));\n return fract(sin(h) * 43758.5453123);\n }\n float noise(in vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n vec2 u = f * f * (3.0 - 2.0 * f);\n float xMix1 = mix(hash(i + vec2(0.0)), hash(i + vec2(1.0, 0.0)), u.x);\n float xMix2 = mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0)), u.x);\n return -1.0 + 2.0 * mix(xMix1, xMix2, u.y);\n }\n \n // Lighting\n float diffuse(vec3 n, vec3 l, float p) {\n return pow(dot(n, l) * 0.4 + 0.6, p);\n }\n float specular(vec3 n,vec3 l,vec3 e,float s) {\n float nrm = (s + 8.0) / (PI * 8.0);\n return pow(max(dot(reflect(e, n), l), 0.0), s) * nrm;\n }\n \n // Sky\n vec3 getSkyColor(vec3 e) {\n e.y = (max(e.y, 0.0) * 0.8 + 0.2) * 0.8;\n return vec3(pow(1.0 - e.y, 2.0), 1.0 - e.y, 0.6 + (1.0 - e.y) * 0.45) * 0.45;\n }\n \n // Sea\n float sea_octave(vec2 uv, float choppy) {\n uv += noise(uv);\n vec2 wv = 1.0 - abs(sin(uv));\n vec2 swv = abs(cos(uv));\n wv = mix(wv, swv, wv);\n return pow(1.0 - pow(wv.x * wv.y, 0.65), choppy);\n }\n float map_detailed(vec3 p) {\n float freq = uSeaFreq;\n float amp = uSeaHeight;\n float choppy = uSeaChoppy;\n vec2 uv = p.xz;\n uv.x *= 0.75;\n \n float d, h = 0.0;\n for(int i = 0; i < 5; i++) {\n d = sea_octave((uv + uTime) * freq, choppy);\n d += sea_octave((uv - uTime) * freq, choppy);\n h += d * amp;\n uv *= octave_m;\n freq *= 1.9;\n amp *= 0.22;\n choppy = mix(choppy, 1.0, 0.2);\n }\n return p.y - h;\n }\n vec3 getSeaColor(vec3 p, vec3 n, vec3 l, vec3 eye, vec3 dist) {\n float fresnel = clamp(1.0 - dot(n, -eye), 0.0, 1.0);\n fresnel = pow(fresnel, 3.0) * 0.5;\n \n vec3 reflected = getSkyColor(reflect(eye, n));\n vec3 refracted = SEA_BASE + diffuse(n, l, 80.0) * SEA_WATER_COLOR * 0.12;\n \n vec3 color = mix(refracted, reflected, fresnel);\n \n float attenuation = max(1.0 - dot(dist, dist) * 0.001, 0.0);\n color += SEA_WATER_COLOR * (p.y - uSeaHeight) * 0.18 * attenuation;\n color += vec3(specular(n, l, eye, 60.0));\n \n return color;\n }\n \n // Sea Wave\n float getWave(vec2 uv) {\n float freq = uSeaFreq;\n float amp = uSeaHeight;\n float choppy = uSeaChoppy;\n float d, h = 0.0;\n \n for(int i = 0; i < 5; i++) {\n d = sea_octave((uv + uTime) * freq, choppy);\n d += sea_octave((uv - uTime) * freq, choppy);\n h += d * amp;\n uv *= octave_m;\n freq *= 1.9;\n amp *= 0.22;\n choppy = mix(choppy, 1.0, 0.2);\n }\n \n return h;\n }\n \n // Tracing\n vec3 getNormal(vec3 p, float eps) {\n vec3 n;\n n.y = map_detailed(p);\n n.x = map_detailed(vec3(p.x + eps, p.y, p.z)) - n.y;\n n.z = map_detailed(vec3(p.x, p.y, p.z + eps)) - n.y;\n n.y = eps;\n return normalize(n);\n }\n \n void main() {\n vec3 light = normalize(vec3(0.0, 1.0, 0.8));\n vec3 dist = vWorldPos - uCamPosition;\n vec3 dir = normalize(dist);\n \n // 此数值控制生成水面法线的范围, 数值与范围成反比\n float EPSILON_NRM = 0.00003;\n vec3 N = getNormal(vWorldPos, dot(dist, dist) * EPSILON_NRM);\n vec3 color = getSeaColor(vWorldPos, N, light, dir, dist);\n \n // gl_FragColor = vec4(vPosition, 1.0);\n // gl_FragColor = vec4(vWorldPos, 1.0);\n // gl_FragColor = vec4(normalize(N), 1.0);\n gl_FragColor = vec4(pow(color, vec3(0.75)), 1.0);\n }\n "},Q=t.Z,Y=(e,t)=>(t.updateMatrixWorld(!0),t=new Q.Vector3,e.getWorldPosition(t),t),J={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}}},$=(e,t)=>e.distanceTo(t),ee=e=>new W.cp(e),te=e=>new H.j(e),re=e=>new W.P7(e),ne=(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)},ae=(e,t,r)=>{"Group"===e.type||"Object3D"===e.type?e.children.forEach((e=>ae(e,t,r))):ne(e,t,r)},ie=e=>(e.mapping=n.EquirectangularReflectionMapping,e),se=e=>{let t=e=>"Group"!==e.type&&"Object3D"!==e.type||1!==e.children.length?e:t(e.children[0]);return t(e)},oe=(e,t)=>{let r=document.createElement("video");return r.style="position:absolute;top:0;left:0;z-index:1000000;",r.src=e,r.loop="loop",r.muted="muted",r.play(),t.appendChild(r),new n.VideoTexture(r)},le=(e,t=!1)=>{let r=new n.CatmullRomCurve3(e),a=new n.BufferGeometry;e=r.getSpacedPoints(100),a.setFromPoints(e),e=new n.LineBasicMaterial({color:26214});let i=new n.Line(a,e);return i.visible=t,{line:i,curve:r}},ce=e=>{let t=0;const r=[],a={},i={0:"x",1:"y",2:"z"};return e.map((e=>{var s,o,l;3===t&&(t=0,({x:s,y:o,z:l}=a),r.push(new n.Vector3(s,o,l))),a[i[t]]=e,t++})),r},ue=e=>{var{pointArray:e,material:t,lineWidth:r,colorArray:a}=e;const i=new F,s=(i.setPositions(e),t||new m({transparent:!0,side:n.DoubleSide,linewidth:r||5,vertexColors:!0})),o=(i.setColors(a||[1,1,1]),s.resolution.set(window.innerWidth,window.innerHeight),new G(i,s));return o.name="gw",o.computeLineDistances(),o},he=e=>3.1415926*e/180,de=(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},pe=(e,t,r,n,a,i)=>({cx:e,cy:t,cz:r,tx:n,ty:a,tz:i}),fe=(e,t)=>{var{x:e,y:r,z:n}=e,{x:t,y:a,z:i}=t;return{x:e-t,y:r-a,z:n-i}},me=()=>new Q.Clock,ge=e=>{var{r:e,g:t,b:r}=(0,Z.fh)((0,Z.I8)(e.includes("#")?e:"#"+e));return new Q.Color(e,t,r)},ve=e=>"#"+e.getHexString(),be=e=>e.r?e:(0,Z.fh)((0,Z.I8)(e.includes("#")?e:"#"+e)),ye=(e,t)=>e.x===t.x&&e.y===t.y&&e.z===t.z,xe=e=>{const{r:t,g:r,b:n}=e;return"rgb("+[t,r,n].map((e=>1<e?e:255*e)).join(",")+")"},we=e=>{var{r:e,g:t,b:r}=e;return{r:e,g:t,b:r}},Se=e=>{let t=e;return(0,K.isColor)(e)?t=we(e):q.YD.is(e)||(t=(0,Z.I8)(e,!0)),t},Me=e=>-1===e.toLocaleLowerCase().indexOf("rgba")?e:e.replace(/[a]/,"").split(",").slice(0,-1)+")",Te=e=>{if(-1!==(e=e.toLocaleLowerCase()).indexOf("#"))return e;if(e=Me(e),/^(rgb|RGB)/.test(e)){for(var t="#",r=e.replace(/(?:\(|\)|rgb|RGB)*/g,"").split(","),n=0;n<r.length;n++){var a=Number(r[n]).toString(16);"0"===a&&(a+=a),t+=a}return t}return String(e)},_e=e=>{var{x:e,y:t,z:r}=e;return{x:e,y:t,z:r}},Ee=e=>(new n.Box3).expandByObject(e).getCenter(e),ke={water(e){var t=new Q.PlaneBufferGeometry(256,256,127,127);const r=new n.ShaderMaterial({name:"WaterMaterial",uniforms:X.uniforms,vertexShader:X.vertexShader,fragmentShader:X.fragmentShader}),a=new n.Mesh(t,r),i=(a.rotateX(-.5*Math.PI),new n.Clock);return setInterval((()=>{r.uniforms.uTime.value+=i.getDelta(),r.uniforms.uCamPosition.value=e.position}),16.6),a}},De=(e,t)=>{let r,a;switch(e){case"Group":r=new Q.Group;break;case"Box":a=new Q.BoxBufferGeometry(1,1,1,1,1,1),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Circle":a=new Q.CircleBufferGeometry(1,8,0,2*Math.PI),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Cylinder":a=new Q.CylinderBufferGeometry(1,1,1,8,1,!1,0,2*Math.PI),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Dodecahedron":a=new Q.DodecahedronBufferGeometry(1,0),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Icosahedron":a=new Q.IcosahedronBufferGeometry(1,0),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Lathe":var i=[new Q.Vector2(0,0),new Q.Vector2(.4,0),new Q.Vector2(.35,.05),new Q.Vector2(.1,.075),new Q.Vector2(.08,.1),new Q.Vector2(.08,.4),new Q.Vector2(.1,.42),new Q.Vector2(.14,.48),new Q.Vector2(.2,.5),new Q.Vector2(.25,.54),new Q.Vector2(.3,1.2)];a=new Q.LatheBufferGeometry(i,12,0,2*Math.PI),r=new Q.Mesh(a,new Q.MeshStandardMaterial({side:Q.DoubleSide}));break;case"Octahedron":a=new Q.OctahedronBufferGeometry(1,0),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Plane":a=new Q.PlaneBufferGeometry(1,1,1,1),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Ring":a=new Q.RingBufferGeometry(.5,1,8,1,0,2*Math.PI),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Sphere":a=new Q.SphereBufferGeometry(1,8,6,0,2*Math.PI,0,Math.PI),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Sprite":r=new Q.Sprite(new Q.SpriteMaterial);break;case"Tetrahedron":a=new Q.TetrahedronBufferGeometry(1,0),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Torus":a=new Q.TorusBufferGeometry(1,.4,8,6,2*Math.PI),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"TorusKnot":a=new Q.TorusKnotBufferGeometry(1,.4,64,8,2,3),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"Tube":i=new Q.CatmullRomCurve3([new Q.Vector3(2,2,-2),new Q.Vector3(2,-2,-.6666666666666667),new Q.Vector3(-2,-2,.6666666666666667),new Q.Vector3(-2,2,2)]),a=new Q.TubeBufferGeometry(i,64,1,8,!1),r=new Q.Mesh(a,new Q.MeshStandardMaterial);break;case"water":r=ke.water(t?t.camera:{position:new n.Vector3})}if(r)return r.name=e,r},Pe=(()=>{const e=(t,r)=>!!(t=t.parent)&&"Scene"!==t.type&&(t.uuid===r?t:e(t,r));return(t,r)=>{if(t&&r)return e(t,r)}})(),Ae=(()=>{const e=(t,r)=>t.parent&&"Scene"!==t.parent.type?(t.parent.visible!==r&&(t.parent.visible=r),e(t.parent,r)):null;return(t,r)=>t?e(t,r):null})(),Oe=e=>"Scene"===e.type||!!e.visible&&!!e.parent&&Oe(e.parent),Ce=(e,t=!1)=>{var[r,a,i]=e.geometry.attributes.position.array,[s,o,l]=(e.geometry.center(),e.geometry.attributes.position.array),{x:c,y:u,z:h}=e.position,c=new n.Vector3(c-(s-r),u-(o-a),h-(l-i));return t&&e.position.copy(c),c}},1129:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__1129__},3300:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__3300__},6001:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__6001__},8881:e=>{e.exports=__WEBPACK_EXTERNAL_MODULE__8881__},8624:(e,t,r)=>{r.d(t,{Ys:()=>M});var n=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 i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(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&&s(e.prototype,t),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1})}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=p(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 c(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 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=p(e);if(r=t?(r=p(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");return d(n)}}function d(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:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var f=new n.Raycaster,m=new n.Vector3,g=new n.Vector3,v=new n.Quaternion,b={X:new n.Vector3(1,0,0),Y:new n.Vector3(0,1,0),Z:new n.Vector3(0,0,1)},y={type:"change"},x={type:"mouseDown"},w={type:"mouseUp",mode:null},S={type:"objectChange"},M=function(){c(t,n.Object3D);var e=h(t);function t(r,a){i(this,t),s=e.call(this),void 0===a&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),a=document),s.isTransformControls=!0,s.visible=!1,s.domElement=a,s.domElement.style.touchAction="none";var s,o=new F,l=(s._gizmo=o,s.add(o),new N),c=(s._plane=l,s.add(l),d(s));function u(e,t){var r=t;Object.defineProperty(c,e,{get:function(){return void 0!==r?r:t},set:function(t){r!==t&&(r=t,l[e]=t,o[e]=t,c.dispatchEvent({type:e+"-changed",value:t}),c.dispatchEvent(y))}}),c[e]=t,l[e]=t,o[e]=t}u("camera",r),u("object",void 0),u("enabled",!0),u("axis",null),u("mode","translate"),u("translationSnap",null),u("rotationSnap",null),u("scaleSnap",null),u("space","world"),u("size",1),u("dragging",!1),u("showX",!0),u("showY",!0),u("showZ",!0),a=new n.Vector3,r=new n.Vector3;var h=new n.Quaternion,p=new n.Quaternion,f=new n.Vector3,m=new n.Quaternion,g=new n.Vector3,v=new n.Vector3,b=new n.Vector3,x=new n.Vector3;return u("worldPosition",a),u("worldPositionStart",r),u("worldQuaternion",h),u("worldQuaternionStart",p),u("cameraPosition",f),u("cameraQuaternion",m),u("pointStart",g),u("pointEnd",v),u("rotationAxis",b),u("rotationAngle",0),u("eye",x),s._offset=new n.Vector3,s._startNorm=new n.Vector3,s._endNorm=new n.Vector3,s._cameraScale=new n.Vector3,s._parentPosition=new n.Vector3,s._parentQuaternion=new n.Quaternion,s._parentQuaternionInv=new n.Quaternion,s._parentScale=new n.Vector3,s._worldScaleStart=new n.Vector3,s._worldQuaternionInv=new n.Quaternion,s._worldScale=new n.Vector3,s._positionStart=new n.Vector3,s._quaternionStart=new n.Quaternion,s._scaleStart=new n.Vector3,s._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(d(s)),s._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(d(s)),s._onPointerHover=function(e){if(this.enabled)switch(e.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(e))}}.bind(d(s)),s._onPointerMove=function(e){this.enabled&&this.pointerMove(this._getPointer(e))}.bind(d(s)),s._onPointerUp=function(e){this.enabled&&(this.domElement.releasePointerCapture(e.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(e)))}.bind(d(s)),s.domElement.addEventListener("pointerdown",s._onPointerDown),s.domElement.addEventListener("pointermove",s._onPointerHover),s.domElement.addEventListener("pointerup",s._onPointerUp),s}return o(t,[{key:"updateMatrixWorld",value:function(){void 0!==this.object&&(this.object.updateMatrixWorld(),null===this.object.parent?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),l(p(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=T(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=T(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,x.mode=this.mode,this.dispatchEvent(x))}},{key:"pointerMove",value:function(e){var t=this.axis,r=this.mode,n=this.object,a=this.space;"scale"===r?a="local":"E"!==t&&"XYZE"!==t&&"XYZ"!==t||(a="world"),void 0!==n&&null!==t&&!1!==this.dragging&&-1===e.button&&(f.setFromCamera(e,this.camera),(e=T(this._plane,f,!0))&&(this.pointEnd.copy(e.point).sub(this.worldPositionStart),"translate"===r?(this._offset.copy(this.pointEnd).sub(this.pointStart),"local"===a&&"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"===a&&"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"===a&&(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"===a&&(n.parent&&n.position.add(m.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(m.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),g.set(e,e,e)):(m.copy(this.pointStart),g.copy(this.pointEnd),m.applyQuaternion(this._worldQuaternionInv),g.applyQuaternion(this._worldQuaternionInv),g.divide(m),-1===t.search("X")&&(g.x=1),-1===t.search("Y")&&(g.y=1),-1===t.search("Z")&&(g.z=1)),n.scale.copy(this._scaleStart).multiply(g),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(m.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(m.copy(this.rotationAxis).cross(this.eye))*e):"X"!==t&&"Y"!==t&&"Z"!==t||(this.rotationAxis.copy(b[t]),m.copy(b[t]),"local"===a&&m.applyQuaternion(this.worldQuaternion),this.rotationAngle=this._offset.dot(m.cross(this.eye).normalize())*e),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),"local"===a&&"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(S)))}},{key:"pointerUp",value:function(e){0===e.button&&(this.dragging&&null!==this.axis&&(w.mode=this.mode,this.dispatchEvent(w)),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(S),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}}]),t}();function T(e,t,r){for(var n=t.intersectObject(e,!0),a=0;a<n.length;a++)if(n[a].object.visible||r)return n[a];return!1}var _=new n.Euler,E=new n.Vector3(0,1,0),k=new n.Vector3(0,0,0),D=new n.Matrix4,P=new n.Quaternion,A=new n.Quaternion,O=new n.Vector3,C=new n.Matrix4,R=new n.Vector3(1,0,0),L=new n.Vector3(0,1,0),I=new n.Vector3(0,0,1),B=new n.Vector3,U=new n.Vector3,j=new n.Vector3,F=function(){c(t,n.Object3D);var e=h(t);function t(){i(this,t),(r=e.call(this)).isTransformControlsGizmo=!0,r.type="TransformControlsGizmo";var r,a=new n.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),s=new n.LineBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),o=a.clone(),l=((((o.opacity=.15,s=s.clone()).opacity=.5,w=a.clone()).color.setHex(16711680),S=a.clone()).color.setHex(65280),a.clone()),c=(l.color.setHex(255),a.clone()),u=(c.color.setHex(16711680),c.opacity=.5,a.clone()),h=(u.color.setHex(65280),u.opacity=.5,a.clone()),d=(h.color.setHex(255),h.opacity=.5,a.clone());(d.opacity=.25,y=a.clone()).color.setHex(16776960),y.opacity=.25,a.clone().color.setHex(16776960);var p=(((a=a.clone()).color.setHex(7895160),g=new n.CylinderGeometry(0,.04,.1,12)).translate(0,.05,0),new n.BoxGeometry(.08,.08,.08)),f=(p.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}(f.setAttribute("position",new n.Float32BufferAttribute([0,0,0,1,0,0],3)),M=new n.CylinderGeometry(.0075,.0075,.5,3)).translate(0,.25,0);var g={X:[[new n.Mesh(g,w),[.5,0,0],[0,0,-Math.PI/2]],[new n.Mesh(g,w),[-.5,0,0],[0,0,Math.PI/2]],[new n.Mesh(M,w),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new n.Mesh(g,S),[0,.5,0]],[new n.Mesh(g,S),[0,-.5,0],[Math.PI,0,0]],[new n.Mesh(M,S)]],Z:[[new n.Mesh(g,l),[0,0,.5],[Math.PI/2,0,0]],[new n.Mesh(g,l),[0,0,-.5],[-Math.PI/2,0,0]],[new n.Mesh(M,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),c.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),u.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},v={X:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new n.Mesh(new n.OctahedronGeometry(.2,0),o)]],XY:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]]},b={START:[[new n.Mesh(new n.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],END:[[new n.Mesh(new n.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],DELTA:[[new n.Line(((b=new n.BufferGeometry).setAttribute("position",new n.Float32BufferAttribute([0,0,0,1,1,1],3)),b),s),null,null,null,"helper"]],X:[[new n.Line(f,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new n.Line(f,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new n.Line(f,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},y=(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),S),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),y),null,[0,Math.PI/2,0]]]},{AXIS:[[new n.Line(f,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]}),x={XYZE:[[new n.Mesh(new n.SphereGeometry(.25,10,8),o)]],X:[[new n.Mesh(new n.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new n.Mesh(new n.TorusGeometry(.5,.1,4,24),o),[0,0,0],[Math.PI/2,0,0]]],Z:[[new n.Mesh(new n.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,0,-Math.PI/2]]],E:[[new n.Mesh(new n.TorusGeometry(.75,.1,2,24),o)]]},w={X:[[new n.Mesh(p,w),[.5,0,0],[0,0,-Math.PI/2]],[new n.Mesh(M,w),[0,0,0],[0,0,-Math.PI/2]],[new n.Mesh(p,w),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new n.Mesh(p,S),[0,.5,0]],[new n.Mesh(M,S)],[new n.Mesh(p,S),[0,-.5,0],[0,0,Math.PI]]],Z:[[new n.Mesh(p,l),[0,0,.5],[Math.PI/2,0,0]],[new n.Mesh(M,l),[0,0,0],[Math.PI/2,0,0]],[new n.Mesh(p,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),c),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.15,.15,.01),u),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new n.Mesh(new n.BoxGeometry(.1,.1,.1),d.clone())]]},S={X:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new n.Mesh(new n.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new n.Mesh(new n.BoxGeometry(.2,.2,.2),o),[0,0,0]]]},M={X:[[new n.Line(f,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new n.Line(f,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new n.Line(f,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function T(e){var t,r=new n.Object3D;for(t in e)for(var a=e[t].length;a--;){var i=e[t][a][0].clone(),s=e[t][a][1],o=e[t][a][2],l=e[t][a][3],c=e[t][a][4];(i.name=t,i.tag=c,s&&i.position.set(s[0],s[1],s[2]),o&&i.rotation.set(o[0],o[1],o[2]),l&&i.scale.set(l[0],l[1],l[2]),i.updateMatrix(),c=i.geometry.clone()).applyMatrix4(i.matrix),i.geometry=c,i.renderOrder=1/0,i.position.set(0,0,0),i.rotation.set(0,0,0),i.scale.set(1,1,1),r.add(i)}return r}return r.gizmo={},r.picker={},r.helper={},r.add(r.gizmo.translate=T(g)),r.add(r.gizmo.rotate=T(a)),r.add(r.gizmo.scale=T(w)),r.add(r.picker.translate=T(v)),r.add(r.picker.rotate=T(x)),r.add(r.picker.scale=T(S)),r.add(r.helper.translate=T(b)),r.add(r.helper.rotate=T(y)),r.add(r.helper.scale=T(M)),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 r=this,n="local"===("scale"===this.mode?"local":this.space)?this.worldQuaternion:A,a=(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,[]);a=(a=(a=a.concat(this.picker[this.mode].children)).concat(this.gizmo[this.mode].children)).concat(this.helper[this.mode].children);for(var i=0;i<a.length;i++)!function(e){var t=a[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.visible=!!r.axis,"X"===r.axis&&(v.setFromEuler(_.set(0,0,0)),t.quaternion.copy(n).multiply(v),.9<Math.abs(E.copy(R).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"Y"===r.axis&&(v.setFromEuler(_.set(0,0,Math.PI/2)),t.quaternion.copy(n).multiply(v),.9<Math.abs(E.copy(L).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"Z"===r.axis&&(v.setFromEuler(_.set(0,Math.PI/2,0)),t.quaternion.copy(n).multiply(v),.9<Math.abs(E.copy(I).applyQuaternion(n).dot(r.eye))&&(t.visible=!1)),"XYZE"===r.axis&&(v.setFromEuler(_.set(0,Math.PI/2,0)),E.copy(r.rotationAxis),t.quaternion.setFromRotationMatrix(D.lookAt(k,E,L)),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),m.set(1e-10,1e-10,1e-10).add(r.worldPositionStart).sub(r.worldPosition).multiplyScalar(-1),m.applyQuaternion(r.worldQuaternionStart.clone().invert()),t.scale.copy(m),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(E.copy(R).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Y"===t.name&&.99<Math.abs(E.copy(L).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Z"===t.name&&.99<Math.abs(E.copy(I).applyQuaternion(n).dot(r.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XY"===t.name&&Math.abs(E.copy(I).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"YZ"===t.name&&Math.abs(E.copy(R).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XZ"===t.name&&Math.abs(E.copy(L).applyQuaternion(n).dot(r.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1)):"rotate"===r.mode&&(P.copy(n),E.copy(r.eye).applyQuaternion(v.copy(n).invert()),-1!==t.name.search("E")&&t.quaternion.setFromRotationMatrix(D.lookAt(r.eye,k,L)),"X"===t.name&&(v.setFromAxisAngle(R,Math.atan2(-E.y,E.z)),v.multiplyQuaternions(P,v),t.quaternion.copy(v)),"Y"===t.name&&(v.setFromAxisAngle(L,Math.atan2(E.x,E.z)),v.multiplyQuaternions(P,v),t.quaternion.copy(v)),"Z"===t.name&&(v.setFromAxisAngle(I,Math.atan2(E.y,E.x)),v.multiplyQuaternions(P,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)}(i);l(p(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}(),N=function(){c(t,n.Mesh);var e=h(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}))).isTransformControlsPlane=!0,r.type="TransformControlsPlane",r}return o(t,[{key:"updateMatrixWorld",value:function(e){var r=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(r="local"),B.copy(R).applyQuaternion("local"===r?this.worldQuaternion:A),U.copy(L).applyQuaternion("local"===r?this.worldQuaternion:A),j.copy(I).applyQuaternion("local"===r?this.worldQuaternion:A),E.copy(U),this.mode){case"translate":case"scale":switch(this.axis){case"X":E.copy(this.eye).cross(B),O.copy(B).cross(E);break;case"Y":E.copy(this.eye).cross(U),O.copy(U).cross(E);break;case"Z":E.copy(this.eye).cross(j),O.copy(j).cross(E);break;case"XY":O.copy(j);break;case"YZ":O.copy(B);break;case"XZ":E.copy(j),O.copy(U);break;case"XYZ":case"E":O.set(0,0,0)}break;default:O.set(0,0,0)}0===O.length()?this.quaternion.copy(this.cameraQuaternion):(C.lookAt(m.set(0,0,0),O,E),this.quaternion.setFromRotationMatrix(C)),l(p(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}()},6422:(e,t,r)=>{r.d(t,{x:()=>c});var n=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 i(){return(i="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 s(e,t){return(s=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"===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 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&&s(t,e);var r=o(a);function a(e){if(this instanceof a)return(e=r.call(this,e)).type=n.HalfFloatType,e;throw new TypeError("Cannot call a class as a function")}return t=a,(e=[{key:"parse",value:function(e){var t,r,a,i,s,o,l,c,u,h,d=function(e,t){switch(e){case 1:console.error("THREE.RGBELoader Read Error: "+(t||""));break;case 2:console.error("THREE.RGBELoader Write Error: "+(t||""));break;case 3:console.error("THREE.RGBELoader Bad File Format: "+(t||""));break;default:console.error("THREE.RGBELoader: Error: "+(t||""))}return-1},p=function(e,t,r){t=t||1024;for(var n=e.pos,a=-1,i=0,s="",o=String.fromCharCode.apply(null,new Uint16Array(e.subarray(n,n+128)));(a=o.indexOf("\n"))<0&&i<t&&n<e.byteLength;)s+=o,i+=o.length,n+=128,o+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(n,n+128)));return-1<a&&(!1!==r&&(e.pos+=i+a+1),s+o.slice(0,a))},f=((e=new Uint8Array(e)).pos=0,function(e){var t,r,n=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,a=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,i=/^\s*FORMAT=(\S+)\s*$/,s=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,o={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};if(e.pos>=e.byteLength||!(t=p(e)))return d(1,"no header found");if(!(r=t.match(/^#\?(\S+)/)))return d(3,"bad initial token");for(o.valid|=1,o.programtype=r[1],o.string+=t+"\n";!1!==(t=p(e));)if(o.string+=t+"\n","#"===t.charAt(0))o.comments+=t+"\n";else if((r=t.match(n))&&(o.gamma=parseFloat(r[1])),(r=t.match(a))&&(o.exposure=parseFloat(r[1])),(r=t.match(i))&&(o.valid|=2,o.format=r[1]),(r=t.match(s))&&(o.valid|=4,o.height=parseInt(r[1],10),o.width=parseInt(r[2],10)),2&o.valid&&4&o.valid)break;return 2&o.valid?4&o.valid?o:d(3,"missing image size specifier"):d(3,"missing format specifier")}(e));if(-1!==f){var m,g,v=f.width,b=f.height,y=function(e,t,r){var n=t;if(n<8||32767<n||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);if(n!==(e[2]<<8|e[3]))return d(3,"wrong scanline width");var a=new Uint8Array(4*t*r);if(!a.length)return d(4,"unable to allocate buffer space");for(var i=0,s=0,o=4*n,l=new Uint8Array(4),c=new Uint8Array(o),u=r;0<u&&s<e.byteLength;){if(s+4>e.byteLength)return d(1);if(l[0]=e[s++],l[1]=e[s++],l[2]=e[s++],l[3]=e[s++],2!=l[0]||2!=l[1]||(l[2]<<8|l[3])!=n)return d(3,"bad rgbe scanline format");for(var h=0,p=void 0;h<o&&s<e.byteLength;){var f=128<(p=e[s++]);if(f&&(p-=128),0===p||o<h+p)return d(3,"bad scanline data");if(f)for(var m=e[s++],g=0;g<p;g++)c[h++]=m;else c.set(e.subarray(s,s+p),h),h+=p,s+=p}for(var v=n,b=0;b<v;b++){var y=0;a[i]=c[b+0],y+=n,a[i+1]=c[b+y],y+=n,a[i+2]=c[b+y],y+=n,a[i+3]=c[b+y],i+=4}u--}return a}(e.subarray(e.pos),v,b);if(-1!==y){switch(this.type){case n.FloatType:for(var x=y.length/4,w=new Float32Array(4*x),S=0;S<x;S++)c=w,u=l=4*S,h=void 0,h=(o=y)[l+3],h=Math.pow(2,h-128)/255,c[u+0]=o[l+0]*h,c[u+1]=o[l+1]*h,c[u+2]=o[l+2]*h,c[u+3]=1;m=w,g=n.FloatType;break;case n.HalfFloatType:x=y.length/4;for(var M=new Uint16Array(4*x),T=0;T<x;T++)a=M,i=r=4*T,s=void 0,s=(t=y)[r+3],s=Math.pow(2,s-128)/255,a[i+0]=n.DataUtils.toHalfFloat(Math.min(t[r+0]*s,65504)),a[i+1]=n.DataUtils.toHalfFloat(Math.min(t[r+1]*s,65504)),a[i+2]=n.DataUtils.toHalfFloat(Math.min(t[r+2]*s,65504)),a[i+3]=n.DataUtils.toHalfFloat(1);m=M,g=n.HalfFloatType;break;default:console.error("THREE.RGBELoader: unsupported type: ",this.type)}return{width:v,height:b,data:m,header:f.string,gamma:f.gamma,exposure:f.exposure,type:g}}}return null}},{key:"setDataType",value:function(e){return this.type=e,this}},{key:"load",value:function(e,t,r,s){return i(l(a.prototype),"load",this).call(this,e,(function(e,r){switch(e.type){case n.FloatType:case n.HalfFloatType:e.encoding=n.LinearEncoding,e.minFilter=n.LinearFilter,e.magFilter=n.LinearFilter,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,r)}),r,s)}}])&&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}(n.DataTextureLoader)},4819:(e,t,r)=>{r.d(t,{T:()=>u,w:()=>o});var n=r(8881);function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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){t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1})}var o=function(){function e(){a(this,e),this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}return s(e,[{key:"setSize",value:function(){}},{key:"render",value:function(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}},{key:"dispose",value:function(){}}]),e}(),l=new n.OrthographicCamera(-1,1,1,-1,0,1),c=new n.BufferGeometry,u=(c.setAttribute("position",new n.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),c.setAttribute("uv",new n.Float32BufferAttribute([0,2,0,0,2,0],2)),function(){function e(t){a(this,e),this._mesh=new n.Mesh(c,t)}return s(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)=>{r.d(t,{T:()=>c});var n=r(8881),a=r(4819);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 s(e,t){return(s=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"===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 l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var 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&&s(t,e);var r=o(i);function i(e,t){var s;if(this instanceof i)return(s=r.call(this)).textureID=void 0!==t?t:"tDiffuse",e instanceof n.ShaderMaterial?(s.uniforms=e.uniforms,s.material=e):e&&(s.uniforms=n.UniformsUtils.clone(e.uniforms),s.material=new n.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:s.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),s.fsQuad=new a.T(s.material),s;throw new TypeError("Cannot call a class as a function")}return t=i,(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)}},{key:"dispose",value:function(){this.material.dispose(),this.fsQuad.dispose()}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(a.w)},699:(e,t,r)=>{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 a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(){return(o="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=c(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 c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}r.d(t,{M:()=>g,j:()=>u});var u=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 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,a=c(e);if(r=t?(r=c(this).constructor,Reflect.construct(a,arguments,r)):a.apply(this,arguments),a=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!==a)return a;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(){var e,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return a(this,i),(e=r.call(this)).isCSS2DObject=!0,e.element=t,e.element.style.position="absolute",e.element.style.userSelect="none",e.element.setAttribute("draggable",!1),e.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),e}return s(i,[{key:"copy",value:function(e,t){return o(c(i.prototype),"copy",this).call(this,e,t),this.element=e.element.cloneNode(!0),this}}]),i}((t=r(8881)).Object3D),h=new t.Vector3,d=new t.Matrix4,p=new t.Matrix4,f=new t.Vector3,m=new t.Vector3,g=s((function e(){var t,r,n,i,s=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},o=(a(this,e),this),l={objects:new WeakMap},c=void 0!==s.element?s.element:document.createElement("div");function u(e,t){return f.setFromMatrixPosition(e.matrixWorld),m.setFromMatrixPosition(t.matrixWorld),f.distanceToSquared(m)}c.style.overflow="hidden",this.domElement=c,this.getSize=function(){return{width:t,height:r}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),d.copy(t.matrixWorldInverse),p.multiplyMatrices(t.projectionMatrix,d),function e(t,r,a){var s;t.isCSS2DObject&&(h.setFromMatrixPosition(t.matrixWorld),h.applyMatrix4(p),s=!0===t.visible&&-1<=h.z&&h.z<=1&&!0===t.layers.test(a.layers),t.element.style.display=1==s?"":"none",1==s&&(t.onBeforeRender(o,r,a),(s=t.element).style.transform="translate(-50%,-50%) translate("+(h.x*n+n)+"px,"+(-h.y*i+i)+"px)",s.parentNode!==c&&c.appendChild(s),t.onAfterRender(o,r,a)),s={distanceToCameraSquared:u(a,t)},l.objects.set(t,s));for(var d=0,f=t.children.length;d<f;d++)e(t.children[d],r,a)}(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})),a=r.length,s=0,f=r.length;s<f;s++)r[s].element.style.zIndex=a-s},this.setSize=function(e,a){n=(t=e)/2,i=(r=a)/2,c.style.width=e+"px",c.style.height=a+"px"}}))},3693:(e,t,r)=>{r.d(t,{P7:()=>v,cp:()=>g,lX:()=>x});var n=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 i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(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&&s(e.prototype,t),r&&s(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 c(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 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"===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 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,g=function(){c(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 i(this,t),(r=e.call(this)).isCSS3DObject=!0,r.element=n,r.element.style.position="absolute",r.element.style.pointerEvents="auto",r.element.style.userSelect="none",r.element.setAttribute("draggable",!1),r.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),r}return o(t,[{key:"copy",value:function(e,r){return l(d(t.prototype),"copy",this).call(this,e,r),this.element=e.element.cloneNode(!0),this}}]),t}(),v=function(){c(t,g);var e=h(t);function t(r){return i(this,t),(r=e.call(this,r)).isCSS3DSprite=!0,r.rotation2D=0,r}return o(t,[{key:"copy",value:function(e,r){return l(d(t.prototype),"copy",this).call(this,e,r),this.rotation2D=e.rotation2D,this}}]),t}(),b=new n.Matrix4,y=new n.Matrix4,x=o((function e(){var t,r,n,a,s=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},o=(i(this,e),this),l={camera:{fov:0,style:""},objects:new WeakMap},c=void 0!==s.element?s.element:document.createElement("div"),u=(c.style.overflow="hidden",this.domElement=c,document.createElement("div"));function h(e){return Math.abs(e)<1e-10?0:e}function d(e){return"matrix3d("+h((e=e.elements)[0])+","+h(-e[1])+","+h(e[2])+","+h(e[3])+","+h(e[4])+","+h(-e[5])+","+h(e[6])+","+h(e[7])+","+h(e[8])+","+h(-e[9])+","+h(e[10])+","+h(e[11])+","+h(e[12])+","+h(-e[13])+","+h(e[14])+","+h(e[15])+")"}function g(e){return"translate(-50%,-50%)matrix3d("+h((e=e.elements)[0])+","+h(e[1])+","+h(e[2])+","+h(e[3])+","+h(-e[4])+","+h(-e[5])+","+h(-e[6])+","+h(-e[7])+","+h(e[8])+","+h(e[9])+","+h(e[10])+","+h(e[11])+","+h(e[12])+","+h(e[13])+","+h(e[14])+","+h(e[15])+")"}u.style.transformStyle="preserve-3d",u.style.pointerEvents="none",c.appendChild(u),this.getSize=function(){return{width:t,height:r}},this.render=function(e,t){var r=t.projectionMatrix.elements[5]*a,i=(l.camera.fov!==r&&(c.style.perspective=t.isPerspectiveCamera?r+"px":"",l.camera.fov=r),!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),t.isOrthographicCamera&&(i=-(t.right+t.left)/2,s=(t.top+t.bottom)/2),t.isOrthographicCamera?"scale("+r+")translate("+h(i)+"px,"+h(s)+"px)"+d(t.matrixWorldInverse):"translateZ("+r+"px)"+d(t.matrixWorldInverse)),s=i+"translate("+n+"px,"+a+"px)";l.camera.style!==s&&(u.style.transform=s,l.camera.style=s),function e(t,r,n,a){var i,s,c;t.isCSS3DObject&&(i=!0===t.visible&&!0===t.layers.test(n.layers),t.element.style.display=1==i?"":"none",1==i&&(t.onBeforeRender(o,r,n),i=t.isCSS3DSprite?(b.copy(n.matrixWorldInverse),b.transpose(),0!==t.rotation2D&&b.multiply(y.makeRotationZ(t.rotation2D)),t.matrixWorld.decompose(p,f,m),b.setPosition(p),b.scale(m),b.elements[3]=0,b.elements[7]=0,b.elements[11]=0,b.elements[15]=1,g(b)):g(t.matrixWorld),s=t.element,void 0!==(c=l.objects.get(t))&&c.style===i||(c={style:s.style.transform=i},l.objects.set(t,c)),s.parentNode!==u&&u.appendChild(s),t.onAfterRender(o,r,n)));for(var h=0,d=t.children.length;h<d;h++)e(t.children[h],r,n,a)}(e,e,t,i)},this.setSize=function(e,i){n=(t=e)/2,a=(r=i)/2,c.style.width=e+"px",c.style.height=i+"px",u.style.width=e+"px",u.style.height=i+"px"}}))},6608:(e,t,r)=>{r.d(t,{C:()=>n});var n={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}"}},4091:(e,t,r)=>{r.d(t,{Vs:()=>function(e,t){if(t===n.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t!==n.TriangleFanDrawMode&&t!==n.TriangleStripDrawMode)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e;var r=e.getIndex();if(null===r){var a=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var s=0;s<i.count;s++)a.push(s);e.setIndex(a),r=e.getIndex()}var o=r.count-2,l=[];if(t===n.TriangleFanDrawMode)for(var c=1;c<=o;c++)l.push(r.getX(0)),l.push(r.getX(c)),l.push(r.getX(c+1));else for(var u=0;u<o;u++)u%2==0?(l.push(r.getX(u)),l.push(r.getX(u+1)),l.push(r.getX(u+2))):(l.push(r.getX(u+2)),l.push(r.getX(u+1)),l.push(r.getX(u)));return l.length/3!=o&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles."),(t=e.clone()).setIndex(l),t.clearGroups(),t},qf:()=>function(e){for(var t,r,i=1<arguments.length&&void 0!==arguments[1]&&arguments[1],s=null!==e[0].index,o=new Set(Object.keys(e[0].attributes)),l=new Set(Object.keys(e[0].morphAttributes)),c={},u={},h=e[0].morphTargetsRelative,d=new n.BufferGeometry,p=0,f=0;f<e.length;++f){var m,g,v=e[f],b=0;if(s!=(null!==v.index))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(m in v.attributes){if(!o.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===c[m]&&(c[m]=[]),c[m].push(v.attributes[m]),b++}if(b!==o.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". Make sure all geometries have the same number of attributes."),null;if(h!==v.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(g in v.morphAttributes){if(!l.has(g))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". .morphAttributes must be consistent throughout all geometries."),null;void 0===u[g]&&(u[g]=[]),u[g].push(v.morphAttributes[g])}if(i){var y=void 0;if(s)y=v.index.count;else{if(void 0===v.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+f+". The geometry must have either an index or a position attribute"),null;y=v.attributes.position.count}d.addGroup(p,y,f),p+=y}}if(s){for(var x=0,w=[],S=0;S<e.length;++S){for(var M=e[S].index,T=0;T<M.count;++T)w.push(M.getX(T)+x);x+=e[S].attributes.position.count}d.setIndex(w)}for(t in c){var _=a(c[t]);if(!_)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+t+" attribute."),null;d.setAttribute(t,_)}for(r in u){var E=u[r][0].length;if(0===E)break;d.morphAttributes=d.morphAttributes||{},d.morphAttributes[r]=[];for(var k=0;k<E;++k){for(var D=[],P=0;P<u[r].length;++P)D.push(u[r][P][k]);var A=a(D);if(!A)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+r+" morphAttribute."),null;d.morphAttributes[r].push(A)}}return d}});var n=r(8881);function a(e){for(var t,r,a,i=0,s=0;s<e.length;++s){var o=e[s];if(o.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if((t=void 0===t?o.array.constructor:t)!==o.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?o.itemSize:r)!==o.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if((a=void 0===a?o.normalized:a)!==o.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;i+=o.array.length}for(var l=new t(i),c=0,u=0;u<e.length;++u)l.set(e[u].array,c),c+=e[u].array.length;return new n.BufferAttribute(l,r,a)}}},__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](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(()=>{__webpack_require__.d(__webpack_exports__,{default:()=>r});var e=__webpack_require__(8624),t=__webpack_require__(5857);const r={RunScene:t.ZP,Utils:t.cQ,ModelEx:t.ch,MaterialEx:t.al,TextureEx:t.Az,Three:t.Sf,ThreeEx:{TransformControls:e.Ys},Bus:t.Gc}})(),__webpack_exports__=__webpack_exports__.default,__webpack_exports__})()));
|