run-scene-v2 0.0.75 → 0.0.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +1 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("three"),require("axios"),require("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,n)=>{function r(){return(r="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=l(e)););return e}(e,t);if(r)return(r=Object.getOwnPropertyDescriptor(r,t)).get?r.get.call(arguments.length<3?e:n):r.value}).apply(this,arguments)}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=l(e);if(n=t?(n=l(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===f(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return o(r)}}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 n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e,t,n){return t&&u(e.prototype,t),n&&u(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e){return function(e){if(Array.isArray(e))return 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 n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?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 n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function f(e){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e){return void 0===e}function v(){return"undefined"!=typeof window}function g(e){return ze(e)||He(e)}function y(e){return(rt=_(e,nt))&&An}function b(e,t){return!t&&console.warn(e)}function x(e,t){return e&&(nt[e]=t)&&rt&&(rt[e]=t)||nt}function w(){return 0}function S(e,t,n){return(n=e[t])&&ze(n)?e[t]():m(n)&&e.getAttribute&&e.getAttribute(t)||n}function A(e,t){(e=e.split(",")).forEach(t)}function M(e,t,n,r){st.length&&vt(),e.render(t,n,r),st.length&&vt()}function B(e){var t=parseFloat(e);return(t||0===t)&&(e+"").match(et).length<2?t:He(e)?e.trim():e}function C(e){return e}function _(e,t){for(var n in t)e[n]=t[n];return e}function E(e,t){for(var n in t)"__proto__"!==n&&"constructor"!==n&&"prototype"!==n&&(e[n]=Je(t[n])?E(e[n]||(e[n]={}),t[n]):t[n]);return e}function T(e){var t,n=e.parent||le,r=e.keyframes?(t=We(e.keyframes),function(e,n){for(var r in n)r in e||"duration"===r&&t||"ease"===r||(e[r]=n[r])}):gt;if(Ke(e.inherit))for(;n;)r(e,n.vars.defaults),n=n.parent||n._dp;return e}function D(e){return!e||e._ts&&D(e.parent)}function P(e){return e._repeat?O(e._tTime,e=e.duration()+e._rDelay)*e:0}function O(e,t){return t=Math.floor(e/=t),e&&t===e?t-1:t}function R(e,t){return(e-t._start)*t._ts+(0<=t._ts?0:t._dirty?t.totalDuration():t._tDur)}function I(e,t){var n;if((t._time||t._initted&&!t._dur)&&(n=R(e.rawTime(),t),(!t._dur||V(0,t.totalDuration(),n)-t._tTime>ke)&&t.render(n,!0)),wt(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur<e.duration())for(n=e;n._dp;)0<=n.rawTime()&&n.totalTime(n._tTime),n=n._dp;e._zTime=-ke}}function k(e,t,n,r){return t.parent&&xt(t),t._start=mt((Ve(n)?n:n||e!==le?H(e,n,t):e._time)+t._delay),t._end=mt(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),function(e,t){var n,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"_first",i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"_last",a=4<arguments.length?arguments[4]:void 0,s=e[i];if(a)for(n=t[a];s&&s[a]>n;)s=s._prev;s?(t._next=s._next,s._next=t):(t._next=e[r],e[r]=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),r||I(e,t),e}function L(e,t){(nt.ScrollTrigger||it("scrollTrigger",t))&&nt.ScrollTrigger.create(t,e)}function F(e,t,n,r){return Zt(e,t),e._initted?!n&&e._pt&&(e._dur&&!1!==e.vars.lazy||!e._dur&&e.vars.lazy)&&pe!==Ut.frame?(st.push(e),e._lazy=[t,r]):void 0:1}function U(e){return(e=e.parent)&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||U(e))}function G(e){return"isFromStart"===(e=e.data)||"isStart"===e}function N(e,t,n,r){var i=e._repeat,a=mt(t)||0;return(t=e._tTime/e._tDur)&&!r&&(e._time*=a/e._dur),e._dur=a,e._tDur=i?i<0?1e10:mt(a*(i+1)+e._rDelay*i):a,0<t&&!r?At(e,e._tTime=e._tDur*t):e.parent&&St(e),n||wt(e.parent,e),e}function j(e){return e instanceof sn?wt(e):N(e,e._dur)}function H(e,t,n){var r,i,a,s=e.labels,o=e._recent||Mt,l=e.duration()>=Ie?o.endTime(!1):e._dur;return He(t)&&(isNaN(t)||t in s)?(i=t.charAt(0),a="%"===t.substr(-1),r=t.indexOf("="),"<"===i||">"===i?(0<=r&&(t=t.replace(/=/,"")),("<"===i?o._start:o.endTime(0<=o._repeat))+(parseFloat(t.substr(1))||0)*(a?(r<0?o:n).totalDuration()/100:1)):r<0?(t in s||(s[t]=l),s[t]):(i=parseFloat(t.charAt(r-1)+t.substr(r+1)),a&&n&&(i=i/100*(We(n)?n[0]:n).totalDuration()),1<r?H(e,t.substr(0,r-1),n)+i:l+i)):null==t?l:+t}function z(e,t,n){var r,i,a=Ve(t[1]),s=(a?2:1)+(e<2?0:1),o=t[s];if(a&&(o.duration=t[1]),o.parent=n,e){for(r=o,i=n;i&&!("immediateRender"in r);)r=i.vars.defaults||{},i=Ke(i.vars.inherit)&&i.parent;o.immediateRender=Ke(r.immediateRender),e<2?o.runBackwards=1:o.startAt=t[s-1]}return new dn(t[0],o,t[1+s])}function V(e,t,n){return n<e?e:t<n?t:n}function J(e){if(ze(e))return e;var t=Je(e)?e:{each:e},n=Vt(t.ease),r=t.from||0,i=parseFloat(t.base)||0,a={},s=(e=0<r&&r<1,isNaN(r)||e),o=t.axis,l=r,u=r;return He(r)?l=u={center:.5,edges:.5,end:1}[r]||0:!e&&s&&(l=r[0],u=r[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:r%b,p=b===Ie?0:s?x*u/b-.5:r/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"===r&&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"===r?-1:1),w.b=x<0?i-x:i,w.u=Ct(t.amount||t.each)||0,n=n&&x<0?zt(n):n}return x=(w[e]-w.min)/w.max||0,mt(w.b+(n?n(x):x)*w.v)+w.u}}function K(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(n){var r=Math.round(parseFloat(n)/e)*e*t;return(r-r%1)/t+(Ve(n)?0:Ct(n))}}function Z(e,t){var n,r,i=We(e);return!i&&Je(e)&&(n=i=e.radius||Ie,e.values?(e=Tt(e.values),(r=!Ve(e[0]))&&(n*=n)):e=K(e.increment)),Bt(t,i?ze(e)?function(t){return r=e(t),Math.abs(r-t)<=n?r:t}:function(t){for(var i,a,s=parseFloat(r?t.x:t),o=parseFloat(r?t.y:0),l=Ie,u=0,c=e.length;c--;)(i=r?(i=e[c].x-s)*i+(a=e[c].y-o)*a:Math.abs(e[c]-s))<l&&(l=i,u=c);return u=!n||l<=n?e[u]:t,r||u===t||Ve(t)?u:u+Ct(t)}:K(e))}function W(e,t,n,r){return Bt(We(e)?!t:!0===n?!!(n=0):!r,(function(){return We(e)?e[~~(Math.random()*e.length)]:(n=n||1e-5)&&(r=n<1?Math.pow(10,(n+"").length-2):1)&&Math.floor(Math.round((e-n/2+Math.random()*(t-e+.99*n))/n)*n*r)/r}))}function X(e,t,n){return Bt(n,(function(n){return e[~~t(n)]}))}function Q(e,t,n,r,i){var a=t-e,s=r-n;return Bt(i,(function(t){return n+((t-e)/a*s||0)}))}function Y(e,t,n){var r,i,a,s=e.labels,o=Ie;for(r in s)(i=s[r]-t)<0==!!n&&i&&o>(i=Math.abs(i))&&(a=r,o=i);return a}function q(e,t,n){var r=e.vars,i=r[t];i&&(t=r[t+"Params"],r=r.callbackScope||e,n&&st.length&&vt(),t?i.apply(r,t):i.call(r))}function $(e){return xt(e),e.scrollTrigger&&e.scrollTrigger.kill(!1),e.progress()<1&&q(e,"onInterrupt"),e}function ee(e,t,n){return(6*(e+=e<0?1:1<e?-1:0)<1?t+(n-t)*e*6:e<.5?n:3*e<2?t+(n-t)*(2/3-e)*6:t)*Ot+.5|0}function te(e,t,n){var r,i,a,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(","))+")"})),n&&(a=kt(e),(r=n.c).join(o)!==a.c.join(o)))for(s=(i=e.replace(Lt,"1").split(Ye)).length-1;c<s;c++)o+=i[c]+(~r.indexOf(c)?l.shift()||u+"0,0,0,0)":(a.length?a:l.length?l:n).shift());if(!i)for(s=(i=e.split(Lt)).length-1;c<s;c++)o+=i[c]+l[c];return o+i[s]}function ne(e,t){for(var n,r=e._first;r;)r instanceof sn?ne(r,t):!r.vars.yoyoEase||r._yoyo&&r._repeat||r._yoyo===t||(r.timeline?ne(r.timeline,t):(n=r._ease,r._ease=r._yEase,r._yEase=n,r._yoyo=t)),r=r._next}function re(e,t){var n,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:function(e){return 1-t(1-e)},i={easeIn:t,easeOut:r,easeInOut:3<arguments.length&&void 0!==arguments[3]?arguments[3]:function(e){return e<.5?t(2*e)/2:1-t(2*(1-e))/2}};A(e,(function(e){for(var t in Nt[e]=nt[e]=i,Nt[n=e.toLowerCase()]=r,i)Nt[n+("easeIn"===t?".in":"easeOut"===t?".out":".inOut")]=Nt[e+"."+t]=i[t]}))}function ie(e){return function(t){return t<.5?(1-e(1-2*t))/2:.5+e(2*(t-.5))/2}}function ae(e,t,n){function r(e){return 1===e?1:i*Math.pow(2,-10*e)*je((e-a)*s)+1}var i=1<=t?t:1,a=(s=(n||(e?.3:.45))/(t<1?t:1))/Le*(Math.asin(1/i)||0),s=(n="out"===e?r:"in"===e?function(e){return 1-r(1-e)}:ie(r),Le/s);return n.config=function(t,n){return ae(e,t,n)},n}function se(e){function t(e){return e?--e*e*((n+1)*e+n)+1:0}var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1.70158,r="out"===e?t:"in"===e?function(e){return 1-t(1-e)}:ie(t);return r.config=function(t){return se(e,t)},r}n.d(t,{Q3:()=>dn});var oe,le,ue,ce,he,de,pe,fe,me,ve,ge,ye,be,xe,we,Se,Ae,Me,Be,Ce,_e,Ee,Te,De,Pe,Oe={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Re={duration:.5,overwrite:!1,delay:0},Ie=1e8,ke=1/Ie,Le=2*Math.PI,Fe=Le/4,Ue=0,Ge=Math.sqrt,Ne=Math.cos,je=Math.sin,He=function(e){return"string"==typeof e},ze=function(e){return"function"==typeof e},Ve=function(e){return"number"==typeof e},Je=function(e){return"object"==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,nt={},rt={},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,n,r=e[0];if(Je(r)||ze(r)||(e=[e]),!(t=(r._gsap||{}).harness)){for(n=ht.length;n--&&!ht[n].targetTest(r););t=ht[n]}for(n=e.length;n--;)e[n]&&(e[n]._gsap||(e[n]._gsap=new rn(e[n],t)))||e.splice(n,1);return e},ft=function(e){return e._gsap||pt(Tt(e))[0]._gsap},mt=function(e){return Math.round(1e7*e)/1e7||0},vt=function(){var e,t,n=st.length,r=st.slice(0);for(ot={},e=st.length=0;e<n;e++)(t=r[e])&&t._lazy&&(t.render(t._lazy[0],t._lazy[1],!0)._lazy=0)},gt=function(e,t){for(var n in t)n in e||(e[n]=t[n]);return e},yt=function(e,t){var n,r={};for(n in e)n in t||(r[n]=e[n]);return r},bt=function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"_first",r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"_last",i=t._prev,a=t._next;i?i._next=a:e[n]===t&&(e[n]=a),a?a._prev=i:e[r]===t&&(e[r]=i),t._next=t._prev=t.parent=null},xt=function(e,t){!e.parent||t&&!e.parent.autoRemoveChildren||e.parent.remove(e),e._act=0},wt=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var n=e;n;)n._dirty=1,n=n.parent;return e},St=function(e){return e._end=mt(e._start+(e._tDur/Math.abs(e._ts||e._rts||ke)||0))},At=function(e,t){var n=e._dp;return n&&n.smoothChildTiming&&e._ts&&(e._start=mt(n._time-(0<e._ts?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),St(e),n._dirty||wt(n,e)),e},Mt={_start:0,endTime:w,totalDuration:w},Bt=function(e,t){return e||0===e?t(e):t},Ct=function(e,t){return He(e)&&(t=tt.exec(e))?e.substr(t.index+t[0].length):""},_t=[].slice,Et=function(e,t){return e&&Je(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&Je(e[0]))&&!e.nodeType&&e!==ue},Tt=function(e,t,n){return!He(e)||n||!ce&&Gt()?We(e)?function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[];return e.forEach((function(e){return He(e)&&!t||Et(e,1)?n.push.apply(n,d(Tt(e))):n.push(e)}))||n}(e,n):Et(e)?_t.call(e,0):e?[e]:[]:_t.call((t||he).querySelectorAll(e),0)},Dt=function(e){return e.sort((function(){return.5-Math.random()}))},Pt=function(e){for(var t,n,r,i,a=0,s="";~(t=e.indexOf("random(",a));)r=e.indexOf(")",t),i="["===e.charAt(t+7),n=e.substr(t+7,r-t-7).match(i?et:Xe),s+=e.substr(a,t-a)+W(i?n:+n[0],i?0:+n[1],+n[2]||1e-5),a=r+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,n){var r,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?"#"+(r=e.charAt(1))+r+(i=e.charAt(2))+i+(a=e.charAt(3))+a+(5===e.length?e.charAt(4)+e.charAt(4):""):e).length)return[(c=parseInt(e.substr(1,6),16))>>16,c>>8&Ot,c&Ot,parseInt(e.substr(7),16)/255];c=[(e=parseInt(e.substr(1),16))>>16,e>>8&Ot,e&Ot]}else if("hsl"===e.substr(0,3))if(c=u=e.match(Xe),t){if(~e.indexOf("="))return c=e.match(Qe),n&&c.length<4&&(c[3]=1),c}else s=+c[0]%360/360,o=+c[1]/100,r=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,r,i),c[1]=ee(s,r,i),c[2]=ee(s-1/3,r,i);else c=e.match(Xe)||Rt.transparent;c=c.map(Number)}return t&&!u&&(r=c[0]/Ot,i=c[1]/Ot,a=c[2]/Ot,l=((e=Math.max(r,i,a))+(t=Math.min(r,i,a)))/2,e===t?s=o=0:(u=e-t,o=.5<l?u/(2-e-t):u/(e+t),s=e===r?(i-a)/u+(i<a?6:0):e===i?(a-r)/u+2:(r-i)/u+4,s*=60),c[0]=~~(s+.5),c[1]=~~(100*o+.5),c[2]=~~(100*l+.5)),n&&c.length<4&&(c[3]=1),c},kt=function(e){var t=[],n=[],r=-1;return e.split(Lt).forEach((function(e){e=e.match(Ye)||[],t.push.apply(t,d(e)),n.push(r+=e.length+1)})),t.c=n,t},Lt=function(){var e,t="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b";for(e in Rt)t+="|"+e+"\\b";return new RegExp(t+")","gi")}(),Ft=/hsl[a]?\(/,Ut=(we=Date.now,Se=500,Ae=33,Me=we(),Be=Me,_e=Ce=1e3/240,Te={time:0,frame:0,tick:function(){Jt(!0)},deltaRatio:function(e){return be/(1e3/(e||60))},wake:function(){de&&(!ce&&v()&&(ue=ce=window,he=ue.document||{},nt.gsap=An,(ue.gsapVersions||(ue.gsapVersions=[])).push(An.version),y(rt||ue.GreenSockGlobals||!ue.gsap&&ue||{}),ye=ue.requestAnimationFrame),ve&&Te.sleep(),ge=ye||function(e){return setTimeout(e,_e-1e3*Te.time+1|0)},me=1,Jt(2))},sleep:function(){(ye?ue.cancelAnimationFrame:clearTimeout)(ve),me=0,ge=w},lagSmoothing:function(e,t){Se=e||1/ke,Ae=Math.min(t,Se,0)},fps:function(e){Ce=1e3/(e||240),_e=1e3*Te.time+Ce},add:function(e){Ee.indexOf(e)<0&&Ee.push(e),Gt()},remove:function(e,t){~(t=Ee.indexOf(e))&&Ee.splice(t,1)&&t<=xe&&xe--},_listeners:Ee=[]}),Gt=function(){return!me&&Ut.wake()},Nt={},jt=/^[\d.\-M][\d.\-,\s]/,Ht=/["']/g,zt=function(e){return function(t){return 1-e(1-t)}},Vt=function(e,t){return e&&(ze(e)?e:Nt[e]||function(e){var t,n,r,i=(e+"").split("("),a=Nt[i[0]];return a&&1<i.length&&a.config?a.config.apply(null,~e.indexOf("{")?[function(e){for(var t,n,r,i={},a=e.substr(1,e.length-3).split(":"),s=a[0],o=1,l=a.length;o<l;o++)n=a[o],t=o!==l-1?n.lastIndexOf(","):n.length,r=n.substr(0,t),i[s]=isNaN(r)?r.replace(Ht,"").trim():+r,s=n.substr(t+1).trim();return i}(i[1])]:(t=(i=e).indexOf("(")+1,n=i.indexOf(")"),r=i.indexOf("(",t),i.substring(t,~r&&r<n?i.indexOf(")",n+1):n).split(",").map(B))):Nt._CE&&jt.test(e)?Nt._CE("",e):a}(e))||t};function Jt(e){var t,n,r,i=we()-Be,a=!0===e;if(Se<i&&(Me+=i-Ae),(0<(i=(n=(Be+=i)-Me)-_e)||a)&&(r=++Te.frame,be=n-1e3*Te.time,Te.time=n/=1e3,_e+=i+(Ce<=i?4:Ce-i),t=1),a||(ve=ge(Jt)),t)for(xe=0;xe<Ee.length;xe++)Ee[xe](n,be,r,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 n,r,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._dur,E=e._startAt,T=e._targets,D=e.parent,P=D&&"nested"===D.data?D.parent._targets:T,O="auto"===e._overwrite&&!oe,R=e.timeline;if(e._ease=Vt(v=!R||B&&v?v:"none",Re.ease),e._yEase=M?zt(Vt(!0===M?v:M,Re.ease)):0,M&&e._yoyo&&!e._repeat&&(M=e._yEase,e._yEase=e._ease,e._ease=M),e._from=!R&&!!m.runBackwards,!R||B&&!m.stagger){if(p=(u=T[0]?ft(T[0]).harness:0)&&m[u.prop],n=yt(m,at),E&&xt(E.render(-1,!0)),g)if(xt(e._startAt=dn.set(T,gt({data:"isStart",overwrite:!1,parent:D,immediateRender:!0,lazy: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),_&&t<=0)return void(t&&(e._zTime=t))}else!1===C&&(e._startAt=0);else if(A&&_)if(E)C||(e._startAt=0);else if(i=gt({overwrite:!1,data:"isFromStart",lazy:(y=!t&&y)&&Ke(b),immediateRender:y,stagger:0,parent:D},n),p&&(i[u.prop]=p),xt(e._startAt=dn.set(T,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=_&&Ke(b)||b&&!_,r=0;r<T.length;r++){if(l=(s=T[r])._gsap||pt(T)[r]._gsap,e._ptLookup[r]=h={},ot[l.id]&&st.length&&vt(),d=P===T?r:P.indexOf(s),u&&!1!==(c=new u).init(s,p||n,e,d,P)&&(e._pt=a=new xn(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 n)lt[i]&&(c=un(i,n,e,d,s,P))?c.priority&&(o=1):h[i]=a=ln.call(e,s,i,"get",n[i],d,P,0,m.stringFilter);e._op&&e._op[r]&&e.kill(s,e._op[r]),O&&e._pt&&(nn=e,le.killTweensOf(s,h,e.globalTime(t)),f=!e.parent,nn=0),e._pt&&b&&(ot[l.id]=1)}o&&bn(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,n,r,i){return ze(e)?e.call(t,n,r,i):He(e)&&~e.indexOf("random(")?Pt(e):e}function Xt(e,t,n){return e.setAttribute(t,n)}function Qt(e,t){var n=t._pt,r="";if(!e&&t.b)r=t.b;else if(1===e&&t.e)r=t.e;else{for(;n;)r=n.p+(n.m?n.m(n.s+n.c*e):Math.round(1e4*(n.s+n.c*e))/1e4)+r,n=n._next;r+=t.c}t.set(t.t,t.p,r,t)}function Yt(e,t){for(var n=t._pt;n;)n.r(e,n.d),n=n._next}function qt(e,t,n,r){for(var i,a=this._pt;a;)i=a._next,a.p===r&&a.modifier(e,t,n),a=i}function $t(e){for(var t,n,r=this._pt;r;)n=r._next,r.p===e&&!r.op||r.op===e?bt(this,r,"_pt"):r.dep||(t=1),r=n;return!t}function en(e,t,n,r){r.mSet(e,t,r.m.call(r.tween,n,r.mt),r)}function tn(e,t){return{name:e,rawVars:1,init:function(e,n,r){r._onInit=function(e){var r,i;if(He(n)&&(r={},A(n,(function(e){return r[e]=1})),n=r),t){for(i in r={},n)r[i]=t(n[i]);n=r}var a,s,o,l=e,u=n,c=l._targets;for(a in u)for(s=c.length;s--;)(o=(o=l._ptLookup[s][a])&&o.d)&&(o=o._pt?Sn(o,a):o)&&o.modifier&&o.modifier(u[a],l,c[s],a)}}}}A("Linear,Quad,Cubic,Quart,Quint,Strong",(function(e,t){var n=t<5?t+1:t;re(e+",Power"+(n-1),t?function(e){return Math.pow(e,n)}:function(e){return e},(function(e){return 1-Math.pow(1-e,n)}),(function(e){return e<.5?Math.pow(2*e,n)/2:1-Math.pow(2*(1-e),n)/2}))})),Nt.Linear.easeNone=Nt.none=Nt.Linear.easeIn,re("Elastic",ae("in"),ae("out"),ae()),De=7.5625,Pe=1/2.75,re("Bounce",(function(e){return 1-Kt(1-e)}),Kt),re("Expo",(function(e){return e?Math.pow(2,10*(e-1)):0})),re("Circ",(function(e){return-(Ge(1-e*e)-1)})),re("Sine",(function(e){return 1===e?1:1-Ne(e*Fe)})),re("Back",se("in"),se("out"),se()),Nt.SteppedEase=Nt.steps=nt.SteppedEase={config:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length?arguments[1]:void 0,n=1/e,r=e+(t?0:1),i=t?1:0,a=1-ke;return function(e){return((r*V(0,a,e)|0)+i)*n}}},Re.ease=Nt["quad.out"],A("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",(function(e){return dt+=e+","+e+"Params,"}));var nn,rn=c((function e(t,n){h(this,e),this.id=Ue++,(t._gsap=this).target=t,this.harness=n,this.get=n?n.get:S,this.set=n?n.getSetter:vn})),an=function(){function e(t){h(this,e),this.vars=t,this._delay=+t.delay||0,(this._repeat=t.repeat===1/0?-2:t.repeat||0)&&(this._rDelay=t.repeatDelay||0,this._yoyo=!!t.yoyo||!!t.yoyoEase),this._ts=1,N(this,+t.duration,1,1),this.data=t.data,me||Ut.wake()}return c(e,[{key:"delay",value:function(e){return e||0===e?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+e-this._delay),this._delay=e,this):this._delay}},{key:"duration",value:function(e){return arguments.length?this.totalDuration(0<this._repeat?e+(e+this._rDelay)*this._repeat:e):this.totalDuration()&&this._dur}},{key:"totalDuration",value:function(e){return arguments.length?(this._dirty=0,N(this,this._repeat<0?e:(e-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur}},{key:"totalTime",value:function(e,t){if(Gt(),!arguments.length)return this._tTime;var n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(At(this,e),n._dp&&!n.parent&&I(n,this);n&&n.parent;)n.parent._time!==n._start+(0<=n._ts?n._tTime/n._ts:(n.totalDuration()-n._tTime)/-n._ts)&&n.totalTime(n._tTime,!0),n=n.parent;!this.parent&&this._dp.autoRemoveChildren&&(0<this._ts&&e<this._tDur||this._ts<0&&0<e||!this._tDur&&!e)&&k(this._dp,this,this._start-this._delay)}return(this._tTime!==e||!this._dur&&!t||this._initted&&Math.abs(this._zTime)===ke||!e&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=e),M(this,e,t)),this}},{key:"time",value:function(e,t){return arguments.length?this.totalTime(Math.min(this.totalDuration(),e+P(this))%(this._dur+this._rDelay)||(e?this._dur:0),t):this._time}},{key:"totalProgress",value:function(e,t){return arguments.length?this.totalTime(this.totalDuration()*e,t):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.ratio}},{key:"progress",value:function(e,t){return arguments.length?this.totalTime(this.duration()*(!this._yoyo||1&this.iteration()?e:1-e)+P(this),t):this.duration()?Math.min(1,this._time/this._dur):this.ratio}},{key:"iteration",value:function(e,t){var n=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(e-1)*n,t):this._repeat?O(this._tTime,n)+1:1}},{key:"timeScale",value:function(e){if(!arguments.length)return this._rts===-ke?0:this._rts;if(this._rts===e)return this;for(var t=this.parent&&this._ts?R(this.parent._time,this):this._tTime,n=(this._rts=+e||0,this._ts=this._ps||e===-ke?0:this._rts,e=this.totalTime(V(-this._delay,this._tDur,t),!0)).parent;n&&n.parent;)n._dirty=1,n.totalDuration(),n=n.parent;return 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,n=arguments.length?e:t.rawTime();t;)n=t._start+n/(t._ts||1),t=t._dp;return n}},{key:"repeat",value:function(e){return arguments.length?(this._repeat=e===1/0?-2:e,j(this)):-2===this._repeat?1/0:this._repeat}},{key:"repeatDelay",value:function(e){var t;return arguments.length?(t=this._time,this._rDelay=e,j(this),t?this.time(t):this):this._rDelay}},{key:"yoyo",value:function(e){return arguments.length?(this._yoyo=e,this):this._yoyo}},{key:"seek",value:function(e,t){return this.totalTime(H(this,e),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,n){var r=this.vars;return 1<arguments.length?(t?(r[e]=t,n&&(r[e+"Params"]=n),"onUpdate"===e&&(this._onUpdate=t)):delete r[e],this):r[e]}},{key:"then",value:function(e){var t=this;return new Promise((function(n){function r(){var e=t.then;t.then=null,ze(i)&&(i=i(t))&&(i.then||i===t)&&(t.then=e),n(i),t.then=e}var i=ze(e)?e:C;t._initted&&1===t.totalProgress()&&0<=t._ts||!t._tTime&&t._ts<0?r():t._prom=r}))}},{key:"kill",value:function(){$(this)}}]),e}(),sn=(gt(an.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-ke,_prom:0,_ps:!1,_rts:1}),function(){i(t,an);var e=s(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},i=1<arguments.length?arguments[1]:void 0;return h(this,t),(n=e.call(this,r)).labels={},n.smoothChildTiming=!!r.smoothChildTiming,n.autoRemoveChildren=!!r.autoRemoveChildren,n._sort=Ke(r.sortChildren),le&&k(r.parent||le,o(n),i),r.reversed&&n.reverse(),r.paused&&n.paused(!0),r.scrollTrigger&&L(o(n),r.scrollTrigger),n}return c(t,[{key:"to",value:function(e,t,n){return z(0,arguments,this),this}},{key:"from",value:function(e,t,n){return z(1,arguments,this),this}},{key:"fromTo",value:function(e,t,n,r){return z(2,arguments,this),this}},{key:"set",value:function(e,t,n){return t.duration=0,t.parent=this,T(t).repeatDelay||(t.repeat=0),t.immediateRender=!!t.immediateRender,new dn(e,t,H(this,n),1),this}},{key:"call",value:function(e,t,n){return k(this,dn.delayedCall(0,e,t),n)}},{key:"staggerTo",value:function(e,t,n,r,i,a,s){return n.duration=t,n.stagger=n.stagger||r,n.onComplete=a,n.onCompleteParams=s,n.parent=this,new dn(e,n,H(this,i)),this}},{key:"staggerFrom",value:function(e,t,n,r,i,a,s){return n.runBackwards=1,T(n).immediateRender=Ke(n.immediateRender),this.staggerTo(e,t,n,r,i,a,s)}},{key:"staggerFromTo",value:function(e,t,n,r,i,a,s,o){return r.startAt=n,T(r).immediateRender=Ke(r.immediateRender),this.staggerTo(e,t,r,i,a,s,o)}},{key:"render",value:function(e,t,n){var r,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||n||g){if(p!==this._time&&m&&(v+=this._time-p,e+=this._time-p),r=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,n);if(r=mt(v%s),v===f?(a=this._repeat,r=m):((a=~~(v/s))&&a===v/s&&(r=m,a--),m<r&&(r=m)),h=O(this._tTime,s),g&&1&a&&(r=m-r,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;ne(this,d)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(l=function(e,t,n){var r;if(t<n)for(r=e._first;r&&r._start<=n;){if("isPause"===r.data&&r._start>t)return r;r=r._next}else for(r=e._last;r&&r._start>=n;){if("isPause"===r.data&&r._start<t)return r;r=r._prev}}(this,mt(p),mt(r)))&&(v-=r-(r=l._start)),this._tTime=v,this._time=r,this._act=!u,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=e,p=0),!p&&r&&!t&&(q(this,"onStart"),this._tTime!==v))return this;if(p<=r&&0<=e)for(b=this._first;b;){if(i=b._next,(b._act||r>=b._start)&&b._ts&&l!==b){if(b.parent!==this)return this.render(e,t,n);if(b.render(0<b._ts?(r-b._start)*b._ts:(b._dirty?b.totalDuration():b._tDur)+(r-b._start)*b._ts,t,n),r!==this._time||!this._ts&&!o){l=0,i&&(v+=this._zTime=-ke);break}}b=i}else for(var b=this._last,x=e<0?e:r;b;){if(i=b._prev,(b._act||x<=b._end)&&b._ts&&l!==b){if(b.parent!==this)return this.render(e,t,n);if(b.render(0<b._ts?(x-b._start)*b._ts:(b._dirty?b.totalDuration():b._tDur)+(x-b._start)*b._ts,t,n),r!==this._time||!this._ts&&!o){l=0,i&&(v+=this._zTime=x?-ke:ke);break}}b=i}if(l&&!t&&(this.pause(),l.render(p<=r?0:-ke)._zTime=p<=r?1:-1,this._ts))return this._start=c,St(this),this.render(e,t,n);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 n=this;if(Ve(t)||(t=H(this,t,e)),!(e instanceof an)){if(We(e))return e.forEach((function(e){return n.add(e,t)})),this;if(He(e))return this.addLabel(e,t);if(!ze(e))return this;e=dn.delayedCall(0,e)}return this!==e?k(this,e,t):this}},{key:"getChildren",value:function(){for(var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],n=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:-Ie,i=[],a=this._first;a;)a._start>=r&&(a instanceof dn?t&&i.push(a):(n&&i.push(a),e&&i.push.apply(i,d(a.getChildren(!0,t,n))))),a=a._next;return i}},{key:"getById",value:function(e){for(var t=this.getChildren(1,1,1),n=t.length;n--;)if(t[n].vars.id===e)return t[n]}},{key:"remove",value:function(e){return He(e)?this.removeLabel(e):ze(e)?this.killTweensOf(e):(bt(this,e),e===this._recent&&(this._recent=this._last),wt(this))}},{key:"totalTime",value:function(e,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=mt(Ut.time-(0<this._ts?e/this._ts:(this.totalDuration()-e)/-this._ts))),r(l(t.prototype),"totalTime",this).call(this,e,n),this._forcing=0,this):this._tTime}},{key:"addLabel",value:function(e,t){return this.labels[e]=H(this,t),this}},{key:"removeLabel",value:function(e){return delete this.labels[e],this}},{key:"addPause",value:function(e,t,n){return(t=dn.delayedCall(0,t||w,n)).data="isPause",this._hasPause=1,k(this,t,H(this,e))}},{key:"removePause",value:function(e){var t=this._first;for(e=H(this,e);t;)t._start===e&&"isPause"===t.data&&xt(t),t=t._next}},{key:"killTweensOf",value:function(e,t,n){for(var r=this.getTweensOf(e,n),i=r.length;i--;)nn!==r[i]&&r[i].kill(e,t);return this}},{key:"getTweensOf",value:function(e,t){for(var n,r=[],i=Tt(e),a=this._first,s=Ve(t);a;)a instanceof dn?function(e,t){for(var n=t.length,r=0;e.indexOf(t[r])<0&&++r<n;);return r<n}(a._targets,i)&&(s?(!nn||a._initted&&a._ts)&&a.globalTime(0)<=t&&a.globalTime(a.totalDuration())>t:!t||a.isActive())&&r.push(a):(n=a.getTweensOf(i,t)).length&&r.push.apply(r,d(n)),a=a._next;return r}},{key:"tweenTo",value:function(e,t){t=t||{};var n,r=this,i=H(r,e),a=(e=t).startAt,s=e.onStart,o=e.onStartParams,l=(e=e.immediateRender,dn.to(r,gt({ease:t.ease||"none",lazy:!1,immediateRender:!1,time:i,overwrite:"auto",duration:t.duration||Math.abs((i-(a&&"time"in a?a.time:r._time))/r.timeScale())||ke,onStart:function(){var e;r.pause(),n||(e=t.duration||Math.abs((i-(a&&"time"in a?a.time:r._time))/r.timeScale()),l._dur!==e&&N(l,e,0,1).render(l._time,!0,!0),n=1),s&&s.apply(l,o||[])}},t)));return e?l.render(0):l}},{key:"tweenFromTo",value:function(e,t,n){return this.tweenTo(t,gt({startAt:{time:H(this,e)}},n))}},{key:"recent",value:function(){return this._recent}},{key:"nextLabel",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._time;return Y(this,H(this,e))}},{key:"previousLabel",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._time;return Y(this,H(this,e),1)}},{key:"currentLabel",value:function(e){return arguments.length?this.seek(e,!0):this.previousLabel(this._time+ke)}},{key:"shiftChildren",value:function(e,t){for(var n,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=this._first,a=this.labels;i;)i._start>=r&&(i._start+=e,i._end+=e),i=i._next;if(t)for(n in a)a[n]>=r&&(a[n]+=e);return wt(this)}},{key:"invalidate",value:function(){var e=this._first;for(this._lock=0;e;)e.invalidate(),e=e._next;return r(l(t.prototype),"invalidate",this).call(this)}},{key:"clear",value:function(){for(var e,t=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],n=this._first;n;)e=n._next,this.remove(n),n=e;return this._dp&&(this._time=this._tTime=this._pTime=0),t&&(this.labels={}),wt(this)}},{key:"totalDuration",value:function(e){var t,n,r,i=0,a=this,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(r=a.parent;s;)t=s._prev,s._dirty&&s.totalDuration(),(n=s._start)>o&&a._sort&&s._ts&&!a._lock?(a._lock=1,k(a,s,n-s._delay,1)._lock=0):o=n,n<0&&s._ts&&(i-=n,(!r&&!a._dp||r&&r.smoothChildTiming)&&(a._start+=n/a._ts,a._time-=n,a._tTime-=n),a.shiftChildren(-n,!1,-1/0),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}()),on=(gt(sn.prototype,{_lock:0,_hasPause:0,_forcing:0}),function(e,t,n,r,i,a,s){var o,l,u,c,h,d=new xn(this._pt,e,t,0,1,Qt,null,i),p=0,f=0;for(d.b=n,d.e=r,n+="",(i=~(r+="").indexOf("random("))&&(r=Pt(r)),a&&(a(a=[n,r],e,t),n=a[0],r=a[1]),o=n.match(qe)||[];c=qe.exec(r);)u=c[0],c=r.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<r.length?r.substring(p,r.length):"",d.fp=s,($e.test(r)||i)&&(d.e=0),this._pt=d}),ln=function(e,t,n,r,i,a,s,o,l){var u;if(ze(r)&&(r=r(i||0,e,a)),i=e[t],a="get"!==n?n:ze(i)?l?e[t.indexOf("set")||!ze(e["get"+t.substr(3)])?t:"get"+t.substr(3)](l):e[t]():i,n=ze(i)?l?mn:fn:pn,He(r)&&"="===(r=~r.indexOf("random(")?Pt(r):r).charAt(1)&&(!(u=parseFloat(a)+parseFloat(r.substr(2))*("-"===r.charAt(0)?-1:1)+(Ct(a)||0))&&0!==u||(r=u)),a!==r)return isNaN(a*r)||""===r?(i||t in e||it(t,r),on.call(this,e,t,a,r,n,o||Oe.stringFilter,l)):(u=new xn(this._pt,e,t,+a||0,r-(a||0),"boolean"==typeof i?yn:gn,0,n),l&&(u.fp=l),s&&u.modifier(s,this,e),this._pt=u)},un=function(e,t,n,r,i,a){var s,o,l,u;if(lt[e]&&!1!==(s=new lt[e]).init(i,s.rawVars?t[e]:function(e,t,n,r,i){if(ze(e)&&(e=Wt(e,i,t,n,r)),!Je(e)||e.style&&e.nodeType||We(e)||Ze(e))return He(e)?Wt(e,i,t,n,r):e;var a,s={};for(a in e)s[a]=Wt(e[a],i,t,n,r);return s}(t[e],r,i,a,n),n,r,a)&&(n._pt=o=new xn(n._pt,i,e,0,1,s.render,s,0,s.priority),n!==fe))for(l=n._ptLookup[n._targets.indexOf(i)],u=s._props.length;u--;)l[s._props[u]]=o;return s},cn=dt+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase",hn={},dn=(A(cn+",id,stagger,delay,duration,paused,scrollTrigger",(function(e){return hn[e]=1})),function(){i(t,an);var e=s(t);function t(n,r,i,a){h(this,t),"number"==typeof r&&(i.duration=r,r=i,i=null);var s,l,u,c,d,p,f,m,v,y=(a=(s=e.call(this,a?r:T(r))).vars).duration,x=a.delay,w=a.immediateRender,S=a.stagger,A=a.overwrite,M=a.keyframes,B=a.defaults,C=a.scrollTrigger,E=a.yoyoEase,P=(a=r.parent||le,(We(n)||Ze(n)?Ve(n[0]):"length"in r)?[n]:Tt(n));if(s._targets=P.length?pt(P):b("GSAP target "+n+" not found. https://greensock.com",!Oe.nullTargetWarn)||[],s._ptLookup=[],s._overwrite=A,M||S||g(y)||g(x)){if(r=s.vars,(l=s.timeline=new sn({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)~cn.indexOf(p)&&((v=v||{})[p]=S[p]);for(u=0;u<d;u++)(c=yt(r,hn)).stagger=0,E&&(c.yoyoEase=E),v&&_(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){T(gt(l.vars.defaults,{ease:"none"})),l._ease=Vt(M.ease||r.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,n,r){var i,a,s=t.ease||r||"power1.inOut";if(We(t))a=n[e]||(n[e]=[]),t.forEach((function(e,n){return a.push({t:n/(t.length-1)*100,v:e,e:s})}));else for(i in t)a=n[i]||(n[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||(nn=o(s),le.killTweensOf(P),nn=0),k(a,o(s),i),r.reversed&&s.reverse(),r.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,n){var r,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||n||!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,n);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&&!n&&this._initted)return this;g!==y&&(f&&this._yEase&&ne(f,p),!this.vars.repeatRefresh||p||this._lock||(this._lock=n=1,this.render(mt(h*g),!0).invalidate()._lock=0))}if(!this._initted){if(F(this,e<0?e:m,n,t))return this._tTime=0,this;if(o!==this._dur)return this.render(e,t,n)}if(this._tTime=l,this._time=m,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=i=(d||this._ease)(m/o),this._from&&(this.ratio=i=1-i),m&&!a&&!t&&(q(this,"onStart"),this._tTime!==l))return this;for(r=this._pt;r;)r.r(i,r.d),r=r._next;f&&f.render(e<0?e:!m&&p?-ke:f._dur*f._ease(m/this._dur),t,n)||this._startAt&&(this._zTime=e),this._onUpdate&&!t&&(e<0&&this._startAt&&this._startAt.render(e,!0,n),q(this,"onUpdate")),this._repeat&&g!==y&&this.vars.onRepeat&&!t&&this.parent&&q(this,"onRepeat"),l!==this._tDur&&l||this._tTime!==l||(e<0&&this._startAt&&!this._onUpdate&&this._startAt.render(e,!0,!0),!e&&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=n,m=h.ratio,v=d<0||!d&&(!h._start&&U(h)&&(h._initted||!G(h))||(h._ts<0||h._dp._ts<0)&&!G(h))?0:1,g=h._rDelay,y=0;if(g&&h._repeat&&(c=O(y=V(0,h._tDur,d),g),h._yoyo&&1&c&&(v=1-v),c!==O(h._tTime,g)&&(m=1-v,h.vars.repeatRefresh&&h._initted&&h.invalidate())),v!==m||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(),r(l(t.prototype),"invalidate",this).call(this)}},{key:"kill",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"all";if(!(e||t&&"all"!==t))return this._lazy=this._pt=0,this.parent?$(this):this;if(this.timeline)return d=this.timeline.totalDuration(),this.timeline.killTweensOf(e,t,nn&&!0!==nn.vars.overwrite)._first||$(this),this.parent&&d!==this.timeline.totalDuration()&&N(this,this._dur*this.timeline._tDur/d,0,1),this;var n,r,i,a,s,o,l,u=this._targets,c=e?Tt(e):u,h=this._ptLookup,d=this._pt;if((!t||"all"===t)&&function(e,t){for(var n=e.length,r=n===t.length;r&&n--&&e[n]===t[n];);return n<0}(u,c))return"all"===t&&(this._pt=0),$(this);for(n=this._op=this._op||[],"all"!==t&&(He(t)&&(s={},A(t,(function(e){return s[e]=1})),t=s),t=function(e,t){var n,r,i,a,s=(e=e[0]?ft(e[0]).harness:0)&&e.aliases;if(!s)return t;for(r in n=_({},t),s)if(r in n)for(i=(a=s[r].split(",")).length;i--;)n[a[i]]=n[r];return n}(u,t)),l=u.length;l--;)if(~c.indexOf(u[l]))for(s in r=h[l],"all"===t?(n[l]=t,a=r,i={}):(i=n[l]=n[l]||{},a=t),a)(o=r&&r[s])&&("kill"in o.d&&!0!==o.d.kill(s)||bt(this,o,"_pt"),delete r[s]),"all"!==i&&(i[s]=1);return this._initted&&!this._pt&&d&&$(this),this}}],[{key:"to",value:function(e,n){return new t(e,n,arguments[2])}},{key:"from",value:function(e,t){return z(1,arguments)}},{key:"delayedCall",value:function(e,n,r,i){return new t(n,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:e,onComplete:n,onReverseComplete:n,onCompleteParams:r,onReverseCompleteParams:r,callbackScope:i})}},{key:"fromTo",value:function(e,t,n){return z(2,arguments)}},{key:"set",value:function(e,n){return n.duration=0,n.repeatDelay||(n.repeat=0),new t(e,n)}},{key:"killTweensOf",value:function(e,t,n){return le.killTweensOf(e,t,n)}}]),t}()),pn=(gt(dn.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),A("staggerTo,staggerFrom,staggerFromTo",(function(e){dn[e]=function(){var t=new sn,n=_t.call(arguments,0);return n.splice("staggerFromTo"===e?5:4,0,0),t[e].apply(t,n)}})),function(e,t,n){return e[t]=n}),fn=function(e,t,n){return e[t](n)},mn=function(e,t,n,r){return e[t](r.fp,n)},vn=function(e,t){return ze(e[t])?fn:m(e[t])&&e.setAttribute?Xt:pn},gn=function(e,t){return t.set(t.t,t.p,Math.round(1e6*(t.s+t.c*e))/1e6,t)},yn=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},bn=function(e){for(var t,n,r,i,a=e._pt;a;){for(t=a._next,n=r;n&&n.pr>a.pr;)n=n._next;(a._prev=n?n._prev:i)?a._prev._next=a:r=a,(a._next=n)?n._prev=a:i=a,a=t}e._pt=r},xn=function(){function e(t,n,r,i,a,s,o,l,u){h(this,e),this.t=n,this.s=i,this.c=a,this.p=r,this.r=s||gn,this.d=o||this,this.set=l||pn,this.pr=u||0,(this._next=t)&&(t._prev=this)}return c(e,[{key:"modifier",value:function(e,t,n){this.mSet=this.mSet||this.set,this.set=en,this.m=e,this.mt=n,this.tween=t}}]),e}(),wn=(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})),nt.TweenMax=nt.TweenLite=dn,nt.TimelineLite=nt.TimelineMax=sn,le=new sn({sortChildren:!1,defaults:Re,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Oe.stringFilter=function(e){var t=e.join(" ");if(Lt.lastIndex=0,Lt.test(t))return t=Ft.test(t),e[1]=te(e[1],t),e[0]=te(e[0],t,kt(e[1])),!0},{registerPlugin:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.forEach((function(e){var t=(e=!e.name&&e.default||e).name,n=ze(e),r=(n=t&&!n&&e.init?function(){this._props=[]}:e,{init:w,render:Yt,add:ln,kill:$t,modifier:qt,rawVars:0}),i={targetTest:0,get:0,getSetter:vn,aliases:{},register:0};if(Gt(),e!==n){if(lt[t])return;gt(n,gt(yt(e,r),i)),_(n.prototype,_(r,yt(e,i))),lt[n.prop=t]=n,e.targetTest&&(ht.push(n),at[t]=1),t=("css"===t?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}x(t,n),e.register&&e.register(An,n,xn)}))},timeline:function(e){return new sn(e)},getTweensOf:function(e,t){return le.getTweensOf(e,t)},getProperty:function(e,t,n,r){He(e)&&(e=Tt(e)[0]);var i=ft(e||{}).get,a=n?C:B;return"native"===n&&(n=""),e&&(t?a((lt[t]&&lt[t].get||i)(e,t,n,r)):function(t,n,r){return a((lt[t]&&lt[t].get||i)(e,t,n,r))})},quickSetter:function(e,t,n){var r,i;if(1<(e=Tt(e)).length)return r=e.map((function(e){return An.quickSetter(e,t,n)})),i=r.length,function(e){for(var t=i;t--;)r[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 r=new a;fe._pt=0,r.init(e,n?t+n:t,fe,0,[e]),r.render(1,r),fe._pt&&Yt(1,fe)}:s.set(e,o);return a?l:function(t){return l(e,o,n?t+n: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)),E(Re,e||{})},config:function(e){return E(Oe,e||{})},registerEffect:function(e){var t=e.name,n=e.effect,r=e.plugins,i=e.defaults;e=e.extendTimeline,(r||"").split(",").forEach((function(e){return e&&!lt[e]&&!nt[e]&&b(t+" effect requires "+e+" plugin.")})),ut[t]=function(e,t,r){return n(Tt(e),gt(t||{},i),r)},e&&(sn.prototype[t]=function(e,n,r){return this.add(ut[t](e,Je(n)?n:(r=n)&&{},this),r)})},registerEase:function(e,t){Nt[e]=Vt(t)},parseEase:function(e,t){return arguments.length?Vt(e,t):Nt},getById:function(e){return le.getById(e)},exportRoot:function(){var e,t,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},r=1<arguments.length?arguments[1]:void 0,i=new sn(n);for(i.smoothChildTiming=Ke(n.smoothChildTiming),le.remove(i),i._dp=0,i._time=i._tTime=le._time,e=le._first;e;)t=e._next,!r&&!e._dur&&e instanceof dn&&e.vars.onComplete===e._targets[0]||k(i,e,e._start-e._delay),e=t;return k(le,i,0),i},utils:{wrap:function e(t,n,r){var i=n-t;return We(t)?X(t,e(0,t.length),n):Bt(r,(function(e){return(i+(e-t)%i)%i+t}))},wrapYoyo:function e(t,n,r){var i=n-t,a=2*i;return We(t)?X(t,e(0,t.length-1),n):Bt(r,(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,n){return Q(e,t,0,1,n)},getUnit:Ct,clamp:function(e,t,n){return Bt(n,(function(n){return V(e,t,n)}))},splitColor:It,toArray:Tt,selector:function(e){return e=Tt(e)[0]||b("Invalid scope")||{},function(t){var n=e.current||e.nativeElement||e;return Tt(t,n.querySelectorAll?n:n===e?b("Invalid scope")||he.createElement("div"):e)}},mapRange:Q,pipe:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return t.reduce((function(e,t){return t(e)}),e)}},unitize:function(e,t){return function(n){return e(parseFloat(n))+(t||Ct(n))}},interpolate:function e(t,n,r,i){var a=isNaN(t+n)?0:function(e){return(1-e)*t+e*n};if(!a){var s,o,l,u,c,h=He(t),d={};if(!0===r&&(i=1)&&(r=null),h)t={p:t},n={p:n};else if(We(t)&&!We(n)){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)},r=n}else i||(t=_(We(t)?[]:{},t));if(!l){for(s in n)ln.call(d,t,s,"get",n[s]);a=function(e){return Yt(e,d),h?t.p:t}}}return Bt(r,a)},shuffle:Dt},install:y,effects:ut,ticker:Ut,updateRoot:sn.updateRoot,plugins:lt,globalTimeline:le,core:{PropTween:xn,globals:x,Tween:dn,Timeline:sn,Animation:an,getCache:ft,_removeLinkedListItem:bt,suppressOverwrites:function(e){return oe=e}}}),Sn=(A("to,from,fromTo,delayedCall,set,killTweensOf",(function(e){return wn[e]=dn[e]})),Ut.add(sn.updateRoot),fe=wn.to({},{duration:0}),function(e,t){for(var n=e._pt;n&&n.p!==t&&n.op!==t&&n.fp!==t;)n=n._next;return n}),An=wn.registerPlugin({name:"attr",init:function(e,t,n,r,i){var a,s;for(a in t)(s=this.add(e,"setAttribute",(e.getAttribute(a)||0)+"",t[a],r,i,0,0,a))&&(s.op=a),this._props.push(a)}},{name:"endArray",init:function(e,t){for(var n=t.length;n--;)this.add(e,n,e[n]||0,t[n])}},tn("roundProps",K),tn("modifiers"),tn("snap",Z))||wn;dn.version=sn.version=An.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,n)=>{n.d(t,{N:()=>o,Z:()=>s});var r=n(881),i=n(794),a=n(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 n,r;this.backgroudDom||(this.backgroudDom=document.createElement("div"),({width:n,height:r}=this.runScene.renderEx.getDomSize()),this.backgroudDom.style.position="absolute",this.backgroudDom.style.width=n+"px",this.backgroudDom.style.height=r+"px",t.appendChild(this.backgroudDom)),e?(this.backgroudDom.style.display="block",this.backgroudDom.style.backgroundImage="url("+e+")",this.backgroudDom.style.backgroundRepeat="no-repeat",this.backgroudDom.style.backgroundSize="100% 100%"):this.backgroudDom.style.display="none"}create(){return new r.PerspectiveCamera}createOrthographic(){return new r.OrthographicCamera}setMode(e){if(e!==this.mode){this.runScene.helperEx.transContro.reset(),this.mode=e,this.runScene.assetsEx.reset(),this.reset(this.getCamera()),this.setSize();const t=this.runScene.assetsEx.get().controls;"OrthographicCamera"===e&&(t.enableRotate=!1,t.enablePan=!1)}}getCamera(){return"OrthographicCamera"===this.mode?this.oCam:this.pCam}reset(e){e.position.set(0,20,20);const t=this.runScene.assetsEx.get().controls;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 n=this.getCamera();n.aspect=e/t,n.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:n,z:r}=e.position,{x:t,y:i,z:a}=t.target;return{x:e,y:n,z:r,tx:t,ty:i,tz:a}}setTemp(e,t=.5){(e=this.temp.get(e))&&this.anima(e.data,t)}anima(e,t=.5){const{camera:n,controls:r}=this.runScene.assetsEx;this.animaIns&&(this.animaIns.kill(),this.animaIns=null),this.animaIns=(0,a.gY)(this.getLocal(),e,t,(e=>{var{x:e,y:t,z:i,tx:a,ty:s,tz:o}=e;n.position.set(e,t,i),r.target.set(a,s,o),r.update()}))}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,n)=>{n.d(t,{sG:()=>r,zX:()=>i});const r=["map","normalMap","aoMap"],i=["map","metalnessMap","roughnessMap","normalMap","aoMap","emissiveMap","alphaMap","lightMap","envMap","displacementMap"]},263:(e,t,n)=>{n.d(t,{F6:()=>r,YD:()=>u});var r={};n.r(r),n.d(r,{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 n=0;n<e.length;n++)if(e[n]!==t[n])return!0;return!1};n(794),n(272);var u=n(201)},794:(e,t,n)=>{n.d(t,{Z:()=>i});var r=n(1);class i extends Map{constructor(e){e?super((0,r.mapObj)(e,((e,t)=>[e,t]))):super()}toArray(e){let t=[];for(const n of this.entries())"key"==e?t.push(n[0]):t.push(n[1]);return t}map(e){return[...this.entries()].map((t=>{var[t,n]=t;return e(t,n)}))}toJSON(){const e={};return this.forEach(((t,n)=>{e[n]=t})),e}toString(){return JSON.stringify(this.map)}filter(e,t){let n=[];for(var[r,i]of this.entries())e(r,i)&&n.push("key"===t?r:i);return n}find(e){for(var[t,n]of this.entries())if(e(t,n))return n}static formJSON(e){return new i(e)}copy(e){e.map(((e,t)=>this.set(e,t)))}}},201:(e,t,n)=>{n.r(t),n.d(t,{is:()=>a,isDef:()=>i,logObj:()=>c,objToStr:()=>u,replaceKVForObj:()=>o,replaceKeyForObj:()=>l,replaceValForObj:()=>s});var r=n(1);const i=(e,t)=>{if(!a(e))return!0;var n=Object.keys(e);for(let o=0;o<n.length;o++){var r=n[o],s=e[r];if(r=t[r],a(s))return!a(r)||i(s,r);if(s!==r)return!0}return!1},a=e=>(null==e?void 0:e.constructor)===Object,s=(e,t)=>{let n={};return Object.keys(e).map(((r,i)=>{var a=e[r];n[r]=t(r,a,i)})),n},o=(e,t)=>{let n={};return Object.keys(e).map(((r,i)=>{var a=e[r],{k:r,v:a}=t(r,a,i);n[r]=a})),n},l=(e,t)=>{let n={};return Object.keys(e).map(((r,i)=>{var a=e[r];n[t(r,a,i)]=a})),n},u=e=>{let t="";return(0,r.mapObj)(e,((e,n)=>{console.log(n,"v"),t=(t+=e+":")+(a(n)?u(n):n)})),t},c=e=>{console.log(u(e))}},272:(e,t,n)=>{n.d(t,{Z:()=>r});class r extends Set{constructor(e){super(),this.isSet=!0,this.add(e||[])}add(e){return Array.isArray(e)?e.map((e=>this.add(e))):super.add(e),this}remove(e){if(Array.isArray(e))e.map((e=>this.remove(e)));else{if(!super.has(e))return;super.delete(e)}return this}toArray(){return[...this]}map(e,t=!1){const n=[];return this.forEach((r=>{if(r=e(r),!t)return n.push(r);r&&n.push(r)})),n}find(e){for(const t of this)if(e(t))return t}filter(e){const t=[];for(const n of this)e(n)&&t.push(n);return t}}},247:(e,t,n)=>{n.d(t,{Z:()=>r});const r=t=n(881)},598:(e,t,n)=>{n.d(t,{Z:()=>r});class r{constructor(e){this.runScene=e}}},585:(e,t,n)=>{n.d(t,{Z:()=>i});var r=n(247);class i extends n(598).Z{get(){throw new Error("Method not implemented.")}static toJSON(e){const{intensity:t,name:n,type:r,position:i,visible:a,color:s,castShadow:o,shadow:l,rotation:u,target:c}=e;var{mapSize:e,camera:h}=l,{scale:h,near:d,far:p}=h;return{type:r,intensity:t,name:n,visible:a,color:s.getHexString(),castShadow:o,shadow:{mapSize:e.x,camera:{near:d,far:p,scale:h.x}},position:{x:i.x,y:i.y,z:i.z},rotation:{x:u.x,y:u.y,z:u.z},targetPosition:{x:c.position.x,y:c.position.y,z:c.position.z}}}parseJSON(e,t){t=this.runScene.lightEx.get("DirectionalLight",t);var[n]=t;return i.setConfig(n,e),t}static setConfig(e,t){const{intensity:n,position:i,rotation:a,targetPosition: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=n,e.name=o,e.visible=l,e.castShadow=c,e.color=new r.Z.Color(u.includes(u)?u:"#"+u),i&&e.position.set(i.x,i.y,i.z),a&&e.rotation.set(a.x,a.y,a.z),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()}}},269:(e,t,n)=>{n.d(t,{ZP:()=>M,RQ:()=>B});var r=n(1),i=n(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 n,r=l(e);if(n=t?(n=l(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===a(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=function(e){var t=r;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e);var n=o(r);function r(e,t){if(!(this instanceof r))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=n.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=r,(e=[{key:"updateMatrixWorld",value:function(){var e,t;this.scale.set(.5*this.light.width,.5*this.light.height,1),void 0!==this.color?(this.material.color.set(this.color),this.children[0].material.color.set(this.color)):(this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),e=this.material.color,1<(t=Math.max(e.r,e.g,e.b))&&e.multiplyScalar(1/t),this.children[0].material.color.copy(this.material.color)),this.matrixWorld.extractRotation(this.light.matrixWorld).scale(this.scale).copyPosition(this.light.matrixWorld),this.children[0].matrixWorld.copy(this.matrixWorld)}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),r}(i.Line),c=n(247);t=n(598);class h extends t.Z{get(){}static toJSON(e){const{type:t,intensity:n,name:r,visible:i,color:a}=e;return{type:t,intensity:n,name:r,visible:i,color:a.getHexString()}}parseJSON(e){var t=this.runScene.lightEx.get("AmbientLight");const[n]=t;var{type:e,intensity:r,name:i,visible:a,color:s}=e;return n.intensity=r,n.type=e,n.name=i,n.visible=a,n.color=new c.Z.Color("#"+s),t}}var d=n(585);class p extends t.Z{get(){throw new Error("Method not implemented.")}static toJSON(e){const{type:t,intensity:n,name:r,visible:i,color:a,groundColor:s,position:o}=e;return{name:r,type:t,intensity:n,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[n]=t;var{type:e,intensity:r,name:i,visible:a,color:s,groundColor:o,position:l}=e;return n.type=e,n.intensity=r,n.name=i,n.visible=a,n.color=new c.Z.Color("#"+s),n.groundColor=new c.Z.Color("#"+o),n.position.set(l.x,l.y,l.z),t}}class f extends t.Z{get(){throw new Error("Method not implemented.")}static toJSON(e){const{name:t,type:n,intensity:r,distance:i,decay:a,renderOrder:s,color:o,visible:l,castShadow:u,shadow:c,position:h}=e;var{mapSize:e,camera:d,bias:p,radius:f}=c,{scale:d,near:m,far:v}=d;return{name:t,type:n,intensity:r,visible:l,color:o.getHexString(),castShadow:u,distance:i,decay:a,renderOrder:s,shadow:{mapSize:e.x,camera:{near:m,far:v,scale:d.x},radius:f,bias:p},position:{x:h.x,y:h.y,z:h.z}}}parseJSON(e){var t=this.runScene.lightEx.get("PointLight");const[n]=t;var{name:e,type:r,intensity:i,distance:a,decay:s,renderOrder:o,color:l,visible:u,castShadow:h,shadow:d,position:p}=e,{mapSize:d,camera:f,bias:m,radius:v}=d,{scale:f,near:g,far:y}=f;return n.intensity=i,n.type=r,n.name=e,n.visible=u,n.castShadow=h,n.distance=a,n.renderOrder=o,n.color=new c.Z.Color("#"+l),n.position.set(p.x,p.y,p.z),n.shadow.mapSize.x=d,n.shadow.mapSize.y=d,n.shadow.bias=m,n.decay=s,n.shadow.radius=v,n.shadow.camera.scale.x=f,n.shadow.camera.scale.y=f,n.shadow.camera.scale.z=f,n.shadow.camera.near=g,n.shadow.camera.far=y,n.shadow.camera.updateProjectionMatrix(),t}}class m{constructor(e){this.runScene=e}static toJSON(e){const{type:t,intensity:n,name:r,visible:i,color:a,position:s}=e;return{name:r,type:t,intensity:n,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[n]=t;var{type:e,intensity:r,name:i,visible:a,color:s,position:o}=e;return n.type=e,n.intensity=r,n.name=i,n.visible=a,n.color=new c.Z.Color("#"+s),n.position.set(o.x,o.y,o.z),t}}class v{constructor(e){this.runScene=e}static toJSON(e){const{name:t,type:n,color:r,distance:i,decay:a,intensity:s,angle:o,penumbra:l,visible:u,castShadow:c,shadow:h,renderOrder:d,position:p,target:f}=e;var{bias:e,camera:m,normalBias:v,mapSize:g,radius:y}=h,m=m.near;return{type:n,intensity:s,name:t,visible:u,distance:i,angle:o,decay:a,penumbra:l,renderOrder:d,color:r.getHexString(),castShadow:c,shadow:{bias:e,normalBias:v,mapSize:g.x,camera:{near:m},radius:y},position:{x:p.x,y:p.y,z:p.z},targetPosition:{x:f.position.x,y:f.position.y,z:f.position.z}}}parseJSON(e){var t=this.runScene.lightEx.get("SpotLight");const[n]=t;var{name:e,type:r,color:i,distance:a,decay:s,intensity:o,angle:l,penumbra:u,visible:h,castShadow:d,shadow:p,renderOrder:f,position:m,targetPosition:v}=e,{bias:p,camera:g,normalBias:y,mapSize:b,radius:x}=p,g=g.near;return n.intensity=o,n.type=r,n.name=e,n.visible=h,n.distance=a,n.decay=s,n.angle=l,n.penumbra=u,n.renderOrder=f,n.castShadow=d,n.color=new c.Z.Color("#"+i),n.position.set(m.x,m.y,m.z),n.shadow.mapSize.x=b,n.shadow.mapSize.y=b,n.shadow.camera.near=g,n.target.position.set(v.x,v.y,v.z),n.shadow.bias=p,n.shadow.normalBias=y,n.shadow.radius=x,n.shadow.camera.updateProjectionMatrix(),t}}var g=n(529),y=n(735),b=n(510),x=n(169),w=n(729),S=n(457);const A={DirectionalLight:d.Z,PointLight:f,SpotLight:v,RectAreaLight:m,HemisphereLight:p,AmbientLight:h};class M{constructor(e){this.shadowList=["DirectionalLight","PointLight","SpotLight"],this.helperList=["DirectionalLight","PointLight","SpotLight","RectAreaLight","HemisphereLight"],this.lightDom=void 0,this.helperUpdateList=["DirectionalLight","PointLight","SpotLight","HemisphereLight"],this.runScene=e,this.lightExMap={DirectionalLight:new d.Z(e),PointLight:new f(e),SpotLight:new v(e),RectAreaLight:new m(e),HemisphereLight:new p(e),AmbientLight:new h(e)}}getLightsByScene(e=this.runScene.sceneEx.get()){return e.children.filter((e=>e.isLight))}add(e,t){e=e.map((e=>this.runScene.modelEx.add(e,void 0,Object.assign(Object.assign({},t),{select:!!B(e)&&t.select,addUndo:!1})))),t.addUndo&&this.runScene.undoEx.addUndo(e)}get(e,t){t=(0,S.mergeObject)({id:(0,r.getId)()},t).id;let n=new c.Z[e],i=[n];return n.position.y=10,n.name=e,n.userData.id=t,this.shadowList.includes(e)&&(n.castShadow=!0),this.setLight(n),i.push(...this.setLightHelper(n)),null!=(t=null==n?void 0:n.lightHelper)&&t.update(),i}setNull(e){e.userData.light&&this.setNull(e.userData.light),this.isLight(e)&&("DirectionalLight"===e.type?e.cameraHelper&&(e.cameraHelper.visible=!1):"SpotLight"===e.type&&(e.cameraHelper&&(e.cameraHelper.visible=!1),e.helper&&(e.helper.visible=!0)))}setSelect(e){e.userData.light&&this.setSelect(e.userData.light),this.isLight(e)&&("DirectionalLight"===e.type?e.cameraHelper&&(e.cameraHelper.visible=!0):"SpotLight"===e.type&&(e.cameraHelper&&(e.cameraHelper.visible=!0),e.helper&&(e.helper.visible=!0)))}update(e){var t;e.userData.isLightTarget&&e.userData.light&&(e=e.userData.light),this.isLight(e)&&("DirectionalLight"===e.type||"SpotLight"===e.type?(null!=(t=e.helper)&&t.update(),null!=(t=e.cameraHelper)&&t.update()):null!=(e=null==(t=e.helper)?void 0:t.update)&&e.call(t))}remove(e,t=!0){let n;return this.runScene.helperEx.unfocus(),n="DirectionalLight"===e.type||"SpotLight"===e.type?[e,e.cameraHelper,e.helper].map((t=>{if(t)return new x.Z({addTree:t===e,runScene:this.runScene,model:t,parent:t.parent||this.runScene.sceneEx.get()}).execute()})).filter((e=>e)):[e,e.helper].map((t=>{if(t)return new x.Z({addTree:t===e,runScene:this.runScene,model:t,parent:t.parent||this.runScene.sceneEx.get()}).execute()})).filter((e=>e)),t&&n&&this.runScene.undoEx.addUndo(n),n}getLightHelper(e,t){this.runScene.uniqueEx.model.add(t);const n=(0,w.K)(t);let r,i=[];switch(e){case"RectAreaLight":r=new u(t,16773120);break;case"DirectionalLight":if(r=new c.Z.DirectionalLightHelper(t,1,16711680),t.children[0])t.target=t.children[0];else{let e=new c.Z.Object3D;(t.target=e).name="helperModel",e.position.y=-10,t.shadow.autoUpdate=!0,e.userData.isLightTarget=!0,(e.userData.light=t).add(e)}t.shadow.camera.layers.set(1),t.shadow.camera.far=1e5,t.shadowCameraLeft=-5,t.shadowCameraRight=5,t.shadowCameraTop=5,t.shadowCameraBottom=-5,t.shadow.camera.updateProjectionMatrix();const e=new c.Z.CameraHelper(t.shadow.camera);t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(e,!0,(e=>{e.userData.id=n,e.userData.unClick=!0})),e.userData.id=n,e.userData.unClick=!0,e.visible=!1,t.cameraHelper=e,i.push(e);break;case"PointLight":r=new c.Z.PointLightHelper(t,1,16711935);break;case"SpotLight":r=new c.Z.SpotLightHelper(t);let a=new c.Z.Object3D;(t.target=a).name="helperModel",a.userData.isLightTarget=!0,a.userData.light=t,a.position.y=-10,t.shadow.autoUpdate=!0,t.add(a);const s=new c.Z.CameraHelper(t.shadow.camera);t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(s,!0,(e=>{e.userData.id=n})),s.userData.id=n,s.visible=!1,t.cameraHelper=s,i.push(s);break;case"HemisphereLight":r=new c.Z.HemisphereLightHelper(t,1,16773135)}return r.name="helperModel",this.runScene.helperEx.setHelper(r,!0,(e=>{e.userData.id=n})),r.userData.id=n,(r.light=t).helper=r,this.update(t),i.push(r),i}setLightHelper(e){return"editor"===this.runScene.optionsEx.options.mode&&this.helperList.includes(e.type)?this.getLightHelper(e.type,e):[]}isUpdateHelper(e){return this.helperUpdateList.includes(e)}initLight(e){e.forEach((e=>this.setLightHelper(e)))}setNormal(e,t=0){var{model:e,info:n,val:r,cb:i}=e;return new b.Z({target:e,runScene:this.runScene,info:n,oldVal:e[n],newVal:r,cb:i}).execute()}setMultip(e,t,n=!0,r=!0){if(e instanceof Array)return i=e.map((e=>{var{model:e,typeList:r,newVal:i}=e;const a=new y.Z({target:e,typeList:r,newVal:i,cb:t});return n?a.execute():a})),r&&this.runScene.undoEx.addUndo(i),i;{var{model:i,typeList:e,newVal:a}=e;const s=new y.Z({target:i,typeList:e,newVal:a,cb:t});return r&&this.runScene.undoEx.addUndo(s),n?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,g.isHelper)(e))).map((e=>{var t=e.type;return A[t].toJSON(e)}))}}const B=e=>null==(e=null==e?void 0:e.userData)?void 0:e.isLight},143:(e,t,n)=>{n.d(t,{B:()=>Pe,Z:()=>De});var r=n(881),i=(t=n(300),n.n(t));function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}n(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 n,r="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB";function i(e,t,r,i,a,s){var o=n.exports.sbrk,l=r+3&-4,u=o(l*i),c=o(a.length),h=new Uint8Array(n.exports.memory.buffer);if(0==(h.set(a,c),e=e(u,r,i,c,a.length))&&s&&s(u,l,i),t.set(h.subarray(u,u+r*i)),o(u-o(0)),0!=e)throw new Error("Malformed buffer data: "+e)}WebAssembly.validate(e)&&(r="B9h9z9tFBBBFiI9gBB9gLaaaaaFa9gEaaaB9gFaFaEMcBBFBFFGGGEILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBOn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBNI9z9iqlBVc+N9IcIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMk8lLbaE97F9+FaL978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAeDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAeDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBReCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBH8ZCFD9tA8ZAPD9OD9hD9RH8ZDQBTFtGmEYIPLdKeOnHpAIAQJDBIBHyCFD9tAyAPD9OD9hD9RHyAIASJDBIBH8cCFD9tA8cAPD9OD9hD9RH8cDQBTFtGmEYIPLdKeOnH8dDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAeD9uHeDyBjGBAEAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeApA8dDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNiV8ZcpMyS8cQ8df8eb8fHdAyA8cDQNiV8ZcpMyS8cQ8df8eb8fH8ZDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/dLEK97FaF97GXGXAGCI9HQBAF9FQFCBRGEXABABDBBBHECiD+rFCiD+sFD/6FHIAECND+rFCiD+sFD/6FAID/gFAECTD+rFCiD+sFD/6FHLD/gFD/kFD/lFHKCBDtD+2FHOAICUUUU94DtHND9OD9RD/kFHI9DBB/+hDYAIAID/mFAKAKD/mFALAOALAND9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHLD/mF9DBBX9LDYHOD/kFCgFDtD9OAECUUU94DtD9OD9QAIALD/mFAOD/kFCND+rFCU/+EDtD9OD9QAKALD/mFAOD/kFCTD+rFCUU/8ODtD9OD9QDMBBABCTJRBAGCIJHGAF9JQBSGMMAF9FQBCBRGEXABCTJHVAVDBBBHECBDtHOCUU98D8cFCUU98D8cEHND9OABDBBBHKAEDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAKAEDQBFGENVcMTtmYi8ZpyHECTD+sFD/6FHID/gFAECTD+rFCTD+sFD/6FHLD/gFD/kFD/lFHE9DB/+g6DYALAEAOD+2FHOALCUUUU94DtHcD9OD9RD/kFHLALD/mFAEAED/mFAIAOAIAcD9OD9RD/kFHEAED/mFD/kFD/kFD/jFD/nFHID/mF9DBBX9LDYHOD/kFCTD+rFALAID/mFAOD/kFCggEDtD9OD9QHLAEAID/mFAOD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHEDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAKAND9OALAEDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM/hEIGaF97FaL978jUUUUBCTlREGXAF9FQBCBRIEXAEABDBBBHLABCTJHKDBBBHODQILKOSQfbPden8c8d8e8fHNCTD+sFHVCID+rFDMIBAB9DBBU8/DY9D/zI818/DYAVCEDtD9QD/6FD/nFHVALAODQBFGENVcMTtmYi8ZpyHLCTD+rFCTD+sFD/6FD/mFHOAOD/mFAVALCTD+sFD/6FD/mFHcAcD/mFAVANCTD+rFCTD+sFD/6FD/mFHNAND/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHVD/mF9DBBX9LDYHLD/kFCggEDtHMD9OAcAVD/mFALD/kFCTD+rFD9QHcANAVD/mFALD/kFCTD+rFAOAVD/mFALD/kFAMD9OD9QHVDQBFTtGEmYILPdKOenHLD8dBAEDBIBDyB+t+J83EBABCNJALD8dFAEDBIBDyF+t+J83EBAKAcAVDQNVi8ZcMpySQ8c8dfb8e8fHVD8dBAEDBIBDyG+t+J83EBABCiJAVD8dFAEDBIBDyE+t+J83EBABCAJRBAICIJHIAF9JQBMMM9jFF97GXAGCGrAF9sHG9FQBCBRFEXABABDBBBHECND+rFCND+sFD/6FAECiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBABCTJRBAFCIJHFAG9JQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",console.log("Warning: meshopt_decoder is using experimental SIMD support")),e=WebAssembly.instantiate(function(e){for(var n=new Uint8Array(e.length),r=0;r<e.length;++r){var i=e.charCodeAt(r);n[r]=96<i?i-71:64<i?i-65:47<i?i+4:46<i?63:62}var a=0;for(r=0;r<e.length;++r)n[a++]=n[r]<60?t[n[r]]:64*(n[r]-60)+n[++r];return n.buffer.slice(0,a)}(r),{}).then((function(e){(n=e.instance).exports.__wasm_call_ctors()}));var 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,r,a,o){i(n.exports.meshopt_decodeVertexBuffer,e,t,r,a,n.exports[s[o]])},decodeIndexBuffer:function(e,t,r,a){i(n.exports.meshopt_decodeIndexBuffer,e,t,r,a)},decodeIndexSequence:function(e,t,r,a){i(n.exports.meshopt_decodeIndexSequence,e,t,r,a)},decodeGltfBuffer:function(e,t,r,a,l,u){i(n.exports[o[l]],e,t,r,a,n.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 n,r=c(e);if(n=t?(n=c(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===o(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var h=new WeakMap,d=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e);var n=u(i);function i(e){if(this instanceof i)return(e=n.call(this,e)).decoderPath="",e.decoderConfig={},e.decoderBinary=null,e.decoderPending=null,e.workerLimit=4,e.workerPool=[],e.workerNextTaskID=1,e.workerSourceURL="",e.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},e.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},e;throw new TypeError("Cannot call a class as a function")}return t=i,(e=[{key:"setDecoderPath",value:function(e){return this.decoderPath=e,this}},{key:"setDecoderConfig",value:function(e){return this.decoderConfig=e,this}},{key:"setWorkerLimit",value:function(e){return this.workerLimit=e,this}},{key:"load",value:function(e,t,n,i){var a=this,s=new r.FileLoader(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(e){var n={attributeIDs:a.defaultAttributeIDs,attributeTypes:a.defaultAttributeTypes,useUniqueIDs:!1};a.decodeGeometry(e,n).then(t).catch(i)}),n,i)}},{key:"decodeDracoFile",value:function(e,t,n,r){r={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!n},this.decodeGeometry(e,r).then(t)}},{key:"decodeGeometry",value:function(e,t){var n,r=this;for(n in t.attributeTypes){var i=t.attributeTypes[n];void 0!==i.BYTES_PER_ELEMENT&&(t.attributeTypes[n]=i.name)}var a,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(n){return a=n,new Promise((function(n,r){a._callbacks[o]={resolve:n,reject:r},a.postMessage({type:"decode",id:o,taskConfig:t,buffer:e},[e])}))})).then((function(e){return r._createGeometry(e.geometry)})),l.catch((function(){return!0})).then((function(){a&&o&&r._releaseTask(a,o)})),h.set(e,{key:s,promise:l}),l}},{key:"_createGeometry",value:function(e){var t=new r.BufferGeometry;e.index&&t.setIndex(new r.BufferAttribute(e.index.array,1));for(var n=0;n<e.attributes.length;n++){var i=(s=e.attributes[n]).name,a=s.array,s=s.itemSize;t.setAttribute(i,new r.BufferAttribute(a,s))}return t}},{key:"_loadLibrary",value:function(e,t){var n=new r.FileLoader(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((function(t,r){n.load(e,t,void 0,r)}))}},{key:"preload",value:function(){return this._initDecoder(),this}},{key:"_initDecoder",value:function(){var e=this;if(this.decoderPending)return this.decoderPending;var t="object"!==("undefined"==typeof WebAssembly?"undefined":o(WebAssembly))||"js"===this.decoderConfig.type,n=[];return t?n.push(this._loadLibrary("draco_decoder.js","text")):(n.push(this._loadLibrary("draco_wasm_wrapper.js","text")),n.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(n).then((function(n){var r=n[0];t||(e.decoderConfig.wasmBinary=n[1]),n=function(){var e,t;onmessage=function(n){var r=n.data;switch(r.type){case"init":e=r.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var i=r.buffer,a=r.taskConfig;t.then((function(e){var t=new(e=e.draco).Decoder,n=new e.DecoderBuffer;n.Init(new Int8Array(i),i.byteLength);try{var s=function(e,t,n,r){var i,a=r.attributeIDs,s=r.attributeTypes,o=t.GetEncodedGeometryType(n);if(o===e.TRIANGULAR_MESH)i=new e.Mesh,g=t.DecodeBufferToMesh(n,i);else{if(o!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");i=new e.PointCloud,g=t.DecodeBufferToPointCloud(n,i)}if(!g.ok()||0===i.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+g.error_msg());var l,u,c,h,d,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(r.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=(n=e,g=t,b=4*(y=3*(o=i).num_faces()),x=n._malloc(b),g.GetTrianglesUInt32Array(o,b,x),g=new Uint32Array(n.HEAPF32.buffer,x,y).slice(),n._free(x),{array:g,itemSize:1})),e.destroy(i),w}(e,t,n,a),o=s.attributes.map((function(e){return e.array.buffer}));s.index&&o.push(s.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:s},o)}catch(e){console.error(e),self.postMessage({type:"error",id:r.id,error:e.message})}finally{e.destroy(n),e.destroy(t)}}))}}}.toString(),r=["/* draco decoder */",r,"","/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n"),e.workerSourceURL=URL.createObjectURL(new Blob([r]))})),this.decoderPending}},{key:"_getWorker",value:function(e,t){var n=this;return this._initDecoder().then((function(){n.workerPool.length<n.workerLimit?((r=new Worker(n.workerSourceURL))._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:n.decoderConfig}),r.onmessage=function(e){var t=e.data;switch(t.type){case"decode":r._callbacks[t.id].resolve(t);break;case"error":r._callbacks[t.id].reject(t);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+t.type+'"')}},n.workerPool.push(r)):n.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));var r,i=n.workerPool[n.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i}))}},{key:"_releaseTask",value:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}},{key:"debug",value:function(){console.log("Task load: ",this.workerPool.map((function(e){return e._taskLoad})))}},{key:"dispose",value:function(){for(var e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.Loader),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,n){return Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(t,n,r){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var i=this,a=!1,s=0,o=0,l=void 0,u=[];this.onStart=void 0,this.onLoad=t,this.onProgress=n,this.onError=r,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,n=u.length;t<n;t+=2){var r=u[t],i=u[t+1];if(r.global&&(r.lastIndex=0),r.test(e))return i}return null}})));var m=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.manager=void 0!==t?t:f,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}var t,n;return t=e,(n=[{key:"load",value:function(){}},{key:"loadAsync",value:function(e,t){var n=this;return new Promise((function(r,i){n.load(e,r,t,i)}))}},{key:"parse",value:function(){}},{key:"setCrossOrigin",value:function(e){return this.crossOrigin=e,this}},{key:"setWithCredentials",value:function(e){return this.withCredentials=e,this}},{key:"setPath",value:function(e){return this.path=e,this}},{key:"setResourcePath",value:function(e){return this.resourcePath=e,this}},{key:"setRequestHeader",value:function(e){return this.requestHeader=e,this}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function v(e){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function y(e,t){return(y=Object.setPrototypeOf||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=r,t=m;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&y(e,t);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=b(e);if(n=t?(n=b(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===v(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(r);function r(e){if(this instanceof r)return e=n.call(this,e),"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),e.options={premultiplyAlpha:"none"},e;throw new TypeError("Cannot call a class as a function")}return e=r,(t=[{key:"setOptions",value:function(e){return this.options=e,this}},{key:"load",value:function(e,t,n,r,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var a=this,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 n=(r=a.options).textureQuality,r=r.reverseTexture,s=i.notCompress,o=i.size,l=0===e.size?new ImageData(1,1):e;t(o&&1!==n?(o=(t=i.size).w,t=t.h,s=s?1:n,createImageBitmap(l,Object.assign(a.options,{imageOrientation:r?"none":"flipY",resizeHeight:t*s,resizeWidth:o*s}))):createImageBitmap(l,Object.assign(a.options,{imageOrientation:r?"none":"flipY"})))})),Promise.resolve(e)])})).then((function(n){n=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],s=!0,o=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(a.push(r.value),2!==a.length);s=!0);}catch(e){o=!0,i=e}finally{try{s||null==n.return||n.return()}finally{if(o)throw i}}return a}}(e)||function(e,t){if(e){if("string"==typeof e)return g(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(e,2):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(n);var r=n[0];n=n[1],p.add(e,r),t&&t(r,n),a.manager.itemEnd(e)})).catch((function(t){r&&r(t),a.manager.itemError(e),a.manager.itemEnd(e)})),a.manager.itemStart(e)}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),r}(),w=(x.prototype.isImageBitmapLoader=!0,n(457));function S(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],s=!0,o=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);s=!0);}catch(e){o=!0,i=e}finally{try{s||null==n.return||n.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 n,r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=B(e))||t&&e&&"number"==typeof e.length)return r&&(e=r),n=0,{s:t=function(){},n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.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 n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?C(e,t):void 0}}function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function _(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,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=L(e)););return e}(e,t);if(r)return(r=Object.getOwnPropertyDescriptor(r,t)).get?r.get.call(arguments.length<3?e:n):r.value}).apply(this,arguments)}function T(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function D(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function P(e,t,n){return t&&D(e.prototype,t),n&&D(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function O(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&R(e,t)}function R(e,t){return(R=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function I(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=L(e);if(n=t?(n=L(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===_(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return k(r)}}function k(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function L(e){return(L=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var F=function(){O(t,r.Loader);var e=I(t);function t(n){return T(this,t),(n=e.call(this,n)).dracoLoader=null,n.ktx2Loader=null,n.meshoptDecoder=null,n.pluginCallbacks=[],n.register((function(e){return new H(e)})),n.register((function(e){return new W(e)})),n.register((function(e){return new X(e)})),n.register((function(e){return new z(e)})),n.register((function(e){return new V(e)})),n.register((function(e){return new J(e)})),n.register((function(e){return new K(e)})),n.register((function(e){return new Z(e)})),n.register((function(e){return new N(e)})),n.register((function(e){return new Q(e)})),n}return P(t,[{key:"load",value:function(e,t,n,i){function a(t){i?i(t):console.error(t),s.manager.itemError(e),s.manager.itemEnd(e)}var s=this,o=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:r.LoaderUtils.extractUrlBase(e),l=(this.manager.itemStart(e),new r.FileLoader(this.manager));l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,(function(n){try{s.parse(n,o,(function(n){t(n),s.manager.itemEnd(e)}),a)}catch(n){a(n)}}),n,a)}},{key:"setDRACOLoader",value:function(e){return this.dracoLoader=e,this}},{key:"setDDSLoader",value:function(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}},{key:"setKTX2Loader",value:function(e){return this.ktx2Loader=e,this}},{key:"setMeshoptDecoder",value:function(e){return this.meshoptDecoder=e,this}},{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,n,i,a){var s,o={},l={};if("string"==typeof e)s=e;else if(r.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=r.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 ne;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 re;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(n,i)}}},{key:"parseAsync",value:function(e,t){var n=this;return new Promise((function(r,i){n.parse(e,t,r,i)}))}}]),t}();function U(){var e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}var G={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"},N=function(){function e(t){T(this,e),this.parser=t,this.name=G.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return P(e,[{key:"_markDefs",value:function(){for(var e=this.parser,t=this.parser.json.nodes||[],n=0,r=t.length;n<r;n++){var i=t[n];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}},{key:"_loadLight",value:function(e){var t=this.parser,n="light:"+e,i=t.cache.get(n);if(i)return i;var a,s=t.json,o=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e],l=new r.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 r.DirectionalLight(l)).target.position.set(0,0,-1),a.add(a.target);break;case"point":(a=new r.PointLight(l)).distance=u;break;case"spot":(a=new r.SpotLight(l)).distance=u,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(n,i),i}},{key:"createNodeAttachment",value:function(e){var t=this,n=this.parser,r=((e=n.json.nodes[e]).extensions&&e.extensions[this.name]||{}).light;return void 0===r?null:this._loadLight(r).then((function(e){return n._getNodeRef(t.cache,r,e)}))}}]),e}(),j=function(){function e(){T(this,e),this.name=G.KHR_MATERIALS_UNLIT}return P(e,[{key:"getMaterialType",value:function(){return r.MeshBasicMaterial}},{key:"extendParams",value:function(e,t,n){var i,a=[];return e.color=new r.Color(1,1,1),e.opacity=1,(t=t.pbrMetallicRoughness)&&(Array.isArray(t.baseColorFactor)&&(i=t.baseColorFactor,e.color.fromArray(i),e.opacity=i[3]),void 0!==t.baseColorTexture&&a.push(n.assignTexture(e,"map",t.baseColorTexture))),Promise.all(a)}}]),e}(),H=function(){function e(t){T(this,e),this.parser=t,this.name=G.KHR_MATERIALS_CLEARCOAT}return P(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser;if(!(e=n.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var i=[];return void 0!==(e=e.extensions[this.name]).clearcoatFactor&&(t.clearcoat=e.clearcoatFactor),void 0!==e.clearcoatTexture&&i.push(n.assignTexture(t,"clearcoatMap",e.clearcoatTexture)),void 0!==e.clearcoatRoughnessFactor&&(t.clearcoatRoughness=e.clearcoatRoughnessFactor),void 0!==e.clearcoatRoughnessTexture&&i.push(n.assignTexture(t,"clearcoatRoughnessMap",e.clearcoatRoughnessTexture)),void 0!==e.clearcoatNormalTexture&&(i.push(n.assignTexture(t,"clearcoatNormalMap",e.clearcoatNormalTexture)),void 0!==e.clearcoatNormalTexture.scale&&(n=e.clearcoatNormalTexture.scale,t.clearcoatNormalScale=new r.Vector2(n,n))),Promise.all(i)}}]),e}(),z=function(){function e(t){T(this,e),this.parser=t,this.name=G.KHR_MATERIALS_SHEEN}return P(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser;if(!(e=n.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var i=[];return void 0!==(t.sheenColor=new r.Color(0,0,0),t.sheenRoughness=0,t.sheen=1,e=e.extensions[this.name]).sheenColorFactor&&t.sheenColor.fromArray(e.sheenColorFactor),void 0!==e.sheenRoughnessFactor&&(t.sheenRoughness=e.sheenRoughnessFactor),void 0!==e.sheenColorTexture&&i.push(n.assignTexture(t,"sheenColorMap",e.sheenColorTexture)),void 0!==e.sheenRoughnessTexture&&i.push(n.assignTexture(t,"sheenRoughnessMap",e.sheenRoughnessTexture)),Promise.all(i)}}]),e}(),V=function(){function e(t){T(this,e),this.parser=t,this.name=G.KHR_MATERIALS_TRANSMISSION}return P(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser;if(!(e=n.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var r=[];return void 0!==(e=e.extensions[this.name]).transmissionFactor&&(t.transmission=e.transmissionFactor),void 0!==e.transmissionTexture&&r.push(n.assignTexture(t,"transmissionMap",e.transmissionTexture)),Promise.all(r)}}]),e}(),J=function(){function e(t){T(this,e),this.parser=t,this.name=G.KHR_MATERIALS_VOLUME}return P(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){if(!(e=(i=this.parser).json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var n=[],i=(e=e.extensions[this.name],t.thickness=void 0!==e.thicknessFactor?e.thicknessFactor:0,void 0!==e.thicknessTexture&&n.push(i.assignTexture(t,"thicknessMap",e.thicknessTexture)),t.attenuationDistance=e.attenuationDistance||0,e.attenuationColor||[1,1,1]);return t.attenuationColor=new r.Color(i[0],i[1],i[2]),Promise.all(n)}}]),e}(),K=function(){function e(t){T(this,e),this.parser=t,this.name=G.KHR_MATERIALS_IOR}return P(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?(e=e.extensions[this.name],t.ior=void 0!==e.ior?e.ior:1.5,Promise.resolve()):Promise.resolve()}}]),e}(),Z=function(){function e(t){T(this,e),this.parser=t,this.name=G.KHR_MATERIALS_SPECULAR}return P(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser;if(!(e=n.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var i=[],a=(e=e.extensions[this.name],t.specularIntensity=void 0!==e.specularFactor?e.specularFactor:1,void 0!==e.specularTexture&&i.push(n.assignTexture(t,"specularIntensityMap",e.specularTexture)),e.specularColorFactor||[1,1,1]);return t.specularColor=new r.Color(a[0],a[1],a[2]),void 0!==e.specularColorTexture&&i.push(n.assignTexture(t,"specularColorMap",e.specularColorTexture).then((function(e){e.encoding=r.sRGBEncoding}))),Promise.all(i)}}]),e}(),W=function(){function e(t){T(this,e),this.parser=t,this.name=G.KHR_TEXTURE_BASISU}return P(e,[{key:"loadTexture",value:function(e){var t=this.parser,n=t.json;if(!(r=n.textures[e]).extensions||!r.extensions[this.name])return null;var r=r.extensions[this.name],i=t.options.ktx2Loader;if(i)return t.loadTextureImage(e,r.source,i);if(n.extensionsRequired&&0<=n.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}}]),e}(),X=function(){function e(t){T(this,e),this.parser=t,this.name=G.EXT_TEXTURE_WEBP,this.isSupported=null}return P(e,[{key:"loadTexture",value:function(e){var t=this.name,n=this.parser,r=n.json;if(!(i=r.textures[e]).extensions||!i.extensions[t])return null;var i=i.extensions[t],a=r.images[i.source],s=n.textureLoader;return a.uri&&null!==(i=n.options.manager.getHandler(a.uri))&&(s=i),this.detectSupport().then((function(i){if(i)return n.loadTextureImage(e,a,s);if(r.extensionsRequired&&0<=r.extensionsRequired.indexOf(t))throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)}))}},{key:"detectSupport",value:function(){return this.isSupported||(this.isSupported=new Promise((function(e){var t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}]),e}(),Q=function(){function e(t){T(this,e),this.name=G.EXT_MESHOPT_COMPRESSION,this.parser=t}return P(e,[{key:"loadBufferView",value:function(e){var t=this.parser.json;if((e=t.bufferViews[e]).extensions&&e.extensions[this.name]){var n=e.extensions[this.name],r=(e=this.parser.getDependency("buffer",n.buffer),this.parser.options.meshoptDecoder);if(r&&r.supported)return Promise.all([e,r.ready]).then((function(e){var t=n.byteOffset||0,i=n.byteLength||0,a=n.count,s=n.byteStride,o=new ArrayBuffer(a*s);return e=new Uint8Array(e[0],t,i),r.decodeGltfBuffer(new Uint8Array(o),a,s,e,n.mode,n.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){T(this,e),this.name=G.KHR_BINARY_GLTF,this.content=null,this.body=null;var n=new DataView(t,0,12);if(this.header={magic:r.LoaderUtils.decodeText(new Uint8Array(t.slice(0,4))),version:n.getUint32(4,!0),length:n.getUint32(8,!0)},this.header.magic!==Y)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var i=this.header.length-12,a=new DataView(t,12),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=r.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,n){if(T(this,e),!n)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=G.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=n,this.dracoLoader.preload()}return P(e,[{key:"decodePrimitive",value:function(e,t){var n,r,i=this.json,a=this.dracoLoader,s=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,l={},u={},c={};for(n in o){var h=he[n]||n.toLowerCase();l[h]=o[n]}for(r in e.attributes){var d,p,f=he[r]||r.toLowerCase();void 0!==o[r]&&(d=i.accessors[e.attributes[r]],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 n in e.attributes){var r=e.attributes[n];void 0!==(n=u[n])&&(r.normalized=n)}t(e)}),l,c)}))}))}}]),e}(),ee=function(){function e(){T(this,e),this.name=G.KHR_TEXTURE_TRANSFORM}return P(e,[{key:"extendTexture",value:function(e,t){return void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),void 0===t.offset&&void 0===t.rotation&&void 0===t.scale||(e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}]),e}(),te=function(){O(t,r.MeshStandardMaterial);var e=I(t);function t(n){T(this,t),(i=e.call(this)).isGLTFSpecularGlossinessMaterial=!0;var i,a=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),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 r.Color).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};return i._extraUniforms=c,i.onBeforeCompile=function(e){for(var t in c)e.uniforms[t]=c[t];e.fragmentShader=e.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>",a).replace("#include <metalnessmap_pars_fragment>",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(n),i}return P(t,[{key:"copy",value:function(e){return E(L(t.prototype),"copy",this).call(this,e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this}}]),t}(),ne=function(){function e(){T(this,e),this.name=G.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.specularGlossinessParams=["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"]}return P(e,[{key:"getMaterialType",value:function(){return te}},{key:"extendParams",value:function(e,t,n){t=t.extensions[this.name];var i,a=(e.color=new r.Color(1,1,1),e.opacity=1,[]);return Array.isArray(t.diffuseFactor)&&(i=t.diffuseFactor,e.color.fromArray(i),e.opacity=i[3]),void 0!==t.diffuseTexture&&a.push(n.assignTexture(e,"map",t.diffuseTexture)),e.emissive=new r.Color(0,0,0),e.glossiness=void 0!==t.glossinessFactor?t.glossinessFactor:1,e.specular=new r.Color(1,1,1),Array.isArray(t.specularFactor)&&e.specular.fromArray(t.specularFactor),void 0!==t.specularGlossinessTexture&&(i=t.specularGlossinessTexture,a.push(n.assignTexture(e,"glossinessMap",i)),a.push(n.assignTexture(e,"specularMap",i))),Promise.all(a)}},{key:"createMaterial",value:function(e){var t=new te(e);return t.fog=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,t.normalMapType=r.TangentSpaceNormalMap,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t}}]),e}(),re=P((function e(){T(this,e),this.name=G.KHR_MESH_QUANTIZATION})),ie=function(){O(t,r.Interpolant);var e=I(t);function t(n,r,i,a){return T(this,t),e.call(this,n,r,i,a)}return P(t,[{key:"copySampleValue_",value:function(e){for(var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r*3+r,a=0;a!==r;a++)t[a]=n[i+a];return t}}]),t}(),ae=(ie.prototype.beforeStart_=ie.prototype.copySampleValue_,ie.prototype.afterEnd_=ie.prototype.copySampleValue_,ie.prototype.interpolate_=function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=2*s,l=3*s,u=r-t,c=e*l,h=c-l,d=-2*(t=(n=(r=(n-t)/u)*r)*r)+3*n,p=t-n,f=1-d,m=p-n+r,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 r.Quaternion),se=function(){O(t,ie);var e=I(t);function t(){return T(this,t),e.apply(this,arguments)}return P(t,[{key:"interpolate_",value:function(e,n,r,i){return e=E(L(t.prototype),"interpolate_",this).call(this,e,n,r,i),ae.fromArray(e).normalize().toArray(e),e}}]),t}(),oe={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},le={9728:r.NearestFilter,9729:r.LinearFilter,9984:r.NearestMipmapNearestFilter,9985:r.LinearMipmapNearestFilter,9986:r.NearestMipmapLinearFilter,9987:r.LinearMipmapLinearFilter},ue={33071:r.ClampToEdgeWrapping,33648:r.MirroredRepeatWrapping,10497:r.RepeatWrapping},ce={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},he={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},de={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},pe={CUBICSPLINE:void 0,LINEAR:r.InterpolateLinear,STEP:r.InterpolateDiscrete};function fe(e,t,n){for(var r in n.extensions)void 0===e[r]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=n.extensions[r])}function me(e,t){void 0!==t.extras&&("object"===_(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function ve(e){for(var t="",n=Object.keys(e).sort(),r=0,i=n.length;r<i;r++)t+=n[r]+":"+e[n[r]]+";";return t}function ge(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}var ye=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};T(this,e),this.json=t,this.extensions={},this.plugins={},this.options=n,this.cache=new U,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={},"undefined"!=typeof createImageBitmap&&!1===/Firefox|^((?!chrome|android).)*safari/i.test(navigator.userAgent)?this.textureLoader=new x(this.options.manager):this.textureLoader=new r.TextureLoader(this.options.manager),this.options.myOptions.core.options.setTextureLoader(this.textureLoader),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new r.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}return P(e,[{key:"setExtensions",value:function(e){this.extensions=e}},{key:"setPlugins",value:function(e){this.plugins=e}},{key:"parse",value:function(e,t){var n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(M(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()})))).then((function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])})).then((function(t){var a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};fe(i,a,r),me(a,r),Promise.all(n._invokeAll((function(e){return e.afterRoot&&e.afterRoot(a)}))).then((function(){e(a)}))})).catch(t)}},{key:"_markDefs",value:function(){for(var e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[],r=0,i=t.length;r<i;r++)for(var a=t[r].joints,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&&(n[c.mesh].isSkinnedMesh=!0)),void 0!==c.camera&&this._addNodeRef(this.cameraCache,c.camera)}}},{key:"_addNodeRef",value:function(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}},{key:"_getNodeRef",value:function(e,t,n){var r=this;if(e.refs[t]<=1)return n;var i=n.clone();return function e(t,n){var i,a=r.associations.get(t),s=(null!=a&&r.associations.set(n,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],n.children[l])}}catch(e){s.e(e)}finally{s.f()}}(n,i),i.name+="_instance_"+e.uses[t]++,i}},{key:"_invokeOne",value:function(e){var t=Object.values(this.plugins);t.push(this);for(var n=0;n<t.length;n++){var r=e(t[n]);if(r)return r}return null}},{key:"_invokeAll",value:function(e){for(var t=Object.values(this.plugins),n=(t.unshift(this),[]),r=0;r<t.length;r++){var i=e(t[r]);i&&n.push(i)}return n}},{key:"getDependency",value:function(e,t){var n=e+":"+t,r=this.cache.get(n);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this.loadNode(t);break;case"mesh":r=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":r=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":r=this.loadSkin(t);break;case"animation":r=this.loadAnimation(t);break;case"camera":r=this.loadCamera(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(n,r)}return r}},{key:"getDependencies",value:function(e){var t,n,r=this.cache.get(e);return r||(n=(t=this).json[e+("mesh"===e?"es":"s")]||[],r=Promise.all(n.map((function(n,r){return t.getDependency(e,r)}))),this.cache.add(e,r)),r}},{key:"loadBuffer",value:function(e){var t=this.json.buffers[e],n=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[G.KHR_BINARY_GLTF].body);var i=this.options;return new Promise((function(e,a){n.load(r.LoaderUtils.resolveURL(t.uri,i.path),e,void 0,(function(){a(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))}},{key:"loadBufferView",value:function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)}))}},{key:"loadAccessor",value:function(e){var t=this,n=this.json,i=this.json.accessors[e];return void 0===i.bufferView&&void 0===i.sparse?Promise.resolve(null):(e=[],void 0!==i.bufferView?e.push(this.getDependency("bufferView",i.bufferView)):e.push(null),void 0!==i.sparse&&(e.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),e.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(e).then((function(e){var a,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?n.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 r.InterleavedBuffer(a,h/u),t.cache.add(m,v)),new r.InterleavedBufferAttribute(v,o,c%h/u,d)):(a=null===s?new l(i.count*o):new l(s,c,i.count*o),new r.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 r.BufferAttribute(p.array.slice(),p.itemSize,p.normalized));for(var b=0,x=g.length;b<x;b++){var w=g[b];if(p.setX(w,y[b*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,n=this.options,r=t.textures[e].source,i=(t=t.images[r],this.textureLoader);return t.uri&&null!==(n=n.manager.getHandler(t.uri))&&(i=n),this.loadTextureImage(e,r,i)}},{key:"loadTextureImage",value:function(e,t,n){var i=this,a=this.json,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,n,e).then((function(t){t.flipY=!1,s.name&&(t.name=s.name);var n=(a.samplers||{})[s.sampler]||{};return t.magFilter=le[n.magFilter]||r.LinearFilter,t.minFilter=le[n.minFilter]||r.LinearMipmapLinearFilter,t.wrapS=ue[n.wrapS]||r.RepeatWrapping,t.wrapT=ue[n.wrapT]||r.RepeatWrapping,i.associations.set(t,{textures:e}),i.options.myOptions.core.loadTexture({texture:t,textureDef:s}),t})).catch((function(e){return null})),this.textureCache[o]=t)}},{key:"loadImageSource",value:function(e,t,n){var i=this.json,a=this.options,s=i.textures[n];if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((function(e){return e.clone()})).catch((function(e){throw e}));var 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 n=Promise.resolve(u).then((function(e){return new Promise((function(n,i){var o,l;!0===t.isImageBitmapLoader?(o=function(e,t){(e=new r.Texture(e)).needsUpdate=!0,n({texture:e,blob:t})},t.load(r.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 r.Texture(i));l||(t.clearRect(0,0,i.width,i.height),t.translate(0,i.height),t.scale(1,-1),t.drawImage(e,0,0,i.width,i.height)),n(a)})).catch(i))}))})).then((function(e){var n=(e=t.isImageBitmapLoader?e:{texture:e,blob:null}).texture;return e=e.blob,!0===t.isImageBitmapLoader&&(n.userData.url=u,n.userData.blob=e),n.url=u,n})).catch((function(e){throw console.log(e,"error"),console.error("THREE.GLTFLoader: Couldn't load texture",u),e})),this.sourceCache[e]=n}},{key:"assignTexture",value:function(e,t,n){var r=this;return this.getDependency("texture",n.index).then((function(i){var a,s;return void 0===n.texCoord||0==n.texCoord||"aoMap"===t&&1==n.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+n.texCoord+" for texture "+t+" not yet supported."),r.extensions[G.KHR_TEXTURE_TRANSFORM]&&(a=void 0!==n.extensions?n.extensions[G.KHR_TEXTURE_TRANSFORM]:void 0)&&(s=r.associations.get(i),i=r.extensions[G.KHR_TEXTURE_TRANSFORM].extendTexture(i,a),r.associations.set(i,s)),e[t]=i}))}},{key:"assignFinalMaterial",value:function(e){var t,n,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,(n=this.cache.get(t))||(n=new r.PointsMaterial,r.Material.prototype.copy.call(n,a),n.color.copy(a.color),n.map=a.map,n.sizeAttenuation=!1,this.cache.add(t,n)),a=n):e.isLine&&(t="LineBasicMaterial:"+a.uuid,(n=this.cache.get(t))||(n=new r.LineBasicMaterial,r.Material.prototype.copy.call(n,a),n.color.copy(a.color),this.cache.add(t,n)),a=n),(s||o||l)&&(t="ClonedMaterial:"+a.uuid+":",a.isGLTFSpecularGlossinessMaterial&&(t+="specular-glossiness:"),s&&(t+="derivative-tangents:"),o&&(t+="vertex-colors:"),l&&(t+="flat-shading:"),(n=this.cache.get(t))||(n=a.clone(),o&&(n.vertexColors=!0),l&&(n.flatShading=!0),s&&(n.normalScale&&(n.normalScale.y*=-1),n.clearcoatNormalScale&&(n.clearcoatNormalScale.y*=-1)),this.cache.add(t,n),this.associations.set(n,this.associations.get(a)))),a.aoMap&&void 0===i.attributes.uv2&&void 0!==i.attributes.uv&&i.setAttribute("uv2",i.attributes.uv),this.options.myOptions.core.loadMaterial({material:a,materialDef:a.userData,model:e}),e.material=a}},{key:"getMaterialType",value:function(){return r.MeshStandardMaterial}},{key:"loadMaterial",value:function(e){var t,n=this,i=this.json,a=this.extensions,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,n))):i[G.KHR_MATERIALS_UNLIT]?(u=a[G.KHR_MATERIALS_UNLIT],t=u.getMaterialType(),l.push(u.extendParams(o,s,n))):(i=s.pbrMetallicRoughness||{},o.color=new r.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(n.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(n.assignTexture(o,"metalnessMap",i.metallicRoughnessTexture)),l.push(n.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=r.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!==r.MeshBasicMaterial&&(l.push(n.assignTexture(o,"normalMap",s.normalTexture)),o.normalScale=new r.Vector2(1,1),void 0!==s.normalTexture.scale&&(i=s.normalTexture.scale,o.normalScale.set(i,i))),void 0!==s.occlusionTexture&&t!==r.MeshBasicMaterial&&(l.push(n.assignTexture(o,"aoMap",s.occlusionTexture)),void 0!==s.occlusionTexture.strength&&(o.aoMapIntensity=s.occlusionTexture.strength)),void 0!==s.emissiveFactor&&t!==r.MeshBasicMaterial&&(o.emissive=(new r.Color).fromArray(s.emissiveFactor)),void 0!==s.emissiveTexture&&t!==r.MeshBasicMaterial&&l.push(n.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=r.sRGBEncoding),i.emissiveMap&&(i.emissiveMap.encoding=r.sRGBEncoding),me(i,s),n.associations.set(i,{materials:e}),s.extensions&&fe(a,i,s),i}))}},{key:"createUniqueName",value:function(e){for(var t=r.PropertyBinding.sanitizeNodeName(e||""),n=t,i=1;this.nodeNamesUsed[n];++i)n=t+"_"+i;return this.nodeNamesUsed[n]=!0,n}},{key:"loadGeometries",value:function(e){for(var t=this,n=this.extensions,i=this.primitiveCache,a=[],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 n[G.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(n){return be(n,e,t)}))}(l):be(new r.BufferGeometry,l,t),i[u]={primitive:l,promise:c},a.push(c))}return Promise.all(a)}},{key:"loadMesh",value:function(e){for(var t=this,n=this.json,i=this.extensions,a=n.meshes[e],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 r.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:r.FrontSide})),c.DefaultMaterial):this.getDependency("material",s[l].material);o.push(c)}return o.push(t.loadGeometries(s)),Promise.all(o).then((function(n){for(var o=n.slice(0,n.length-1),l=n[n.length-1],u=[],c=0,h=l.length;c<h;c++){var d=l[c],p=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?r.SkinnedMesh:r.Mesh)(d,m)).isSkinnedMesh||f.geometry.attributes.skinWeight.normalized||f.normalizeSkinWeights(),5===p.mode?f.geometry=xe(f.geometry,r.TriangleStripDrawMode):6===p.mode&&(f.geometry=xe(f.geometry,r.TriangleFanDrawMode));else if(1===p.mode)f=new r.LineSegments(d,m);else if(3===p.mode)f=new r.Line(d,m);else if(2===p.mode)f=new r.LineLoop(d,m);else{if(0!==p.mode)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+p.mode);f=new r.Points(d,m)}if(0<Object.keys(f.geometry.morphAttributes).length){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 r.Group;t.associations.set(B,{meshes:e});for(var C=0,_=u.length;C<_;C++)B.add(u[C]);return B}))}},{key:"loadCamera",value:function(e){var t,n=(e=this.json.cameras[e])[e.type];if(n)return"perspective"===e.type?t=new r.PerspectiveCamera(r.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===e.type&&(t=new r.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),e.name&&(t.name=this.createUniqueName(e.name)),me(t,e),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}},{key:"loadSkin",value:function(e){var t={joints:(e=this.json.skins[e]).joints};return void 0===e.inverseBindMatrices?Promise.resolve(t):this.getDependency("accessor",e.inverseBindMatrices).then((function(e){return t.inverseBindMatrices=e,t}))}},{key:"loadAnimation",value:function(e){for(var t=this.json.animations[e],n=[],i=[],a=[],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;n.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(n),Promise.all(i),Promise.all(a),Promise.all(s),Promise.all(o)]).then((function(n){for(var i=n[0],a=n[1],s=n[2],o=n[3],l=n[4],u=[],c=0,h=i.length;c<h;c++)!function(e){var t=i[e],n=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=r.NumberKeyframeTrack;break;case de.rotation:p=r.QuaternionKeyframeTrack;break;default:p=r.VectorKeyframeTrack}e=t.name||t.uuid;var f=void 0!==h.interpolation?pe[h.interpolation]:r.InterpolateLinear,m=[],v=(de[d.path]===de.weights?t.traverse((function(e){e.morphTargetInfluences&&m.push(e.name||e.uuid)})):m.push(e),c.array);if(c.normalized){for(var g=ge(v.constructor),y=new Float32Array(v.length),b=0,x=v.length;b<x;b++)y[b]=v[b]*g;v=y}for(var w=0,S=m.length;w<S;w++){var A=new p(m[w]+"."+de[d.path],n.array,v,f);"CUBICSPLINE"===h.interpolation&&(A.createInterpolant=function(e){return new(this instanceof r.QuaternionKeyframeTrack?se:ie)(this.times,this.values,this.getValueSize()/3,e)},A.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),u.push(A)}}}(c);return n=t.name||"animation_"+e,new r.AnimationClip(n,void 0,u)}))}},{key:"createNodeMesh",value:function(e){var t=this.json,n=this,r=t.nodes[e];return void 0===r.mesh?null:n.getDependency("mesh",r.mesh).then((function(e){return e=n._getNodeRef(n.meshCache,r.mesh,e),void 0!==r.weights&&e.traverse((function(e){if(e.isMesh)for(var t=0,n=r.weights.length;t<n;t++)e.morphTargetInfluences[t]=r.weights[t]})),e}))}},{key:"loadNode",value:function(e){var t,n=this.json,i=this.extensions,a=this,s=n.nodes[e],o=s.name?a.createUniqueName(s.name):"";return t=[],(n=a._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)})))&&t.push(n),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 n,l=!0===s.isBone?new r.Bone:1<t.length?new r.Group:1===t.length?t[0]:new r.Object3D;if(l!==t[0])for(var u=0,c=t.length;u<c;u++)l.add(t[u]);return s.name&&(l.userData.name=s.name,l.name=o),me(l,s),s.extensions&&fe(i,l,s),void 0!==s.matrix?((n=new r.Matrix4).fromArray(s.matrix),l.applyMatrix4(n)):(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,n=this.extensions,i=(e=this.json.scenes[e],this),a=new r.Group,s=(a.isLoadScene=!0,e.name&&(a.name=i.createUniqueName(e.name)),me(a,e),e.extensions&&fe(n,a,e),e.nodes||[]),o=[],l=0,u=s.length;l<u;l++)o.push(function e(t){var n=t.nodeId,i=t.parentObject,a=t.json,s=t.parser,o=t.idMap,l=t.children,u=a.nodes[n];return s.getDependency("node",n).then((function(e){return void 0===u.skin?e:s.getDependency("skin",u.skin).then((function(e){for(var n=[],r=0,i=(t=e).joints.length;r<i;r++)n.push(s.getDependency("node",t.joints[r]));return Promise.all(n)})).then((function(n){return e.traverse((function(e){if(e.isMesh){for(var i=[],a=[],s=0,o=n.length;s<o;s++){var l=n[s];l?(i.push(l),l=new r.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 r.Skeleton(i,a),e.matrixWorld)}})),e}));var t})).then((function(t){var r,c;i.isLoadScene&&null!=(r=a.asset.ex)&&r.type,o&&o.set(n,t),i.add(t);try{void 0!==l&&(null==l?void 0:l.length)===i.children.length&&(l[0],c=!0,l.forEach((function(e){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,n=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 r.Material||o instanceof r.Texture)&&n.set(o,l)}}catch(e){a.e(e)}finally{a.f()}return e.traverse((function(e){var t=i.associations.get(e);null!=t&&n.set(e,t)})),n}(a),a}))}}]),e}();function be(e,t,n){var i,a=t.attributes,s=[];for(i in a){var o=he[i]||i.toLowerCase();o in e.attributes||s.push(function(t,r){return n.getDependency("accessor",t).then((function(t){e.setAttribute(r,t)}))}(a[i],o))}void 0===t.indices||e.index||(l=n.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)})),s.push(l)),me(e,t);var l=e,u=t,c=n,h=u.attributes,d=new r.Box3;if(void 0!==h.POSITION){var p=(h=c.json.accessors[h.POSITION]).min,f=h.max;if(void 0===p||void 0===f)console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");else{d.set(new r.Vector3(p[0],p[1],p[2]),new r.Vector3(f[0],f[1],f[2])),h.normalized&&(p=ge(oe[h.componentType]),d.min.multiplyScalar(p),d.max.multiplyScalar(p));var m=u.targets;if(void 0!==m){for(var v=new r.Vector3,g=new r.Vector3,y=0,b=m.length;y<b;y++){var x,w,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 r.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 r=e,i=t.targets,a=n,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(r);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):r.attributes.position,d.push(g)),o&&(g=void 0!==y.NORMAL?a.getDependency("accessor",y.NORMAL):r.attributes.normal,p.push(g)),l&&(y=void 0!==y.COLOR_0?a.getDependency("accessor",y.COLOR_0):r.attributes.color,f.push(y))}return Promise.all([Promise.all(d),Promise.all(p),Promise.all(f)]).then((function(e){var t=e[0],n=e[1];return e=e[2],s&&(r.morphAttributes.position=t),o&&(r.morphAttributes.normal=n),l&&(r.morphAttributes.color=e),r.morphTargetsRelative=!0,r}))}))}function xe(e,t){var n=e.getIndex();if(null===n){var i=[],a=e.getAttribute("position");if(void 0===a)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var s=0;s<a.count;s++)i.push(s);e.setIndex(i),n=e.getIndex()}var o=n.count-2,l=[];if(t===r.TriangleFanDrawMode)for(var u=1;u<=o;u++)l.push(n.getX(0)),l.push(n.getX(u)),l.push(n.getX(u+1));else for(var c=0;c<o;c++)c%2==0?(l.push(n.getX(c)),l.push(n.getX(c+1)),l.push(n.getX(c+2))):(l.push(n.getX(c+2)),l.push(n.getX(c+1)),l.push(n.getX(c)));return l.length/3!=o&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles."),(t=e.clone()).setIndex(l),t}var we=n(794),Se=n(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){return!e.asset.ex||!(e=e.asset.ex.base64)||!!(e=(0,Se.Ne)(e))&&(e=Number(e),!isNaN(e)&&(new Date).getTime()<e)}callback(e,t){var n,r;return this.loadConfig.triggerCb&&null!=(n=null==(r=this.runScene.cb.loaderer.gltf[e])?void 0:r.cb)&&n.call(r,t),null!=(r=null==(n=this.loadConfig.callBack)?void 0:n[e])&&r.call(n,t),this.runScene.exporter.gltf.module.loadCallback({type:e,json:this.json,data:t,config:this.loadConfig,core:this})}loadMaterial(e){this.callback("loadMaterial",e)}loadNode(e){if(1===(e=this.callback("loadNode",e)).length)return e[0]}}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,n,r){return new(n=n||Promise)((function(t,i){function a(e){try{o(r.next(e))}catch(e){i(e)}}function s(e){try{o(r.throw(e))}catch(e){i(e)}}function o(e){var r;e.done?t(e.value):((r=e.value)instanceof n?r:new n((function(e){e(r)}))).then(a,s)}o((r=r.apply(e,[])).next())}))}(this,0,void 0,(function*(){var n=yield i().get(e,{responseType:"arraybuffer",onDownloadProgress:e=>{var n,{total:e,loaded:r}=e;let i=r/e;1<(i=i<0?0:i)&&(i=1);var r=Number(i.toFixed(2));e=Math.floor(100*r),null!=(n=null==(r=null==t?void 0:t.callBack)?void 0:r.progress)&&n.call(r,e),this.runScene.optionsEx.log("下载场景进度:"+e,"detail"),null!=t&&t.triggerCb&&this.runScene.cb.loaderer.gltf.progress.cb(e)}}).then((e=>e.data)).catch((e=>{this.runScene.optionsEx.log("下载场景失败:",e)}));return n?this.parse(n,t):Promise.resolve()}))}parse(e,t){const n=(0,w.deepMergeObject)({cleanJSON:!0,triggerCb:!1,reverseTexture:!1,callBack:{mountModule:void 0,getJSON:void 0,beforeParse:void 0,afterParse:void 0,lazyLoadedTexture:void 0,loaded:void 0,loadMaterial:void 0,loadNode:void 0,modelLoaded:void 0,progress:void 0,getArrayBuffer:void 0,complete:void 0,loadedGltf:void 0,loadTexture:void 0},module:{light:!0,model:!0,camera:!0,controls:!0,tags:!0,objects:!0,timeline:!0,sceneConfig:!0}},t||{}),r=new Me(this.runScene,n);return r.callback("getArrayBuffer",e),new Promise((t=>{try{e instanceof ArrayBuffer&&this._gltf.parse(e,"",(e=>{r.callback("loadedGltf",e),this.afterParse(e.parser.options.myOptions,e,n),t(r.models)}),(e=>{console.log(e,"_a")}),{rootModel:this.runScene.assetsEx.get().scene,models:[],core:r,runScene:this.runScene,loadConfig:n})}catch(e){throw this.runScene.optionsEx.log("加载场景出错:"+e),TypeError(e)}}))}afterParse(e,t,n){var r;const i=e.core;i.callback("afterParse",{options:e,json:t,loadConfig:n});var{cleanJSON:n,callBack:a}=n;this.runScene.optionsEx.log(t,"detail"),Promise.all(i.pending).then((()=>{i.callback("complete",{models:e.models,json:t})})),null!=(r=null==a?void 0:a.getJSON)&&r.call(a,t),n&&this.disposeJSON(t)}disposeJSON(e){}}var Ce=n(736),_e=n(110);class Ee{constructor(e){this._objectLoader=new r.ObjectLoader,this.runScene=e,this._parser=new Te(e)}parse(e){return function(e,t,n,r){return new(n=n||Promise)((function(t,i){function a(e){try{o(r.next(e))}catch(e){i(e)}}function s(e){try{o(r.throw(e))}catch(e){i(e)}}function o(e){var r;e.done?t(e.value):((r=e.value)instanceof n?r:new n((function(e){e(r)}))).then(a,s)}o((r=r.apply(e,[])).next())}))}(this,0,void 0,(function*(){var t=yield this._objectLoader.parseAsync(JSON.parse(e));return this._parser.afterParse(this.runScene.sceneEx.cleanUnlessLevel(t))}))}}class Te{constructor(e){this.runScene=e}parseModel(e){e.material&&this.parseMaterial(e)}parseMaterial(e){var t=e.material;"SpriteMaterial"===t.type&&(0,Ce.M)(t,"type",_e.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 r.ImageBitmapLoader,this.object=new r.ObjectLoader,this.runScene=e,this.gltf=new Be(e),this.json=new Ee(e)}init(){this.gltf.init()}}const Pe=new class{constructor(){this.load=new r.AnimationLoader}parse(e){return this.load.parse(e)}}},943:(e,t,n)=>{n.d(t,{Ws:()=>H,ZP:()=>z,ee:()=>V});var r,i,a,s,o=n(707),l=n(881),u=n(932),c=n(651),h=n(735),d=n(736);class p{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:n}=e;this.runScene.undoEx.addUndo(new h.Z({target:e,typeList:["uniforms",...t],newVal:n}).execute())}}(r=p).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],p.TextureNames=["sideWallTex","backWallTex","floorTex","ceilingTex"],p.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 n=new l.ShaderMaterial({uniforms:(0,c.d9)(f.uniforms),vertexShader:f.vertexShader,fragmentShader:f.fragmentShader});return r.tools.bind(n),n},parseData:e=>{const{texture:t,normal:n,material:i}=e,{data:a,load:s}=t,o=new l.ShaderMaterial({uniforms:(0,c.d9)(f.uniforms),vertexShader:f.vertexShader,fragmentShader:f.fragmentShader}),u=[];return s&&u.push(...a.map((e=>()=>{"ceilingTex"===e.type?o.uniforms.ceilingTex.value=e.texture||null:"floorTex"===e.type?o.uniforms.floorTex.value=e.texture||null:"sideWallTex"===e.type?o.uniforms.sideWallTex.value=e.texture||null:"backWallTex"===e.type&&(o.uniforms.backWallTex.value=e.texture||null)}))),Object.keys(n.uniforms).filter((e=>!p.TextureNames.includes(e))).map((e=>{var t=n.uniforms[e];o.uniforms[e].value="roomsXYZPropsW"===e||"positionOffsetRoomsXYZPropsW"===e||"roomColorTint"===e?new l.Vector4(t.x,t.y,t.z,t.w):t})),o.name=n.name,o.userData.id=i.userData.id,r.tools.bind(o),{material:o,setTextureFns:u}},toNormal:e=>{const t=(0,u.createDefMaterial)(),n=(t.userData=Object.assign({},t.userData),{}),i=e.uniforms,a=f.uniforms;return Object.keys(i).filter((e=>!p.TextureNames.includes(e))).map((e=>{var t,r,s,o,u,c,h=i[e].value,d=a[e].value;h instanceof l.Vector4?(({x:t,y:r,z:s}=h),({x:o,y:u,z:c}=d),t===o&&r===u&&s===c||(n[e]=h)):h!==d&&(n[e]=h)})),{material:t,normal:{type:r.tools.type,uniforms:n,name:e.name},textures:r.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const n=r.tools.create(t);return Object.keys(n).filter((e=>!p.IgnoredAttributes.includes(e))).map((t=>{n[t]=e[t]})),n},bind:e=>{(0,d.M)(e,"type",r.tools.type)}};const f={uniforms:{roomIntensity:{value:1},roomColorTint:{value:new l.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 l.Vector4(.35,.65,.1,1)},positionOffsetRoomsXYZPropsW:{value:new l.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 m{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:n}=e;this.runScene.undoEx.addUndo(new h.Z({target:e,typeList:[...t],newVal:n}).execute())}}(i=m).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],m.TextureNames=["envMap","displacementMap"],m.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 n=new v(void 0,void 0,e);return n.insertFresnelShader(),i.tools.bind(n),(t=t||e.modelEx.select)&&(n.name=t.name),n},parseData:(e,t)=>{const{texture:n,normal:r,material:a}=e,{data:s,load:o}=n,l=(0,u.mergeMaterial)(a,new v(void 0,void 0,t)),c=[];return o&&c.push(...s.map((e=>()=>{l[e.type]=e.texture}))),Object.keys(r.uniforms).filter((e=>!m.TextureNames.includes(e))).map((e=>{l[e]=r.uniforms[e]})),l.insertFresnelShader(),l.name=r.name,l.userData.id=a.userData.id,i.tools.bind(l),{material:l,setTextureFns:c}},toNormal:e=>{const t=(0,u.mergeMaterial)(e,(0,u.createDefMaterial)()),n=(t.userData=Object.assign({},t.userData),t.name=e.name,{}),r=g.uniforms;return Object.keys(r).filter((e=>!m.TextureNames.includes(e))).map((t=>{var i=e[t],a=r[t].value;"fresnelBias"===t||"fresnelScale"===t||"fresnelPower"===t||"isSurge"===t?i.value!==a&&(n[t]=i):i!==a&&(n[t]=i)})),{material:t,normal:{type:i.tools.type,uniforms:n,name:e.name},textures:i.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const n=i.tools.create(t);return Object.keys(n).filter((e=>!m.IgnoredAttributes.includes(e))).map((t=>{n[t]=e[t]})),n},bind:e=>{(0,d.M)(e,"type",i.tools.type)}};class v extends l.MeshPhysicalMaterial{constructor(e,t,n){if(e?super(e):(super(),this.emissive=new l.Color(65535),this.envMap=null,this.displacementMap=null,this.metalness=0,this.roughness=0,this.ior=1.5,this.transmission=1,this.opacity=1,this.transparent=!0,this.thickness=0),this.runScene=n,this.isSpecialMaterial=!0,t?(this.fresnelBias=new l.Uniform(t.fresnelBias),this.fresnelScale=new l.Uniform(t.fresnelScale),this.fresnelPower=new l.Uniform(t.fresnelPower)):(this.fresnelBias=new l.Uniform(g.uniforms.fresnelBias.value),this.fresnelScale=new l.Uniform(g.uniforms.fresnelScale.value),this.fresnelPower=new l.Uniform(g.uniforms.fresnelPower.value)),this.clock=new l.Clock,this.isSurge=new l.Uniform(!1),this.deltaTime=new l.Uniform(0),!this.cubeCamera){const e=new l.WebGLCubeRenderTarget(2048);e.texture.mapping=l.CubeRefractionMapping,this.cubeCamera=new l.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 l.Uniform(!0),depthWrite:new l.Uniform(!0),isSurge:new l.Uniform(!1),deltaTime:new l.Uniform(0),fresnelBias:new l.Uniform(0),fresnelScale:new l.Uniform(1),fresnelPower:new l.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 y{constructor(e){this.runScene=e}undo(e){const{material:t,list:n,val:r}=e;this.runScene.undoEx.addUndo(new h.Z({target:t,typeList:[...n],newVal:r,cb:()=>{t.needsUpdate=!0}}).execute())}}(a=y).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],y.TextureNames=["alphaMap","bumpMap","displacementMap","map","normalMap","matcap"],y.tools={type:"Matcap",getTextures:e=>{const t=[];return y.TextureNames.forEach((n=>{e[n]&&t.push({type:n,texture:e[n]})})),t},create:(e,t)=>{const n=new l.MeshMatcapMaterial;return a.tools.bind(n),(t=t||e.modelEx.select)&&(n.name="Matcap-"+t.name),n},parseData:e=>{const{normal:t,texture:n,material:r}=e,{data:i,load:s}=n,o=(0,u.mergeMaterial)(r,new l.MeshMatcapMaterial),c=(delete o.emissive,[]);return s&&c.push(...i.map((e=>()=>{o[e.type]=e.texture}))),Object.keys(t.uniforms).filter((e=>!y.IgnoredAttributes.includes(e))).map((e=>{o[e]="normalScale"===e?new l.Vector2(t.uniforms[e].x,t.uniforms[e].y):t.uniforms[e]})),o.name=t.name,o.userData.id=r.userData.id,a.tools.bind(o),{material:o,setTextureFns:c}},toNormal:e=>{var t=a.tools.getTextures(e);const n=(0,u.mergeMaterial)(e,(0,u.createDefMaterial)()),r=(n.userData=Object.assign({},n.userData),n.name=e.name,{}),i=new l.MeshMatcapMaterial;return Object.keys(e).filter((e=>!y.TextureNames.includes(e))).filter((e=>!y.IgnoredAttributes.includes(e))).map((t=>{var n=e[t],a=i[t];"bumpScale"===t||"displacementScale"===t||"displacementBias"===t||"depthTest"===t||"depthWrite"===t||"transparent"===t||"opacity"===t?n!==a&&(r[t]=n):"normalScale"!==t||n.x===a.x&&n.y===a.y||(r[t]=n)})),{material:n,normal:{type:a.tools.type,uniforms:r,name:e.name},textures:t}},clone:(e,t)=>e,copy:(e,t)=>{const n=a.tools.create(t);return Object.keys(n).filter((e=>!y.IgnoredAttributes.includes(e))).map((t=>{n[t]=e[t]})),n},bind:e=>{(0,d.M)(e,"type",a.tools.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 ",x="\n vec3 mod289(vec3 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n }\n \n vec4 mod289(vec4 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n }\n \n vec4 permute(vec4 x) {\n return mod289(((x*34.0)+1.0)*x);\n }\n \n vec4 taylorInvSqrt(vec4 r) {\n return 1.79284291400159 - 0.85373472095314 * r;\n }\n \n float 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 ",w={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 l.Matrix3,new l.Matrix3,new l.Matrix3,new l.Matrix3,new l.Matrix3,new l.Matrix3]},maskUvTransArray:{value:[new l.Matrix3,new l.Matrix3,new l.Matrix3,new l.Matrix3,new l.Matrix3]},diffuse:{value:new l.Color(16777215)},uvTransform:{value:new l.Matrix3},shadowShade:{value:.6}},vertex:"\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n // vUv = (uvTransform * vec3(uv, 1.0)).xy;\n}\n ",fragment:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\n#define MAX_TEX 6\nuniform mat3 mapUvTransArray[MAX_TEX];\nuniform mat3 maskUvTransArray[MAX_TEX - 1];\nuniform sampler2D mapArray[MAX_TEX];\nuniform sampler2D maskArray[MAX_TEX - 1];\nuniform float shadowShade;\n\n// Insert Noise2D\nfloat sum(vec3 v) {return v.x + v.y + v.z;}\nvec3 textureNoTile(sampler2D tex, vec2 tUv, float offsetScale) {\n // cheap (cache friendly) lookup\n float k = noise2D(0.25 * tUv);\n\n float l = k * 8.0;\n float f = fract(l);\n float ia = floor(l);\n float ib = ia + 1.0;\n\n // can replace with any other hash\n vec2 offa = sin(vec2(3.0, 7.0) * ia);\n vec2 offb = sin(vec2(3.0, 7.0) * ib);\n\n vec2 duvdx = dFdx(tUv);\n vec2 duvdy = dFdy(tUv);\n vec3 cola = textureGrad(tex, tUv + offsetScale * offa, duvdx, duvdy).xyz;\n vec3 colb = textureGrad(tex, tUv + offsetScale * offb, duvdx, duvdy).xyz;\n\n return mix(cola, colb, smoothstep(0.2, 0.8, f - 0.1 * sum(cola-colb)));\n}\nvec4 texSampler(sampler2D tex, vec2 tUv, float offsetScale) {\n return vec4(textureNoTile(tex, tUv, offsetScale), 1.0);\n}\n\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(diffuse, opacity);\n #include <logdepthbuf_fragment>\n \n // Custom UV Start\n #if MAX_TEX > 0\n vec2 vCustomMapUv[MAX_TEX];\n for (int i = 0; i < MAX_TEX; i++) {\n vCustomMapUv[i] = (mapUvTransArray[i] * vec3(vUv, 1.0)).xy;\n }\n #endif\n #if MAX_TEX > 1\n vec2 vCustomMaskUv[MAX_TEX - 1];\n for (int i = 0; i < MAX_TEX - 1; i++) {\n vCustomMaskUv[i] = (maskUvTransArray[i] * vec3(vUv, 1.0)).xy;\n }\n #endif\n // Custom UV End\n \n // Custom Texture Start\n float offsetScale = 1.2;\n vec4 maskColor = vec4(1.0);\n vec4 textureColor = vec4(1.0);\n #if MAX_TEX > 0\n textureColor = texSampler(mapArray[0], vCustomMapUv[0], offsetScale);\n #endif\n #if MAX_TEX > 1\n maskColor = texture2D(maskArray[0], vCustomMaskUv[0]);\n textureColor = mix(textureColor, texSampler(mapArray[1], vCustomMapUv[1], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 2\n maskColor = texture2D(maskArray[1], vCustomMaskUv[1]);\n textureColor = mix(textureColor, texSampler(mapArray[2], vCustomMapUv[2], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 3\n maskColor = texture2D(maskArray[2], vCustomMaskUv[2]);\n textureColor = mix(textureColor, texSampler(mapArray[3], vCustomMapUv[3], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 4\n maskColor = texture2D(maskArray[3], vCustomMaskUv[3]);\n textureColor = mix(textureColor, texSampler(mapArray[4], vCustomMapUv[4], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 5\n maskColor = texture2D(maskArray[4], vCustomMaskUv[4]);\n textureColor = mix(textureColor, texSampler(mapArray[5], vCustomMapUv[5], offsetScale), maskColor.r);\n #endif\n diffuseColor *= textureColor;\n // Custom Texture End\n \n // ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n // reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n // vec3 outgoingLight = reflectedLight.indirectDiffuse;\n vec3 outgoingLight = diffuseColor.rgb;\n #include <output_fragment>\n \n // gl_FragColor = vec4(diffuse, opacity * (1.0 - getShadowMask()));\n gl_FragColor.rgb *= vec3(getShadowMask() * (1.0 - shadowShade) + shadowShade);\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n "};class S{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:n}=e;this.runScene.undoEx.addUndo(new h.Z({target:e,typeList:["uniforms",...t],newVal:n}).execute())}insertShader(e){e&&(e.onBeforeCompile=t=>{t.defines=w.defines,this.mergeUniforms(e.uniforms,t.uniforms),t.vertexShader=w.vertex,t.fragmentShader=w.fragment,t.fragmentShader=t.fragmentShader.replace(/\/\/ Insert Noise2D/g,b)})}mergeUniforms(e,t){if(e&&t)for(const n in e)t[n]=e[n]}onTexRepeatChange(e,t,n){e&&0<=t&&(n?(n=e.uniforms.mapArray.value[t],e.uniforms.mapUvTransArray.value[t].identity(),e.uniforms.mapUvTransArray.value[t].scale(n.repeat.x,n.repeat.y)):(n=e.uniforms.maskArray.value[t],e.uniforms.maskUvTransArray.value[t].identity(),e.uniforms.maskUvTransArray.value[t].scale(n.repeat.x,n.repeat.y)))}}(s=S).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],S.TextureNames=["terrainMap0","terrainMap1","terrainMap2","terrainMap3","terrainMap4","terrainMap5","terrainMap6","terrainMap7","terrainMask0","terrainMask1","terrainMask2","terrainMask3","terrainMask4","terrainMask5","terrainMask6"],S.tools={type:"MixTexture",getTextures:e=>{const t=[];return S.TextureNames.forEach((n=>{var r=parseInt(n.slice(-1));n.startsWith("terrainMap")?e.uniforms.mapArray.value[r]&&t.push({type:n,texture:e.uniforms.mapArray.value[r]}):n.startsWith("terrainMask")&&e.uniforms.maskArray.value[r]&&t.push({type:n,texture:e.uniforms.maskArray.value[r]})})),t},create:(e,t)=>{const n=new l.ShadowMaterial({color:0,opacity:1});return n.uniforms=l.UniformsUtils.clone(w.uniforms),e.materialEx.def.map.MixTexture.insertShader(n),s.tools.bind(n),n},parseData:(e,t)=>{const{texture:n,normal:r,material:i}=e,{data:a,load:o}=n,u=new l.ShadowMaterial({color:0,opacity:1}),c=(u.uniforms=l.UniformsUtils.clone(w.uniforms),t.materialEx.def.map.MixTexture.insertShader(u),[]);return o&&c.push(...a.map((e=>()=>{var n=parseInt(e.type.slice(-1));e.type.startsWith("terrainMap")?(u.uniforms.mapArray.value[n]=e.texture,t.materialEx.def.map.MixTexture.onTexRepeatChange(u,n,!0)):e.type.startsWith("terrainMask")&&(u.uniforms.maskArray.value[n]=e.texture,t.materialEx.def.map.MixTexture.onTexRepeatChange(u,n,!1))}))),Object.keys(r.uniforms).filter((e=>!S.TextureNames.includes(e))).map((e=>{var t=r.uniforms[e];"diffuse"===e?u.uniforms[e].value=new l.Color(parseInt(t,16)):"uvTransform"!==e&&(u.uniforms[e].value=t)})),u.name=r.name,u.userData.id=i.userData.id,s.tools.bind(u),{material:u,setTextureFns:c}},toNormal:e=>{const t=(0,u.createDefMaterial)(),n=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:s.tools.type,uniforms:{},name:e.name},textures:s.tools.getTextures(e)}),{}),r=e.uniforms,i=w.uniforms;return Object.keys(r).filter((e=>"mapArray"!==e&&"maskArray"!==e&&"mapUvTransArray"!==e&&"maskUvTransArray"!==e)).map((e=>{const t=r[e].value,a=i[e].value;"diffuse"===e?t.getHexString()!==a.getHexString()&&(n[e]=t.getHexString()):"uvTransform"!==e&&t!==a&&(n[e]=t)})),{material:t,normal:{type:s.tools.type,uniforms:n,name:e.name},textures:s.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const n=s.tools.create(t);return Object.keys(n).filter((e=>!S.IgnoredAttributes.includes(e))).map((t=>{n[t]=e[t]})),n},bind:e=>{(0,d.M)(e,"type",s.tools.type)}};var A,M=n(110);class B{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:n}=e;this.runScene.undoEx.addUndo(new h.Z({target:e,typeList:[...t],newVal:n}).execute())}}(A=B).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],B.TextureNames=["alphaMap","aoMap","bumpMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap","clearcoatMap","clearcoatNormalMap","clearcoatRoughnessMap","sheenRoughnessMap","sheenColorMap","specularIntensityMap","specularColorMap","thicknessMap","transmissionMap"],B.tools={type:"Physical",getTextures:e=>{const t=[];return B.TextureNames.forEach((n=>{e[n]&&t.push({type:n,texture:e[n]})})),t},create:(e,t)=>{const n=new l.MeshPhysicalMaterial;return A.tools.bind(n),(t=t||e.modelEx.select)&&(n.name="MeshPhysicalMaterial-"+t.name),n},parseData:e=>{const{normal:t,texture:n,material:r}=e,{data:i,load:a}=n,s=(0,u.mergeMaterial)(r,new l.MeshPhysicalMaterial),o=[];return a&&o.push(...i.map((e=>()=>{s[e.type]=e.texture}))),Object.keys(t.uniforms).filter((e=>!B.IgnoredAttributes.includes(e))).map((e=>{var n=t.uniforms[e];s[e]="attenuationColor"===e||"sheenColor"===e||"specularColor"===e?new l.Color(n):"clearcoatNormalScale"===e?new l.Vector2(n.x,n.y):n})),s.name=t.name,s.userData.id=r.userData.id,A.tools.bind(s),{material:s,setTextureFns:o}},toNormal:e=>{const t=(0,u.mergeMaterial)(e,(0,u.createDefMaterial)()),n=(t.userData=Object.assign({},t.userData),t.name=e.name,{}),r=new l.MeshPhysicalMaterial;return Object.keys(e).filter((e=>!B.TextureNames.includes(e))).filter((e=>!B.IgnoredAttributes.includes(e))).filter((e=>void 0===t[e])).map((t=>{const i=e[t],a=r[t];"attenuationColor"===t||"sheenColor"===t||"specularColor"===t?i.getHexString()!==a.getHexString()&&(n[t]=i.getHexString()):"clearcoatNormalScale"===t?i.x===a.x&&i.y===a.y||(n[t]=i):i!==a&&(n[t]=i)})),{material:t,normal:{type:A.tools.type,uniforms:n,name:e.name},textures:A.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const n=A.tools.create(t);return Object.keys(n).filter((e=>!B.IgnoredAttributes.includes(e))).map((t=>{n[t]=e[t]})),n},bind:e=>{(0,d.M)(e,"type",A.tools.type)}};var C=n(1),_=n(180);const E={uniforms:{tDiffuse:new l.Uniform(null),h:new l.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}"},T={uniforms:{tDiffuse:new l.Uniform(null),v:new l.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 D;new l.Uniform(null),new l.Uniform(null),new l.Uniform(0),new l.Uniform(0),new l.Uniform(0),new l.Uniform(new l.Vector2),new l.Uniform(.1),new l.Uniform(1e3);class P{constructor(e){this.materials={},this.render=()=>{(0,C.mapObj)(this.materials,((e,t)=>{const{model:n,material:r}=t;r.update(n)}))},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 n=(0,C.getId)();t.userData.id=n,this.materials[n]=e}undo(e){var{material:e,list:t,val:n}=e;this.runScene.undoEx.addUndo(new h.Z({target:e,typeList:[...t],newVal:n}).execute())}dispose(){this.materials={}}}(D=P).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],P.TextureNames=["map","normalMap","roughnessMap","metalnessMap","tDiffuse","tDiffuseBlur"],P.tools={type:"Reflector",getTextures:e=>(0,u.getTexturesByMaterial)(e),create:(e,t)=>{const n=new O(void 0,void 0,e);return n.insertReflectorShader(),D.tools.bind(n),(t=t||e.modelEx.select)&&(n.name=t.name),e.materialEx.def.map.Reflector.bindData({model:t,material:n}),n},parseData:(e,t)=>{const{texture:n,normal:r,models:i,material:a}=e,{data:s,load:o}=n,c=(0,u.mergeMaterial)(a,new O(void 0,void 0,t)),h=[];return o&&h.push(...s.map((e=>()=>{c[e.type]=e.texture}))),Object.keys(r.uniforms).filter((e=>!P.TextureNames.includes(e))).map((e=>{c[e]="normalScale"===e?new l.Vector2(r.uniforms[e].x,r.uniforms[e].y):r.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=r.name,c.userData.id=a.userData.id,D.tools.bind(c),{material:c,setTextureFns:h}},toNormal:e=>{const t=(0,u.mergeMaterial)(e,(0,u.createDefMaterial)()),n=(t.userData=Object.assign({},t.userData),t.name=e.name,{}),r=R.uniforms;return Object.keys(r).filter((e=>!P.TextureNames.includes(e))).map((t=>{var i=e[t],a=r[t].value;"mirror"===t||"mixBlur"===t||"mixStrength"===t||"mixContrast"===t?i.value!==a&&(n[t]=i):i!==a&&(n[t]=i)})),t.normalScale&&(n.normalScale=t.normalScale),{material:t,normal:{type:D.tools.type,uniforms:n,name:e.name},textures:D.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const n=D.tools.create(t);return Object.keys(n).filter((e=>!P.IgnoredAttributes.includes(e))).map((t=>{n[t]=e[t]})),n},bind:e=>{(0,d.M)(e,"type",D.tools.type)}};class O extends l.MeshStandardMaterial{constructor(e,t,n){e?super(e):(super(),this.opacity=R.uniforms.opacity.value,this.transparent=R.uniforms.transparent.value,this.roughness=R.uniforms.roughness.value,this.metalness=R.uniforms.metalness.value),this.runScene=n,this.isSpecialMaterial=!0,t?(this.resolution=t.resolution,this.blurSize=t.blurSize,this.mirror=new l.Uniform(t.mirror),this.mixBlur=new l.Uniform(t.mixBlur),this.mixStrength=new l.Uniform(t.mixStrength),this.mixContrast=new l.Uniform(t.mixContrast)):(this.resolution=R.uniforms.resolution.value,this.blurSize=R.uniforms.blurSize.value,this.mirror=new l.Uniform(R.uniforms.mirror.value),this.mixBlur=new l.Uniform(R.uniforms.mixBlur.value),this.mixStrength=new l.Uniform(R.uniforms.mixStrength.value),this.mixContrast=new l.Uniform(R.uniforms.mixContrast.value)),this.textureMatrix=new l.Uniform(new l.Matrix4),this.reflectorWorldPosition=new l.Vector3,this.cameraWorldPosition=new l.Vector3,this.rotationMatrix=new l.Matrix4,this.normal=new l.Vector3,this.view=new l.Vector3,this.lookAtPosition=new l.Vector3,this.target=new l.Vector3,this.tempQuaternion=new l.Vector4,this.virtualCamera=new l.PerspectiveCamera,this.reflectorPlane=new l.Plane,this.clipPlane=new l.Vector4,e={minFilter:l.LinearFilter,magFilter:l.LinearFilter,type:l.HalfFloatType,encoding:this.runScene.assetsEx.get().renderer.outputEncoding},this.glRT1=new l.WebGLRenderTarget(this.resolution,this.resolution,e),this.glRT2=new l.WebGLRenderTarget(this.resolution,this.resolution,e),this.tDiffuse=new l.Uniform(this.glRT1.texture),this.tDiffuseBlur=new l.Uniform(this.glRT2.texture),this.hBlurPass=new _.T(E),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 _.T(T),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=R.vertexParas+""+e.vertexShader,e.vertexShader=e.vertexShader.replace("#include <project_vertex>",R.vertexShader),e.fragmentShader=R.fragmentParas+""+e.fragmentShader,e.fragmentShader=e.fragmentShader.replace("#include <emissivemap_fragment>",R.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 R={uniforms:{opacity:new l.Uniform(1),transparent:new l.Uniform(!1),roughness:new l.Uniform(1),metalness:new l.Uniform(.6),resolution:new l.Uniform(1024),blurSize:new l.Uniform(1024),mirror:new l.Uniform(0),mixBlur:new l.Uniform(10),mixStrength:new l.Uniform(2),mixContrast:new l.Uniform(1),depthTest:new l.Uniform(!0),depthWrite:new l.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 "},I="\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 ",k="\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 ";var L,F=n(398);const U={emissive:o.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 G{constructor(e){this.runScene=e}undo(e){const{material:t,list:n,val:r}=e;this.runScene.undoEx.addUndo(new h.Z({target:t,typeList:[...n],newVal:r,cb:()=>{t.needsUpdate=!0}}).execute())}}(L=G).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines","onBeforeCompile"],G.TextureNames=["alphaMap","aoMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap"],G.tools={type:"TreeLeaf",getTextures:e=>{const t=[];return G.TextureNames.forEach((n=>{e[n]&&t.push({type:n,texture:e[n]})})),t},create:(e,t)=>{const n=new j(e);return L.tools.bind(n),(t=t||e.modelEx.select)&&(n.name=t.name,n.setSize(t),n.setWorldPos(t)),n},parseData:(e,t)=>{const{normal:n,texture:r,material:i,models:a}=e,{data:s,load:o}=(console.log(i,i.userData,"material,"),r),c=(0,u.mergeMaterial)(i,new j(t)),h=(c.setSize(a[0]),c.setWorldPos(a[0]),[]);return o&&h.push(...s.map((e=>()=>{c[e.type]=e.texture}))),Object.keys(n.uniforms).filter((e=>!G.IgnoredAttributes.includes(e))).map((e=>{var t=n.uniforms[e];"color"!==e&&"emissive"!==e&&("normalScale"===e?c[e]=new l.Vector2(t.x,t.y):"windForce"===e||"windSpeed"===e||"windWaveScale"===e||"colorLevel"===e||"colorFade"===e||"leavesCore"===e?c.uniforms[e]=new l.Uniform(t):"colorGradient"===e?c.uniforms[e]=new l.Uniform(new l.Color(parseInt(t,16))):c[e]=n.uniforms[e])})),c.name=n.name,c.userData.id=i.userData.id,L.tools.bind(c),{material:c,setTextureFns:h}},toNormal:(e,t)=>{var n=L.tools.getTextures(e);const r=(0,u.mergeMaterial)(e,(0,u.createDefMaterial)()),i=(r.name=e.name,{}),a=new j(t);return Object.keys(e).filter((e=>!G.TextureNames.includes(e))).filter((e=>!G.IgnoredAttributes.includes(e))).map((t=>{var n=e[t],r=a[t];"color"!==t&&"emissive"!==t&&("normalScale"===t?n.x===r.x&&n.y===r.y||(i[t]=n):"uniforms"===t?Object.keys(n).map((t=>{const n=e.uniforms[t].value,r=a.uniforms[t].value;"windForce"===t||"windSpeed"===t||"windWaveScale"===t||"colorLevel"===t||"colorFade"===t||"leavesCore"===t?n!==r&&(i[t]=n):"colorGradient"===t&&n.getHexString()!==r.getHexString()&&(i[t]=n.getHexString())})):n!==r&&(i[t]=n))})),{material:r,normal:{type:L.tools.type,uniforms:i,name:e.name},textures:n}},clone:(e,t)=>e,copy:(e,t)=>{const n=L.tools.create(t);return Object.keys(n).filter((e=>!G.IgnoredAttributes.includes(e))).map((t=>{n[t]=e[t]})),n},bind:e=>{(0,d.M)(e,"type",L.tools.type)},snapshot:{getDiff:e=>F.LV.getDiff(U,e),set:e=>{const{map:t,material:n,runScene:r,data:i}=e;F.LV.set({def:U,data:i,runScene:r,map:t,target:n}),t.data.completedCbs.push((()=>{(0,u.updateMaterial)(n)}))}}};const N=new l.Clock;class j extends l.MeshStandardMaterial{constructor(e){super(),this.isSpecialMaterial=!0,this.uniforms={time:new l.Uniform(0),windForce:new l.Uniform(.3),windSpeed:new l.Uniform(.5),windWaveScale:new l.Uniform(.25),colorGradient:new l.Uniform(new l.Color(65280)),colorLevel:new l.Uniform(-.5),colorFade:new l.Uniform(-.25),leavesCore:new l.Uniform(.3),leavesSize:new l.Uniform(new l.Vector3),leavesPos:new l.Uniform(new l.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=I,e.fragmentShader=k,e.vertexShader=e.vertexShader.replace(/\/\/ Insert Noise3D/g,x)}}update(){this.uniforms.time.value=N.getElapsedTime()}setSize(e){var t=new l.Vector3;e.getWorldScale(t),t=new l.Vector3,(new l.Box3).setFromObject(e).getSize(t),this.uniforms.leavesSize.value=t}setWorldPos(e){var t=new l.Vector3;e.getWorldPosition(t),this.uniforms.leavesPos.value=t}}const H={SpriteMaterial:M.Z,FakeInterior:p,Fresnel:m,Matcap:y,MixTexture:S,Physical:B,Reflector:P,TreeLeaf:G,BasicMaterial:o.ZP};class z{constructor(e){this.runScene=e,this.map={SpriteMaterial:new M.Z(e),FakeInterior:new p(e),Fresnel:new m(e),Matcap:new y(e),MixTexture:new S(e),Physical:new B(e),Reflector:new P(e),TreeLeaf:new G(e),BasicMaterial:new o.ZP(e)}}static create(e,t){return H[e].tools.create(t)}static copy(e,t,n){return H[e].tools.copy(t,n)}static clone(e,t){return H[e].tools.clone(t)}static toNromal(e,t,n){return H[e].tools.toNormal(t,n)}static parseData(e,t,n){return H[e].tools.parseData(t,n)}static bind(e){e.material&&("MeshStandardMaterial"===e.material.type?o.ZP.tools.bind(e):"SpriteMaterial"===e.material.type&&M.Z.tools.bind(e))}static getTextures(e){var t=V(e);if(t)return H[t].tools.getTextures(e);throw TypeError("该材质没有类型")}static parseNode(e){e.material&&(e=e.material,(0,u.isBaseMaterial)(e)&&o.ZP.tools.bind(e),e.isSpriteMaterial&&M.Z.tools.bind(e))}}z.snapshot={getDiff:e=>{var t=V(e);if(H[t])return H[t].tools.snapshot.getDiff(e);throw TypeError("该材质没有类型")},set:e=>{var t=e.material;if(t=V(t),H[t])return H[t].tools.snapshot.set(e);throw TypeError("该材质没有类型")}};const V=e=>e.userData.type},932:(e,t,n)=>{n.r(t),n.d(t,{SpecialMaterial:()=>I,createDefMaterial:()=>w,defAllMaterialMap:()=>b,defBaseMaterialMap:()=>y,default:()=>x,disposeMaterial:()=>A,getBaseTextures:()=>C,getMaterialType:()=>k,getTextures:()=>B,getTexturesByMaterial:()=>M,initMaterial:()=>E,isBaseMaterial:()=>R,isColor:()=>T,isMaterial:()=>P,materialIgnore:()=>L,mergeMaterial:()=>S,setDefMaterialForSameGeo:()=>O,setMaterialTexture:()=>_,updateMaterial:()=>D});var r=n(1),i=n(881),a=n(330),s=n(794),o=n(736),l=n(625),u=n(24),c=n(510),h=n(729),d=n(723),p=n(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.data=this.getData()},this.load=e=>{e=e.data;var{materialDef:e,material:t,model:n}=e;E(t),this.data.materialIns[e.id]||(this.data.materialIns[e.id]={material:t,models:[]}),this.data.materialIns[e.id].models.push(n)},this.done=e=>{const{json:t,core:n}=e;var{materialMap:e,textureMap:r}=t.asset.ex||{};this.processTextureMap(r||{}),this.processMaterialMap(e||{},t),this.processClonedTextures(),this.pending.push(this.loadTextures(n)),n.pending.push(Promise.all(this.pending))},this.parser=null,this.loadTexture=e=>{e=e.data;const{textureDef:t,texture:n}=e;var{md5:e,format:r,size:i,uvScript:a,id:s,cloneSourceId:u,minFilter:c}=t;n.userData.md5=e,r&&(n.format=r,n.userData.format=r),a&&(n.userData.uvScript=a),u&&((0,l.setTextureCloneId)(n,u),this.clonedTextures.push(n)),"nearest"===c&&((0,l.setTextureMinFilter)(n,"nearest"),(0,o.M)(n,"minFilter",c)),n.userData.id=s,n.userData.size=i,this.data.textureIns[t.id]=this.runScene.textureEx.getSameTexture(e,n)||n},this.processTextureMap=(()=>{const e=e=>{const{target:t,data:n}=e;var r;n&&(({x:e,y:r}="object"==typeof n?n:{x:n,y:n}),t.x=e,t.y=r)};return t=>{(0,r.mapObj)(t,((t,n)=>{var{format:n,center:r,rotation:i,offset:a,repeat:s}=n;const o=this.data.textureIns[t];o&&(o.format=n,e({target:o.repeat,data:s}),e({target:o.center,data:r}),e({target:o.offset,data:a}),i&&(o.rotation=i),this.runScene.textureEx.initTextureAndAddtoAll(o))}))}})(),this.processMaterialMap=(()=>{const e=e=>{const{textures:t,normal:n,models:i,material:a}=e;e=(0,r.mapObj)(t,((e,t)=>({type:e,texture:this.data.textureIns[t]})));const{material:s,setTextureFns:o}=this.runScene.materialEx.parseData(n.type,{normal:n,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,n)=>{(0,r.mapObj)(t,((t,i)=>{if(t=this.data.materialIns[t]){const{material:a,models:s}=t;if(a){const{normal:t,textures:o}=i;t.type||(t.type=p.ZP.tools.type),"scene"===n.asset.ex.type&&n.asset.ex.sceneEx.materialId===a.userData.id&&(0,r.mapObj)(o,((e,t)=>{t=this.data.textureIns[t],_({material:a,type:e,texture:t})})),e({textures:o,models:s,material:a,normal:t}),a.needsUpdate=!0}}}))}})(),this.lazyLoadFns=[],this.loadTextures=(()=>{const e=e=>{e.callback("lazyLoadedTexture",""),this.runScene.optionsEx.log("贴图懒加载完毕","base","success")},t=(n,r,i)=>{const a=this.lazyLoadFns[n];if(!a)return r(0),e(i);a(),setTimeout((()=>t(++n,r,i)),this.runScene.optionsEx.options.texture.lazyLoad.intervalTime)};return e=>new Promise((n=>{this.runScene.optionsEx.options.texture.lazyLoad.open?t(0,n,e):(n(0),this.lazyLoadFns.map((e=>e())))}))})(),this.afterParse=e=>{const{data:t,core:n,json:r}=e;if("material"===r.asset.ex.type){e=t.options.models;const[r]=e,i=[];r.material?(this.runScene.materialEx.add(r.material),i.push(r.material)):r.children.map((e=>{e.material&&(i.push(e.material),this.runScene.materialEx.add(e.material))})),n.models.push(...i)}},this.runScene=e}getData(){return{materialMap:{},textureMap:{},materialIns:{},textureIns:{}}}getMap(){return new 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,n,r){return new(n=n||Promise)((function(t,i){function a(e){try{o(r.next(e))}catch(e){i(e)}}function s(e){try{o(r.throw(e))}catch(e){i(e)}}function o(e){var r;e.done?t(e.value):((r=e.value)instanceof n?r:new n((function(e){e(r)}))).then(a,s)}o((r=r.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))}))}}var m=n(943);t=n(110);class v{constructor(e){this.getDiff=()=>{let e={};return this.runScene.uniqueEx.material.getAll("values").map((t=>{t=t.material;var n=(0,m.ee)(t);m.Ws[n].tools.snapshot&&(n=(0,h.K)(t),console.log(n,"id"),n&&(e[n]=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,r.mapObj)(t,((t,n)=>{(t=this.runScene.uniqueEx.material.get(t))&&m.ZP.snapshot.set({material:t,data:n,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,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.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)}add(e,t,n){L.is(e)||this.runScene.uniqueEx.material.add(e,t,n)}create(e="BasicMaterial"){return e=m.ZP.create(e,this.runScene),this.add(e),e}toArray(){return(0,r.mapObj)(this.runScene.uniqueEx.material.map,((e,t)=>t.material))}copy(e){var t=k(e);if(t){const n=m.ZP.copy(t,e,this.runScene);return n.userData.id=(0,r.getId)(),n}}clone(e){var t=k(e);if(t){const n=m.ZP.clone(t,e);return n.userData.id=(0,r.getId)(),n}}setNormals(e,t=!0){const{info:n,newVal:r,materials:i,oldval:a,cb:s}=e;let o=r;return o.isVector2&&(o=o.clone()),e=i.map((e=>new u.Z({info:n,target:e,newVal:o,oldVal:a||e[n],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:n,newVal:r,materials:i,oldVal:a}=e;r instanceof File&&(e.newVal=yield this.runScene.textureEx.parse(r)),"envMap"===n&&(0,l.setTextureMapping)(e.newVal);var s=i.map((t=>new u.Z({info:n,target:t,newVal:e.newVal,oldVal:a||t[n],runScene:this.runScene}).execute()));return t&&this.runScene.undoEx.addUndo(s),i[0][n]}))}setTexture(e,t=!0){return g(this,void 0,void 0,(function*(){var{info:n,newVal:r,target:i}=e,r=(r instanceof File&&(e.newVal=yield this.runScene.textureEx.parse(r)),"envMap"===n&&(0,l.setTextureMapping)(e.newVal),new u.Z(Object.assign(Object.assign({},e),{oldVal:i[n],runScene:this.runScene})).execute());return t&&this.runScene.undoEx.addUndo(r),e.newVal}))}resetMaterial(e,t,n){const{addUndo:r,includeChild:i}=n=(0,d.Gm)({addUndo:!0,includeChild:!1},n);if(e&&t){const n=new Set;((0,d.lG)(e,"array")?e:[e]).map((e=>{i?e.traverse((e=>{R(e.material)&&n.add(e)})):e.material&&n.add(e)}));const a=[];n.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),r&&this.runScene.undoEx.addUndo(a)}}toNromal(e){var t=k(e);if(t){const n=m.ZP.toNromal(t,e,this.runScene);return n.material.userData=Object.assign(Object.assign({},n.material.userData),e.userData),n}}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.K)(e));t&&(this.resetMaterial(t.toArray(),w()),this.runScene.cb.material.remove.cb(e))}getDefNromals(e){var t;if("BasicMaterial"!==(null==(t=e.userData)?void 0:t.type))return{};const n={};return(0,r.mapObj)(y,((t,r)=>{const i=e[t];if("object"==typeof i)for(const e in i)if(i[e]!==r[e])return void(n[t]=i.clone());i!==r&&(n[t]=i)})),n}parseNromals(e,t){(0,r.mapObj)(e,((e,n)=>{var r,i,a,s,o;void 0!==y[e]&&("object"==typeof n?(({x:a,y:s,z:o}=n),null!=(i=null==(r=t[e])?void 0:r.set)&&i.call(r,a,s,o)):t[e]=n)}))}isBaseMaterial(e){return"MeshStandardMaterial"===e.type&&"BasicMaterial"===e.userData.type&&!e.userData.isTimeLineUsed&&p.ZP.isDefVal(e)}}const w=e=>{const t=new i.MeshStandardMaterial(e);return t.userData.id=(0,r.getId)(),p.ZP.tools.bind(t),t},S=(e,t)=>(b.map((n=>{const r=e[n];"object"==typeof r&&(t[n]=r.clone()),t[n]=r})),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=>{const{material:t,type:n,texture:r}=e;"envMap"===n&&(0,l.setTextureMapping)(r),t[n]=r,t.needsUpdate=!0},E=e=>{e.vertexColors=!1,e.depthWrite=!0,e.needsUpdate=!1},T=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,n)=>{n.d(t,{ZP:()=>g,Gf:()=>v});var r=n(881),i=n(330),a=n(263),s=n(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=n(398),m=n(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"},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})=>{console.log(e,t,"target,end"),t<1&&!e.transparent&&(e.transparent=!0,(0,m.updateMaterial)(e))}},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)&&(g.tools.bind(e),e.userData.uvCount||(e.userData.uvCount=new r.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 n=this.defVal[t],i=e[t];if(n instanceof r.Color){if(n.getHexString()!==i.getHexString())return!1}else if("object"==typeof n){if(i.x!==n.x)return!1}else if(i!==n)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 r.MeshStandardMaterial;return p.tools.bind(e),e},parseData:e=>{const{texture:t,normal:n,core:r,material:i}=e,{data:s,load:o}=t,l=[];return o&&l.push(...a.F6.filter(s.map((e=>{const{type:t,texture:n}=e;if(n)return()=>{r.runScene.uniqueEx.texture.addMaterial(n,{material:i,type:t}),(0,m.setMaterialTexture)({material:i,type:t,texture:n})}})))),r.runScene.materialEx.parseNromals(n,i),g.tools.bind(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:n,runScene:r,data:i}=e;f.LV.set({def:v,data:i,runScene:r,map:t,target:n}),t.data.completedCbs.push((()=>{(0,m.updateMaterial)(n)}))}}},g.defVal={color:new r.Color(16777215),emissive:new r.Color(0),roughness:1,metalness:0,lightMapIntensity:1,aoMapIntensity:1,emissiveIntensity:1,bumpScale:1,normalScale:new r.Vector2(1,1),displacementScale:1,envMapIntensity:1,wireframe:!1,transparent:!1,depthTest:!0,depthWrite:!0,opacity:1,fog:!0}},110:(e,t,n)=>{n.d(t,{Z:()=>c});var r,i=n(881),a=n(529),s=n(736),o=n(398),l=n(932);const u={color:(t=n(707)).Gf.color,opacity:t.Gf.opacity};class c{constructor(e){this.runScene=e}}(r=c).tools={type:"SpriteMaterial",bind(e){(0,s.M)(e,"type","SpriteMaterial")},getTextures:e=>["map","alphaMap"].map((t=>{var n=e[t];if(n)return{type:t,texture:n}})).filter((e=>e)),create:()=>{var e=new i.SpriteMaterial;return r.tools.bind(e),e},parseData:(e,t)=>{var{texture:e,material:n,normal:r}=e;const{data:i,load:a}=e,s=[],o=(0,l.mergeMaterial)(n,c.tools.create(t));var{depthWrite:e,depthTest:n,name:t,fog:r}=r;return!1===r&&(o.fog=!1),void 0!==e&&(o.depthWrite=e),void 0!==n&&(o.depthTest=n),t&&(o.name=t),a&&s.push(...i.map((e=>{const{type:t,texture:n}=e;return()=>{o[t]=n}}))),{material:o,setTextureFns:s}},toNormal:e=>{const t=(0,l.mergeMaterial)(e,(0,l.createDefMaterial)());var n=Object.assign({},t.userData);const r={type:c.tools.type,name:e.name};return e.fog||(r.fog=!1),e.depthWrite!==l.defBaseMaterialMap.depthWrite&&(r.depthWrite=e.depthWrite),e.depthTest!==l.defBaseMaterialMap.depthTest&&(r.depthTest=e.depthTest),t.userData=n,{normal:r,textures:c.tools.getTextures(e),material:t}},clone:e=>e,copy:e=>{const t=e.clone();return t.userData.type=c.tools.type,t},snapshot:{getDiff:e=>o.LV.getDiff(u,e),set:e=>{const{map:t,material:n,runScene:r,data:i}=e;o.LV.set({def:u,data:i,runScene:r,map:t,target:n}),t.data.completedCbs.push((()=>{(0,l.updateMaterial)(n)}))}}},c.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,t)=>{const n=(0,a.createDefModel)("Box");return n.userData.normal=Object.assign({type:"MySpriteMaterial"},e.userData),n.material=e.material,c.modelTools.merge(e,n),n},parseData:(e,t)=>{const n=(0,a.createDefModel)("Sprite");var r=e.userData.layers;return(0,a.setLayers)(n,r),n.userData=Object.assign(Object.assign({},t),n.userData),c.modelTools.merge(e,n),n.material=e.material,n}}},801:(e,t,n)=>{n.d(t,{Ju:()=>a,t9:()=>i,zf:()=>s});var r=n(736);const i={isDynamic:()=>{}},a={isDeleted(e,t=!1){var n;return!!e&&(!(null==(n=null==e?void 0:e.userData)||!n.isDeleted)||!!t&&a.isDeleted(e.parent,t))},setDeleted(e,t){e.userData&&(t?(0,r.M)(e,"isDeleted",!0):null!=(t=null==e?void 0:e.userData)&&delete t.isDeleted)}},s={setLock(e){(0,r.M)(e,"lock",!0)},reLock(e){delete e.userData.lock},isLock(e,t=!1){if(!e||"Scene"===e.type)return!1;var n=e.userData.lock;return t?!!n||s.isLock(e.parent,t):void 0!==n&&n}}},529:(e,t,n)=>{n.r(t),n.d(t,{createDefModel:()=>k,createSpecialModel:()=>I,default:()=>R,delClonedModel:()=>X,deletedModel:()=>O.Ju,disposeModel:()=>L,dynamicModel:()=>O.t9,getClonedIdModel:()=>Z,getDeepModels:()=>z,getIdMapByModel:()=>ie,getModelSize:()=>$,hasSkeleton:()=>V,helperModel:()=>ne,instanceModel:()=>F,isDynamicModel:()=>K,isGLowModel:()=>Q,isGroup:()=>q,isHelper:()=>j,isSprite:()=>Y,lockModel:()=>O.zf,mergeModel:()=>U,normalModel:()=>te,selectableModel:()=>ee,setClonedModel:()=>W,setDynamicModel:()=>J,setHelper:()=>N,setLayers:()=>H,tempModel:()=>ae,uselessGroup:()=>re,withAnima:()=>G}),t=n(356);var r=n.n(t),i=n(1),a=n(881);function s(e){for(var t,n,r,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((n=void 0===n?o.itemSize:n)!==o.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if((r=void 0===r?o.normalized:r)!==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,n,r)}var o=n(230);const l=["Group","Box","Circle","Cylinder","Dodecahedron","Icosahedron","Lathe","Octahedron","Plane","Ring","Sphere","Sprite","Tetrahedron","Torus","TorusKnot","Tube","Reflector"];var u=n(794),c=n(272),h=n(247),d=n(269),p=n(943),f=n(932),m=n(736);class v extends n(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=n(735),y=n(510);class b extends n(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=n(169),S=n(380),A=n(729),M=n(457);class B{constructor(e){this.runScene=e}init(){this.bindEvent()}bindEvent(){}}var C=n(143),_=n(110);class E{constructor(e){this.data=this.getData(),this.nodeType={MySpriteMaterial:_.Z},this.mount=e=>{e.core.module.set("model",this)},this.complete=()=>{this.data=this.getData()},this.loadNodeDef=e=>{let{node:t,nodeDef:n}=e;(0,i.mapObj)(this.runScene.modelEx.defNodeMap,((e,r)=>{var i=n[e];null!=i&&(t[e]=i)})),n.wireframe&&(t.material.wireframe=!0)},this.load=e=>{var{data:e,core:t}=e;return this.loadNodeDef(e),this.loadExtras(e,t),e.node},this.done=()=>{this.removeHelperModel()},this.afterParse=e=>{const{config:t,data:n,json:r,core:i}=e;if("model"===r.asset.ex.type){if(null==(e=t.module)||!e.model)return[];let r=["glb_model"===(e=(e=n.options).models[0]).name&&(null==e?void 0:e.children[0])||e];var[e]=r;re.is(e)&&(r=[...e.children]),i.models.push(...r),this.mergeClone()}},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})}loadExtras(e,t){let{node:n,nodeDef:r}=e;if(r.extras){const{layers:o,normal:l,local:u,cloneId:c,id:h,animations:d,isDynamic:p}=r.extras;var i,a=K(n,!0);if("running"!==this.runScene.optionsEx.options.mode||a||null!=(s=this.runScene.optionsEx.options.renderConfig)&&s.matrixAutoUpdate||(n.matrixAutoUpdate=!1),d&&(n.animations=C.B.parse(d)),p&&(n.userData.isDynamic=!0),!c||a||(this.data.instancedMap[c]||(this.data.instancedMap[c]=new Set),this.data.instancedMap[c].add(n)),u&&([s,a,i]=u.split(","),n.position.set(s,a,i)),o&&(n.layers.enable(1),this.runScene.cb.model.setLayers.cb({model:n,val:1})),r.extras.isHelper&&this.data.helperModels.push(n),l){const t=this.nodeType[null==l?void 0:l.type];e.node=t.modelTools.parseData(n,l)}h&&this.data.map.set(h,e.node);var s=null==(i=null==(a=null==(s=e.node)?void 0:s.material)?void 0:a.userData)?void 0:i.id;if(s){const n=t.module.get("material").data.materialIns[s];n&&n.models.push(e.node)}}}removeHelperModel(){this.data.helperModels.map((e=>{var t;return null==(t=e.parent)?void 0:t.remove(e)}))}mergeClone(){var e;this.runScene.optionsEx.options.instanceClone&&"running"===this.runScene.optionsEx.options.mode&&(this.runScene.assetsEx.scene.updateMatrixWorld(),e=this.data.instancedMap,(0,i.mapObj)(e,((e,t)=>{var n,r=this.runScene.uniqueEx.model.map[e];t.size<2||!r||!r.geometry||K(r,!0)||(n=F(r,[...t]),this.runScene.modelEx.add(n,void 0,{isClone:!1,select:!1,addUndo:!1}),Q(r)&&this.runScene.modelEx.setGlow(n,!0),this.runScene.modelEx.remove(r,!1),t.forEach((e=>this.runScene.modelEx.remove(e,!1))),t.clear(),delete this.data.instancedMap[e])}))),this.data.instancedMap={}}mergeGeometry(){}}var T=n(398);const D={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 P{constructor(e){this.create=e=>{e.data.set("model",this.getDiff())},this.set=e=>{var t=e.snapshot.data.get("model");if(t){const n=e.data.completedCbs;(0,i.mapObj)(t,((t,r)=>{const i=this.runScene.uniqueEx.model.get(t);i&&(T.LV.set({def:D,runScene:this.runScene,data:r,target:i,map:e}),void 0!==r.visible&&r.visible&&(i.visible=r.visible),n.push((()=>{void 0===r.isGLow||Q(i)||H(i,1)})))}))}},this.runScene=e,this.runScene.cb.snapshot.create.add("scene",this.create),this.runScene.cb.snapshot.set.add("scene",this.set)}getDiff(){const e={},t=this.runScene.sceneEx.getClearModels();return console.log(t,"models"),t.map((t=>{t.traverse((t=>{var n=(0,A.K)(t);n&&(e[n]=T.LV.getDiff(D,t),Q(t)&&(e[n].isGLow=!0))}))})),e}getData(){}}var O=n(801);class R{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,n,r)=>{var{addUndo:i,isClone:a,select:s,addToTree:o}=(0,M.mergeObject)({addUndo:!0,isClone:!1,select:!1,addToTree:!0},r);return t instanceof Array?t.map((e=>this.add(e,n,r))):(e(t,a),this.setGeometryMap(t),this.setCloneMap(t),o=new v({model:t,parent:n||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,n=!0)=>{if(e.lightEx.isLight(t))return e.lightEx.clone(t);var r,a,s=V(t),o=(e=>{const t={};return(0,M.getModelMap)(e,"id",(e=>{0<e.animations.length&&(t[(0,A.K)(e)]=e.animations)})),t})(t),l=(s=s?function(e){var t=new Map,n=new Map,r=e.clone();return function e(t,n,r){r(t,n);for(var i=0;i<t.children.length;i++)e(t.children[i],n.children[i],r)}(e,r,(function(e,r){t.set(r,e),n.set(e,r)})),r.traverse((function(e){var r,i;e.isSkinnedMesh&&(i=(r=t.get(e)).skeleton.bones,e.skeleton=r.skeleton.clone(),e.bindMatrix.copy(r.bindMatrix),e.skeleton.bones=i.map((function(e){return n.get(e)})),e.bind(e.skeleton,e.bindMatrix))})),r}(t):t.clone(),l=t,(0,m.M)(s,"cloneId",Z(l)||l.userData.id),(0,m.is)(t,"isDynamic")&&J(s,!0),(0,M.getModelMap)(s,"id"));u=s,(a=null==t?void 0:t.material)&&(r=p.ZP.clone((0,p.ee)(a),a))&&r.uuid!==a.uuid&&(e.materialEx.resetMaterial(u,r,{addUndo:!0}),e.materialEx.add(r,t,a));{var u={newModel:s,newModelMap:l,animaMap:o};const{animaMap:e,newModelMap:t}=u;(0,i.mapObj)(e,((e,n)=>{const r=t[e];r&&(r.animations=[...n.map((e=>e.clone()))])}))}return n&&e.uniqueEx.model.add(s,{reset:!0,hasReset:!0}),s})(e),this.runScene.cb.clean.add("EngineModel",this.clean),this.export=new B(e),this.import=new E(e),this.snapsot=new P(e),this.runScene.cb.loaderer.gltf.getArrayBuffer.add("EngineModel",(()=>{this.selectNull()}))}get select(){return this._selectModel}set select(e){this.setSelectByModel(e)}init(){var e={name:"node",loadCallBacks:this.import.getMap(),exportCallBacks:new u.Z};this.runScene.exporter.gltf.module.bind(e)}setGeometryMap(e){if((0,M.validType)(e,"array"))return e.map((e=>this.setGeometryMap(e)));var t;e.geometry&&(t=e.geometry.uuid,this.geometryMap.get(t)||this.geometryMap.set(t,new Set),this.geometryMap.get(t).add((0,A.K)(e))),this.setGeometryMap(e.children)}isSameGeo(e,t){var{normal:e,position:n,uv:r}=e.attributes,{normal:t,position:i,uv:a}=t.attributes;return e.array.length===t.array.length&&n.array.length===i.array.length&&r.array.length===a.array.length&&(e=(0,M.sameArr)([...e.array],[...t.array],20),t=(0,M.sameArr)([...n.array],[...i.array],20),n=(0,M.sameArr)([...r.array],[...a.array],20),e&&t&&n)}getClonedIdFromModel(e){if(e.geometry){for(const e of this.clonedMap){const[n,r]=e;if(0!==r.size){var t=r.values()[0];if(!t)return;const e=this.runScene.uniqueEx.model.get(t);if(!e||!e.geometry)return;if(this.isSameGeo(e.geometry,e.geometry))return n}}this.clonedMap.map(((e,t)=>{t.size}))}}setCloneMap(e){if((0,M.validType)(e,"array"))return e.map((e=>this.setGeometryMap(e)));var t=Z(e);(t||this.getClonedIdFromModel(e))&&(this.clonedMap.get(t)||this.clonedMap.set(t,new c.Z),this.clonedMap.get(t).add((0,A.K)(e)),this.setCloneMap(e.children))}removeCloneMap(e){this.clonedMap.get((0,A.K)(e))}replaceClonedGroup(e,t){t=Z(t)||(0,A.K)(t);const n=this.clonedMap.get(t);n&&0!==n.size&&(e.userData.id=t,n.map((t=>{if(t=this.runScene.modelEx.getById(t)){var{position:n,rotation:r,scale:i,name:a,parent:s}=t;this.remove(t,!1);const o=this.runScene.modelEx.clone(e);o.userData.id=(0,A.K)(t),o.position.copy(n),o.rotation.copy(r),o.scale.copy(i),o.name=a,this.add(o,s,{addUndo:!1,isClone:!0,select:!1})}})))}replaceGeometry(e,t){t=t.uuid;const n=this.geometryMap.get(t);n&&0!==n.size&&(n.forEach((t=>{const n=this.runScene.uniqueEx.model.get(t);n&&(n.geometry=e,n.updateMatrix())})),this.geometryMap.delete(t),this.geometryMap.set(e.uuid,n))}setSelectByModel(e,t){this.runScene.optionsEx.log([e,"选中的模型",(0,A.K)(e)],"detail");var{isDomTreeActive:t,isClone:n}=t||{};if(this.runScene.events.key.ctrl&&!n)this.runScene.multipSelector.add(e);else{if(this.runScene.multipSelector.isEmpty()||this.runScene.multipSelector.setEmpty(),this._selectModel){if(this._selectModel===e)return void(this.runScene.helperEx.focusModelId||this.runScene.helperEx.focus(e));this.runScene.lightEx.setNull(this._selectModel),this.runScene.cb.model.unFocus.cb(this._selectModel)}e&&(this.runScene.cb.model.focus.cb({model:e,status:!0,domActive:!t}),this.runScene.materialEx.setSelect(e.material),this.runScene.cb.model.setSelect.cb(e),(this._selectModel=e).isCamera||(this.runScene.helperEx.focus(e),this.runScene.lightEx.setSelect(e)))}}setSelectById(e){(e=this.runScene.uniqueEx.model.get(e))&&this.setSelectByModel(e)}remove(e,t=!0){let n=[];Array.isArray(e)?n.push(...e):n.push(e),e=n.map((e=>new w.Z({runScene:this.runScene,model:e,parent:e.parent||this.runScene.sceneEx.get()}).execute())),t&&this.runScene.undoEx.addUndo(e)}isNavieV3(e,t=0){var{x:e,y:n,z:r}=e;return e+n+r===t}isNavieV2(e,t=0){var{x:e,y:n}=e;return e===t&&n===t}isUnless(e){return!e.material&&this.isNavieV3(e.position)&&this.isNavieV3(e.rotation)&&this.isNavieV3(e.scale,3)&&0===e.children.length}isUnlessLevel(e){return this.isNavieV3(e.position)&&this.isNavieV3(e.rotation)&&this.isNavieV3(e.scale,3)&&1===e.children.length&&!G(e)}create(){var e=r().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,n=!0){if(t=new x({oldParent:e.parent,newParent:t,target:e,runScene:this.runScene}).execute(),!n)return t;this.runScene.undoEx.addUndo(t)}_setV3(e){const{model:t,info:n,newV3:r}=e;if(Array.isArray(t))return t.map((e=>{e[n].set(r.x,r.y,r.z),e.updateMatrix()}));t[n].set(r.x,r.y,r.z),t.updateMatrix()}update(e){if(Array.isArray(e))return e.map((e=>e.updateMatrix()));e.updateMatrix()}setV3(e,t=!0,n=!0){let{model:r,info:i,newV3: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,M.isRunning)(this.runScene))return this._setV3(e);var c=r instanceof Array?r.map((e=>new S.Z({target:e,info:i,runScene:this.runScene,oldV3:o||e[i].clone(),newV3:s}).execute(n))):new S.Z({target:r,info:i,oldV3:o||r[i].clone(),newV3:s,runScene:this.runScene}).execute(n);t&&this.runScene.undoEx.addUndo(c)}setNormal(e,t=!0){const{model:n,oldVal:r,info:i,val:a,executeCb:s}=e;return e=n instanceof Array?n.map((e=>new y.Z({target:e,info:i,runScene:this.runScene,oldVal:r||n[i],newVal:a,executeCb:s}).execute())):new y.Z({target:n,info:i,runScene:this.runScene,oldVal:r||n[i],newVal:a,executeCb:s}).execute(),t&&this.runScene.undoEx.addUndo(e),e}setMaterial(e,t,n=!0){var r=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,n&&this.runScene.undoEx.addUndo(r)}addDef(e){this.add(k(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 n=this.getIndexByModel(e);if(t=this.getIndexByModel(t),-1!==n&&-1!==t){const r=Math.max(n,t),i=n===r?t:n;return e.parent.children.map(((e,t)=>t>i&&t<r&&e)).filter((e=>e))}}}setMultip(e){var{model:e,typeList:t,newVal:n}=e;this.runScene.undoEx.addUndo(new g.Z({target:e,typeList:t,newVal:n}).execute())}createGroup(e,t,n){const r=t||new a.Group,i=[];i.push(new v({model:r,runScene:this.runScene,parent:n||this.runScene.assetsEx.get().scene}).execute()),e instanceof Array?i.push(...e.map((e=>new x({target:e,oldParent:e.parent,newParent:r,runScene:this.runScene}).execute()))):i.push(new x({target:e,oldParent:e.parent,newParent:r,runScene:this.runScene}).execute()),n&&this.runScene.cb.model.setOpen.cb({isOpen:!0,model:n}),this.runScene.cb.model.setOpen.cb({isOpen:!0,model:r}),this.runScene.cb.model.setMainStatue.cb({status:!0,model:r}),this.runScene.undoEx.addUndo(i),this.setSelectByModel(r)}cleanGroup(e,t=!0){if(e instanceof Array){const t=(0,i.multiArrToArr)(e.map((e=>(this.runScene.cb.model.unFocus.cb(e),this.cleanGroup(e,!1)))).filter((e=>e)));return this.runScene.undoEx.addUndo(t),t}if(this.runScene.cb.model.unFocus.cb(e),0!==e.children.length){const n=[],r=e.children.map((e=>{if(e.parent.parent)return new x({target:e,oldParent:e.parent,newParent:e.parent.parent,runScene:this.runScene})})).filter((e=>e));return n.push(...r.map((e=>e.execute()))),n.push(new w.Z({runScene:this.runScene,model:e,parent:e.parent}).execute()),t&&this.runScene.undoEx.addUndo(n),n}}hideOther(e){const t=e.uuid,n=0<e.children.length,i=this.runScene.sceneEx.getClearModels(),a=[];i.map((i=>{i.traverse((i=>{n?!1===r().model.deepFindParentByUuid(i,t)&&i.uuid!==e.uuid&&a.push(i):i.uuid!==e.uuid&&a.push(i)}))}));var 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),r().model.setParentVisible(e,!0)}showAll(){const e=this.runScene.sceneEx.getClearModels(),t=[];e.map((e=>{e.traverse((e=>{"materialHelper"!==e.name&&!1===e.visible&&t.push(e)}))}));var n=t.map((e=>new y.Z({target:e,info:"visible",runScene:this.runScene,newVal:!0,oldVal:e.visible}).execute()));this.runScene.undoEx.addUndo(n)}removeHide(){const e=this.runScene.sceneEx.getClearModels(),t=new Set,n=[];e.map((e=>{e.traverse((e=>{e.visible||t.add(e)}))})),t.forEach((e=>{n.push(new w.Z({runScene:this.runScene,model:e,parent:e.parent}).execute())})),this.runScene.undoEx.addUndo(n)}_getModel(e){var t=this.runScene.uniqueEx.model.nameMap[e];if(t)return this.runScene.uniqueEx.model.get(t)||this.runScene.assetsEx.scene.getObjectByName(e)}getModel(e,t="array"){if(!(e instanceof Array))return this._getModel(e);if("array"===t)return e.map((e=>this._getModel(e)));if("map"===t){const t={};return e.map((e=>{t[e]=this.getModel(e)})),t}}getWorldLocal(e){this.runScene.assetsEx.scene.updateMatrixWorld(!0);var t=new a.Vector3;return e.getWorldPosition(t),t}getClickObj(e,t,n=!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(n){if(0===(e=o.filter((e=>r().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:n}=this.runScene.assetsEx.camera.position,{x:r,y:i,z:a}=this.runScene.assetsEx.controls.target;return{cx:e,cy:t,cz:n,tx:r,ty:i,tz:a}}camAnima(e,t,n=1,r,i){return(0,M.anima)(e,t,n,(e=>{i&&i(e),this.runScene.assetsEx.camera.position.set(e.cx,e.cy,e.cz),this.runScene.assetsEx.controls.target.set(e.tx,e.ty,e.tz),this.runScene.assetsEx.camera.lookAt(this.runScene.assetsEx.controls.target)}),(e=>{r&&r()}))}setGlow(e,t=!0){t=t?1:0,0==(e.userData.layers=t)?e.layers.set(0):e.layers.enable(1),this.runScene.cb.model.setLayers.cb({model:e,val:t})}setOutline(e,t=!0){e.userData.outline=t,this.runScene.pp.addOutlineObj(e,t),this.runScene.cb.model.setOutline.cb({model:e,val:t})}beforeLoad(e){return e instanceof Array?e.map((e=>this.beforeLoad(e))):e}focus(e){const{scene:t,camera:n,renderer:r,controls:i}=this.runScene.assetsEx.get(),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=r.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(n.position,o),u.projectOnPlane(new a.Vector3(0,1,0)),u.normalize(),1<t&&(t=1/t),l=2*Math.tan(.5*n.fov*Math.PI/180),l=i.length()/t/l,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 r=new a.Vector3;r.subVectors(n.position,o),r.projectOnPlane(new a.Vector3(0,1,0)),r.normalize(),s.addVectors(o,r.multiplyScalar(3))}(0,M.anima)({positionX:n.position.x,positionY:n.position.y,positionZ:n.position.z,targetX:i.target.x,targetY:i.target.y,targetZ:i.target.z},{positionX:s.x,positionY:s.y,positionZ:s.z,targetX:o.x,targetY:o.y,targetZ:o.z},.5,(e=>{n.position.set(e.positionX,e.positionY,e.positionZ),n.lookAt(e.targetX,e.targetY,e.targetZ),i.target.set(e.targetX,e.targetY,e.targetZ),i.update()}))}instance(e){this.runScene.assetsEx.scene.updateMatrixWorld();const t={},n=Array.isArray(e)?e:[e],r=[];n.map((e=>{e.traverse((e=>{var n;e.geometry&&!K(e)&&(n=Z(e))&&(r.push(e),t[n]||(t[n]=new Set),t[n].add(e))}))})),(0,i.mapObj)(t,((e,t)=>{e=this.runScene.uniqueEx.model.get(e),t.size<2||!e||(t=F(e,[...t]),this.runScene.modelEx.add(t,void 0,{isClone:!1,select:!1,addUndo:!1}),Q(e)&&this.setGlow(t,!0),this.runScene.modelEx.remove(e,!1))})),r.map((e=>{this.runScene.modelEx.remove(e,!1)}))}reset(){const e=this.runScene.sceneEx.getClearModels();let t=[];e.map((e=>e.traverse((e=>t.push(e))))),t.map((e=>{L(e,{remove:!1}),this.runScene.cb.model.dispose.cb(e)})),this.runScene.modelEx.selectNull(),this.geometryMap.clear()}getHoverFromModels(e,t,n){const{getOriginData:r,ignoreMove:i}=(0,M.mergeObject)({ignoreMove:!1,getOriginData:!1},n);this.runScene.cb.events.pointer.move.add("get-hover-from-models",(n=>{if(i||!this.runScene.events.mouse.isMove){const i=new 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=n.pageX-o;n=n.pageY-s,c.x=o/l*2-1,c.y=-n/u*2+1,i.setFromCamera(c,d);const p=i.intersectObjects(e||[],!0);null!=t&&t(0===p.length?null:r?p:p.map((e=>e.object)))}}))}}const I=e=>{},k=e=>{if(l.includes(e))return e=r().model.getModelByType(e),p.ZP.parseNode(e),e;throw TypeError("")},L=(e,t)=>{t=(t||{}).remove;const{geometry:n,material:r}=e;n&&(null!=n&&n.dispose(),delete e.geometry),r&&((0,f.disposeMaterial)(e.material),e.material.dispose(),delete e.material),!1!==t&&e.parent&&e.parent.remove(e)},F=(e,t)=>{var{material:n,geometry:r}=e;const i=new h.Z.InstancedMesh(r,n,t.length+1);return[e,...t].map(((e,t)=>{e.updateMatrix(),i.setMatrixAt(t,e.matrixWorld)})),i.name=e.name,i},U=(e,t)=>{const n=[];if(t.map((e=>{e=e.geometry,n.push(e)})),t=function(e,t){for(var n,r,i=1<arguments.length&&void 0!==t&&t,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(n in c){var C=s(c[n]);if(!C)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+n+" attribute."),null;p.setAttribute(n,C)}for(r in h){var _=h[r][0].length;if(0===_)break;p.morphAttributes=p.morphAttributes||{},p.morphAttributes[r]=[];for(var E=0;E<_;++E){for(var T=[],D=0;D<h[r].length;++D)T.push(h[r][D][E]);var P=s(T);if(!P)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+r+" morphAttribute."),null;p.morphAttributes[r].push(P)}}return p}(n),t)return new h.Z.Mesh(t,e)},G=e=>0!==e.animations.length,N=e=>{e&&e.userData&&(e.userData.isHelper=!0)},j=e=>null==(e=null==e?void 0:e.userData)?void 0:e.isHelper,H=(e,t)=>{null!=t&&(0===t?e.layers.set(0):e.layers.enable(1),(0,m.M)(e,"layers",t))},z=e=>{const t=[];e.traverse((e=>{t.push(e)}))},V=e=>{let t=!1;if(e)return e.traverse((e=>{e.isSkinnedMesh&&(t=!0)})),t},J=(e,t)=>{t?(0,m.M)(e,"isDynamic",!0):delete e.userData.isDynamic},K=(e,t)=>e&&t?!!e.userData.isDynamic||!!e.parent&&K(e.parent,t):null==(t=null==e?void 0:e.userData)?void 0:t.isDynamic,Z=e=>e.userData.cloneId,W=(e,t)=>{(0,m.M)(e,"cloneId",t)},X=e=>{delete e.userData.cloneId},Q=e=>1===e.userData.layers,Y=e=>e.isSprite,q=e=>{},$=e=>{var t=new a.Vector3;return(new a.Box3).setFromObject(e).getSize(t),t},ee={open(e){delete e.userData.unSelectable},close(e){e.userData.unSelectable=!0},is:e=>void 0===e.userData.unSelectable},te={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)},ne={is:e=>null==(e=null==e?void 0:e.userData)?void 0:e.isHelper,set(e){e.userData.isHelper=!0}},re={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}},ie=(e,t)=>{let n=[];Array.isArray(e)?n.push(...e):n.push(e);const r={};return n.map((e=>e.traverse((e=>{null!=t&&t(e),r[(0,A.K)(e)]=e})))),r},ae={is:e=>!(null==(e=null==e?void 0:e.userData)||!e.isTemp),set(e,t){t?e.userData.isTemp=t:delete e.userData.isTemp}}},738:(e,t,n)=>{n.d(t,{Z:()=>i,s:()=>a});var r=n(881);class i{constructor(e){this.setSize=(e,t)=>{var{width:n,height:r}=this.getDomSize();this.runScene.setSize(e||n,t||r)},this.runScene=e,this.runScene.cb.resize.add("render-ex-resize",(({width:e,height:t})=>{this.setSize(e,t)}))}setBackground(e){this.runScene.assetsEx.engineDom.style.background=e}create(e){let t=new r.WebGLRenderer({antialias:!0,alpha:!0,powerPreference:"high-performance"});return t.domElement.style.position="absolute",t.setPixelRatio(window.devicePixelRatio),t.shadowMap.enabled=!0,t.shadowMap.type=r.PCFSoftShadowMap,t.physicallyCorrectLights=!0,t.localClippingEnabled=!0,e.appendChild(t.domElement),t}getDomSize(){var{clientWidth:e,clientHeight:t}=this.runScene.assetsEx.get().engineDom;return{width:e,height:t}}}const a=(e,t)=>{t=(t||{}).removeDom,!(e.render=()=>{})!==t&&e.domElement.remove(),e.setAnimationLoop(null),e.dispose(),e.renderLists&&e.renderLists.dispose()}},736:(e,t,n)=>{n.d(t,{ZP:()=>y,bv:()=>A,is:()=>S,UE:()=>w,M:()=>b});var r=n(881),i=n(794),a=n(625);class s{constructor(e){this.mount=e=>{e.core.module.set("scene",this)},this.parse={before:e=>{var t,n,r,i,a,{json:e,config:s,core:o}=e;"scene"===e.asset.ex.type&&(({camera:e,lights:t,options:n,controls:r,tags:i,objects:a}=e.asset.ex),this.parse.camera(e,s),this.parse.light(t,s,o),this.parse.controls(r,s),s.module.tags&&this.runScene.tags.parseJSON(i||{}),this.parse.options(n),a&&this.runScene.objects.parseJSON(a))},after:e=>{const{core:t,json:n,data:r,config:i}=e;if("scene"===n.asset.ex.type){var{options:e,json:a}=r;if(e=e.models,!t.loadConfig.module.model)return[];const 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(n,i,t),t.models.push(...e)}},controls:(e,t)=>{var n;t.module.controls||(({x:t,y:e,z:n}=e),this.runScene.assetsEx.controls.target.set(t,e,n),this.runScene.assetsEx.controls.update())},camera:(e,t)=>{if(t.module.camera){let l=e;e.temp&&(l=e.camera,this.runScene.cameraEx.temp=i.Z.formJSON(e.temp));var{position:t,far:e,near:n,fov:r,name:a,userData:s,rotation:o}=this.runScene.loaderer.object.parse(l);const u=this.runScene.assetsEx.get().camera;u.position.copy(t),u.far=e,u.near=n,u.fov=r,u.name=a,u.updateProjectionMatrix(),u.userData.id=s.id,this.runScene.uniqueEx.model.add(u),u.rotation.copy(o),this.runScene.assetsEx.get().controls.update()}},light:(e,t,n)=>{if(t.module.light){const t=[];e.map((e=>{var n=e.type;t.push(...this.runScene.lightEx.lightExMap[n].parseJSON(e))})),n.models.push(...t)}},scene:(e,t,n)=>{if(t.module.sceneConfig){const o=this.runScene.sceneEx.get();t=n.module.get("material").data.materialIns;var{materialId:n,backgroundMapping:e,backgroundColor:i,fog:s}=e.asset.ex.sceneEx;if(n&&(n=null==(t=t[n])?void 0:t.material)){const{map:t,envMap:r}=n;t&&(t.mapping=e||300,t.needsUpdate=!0,this.runScene.sceneEx.setBackground(t,!1),t.userData.isBackgroud=!0),r&&(o.environment=(0,a.setTextureMapping)(r))}if(i&&this.runScene.sceneEx.setBackground(new r.Color("#"+i)),s){const{color:e,far:t,near:n,show:i}=s,a=new r.Fog(e.includes("#")?e:"#"+e,n,t);!1===i?this.runScene.sceneEx.oldFog=a:o.fog=a,a.show=i,this.runScene.cb.setScene.cb({scene:o,type:"fog",val:a})}this.runScene.cb.setScene.cb({scene:o,type:"any",val:"any"})}},options:e=>{e.map((e=>{var{type:e,data:t}=e;const n=this.runScene.exporter.gltf.options.getParse(e);null!=n&&n.parse(t)}))}},this.toJSON=()=>{},this.runScene=e}init(){this.bindEvent()}bindEvent(){var e={name:"sceneConfig",loadCallBacks:new i.Z({beforeParse:this.parse.before,afterParse:this.parse.after,mountModule:this.mount}),exportCallBacks:new i.Z};this.runScene.exporter.gltf.module.bind(e)}}var o=n(1),l=n(932),u=n(529),c=n(738),h=n(735),d=n(510),p=n(169),f=n(453);class m{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:h,env:d}=t,p=this.runScene.assetsEx.get().scene,{animas:m,completedCbs:v}=e.data;let g=p.background;if(h){console.log(h,"bgc");const{type:t,data:n}=h;"color"===t?(0,l.isColor)(g)||null===g?(e=null===g?"#000000":(0,f.J6)(g),null===g&&this.runScene.sceneEx.setBackground(new r.Color("#000000")),e!==h.data&&m.push({target:p,label:"background",type:"color",isUpdate:!0,begin:e,end:n})):(0,a.isTexture)(g)&&v.push((()=>{this.runScene.sceneEx.setBackground(new r.Color(n))})):"texture"===t&&v.push((()=>{this.runScene.sceneEx.setBackground(this.runScene.uniqueEx.texture.get(h.data))}))}else(0,l.isColor)(g)&&(g||(g=new r.Color,this.runScene.sceneEx.setBackground(g)),m.push({target:p,label:"background",type:"color",isUpdate:!0,begin:(0,f.J6)(g),end:"#000000"})),v.push((()=>{this.runScene.sceneEx.setBackground(null)}));var n,i,s,o,u;v.push((()=>{this.runScene.sceneEx.setEnv(this.runScene.uniqueEx.texture.get(null==d?void 0:d.data))})),p.fog&&c?(({color:e,near:n,far:i}=c),({color:u,near:s,far:o}=p.fog),e!==(u=(0,f.J6)(u))&&m.push({target:p,label:["fog","color"],begin:u,end:e,type:"color",isUpdate:!0}),s!==n&&m.push({target:p,label:["fog","near"],begin:s,end:n,type:"number",isUpdate:!0}),o!==i&&m.push({target:p,label:["fog","far"],begin:o,end:i,type:"number",isUpdate:!0})):v.push((()=>{p.fog=c?w(c):null})),v.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;return void 0!==((t=this.runScene.sceneEx.getJson("fog"))&&(e.fog=t),(t=this.runScene.sceneEx.getJson("background"))&&(e.bgc=t),(t=this.runScene.sceneEx.getJson("environment"))&&(e.env=t),t=this.runScene.sceneEx.getEnvStrength())&&1!==t&&(e.envS=t),e}}var v=n(729),g=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.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.runScene=e,this.exportAndImport=new s(e),this.snapshot=new m(e),this.runScene.cb.clean.add("EngineScene",this.clean)}init(){this.exportAndImport.init()}each(e){return this.runScene.assetsEx.get().scene.traverseAncestors(e)}get(){return new Proxy(this.runScene.assetsEx.get().scene,{set:(e,t,n)=>(e[t]=n,!0)})}getNromal(){return this.get().children.filter((e=>!this.runScene.helperEx.isHelper(e)))}getEnvStrength(){var e=Object.values(this.runScene.uniqueEx.material.map)[0];if(e)return e.material.envMapIntensity}remove(e){if(e){if(e instanceof Array){const t=[];return e.map((e=>{for(const n in this.removeMap){const{valid:r,remove:i}=this.removeMap[n];if(r(e))return t.push(...(0,o.multiArrToArr)(i(e)))}t.push(new p.Z({model:e,runScene:this.runScene,parent:e.parent}).execute())})),this.runScene.undoEx.addUndo(t),t}for(const t in this.removeMap){const{valid:n,remove:r}=this.removeMap[t];if(n(e))return r(e)}this.runScene.modelEx.remove(e),this.runScene.helperEx.unfocus()}}cleanUnlessLevel(e){return this.runScene.modelEx.isUnlessLevel(e)&&!this.runScene.helperEx.isHelper(e)&&0!==e.children.length&&1===e.children.length?this.cleanUnlessLevel(e.children[0]):e}searchModel(e){return this.runScene.uniqueEx.model.findModelWithName(e)}getClearModels(){return this.get().children.filter((e=>!this.runScene.helperEx.isHelper(e)&&!this.runScene.lightEx.isLight(e)))}getClear(){const e=this.get(),t=new r.Group;return e.children.filter((e=>!this.runScene.helperEx.isHelper(e)&&!this.runScene.lightEx.isLight(e)&&u.normalModel.is(e))).map((e=>{const n=e.clone();(0,u.withAnima)(e)&&(n.animations=[...e.animations]),t.add(n)})),this.runScene.helperEx.setHelper(t),this.cleanUnlessLevel(t)}cleanNormal(){this.getNromal().map((e=>this.remove(e)))}cleanSceneInfo(e){this.setBackground(null).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,a.isTexture)(e)&&(e.userData.isBackgroud=!0);var n=this.get(),r=new d.Z({target:n,info:"background",newVal:e,oldVal:n.background,runScene:this.runScene,cb:e=>{}}).execute();return t&&this.runScene.undoEx.addUndo(r),this.runScene.cb.setScene.cb({scene:n,type:"background",val:n.background}),e}))}isBackground(e){return e.userData.isBackgroud}dispose(){const{renderer:e,controls:t}=this.runScene.assetsEx.get();this.clean(),(0,c.s)(e),t.dispose(),this.runScene.pp.dispose(),r.Cache.clear()}render(){}create(){return new r.Scene}setEnv(e){return g(this,void 0,void 0,(function*(){var t=this.runScene.assetsEx.scene;let n;return e instanceof String&&(n=yield this.runScene.textureEx.load(e)),e instanceof File&&(n=yield this.runScene.textureEx.parse(e)),n=(n=null!=e&&e.isTexture?this.runScene.textureEx.clone(e):n)&&(0,a.setTextureMapping)(n),this.setNormal({model:t,info:"environment",val:n}),this.runScene.cb.setScene.cb({scene:t,type:"environment",val:n}),n}))}setNormal(e,t=!0){var{model:e,info:n,val:r}=e;e=new d.Z({target:e,info:n,oldVal:e[n],newVal:r,runScene:this.runScene}).execute(),t&&this.runScene.undoEx.addUndo(e)}setRealReflection(){const{scene:e,renderer:t}=this.runScene.assetsEx;this.cubeRT||(this.cubeRT=new r.WebGLCubeRenderTarget(1024)),this.realReflectionCamera||(this.realReflectionCamera=new r.CubeCamera(.1,5e3,this.cubeRT),e.add(this.realReflectionCamera),this.runScene.cb.render.add("RealReflection-update",(()=>{this.realReflectionCamera.update(t,e)}))),console.log(this.isRealReflection,"RealReflection"),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 r.Mesh(new r.SphereGeometry(15,32,16),new r.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:n}=e;if(e){let e=this.oldFog||new r.Fog(n||"#ffffff");e.show=!0,this.setNormal({model:t,info:"fog",val:e})}else this.oldFog=t.fog,this.setNormal({model:t,info:"fog",val:null}),this.oldFog.show=!1;this.runScene.cb.setScene.cb({scene:t,type:"fog",val:t.fog})}setFog(e){var t=this.runScene.assetsEx.scene,{type:e,val:n,cb:r}=e;t=new h.Z({target:t,typeList:["fog",e],newVal:n,cb:r}).execute(),this.runScene.undoEx.addUndo(t)}sreenShotDefFile(e,t){e=e||Number(prompt("请输入截图的宽"))||1920,t=t||Number(prompt("请输入截图的高"))||1080;var{width:n,height:r}=(this.runScene.helperEx.unfocus(),this.runScene.renderEx.getDomSize());const i=this.runScene.assetsEx.get().renderer.domElement;return this.runScene.pp.setSize(e,t),this.runScene.renderEx.setSize(e,t),this.runScene.pp.update(),e=i.toDataURL("image/png",1),t=(0,o.base64ToFile)(e,"screenShot.png"),this.runScene.pp.setSize(n,r),this.runScene.renderEx.setSize(),this.runScene.pp.update(),t}getJson(e){let t;var n=this.runScene.assetsEx.scene;if("fog"===e){var r=n.fog;r&&(t=x(r,null!==n.fog))}else if("background"===e){if(!n.background)return;t={type:(r=(0,l.isColor)(n.background))?"color":"texture",data:(r?f.J6:v.K)(n.background)}}else if("environment"===e){if(!n.environment)return;t={type:"texture",data:(0,v.K)(n.environment)}}return t}static toJSON(e,t){const n={};let r=!1,i=e.fog;return i?r=!0:i=t.sceneEx.oldFog,i&&(n.fog=x(i,r)),(0,l.isColor)(e.background)&&(n.backgroundColor=e.background.getHexString()),n}setEnvStrength(e){this.runScene.uniqueEx.material.each((t=>{void 0!==t.envMapIntensity&&(t.envMapIntensity=e,(0,l.updateMaterial)(t))}))}}const b=(e,t,n)=>{e.userData[t]=n},x=(e,t)=>{var{color:e,far:n,near:r}=e;return{color:(0,f.J6)(e),show:t,far:n,near:r}},w=e=>{var{color:e,far:t,near:n}=e;return new r.Fog(e,n,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,n)=>{n.d(t,{LV:()=>f,ZP:()=>p});var r=n(1),i=n(263),a=n(794),s=n(201),o=n(932),l=n(625),u=n(729),c=n(457),h=n(453);const d=["number","color","v2","v3"];class p{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 n,r,i,a,s,o=e.label instanceof Array?e.label.join("."):e.label;const l={begin:[],end:[]};return"color"===e.type?(i=(0,h.e9)(e.begin),n=(0,h.e9)(e.end),a=o+"_"+t+"_r",s=o+"_"+t+"_g",r=o+"_"+t+"_b",l.begin.push({type:a,data:i.r}),l.begin.push({type:s,data:i.g}),l.begin.push({type:r,data:i.b}),l.end.push({type:a,data:n.r}),l.end.push({type:s,data:n.g}),l.end.push({type:r,data:n.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:n,type:r}=e;return e=e.label instanceof Array?e.label.join("."):e.label,"v2"===r||"v3"===r?(t.push(e+"_"+n+"_x"),t.push(e+"_"+n+"_y"),t.push(e+"_"+n+"_z")):"color"===r?(t.push(e+"_"+n+"_r"),t.push(e+"_"+n+"_g"),t.push(e+"_"+n+"_b")):"number"===r&&t.push(e+"_"+n),t},update:(e,t)=>{var n;const i=this.trans.getKey(e);let a=e.target,s=e.label,o=(e.label instanceof Array&&(s=(0,r.lastArrayEle)(e.label),a=(0,r.objLastMap)(e.target,e.label)),t[i[0]]),l=s;"color"===e.type?(o={r:0,g:0,b:0},i.map((e=>{var[,,n]=e.split("_");e=t[e]/255,o[n]=e}))):"v2"!==e.type&&"v3"!==e.type||(o={x:0,y:0,z:0},i.map((e=>{var[,,n]=e.split("_");o[n]=t[e]}))),null!=(n=e.onUpdate)&&n.call(e,{target:a,data:o,type:l,runScene:this.runScene})},exec:(e,t)=>{const n=this.trans.getKey(e);let i=e.target,a=e.label;e.label instanceof Array&&(a=(0,r.lastArrayEle)(e.label),i=(0,r.objLastMap)(e.target,e.label)),"color"===e.type?n.map((e=>{var[,,n]=e.split("_");e=t[e]/255,i[a][n]=e})):"number"===e.type?i[a]=t[n[0]]:"v2"!==e.type&&"v3"!==e.type||n.map((e=>{var[,,n]=e.split("_");i[a][n]=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){if(e=this.map.get(e)){const t={animas:[],completedCbs:[]};this.runScene.cb.snapshot.set.cb({snapshot:e,data:t}),0===t.animas.length?0!==t.completedCbs.length&&t.completedCbs.map((e=>e())):this.anima(t,e)}}anima(e,t){this.runScene.modelEx.selectNull(),this.playing.animaIns&&(this.playing.animaIns.kill(),this.playing.data.completedCbs=[]);const n=new a.Z,i={},s={};t=t.time,this.playing.data=e,this.playing.data.animas.map(((e,t)=>{t=String(t);const{begin:r,end:a}=this.trans.set(e,t);r.map((e=>i[e.type]=e.data)),a.map((e=>s[e.type]=e.data)),n.set(t,Object.assign({unique:t},e))})),this.playing.animaIns=(0,c.anima)(i,s,t,(e=>{(0,r.mapObj)(e,(t=>{var[,t]=t.split("_");(t=n.get(t))&&(t.isUpdate?this.trans.exec(t,e):this.trans.update(t,e))}))}),(()=>{this.playing.data.completedCbs.map((e=>e()))}))}parseNromal(e,t){const{animas:n,completedCbs:i}=t.data,{target:a,type:s,begin:o,end:l,label:u,onUpdate:h}=e;if((0,c.isDef)(o,l))if(d.includes(s))n.push({target:a,type:s,begin:o,end:l,label:u,isUpdate:void 0===h,onUpdate:h});else{let e=a,t=u;u instanceof Array&&(e=(0,r.objLastMap)(a,u),t=(0,r.lastArrayEle)(u)),"texture"===s?e[t]=l:i.push((()=>{e[t]=l}))}}bind(e){const{name:t,def:n,target:r,create:i,set:a}=e;this.runScene.cb.snapshot.create.add(t,i||(e=>{e.data.set("glow",f.getDiff(n,r))})),this.runScene.cb.snapshot.set.add(t,a||(e=>{var i=e.snapshot.data.get(t);i&&f.set({def:n,runScene:this.runScene,data:i,target:r,map:e})}))}}const f={toNormal(e){var t,{type:e,val:n}=e;let r=n;return"color"===e?(0,o.isColor)(n)&&(r=(0,h.J6)(n)):"texture"===e?(0,l.isTexture)(n)&&(r=(0,u.K)(n)):"v3"!==e&&"v2"!==e||(({x:e,y:n,z:t}=n),r={x:e,y:n,z:t}),r},parse(e){const{type:t,val:n,runScene:a}=e;let s=n;return"color"===t&&i.YD.is(n)&&(s=(0,r.rgbToHex)((0,h.$W)(n))),"texture"===t&&null!==n?a.uniqueEx.texture.get(n):s},getDiff(e,t){let n={};return(0,r.mapObj)(e,((e,i)=>{var a=i.label;let s=t[e];a&&(s=(0,r.objLastMap)(t,a)[(0,r.lastArrayEle)(a)],console.log(i,s,"v,tV")),n[e]=s})),(0,s.replaceKVForObj)((0,c.getDiff)((0,s.replaceValForObj)(e,((e,t)=>t.val)),n),((t,n)=>{var{shortKey:t,type:r}=e[t];return{k:t,v:f.toNormal({type:r,val:n})}}))},set(e){const{def:t,data:n,target:i,runScene:a,map:s}=e;(0,r.mapObj)(t,((e,t)=>{const{type:o,val:l,shortKey:u,before:c,label:h,onUpdate:d}=t;let p=i,m=e;h&&(p=(0,r.objLastMap)(i,h),m=(0,r.lastArrayEle)(h)),t=f.toNormal({type:o,val:p[m]}),e=f.parse({type:o,val:void 0!==n[u]?n[u]:l,runScene:a}),null!=c&&c({target:p,begin:t,end:e}),a.snapshot.parseNromal({target:p,label:m,type:o,begin:t,end:e,onUpdate:d},s)}))}}},625:(e,t,n)=>{n.r(t),n.d(t,{bindTextureBaseData:()=>A,default:()=>y,disposeTexture:()=>S,getBlobByTexture:()=>M,getCloneIdFromTexture:()=>R,getMimeByTexture:()=>x,getSizeByTexture:()=>D,getTextureGpuMemory:()=>w,getTextureMinFilter:()=>F,getUrlByTexture:()=>E,initTexture:()=>B,isClonedTexture:()=>O,isTexture:()=>P,loadTexture:()=>_,parseImageBitMapByBlob:()=>C,setTextureCloneId:()=>I,setTextureMapping:()=>T,setTextureMinFilter:()=>L,textureNameMap:()=>b,updateTexture:()=>k});var r=n(1),i=n(881),a=n(247),s=n(24),o=n(457),l=n(729),u=n(510);class c extends n(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=n(932),p=n(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 n=(0,l.K)(t);n&&(e[n]=p.LV.getDiff(f,t),(t=this.runScene.script.texture.get(t))&&(e[n].uvScript=Object.assign({},t)))})),console.log(e,"map"),e},this.create=e=>{e.data.set("texture",this.getDiff())},this.set=e=>{var t=e.snapshot.data.get("texture");t&&(0,r.mapObj)(t,((t,n)=>{(t=this.runScene.uniqueEx.texture.get(t))&&(p.LV.set({def:f,data:n,runScene:this.runScene,map:e,target:t}),n.uvScript&&(this.runScene.script.texture.parse(n.uvScript,t),this.runScene.script.texture.set(n.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=n(736),g=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}))};class y{constructor(e){this.allTextures=new Set,this.setAnima=e=>{const{texture:t,type:n,val:r}=e,i=t.userData.uvScript||{};t.userData.uvScript||(t.userData.uvScript=i),0===r?delete i[n]:i[n]=r,this.runScene.cb.texture.setAnima.cb({texture:t,uvScript:i})},this.runScene=e,this.snapshot=new m(e)}load(e,t){return g(this,void 0,void 0,(function*(){var n=yield(0,o.urlToBlob)(e);return this.parse(n,t)}))}parse(e,t){return g(this,void 0,void 0,(function*(){t=(0,o.mergeObject)({flipY:!0},t);var n="Blob"===(0,o.getType)(e)?e:yield(0,o.fileToBlob)(e);return this.afterLoad(yield _(n,t),n)}))}clone(e){const t=new i.Texture(e.image);return t.userData=Object.assign(Object.assign({},e.userData),{id:(0,r.getId)(),cloneSourceId:(0,l.K)(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 r in this.runScene.uniqueEx.texture.map){var n=this.runScene.uniqueEx.texture.get(r);if(n.userData.md5===e&&n.mapping===t.mapping)return n}}initTextureAndAddtoAll(e){return 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 n;n=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,r.mapObj)(i,((r,i)=>{const a=this.runScene.uniqueEx.material.get(r);a&&i.forEach((r=>{t.push(new s.Z({target:a,info:r,newVal:n,oldVal:e,runScene:this.runScene}).execute())}))})),this.runScene.undoEx.addUndo(t)}}))}remove(e){const t=(0,l.K)(e);var n=this.runScene.uniqueEx.texture.map[t];if(n){const i=[];n=n.materialMap,(0,r.mapObj)(n,((e,t)=>{const n=this.runScene.uniqueEx.material.get(e);n&&(t.forEach((e=>{i.push(new u.Z({target:n,info:e,oldVal:n[e],newVal:null,runScene:this.runScene,cb(){(0,d.updateMaterial)(n)}}).execute())})),(0,d.updateMaterial)(n))}));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:()=>{this.runScene.uniqueEx.texture.map[t]=null}}).execute()),this.runScene.undoEx.addUndo(i)}}delete(e){this.runScene.cb.texture.remove.cb(e),this.runScene.uniqueEx.texture.remove(e),S(e)}reverseImageBitMapTexture(e){return g(this,void 0,void 0,(function*(){var{canvas:t,imageBitMap:n}=yield(0,o.reverseImageBitMap)(e.image);const a=new i.Texture(n);return a.needsUpdate=!0,n=this.runScene.uniqueEx.texture.map[e.userData.id],(0,r.mapObj)(n.materialMap,((e,t)=>{const n=this.runScene.uniqueEx.material.get(e);t.forEach((e=>{n[e]=a,this.runScene.uniqueEx.texture.addMaterial(a,{material:n,type:e})}))})),B(a),yield A(a),this.runScene.cb.texture.add.cb(a),this.delete(e),(0,o.disposeCanvas)(t),a}))}}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,n;e&&(t=e.image,n=e.userData.url,t instanceof ImageBitmap?(0,o.disposeImageBitMap)(t):t instanceof HTMLCanvasElement&&(0,o.disposeCanvas)(t),URL.revokeObjectURL(n),e.dispose())},A=(e,t)=>g(void 0,void 0,void 0,(function*(){var n=(0,o.isBlob)(e.userData.blob)?e.userData.blob:null;const r=t||n||(yield M(e));e.userData.blob=r;var{md5:n,url:i}=e.userData;return n||(e.userData.md5=(0,o.getMd5)(yield r.arrayBuffer())),i||(e.userData.url=URL.createObjectURL(r)),e.userData.gm=w(e),e.format=e.userData.format||-1!==r.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 n={resizeQuality:"pixelated"};return null!=t&&t.flipY&&(n.imageOrientation="flipY"),createImageBitmap(e,n)},_=(e,t)=>g(void 0,void 0,void 0,(function*(){var n=yield C(e instanceof Blob?e:yield(0,o.urlToBlob)(e),t);return new i.Texture(n)})),E=e=>null==(e=e.userData)?void 0:e.url,T=(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")},651:(e,t,n)=>{n.d(t,{ZP:()=>r,d9:()=>i});class r{constructor(e){this.undos=[],this.redos=[],this.dataMap={history:[],index:0},this.clean=()=>{this.reset()},this.runScene=e,this.runScene.cb.clean.add("Undo",this.clean)}undo(){if(0!==this.undos.length){const e=this.removeUndos(-1)[0];e&&(e instanceof Array?e.reverse().map((e=>e.undo())):e.undo(),this.redos.push(e))}}addUndos(e){var t;return this.undos.push(e),t=this.dataMap.history.push(e),this.dataMap.index=this.undos.length-1,this.runScene.cb.undo.addUndos.cb({undoVal:e,undos:this.undos}),t}removeUndos(e){var t;return this.undos.splice(e),t=this.dataMap.history.splice(e),this.dataMap.index=this.undos.length-1,this.runScene.cb.undo.removeUndos.cb({index:e}),t}undoByIndex(e){e>this.dataMap.index?this.undos.slice(this.dataMap.index+1,e+1).map((e=>{e instanceof Array?e.map((e=>e.redo())):e.redo()})):e<this.dataMap.index&&this.undos.slice(e+1,this.dataMap.index+1).reverse().map((e=>{e instanceof Array?e.map((e=>e.undo())):e.undo()})),this.dataMap.index=e,this.runScene.cb.undo.undoByIndex.cb(e)}addUndo(e){this.dataMap.index!==this.undos.length&&this.removeUndos(this.dataMap.index+1),this.addUndos(e)}addRedo(e){this.redos.push(e)}redo(){if(0!==this.redos.length){const e=this.redos.splice(-1)[0];e&&(e instanceof Array?e.reverse().map((e=>e.redo())):e.redo(),this.addUndo(e))}}reset(){this.undos=[],this.redos=[],this.dataMap.history=[],this.dataMap.index=0,this.runScene.cb.undo.reset.cb("")}}var i=function(e){if("object"!=typeof e)return e;if(null===e)return null;if(e){var t,n,r=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(n=i(e[t]),r[t]=n);return r}}},773:(e,t,n)=>{n.d(t,{Z:()=>i});var r=n(269);class i{constructor(e){this.addTree=!0,this.isClone=!1,this.cb=(e,t)=>{};var{model:e,parent:t,cb:n,addTree:r,isClone:i,runScene:a}=e;this.runScene=a,this.model=e,this.parent=t,!1===r&&(this.addTree=r),!0===i&&(this.isClone=i),n&&(this.cb=n)}remove(e){const{model:t,parent:n,addTree:r,runScene:i}=e;i.modelEx.select===t&&i.modelEx.selectNull(),n.remove(t),r&&i.uniqueEx.model.remove(t),r&&i.cb.model.remove.cb({model:t,parent:n}),this.cb(t,"remove"),i.uniqueEx.material.addModel(t,void 0,t.material)}add(e){const{model:t,parent:n,addTree:i,isClone:a,runScene:s}=e;n.add(t),i&&s.uniqueEx.model.add(t),i&&s.cb.model.add.cb({model:t,parent:n,isClone:a}),this.cb(t,"add"),s.uniqueEx.material.addModel(t,t.material),(0,r.RQ)(t)&&setTimeout((()=>{this.runScene.lightEx.update(t)}))}}},616:(e,t,n)=>{n.d(t,{Z:()=>r});class r{}},24:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(330);class i extends n(616).Z{constructor(e){super(),this.isUndoMaterial=!0,this.type="修改材质";var{target:e,info:t,newVal:n,oldVal:r,runScene:i,cb:a}=e;this.runScene=i,this.target=e,this.info=t,this.newVal=n,this.oldVal=r,this.cb=a}_execute(e,t){if(this.target[this.info]=e,this.target.needsUpdate=!0,r.zX.includes(this.info)){if(!e)return;this.runScene.uniqueEx.texture.addMaterial(e,{material:this.target,type:this.info})}"depthWrite"===this.info&&!0===e&&delete this.target.userData[this.info],null!=(e=this.cb)&&e.call(this,this)}execute(){return this.redo(),this}undo(){this._execute(this.oldVal,this.newVal)}redo(){this._execute(this.newVal,this.oldVal)}}const a=i},735:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(1);class i extends n(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,r.objLastMap)(e.target,this.typeList)[(0,r.lastArrayEle)(e.typeList)]}execute(){return this.redo(),this}_execute(e){const t=(0,r.objLastMap)(this.target,this.typeList);t[(0,r.lastArrayEle)(this.typeList)]=e,this.cb&&this.cb(t),"shadow"!==this.typeList[0]&&this.typeList[1]}undo(){this._execute(this.old)}redo(){this._execute(this.new)}}const a=i},510:(e,t,n)=>{n.d(t,{Z:()=>i});class r extends n(616).Z{constructor(e){super(),this.type="修改属性",this.isUndoNormal=!0,this.cb=e=>{};var{target:e,info:t,oldVal:n,newVal:r,runScene:i,cb:a,executeCb:s}=e;this.runScene=i,this.target=e,this.info=t,this.newVal=r,this.oldVal=n,a&&(this.cb=a),s&&(this.executeCb=s)}_execute(e){var{target:t,info:n}=this;if(this.executeCb)return this.executeCb({target:t,info:n,val:e});this.target[this.info]=e,"name"===this.info&&this.target.isObject3D?(t=this.runScene.uniqueEx.model.parseName(this.target),n=e,this.runScene.cb.model.changeName.cb({model:this.target,name:e=t||e,oldName:n})):"material"===this.info?this.runScene.uniqueEx.material.addModel(this.target,e,e===this.newVal?this.oldVal:this.newVal):"visible"===this.info&&this.runScene.cb.model.setVisible.cb({model:this.target,visible:e}),this.runScene.cb.model.change.cb({type:this.info,model:this.target,val:e}),this.cb(this.target)}execute(){return this.redo(),this}undo(){this._execute(this.oldVal)}redo(){this._execute(this.newVal)}}const i=r},169:(e,t,n)=>{n.d(t,{Z:()=>r});class r extends n(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,n)=>{n.d(t,{Z:()=>i});class r extends n(616).Z{constructor(e){super(),this.isUndoV3=!0,this.type="三维矩阵修改";var{target:e,info:t,newV3:n,oldV3:r,runScene:i}=e;this.target=e,this.info=t,this.runScene=i,this.newV3=n,this.oldV3=r,this.target.uuid===(null==(e=this.runScene.modelEx.select)?void 0:e.uuid)&&(this.runScene.cb.model.setSelect.cb(null),this.runScene.cb.model.setSelect.cb(this.target))}_execute(e){this.target[this.info].copy(e),this.target.uuid===(null==(e=this.runScene.modelEx.select)?void 0:e.uuid)&&this.runScene.helperEx.focus(this.target)}execute(e=!0){return e&&this.redo(),this}undo(){this._execute(this.oldV3)}redo(){this._execute(this.newV3)}}const i=r},729:(e,t,n)=>{n.d(t,{Z:()=>d,K:()=>p});var r=n(1),i=n(272),a=n(932);class s{constructor(e){this.map={},this.removes=[],this.unique=e}add(e,t,n){if(null!=e&&e.userData&&!a.materialIgnore.is(e)){let a=e.userData.id;if(a||(a=(0,r.getId)(),e.userData.id=a),this.map[a]){if(this.map[a].material.name!==e.name){const t=(0,r.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,n)}}addModel(e,t,n){n&&t&&p(n)===p(t)||(null!=t&&t.userData&&(t=p(t),null!=(t=this.map[t])&&t.models.add(e)),n&&null!=(t=this.map[p(n)])&&t.models.delete(e))}each(e){return this.getAll("values").map((({material:t})=>e(t)))}getAll(e){return Object[e](this.map)}get(e){return null==(e=this.map[e])?void 0:e.material}getModels(e){return null==(e=this.map[e])?void 0:e.models}remove(e){delete this.map[e]}addRemoved(e){this.map[e.uuid]&&this.removes.push(e.uuid)}dispose(){(0,r.mapObj)(this.map,((e,t)=>{t.material.dispose()})),this.map={}}}var o=n(269),l=n(529),u=n(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,r.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),r.type.isNumber(e)?Number.parseInt(e):-1)},t=(n,r)=>{var i=(t=>{if(-1===e(t))return t;var n=t.lastIndexOf("_");return-1===n?t:t.slice(0,n)})(n)+"_"+r++;return this.nameMap[i]?t(n,r):i},n=e=>Object.keys(this.nameMap).find((t=>this.nameMap[t]===e)),i=["PerspectiveCamera"];return r=>{if(i.includes(r.type))return r.name=r.type;let a=r.name;if(a=a||r.type,!this.nameMap[a])return s=this.unique.getId(r),(o=n(s))&&delete this.nameMap[o],void(this.nameMap[a]=s);var s,o=this.nameMap[a];return this.unique.model.get(o)!==r?(s=e(a),s=t(a,o=-1===s?0:s),this.nameMap[s]=this.unique.getId(r),r.name=s):void 0}})()}add(e,t){var{reset:n,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&&!n||(a=(0,r.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,r.getId)(),e.userData.id=a}return this.map[a]=e,this.parseName(e),e.material&&this.unique.material.add(e.material,e),!e.children.length||(0,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 n=t.toLowerCase();return n===(t=e.toLowerCase())||-1!==n.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,r.getId)(),e.userData.id=t),this.map[t]?void 0:(this.map[t]={texture:e,materialMap:{}},t)}}getLength(){return Object.keys(this.map).length}addMaterial(e,t,n){var r;e=e.userData.id||this.add(e),t&&(({material:t,type:r}=t),this.map[e].materialMap[t.userData.id]||(this.map[e].materialMap[t.userData.id]=new Set),this.map[e].materialMap[t.userData.id].add(r)),n&&(({material:t,type:r}=n),this.map[e].materialMap[t.userData.id]&&this.map[e].materialMap[t.userData.id].delete(r))}get(e){return null==(e=this.map[e])?void 0:e.texture}getMaterials(e){return null==(e=this.map[e])?void 0:e.materialMap}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));var t=this.map[e.userData.id];t&&((0,r.mapObj)(t.materialMap,((e,t)=>{const n=this.unique.runScene.uniqueEx.material.get(e);n&&t.forEach((e=>{n[e]=null}))})),delete this.map[e.userData.id])}dispose(){(0,r.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)||""},457:(e,t,n)=>{n.r(t),n.d(t,{HextoRgb:()=>i.I8,LimitCb:()=>i.cM,addElesFromIndexToArr:()=>i.Rn,angleToNum:()=>a.Zv,anima:()=>i.gY,arrayBufferToBase64:()=>i.sM,arrayBufferToBlobUr:()=>i.oo,arrayToVector3:()=>a.F,base64ToArrayBuffer:()=>i.RG,base64ToBlob:()=>i.Jr,bitMapToCanvas:()=>r.Rd,blobToFile:()=>i.hl,bufferToArrayBuffer:()=>i.cO,canvasToBlob:()=>i._c,changeModelOpc:()=>a.Hg,changeModelOpcs:()=>a.Z7,clone:()=>i.d9,compressImgToUrl:()=>r.jH,deepMergeObject:()=>i.U,disposeCanvas:()=>r.eZ,disposeImageBitMap:()=>r.oZ,domTo2Dui:()=>a.UZ,domTo3DSprite:()=>a.YG,domTo3Dui:()=>a.ol,fileAndBlobToCanvas:()=>i.OE,fileToBlob:()=>i.a_,filterFiles:()=>i.Rz,fromCode:()=>i.Ne,getArrIndexByItem:()=>i.B1,getBetweenByV3:()=>a.A2,getBetweenDomByIdx:()=>l,getCamAnimaData:()=>a.Gm,getClock:()=>a.aM,getColorByHex:()=>a.e9,getCurve:()=>a.kG,getDiff:()=>i.ad,getDistance:()=>a.Sp,getEmptyImageData:()=>r.mH,getFilesByDataTransfer:()=>i.xl,getFilesFromFileList:()=>i.kk,getHexByColor:()=>a.J6,getIdxInParent:()=>o,getImg:()=>r.Pk,getImgPixels:()=>r.BW,getImgPixels1:()=>r.Cm,getLine2:()=>a.SI,getMacro:()=>i.Ls,getMapByRgb:()=>i.fh,getMd5:()=>i.ZM,getModelMap:()=>a.yT,getNamesByNum:()=>i.nR,getOptions:()=>s.FW,getProgress:()=>i.xC,getRGBByHex:()=>a.OR,getRandomColor:()=>i.mr,getRes:()=>i.sR,getResultFromCanvas:()=>r.xK,getTime:()=>i.hK,getTruthBase64:()=>i.Mh,getType:()=>i.oL,getTypeByBase64:()=>i.Op,getTypeFromGlb:()=>s.te,getVideoTexture:()=>a.hX,getWorldLocal:()=>a.VU,hslToRgb:()=>r.ve,imgArrayBufferToBlobUrl:()=>r.lU,imgBitMapToBase64:()=>r.s4,imgBitMapToBlob:()=>r.gW,imgBitMapToBlobAndBase64:()=>r.v1,isBlob:()=>i.Lj,isDef:()=>i.Xq,isEditor:()=>s.hz,isEmpty:()=>i.xb,isRunning:()=>s.An,longestCommonPrefix:()=>i.GG,mergeObject:()=>i.Gm,removeUnLess:()=>a.hs,reverseImageBitMap:()=>r.Fs,reverseImg:()=>r.rx,rgbToHsl:()=>r.lC,rgbToStr:()=>a.$W,rmArrEle:()=>i.J9,rmPartOfString:()=>i.h3,sameArr:()=>i.F1,sameV3:()=>a.x$,strToNum:()=>i.LC,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 r=n(137),i=n(723),a=n(453),s=n(158);const o=e=>[...e.parentElement.children].findIndex((t=>t===e)),l=e=>{var{dom:e,beginIdx:t,endIdx:n}=e;return[...e.children].slice(t,n+1)};var u=n(881);const c=(e,t,n)=>{const{}=n||{},r={},a={};e.map(((e,t)=>{const{begin:n,end:s,type:o,label:l}=e,c="_"+o+"_"+l+"_"+String(t);if("color"===o&&n instanceof u.Color&&s instanceof u.Color){const e=(0,i.I8)("#"+n.getHexString(),!0),t=(0,i.I8)("#"+s.getHexString(),!0);["r","g","b"].map((n=>{var i=n+c;r[i]=e[n],a[i]=t[n]}))}"number"===o&&(r[e=l+c]=n,a[e]=s),"vector3"===o&&["x","y","z"].map((e=>{var t=e+c;r[t]=n[e],a[t]=s[e]})),"vector2"===o&&["x","y"].map((e=>{var t=e+c;r[t]=n[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,n)=>{n.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 r=n(247),i=n(625),a=n(723),s=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.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"),n=(t.width=e.width,t.height=e.height,t.getContext("2d"));n.translate(0,t.height),n.scale(1,-1),n.drawImage(e,0,0,t.width,t.height)},c=e=>s(void 0,void 0,void 0,(function*(){var t=e.image;const n=document.createElement("canvas"),r=(n.width=t.width,n.height=t.height,n.getContext("2d")),a=(0,i.getMimeByTexture)(e);return r.drawImage(t,0,0,n.width,n.height),new Promise((e=>{n.toBlob((t=>{e({blob:t,base64:n.toDataURL(a)})}),a)}))})),h=(e,t)=>URL.createObjectURL(new Blob([e],t)),d=(e,t)=>{const n=document.createElement("canvas"),r=n.getContext("2d");return n.width=e.width,n.height=e.height,r.drawImage(e,0,0,e.width,e.height),new Promise((e=>{n.toBlob((t=>{t&&e(URL.createObjectURL(t))}),"image/webp",t)}))},p=e=>s(void 0,void 0,void 0,(function*(){var{bitmap:t,texture:n}=e;const{ctx:i,canvas:s}=yield(0,a.OE)(URL.createObjectURL(n.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 r.Z.Texture(s)})),f=e=>{for(var t=(e=e.bitmap).width,n=e.height,r=m(e).ctx.getImageData(0,0,t,n).data,i=[],a=0;a<r/4;a+=1)i.push(r.slice(4*a,4*(a+1)))},m=e=>{const t=document.createElement("canvas"),n=t.getContext("2d");return n.drawImage(e,0,0,e.width,e.height),{ctx:n,canvas:t}},v=(e,t,n)=>{e/=255,t/=255,n/=255;var r,i=Math.max(e,t,n),a=Math.min(e,t,n),s=(i+a)/2;if(i==a)r=l=0;else{var o=i-a,l=.5<s?o/(2-i-a):o/(i+a);switch(i){case e:r=(t-n)/o+(t<n?6:0);break;case t:r=(n-e)/o+2;break;case n:r=(e-t)/o+4}r/=6}return[100*r,100*l,100*s]},g=(e,t,n)=>{var r,i,a,s;return 0==t?i=a=s=n:(i=(r=function(e,t,n){return n<0&&(n+=1),1<n&&--n,n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e})(t=2*n-(n=n<.5?n*(1+t):n+t-n*t),n,e+1/3),a=r(t,n,e),s=r(t,n,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,n)=>{const r=(0,a.Gm)({base64Type:"webp"},n).base64Type;return new Promise(((n,i)=>{"blob"===t?e.toBlob((e=>{(e?n:i)(e)})):"base64"===t&&n(e.toDataURL("image/"+r))}))},x=e=>s(void 0,void 0,void 0,(function*(){var{width:t,height:n}=e;const r=document.createElement("canvas"),i=(r.width=t,r.height=n,r.getContext("2d"));if(i)return i.translate(0,n),i.scale(1,-1),i.drawImage(e,0,0,t,n),{imageBitMap:yield createImageBitmap(i.getImageData(0,0,t,n)),canvas:r}})),w=e=>{e.remove()},S=e=>{e.close()},A=e=>{var{width:e,height:t}=e;const n=document.createElement("canvas");return(n.width=e,n.height=t,n.getContext("2d")).drawImage(new Image,0,0),n}},723:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{B1:()=>getArrIndexByItem,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,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}))};const anima=(e,t,n,r,i)=>{let a=Object.assign({},e),s=new _libs_Anima__WEBPACK_IMPORTED_MODULE_3__.Q3(a,n,t).eventCallback("onUpdate",(e=>r&&r(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 n=t.length;const r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.charCodeAt(e);return r.buffer})),getTruthBase64=e=>e.substring(e.indexOf(",")+1),arrayBufferToBlobUr=e=>URL.createObjectURL(new Blob([e])),arrayBufferToBase64=e=>{let t="";var n=new Uint8Array(e);for(let e=0,r=n.byteLength;e<r;e++)t+=String.fromCharCode(n[e]);return"data:image/jpg;base64,"+window.btoa(t)},urlToBlob=e=>__awaiter(void 0,void 0,void 0,(function*(){return(yield axios__WEBPACK_IMPORTED_MODULE_1___default().get(e,{responseType:"blob"})).data})),base64ToBlob=e=>{let t=e.split(","),n=t[0].match(/:(.*?);/)[1],r=atob(t[1]),i=r.length,a=new Uint8Array(i);for(;i--;)a[i]=r.charCodeAt(i);return new Blob([a],{type:n})},fileToBlob=e=>__awaiter(void 0,void 0,void 0,(function*(){return base64ToBlob(yield(0,js_funcs__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 n=t=e<102.4?e.toFixed(2)+"B":e<1048576?(e/1024).toFixed(2)+"KB":e<1073741824?(e/1048576).toFixed(2)+"M":(e/1073741824).toFixed(2)+"G";return e=n.indexOf("."),"00"==n.substr(e+1,2)?n.substring(0,e)+n.substr(e+3,2):t},getMd5=e=>(0,_allex_md5__WEBPACK_IMPORTED_MODULE_0__.md5)(e),fileAndBlobToCanvas=(e,t)=>{var{width:t,height:n}=t;let r=new Image,i=(r.src=e,r.width=t,r.height=n,document.createElement("canvas")),a=(i.width=t,i.height=n,i.getContext("2d"));return new Promise((e=>{r.onload=function(){a.drawImage(r,0,0,i.width,i.height),e({canvas:i,ctx:a})}}))},getFilesByDataTransfer=e=>new Array(e.files.length).fill(0).map(((t,n)=>e.files.item(n))).filter((e=>null!==e)),canvasToBlob=e=>new Promise((t=>{e.toBlob((e=>{t(e)}))})),getRes=(e,t)=>axios__WEBPACK_IMPORTED_MODULE_1___default().get(e,{responseType:t||"arraybuffer"}).then((e=>e.data)).catch((e=>{console.log(e,"加载出错")})),mergeObject=(e,t)=>Object.assign(e,t||{}),getMacro=(e,t=0)=>{let n=setTimeout((()=>(null!==n&&clearTimeout(n),n=null,e())),t)},clone=e=>{if(null===e)return null;if("object"!=typeof e)return e;var t,n,r=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(n=e[t],r[t]=n);return r},getNamesByNum=(e,t,n=1,r)=>new Array(t).fill("").map(((t,i)=>e+(i+n)+(r||""))),getType=e=>null==e?void 0:e.toString().replace(/(\[object )([a-zA-Z]+)(])/,"$2"),deepMergeObject=(e,t)=>((0,js_funcs__WEBPACK_IMPORTED_MODULE_2__.mapObj)(e,((n,r)=>{let i=t[n];void 0!==i&&("Object"===getType(r)&&"Object"===getType(i)&&(i=deepMergeObject(r,i)),e[n]=i)})),e),getArrIndexByItem=(e,t)=>e.find((e=>e===t)),getProgress=(e,t,n=!1)=>{let r=e/t;return n&&(r*=100),Number(r.toFixed(2))},urlToCanvas=e=>__awaiter(void 0,void 0,void 0,(function*(){if(!e)throw TypeError("该参数为空");var t=yield(0,_UtilsImage__WEBPACK_IMPORTED_MODULE_5__.Pk)(e);const n=document.createElement("canvas"),r=(n.width=t.width,n.height=t.height,n.getContext("2d"));return r.drawImage(t,0,0),{img:t,canvas:n,ctx:r}})),bufferToArrayBuffer=e=>{for(var t=new ArrayBuffer(e.length),n=new Uint8Array(t),r=0;r<e.length;++r)n[r]=e[r];return t},isEmpty=e=>null==e||(Array.isArray(e)||"string"==typeof e?0===e.length:"number"==typeof e?0===e:"object"==typeof e?0===Object.keys(e).length:void 0),isBlob=e=>e&&e instanceof Blob,getTime=e=>{const t=new Date;return t.setTime(t.getTime()+864e5*e),t.getTime()},key="gltf-version-2.0",toCode=e=>{for(var t,n,r=key.length,i=key.split(""),a="",s=0;s<e.length;s++)a+=i[((n=((n=e.charCodeAt(s))-(t=n%r))/r)-(n%=r))/r%r]+i[n]+i[t];return a},fromCode=str=>{for(var st=key.length,b,b1,b2,b3,d=0,s,s=new Array(Math.floor(str.length/3)),b=s.length,i=0;i<b;i++)b1=key.indexOf(str.charAt(d)),d++,b2=key.indexOf(str.charAt(d)),d++,b3=key.indexOf(str.charAt(d)),d++,s[i]=b1*st*st+b2*st+b3;return b=eval("String.fromCharCode("+s.join(",")+")"),b},getFilesFromFileList=e=>{const t=[];for(let r=0;r<e.length;r++){var n=e.item(r);t.push(n)}return t},filterFiles=(e,t)=>"any"===t?e:e.filter((e=>-1!==e.type.indexOf(t))),toTimeString=e=>{if(e)return e.getFullYear()+"/"+(e.getMonth()+1)+"/"+e.getDate()},rmPartOfString=(e,t)=>e.replace(new RegExp(t),""),rmArrEle=(e,t)=>{var n=e.findIndex((e=>e===t));if(-1!==n)return e.splice(n,1),n},addElesFromIndexToArr=(e,t,n)=>(t=Array.isArray(t)?t:[t],e.splice(n,0,...t)),sameArr=(e,t,n)=>{if("fill"===n){for(var[r,i]of e)if(r!==t[i])return!1;return!0}var a=e.length;const s=Math.floor(a/n);for(const r of new Array(n).fill("").map(((e,t)=>(t+1)*s)))if(e[r]!==t[r])return!1;return!0};class LimitCb{constructor(){this.timer=0}update(e){const{cb:t,now:n,cbRate:r}=e;this.timer+=n,this.timer>r&&(t(),this.timer=0)}}const longestCommonPrefix=e=>{if(0==e.length)return"";for(var t=e[0],n="",r=1;r<e.length;r++){for(var i=0;i<=e[r].length;i++){if(t[i]!=e[r][i]){t=n;break}n+=t[i]}n=""}return t},getRandomColor=()=>{let e=[];for(let t=0;t<3;++t){let t=Math.floor(256*Math.random()).toString(16);t=1==t.length?"0"+t:t,e.push(t)}return"#"+e.join("")},validType=(e,t)=>{var n;return"number"===t?(n=Number(e),!isNaN(n)):"array"===t?Array.isArray(e):void 0},isDef=(e,t)=>e instanceof Array?_Ex_Ex__WEBPACK_IMPORTED_MODULE_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 n={r:0,g:0,b:0};for(let e=0;e<rgbArr.length;e++){var r=rgbArr[e],i=t[e];if(!i)return;i=strToNum(i),n[r]=i}return n};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 n="#",r=1;r<4;r+=1)n+=e.slice(r,r+1).concat(e.slice(r,r+1));e=n}var i,a,s=[];for(r=1;r<7;r+=2)s.push(parseInt("0x"+e.slice(r,r+2)));return t?([t,i,a]=s,{r:t,g:i,b:a}):"RGB("+s.join(",")+")"}return e}const getDiff=(e,t,n=0)=>{const r={};return(0,js_funcs__WEBPACK_IMPORTED_MODULE_2__.mapObj)(e,((e,n)=>{var i=t[e];isDef(n,i)&&(r[e]=i)})),r}},158:(e,t,n)=>{n.d(t,{An:()=>a,FW:()=>s,hz:()=>i,te:()=>r});const r=e=>{},i=e=>"editor"===e.optionsEx.options.mode,a=e=>"running"===e.optionsEx.options.mode,s=e=>e.optionsEx.options},453:(e,t,n)=>{n.d(t,{Zv:()=>ce,F:()=>le,Hg:()=>ne,Z7:()=>re,UZ:()=>ee,YG:()=>te,ol:()=>$,A2:()=>pe,Gm:()=>de,aM:()=>fe,e9:()=>me,kG:()=>oe,Sp:()=>q,J6:()=>ve,SI:()=>ue,yT:()=>he,OR:()=>ge,hX:()=>se,VU:()=>Q,hs:()=>ae,$W:()=>be,x$:()=>ye,vp:()=>ie,xr:()=>Y});var r=n(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 n,r=o(e);if(n=t?(n=o(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===i(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var l=new r.Box3,u=new r.Vector3,c=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e);var n=s(i);function i(){var e;if(!(this instanceof i))throw new TypeError("Cannot call a class as a function");return(e=n.call(this)).type="LineSegmentsGeometry",e.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),e.setAttribute("position",new r.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),e.setAttribute("uv",new r.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),e}return t=i,(e=[{key:"applyMatrix4",value:function(e){var t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"setPositions",value:function(e){var t;return e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e)),e=new r.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceStart",new r.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceEnd",new r.InterleavedBufferAttribute(e,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}},{key:"setColors",value:function(e){var t;return e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e)),e=new r.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceColorStart",new r.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceColorEnd",new r.InterleavedBufferAttribute(e,3,3)),this}},{key:"fromWireframeGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromEdgesGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromMesh",value:function(e){return this.fromWireframeGeometry(new r.WireframeGeometry(e.geometry)),this}},{key:"fromLineSegments",value:function(e){if(!(e=e.geometry).isGeometry)return e.isBufferGeometry&&this.setPositions(e.attributes.position.array),this;console.error("THREE.LineSegmentsGeometry no longer supports Geometry. Use THREE.BufferGeometry instead.")}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new r.Box3);var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),l.setFromBufferAttribute(t),this.boundingBox.union(l))}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new r.Sphere),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){for(var n=this.boundingSphere.center,i=(this.boundingBox.getCenter(n),0),a=0,s=e.count;a<s;a++)u.fromBufferAttribute(e,a),i=Math.max(i,n.distanceToSquared(u)),u.fromBufferAttribute(t,a),i=Math.max(i,n.distanceToSquared(u));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}},{key:"toJSON",value:function(){}},{key:"applyMatrix",value:function(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.InstancedBufferGeometry);function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function d(e,t){return(d=Object.setPrototypeOf||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,r.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new r.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},r.ShaderLib.line={uniforms:r.UniformsUtils.merge([r.UniformsLib.common,r.UniformsLib.fog,r.UniformsLib.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// get the offset direction as perpendicular to the view vector\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 offset;\n\t\t\t\tif ( position.y < 0.5 ) {\n\n\t\t\t\t\toffset = normalize( cross( start.xyz, worldDir ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toffset = normalize( cross( end.xyz, worldDir ) );\n\n\t\t\t\t}\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\tfloat forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// extend the line bounds to encompass endcaps\n\t\t\t\t\tstart.xyz += - worldDir * linewidth * 0.5;\n\t\t\t\t\tend.xyz += worldDir * linewidth * 0.5;\n\n\t\t\t\t\t// shift the position of the quad so it hugs the forward edge of the line\n\t\t\t\t\toffset.xy -= dir * forwardOffset;\n\t\t\t\t\toffset.z += 0.5;\n\n\t\t\t\t#endif\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\toffset.xy += dir * 2.0 * forwardOffset;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth * 0.5;\n\n\t\t\t\t// set the world position\n\t\t\t\tworldPos = ( position.y < 0.5 ) ? start : end;\n\t\t\t\tworldPos.xyz += offset;\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"};var m=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=f(e);if(n=t?(n=f(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===h(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return p(r)}}(i);function i(e){var t;if(this instanceof i)return t=n.call(this,{type:"LineMaterial",uniforms:r.UniformsUtils.clone(r.ShaderLib.line.uniforms),vertexShader:r.ShaderLib.line.vertexShader,fragmentShader:r.ShaderLib.line.fragmentShader,clipping:!0}),Object.defineProperties(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}(r.ShaderMaterial);function v(e){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function g(e,t){return(g=Object.setPrototypeOf||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 r.Vector3,M=new r.Vector3,B=new r.Vector4,C=new r.Vector4,_=new r.Vector4,E=new r.Vector3,T=new r.Matrix4,D=new r.Line3,P=new r.Vector3,O=new r.Box3,R=new r.Sphere,I=new r.Vector4;function k(e,t,n){return I.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),I.multiplyScalar(1/I.w),I.x=S/n.width,I.y=S/n.height,I.applyMatrix4(e.projectionMatrixInverse),I.multiplyScalar(1/I.w),Math.abs(Math.max(I.x,I.y))}var L=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&g(t,e);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y(e);if(n=t?(n=y(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===v(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new c,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new m({color:16777215*Math.random()}),r=this,a=i;if(r instanceof a)return(r=n.call(this,e,t)).type="LineSegments2",r;throw new TypeError("Cannot call a class as a function")}return t=i,(e=[{key:"computeLineDistances",value:function(){for(var e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,i=new Float32Array(2*t.count),a=0,s=0,o=t.count;a<o;a++,s+=2)A.fromBufferAttribute(t,a),M.fromBufferAttribute(n,a),i[s]=0===s?0:i[s-1],i[s+1]=i[s]+A.distanceTo(M);var l=new r.InstancedInterleavedBuffer(i,2,1);return e.setAttribute("instanceDistanceStart",new r.InterleavedBufferAttribute(l,1,0)),e.setAttribute("instanceDistanceEnd",new r.InterleavedBufferAttribute(l,1,1)),this}},{key:"raycast",value:function(e,t){var n=this.material.worldUnits,i=e.camera,a=(null!==i||n||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),void 0!==e.params.Line2&&e.params.Line2.threshold||0),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=n?.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=n?.5*S:k(i,Math.max(i.near,O.distanceToPoint(b.origin)),o.resolution),O.expandByScalar(a),!1!==b.intersectsBox(O)))if(n)for(var l=t,u=0,c=x.count;u<c;u++){D.start.fromBufferAttribute(x,u),D.end.fromBufferAttribute(w,u);var h=new r.Vector3,d=new r.Vector3;b.distanceSqToSegment(D.start,D.end,d,h),d.distanceTo(h)<.5*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,_),_.w=1,_.applyMatrix4(s.matrixWorldInverse),_.applyMatrix4(m),_.multiplyScalar(1/_.w),_.x*=v.x/2,_.y*=v.y/2,_.z=0,E.copy(_),T.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(T),C.applyMatrix4(T),B.z>M&&C.z>M||(B.z>M?(I=B.z-C.z,I=(B.z-M)/I,B.lerp(C,I)):C.z>M&&(I=C.z-B.z,L=(C.z-M)/I,C.lerp(B,L)),B.applyMatrix4(m),C.applyMatrix4(m),B.multiplyScalar(1/B.w),C.multiplyScalar(1/C.w),B.x*=v.x/2,B.y*=v.y/2,C.x*=v.x/2,C.y*=v.y/2,D.start.copy(B),D.start.z=0,D.end.copy(C),D.end.z=0,L=D.closestPointToPointParameter(E,!0),D.at(L,P),F=-1<=(F=r.MathUtils.lerp(B.z,C.z,L))&&F<=1,U=E.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 r.Vector3,U=new r.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 n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.Mesh);function F(e){return(F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function U(){return(U="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=N(e)););return e}(e,t);if(r)return(r=Object.getOwnPropertyDescriptor(r,t)).get?r.get.call(arguments.length<3?e:n):r.value}).apply(this,arguments)}function G(e,t){return(G=Object.setPrototypeOf||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=r,t=c;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&G(e,t);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=N(e);if(n=t?(n=N(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===F(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(r);function r(){var e;if(this instanceof r)return(e=n.call(this)).type="LineGeometry",e;throw new TypeError("Cannot call a class as a function")}return e=r,(t=[{key:"setPositions",value:function(e){for(var t=e.length-3,n=new Float32Array(2*t),i=0;i<t;i+=3)n[2*i]=e[i],n[2*i+1]=e[i+1],n[2*i+2]=e[i+2],n[2*i+3]=e[i+3],n[2*i+4]=e[i+4],n[2*i+5]=e[i+5];return U(N(r.prototype),"setPositions",this).call(this,n),this}},{key:"setColors",value:function(e){for(var t=e.length-3,n=new Float32Array(2*t),i=0;i<t;i+=3)n[2*i]=e[i],n[2*i+1]=e[i+1],n[2*i+2]=e[i+2],n[2*i+3]=e[i+3],n[2*i+4]=e[i+4],n[2*i+5]=e[i+5];return U(N(r.prototype),"setColors",this).call(this,n),this}},{key:"fromLine",value:function(e){if(!(e=e.geometry).isGeometry)return e.isBufferGeometry&&this.setPositions(e.attributes.position.array),this;console.error("THREE.LineGeometry no longer supports Geometry. Use THREE.BufferGeometry instead.")}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),r}();function H(e){return(H="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function z(e,t){return(z=Object.setPrototypeOf||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=r,t=L;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&z(e,t);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=V(e);if(n=t?(n=V(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===H(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(r);function r(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new j,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new m({color:16777215*Math.random()}),i=this,a=r;if(i instanceof a)return(i=n.call(this,e,t)).type="Line2",i;throw new TypeError("Cannot call a class as a function")}return e=r,Object.defineProperty(e,"prototype",{writable:!1}),e}(),K=(J.prototype.isLine2=!0,n(699)),Z=n(693),W=n(247),X=n(723);const Q=(e,t)=>(t.updateMatrixWorld(!0),t=new W.Z.Vector3,e.getWorldPosition(t),t),Y={parse(e){var{x:e,y:t,z:n}=e;return void 0===n?new r.Vector2(e,t):new r.Vector3(e,t,n)},toJSON(e){var{x:e,y:t,z:n}=e;return null==n?{x:e,y:t}:{x:e,y:t,z:n}}},q=(e,t)=>e.distanceTo(t),$=e=>new Z.cp(e),ee=e=>new K.j(e),te=e=>new Z.P7(e),ne=(e,t=.5,n=!1)=>{if("Group"===e.type)throw TypeError("该模型为Group类型");if(!e.material)throw TypeError("该模型没有材质");if(void 0===e.material.oldOpc&&(e.material.oldOpc=e.material.opacity,e.material.oldTransparent=e.material.transparent),n)return e.material.opacity=e.material.oldOpc,void(e.material.transparent=e.material.oldTransparent);1===t?(e.material.transparent=!1,e.material.opacity=1):(e.material.transparent=!0,e.material.opacity=t)},re=(e,t,n)=>{"Group"===e.type||"Object3D"===e.type?e.children.forEach((e=>re(e,t,n))):ne(e,t,n)},ie=e=>(e.mapping=r.EquirectangularReflectionMapping,e),ae=e=>{let t=e=>"Group"!==e.type&&"Object3D"!==e.type||1!==e.children.length?e:t(e.children[0]);return t(e)},se=(e,t)=>{let n=document.createElement("video");return n.style="position:absolute;top:0;left:0;z-index:1000000;",n.src=e,n.loop="loop",n.muted="muted",n.play(),t.appendChild(n),new r.VideoTexture(n)},oe=(e,t=!1)=>{let n=new r.CatmullRomCurve3(e),i=new r.BufferGeometry;e=n.getSpacedPoints(100),i.setFromPoints(e),e=new r.LineBasicMaterial({color:26214});let a=new r.Line(i,e);return a.visible=t,{line:a,curve:n}},le=e=>{let t=0;const n=[],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),n.push(new r.Vector3(s,o,l))),i[a[t]]=e,t++})),n},ue=e=>{var{pointArray:e,material:t,lineWidth:n,colorArray:i}=e;const a=new j,s=(a.setPositions(e),t||new m({transparent:!0,side:r.DoubleSide,linewidth:n||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},ce=e=>3.1415926*e/180,he=(e,t="name",n)=>{const r={};return e.traverse((e=>{"id"===t?r[e.userData.id]=e:r[e[t]]=e,null!=n&&n(e)})),r},de=(e,t,n,r,i,a)=>({cx:e,cy:t,cz:n,tx:r,ty:i,tz:a}),pe=(e,t)=>{var{x:e,y:n,z:r}=e,{x:t,y:i,z:a}=t;return{x:e-t,y:n-i,z:r-a}},fe=()=>new W.Z.Clock,me=e=>{var{r:e,g:t,b:n}=(0,X.fh)((0,X.I8)(e.includes("#")?e:"#"+e));return new W.Z.Color(e,t,n)},ve=e=>"#"+e.getHexString(),ge=e=>(0,X.fh)((0,X.I8)(e.includes("#")?e:"#"+e)),ye=(e,t)=>e.x===t.x&&e.y===t.y&&e.z===t.z,be=e=>{const{r:t,g:n,b:r}=e;return"rgb("+[t,n,r].map((e=>255*e)).join(",")+")"}},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__},819:(e,t,n)=>{n.d(t,{T:()=>c,w:()=>o});var r=n(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 n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t,n){t&&a(e.prototype,t),n&&a(e,n),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 r.OrthographicCamera(-1,1,1,-1,0,1),u=new r.BufferGeometry,c=(u.setAttribute("position",new r.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),u.setAttribute("uv",new r.Float32BufferAttribute([0,2,0,0,2,0],2)),function(){function e(t){i(this,e),this._mesh=new r.Mesh(u,t)}return 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,n)=>{n.d(t,{T:()=>u});var r=n(881),i=n(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 n,r=l(e);if(n=t?(n=l(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===a(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf: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 n=o(a);function a(e,t){var s;if(this instanceof a)return(s=n.call(this)).textureID=void 0!==t?t:"tDiffuse",e instanceof r.ShaderMaterial?(s.uniforms=e.uniforms,s.material=e):e&&(s.uniforms=r.UniformsUtils.clone(e.uniforms),s.material=new r.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,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)),this.fsQuad.render(e)}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),a}(i.w)},699:(e,t,n)=>{function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=u(e)););return e}(e,t);if(r)return(r=Object.getOwnPropertyDescriptor(r,t)).get?r.get.call(arguments.length<3?e:n):r.value}).apply(this,arguments)}function l(e,t){return(l=Object.setPrototypeOf||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)}n.d(t,{M:()=>v,j:()=>c});var c=function(e){var t=a;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=u(e);if(n=t?(n=u(this).constructor,Reflect.construct(i,arguments,n)):i.apply(this,arguments),i=this,n&&("object"===r(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==i)return i;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(a);function a(){var e,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return i(this,a),(e=n.call(this)).element=t,e.element.style.position="absolute",e.element.style.userSelect="none",e.element.setAttribute("draggable",!1),e.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),e}return 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=n(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,n,r,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:n}},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,n,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,n,i),s=t.element,/apple/i.test(navigator.vendor)?s.style.transform="translate(-50%,-50%) translate("+Math.round(h.x*r+r)+"px,"+Math.round(-h.y*a+a)+"px)":s.style.transform="translate(-50%,-50%) translate("+(h.x*r+r)+"px,"+(-h.y*a+a)+"px)",s.parentNode!==u&&u.appendChild(s),t.onAfterRender(o,n,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],n,i)}(e,e,t);for(var n=function(e){var t=[];return e.traverse((function(e){e.isCSS2DObject&&t.push(e)})),t}(e).sort((function(e,t){return e.renderOrder!==t.renderOrder?t.renderOrder-e.renderOrder:l.objects.get(e).distanceToCameraSquared-l.objects.get(t).distanceToCameraSquared})),i=n.length,s=0,f=n.length;s<f;s++)n[s].element.style.zIndex=i-s},this.setSize=function(e,i){r=(t=e)/2,a=(n=i)/2,u.style.width=e+"px",u.style.height=i+"px"}}))},693:(e,t,n)=>{n.d(t,{P7:()=>g,cp:()=>v,lX:()=>x});var r=n(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 n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&s(e.prototype,t),n&&s(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(){return(l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(r)return(r=Object.getOwnPropertyDescriptor(r,t)).get?r.get.call(arguments.length<3?e:n):r.value}).apply(this,arguments)}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=d(e);if(n=t?(n=d(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===i(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var p=new r.Vector3,f=new r.Quaternion,m=new r.Vector3,v=function(){u(t,r.Object3D);var e=h(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return a(this,t),(n=e.call(this)).element=r,n.element.style.position="absolute",n.element.style.pointerEvents="auto",n.element.style.userSelect="none",n.element.setAttribute("draggable",!1),n.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),n}return o(t,[{key:"copy",value:function(e,n){return l(d(t.prototype),"copy",this).call(this,e,n),this.element=e.element.cloneNode(!0),this}}]),t}(),g=(v.prototype.isCSS3DObject=!0,function(){u(t,v);var e=h(t);function t(n){return a(this,t),(n=e.call(this,n)).rotation2D=0,n}return o(t,[{key:"copy",value:function(e,n){return l(d(t.prototype),"copy",this).call(this,e,n),this.rotation2D=e.rotation2D,this}}]),t}()),y=(g.prototype.isCSS3DSprite=!0,new r.Matrix4),b=new r.Matrix4,x=o((function e(){var t,n,r,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:n}},this.render=function(e,t){var n=t.projectionMatrix.elements[5]*i,a=(l.camera.fov!==n&&(u.style.perspective=t.isPerspectiveCamera?n+"px":"",l.camera.fov=n),!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),t.isOrthographicCamera&&(a=-(t.right+t.left)/2,s=(t.top+t.bottom)/2),t.isOrthographicCamera?"scale("+n+")translate("+h(a)+"px,"+h(s)+"px)"+d(t.matrixWorldInverse):"translateZ("+n+"px)"+d(t.matrixWorldInverse)),s=a+"translate("+r+"px,"+i+"px)";l.camera.style!==s&&(c.style.transform=s,l.camera.style=s),function e(t,n,r,i){var a,s,u;t.isCSS3DObject&&(a=!0===t.visible&&!0===t.layers.test(r.layers),t.element.style.display=1==a?"":"none",1==a&&(t.onBeforeRender(o,n,r),a=t.isCSS3DSprite?(y.copy(r.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,n,r)));for(var h=0,d=t.children.length;h<d;h++)e(t.children[h],n,r,i)}(e,e,t,a)},this.setSize=function(e,a){r=(t=e)/2,i=(n=a)/2,u.style.width=e+"px",u.style.height=a+"px",c.style.width=e+"px",c.style.height=a+"px"}}))}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];return void 0!==t||(t=__webpack_module_cache__[e]={exports:{}},__webpack_modules__[e](t,t.exports,__webpack_require__)),t.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};return(()=>{__webpack_require__.d(__webpack_exports__,{default:()=>xs});var e={},t=(__webpack_require__.r(e),__webpack_require__.d(e,{AsyncCompress:()=>tr,AsyncDecompress:()=>vr,AsyncDeflate:()=>Zn,AsyncGunzip:()=>ar,AsyncGzip:()=>tr,AsyncInflate:()=>Yn,AsyncUnzipInflate:()=>Gr,AsyncUnzlib:()=>dr,AsyncZipDeflate:()=>kr,AsyncZlib:()=>ur,Compress:()=>er,DecodeUTF8:()=>Sr,Decompress:()=>mr,Deflate:()=>Kn,EncodeUTF8:()=>Ar,Gunzip:()=>ir,Gzip:()=>er,Inflate:()=>Qn,Unzip:()=>Nr,UnzipInflate:()=>Ur,UnzipPassThrough:()=>Fr,Unzlib:()=>hr,Zip:()=>Lr,ZipDeflate:()=>Ir,ZipPassThrough:()=>Rr,Zlib:()=>lr,compress:()=>nr,compressSync:()=>rr,decompress:()=>function(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return(31==e[0]&&139==e[1]&&8==e[2]?sr:8!=(15&e[0])||7<e[0]>>4||(e[0]<<8|e[1])%31?qn:pr)(e,t,n)},decompressSync:()=>function(e,t){return(31==e[0]&&139==e[1]&&8==e[2]?or:8!=(15&e[0])||7<e[0]>>4||(e[0]<<8|e[1])%31?$n:fr)(e,t)},deflate:()=>Wn,deflateSync:()=>Xn,gunzip:()=>sr,gunzipSync:()=>or,gzip:()=>nr,gzipSync:()=>rr,inflate:()=>qn,inflateSync:()=>$n,strFromU8:()=>Br,strToU8:()=>Mr,unzip:()=>function(e,t){if("function"!=typeof t)throw"no callback";for(var n=[],r=function(){for(var e=0;e<n.length;++e)n[e]()},i={},a=e.length-22;101010256!=Fn(e,a);--a)if(!a||65558<e.length-a)return void t("invalid zip file",null);var s=Ln(e,a+8);s||t(null,{});var o=s,l=Fn(e,a+16),u=4294967295==l;if(u){if(a=Fn(e,a-12),101075792!=Fn(e,a))return void t("invalid zip file",null);o=s=Fn(e,a+32),l=Fn(e,a+48)}for(var c=function(a){function o(e,n){e?(r(),t(e,null)):(i[p]=n,--s||t(null,i))}var c=(m=Er(e,l,u))[0],h=m[1],d=m[2],p=m[3],f=m[4],m=m[5];if(m=_r(e,m),l=f,c)if(8==c)if(f=e.subarray(m,m+h),h<32e4)try{o(null,$n(f,new Ot(d)))}catch(a){o(a,null)}else n.push(qn(f,{size:d},o));else o("unknown compression type "+c,null);else o(null,sn(e,m,m+h))},h=0;h<o;++h)c();return r},unzipSync:()=>function(e){for(var t={},n=e.length-22;101010256!=Fn(e,n);--n)if(!n||65558<e.length-n)throw"invalid zip file";var r=Ln(e,n+8);if(!r)return{};var i=Fn(e,n+16),a=4294967295==i;if(a){if(n=Fn(e,n-12),101075792!=Fn(e,n))throw"invalid zip file";r=Fn(e,n+32),i=Fn(e,n+48)}for(var s=0;s<r;++s){var o=(d=Er(e,i,a))[0],l=d[1],u=d[2],c=d[3],h=d[4],d=d[5];if(d=_r(e,d),i=h,o){if(8!=o)throw"unknown compression type "+o;t[c]=$n(e.subarray(d,d+l),new Ot(u))}else t[c]=sn(e,d,d+l)}return t},unzlib:()=>pr,unzlibSync:()=>fr,zip:()=>function(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";function r(){for(var e=0;e<d.length;++e)d[e]()}function i(){for(var e=new Ot(u+22),t=l,r=u-l,i=u=0;i<c;++i){var a=h[i];try{var s=a.c.length,o=(Pr(e,u,a,a.f,a.u,s),30+a.f.length+Dr(a.extra)),d=u+o;e.set(a.c,d),Pr(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 n(e,null)}}Or(e,l,h.length,r,t),n(null,e)}var a={},s=(gr(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?(r(),n(t,null)):(t=a.length,h[e]=An(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=xn(),g=f.length,y=(v.p(f),Mr(c)),b=y.length,x=m.comment,w=x&&Mr(x),S=w&&w.length,A=Dr(m.extra),M=0==m.level?0:8;if(65535<b&&t("filename too long",null),M)if(g<16e4)try{t(null,Xn(f,m))}catch(p){t(p,null)}else d.push(Wn(f,m,t));else t(null,f)},f=0;f<c;++f)p(f);return r},zipSync:()=>function(e,t){var n,r={},i=[],a=(gr(e,"",r,t=t||{}),0),s=0;for(n in r){var o,l=(o=r[n])[0],u=0==(o=o[1]).level?0:8,c=(x=Mr(n)).length,h=o.comment,d=h&&Mr(h),p=d&&d.length,f=Dr(o.extra);if(65535<c)throw"filename too long";var m=u?Xn(l,o):l,v=m.length,g=xn();g.p(l),i.push(An(o,{size:l.length,crc:g.d(),c:m,f:x,m:d,u:c!=n.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 Ot(s+22),b=(e=a,t=s-a,0);b<i.length;++b){var x=i[b],w=(Pr(y,x.o,x,x.f,x.u,x.c.length),30+x.f.length+Dr(x.extra));y.set(x.c,x.o+w),Pr(y,a,x,x.f,x.u,x.c.length,x.o,x.m),a+=16+w+(x.m?x.m.length:0)}return Or(y,a,i.length,t,e),y},zlib:()=>function(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return kn(e,t,[En,Pn,function(){return[cr]}],(function(e){return Rn(cr(e.data[0],e.data[1]))}),4,n)},zlibSync:()=>cr}),{}),n=(__webpack_require__.r(t),__webpack_require__.d(t,{FBXLoader:()=>ii}),__webpack_require__(881));function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t,n){t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1})}function o(){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(r)return(r=Object.getOwnPropertyDescriptor(r,t)).get?r.get.call(arguments.length<3?e:n):r.value}).apply(this,arguments)}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&u(e,t)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=d(e);if(n=t?(n=d(this).constructor,Reflect.construct(i,arguments,n)):i.apply(this,arguments),i=this,n&&("object"===r(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return h(i)}}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var p=new n.Raycaster,f=new n.Vector3,m=new n.Vector3,v=new n.Quaternion,g={X:new n.Vector3(1,0,0),Y:new n.Vector3(0,1,0),Z:new n.Vector3(0,0,1)},y={type:"change"},b={type:"mouseDown"},x={type:"mouseUp",mode:null},w={type:"objectChange"},S=function(){l(t,n.Object3D);var e=c(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.visible=!1,s.domElement=a,s.domElement.style.touchAction="none";var s,o=new U,l=(s._gizmo=o,s.add(o),new G),u=(s._plane=l,s.add(l),h(s));function c(e,t){var n=t;Object.defineProperty(u,e,{get:function(){return void 0!==n?n:t},set:function(t){n!==t&&(n=t,l[e]=t,o[e]=t,u.dispatchEvent({type:e+"-changed",value:t}),u.dispatchEvent(y))}}),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),a=new n.Vector3,r=new n.Vector3;var d=new n.Quaternion,p=new n.Quaternion,f=new n.Vector3,m=new n.Quaternion,v=new n.Vector3,g=new n.Vector3,b=new n.Vector3,x=new n.Vector3;return c("worldPosition",a),c("worldPositionStart",r),c("worldQuaternion",d),c("worldQuaternionStart",p),c("cameraPosition",f),c("cameraQuaternion",m),c("pointStart",v),c("pointEnd",g),c("rotationAxis",b),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(h(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(h(s)),s._onPointerHover=function(e){if(this.enabled)switch(e.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(e))}}.bind(h(s)),s._onPointerMove=function(e){this.enabled&&this.pointerMove(this._getPointer(e))}.bind(h(s)),s._onPointerUp=function(e){this.enabled&&(this.domElement.releasePointerCapture(e.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(e)))}.bind(h(s)),s.domElement.addEventListener("pointerdown",s._onPointerDown),s.domElement.addEventListener("pointermove",s._onPointerHover),s.domElement.addEventListener("pointerup",s._onPointerUp),s}return s(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(),o(d(t.prototype),"updateMatrixWorld",this).call(this,this)}},{key:"pointerHover",value:function(e){void 0!==this.object&&!0!==this.dragging&&(p.setFromCamera(e,this.camera),e=A(this._gizmo.picker[this.mode],p),this.axis=e?e.object.name:null)}},{key:"pointerDown",value:function(e){void 0!==this.object&&!0!==this.dragging&&0===e.button&&null!==this.axis&&(p.setFromCamera(e,this.camera),(e=A(this._plane,p,!0))&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(e.point).sub(this.worldPositionStart)),this.dragging=!0,b.mode=this.mode,this.dispatchEvent(b))}},{key:"pointerMove",value:function(e){var t=this.axis,n=this.mode,r=this.object,i=this.space;"scale"===n?i="local":"E"!==t&&"XYZE"!==t&&"XYZ"!==t||(i="world"),void 0!==r&&null!==t&&!1!==this.dragging&&-1===e.button&&(p.setFromCamera(e,this.camera),(e=A(this._plane,p,!0))&&(this.pointEnd.copy(e.point).sub(this.worldPositionStart),"translate"===n?(this._offset.copy(this.pointEnd).sub(this.pointStart),"local"===i&&"XYZ"!==t&&this._offset.applyQuaternion(this._worldQuaternionInv),-1===t.indexOf("X")&&(this._offset.x=0),-1===t.indexOf("Y")&&(this._offset.y=0),-1===t.indexOf("Z")&&(this._offset.z=0),("local"===i&&"XYZ"!==t?this._offset.applyQuaternion(this._quaternionStart):this._offset.applyQuaternion(this._parentQuaternionInv)).divide(this._parentScale),r.position.copy(this._offset).add(this._positionStart),this.translationSnap&&("local"===i&&(r.position.applyQuaternion(v.copy(this._quaternionStart).invert()),-1!==t.search("X")&&(r.position.x=Math.round(r.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(r.position.y=Math.round(r.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(r.position.z=Math.round(r.position.z/this.translationSnap)*this.translationSnap),r.position.applyQuaternion(this._quaternionStart)),"world"===i&&(r.parent&&r.position.add(f.setFromMatrixPosition(r.parent.matrixWorld)),-1!==t.search("X")&&(r.position.x=Math.round(r.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(r.position.y=Math.round(r.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(r.position.z=Math.round(r.position.z/this.translationSnap)*this.translationSnap),r.parent&&r.position.sub(f.setFromMatrixPosition(r.parent.matrixWorld))))):"scale"===n?(-1!==t.search("XYZ")?(e=this.pointEnd.length()/this.pointStart.length(),this.pointEnd.dot(this.pointStart)<0&&(e*=-1),m.set(e,e,e)):(f.copy(this.pointStart),m.copy(this.pointEnd),f.applyQuaternion(this._worldQuaternionInv),m.applyQuaternion(this._worldQuaternionInv),m.divide(f),-1===t.search("X")&&(m.x=1),-1===t.search("Y")&&(m.y=1),-1===t.search("Z")&&(m.z=1)),r.scale.copy(this._scaleStart).multiply(m),this.scaleSnap&&(-1!==t.search("X")&&(r.scale.x=Math.round(r.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Y")&&(r.scale.y=Math.round(r.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Z")&&(r.scale.z=Math.round(r.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))):"rotate"===n&&(this._offset.copy(this.pointEnd).sub(this.pointStart),e=20/this.worldPosition.distanceTo(f.setFromMatrixPosition(this.camera.matrixWorld)),"E"===t?(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1):"XYZE"===t?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(f.copy(this.rotationAxis).cross(this.eye))*e):"X"!==t&&"Y"!==t&&"Z"!==t||(this.rotationAxis.copy(g[t]),f.copy(g[t]),"local"===i&&f.applyQuaternion(this.worldQuaternion),this.rotationAngle=this._offset.dot(f.cross(this.eye).normalize())*e),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),"local"===i&&"E"!==t&&"XYZE"!==t?(r.quaternion.copy(this._quaternionStart),r.quaternion.multiply(v.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),r.quaternion.copy(v.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),r.quaternion.multiply(this._quaternionStart).normalize())),this.dispatchEvent(y),this.dispatchEvent(w)))}},{key:"pointerUp",value:function(e){0===e.button&&(this.dragging&&null!==this.axis&&(x.mode=this.mode,this.dispatchEvent(x)),this.dragging=!1,this.axis=null)}},{key:"dispose",value:function(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse((function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()}))}},{key:"attach",value:function(e){return this.object=e,this.visible=!0,this}},{key:"detach",value:function(){return this.object=void 0,this.visible=!1,this.axis=null,this}},{key:"reset",value:function(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(y),this.dispatchEvent(w),this.pointStart.copy(this.pointEnd))}},{key:"getRaycaster",value:function(){return p}},{key:"getMode",value:function(){return this.mode}},{key:"setMode",value:function(e){this.mode=e}},{key:"setTranslationSnap",value:function(e){this.translationSnap=e}},{key:"setRotationSnap",value:function(e){this.rotationSnap=e}},{key:"setScaleSnap",value:function(e){this.scaleSnap=e}},{key:"setSize",value:function(e){this.size=e}},{key:"setSpace",value:function(e){this.space=e}},{key:"update",value:function(){console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.")}}]),t}();function A(e,t,n){for(var r=t.intersectObject(e,!0),i=0;i<r.length;i++)if(r[i].object.visible||n)return r[i];return!1}S.prototype.isTransformControls=!0;var M=new n.Euler,B=new n.Vector3(0,1,0),C=new n.Vector3(0,0,0),_=new n.Matrix4,E=new n.Quaternion,T=new n.Quaternion,D=new n.Vector3,P=new n.Matrix4,O=new n.Vector3(1,0,0),R=new n.Vector3(0,1,0),I=new n.Vector3(0,0,1),k=new n.Vector3,L=new n.Vector3,F=new n.Vector3,U=function(){l(t,n.Object3D);var e=c(t);function t(){i(this,t),(r=e.call(this)).type="TransformControlsGizmo";var r,a=new n.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),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()),u=(l.color.setHex(255),a.clone()),c=(u.color.setHex(16711680),u.opacity=.5,a.clone()),h=(c.color.setHex(65280),c.opacity=.5,a.clone()),d=(h.color.setHex(255),h.opacity=.5,a.clone());(d.opacity=.25,b=a.clone()).color.setHex(16776960),b.opacity=.25,a.clone().color.setHex(16776960);var p=(((a=a.clone()).color.setHex(7895160),v=new 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=(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),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(a)),r.add(r.gizmo.scale=M(w)),r.add(r.picker.translate=M(g)),r.add(r.picker.rotate=M(x)),r.add(r.picker.scale=M(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 s(t,[{key:"updateMatrixWorld",value:function(e){var n=this,r="local"===("scale"===this.mode?"local":this.space)?this.worldQuaternion:T,i=(this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode,this.helper.translate.visible="translate"===this.mode,this.helper.rotate.visible="rotate"===this.mode,this.helper.scale.visible="scale"===this.mode,[]);i=(i=(i=i.concat(this.picker[this.mode].children)).concat(this.gizmo[this.mode].children)).concat(this.helper[this.mode].children);for(var a=0;a<i.length;a++)!function(e){var t=i[e];if(t.visible=!0,t.rotation.set(0,0,0),e=void t.position.copy(n.worldPosition),e=n.camera.isOrthographicCamera?(n.camera.top-n.camera.bottom)/n.camera.zoom:n.worldPosition.distanceTo(n.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*n.camera.fov/360)/n.camera.zoom,7),t.scale.set(1,1,1).multiplyScalar(e*n.size/4),"helper"===t.tag)return t.visible=!1,"AXIS"===t.name?(t.position.copy(n.worldPositionStart),t.visible=!!n.axis,"X"===n.axis&&(v.setFromEuler(M.set(0,0,0)),t.quaternion.copy(r).multiply(v),.9<Math.abs(B.copy(O).applyQuaternion(r).dot(n.eye))&&(t.visible=!1)),"Y"===n.axis&&(v.setFromEuler(M.set(0,0,Math.PI/2)),t.quaternion.copy(r).multiply(v),.9<Math.abs(B.copy(R).applyQuaternion(r).dot(n.eye))&&(t.visible=!1)),"Z"===n.axis&&(v.setFromEuler(M.set(0,Math.PI/2,0)),t.quaternion.copy(r).multiply(v),.9<Math.abs(B.copy(I).applyQuaternion(r).dot(n.eye))&&(t.visible=!1)),"XYZE"===n.axis&&(v.setFromEuler(M.set(0,Math.PI/2,0)),B.copy(n.rotationAxis),t.quaternion.setFromRotationMatrix(_.lookAt(C,B,R)),t.quaternion.multiply(v),t.visible=n.dragging),"E"===n.axis&&(t.visible=!1)):"START"===t.name?(t.position.copy(n.worldPositionStart),t.visible=n.dragging):"END"===t.name?(t.position.copy(n.worldPosition),t.visible=n.dragging):"DELTA"===t.name?(t.position.copy(n.worldPositionStart),t.quaternion.copy(n.worldQuaternionStart),f.set(1e-10,1e-10,1e-10).add(n.worldPositionStart).sub(n.worldPosition).multiplyScalar(-1),f.applyQuaternion(n.worldQuaternionStart.clone().invert()),t.scale.copy(f),t.visible=n.dragging):(t.quaternion.copy(r),n.dragging?t.position.copy(n.worldPositionStart):t.position.copy(n.worldPosition),n.axis&&(t.visible=-1!==n.axis.search(t.name)));t.quaternion.copy(r),"translate"===n.mode||"scale"===n.mode?("X"===t.name&&.99<Math.abs(B.copy(O).applyQuaternion(r).dot(n.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Y"===t.name&&.99<Math.abs(B.copy(R).applyQuaternion(r).dot(n.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Z"===t.name&&.99<Math.abs(B.copy(I).applyQuaternion(r).dot(n.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XY"===t.name&&Math.abs(B.copy(I).applyQuaternion(r).dot(n.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"YZ"===t.name&&Math.abs(B.copy(O).applyQuaternion(r).dot(n.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XZ"===t.name&&Math.abs(B.copy(R).applyQuaternion(r).dot(n.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1)):"rotate"===n.mode&&(E.copy(r),B.copy(n.eye).applyQuaternion(v.copy(r).invert()),-1!==t.name.search("E")&&t.quaternion.setFromRotationMatrix(_.lookAt(n.eye,C,R)),"X"===t.name&&(v.setFromAxisAngle(O,Math.atan2(-B.y,B.z)),v.multiplyQuaternions(E,v),t.quaternion.copy(v)),"Y"===t.name&&(v.setFromAxisAngle(R,Math.atan2(B.x,B.z)),v.multiplyQuaternions(E,v),t.quaternion.copy(v)),"Z"===t.name&&(v.setFromAxisAngle(I,Math.atan2(B.y,B.x)),v.multiplyQuaternions(E,v),t.quaternion.copy(v))),t.visible=t.visible&&(-1===t.name.indexOf("X")||n.showX),t.visible=t.visible&&(-1===t.name.indexOf("Y")||n.showY),t.visible=t.visible&&(-1===t.name.indexOf("Z")||n.showZ),t.visible=t.visible&&(-1===t.name.indexOf("E")||n.showX&&n.showY&&n.showZ),t.material._color=t.material._color||t.material.color.clone(),t.material._opacity=t.material._opacity||t.material.opacity,t.material.color.copy(t.material._color),t.material.opacity=t.material._opacity,n.enabled&&n.axis&&(t.name===n.axis||n.axis.split("").some((function(e){return t.name===e})))&&(t.material.color.setHex(16776960),t.material.opacity=1)}(a);o(d(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}(),G=(U.prototype.isTransformControlsGizmo=!0,function(){l(t,n.Mesh);var e=c(t);function t(){var r;return i(this,t),(r=e.call(this,new n.PlaneGeometry(1e5,1e5,2,2),new n.MeshBasicMaterial({visible:!1,wireframe:!0,side:n.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1}))).type="TransformControlsPlane",r}return s(t,[{key:"updateMatrixWorld",value:function(e){var n=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(n="local"),k.copy(O).applyQuaternion("local"===n?this.worldQuaternion:T),L.copy(R).applyQuaternion("local"===n?this.worldQuaternion:T),F.copy(I).applyQuaternion("local"===n?this.worldQuaternion:T),B.copy(L),this.mode){case"translate":case"scale":switch(this.axis){case"X":B.copy(this.eye).cross(k),D.copy(k).cross(B);break;case"Y":B.copy(this.eye).cross(L),D.copy(L).cross(B);break;case"Z":B.copy(this.eye).cross(F),D.copy(F).cross(B);break;case"XY":D.copy(F);break;case"YZ":D.copy(k);break;case"XZ":B.copy(F),D.copy(L);break;case"XYZ":case"E":D.set(0,0,0)}break;default:D.set(0,0,0)}0===D.length()?this.quaternion.copy(this.cameraQuaternion):(P.lookAt(f.set(0,0,0),D,B),this.quaternion.setFromRotationMatrix(P)),o(d(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}()),N=(G.prototype.isTransformControlsPlane=!0,__webpack_require__(300)),j=__webpack_require__.n(N),H=__webpack_require__(1);class z{constructor(e){this.runScene=e}}var V=__webpack_require__(143),J=__webpack_require__(247),K=__webpack_require__(457),Z=__webpack_require__(529);class W extends z{constructor(e){super(e),this.map={},this.clock=new n.Clock,this.tickIndex=void 0,this.playings=new Set,this.updates={},this.clean=()=>{this.reset()},e.cb.model.add.add("anima-parse",(({model:e})=>{this.parses(e)})),e.cb.model.remove.add("anima-parse",(({model:e})=>{this.onModelDelete(e)})),this.runScene.cb.clean.add("EngineHelper",this.clean)}onModelDelete(e){e.traverse((e=>{(0,Z.withAnima)(e)&&e.animations.map((t=>{t.id&&(this.close(e,t.name),delete this.map[t.id])}))}))}parses(e){e.traverse((e=>this.parse(e)))}findId(e,t){for(const n of e.animations)if(n.name===t)return n.id}parse(e,t){if(0!==e.animations.length||t){const a=e.animations.length?e.animations:V.B.parse(t),s=new n.AnimationMixer(e);for(const t of a){var r=(0,H.getId)(),i=(t.id=r,s.clipAction(t));const n={finished:()=>{},loop:()=>{}};s.addEventListener("finished",(()=>n.finished())),s.addEventListener("loop",(()=>n.loop())),this.map[r]={mixer:s,action:i,model:e,time:0,runState:"close",clip:t,eventMap:n}}a.map((t=>{e.animations.find((e=>e.uuid===t.uuid))||e.animations.push(t)}))}}play(e,t,n){e=this.findId(e,t);const r=this.map[e];if(r&&!this.playings.has(r)){t=(0,K.mergeObject)({onLoop:()=>{},onProgress:()=>{},onFinished:()=>{},onClose:()=>{},onPause:()=>{},onResume:()=>{},onBeforeEnd:()=>{},loop:!1,lastFrame:!0,reset:!0},n);const{onProgress:i,onBeforeEnd:a,onLoop:s,onFinished:o,lastFrame:l,loop:u,reset:c}=t,{action:h,clip:d,eventMap:p}=(this.map[e].options=t,r);h.stop(),n=c?0:r.time,h.time=n,this.setPlayState(r,!0),c&&h.reset(),h.play();let f=!(r.runState="play");this.setUpdates(e,(()=>{var e=(0,K.getProgress)(h.time,d.duration,!0);99<=e&&!f&&(a(),f=!0),i(e)})),u?(h.loop=J.Z.LoopRepeat,p.loop=s):(l&&(h.clampWhenFinished=!0),h.loop=J.Z.LoopOnce,p.finished=()=>{this.setPlayState(r,!1),i(100),o()})}}pause(e,t){e=this.findId(e,t);const n=this.map[e];n&&this.playings.has(n)&&(this.updateTime(n),this.setPlayState(n,!1),n.options.onPause(),n.runState="pause")}resume(e,t){var n=this.findId(e,t);const r=this.map[n];r&&this.playings.has(r)&&(r.options.onResume(),this.play(e,t,null==(n=this.map[t])?void 0:n.options))}playAll(){this.pauseAll(),this.playings.clear(),Object.values(this.map).map((e=>{this.playings.add(e);const t=e.action;t.time=0,t.play()})),this.anima()}setValue(e){let t=this.clock.getDelta();Object.keys(this.map).map((n=>{const{mixer:r,action:i}=this.map[n];i.play(),i.time=e,r.update(t)}))}getDetal(){return this.clock.getDelta()}update(e){const t=e||this.getDetal();(0,H.mapObj)(this.updates,((e,n)=>n(t)))}anima(){let e=this.clock.getDelta();this.update(e),this.playings.forEach((t=>{t.mixer.update(e)})),this.tickIndex=window.requestAnimationFrame(this.anima.bind(this))}closeAnima(){window.cancelAnimationFrame(this.tickIndex)}resetItem(e){const{mixer:t,action:n}=e;n.reset(),n.stop(),t.time=0}pauseAll(){this.closeAnima(),this.playings.forEach((e=>this.resetItem(e))),this.playings.clear()}reset(){this.pauseAll(),this.map={},this.playings.clear(),this.closeAnima()}updateTime(e,t){e.time=t||e.action.time}setPlayState(e,t){t?(this.playings.add(e),1===this.playings.size&&this.anima()):(this.playings.delete(e),delete this.updates[e.clip.id],0===this.playings.size&&this.closeAnima())}getItem(e,t){return e=this.findId(e,t),this.map[e]}close(e,t,n){e=this.findId(e,t);const r=this.map[e];r&&this.playings.has(r)&&r.options&&((t=(0,K.mergeObject)({resetAction:!0},n).resetAction)&&r.action.reset(),this.setPlayState(r,!1),this.updateTime(r,0),r.options.onClose(),r.options=null,r.runState="pause")}setUpdates(e,t){this.updates[e]=t}fadeTo(e){var{lastModel:e,lastName:t,nextModel:n,nextName:r,duration:i}=e;e=this.findId(e,t);const a=this.map[e];a&&(t=this.findId(n,r),(e=this.map[t])&&a.action.crossFadeTo(e.action,i,!0))}resetTime(e,t){const n=this.getItem(e,t);n&&(n.action.time=0)}}var X=__webpack_require__(693),Q=__webpack_require__(699);class Y{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 X.lX;return e.setSize(this.engineDom.clientWidth,this.engineDom.clientHeight),e.domElement.style.position="absolute",e.domElement.style.top=String(0),e.domElement.className="css3dRenderer",this.engineDom.appendChild(e.domElement),this.runScene.cb.resize.add("render-3",(({width:t,height:n})=>{e.setSize(t,n)})),e}initRender2(){const e=new Q.M;return e.setSize(this.engineDom.clientWidth,this.engineDom.clientHeight),e.domElement.style.position="absolute",e.domElement.classList.add("css2dRenderer"),e.domElement.style.top="0px",e.domElement.style.left="0px",this.engineDom.insertBefore(e.domElement,this.engineDom.childNodes[0]),this.runScene.cb.resize.add("render-2",(({width:t,height:n})=>{e.setSize(t,n)})),e}reset(){var e=this.get().camera;this.runScene.renderEx.setSize(),this.runScene.cameraEx.reset(e)}dispose(){this.disposeRender(this.render2),this.disposeRender(this.render3)}setRender2(e){e?this.render2=this.initRender2():this.render2&&(this.disposeRender(this.render2),this.render2=null)}setRender3(e){e?this.render3=this.initRender3():this.render3&&(this.disposeRender(this.render3),this.render3=null)}init(e){var t=this.runScene.sceneEx.create(),n=this.runScene.cameraEx.pCam,r=this.runScene.renderEx.create(e),i=this.runScene.controlsEx.create(n,e),{render2:a,render3:s}=this.runScene.optionsEx.options;return this.camera=n,this.scene=t,this.renderer=r,this.controls=i,this.engineDom=e,this.runScene.renderEx.setSize(),this.setRender2(a),this.setRender3(s),{scene:t,camera:n,render:r,controls:i,engineDom:e}}get(){var{scene:e,renderer:t,controls:n,engineDom:r}=this;return{scene:e,camera:this.runScene.cameraEx.getCamera(),renderer:t,controls:n,engineDom:r}}}class q{constructor(){this.cbs=[],this.cb=e=>this.cbs.map((t=>{var n;return null==(n=t.fn)?void 0:n.call(t,e)})),this.emit=this.cb}add(e,t){return this.cbs.push({fn:t,name:e})}on(e,t){return this.add(t||"custom_"+(0,H.getId)(),e)}get(e){var t=this.cbs.findIndex((t=>t.name===e));if(-1!==t)return{data:this.cbs[t],index:t}}reset(e,t){return!!(e=this.get(e))&&(e.data.fn=t,!0)}remove(e){this.reset(e,null)}delete(e){e=(this.get(e)||{}).index,this.cbs.splice(e,1)}}class ${constructor(){this.resize=new q,this.setSelectMaterial=new q,this.setScene=new q,this.reset=new q,this.render=new q,this.tick=new q,this.baseLog=new q,this.inited=new q,this.texture={add:new q,remove:new q,setAnima:new q},this.model={multiSelect:{setEmpty:new q},change:new q,setSelect:new q,click:new q,add:new q,remove:new q,multipDrop:new q,focus:new q,unFocus:new q,changeName:new q,setOpen:new q,setMainStatue:new q,setVisible:new q,setParent:new q,setLayers:new q,setOutline:new q,clone:new q,dispose:new q},this.material={add:new q,remove:new q,dispose:new q,setName:new q},this.unique={material:{add:new q}},this.tranControls={changing:new q},this.undo={addUndos:new q,addRedus:new q,removeUndos:new q,undoByIndex:new q,reset:new q},this.scene={save:new q,saveNet:new q},this.timeLine={setProgress:new q,playGroup:new q,setGroupMap:new q,reset:new q,closeGroup:new q},this.events={key:{down:new q,up:new q},mouse:{move:new q,down:new q,up:new q},pointer:{rightTrigger:new q,down:new q,up:new q,move:new q,trigger:new q}},this.pp={glow:{setData:new q,setStatus:new q},outline:{setData:new q,setStatus:new q},ao:{setData:new q,setStatus:new q},vignette:{setData:new q,setStatus:new q}},this.load={getJSON:new q,progress:new q,complete:new q},this.exporter={gltf:{before:new q,complete:new q}},this.loaderer={gltf:{loadNode:new q,lazyLoadedTexture:new q,loaded:new q,modelLoaded:new q,progress:new q,getJSON:new q,getArrayBuffer:new q,complete:new q}},this.custom=new Proxy({},{get:(e,t)=>(e[t]||(e[t]=new q),e[t])}),this.tags={parseJSON:new q,clear:new q},this.snapshot={create:new q,set:new q},this.clean=new q}}var ee=__webpack_require__(230);function te(e,t){this.orbit=t,this.object=e,this.target=new J.Z.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.25;var n,r,i,a,s,o,l,u,c,h,d,p,f=this,m=0,v=0,g=0,y=0,b=1,x=new J.Z.Vector3,w=!1;this.getPolarAngle=function(){return v},this.getAzimuthalAngle=function(){return m},this.setPolarAngle=function(e){v=e,this.forceUpdate()},this.setAzimuthalAngle=function(e){m=e,this.forceUpdate()},this.rotateLeft=function(e){y-=e},this.rotateUp=function(e){g-=e},this.panLeft=(n=new J.Z.Vector3,function(e){var t=this.object.matrix.elements;n.set(t[0],t[1],t[2]),n.multiplyScalar(-e),x.add(n)}),this.panUp=(r=new J.Z.Vector3,function(e,n){t.screenSpacePanning?r.setFromMatrixColumn(n,1):(r.setFromMatrixColumn(n,0),r.crossVectors(f.object.up,r)),r.multiplyScalar(e),x.add(r)}),this.pan=function(e,t,n,r){var i;f.object instanceof J.Z.PerspectiveCamera?(i=f.object.position.clone().sub(f.target).length(),i*=Math.tan(f.object.fov/2*Math.PI/180),f.panLeft(2*e*i/r),f.panUp(2*t*i/r,f.object.matrix)):f.object instanceof J.Z.OrthographicCamera?(f.panLeft(e*(f.object.right-f.object.left)/n),f.panUp(t*(f.object.top-f.object.bottom)/r)):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.")},this.dollyIn=function(e){f.object instanceof J.Z.PerspectiveCamera?b/=e:f.object instanceof J.Z.OrthographicCamera?(f.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom*e)),f.object.updateProjectionMatrix(),w=!0):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.")},this.dollyOut=function(e){f.object instanceof J.Z.PerspectiveCamera?b*=e:f.object instanceof J.Z.OrthographicCamera?(f.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/e)),f.object.updateProjectionMatrix(),w=!0):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.")},this.forceUpdate=(i=new J.Z.Vector3,a=(new J.Z.Quaternion).setFromUnitVectors(e.up,new J.Z.Vector3(0,1,0)),s=a.clone().invert(),o=new J.Z.Vector3,l=new J.Z.Quaternion,function(){var e=this.object.position,t=(i.copy(e).sub(this.target),i.applyQuaternion(a),m=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,m)),v=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,v)),v=Math.max(1e-6,Math.min(Math.PI-1e-6,v)),i.length()*b);return t=Math.max(this.minDistance,Math.min(this.maxDistance,t)),this.target.add(x),i.x=t*Math.sin(v)*Math.sin(m),i.y=t*Math.cos(v),i.z=t*Math.sin(v)*Math.cos(m),i.applyQuaternion(s),e.copy(this.target).add(i),this.object.lookAt(this.target),!0===this.enableDamping?(y*=1-this.dampingFactor,g*=1-this.dampingFactor):g=y=0,b=1,x.set(0,0,0),!(!(w||1e-6<o.distanceToSquared(this.object.position)||1e-6<8*(1-l.dot(this.object.quaternion)))||(o.copy(this.object.position),l.copy(this.object.quaternion),w=!1))}),this.update=(u=new J.Z.Vector3,c=(new J.Z.Quaternion).setFromUnitVectors(e.up,new J.Z.Vector3(0,1,0)),h=c.clone().invert(),d=new J.Z.Vector3,p=new J.Z.Quaternion,function(){var e=this.object.position,t=(u.copy(e).sub(this.target),u.applyQuaternion(c),m=Math.atan2(u.x,u.z),v=Math.atan2(Math.sqrt(u.x*u.x+u.z*u.z),u.y),m+=y,v+=g,m=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,m)),v=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,v)),v=Math.max(1e-6,Math.min(Math.PI-1e-6,v)),u.length()*b);return t=Math.max(this.minDistance,Math.min(this.maxDistance,t)),this.target.add(x),u.x=t*Math.sin(v)*Math.sin(m),u.y=t*Math.cos(v),u.z=t*Math.sin(v)*Math.cos(m),u.applyQuaternion(h),e.copy(this.target).add(u),this.object.lookAt(this.target),!0===this.enableDamping?(y*=1-this.dampingFactor,g*=1-this.dampingFactor):g=y=0,b=1,x.set(0,0,0),!(!(w||1e-6<d.distanceToSquared(this.object.position)||1e-6<8*(1-p.dot(this.object.quaternion)))||(d.copy(this.object.position),p.copy(this.object.quaternion),w=!1))})}function ne(e,t){var n=new te(e,this),r=(this.domElement=void 0!==t?t:document,Object.defineProperty(this,"constraint",{get:function(){return n}}),this.getPolarAngle=function(){return n.getPolarAngle()},this.getAzimuthalAngle=function(){return n.getAzimuthalAngle()},this.setPolarAngle=function(e){return n.setPolarAngle(e)},this.setAzimuthalAngle=function(e){return n.setAzimuthalAngle(e)},this.enabled=!0,this.center=this.target,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.screenSpacePanning=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={ORBIT:J.Z.MOUSE.LEFT,ZOOM:J.Z.MOUSE.MIDDLE,PAN:J.Z.MOUSE.RIGHT},this),i=new J.Z.Vector2,a=new J.Z.Vector2,s=new J.Z.Vector2,o=new J.Z.Vector2,l=new J.Z.Vector2,u=new J.Z.Vector2,c=new J.Z.Vector2,h=new J.Z.Vector2,d=new J.Z.Vector2,p=-1,f=p,m=(this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,{type:"change"}),v={type:"start"},g={type:"end"};function y(e,t){var i=r.domElement===document?r.domElement.body:r.domElement;n.pan(e,t,i.clientWidth,i.clientHeight)}function b(){return Math.pow(.95,r.zoomSpeed)}function x(e){if(!1!==r.enabled){if(e.preventDefault(),e.button===r.mouseButtons.ORBIT){if(!1===r.enableRotate)return;f=0,i.set(e.clientX,e.clientY)}else if(e.button===r.mouseButtons.ZOOM){if(!1===r.enableZoom)return;f=1,c.set(e.clientX,e.clientY)}else if(e.button===r.mouseButtons.PAN){if(!1===r.enablePan)return;f=2,o.set(e.clientX,e.clientY)}f!==p&&(document.addEventListener("mousemove",w,!1),document.addEventListener("mouseup",S,!1),r.dispatchEvent(v))}}function w(e){if(null!=e&&null!=(t=e.preventDefault)&&t.call(e),!1!==r.enabled){var t=r.domElement===document?r.domElement.body:r.domElement;if(0===f){if(!1===r.enableRotate)return;a.set(e.clientX,e.clientY),s.subVectors(a,i),n.rotateLeft(2*Math.PI*s.x/t.clientWidth*r.rotateSpeed),n.rotateUp(2*Math.PI*s.y/t.clientHeight*r.rotateSpeed),i.copy(a)}else if(1===f){if(!1===r.enableZoom)return;h.set(e.clientX,e.clientY),d.subVectors(h,c),0<d.y?n.dollyIn(b()):d.y<0&&n.dollyOut(b()),c.copy(h)}else if(2===f){if(!1===r.enablePan)return;l.set(e.clientX,e.clientY),u.subVectors(l,o),y(u.x,u.y),o.copy(l)}f!==p&&r.update()}}function S(){!1!==r.enabled&&(document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",S),r.dispatchEvent(g),f=p)}function A(e){var t;!1!==r.enabled&&!1!==r.enableZoom&&f===p&&(e.stopPropagation(),void(t=0)!==e.wheelDelta?t=e.wheelDelta:void 0!==e.detail&&(t=-e.detail),0<t?n.dollyOut(b()):t<0&&n.dollyIn(b()),r.update(),r.dispatchEvent(v),r.dispatchEvent(g))}function M(e){if(!1!==r.enabled&&!1!==r.enableKeys&&!1!==r.enablePan)switch(e.keyCode){case r.keys.UP:y(0,r.keyPanSpeed),r.update();break;case r.keys.BOTTOM:y(0,-r.keyPanSpeed),r.update();break;case r.keys.LEFT:y(r.keyPanSpeed,0),r.update();break;case r.keys.RIGHT:y(-r.keyPanSpeed,0),r.update()}}function B(e){if(!1!==r.enabled){switch(e.touches.length){case 1:if(!1===r.enableRotate)return;f=3,i.set(e.touches[0].pageX,e.touches[0].pageY);break;case 2:if(!1===r.enableZoom)return;f=4;var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY;t=Math.sqrt(t*t+n*n),c.set(0,t);break;case 3:if(!1===r.enablePan)return;f=5,o.set(e.touches[0].pageX,e.touches[0].pageY);break;default:f=p}f!==p&&r.dispatchEvent(v)}}function C(e){if(e.stopPropagation(),!1!==r.enabled){var t=r.domElement===document?r.domElement.body:r.domElement;switch(e.touches.length){case 1:if(!1===r.enableRotate)return;if(3!==f)return;a.set(e.touches[0].pageX,e.touches[0].pageY),s.subVectors(a,i),n.rotateLeft(2*Math.PI*s.x/t.clientWidth*r.rotateSpeed),n.rotateUp(2*Math.PI*s.y/t.clientHeight*r.rotateSpeed),i.copy(a),r.update();break;case 2:if(!1===r.enableZoom)return;if(4!==f)return;var m=e.touches[0].pageX-e.touches[1].pageX,v=e.touches[0].pageY-e.touches[1].pageY;m=Math.sqrt(m*m+v*v),h.set(0,m),d.subVectors(h,c),0<d.y?n.dollyOut(b()):d.y<0&&n.dollyIn(b()),c.copy(h),r.update();break;case 3:if(!1===r.enablePan)return;if(5!==f)return;l.set(e.touches[0].pageX,e.touches[0].pageY),u.subVectors(l,o),y(u.x,u.y),o.copy(l),r.update();break;default:f=p}}}function _(){!1!==r.enabled&&(r.dispatchEvent(g),f=p)}function E(e){e.preventDefault()}this.update=function(){this.autoRotate&&f===p&&n.rotateLeft(2*Math.PI/60/60*r.autoRotateSpeed),!0===n.update()&&this.dispatchEvent(m)},this.reset=function(){f=p,this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(m),this.update()},this.dispose=function(){this.domElement.removeEventListener("contextmenu",E,!1),this.domElement.removeEventListener("mousedown",x,!1),this.domElement.removeEventListener("mousewheel",A,!1),this.domElement.removeEventListener("MozMousePixelScroll",A,!1),this.domElement.removeEventListener("touchstart",B,!1),this.domElement.removeEventListener("touchend",_,!1),this.domElement.removeEventListener("touchmove",C,!1),document.removeEventListener("mousemove",w,!1),document.removeEventListener("mouseup",S,!1),window.removeEventListener("keydown",M,!1)},this.domElement.addEventListener("contextmenu",E,!1),this.domElement.addEventListener("mousedown",x,!1),this.domElement.addEventListener("mousewheel",A,{passive:!0}),this.domElement.addEventListener("MozMousePixelScroll",A,!1),this.domElement.addEventListener("touchstart",B,{passive:!0}),this.domElement.addEventListener("touchend",_,!1),this.domElement.addEventListener("touchmove",C,{passive:!0}),window.addEventListener("keydown",M,!1),this.update()}J.Z.MOUSE,(ne.prototype=Object.create(J.Z.EventDispatcher.prototype)).constructor=ne,Object.defineProperties(ne.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 re=ne;class ie{create(e,t){return new re(e,t)}static toJSON(e){return e.target}static setTarget(e,t,n){var{x:r,y:i,z:a}=t,{x:n,y:s,z:o}=n||e.target;this.setTargetData.anima&&(this.setTargetData.anima.kill(),this.setTargetData.anima=null,this.setTarget(e,t,this.setTargetData.nowData)),this.setTargetData.anima=(0,K.anima)({x:n,y:s,z:o},{x:r,y:i,z:a},.5,(t=>{var{x:n,y:r,z:i}=t;e.target.set(n,r,i),e.update(),this.setTargetData.nowData=t}),(()=>{this.setTargetData.anima=null}))}}ie.setTargetData={anima:null,nowData:null};class ae{constructor(e){this._state=!1,this._libsState=!1,this.map={val:"Box",type:"base-model"},this.libsMap={data:"Box",type:"texture"},this.events=e}get state(){return this._state}set state(e){this._state=e}setVal(e){this.state=!0,this.map=e}getVal(){if(this.state)return this.state=!1,this.map}setLibsVal(e){this._libsState=!0,this.libsMap=e}getLibsVal(){if(this._libsState)return this._libsState=!1,this.libsMap}}var se=__webpack_require__(794),oe=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}))};const le=H.fnDebounce;class ue{constructor(e){this.alt=!1,this.ctrl=!1,this.shift=!1,this.unExec=new se.Z,this.specialKeyDebounce=le((()=>{this.ctrl=!1,this.shift=!1,this.alt=!1}),1e3),this.allFn={s_saveScene:()=>oe(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 oe(this,void 0,void 0,(function*(){if("INPUT"!==document.activeElement.nodeName){var t=e.key.toLowerCase();if(this.events.runScene.cb.events.key.down.cb({key:t,event:e}),!this.unExec.get(t))switch(t){case" ":break;case"s":this.ctrl&&(e.preventDefault(),this.allFn.s_saveScene());break;case"d":this.ctrl&&(e.preventDefault(),this.allFn.d_copyModel());break;case"alt":this.alt=!0,this.specialKeyDebounce();break;case"control":case"ctrl":this.ctrl=!0,this.specialKeyDebounce();break;case"shift":this.shift=!0,this.specialKeyDebounce();break;case"f11":this.events.runScene.cb.resize.cb(this.events.runScene.renderEx.getDomSize());break;case"w":e.preventDefault(),e.stopPropagation(),this.events.runScene.helperEx.transContro.changeMode("position");break;case"e":this.events.runScene.helperEx.transContro.changeMode("rotation");break;case"r":this.events.runScene.helperEx.transContro.changeMode("scale"),e.preventDefault();break;case"f":this.allFn.f_focusModel();break;case"delete":this.events.runScene.helperEx.unfocus();var n=this.events.runScene.multipSelector.getSelectedList("value");this.events.runScene.sceneEx.remove(this.events.runScene.modelEx.select||n),n&&this.events.runScene.multipSelector.delete();break;case"z":if(!this.ctrl)return;this.allFn.z_undo(e);break;case"y":if(!this.ctrl)return;this.allFn.y_redo(e)}}}))}keyUp(e){if("INPUT"!==document.activeElement.nodeName){var t=e.key.toLowerCase();switch(this.events.runScene.cb.events.key.up.cb({key:t,event:e}),t){case"meta":break;case"s":if(this.ctrl)break;return;case"alt":this.alt=!1;break;case"control":case"ctrl":this.ctrl=!1;break;case"shift":this.shift=!1}}}}var ce=__webpack_require__(801);class he{constructor(e){this.downPosition={0:{x:0,y:0},2:{x:0,y:0}},this.enableUp=!0,this.isMove=!1,this.moveEvent=new MouseEvent("move"),this.down=e=>{0!==e.button&&2!==e.button||(this.downPosition[e.button]={x:e.offsetX,y:e.offsetY}),this.isMove=!0},this.up=e=>{var t,n,r,i;this.isMove=!1,1===e.button||null!=(t=this.events.runScene.helperEx.transContro)&&t.isDraggingChange||(t=e.offsetX,n=e.offsetY,({x:r,y:i}=this.downPosition[e.button]),t===r&&n===i&&(0===e.button&&this.trigger(e),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 n=e;"canvas"===t?n=e:"window"===t&&(n=window),n.addEventListener("pointerdown",this.down.bind(this)),n.addEventListener("pointerup",this.up.bind(this)),n.addEventListener("pointerdown",this.events.runScene.cb.events.pointer.down.cb),n.addEventListener("pointerup",this.events.runScene.cb.events.pointer.up.cb),n.addEventListener("pointermove",(e=>{this.moveEvent=e,this.events.runScene.cb.events.pointer.move.cb(e)})),n.addEventListener("mousemove",this.events.runScene.cb.events.mouse.move.cb),n.addEventListener("mousedown",this.events.runScene.cb.events.mouse.down.cb),n.addEventListener("mouseup",this.events.runScene.cb.events.mouse.up.cb)}getTriggerModels(e){const t=new n.Raycaster,r=new n.Vector2,{engineDom:i,camera:a,scene:s}=this.events.runScene.assetsEx.get();var{top:o,left:l,width:u,height:c}=i.getBoundingClientRect(),l=e.pageX-l,o=(e=e.pageY-o,r.x=l/u*2-1,r.y=-e/c*2+1,t.setFromCamera(r,a),s.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 console.log(h,"intersects"),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)&&!ce.zf.isLock(e,!0)&&Z.selectableModel.is(e)))}trigger(e){let t=this.removeHideOrLockModel(this.getTriggerModels(e));if(this.selectable){if(!t)return this.events.runScene.multipSelector.setEmpty(),void this.events.runScene.modelEx.selectNull();if(this.events.runScene.helperEx.isHelper(t)&&(e=this.events.runScene.uniqueEx.getId(t),t=this.events.runScene.uniqueEx.model.get(e)),!this.enableUp){if(t===this.events.runScene.helperEx.transContro.multipObj)return;this.enableUp=!0}if(this.events.runScene.cb.model.click.cb(t),this.events.key.ctrl)return this.enableUp=!1,this.events.runScene.multipSelector.add(t);if(this.events.key.shift){const e=t.parent;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 de(){de=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=(p="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",i=p.asyncIterator||"@@asyncIterator",a=p.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(t){s=function(e,t,n){return e[t]=n}}function o(e,t,n,r){var i,a,s,o;return t=t&&t.prototype instanceof c?t:c,t=Object.create(t.prototype),r=new x(r||[]),t._invoke=(i=e,a=n,s=r,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 n=s.delegate;if(n&&(n=function e(t,n){var r=t.iterator[n.method];if(void 0===r){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=void 0,e(t,n),"throw"===n.method))return u;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}return"throw"===(r=l(r,t.iterator,n.arg)).type?(n.method="throw",n.arg=r.arg,n.delegate=null,u):(r=r.arg)?r.done?(n[t.resultName]=r.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,u):r:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,u)}(n,s),n)){if(n===u)continue;return n}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"===(n=l(i,a,s)).type){if(o=s.done?"completed":"suspendedYield",n.arg===u)continue;return{value:n.arg,done:s.done}}"throw"===n.type&&(o="completed",s.method="throw",s.arg=n.arg)}}),t}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=o;var u={};function c(){}function h(){}function d(){}var p,f,m=(s(p={},r,(function(){return this})),(f=(f=Object.getPrototypeOf)&&f(f(w([]))))&&f!==t&&n.call(f,r)&&(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 r;this._invoke=function(i,a){function s(){return new t((function(r,s){!function r(i,a,s,o){var u;if("throw"!==(i=l(e[i],e,a)).type)return(a=(u=i.arg).value)&&"object"==fe(a)&&n.call(a,"__await")?t.resolve(a.__await).then((function(e){r("next",e,s,o)}),(function(e){r("throw",e,s,o)})):t.resolve(a).then((function(e){u.value=e,s(u)}),(function(e){return r("throw",e,s,o)}));o(i.arg)}(i,a,r,s)}))}return r=r?r.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[r];if(i)return i.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(i=function r(){for(;++t<e.length;)if(n.call(e,t))return r.value=e[t],r.done=!1,r;return r.value=void 0,r.done=!0,r}).next=i}return{next: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,n,r,i,a){void 0===a&&(a=Promise);var s=new g(o(t,n,r,i),a);return e.isGeneratorFunction(n)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},v(m),s(m,a,"Generator"),s(m,r,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,n=[];for(t in e)n.push(t);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=w,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(b),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return s.type="throw",s.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;0<=i;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var o=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(o&&l){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(o){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;0<=r;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}var 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 n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),b(n),u}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var n,r,i=this.tryEntries[t];if(i.tryLoc===e)return"throw"===(n=i.completion).type&&(r=n.arg,b(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:w(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},e}function pe(e,t,n,r,i,a,s){try{var o=e[a](s),l=o.value}catch(e){return void n(e)}o.done?t(l):Promise.resolve(l).then(r,i)}function fe(e){return(fe="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 me(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ve(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ge(e,t,n){t&&ve(e.prototype,t),n&&ve(e,n),Object.defineProperty(e,"prototype",{writable:!1})}var ye=function(){function e(){me(this,e),this.pluginCallbacks=[],this.register((function(e){return new Le(e)})),this.register((function(e){return new Fe(e)})),this.register((function(e){return new Ue(e)})),this.register((function(e){return new Ne(e)})),this.register((function(e){return new je(e)})),this.register((function(e){return new Ge(e)}))}return ge(e,[{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,n,r){"object"===fe(n)&&(console.warn("THREE.GLTFExporter: parse() expects options as the fourth argument now."),r=n);for(var i=new ke,a=[],s=0,o=this.pluginCallbacks.length;s<o;s++)a.push(this.pluginCallbacks[s](i));i.setPlugins(a),i.write(e,t,r).catch(n)}},{key:"parseAsync",value:function(e,t){var n=this;return new Promise((function(r,i){n.parse(e,r,i,t)}))}}]),e}(),be=5121,xe=5123,we=(N=9728,9729),Se=9984,Ae=9985,Me=9986,Be=9987,Ce=33071,_e=33648,Ee=10497,Te={},De=(Te[n.NearestFilter]=N,Te[n.NearestMipmapNearestFilter]=Se,Te[n.NearestMipmapLinearFilter]=Me,Te[n.LinearFilter]=we,Te[n.LinearMipmapNearestFilter]=Ae,Te[n.LinearMipmapLinearFilter]=Be,Te[n.ClampToEdgeWrapping]=Ce,Te[n.RepeatWrapping]=Ee,Te[n.MirroredRepeatWrapping]=_e,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"});function Pe(e,t){return e.length===t.length&&e.every((function(e,n){return e===t[n]}))}function Oe(e){return 4*Math.ceil(e/4)}function Re(e,t){var n=1<arguments.length&&void 0!==t?t:0,r=Oe(e.byteLength);if(r===e.byteLength)return e;var i=new Uint8Array(r);if(i.set(new Uint8Array(e)),0!==n)for(var a=e.byteLength;a<r;a++)i[a]=n;return i.buffer}var Ie=null,ke=function(){function e(){me(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 ge(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=de().mark((function e(t,n,r){var i,a,s,o,l,u,c;return de().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.options=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(t),e.next=5,Promise.all(this.pending);case 5:return a=(i=this).buffers,s=i.json,r=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===r.binary?((u=new window.FileReader).readAsArrayBuffer(o),u.onloadend=function(){var e=Re(u.result),t=new DataView(new ArrayBuffer(8)),r=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),Re(function(e){if(void 0!==window.TextEncoder)return(new TextEncoder).encode(e).buffer;for(var t=new Uint8Array(new ArrayBuffer(e.length)),n=0,r=e.length;n<r;n++){var i=e.charCodeAt(n);t[n]=255<i?32:i}return t.buffer}(JSON.stringify(s)),32)),i=new DataView(new ArrayBuffer(8)),a=(i.setUint32(0,r.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+r.byteLength+t.byteLength+e.byteLength),l=(l.setUint32(8,o,!0),new Blob([a,i,r,t,e],{type:"application/octet-stream"})),c=new window.FileReader;c.readAsArrayBuffer(l),c.onloadend=function(){n(c.result)}}):s.buffers&&0<s.buffers.length?((c=new window.FileReader).readAsDataURL(o),c.onloadend=function(){var e=c.result;s.buffers[0].uri=e,n(s)}):n(s);case 17:case"end":return e.stop()}}),e,this)})),r=function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function s(e){pe(a,r,i,s,o,"next",e)}function o(e){pe(a,r,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 n=this.options,r=this.extensionsUsed;try{var i=JSON.parse(JSON.stringify(e.userData));if(n.includeCustomExtensions&&i.gltfExtensions){for(var a in void 0===t.extensions&&(t.extensions={}),i.gltfExtensions)t.extensions[a]=i.gltfExtensions[a],r[a]=!0;delete i.gltfExtensions}0<Object.keys(i).length&&(t.extras=i)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}}},{key:"getUID",value:function(e){return this.uids.has(e)||this.uids.set(e,this.uid++),this.uids.get(e)}},{key:"isNormalizedNormalAttribute",value:function(e){if(this.cache.attributesNormalized.has(e))return!1;for(var t=new n.Vector3,r=0,i=e.count;r<i;r++)if(5e-4<Math.abs(t.fromBufferAttribute(e,r).length()-1))return!1;return!0}},{key:"createNormalizedNormalAttribute",value:function(e){var t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);for(var r=e.clone(),i=new n.Vector3,a=0,s=r.count;a<s;a++)i.fromBufferAttribute(r,a),0===i.x&&0===i.y&&0===i.z?i.setX(1):i.normalize(),r.setXYZ(a,i.x,i.y,i.z);return t.attributesNormalized.set(e,r),r}},{key:"applyTextureTransform",value:function(e,t){var n=!1,r={};0===t.offset.x&&0===t.offset.y||(r.offset=t.offset.toArray(),n=!0),0!==t.rotation&&(r.rotation=t.rotation,n=!0),1===t.repeat.x&&1===t.repeat.y||(r.scale=t.repeat.toArray(),n=!0),n&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=r,this.extensionsUsed.KHR_texture_transform=!0)}},{key:"buildORMTexture",value:function(e){var t=null==(t=e.aoMap)?void 0:t.image,r=null==(r=e.roughnessMap)?void 0:r.image,i=null==(i=e.metalnessMap)?void 0:i.image;if(t===r&&r===i)return e.aoMap;if(t||r||i){e=Math.max((null==t?void 0:t.width)||0,(null==r?void 0:r.width)||0,(null==i?void 0:i.width)||0);var a=Math.max((null==t?void 0:t.height)||0,(null==r?void 0:r.height)||0,(null==i?void 0:i.height)||0),s=document.createElement("canvas"),o=(s.width=e,s.height=a,s.getContext("2d")),l=(o.fillStyle="#ffffff",o.fillRect(0,0,e,a),o.getImageData(0,0,e,a));if(t){o.drawImage(t,0,0,e,a);for(var u=o.getImageData(0,0,e,a).data,c=0;c<u.length;c+=4)l.data[c]=u[c]}if(r){o.drawImage(r,0,0,e,a);for(var h=o.getImageData(0,0,e,a).data,d=1;d<h.length;d+=4)l.data[d]=h[d]}if(i){o.drawImage(i,0,0,e,a);for(var p=o.getImageData(0,0,e,a).data,f=2;f<p.length;f+=4)l.data[f]=p[f]}return o.putImageData(l,0,0),new n.Texture(s)}}},{key:"processBuffer",value:function(e){var t=this.json,n=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),n.push(e),0}},{key:"processBufferView",value:function(e,t,n,r,i){for(var a,s=this.json,o=(s.bufferViews||(s.bufferViews=[]),a=t===be?1:t===xe?2:4,Oe(r*e.itemSize*a)),l=new DataView(new ArrayBuffer(o)),u=0,c=n;c<n+r;c++)for(var h=0;h<e.itemSize;h++){var d=void 0;4<e.itemSize?d=e.array[c*e.itemSize+h]:0===h?d=e.getX(c):1===h?d=e.getY(c):2===h?d=e.getZ(c):3===h&&(d=e.getW(c)),5126===t?l.setFloat32(u,d,!0):5125===t?l.setUint32(u,d,!0):t===xe?l.setUint16(u,d,!0):t===be&&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,n=t.json;return n.bufferViews||(n.bufferViews=[]),new Promise((function(r,i){var a=new window.FileReader;if(!(e instanceof Blob))return i();a.readAsArrayBuffer(e),a.onloadend=function(){var e=Re(a.result),i={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,r(n.bufferViews.push(i)-1)}}))}},{key:"processAccessor",value:function(e,t,n,r){var i,a=this.options,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=xe;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");i=be}if(void 0===n&&(n=0),void 0===r&&(r=e.count),a.truncateDrawRange&&void 0!==t&&null===t.index&&(a=n+r,l=t.drawRange.count===1/0?e.count:t.drawRange.start+t.drawRange.count,n=Math.max(n,t.drawRange.start),(r=Math.min(a,l)-n)<0&&(r=0)),0===r)return null;a=function(e,t,n){for(var r={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},i=t;i<t+n;i++)for(var a=0;a<e.itemSize;a++){var 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)),r.min[a]=Math.min(r.min[a],s),r.max[a]=Math.max(r.max[a],s)}return r}(e,n,r);var o,l=(void 0!==t&&(o=e===t.index?34963:34962),this.processBufferView(e,i,n,r,o));return t={bufferView:l.id,byteOffset:l.byteOffset,componentType:i,count:r,max:a.max,min:a.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]},!0===e.normalized&&(t.normalized=!0),s.accessors||(s.accessors=[]),s.accessors.push(t)-1}},{key:"processImage",value:function(e,t,r,i){var a=this,s=a.cache,o=a.json,l=a.options,u=a.pending,c=(s.images.has(e)||s.images.set(e,{}),s=s.images.get(e),"image/png");if(void 0!==s[r=c+":flipY/"+r.toString()])return s[r];o.images||(o.images=[]);var h={mimeType:c};if(!0===l.binary&&null!=i&&null!=(p=i.userData)&&p.blob&&(null==i||null==(p=i.userData)?void 0:p.blob)instanceof Blob)u.push(new Promise((function(e){a.processBufferViewImage(i.userData.blob).then((function(t){h.bufferView=t,e()}))})));else if(l.embedImages){var d=Ie=Ie||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!==n.RGBAFormat&&console.error("GLTFExporter: Only RGBAFormat is supported."),(e.width>l.maxTextureSize||e.height>l.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);for(var f=new Uint8ClampedArray(e.height*e.width*4),m=0;m<f.length;m+=4)f[m+0]=e.data[m+0],f[m+1]=e.data[m+1],f[m+2]=e.data[m+2],f[m+3]=e.data[m+3];p.putImageData(new ImageData(f,e.width,e.height),0,0)}!0===l.binary?u.push(new Promise((function(e){d.toBlob((function(t){a.processBufferViewImage(t).then((function(t){h.bufferView=t,e()}))}),c)}))):h.uri=d.toDataURL(c)}else h.uri=e.src;return t=o.images.push(h)-1,s[r]=t}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter:Te[e.magFilter],minFilter:Te[e.minFilter],wrapS:Te[e.wrapS],wrapT:Te[e.wrapT]},t.samplers.push(e)-1}},{key:"processTexture",value:function(e){var t=this.cache,n=this.json;if(t.textures.has(e))return t.textures.get(e);n.textures||(n.textures=[]);var r={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,e)};return e.name&&(r.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,r)})),n=n.textures.push(r)-1,t.textures.set(e,n),this.options.myOptions.helper.parseTexture({texture:e,textureDef:r}),n}},{key:"processMaterial",value:function(e){var t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);var i,a={pbrMetallicRoughness:{}},s=(Pe((this.options.myOptions.helper.parseMaterial({material:e,materialDef:a,options:this}),!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."),s=e.color.toArray().concat([e.opacity])),[1,1,1,1])||(a.pbrMetallicRoughness.baseColorFactor=s),e.isMeshStandardMaterial?(a.pbrMetallicRoughness.metallicFactor=e.metalness,a.pbrMetallicRoughness.roughnessFactor=e.roughness):(a.pbrMetallicRoughness.metallicFactor=.5,a.pbrMetallicRoughness.roughnessFactor=.5),this.buildORMTexture(e));return(e.metalnessMap||e.roughnessMap)&&(s={index:this.processTexture(s)},this.applyTextureTransform(s,e.metalnessMap||e.roughnessMap),a.pbrMetallicRoughness.metallicRoughnessTexture=s),e.map&&(s={index:this.processTexture(e.map)},this.applyTextureTransform(s,e.map),a.pbrMetallicRoughness.baseColorTexture=s),e.emissive&&(s=e.emissive.clone().multiplyScalar(e.emissiveIntensity),1<(i=Math.max(s.r,s.g,s.b))&&(s.multiplyScalar(1/i),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),0<i&&(a.emissiveFactor=s.toArray()),e.emissiveMap&&(i={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(i,e.emissiveMap),a.emissiveTexture=i)),e.normalMap&&(s={index:this.processTexture(e.normalMap)},e.normalScale&&1!==e.normalScale.x&&(s.scale=e.normalScale.x),this.applyTextureTransform(s,e.normalMap),a.normalTexture=s),e.aoMap&&(i={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(i.strength=e.aoMapIntensity),this.applyTextureTransform(i,e.aoMap),a.occlusionTexture=i),e.transparent?a.alphaMode="BLEND":0<e.alphaTest&&(a.alphaMode="MASK",a.alphaCutoff=e.alphaTest),e.side===n.DoubleSide&&(a.doubleSided=!0),""!==e.name&&(a.name=e.name),this.serializeUserData(e,a),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,a)})),s=r.materials.push(a)-1,t.materials.set(e,s),s}},{key:"processMesh",value:function(e){var t=this.cache,r=this.json,i=[e.geometry.uuid];if(Array.isArray(e.material))for(var a=0,s=e.material.length;a<s;a++)i.push(e.material[a].uuid);else i.push(e.material.uuid);var o=i.join(":");if(t.meshes.has(o))return t.meshes.get(o);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 n.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={},_=!1;for(B in l.morphAttributes)if("position"!==B&&"normal"!==B)_||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),_=!0);else{var E=l.morphAttributes[B][M],T=B.toUpperCase(),D=l.attributes[B];if(t.attributes.has(this.getUID(E)))C[T]=t.attributes.get(this.getUID(E));else{var P=E.clone();if(!l.morphTargetsRelative)for(var O=0,R=E.count;O<R;O++)P.setXYZ(O,E.getX(O)-D.getX(O),E.getY(O)-D.getY(O),E.getZ(O)-D.getZ(O));C[T]=this.processAccessor(P,l),t.attributes.set(this.getUID(D),C[T])}}v.push(C),x.push(e.morphTargetInfluences[M]),void 0!==e.morphTargetDictionary&&w.push(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(o,y),y}},{key:"processCamera",value:function(e){var t=this.json,r=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),i={type:r?"orthographic":"perspective"};return r?i.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:i.perspective={aspectRatio:e.aspect,yfov:n.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(i.name=e.type),t.cameras.push(i)-1}},{key:"processAnimation",value:function(e,t){for(var r=this.json,i=this.nodeMap,a=(r.animations||(r.animations=[]),(e=ye.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),s=[],o=[],l=0;l<a.length;++l){var u=a[l],c=n.PropertyBinding.parseTrackName(u.name),h=n.PropertyBinding.findNode(t,c.nodeName),d=De[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===De.morphTargetInfluences&&(c/=h.morphTargetInfluences.length));!0===u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(p="CUBICSPLINE",c/=3):p=u.getInterpolation()===n.InterpolateDiscrete?"STEP":"LINEAR",o.push({input:this.processAccessor(new n.BufferAttribute(u.times,1)),output:this.processAccessor(new n.BufferAttribute(u.values,c)),interpolation:p}),s.push({sampler:o.length-1,target:{node:i.get(h),path:d}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:o,channels:s}),r.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,r=this.nodeMap,i=t.nodes[r.get(e)],a=e.skeleton;if(void 0===a)return null;var s=e.skeleton.bones[0];if(void 0===s)return null;for(var o=[],l=new Float32Array(16*a.bones.length),u=new n.Matrix4,c=0;c<a.bones.length;++c){var h=a.bones[c];h=this.options.myOptions.helper.getNodeMapValueWithBone(h,r),o.push(h),u.copy(a.boneInverses[c]),u.multiply(e.bindMatrix).toArray(l,16*c)}return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new n.BufferAttribute(l,16)),joints:o,skeleton:r.get(s)}),i.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,n,r=this.json,i=this.options,a=this.nodeMap,s=(r.nodes||(r.nodes=[]),{});if(i.myOptions.helper.parseNode({object:e,nodeDef:s,options:this}),i.trs?(n=e.quaternion.toArray(),h=e.position.toArray(),t=e.scale.toArray(),Pe(n,[0,0,0,1])||(s.rotation=n),Pe(h,[0,0,0])||(s.translation=h),Pe(t,[1,1,1])||(s.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===Pe(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!==(n=this.processMesh(e))&&(s.mesh=n):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=r.nodes.push(s)-1;return a.set(e,h),h}},{key:"processScene",value:function(e){for(var t=this.json,n=this.options,r=(t.scenes||(t.scenes=[],t.scene=0),{}),i=(""!==e.name&&(r.name=e.name),t.scenes.push(r),[]),a=0,s=e.children.length;a<s;a++){var o=e.children[a];console.log(o,"child"),o.userData.isTemp||!o.visible&&!1!==n.onlyVisible||null!==(o=this.processNode(o))&&i.push(o)}0<i.length&&(r.nodes=i),this.serializeUserData(e,r)}},{key:"processObjects",value:function(e){var t=new n.Scene;t.name="AuxScene";for(var r=0;r<e.length;r++)t.children.push(e[r]);this.processScene(t)}},{key:"processInput",value:function(e){for(var t,r,i=this.options,a=(e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)})),[]),s=0;s<e.length;s++)e[s]instanceof n.Scene?this.processScene(e[s]):a.push(e[s]);1===a.length?(t=a[0],"model"===i.myOptions.helper.type&&((r=new n.Group).name="glb_model",r.add(t),t=r),this.processScene(t)):1<a.length&&this.processObjects(a);for(var o=0;o<this.skins.length;++o)this.processSkin(this.skins[o]);for(var l=0;l<i.animations.length;++l)this.processAnimation(i.animations[l],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}},{key:"_invokeAll",value:function(e){for(var t=0,n=this.plugins.length;t<n;t++)e(this.plugins[t])}}]),e}(),Le=function(){function e(t){me(this,e),this.writer=t,this.name="KHR_lights_punctual"}return ge(e,[{key:"writeNode",value:function(e,t){var n,r,i;e.isLight&&(e.isDirectionalLight||e.isPointLight||e.isSpotLight?(n=(i=this.writer).json,i=i.extensionsUsed,r={},e.name&&(r.name=e.name),r.color=e.color.toArray(),r.intensity=e.intensity,e.isDirectionalLight?r.type="directional":e.isPointLight?(r.type="point",0<e.distance&&(r.range=e.distance)):e.isSpotLight&&(r.type="spot",0<e.distance&&(r.range=e.distance),r.spot={},r.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,r.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),i[this.name]||(n.extensions=n.extensions||{},n.extensions[this.name]={lights:[]},i[this.name]=!0),(i=n.extensions[this.name].lights).push(r),t.extensions=t.extensions||{},t.extensions[this.name]={light:i.length-1}):console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e))}}]),e}(),Fe=function(){function e(t){me(this,e),this.writer=t,this.name="KHR_materials_unlit"}return ge(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){me(this,e),this.writer=t,this.name="KHR_materials_pbrSpecularGlossiness"}return ge(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isGLTFSpecularGlossinessMaterial&&(r=(n=this.writer).extensionsUsed,i={},t.pbrMetallicRoughness.baseColorFactor&&(i.diffuseFactor=t.pbrMetallicRoughness.baseColorFactor),e.specular.toArray(a=[1,1,1],0),i.specularFactor=a,i.glossinessFactor=e.glossiness,t.pbrMetallicRoughness.baseColorTexture&&(i.diffuseTexture=t.pbrMetallicRoughness.baseColorTexture),e.specularMap&&(a={index:n.processTexture(e.specularMap)},n.applyTextureTransform(a,e.specularMap),i.specularGlossinessTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),Ge=function(){function e(t){me(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return ge(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&(r=(n=this.writer).extensionsUsed,(i={}).clearcoatFactor=e.clearcoat,e.clearcoatMap&&(a={index:n.processTexture(e.clearcoatMap)},n.applyTextureTransform(a,e.clearcoatMap),i.clearcoatTexture=a),i.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap&&(a={index:n.processTexture(e.clearcoatRoughnessMap)},n.applyTextureTransform(a,e.clearcoatRoughnessMap),i.clearcoatRoughnessTexture=a),e.clearcoatNormalMap&&(a={index:n.processTexture(e.clearcoatNormalMap)},n.applyTextureTransform(a,e.clearcoatNormalMap),i.clearcoatNormalTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),Ne=function(){function e(t){me(this,e),this.writer=t,this.name="KHR_materials_transmission"}return ge(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&0!==e.transmission&&(r=(n=this.writer).extensionsUsed,(i={}).transmissionFactor=e.transmission,e.transmissionMap&&(a={index:n.processTexture(e.transmissionMap)},n.applyTextureTransform(a,e.transmissionMap),i.transmissionTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),je=function(){function e(t){me(this,e),this.writer=t,this.name="KHR_materials_volume"}return ge(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&0!==e.transmission&&(r=(n=this.writer).extensionsUsed,(i={}).thicknessFactor=e.thickness,e.thicknessMap&&(a={index:n.processTexture(e.thicknessMap)},n.applyTextureTransform(a,e.thicknessMap),i.thicknessTexture=a),i.attenuationDistance=e.attenuationDistance,i.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}();function He(){He=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=(p="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",i=p.asyncIterator||"@@asyncIterator",a=p.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(t){s=function(e,t,n){return e[t]=n}}function o(e,t,n,r){var i,a,s,o;return t=t&&t.prototype instanceof c?t:c,t=Object.create(t.prototype),r=new x(r||[]),t._invoke=(i=e,a=n,s=r,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 n=s.delegate;if(n&&(n=function e(t,n){var r=t.iterator[n.method];if(void 0===r){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=void 0,e(t,n),"throw"===n.method))return u;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}return"throw"===(r=l(r,t.iterator,n.arg)).type?(n.method="throw",n.arg=r.arg,n.delegate=null,u):(r=r.arg)?r.done?(n[t.resultName]=r.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,u):r:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,u)}(n,s),n)){if(n===u)continue;return n}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"===(n=l(i,a,s)).type){if(o=s.done?"completed":"suspendedYield",n.arg===u)continue;return{value:n.arg,done:s.done}}"throw"===n.type&&(o="completed",s.method="throw",s.arg=n.arg)}}),t}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=o;var u={};function c(){}function h(){}function d(){}var p,f,m=(s(p={},r,(function(){return this})),(f=(f=Object.getPrototypeOf)&&f(f(w([]))))&&f!==t&&n.call(f,r)&&(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 r;this._invoke=function(i,a){function s(){return new t((function(r,s){!function r(i,a,s,o){var u;if("throw"!==(i=l(e[i],e,a)).type)return(a=(u=i.arg).value)&&"object"==Ve(a)&&n.call(a,"__await")?t.resolve(a.__await).then((function(e){r("next",e,s,o)}),(function(e){r("throw",e,s,o)})):t.resolve(a).then((function(e){u.value=e,s(u)}),(function(e){return r("throw",e,s,o)}));o(i.arg)}(i,a,r,s)}))}return r=r?r.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[r];if(i)return i.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(i=function r(){for(;++t<e.length;)if(n.call(e,t))return r.value=e[t],r.done=!1,r;return r.value=void 0,r.done=!0,r}).next=i}return{next: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,n,r,i,a){void 0===a&&(a=Promise);var s=new g(o(t,n,r,i),a);return e.isGeneratorFunction(n)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},v(m),s(m,a,"Generator"),s(m,r,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,n=[];for(t in e)n.push(t);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=w,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(b),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return s.type="throw",s.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;0<=i;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var o=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(o&&l){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(o){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;0<=r;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}var 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 n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),b(n),u}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var n,r,i=this.tryEntries[t];if(i.tryLoc===e)return"throw"===(n=i.completion).type&&(r=n.arg,b(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:w(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},e}function ze(e,t,n,r,i,a,s){try{var o=e[a](s),l=o.value}catch(e){return void n(e)}o.done?t(l):Promise.resolve(l).then(r,i)}function Ve(e){return(Ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Je(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ke(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ze(e,t,n){t&&Ke(e.prototype,t),n&&Ke(e,n),Object.defineProperty(e,"prototype",{writable:!1})}ye.Utils={insertKeyframe:function(e,t){var n,r=e.getValueSize(),i=new e.TimeBufferType(e.times.length+1),a=new e.ValueBufferType(e.values.length+r),s=e.createInterpolant(new e.ValueBufferType(r));if(0===e.times.length){i[0]=t;for(var o=0;o<r;o++)a[o]=0;n=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<.001)return 0;i[0]=t,i.set(e.times,1),a.set(s.evaluate(t),0),a.set(e.values,r),n=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<.001)return e.times.length-1;i[i.length-1]=t,i.set(e.times,0),a.set(e.values,0),a.set(s.evaluate(t),e.values.length),n=i.length-1}else for(var l=0;l<e.times.length;l++){if(Math.abs(e.times[l]-t)<.001)return l;if(e.times[l]<t&&e.times[l+1]>t){i.set(e.times.slice(0,l+1),0),i[l+1]=t,i.set(e.times.slice(l+1),l+2),a.set(e.values.slice(0,(l+1)*r),0),a.set(s.evaluate(t),(l+1)*r),a.set(e.values.slice((l+1)*r),(l+2)*r),n=l+1;break}}return e.times=i,e.values=a,n},mergeMorphTargetTracks:function(e,t){for(var r=[],i={},a=e.tracks,s=0;s<a.length;++s){var o=a[s],l=n.PropertyBinding.parseTrackName(o.name),u=n.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(n.InterpolateLinear)}var c=u.morphTargetInfluences.length,h=u.morphTargetDictionary[l.propertyIndex];if(void 0===h)throw new Error("THREE.GLTFExporter: Morph target name not found: "+l.propertyIndex);var d=void 0;if(void 0===i[u.uuid]){for(var p=new((d=o.clone()).ValueBufferType)(c*d.times.length),f=0;f<d.times.length;f++)p[f*c+h]=d.values[f];d.name=(l.nodeName||"")+".morphTargetInfluences",d.values=p,i[u.uuid]=d,r.push(d)}else{var m=o.createInterpolant(new o.ValueBufferType(1));d=i[u.uuid];for(var v=0;v<d.times.length;v++)d.values[v*c+h]=m.evaluate(d.times[v]);for(var g=0;g<o.times.length;g++){var y=this.insertKeyframe(d,o.times[g]);d.values[y*c+h]=o.values[g]}}}}return e.tracks=r,e}};var We=function(){function e(){Je(this,e),this.pluginCallbacks=[],this.register((function(e){return new at(e)})),this.register((function(e){return new st(e)})),this.register((function(e){return new ot(e)})),this.register((function(e){return new ut(e)})),this.register((function(e){return new ct(e)})),this.register((function(e){return new lt(e)}))}return Ze(e,[{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,n,r){"object"===Ve(n)&&(console.warn("THREE.GLTFExporter: parse() expects options as the fourth argument now."),r=n);for(var i=new it,a=[],s=0,o=this.pluginCallbacks.length;s<o;s++)a.push(this.pluginCallbacks[s](i));i.setPlugins(a),i.write(e,t,r).catch(n)}},{key:"parseAsync",value:function(e,t){var n=this;return new Promise((function(r,i){n.parse(e,r,i,t)}))}}]),e}(),Xe=5121,Qe=5123,Ye=(N=9728,Se=9729,Me=9984,we=9985,Ae=9986,Be=9987,Ce=33071,Ee=33648,_e=10497,{}),qe=(Ye[n.NearestFilter]=N,Ye[n.NearestMipmapNearestFilter]=Me,Ye[n.NearestMipmapLinearFilter]=Ae,Ye[n.LinearFilter]=Se,Ye[n.LinearMipmapNearestFilter]=we,Ye[n.LinearMipmapLinearFilter]=Be,Ye[n.ClampToEdgeWrapping]=Ce,Ye[n.RepeatWrapping]=_e,Ye[n.MirroredRepeatWrapping]=Ee,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"});function $e(e,t){return e.length===t.length&&e.every((function(e,n){return e===t[n]}))}function et(e){return 4*Math.ceil(e/4)}function tt(e,t){var n=1<arguments.length&&void 0!==t?t:0,r=et(e.byteLength);if(r===e.byteLength)return e;var i=new Uint8Array(r);if(i.set(new Uint8Array(e)),0!==n)for(var a=e.byteLength;a<r;a++)i[a]=n;return i.buffer}var nt=null;function rt(){return nt=nt||("undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"))}var it=function(){function e(){Je(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 Ze(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=He().mark((function e(t,n,r){var i,a,s,o,l;return He().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.options=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(t),e.next=5,Promise.all(this.pending);case 5:a=(s=this).buffers,i=s.json,r=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===r.binary?((o=new FileReader).readAsArrayBuffer(a),o.onloadend=function(){var e=tt(o.result),t=new DataView(new ArrayBuffer(8)),r=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),tt((r=JSON.stringify(i),(new TextEncoder).encode(r).buffer),32)),a=new DataView(new ArrayBuffer(8)),s=(a.setUint32(0,r.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+r.byteLength+t.byteLength+e.byteLength),u=(u.setUint32(8,l,!0),new Blob([s,a,r,t,e],{type:"application/octet-stream"})),c=new FileReader;c.readAsArrayBuffer(u),c.onloadend=function(){n(c.result)}}):i.buffers&&0<i.buffers.length?((l=new FileReader).readAsDataURL(a),l.onloadend=function(){var e=l.result;i.buffers[0].uri=e,n(i)}):n(i);case 15:case"end":return e.stop()}}),e,this)})),r=function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function s(e){ze(a,r,i,s,o,"next",e)}function o(e){ze(a,r,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 n=this.options,r=this.extensionsUsed;try{var i=JSON.parse(JSON.stringify(e.userData));if(n.includeCustomExtensions&&i.gltfExtensions){for(var a in void 0===t.extensions&&(t.extensions={}),i.gltfExtensions)t.extensions[a]=i.gltfExtensions[a],r[a]=!0;delete i.gltfExtensions}0<Object.keys(i).length&&(t.extras=i)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}}},{key:"getUID",value:function(e){return this.uids.has(e)||this.uids.set(e,this.uid++),this.uids.get(e)}},{key:"isNormalizedNormalAttribute",value:function(e){if(this.cache.attributesNormalized.has(e))return!1;for(var t=new n.Vector3,r=0,i=e.count;r<i;r++)if(5e-4<Math.abs(t.fromBufferAttribute(e,r).length()-1))return!1;return!0}},{key:"createNormalizedNormalAttribute",value:function(e){var t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);for(var r=e.clone(),i=new n.Vector3,a=0,s=r.count;a<s;a++)i.fromBufferAttribute(r,a),0===i.x&&0===i.y&&0===i.z?i.setX(1):i.normalize(),r.setXYZ(a,i.x,i.y,i.z);return t.attributesNormalized.set(e,r),r}},{key:"applyTextureTransform",value:function(e,t){var n=!1,r={};0===t.offset.x&&0===t.offset.y||(r.offset=t.offset.toArray(),n=!0),0!==t.rotation&&(r.rotation=t.rotation,n=!0),1===t.repeat.x&&1===t.repeat.y||(r.scale=t.repeat.toArray(),n=!0),n&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=r,this.extensionsUsed.KHR_texture_transform=!0)}},{key:"buildMetalRoughTexture",value:function(e,t){if(e===t)return e;console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures.");var r=null==e?void 0:e.image,i=null==t?void 0:t.image,a=Math.max((null==r?void 0:r.width)||0,(null==i?void 0:i.width)||0),s=Math.max((null==r?void 0:r.height)||0,(null==i?void 0:i.height)||0),o=rt(),l=(o.width=a,o.height=s,o.getContext("2d")),u=(l.fillStyle="#00ffff",l.fillRect(0,0,a,s),l.getImageData(0,0,a,s));if(r){l.drawImage(r,0,0,a,s);for(var c=l.getImageData(0,0,a,s).data,h=2;h<c.length;h+=4)u.data[h]=c[h]}if(i){l.drawImage(i,0,0,a,s);for(var d=l.getImageData(0,0,a,s).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 n.Source(o),r}},{key:"processBuffer",value:function(e){var t=this.json,n=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),n.push(e),0}},{key:"processBufferView",value:function(e,t,n,r,i){for(var a,s=this.json,o=(s.bufferViews||(s.bufferViews=[]),a=t===Xe?1:t===Qe?2:4,et(r*e.itemSize*a)),l=new DataView(new ArrayBuffer(o)),u=0,c=n;c<n+r;c++)for(var h=0;h<e.itemSize;h++){var d=void 0;4<e.itemSize?d=e.array[c*e.itemSize+h]:0===h?d=e.getX(c):1===h?d=e.getY(c):2===h?d=e.getZ(c):3===h&&(d=e.getW(c)),5126===t?l.setFloat32(u,d,!0):5125===t?l.setUint32(u,d,!0):t===Qe?l.setUint16(u,d,!0):t===Xe&&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,n=t.json;return n.bufferViews||(n.bufferViews=[]),new Promise((function(r){var i=new FileReader;i.readAsArrayBuffer(e),i.onloadend=function(){var e=tt(i.result),a={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,r(n.bufferViews.push(a)-1)}}))}},{key:"processAccessor",value:function(e,t,n,r){var i,a=this.options,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=Qe;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");i=Xe}if(void 0===n&&(n=0),void 0===r&&(r=e.count),a.truncateDrawRange&&void 0!==t&&null===t.index&&(a=n+r,l=t.drawRange.count===1/0?e.count:t.drawRange.start+t.drawRange.count,n=Math.max(n,t.drawRange.start),(r=Math.min(a,l)-n)<0&&(r=0)),0===r)return null;a=function(e,t,n){for(var r={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},i=t;i<t+n;i++)for(var a=0;a<e.itemSize;a++){var 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)),r.min[a]=Math.min(r.min[a],s),r.max[a]=Math.max(r.max[a],s)}return r}(e,n,r);var o,l=(void 0!==t&&(o=e===t.index?34963:34962),this.processBufferView(e,i,n,r,o));return t={bufferView:l.id,byteOffset:l.byteOffset,componentType:i,count:r,max:a.max,min:a.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]},!0===e.normalized&&(t.normalized=!0),s.accessors||(s.accessors=[]),s.accessors.push(t)-1}},{key:"processImage",value:function(e,t,r){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"image/png",a=this,s=a.cache,o=a.json,l=a.options,u=a.pending,c=(s.images.has(e)||s.images.set(e,{}),s=s.images.get(e),i+":flipY/"+r.toString());if(void 0!==s[c])return s[c];o.images||(o.images=[]);var h={mimeType:i};if(l.embedImages){var d=rt(),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!==n.RGBAFormat&&console.error("GLTFExporter: Only RGBAFormat is supported."),(e.width>l.maxTextureSize||e.height>l.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);for(var 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,i)})):d.convertToBlob({type:i}),u.push(r.then((function(e){return a.processBufferViewImage(e).then((function(e){h.bufferView=e}))})))):h.uri=d.toDataURL(i)}else h.uri=e.src;return t=o.images.push(h)-1,s[c]=t}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter:Ye[e.magFilter],minFilter:Ye[e.minFilter],wrapS:Ye[e.wrapS],wrapT:Ye[e.wrapT]},t.samplers.push(e)-1}},{key:"processTexture",value:function(e){var t=this.cache,n=this.json;if(t.textures.has(e))return t.textures.get(e);n.textures||(n.textures=[]);var r=("image/webp"===(i=e.userData.mimeType)&&(i="image/png"),{sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,i)}),i=(e.name&&(r.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,r)})),n.textures.push(r)-1);return t.textures.set(e,i),i}},{key:"processMaterial",value:function(e){var t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);var i={pbrMetallicRoughness:{}},a=(!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results."),e.color.toArray().concat([e.opacity])),s=($e(a,[1,1,1,1])||(i.pbrMetallicRoughness.baseColorFactor=a),e.isMeshStandardMaterial?(i.pbrMetallicRoughness.metallicFactor=e.metalness,i.pbrMetallicRoughness.roughnessFactor=e.roughness):(i.pbrMetallicRoughness.metallicFactor=.5,i.pbrMetallicRoughness.roughnessFactor=.5),(e.metalnessMap||e.roughnessMap)&&(a=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),s={index:this.processTexture(a)},this.applyTextureTransform(s,a),i.pbrMetallicRoughness.metallicRoughnessTexture=s),e.map&&(a={index:this.processTexture(e.map)},this.applyTextureTransform(a,e.map),i.pbrMetallicRoughness.baseColorTexture=a),e.emissive&&(s=e.emissive.clone().multiplyScalar(e.emissiveIntensity),1<(a=Math.max(s.r,s.g,s.b))&&(s.multiplyScalar(1/a),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),0<a&&(i.emissiveFactor=s.toArray()),e.emissiveMap&&(a={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(a,e.emissiveMap),i.emissiveTexture=a)),e.normalMap&&(s={index:this.processTexture(e.normalMap)},e.normalScale&&1!==e.normalScale.x&&(s.scale=e.normalScale.x),this.applyTextureTransform(s,e.normalMap),i.normalTexture=s),e.aoMap&&(a={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),i.occlusionTexture=a),e.transparent?i.alphaMode="BLEND":0<e.alphaTest&&(i.alphaMode="MASK",i.alphaCutoff=e.alphaTest),e.side===n.DoubleSide&&(i.doubleSided=!0),""!==e.name&&(i.name=e.name),this.serializeUserData(e,i),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,i)})),r.materials.push(i)-1);return t.materials.set(e,s),s}},{key:"processMesh",value:function(e){var t=this.cache,r=this.json,i=[e.geometry.uuid];if(Array.isArray(e.material))for(var a=0,s=e.material.length;a<s;a++)i.push(e.material[a].uuid);else i.push(e.material.uuid);var o=i.join(":");if(t.meshes.has(o))return t.meshes.get(o);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 n.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={},_=!1;for(B in l.morphAttributes)if("position"!==B&&"normal"!==B)_||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),_=!0);else{var E=l.morphAttributes[B][M],T=B.toUpperCase(),D=l.attributes[B];if(t.attributes.has(this.getUID(E)))C[T]=t.attributes.get(this.getUID(E));else{var P=E.clone();if(!l.morphTargetsRelative)for(var O=0,R=E.count;O<R;O++)P.setXYZ(O,E.getX(O)-D.getX(O),E.getY(O)-D.getY(O),E.getZ(O)-D.getZ(O));C[T]=this.processAccessor(P,l),t.attributes.set(this.getUID(D),C[T])}}v.push(C),x.push(e.morphTargetInfluences[M]),void 0!==e.morphTargetDictionary&&w.push(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(o,y),y}},{key:"processCamera",value:function(e){var t=this.json,r=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),i={type:r?"orthographic":"perspective"};return r?i.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:i.perspective={aspectRatio:e.aspect,yfov:n.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(i.name=e.type),t.cameras.push(i)-1}},{key:"processAnimation",value:function(e,t){for(var r=this.json,i=this.nodeMap,a=(r.animations||(r.animations=[]),(e=We.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks),s=[],o=[],l=0;l<a.length;++l){var u=a[l],c=n.PropertyBinding.parseTrackName(u.name),h=n.PropertyBinding.findNode(t,c.nodeName),d=qe[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===qe.morphTargetInfluences&&(c/=h.morphTargetInfluences.length));!0===u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(p="CUBICSPLINE",c/=3):p=u.getInterpolation()===n.InterpolateDiscrete?"STEP":"LINEAR",o.push({input:this.processAccessor(new n.BufferAttribute(u.times,1)),output:this.processAccessor(new n.BufferAttribute(u.values,c)),interpolation:p}),s.push({sampler:o.length-1,target:{node:i.get(h),path:d}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:o,channels:s}),r.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,r=this.nodeMap,i=t.nodes[r.get(e)],a=e.skeleton;if(void 0===a)return null;var s=e.skeleton.bones[0];if(void 0===s)return null;for(var o=[],l=new Float32Array(16*a.bones.length),u=new n.Matrix4,c=0;c<a.bones.length;++c)o.push(r.get(a.bones[c])),u.copy(a.boneInverses[c]),u.multiply(e.bindMatrix).toArray(l,16*c);return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new n.BufferAttribute(l,16)),joints:o,skeleton:r.get(s)}),i.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,n,r=this.json,i=this.options,a=this.nodeMap,s=(r.nodes||(r.nodes=[]),{});if(i.trs?(n=e.quaternion.toArray(),h=e.position.toArray(),t=e.scale.toArray(),$e(n,[0,0,0,1])||(s.rotation=n),$e(h,[0,0,0])||(s.translation=h),$e(t,[1,1,1])||(s.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===$e(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!==(n=this.processMesh(e))&&(s.mesh=n):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=r.nodes.push(s)-1;return a.set(e,h),h}},{key:"processScene",value:function(e){for(var t=this.json,n=this.options,r=(t.scenes||(t.scenes=[],t.scene=0),{}),i=(""!==e.name&&(r.name=e.name),t.scenes.push(r),[]),a=0,s=e.children.length;a<s;a++){var o=e.children[a];!o.visible&&!1!==n.onlyVisible||null!==(o=this.processNode(o))&&i.push(o)}0<i.length&&(r.nodes=i),this.serializeUserData(e,r)}},{key:"processObjects",value:function(e){var t=new n.Scene;t.name="AuxScene";for(var r=0;r<e.length;r++)t.children.push(e[r]);this.processScene(t)}},{key:"processInput",value:function(e){for(var t=this.options,r=(e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)})),[]),i=0;i<e.length;i++)e[i]instanceof n.Scene?this.processScene(e[i]):r.push(e[i]);0<r.length&&this.processObjects(r);for(var a=0;a<this.skins.length;++a)this.processSkin(this.skins[a]);for(var s=0;s<t.animations.length;++s)this.processAnimation(t.animations[s],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}},{key:"_invokeAll",value:function(e){for(var t=0,n=this.plugins.length;t<n;t++)e(this.plugins[t])}}]),e}(),at=function(){function e(t){Je(this,e),this.writer=t,this.name="KHR_lights_punctual"}return Ze(e,[{key:"writeNode",value:function(e,t){var n,r,i;e.isLight&&(e.isDirectionalLight||e.isPointLight||e.isSpotLight?(n=(i=this.writer).json,i=i.extensionsUsed,r={},e.name&&(r.name=e.name),r.color=e.color.toArray(),r.intensity=e.intensity,e.isDirectionalLight?r.type="directional":e.isPointLight?(r.type="point",0<e.distance&&(r.range=e.distance)):e.isSpotLight&&(r.type="spot",0<e.distance&&(r.range=e.distance),r.spot={},r.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,r.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),i[this.name]||(n.extensions=n.extensions||{},n.extensions[this.name]={lights:[]},i[this.name]=!0),(i=n.extensions[this.name].lights).push(r),t.extensions=t.extensions||{},t.extensions[this.name]={light:i.length-1}):console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e))}}]),e}(),st=function(){function e(t){Je(this,e),this.writer=t,this.name="KHR_materials_unlit"}return Ze(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}(),ot=function(){function e(t){Je(this,e),this.writer=t,this.name="KHR_materials_pbrSpecularGlossiness"}return Ze(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isGLTFSpecularGlossinessMaterial&&(r=(n=this.writer).extensionsUsed,i={},t.pbrMetallicRoughness.baseColorFactor&&(i.diffuseFactor=t.pbrMetallicRoughness.baseColorFactor),e.specular.toArray(a=[1,1,1],0),i.specularFactor=a,i.glossinessFactor=e.glossiness,t.pbrMetallicRoughness.baseColorTexture&&(i.diffuseTexture=t.pbrMetallicRoughness.baseColorTexture),e.specularMap&&(a={index:n.processTexture(e.specularMap)},n.applyTextureTransform(a,e.specularMap),i.specularGlossinessTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),lt=function(){function e(t){Je(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return Ze(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&(r=(n=this.writer).extensionsUsed,(i={}).clearcoatFactor=e.clearcoat,e.clearcoatMap&&(a={index:n.processTexture(e.clearcoatMap)},n.applyTextureTransform(a,e.clearcoatMap),i.clearcoatTexture=a),i.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap&&(a={index:n.processTexture(e.clearcoatRoughnessMap)},n.applyTextureTransform(a,e.clearcoatRoughnessMap),i.clearcoatRoughnessTexture=a),e.clearcoatNormalMap&&(a={index:n.processTexture(e.clearcoatNormalMap)},n.applyTextureTransform(a,e.clearcoatNormalMap),i.clearcoatNormalTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),ut=function(){function e(t){Je(this,e),this.writer=t,this.name="KHR_materials_transmission"}return Ze(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&0!==e.transmission&&(r=(n=this.writer).extensionsUsed,(i={}).transmissionFactor=e.transmission,e.transmissionMap&&(a={index:n.processTexture(e.transmissionMap)},n.applyTextureTransform(a,e.transmissionMap),i.transmissionTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),ct=function(){function e(t){Je(this,e),this.writer=t,this.name="KHR_materials_volume"}return Ze(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&0!==e.transmission&&(r=(n=this.writer).extensionsUsed,(i={}).thicknessFactor=e.thickness,e.thicknessMap&&(a={index:n.processTexture(e.thicknessMap)},n.applyTextureTransform(a,e.thicknessMap),i.thicknessTexture=a),i.attenuationDistance=e.attenuationDistance,i.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),ht=(We.Utils={insertKeyframe:function(e,t){var n,r=e.getValueSize(),i=new e.TimeBufferType(e.times.length+1),a=new e.ValueBufferType(e.values.length+r),s=e.createInterpolant(new e.ValueBufferType(r));if(0===e.times.length){i[0]=t;for(var o=0;o<r;o++)a[o]=0;n=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<.001)return 0;i[0]=t,i.set(e.times,1),a.set(s.evaluate(t),0),a.set(e.values,r),n=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<.001)return e.times.length-1;i[i.length-1]=t,i.set(e.times,0),a.set(e.values,0),a.set(s.evaluate(t),e.values.length),n=i.length-1}else for(var l=0;l<e.times.length;l++){if(Math.abs(e.times[l]-t)<.001)return l;if(e.times[l]<t&&e.times[l+1]>t){i.set(e.times.slice(0,l+1),0),i[l+1]=t,i.set(e.times.slice(l+1),l+2),a.set(e.values.slice(0,(l+1)*r),0),a.set(s.evaluate(t),(l+1)*r),a.set(e.values.slice((l+1)*r),(l+2)*r),n=l+1;break}}return e.times=i,e.values=a,n},mergeMorphTargetTracks:function(e,t){for(var r=[],i={},a=e.tracks,s=0;s<a.length;++s){var o=a[s],l=n.PropertyBinding.parseTrackName(o.name),u=n.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(n.InterpolateLinear)}var c=u.morphTargetInfluences.length,h=u.morphTargetDictionary[l.propertyIndex];if(void 0===h)throw new Error("THREE.GLTFExporter: Morph target name not found: "+l.propertyIndex);var d=void 0;if(void 0===i[u.uuid]){for(var p=new((d=o.clone()).ValueBufferType)(c*d.times.length),f=0;f<d.times.length;f++)p[f*c+h]=d.values[f];d.name=(l.nodeName||"")+".morphTargetInfluences",d.values=p,i[u.uuid]=d,r.push(d)}else{var m=o.createInterpolant(new o.ValueBufferType(1));d=i[u.uuid];for(var v=0;v<d.times.length;v++)d.values[v*c+h]=m.evaluate(d.times[v]);for(var g=0;g<o.times.length;g++){var y=this.insertKeyframe(d,o.times[g]);d.values[y*c+h]=o.values[g]}}}}return e.tracks=r,e}},__webpack_require__(272));class dt{constructor(e){this.map=new ht.Z,this.loadMap=new se.Z,this.exportMap=new se.Z,this.runScene=e,this.loadMap}bind(e){this.processMap(e),this.map.add(e)}processMap(e){e.loadCallBacks.map(((e,t)=>{let n=this.loadMap.get(e);n||(n=new ht.Z,this.loadMap.set(e,n)),n.add(t)})),e.exportCallBacks.map(((e,t)=>{let n=this.exportMap.get(e);n||(n=new ht.Z,this.exportMap.set(e,n)),n.add(t)}))}loadCallback(e){const{type:t,json:n,data:r,config:i,core:a}=e;return null==(e=this.loadMap.get(t))?void 0:e.map((e=>e({json:n,data:r,config:i,core:a})))}}var pt=__webpack_require__(625),ft=__webpack_require__(330),mt=__webpack_require__(269),vt=__webpack_require__(110),gt=__webpack_require__(932),yt=__webpack_require__(736),bt=__webpack_require__(723);class xt{constructor(e){this.materialMap={},this.textureMap={},this.modelType={Sprite:vt.Z},this.geoDefMaterialMap=new se.Z;var{type:e,runScene:t,helper:n}=e;this.type=e,this.helper=n,this.runScene=t}parse(e){var t=this.createTextureGroup(e);"scene"===this.type&&this.parseScene(t),this.parseModel(e),this.materialMapToJson(),this.setMultipMaterial(t,Object.keys(this.textureMap))}createTextureGroup(e){const t=new n.Group;return t.name="back-texture-ex",t.userData.isHelper=!0,e.add(t),t}parseScene(e){this.helper.ex=Object.assign(Object.assign({},this.helper.ex),this._getBaseEx(e))}_getBaseEx(e){var t=this.runScene.sceneEx.get(),n=this.runScene.assetsEx.get().controls,r=this.runScene.optionsEx.exporterOptions.outTime;return{version:{core:"0.0.75",gltf:"0.0.1",editor:"0.0.2"},base64:(0,bt.Ni)(String(r)),lights:mt.ZP.toJSON(this.runScene.lightEx.getLightsByScene()),camera:ee.Z.toJSON(this.runScene),sceneEx:Object.assign(Object.assign({},yt.ZP.toJSON(t,this.runScene)),this._bindSceneTextures(e)),timeLine:this.runScene.timeLineEx.getSavedData(),controls:ie.toJSON(n),objects:this.runScene.objects.toJSON(),tags:this.runScene.tags.toJSON(),options:this.runScene.exporter.gltf.options.getOptions(t)}}_bindSceneTextures(e){var t=this.runScene.sceneEx.get();const n={};if((0,pt.isTexture)(t.background)||(0,pt.isTexture)(t.environment)){this.runScene.pp.setUpdate(!1);const{background:r,environment:i}=t,a=(console.log(r,i," background, environment"),this.runScene.pp.setUpdate(!0),(0,Z.createDefModel)("Box")),s=(0,gt.createDefMaterial)();a.material=s,e.add(a),t=s.userData.id,n.materialId=t;let o=[];(0,pt.isTexture)(r)&&(r.userData.notCompress=!0,o.push({type:"map",texture:r}),303===(s.map=r).mapping&&(n.backgroundMapping=303)),(0,pt.isTexture)(i)&&(i.userData.notCompress=!0,o.push({type:"envMap",texture:i}),s.envMap=i),console.log(s,s.map,s.envMap,"material"),this.materialMap[t]={normalMaterial:s,models:[],normal:{},textures:o}}return n}compressLocal(e){var{x:t,y:n,z:r}=e.position;0===t&&0===n&&0===r||(e.position.set(0,0,0),e.userData.local=t+","+n+","+r)}parseModel(e){const t=new Set;e.traverse((e=>t.add(e))),t.forEach((e=>{this._processMaterial(e),this._processModel(e)}))}_processModel(e){var t;(0,Z.withAnima)(e)&&(t=e.animations.map((e=>e.toJSON())),(0,yt.M)(e,"animations",t));let n=e;const r=this.modelType[e.type];r&&(t=r.modelTools.toNormal(e),e.parent.add(t),e.parent.remove(e),n=t),this.runScene.optionsEx.options.hideLocal&&this.compressLocal(n)}_processMaterial(e){if((0,gt.isMaterial)(e.material)){const r=this.materialMap[e.material.userData.id];if(r)return r.normalMaterial&&(e.material=r.normalMaterial),void r.models.push(e);var t=this.runScene.materialEx.isBaseMaterial(e.material),n=e.material;const{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=n.userData.id,i.userData.id=t,this.materialMap[t]={oldMaterial:n,normalMaterial:i,models:[e],normal:a,textures:s}}}materialMapToJson(){(0,H.mapObj)(this.materialMap,((e,t)=>{var{normalMaterial:t,textures:n,normal:r}=t,i=t.userData.id;this.helper.ex.materialMap[i]||(this.helper.ex.materialMap[i]={normal:r,textures:{}},this.mergeAndRemoveTexture(n,t))}))}mergeSame(e){e.userData||(e.userData={});var t=e.userData;if((0,pt.isClonedTexture)(e))e=this.parseCloneTexture(e);else for(const a in this.textureMap){var n=this.textureMap[a],{md5:r,texture:i}=n;if(t.md5===r&&e.mapping===i.mapping&&!(0,pt.isClonedTexture)(n.texture))return{isSame:!0,texture:i}}return this.textureMap[e.userData.id]=Object.assign(Object.assign({},t),{texture:e}),{isSame:!1,texture:e}}mergeAndRemoveTexture(e,t){return function(e,t,n,r){return new(n=n||Promise)((function(t,i){function a(e){try{o(r.next(e))}catch(e){i(e)}}function s(e){try{o(r.throw(e))}catch(e){i(e)}}function o(e){var r;e.done?t(e.value):((r=e.value)instanceof n?r:new n((function(e){e(r)}))).then(a,s)}o((r=r.apply(e,[])).next())}))}(this,0,void 0,(function*(){return e.map((e=>{var{type:e,texture:n}=e;this.runScene.uniqueEx.texture.add(n),t[e]=null;const r=this.mergeSame(n).texture;if(!this.helper.ex.textureMap[r.userData.id]){var i,{format:n,repeat:a,center:s,rotation:o,offset:l}=r;const e={format:n};this.runScene.modelEx.isNavieV2(a,1)||(({x:n,y:i}=a),e.repeat=n===i?n:a),this.runScene.modelEx.isNavieV2(s,0)||(({x:i,y:n}=s),e.center=i===n?i:s),this.runScene.modelEx.isNavieV2(l,0)||(({x:a,y:n}=l),e.offset=a===n?a:l),0!==o&&(e.rotation=o),this.helper.ex.textureMap[r.userData.id]=e}"normalMap"!==e||r.userData.isNormalMap||(r.userData.isNormalMap=!0),this.helper.ex.materialMap[t.userData.id].textures[e]=r.userData.id}))}))}parseCloneTexture(e){const t=e.clone();t.userData=Object.assign({},e.userData);var{width:e,height:n}=e.image;const r=document.createElement("canvas");return r.width=e,r.height=n,t.image=r,t.userData.blob=new Blob([]),t}setMultipMaterial(e,t){const n=this.runScene.modelEx.create(),r=(0,gt.createDefMaterial)();n.material=r,e.add(n);for(const e of ft.sG){if(!t.length)return;var i=t.pop();if(!i)return;r[e]=this.textureMap[i].texture}t.length&&this.setMultipMaterial(e,t)}getMaterialFromModel(e){return e&&e.geometry?(e=e.geometry.uuid,this.geoDefMaterialMap.get(e)||this.geoDefMaterialMap.set(e,(0,gt.createDefMaterial)()),{material:this.geoDefMaterialMap.get(e),normal:{},textures:[]}):{material:this.runScene.materialEx.defMaterial,normal:{},textures:[]}}}var wt=__webpack_require__(729);class St extends z{constructor(){super(...arguments),this.savedMap=new se.Z,this.clonedMap=new se.Z}getSameNode(e){return this.savedMap.find(((t,n)=>n.materialUuid===e.material.uuid&&n.geometryUuid===e.geometry.uuid))}parseUnClonedModel(e){var t,n=(0,wt.K)(e);e.material&&e.geometry&&((t=this.getSameNode(e))&&(0,Z.setClonedModel)(e,t.id),this.savedMap.set(n,{id:n,geometryUuid:e.geometry.uuid,materialUuid:e.material.uuid}))}parseClonedModel(e){var t=(0,Z.getClonedIdModel)(e),n=(0,wt.K)(e);this.clonedMap.get(t)||this.clonedMap.set(t,{newId:void 0,ids:new Set});const r=this.clonedMap.get(t);r&&(r.ids.add(n),r.newId||this.runScene.uniqueEx.model.get(t)||(t=(0,wt.K)(e),r.newId=t),r.newId&&(r.newId!==n?(0,Z.setClonedModel)(e,r.newId):(0,Z.delClonedModel)(e)))}parseNode(e){(0,Z.getClonedIdModel)(e)?this.parseClonedModel(e):this.parseUnClonedModel(e)}}class At{constructor(){this.savedMap=new se.Z}getSameCount(e){return this.savedMap.filter(((t,n)=>n.geometry.attributes.normal.count===e),"value")}setSameNode(e,t){e.geometry=t}getSameGeo(e,t){var{normal:n,position:r,uv:i}=e.attributes;for(const e of t){var{normal:a,position:s,uv:o}=e.attributes;if(n.array.length===a.array.length&&r.array.length===s.array.length&&i.array.length===o.array.length&&(a=(0,bt.F1)([...n.array],[...a.array],20),s=(0,bt.F1)([...r.array],[...s.array],20),o=(0,bt.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,n=(n=t.attributes.normal).count;const i=this.getSameCount(n);if(i){var r=this.getSameGeo(t,i.map((e=>e.geometry)));if(r)return this.setSameNode(e,r)}this.savedMap.set(t.uuid,{count:n,geometry:t})}}}class Mt{constructor(){this.optionsConfigs={}}getParse(e){return this.optionsConfigs[e]}addOption(e){var t=e.type;if(this.optionsConfigs[t])throw TypeError("该配置项已被挂载");this.optionsConfigs[t]=e}getOptions(e){return Object.values(this.optionsConfigs).map((t=>{const{process:n,type:r}=t;return{type:r,data:n(e)}}))}}class Bt{constructor(e){this.helperModels=[],this.mergeSameGeo=new At;var{type:e,runScene:t,model:n}=e;this.runScene=t,this.type=e,this.bindClondId=new St(t),this.ex={materialMap:{},textureMap:{},type:e},this.before=new xt({helper:this,type:e,runScene:t}),this.before.parse(n)}parseNode(e){const{object:t,nodeDef:n}=e;this.mergeSameGeo.parseNode(t),this.bindClondId.parseNode(t),(0,H.mapObj)(this.runScene.modelEx.defNodeMap,((e,r)=>{t[e]!==r&&(n[e]=t[e])})),t.material&&t.material.wireframe&&(t.material.wireframe=!1,n.wireframe=!0)}parseMaterial(e){const{material:t,materialDef:n}=e;n.id=t.userData.id,this.ex.materialMap[t.userData.id]||(this.ex.materialMap[t.userData.id]={normal:{},textures:{}}),this.ex.materialMap[t.userData.id].normal=Object.assign(Object.assign({},this.ex.materialMap[t.userData.id].normal),this.runScene.materialEx.getDefNromals(t))}parseTexture(e){const{texture:t,textureDef:n}=e;var{notCompress:e,minFilter:r}=t.userData,{width:e,height:r}=(e&&(n.notCompress=!0),n.uvScript=t.userData.uvScript,n.md5=t.userData.md5,n.id=t.userData.id,r&&(n.minFilter=r),(0,pt.isClonedTexture)(t)&&(n.cloneSourceId=(0,pt.getCloneIdFromTexture)(t)),n.format=t.userData.format,(0,pt.getSizeByTexture)(t));n.size={w:e,h:r}}getNodeMapValueWithBone(e,t){for(const n of t.keys())if(n.userData.id===e.userData.id)return t.get(n)}done(e){e.asset.ex=this.ex,this.runScene.optionsEx.log([e,"json"]),this.runScene.cb.exporter.gltf.complete.cb({json:e})}}var Ct=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}))};class _t extends z{constructor(e){super(e),this._gltf=new ye,this._originGltf=new We,this.options=new Mt,this.module=new dt(e)}getArrayBuffer(e=this.runScene.sceneEx.getClear(),t){return Ct(this,void 0,void 0,(function*(){const n=new Bt({type:t,runScene:this.runScene,model:e});return new Promise((t=>{this._gltf.parse(e,(e=>{t(e)}),{binary:!0,onlyVisible:!1,includeCustomExtensions:!0,myOptions:{helper:n,optionsEx:this.runScene.optionsEx}})}))}))}getOriginArrayBuffer(e){return 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,i=[];if(0!==(i=r?[r]:this.runScene.multipSelector.getSelectedList("value")).length){var a=(r=i[0]).name||r.type;const e=new n.Group;e.name="models",Z.uselessGroup.set(e,!0),i.map((t=>e.add(this.runScene.modelEx.clone(t,!1))));var s=yield this.getArrayBuffer(e,"model");return t&&(0,H.downloadFile)(new Blob([s]),a+".glb"),s}}))}material(e){var t;return Ct(this,void 0,void 0,(function*(){if(n=e||(null==(t=this.runScene.modelEx.select)?void 0:t.material)){const e=(0,Z.createDefModel)("Group");let t=n;(t=n instanceof Array?t:[n]).map((t=>{const n=(0,Z.createDefModel)("Box");n.material=t,e.add(n)}));var n=n.name||"material",r=yield this.getArrayBuffer(e,"material");(0,H.downloadFile)(new Blob([r]),n+".glb")}}))}scene(e=!0,t="scene"){return Ct(this,void 0,void 0,(function*(){this.runScene.cb.exporter.gltf.before.cb(null);var n=yield this.getArrayBuffer(this.runScene.sceneEx.getClear(),t);return e&&(0,H.downloadFile)(new Blob([n]),"scene.glb"),n}))}originModel(e){return Ct(this,void 0,void 0,(function*(){var t,n;e&&(t=e.name||e.type,n=yield this.getOriginArrayBuffer(e),(0,H.downloadFile)(new Blob([n]),t+".glb"))}))}}class Et extends z{constructor(e){super(e),this.gltf=new _t(e)}}var Tt={},Dt=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},Pt=function(e){return new Worker(e)};try{URL.revokeObjectURL(Dt(""))}catch(zt){Dt=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)},Pt=function(e){return new Worker(e,{type:"module"})}}for(var Ot=Uint8Array,Rt=Uint16Array,It=Uint32Array,kt=new Ot([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]),Lt=new Ot([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]),Ft=new Ot([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ut=(N=function(e,t){for(var n=new Rt(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new It(n[30]);for(r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return[n,i]},(Me=N(kt,2))[0]),Gt=Me[1],Nt=(Ut[28]=258,Gt[258]=28,Ae=N(Lt,0))[0],jt=Ae[1],Ht=new Rt(32768),zt=0;zt<32768;++zt){var Vt=(43690&zt)>>>1|(21845&zt)<<1;Ht[zt]=((65280&(Vt=(61680&(Vt=(52428&Vt)>>>2|(13107&Vt)<<2))>>>4|(3855&Vt)<<4))>>>8|(255&Vt)<<8)>>>1}var Jt=function(e,t,n){for(var r=e.length,i=0,a=new Rt(t);i<r;++i)++a[e[i]-1];var s=new Rt(t);for(i=0;i<t;++i)s[i]=s[i-1]+a[i-1]<<1;if(n){var o=new Rt(1<<t),l=15-t;for(i=0;i<r;++i)if(e[i])for(var u=i<<4|e[i],c=t-e[i],h=s[e[i]-1]++<<c,d=h|(1<<c)-1;h<=d;++h)o[Ht[h]>>>l]=u}else for(o=new Rt(r),i=0;i<r;++i)e[i]&&(o[i]=Ht[s[e[i]-1]++]>>>15-e[i]);return o},Kt=new Ot(288);for(zt=0;zt<144;++zt)Kt[zt]=8;for(zt=144;zt<256;++zt)Kt[zt]=9;for(zt=256;zt<280;++zt)Kt[zt]=7;for(zt=280;zt<288;++zt)Kt[zt]=8;var Zt=new Ot(32);for(zt=0;zt<32;++zt)Zt[zt]=5;function Wt(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 Xt(e,t,n,r,i){var a,s=Cn(e,r,i,(function(e,n){e?(s.terminate(),t.ondata.call(t,e)):(n[1]&&s.terminate(),t.ondata.call(t,e,n[0],n[1]))}));s.postMessage(n),t.push=function(e,n){if(a)throw"stream finished";if(!t.ondata)throw"no stream handler";s.postMessage([e,a=n],[e.buffer])},t.terminate=function(){s.terminate()}}function Qt(e,t){return Fn(e,t)+4294967296*Fn(e,t+4)}var Yt=Jt(Kt,9,0),qt=Jt(Kt,9,1),$t=Jt(Zt,5,0),en=Jt(Zt,5,1),tn=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},nn=function(e,t,n){var r=t/8|0;return(e[r]|e[1+r]<<8)>>(7&t)&n},rn=function(e,t){var n=t/8|0;return(e[n]|e[1+n]<<8|e[2+n]<<16)>>(7&t)},an=function(e){return(e/8|0)+(7&e&&1)},sn=function(e,t,n){(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof Rt?Rt:e instanceof It?It:Ot)(n-(t=null==t||t<0?0:t));return r.set(e.subarray(t,n)),r},on=function(e,t,n){var r=e.length;if(!r||n&&!n.l&&r<5)return t||new Ot(0);function i(e){var n=t.length;n<e&&((n=new Ot(Math.max(2*n,e))).set(t),t=n)}var a=!t||n,s=!n||n.i,o=(n=n||{},t=t||new Ot(3*r),n.f||0),l=n.p||0,u=n.b||0,c=n.l,h=n.d,d=n.m,p=n.n,f=8*r;do{if(!c){n.f=o=nn(e,l,1);var m=nn(e,l+1,3);if(l+=3,!m){var v=e[(B=an(l)+4)-4]|e[B-3]<<8;if(r<(S=B+v)){if(s)throw"unexpected EOF";break}a&&i(u+v),t.set(e.subarray(B,S),u),n.b=u+=v,n.p=l=8*S;continue}if(1==m)c=qt,h=en,d=9,p=5;else{if(2!=m)throw"invalid block type";v=nn(e,l,31)+257;for(var g=nn(e,l+10,15)+4,y=v+nn(e,l+5,31)+1,b=(l+=14,new Ot(y)),x=new Ot(19),w=0;w<g;++w)x[Ft[w]]=nn(e,l+3*w,7);l+=3*g;var S,A=(1<<(S=tn(x)))-1,M=Jt(x,S,1);for(w=0;w<y;){var B,C=M[nn(e,l,A)];if(l+=15&C,(B=C>>>4)<16)b[w++]=B;else{var _=0,E=0;for(16==B?(E=3+nn(e,l,3),l+=2,_=b[w-1]):17==B?(E=3+nn(e,l,7),l+=3):18==B&&(E=11+nn(e,l,127),l+=7);E--;)b[w++]=_}}m=b.subarray(0,v);var T=b.subarray(v);d=tn(m),p=tn(T),c=Jt(m,d,1),h=Jt(T,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=(_=c[rn(e,l)&D])>>>4;if(f<(l+=15&_)){if(s)throw"unexpected EOF";break}if(!_)throw"invalid length/literal";if(R<256)t[u++]=R;else{if(256==R){O=l,c=null;break}var I,k=R-254,L=(264<R&&(I=kt[w=R-257],k=nn(e,l,(1<<I)-1)+Ut[w],l+=I),(R=h[rn(e,l)&P])>>>4);if(!R)throw"invalid distance";if(l+=15&R,T=Nt[L],3<L&&(I=Lt[L],T+=rn(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],t[u+1]=t[u+1-T],t[u+2]=t[u+2-T],t[u+3]=t[u+3-T];u=F}}n.l=c,n.p=O,n.b=u,c&&(o=1,n.m=d,n.d=h,n.n=p)}while(!o);return u==t.length?t:sn(t,0,u)},ln=function(e,t,n){var r=t/8|0;e[r]|=n<<=7&t,e[1+r]|=n>>>8},un=function(e,t,n){var r=t/8|0;e[r]|=n<<=7&t,e[1+r]|=n>>>8,e[2+r]|=n>>>16},cn=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return[gn,0];if(1==i)return(m=new Ot(n[0].s+1))[n[0].s]=1,[m,1];n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var s=n[0],o=n[1],l=0,u=1,c=2;for(n[0]={s:-1,f:s.f+o.f,l:s,r:o};u!=i-1;)s=n[n[l].f<n[c].f?l++:c++],o=n[l!=u&&n[l].f<n[c].f?l++:c++],n[u++]={s:-1,f:s.f+o.f,l:s,r:o};var h=a[0].s;for(r=1;r<i;++r)a[r].s>h&&(h=a[r].s);var d=new Rt(h+1),p=hn(n[u-1],d,0);if(t<p){r=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}));r<i;++r){var g=a[r].s;if(!(d[g]>t))break;f+=v-(1<<p-d[g]),d[g]=t}for(f>>>=m;0<f;){var y=a[r].s;d[y]<t?f-=1<<t-d[y]++-1:++r}for(;0<=r&&f;--r){var b=a[r].s;d[b]==t&&(--d[b],++f)}p=t}return[new Ot(d),p]},hn=function e(t,n,r){return-1==t.s?Math.max(e(t.l,n,r+1),e(t.r,n,r+1)):n[t.s]=r},dn=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Rt(++t),r=0,i=e[0],a=1,s=function(e){n[r++]=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[n.subarray(0,r),t]},pn=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},fn=function(e,t,n){var r=n.length,i=an(t+2);e[i]=255&r,e[i+1]=r>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var a=0;a<r;++a)e[i+a+4]=n[a];return 8*(i+4+r)},mn=function(e,t,n,r,i,a,s,o,l,u,c){ln(t,c++,n),++i[256];for(var h=(n=cn(i,15))[0],d=(n=n[1],(p=cn(a,15))[0]),p=p[1],f=(m=dn(h))[0],m=m[1],v=(g=dn(d))[0],g=g[1],y=new Rt(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=cn(y,7))[0],w=w[1],S=19;4<S&&!x[Ft[S-1]];--S);var A,M=u+5<<3,B=pn(i,Kt)+pn(a,Zt)+s;if(i=pn(i,h)+pn(a,d)+s+14+3*S+pn(y,x)+(2*y[16]+3*y[17]+7*y[18]),M<=B&&M<=i)return fn(t,c,e.subarray(l,l+u));if(ln(t,c,1+(i<B)),c+=2,i<B){var C=Jt(h,n,0),_=h,E=Jt(d,p,0),T=d,D=Jt(x,w,0);for(ln(t,c,m-257),ln(t,c+5,g-1),ln(t,c+10,S-4),c+=14,b=0;b<S;++b)ln(t,c+3*b,x[Ft[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];ln(t,c,D[I]),c+=x[I],15<I&&(ln(t,c,R[b]>>>5&127),c+=R[b]>>>12)}}}else C=Yt,_=Kt,E=$t,T=Zt;for(b=0;b<o;++b)255<r[b]?(I=r[b]>>>18&31,un(t,c,C[I+257]),c+=_[I+257],7<I&&(ln(t,c,r[b]>>>23&31),c+=kt[I]),A=31&r[b],un(t,c,E[A]),c+=T[A],3<A&&(un(t,c,r[b]>>>5&8191),c+=Lt[A])):(un(t,c,C[r[b]]),c+=_[r[b]]);return un(t,c,C[256]),c+_[256]},vn=new It([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),gn=new Ot(0),yn=function(e,t,n,r,i,a){var s=e.length,o=new Ot(r+s+5*(1+Math.ceil(s/7e3))+i),l=o.subarray(r,o.length-i),u=0;if(!t||s<8)for(var c=0;c<=s;c+=65535){var h=c+65535;u=h<s?fn(l,u,e.subarray(c,h)):(l[c]=a,fn(l,u,e.subarray(c,s)))}else{for(var d=(t=vn[t-1])>>>13,p=8191&t,f=(1<<n)-1,m=new Rt(32768),v=new Rt(1+f),g=Math.ceil(n/3),y=2*g,b=function(t){return(e[t]^e[t+1]<<g^e[t+2]<<y)&f},x=new It(25e3),w=new Rt(288),S=new Rt(32),A=0,M=0,B=(c=0,0),C=0,_=0;c<s;++c){var E=b(c),T=32767&c,D=v[E];if(m[T]=D,v[E]=T,C<=c){var P=s-c;if((7e3<A||24576<B)&&423<P){u=mn(e,l,0,x,w,S,M,B,_,c-_,u),B=A=M=0,_=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=T-D&32767;if(2<P&&E==b(c-L))for(var F=Math.min(d,P)-1,U=Math.min(32767,c),G=Math.min(258,P);L<=U&&--k&&T!=D;){if(e[c+R]==e[c+R-L]){for(var N=0;N<G&&e[c+N]==e[c+N-L];++N);if(R<N){if(I=L,F<(R=N))break;var j=Math.min(L,N-2),H=0;for(O=0;O<j;++O){var z=c-L+O+32768&32767,V=z-m[z]+32768&32767;H<V&&(H=V,D=z)}}}L+=(T=D)-(D=m[T])+32768&32767}I?(x[B++]=268435456|Gt[R]<<18|jt[I],E=31&Gt[R],P=31&jt[I],M+=kt[E]+Lt[P],++w[257+E],++S[P],C=c+R,++A):(x[B++]=e[c],++w[e[c]])}}u=mn(e,l,a,x,w,S,M,B,_,c-_,u),!a&&7&u&&(u=fn(l,u+1,gn))}return sn(o,0,r+an(u)+i)},bn=function(){for(var e=new It(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),xn=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=bn[255&n^t[r]]^n>>>8;e=n},d:function(){return~e}}},wn=function(){var e=1,t=0;return{p:function(n){for(var r=e,i=t,a=n.length,s=0;s!=a;){for(var o=Math.min(s+2655,a);s<o;++s)i+=r+=n[s];r=(65535&r)+15*(r>>16),i=(65535&i)+15*(i>>16)}e=r,t=i},d:function(){return(255&(e%=65521))<<24|e>>>8<<16|(255&(t%=65521))<<8|t>>>8}}},Sn=function(e,t,n,r,i){return yn(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,r,!i)},An=function(e,t){var n,r={};for(n in e)r[n]=e[n];for(n in t)r[n]=t[n];return r},Mn=function(e,t,n){for(var r=e(),i=(e=e.toString()).slice(e.indexOf("[")+1,e.lastIndexOf("]")).replace(/ /g,"").split(","),a=0;a<r.length;++a){var s=r[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 n[o]=s}return[t,n]},Bn=[],Cn=function(e,t,n,r){var i;if(!Bn[n]){for(var a="",s={},o=e.length-1,l=0;l<o;++l)a=(i=Mn(e[l],a,s))[0],s=i[1];Bn[n]=Mn(e[o],a,s)}var u=An({},Bn[n][1]);return function(e,t,n,r,i){return(t=Pt(Tt[t]||(Tt[t]=Dt(e)))).onerror=function(e){return i(e.error,null)},t.onmessage=function(e){return i(null,e.data)},t.postMessage(n,r),t}(Bn[n][0]+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",n,u,function(e){var t,n=[];for(t in e)(e[t]instanceof Ot||e[t]instanceof Rt||e[t]instanceof It)&&n.push((e[t]=new e[t].constructor(e[t])).buffer);return n}(u),r)},_n=function(){return[Ot,Rt,It,kt,Lt,Ft,Ut,Nt,qt,en,Ht,Jt,tn,nn,rn,an,sn,on,$n,Rn,In]},En=function(){return[Ot,Rt,It,kt,Lt,Ft,Gt,jt,Yt,Kt,$t,Zt,Ht,vn,gn,Jt,ln,un,cn,hn,dn,pn,fn,mn,an,sn,yn,Sn,Xn,Rn]},Tn=function(){return[Gn,Hn,Un,xn,bn]},Dn=function(){return[Nn,jn]},Pn=function(){return[zn,Un,wn]},On=function(){return[Vn]},Rn=function(e){return postMessage(e,[e.buffer])},In=function(e){return e&&e.size&&new Ot(e.size)},kn=function(e,t,n,r,i,a){var s=Cn(n,r,i,(function(e,t){s.terminate(),a(e,t)}));return s.postMessage([e,t],t.consume?[e.buffer]:[]),function(){s.terminate()}},Ln=function(e,t){return e[t]|e[t+1]<<8},Fn=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},Un=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},Gn=function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&Un(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;r<=n.length;++r)e[r+10]=n.charCodeAt(r)}},Nn=function(e){if(31!=e[0]||139!=e[1]||8!=e[2])throw"invalid gzip data";var t=e[3],n=10;4&t&&(n+=e[10]|2+(e[11]<<8));for(var r=(t>>3&1)+(t>>4&1);0<r;r-=!e[n++]);return n+(2&t)},jn=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},Hn=function(e){return 10+(e.filename&&e.filename.length+1||0)},zn=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)},Vn=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 Jn(e,t){return t||"function"!=typeof e||(t=e,e={}),this.ondata=t,e}var Kn=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(Sn(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}(),Zn=function(e,t){Xt([En,function(){return[Wt,Kn]}],this,Jn.call(this,e,t),(function(e){e=new Kn(e.data),onmessage=Wt(e)}),6)};function Wn(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return kn(e,t,[En],(function(e){return Rn(Xn(e.data[0],e.data[1]))}),0,n)}function Xn(e,t){return Sn(e,t||{},0,0)}var Qn=function(){function e(e){this.s={},this.p=new Ot(0),this.ondata=e}return e.prototype.e=function(e){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";var t=this.p.length,n=new Ot(t+e.length);n.set(this.p),n.set(e,t),this.p=n},e.prototype.c=function(e){this.d=this.s.i=e||!1,e=this.s.b;var t=on(this.p,this.o,this.s);this.ondata(sn(t,e,this.s.b),this.d),this.o=sn(t,this.s.b-32768),this.s.b=this.o.length,this.p=sn(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),Yn=function(e){this.ondata=e,Xt([_n,function(){return[Wt,Qn]}],this,0,(function(){var e=new Qn;onmessage=Wt(e)}),7)};function qn(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return kn(e,t,[_n],(function(e){return Rn($n(e.data[0],In(e.data[1])))}),1,n)}function $n(e,t){return on(e,t)}var er=function(){function e(e,t){this.c=xn(),this.l=0,this.v=1,Kn.call(this,e,t)}return e.prototype.push=function(e,t){Kn.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),this.l+=e.length,e=Sn(e,this.o,this.v&&Hn(this.o),t&&8,!t),this.v&&(Gn(e,this.o),this.v=0),t&&(Un(e,e.length-8,this.c.d()),Un(e,e.length-4,this.l)),this.ondata(e,t)},e}(),tr=function(e,t){Xt([En,Tn,function(){return[Wt,Kn,er]}],this,Jn.call(this,e,t),(function(e){e=new er(e.data),onmessage=Wt(e)}),8)};function nr(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return kn(e,t,[En,Tn,function(){return[rr]}],(function(e){return Rn(rr(e.data[0],e.data[1]))}),2,n)}function rr(e,t){t=t||{};var n=xn(),r=e.length,i=(n.p(e),e=Sn(e,t,Hn(t),8)).length;return Gn(e,t),Un(e,i-8,n.d()),Un(e,i-4,r),e}var ir=function(){function e(e){this.v=1,Qn.call(this,e)}return e.prototype.push=function(e,t){if(Qn.prototype.e.call(this,e),this.v){if((e=3<this.p.length?Nn(this.p):4)>=this.p.length&&!t)return;this.p=this.p.subarray(e),this.v=0}if(t){if(this.p.length<8)throw"invalid gzip stream";this.p=this.p.subarray(0,-8)}Qn.prototype.c.call(this,t)},e}(),ar=function(e){this.ondata=e,Xt([_n,Dn,function(){return[Wt,Qn,ir]}],this,0,(function(){var e=new ir;onmessage=Wt(e)}),9)};function sr(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return kn(e,t,[_n,Dn,function(){return[or]}],(function(e){return Rn(or(e.data[0]))}),3,n)}function or(e,t){return on(e.subarray(Nn(e),-8),t||new Ot(jn(e)))}var lr=function(){function e(e,t){this.c=wn(),this.v=1,Kn.call(this,e,t)}return e.prototype.push=function(e,t){Kn.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),e=Sn(e,this.o,this.v&&2,t&&4,!t),this.v&&(zn(e,this.o),this.v=0),t&&Un(e,e.length-4,this.c.d()),this.ondata(e,t)},e}(),ur=function(e,t){Xt([En,Pn,function(){return[Wt,Kn,lr]}],this,Jn.call(this,e,t),(function(e){e=new lr(e.data),onmessage=Wt(e)}),10)};function cr(e,t){t=t||{};var n=wn();return n.p(e),e=Sn(e,t,2,4),zn(e,t),Un(e,e.length-4,n.d()),e}var hr=function(){function e(e){this.v=1,Qn.call(this,e)}return e.prototype.push=function(e,t){if(Qn.prototype.e.call(this,e),this.v){if(this.p.length<2&&!t)return;this.p=this.p.subarray(2),this.v=0}if(t){if(this.p.length<4)throw"invalid zlib stream";this.p=this.p.subarray(0,-4)}Qn.prototype.c.call(this,t)},e}(),dr=function(e){this.ondata=e,Xt([_n,On,function(){return[Wt,Qn,hr]}],this,0,(function(){var e=new hr;onmessage=Wt(e)}),11)};function pr(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return kn(e,t,[_n,On,function(){return[fr]}],(function(e){return Rn(fr(e.data[0],In(e.data[1])))}),5,n)}function fr(e,t){return on((Vn(e),e.subarray(2,-4)),t)}var mr=function(){function e(e){this.G=ir,this.I=Qn,this.Z=hr,this.ondata=e}return e.prototype.push=function(e,t){if(!this.ondata)throw"no stream handler";var n,r;this.s?this.s.push(e,t):(this.p&&this.p.length?((n=new Ot(this.p.length+e.length)).set(this.p),n.set(e,this.p.length)):this.p=e,2<this.p.length&&((r=this).s=new(31==this.p[0]&&139==this.p[1]&&8==this.p[2]?this.G:8!=(15&this.p[0])||7<this.p[0]>>4||(this.p[0]<<8|this.p[1])%31?this.I:this.Z)((function(){r.ondata.apply(r,arguments)})),this.s.push(this.p,t),this.p=null))},e}(),vr=function(){function e(e){this.G=ar,this.I=Yn,this.Z=dr,this.ondata=e}return e.prototype.push=function(e,t){mr.prototype.push.call(this,e,t)},e}(),gr=function e(t,n,r,i){for(var a in t){var s=t[a];a=n+a,s instanceof Ot?r[a]=[s,i]:Array.isArray(s)?r[a]=[s[0],An(i,s[1])]:e(s,a+"/",r,i)}},yr="undefined"!=typeof TextEncoder&&new TextEncoder,br="undefined"!=typeof TextDecoder&&new TextDecoder,xr=0;try{br.decode(gn,{stream:!0}),xr=1}catch(zt){}var wr=function(e){for(var t="",n=0;;){var r=e[n++],i=(127<r)+(223<r)+(239<r);if(n+i>e.length)return[t,sn(e,n-1)];i?3==i?(r=((15&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t+=String.fromCharCode(55296|r>>10,56320|1023&r)):t+=1&i?String.fromCharCode((31&r)<<6|63&e[n++]):String.fromCharCode((15&r)<<12|(63&e[n++])<<6|63&e[n++]):t+=String.fromCharCode(r)}},Sr=function(){function e(e){this.ondata=e,xr?this.t=new TextDecoder:this.p=gn}return e.prototype.push=function(e,t){if(!this.ondata)throw"no callback";if(t=!!t,this.t){if(this.ondata(this.t.decode(e,{stream:!0}),t),t){if(this.t.decode().length)throw"invalid utf-8 data";this.t=null}}else{if(!this.p)throw"stream finished";var n=((n=new Ot(this.p.length+e.length)).set(this.p),n.set(e,this.p.length),e=wr(n))[0];if(e=e[1],t){if(e.length)throw"invalid utf-8 data";this.p=null}else this.p=e;this.ondata(n,t)}},e}(),Ar=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(Mr(e),this.d=t||!1)},e}();function Mr(e,t){if(t){for(var n=new Ot(e.length),r=0;r<e.length;++r)n[r]=e.charCodeAt(r);return n}if(yr)return yr.encode(e);var i=e.length,a=new Ot(e.length+(e.length>>1)),s=0,o=function(e){a[s++]=e};for(r=0;r<i;++r){s+5>a.length&&((l=new Ot(s+8+(i-r<<1))).set(a),a=l);var l=e.charCodeAt(r);l<128||t?o(l):(l<2048?o(192|l>>6):(55295<l&&l<57344?(o(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++r))>>18),o(128|l>>12&63)):o(224|l>>12),o(128|l>>6&63)),o(128|63&l))}return sn(a,0,s)}function Br(e,t){if(t){for(var n="",r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}if(br)return br.decode(e);var i=(t=wr(e))[0];if(t[1].length)throw"invalid utf-8 data";return i}function Cr(e){return 1==e?3:e<6?2:9==e?1:0}var _r=function(e,t){return t+30+Ln(e,t+26)+Ln(e,t+28)},Er=function(e,t,n){var r=Ln(e,t+28),i=Br(e.subarray(t+46,t+46+r),!(2048&Ln(e,t+8))),a=(r=t+46+r,Fn(e,t+20)),s=(a=(n=n&&4294967295==a?Tr(e,r):[a,Fn(e,t+24),Fn(e,t+42)])[0],n[1]);return n=n[2],[Ln(e,t+10),a,s,i,r+Ln(e,t+30)+Ln(e,t+32),n]},Tr=function(e,t){for(;1!=Ln(e,t);t+=4+Ln(e,t+2));return[Qt(e,t+12),Qt(e,t+4),Qt(e,t+20)]},Dr=function(e){var t=0;if(e)for(var n in e){if(65535<(n=e[n].length))throw"extra field too long";t+=n+4}return t},Pr=function(e,t,n,r,i,a,s,o){var l=r.length,u=n.extra,c=o&&o.length,h=Dr(u),d=(Un(e,t,null!=s?33639248:67324752),t+=4,null!=s&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(null==a&&8),e[t++]=i&&8,e[t++]=255&n.compression,e[t++]=n.compression>>8,i=new Date(null==n.mtime?Date.now():n.mtime)).getFullYear()-1980;if(d<0||119<d)throw"date not in range 1980-2099";if(Un(e,t,d<<25|i.getMonth()+1<<21|i.getDate()<<16|i.getHours()<<11|i.getMinutes()<<5|i.getSeconds()>>>1),t+=4,null!=a&&(Un(e,t,n.crc),Un(e,t+4,a),Un(e,t+8,n.size)),Un(e,t+12,l),Un(e,t+14,h),t+=16,null!=s&&(Un(e,t,c),Un(e,t+6,n.attrs),Un(e,t+10,s),t+=14),e.set(r,t),t+=l,h)for(var p in u){var f=u[p],m=f.length;Un(e,t,+p),Un(e,t+2,m),e.set(f,t+4),t+=4+m}return c&&(e.set(o,t),t+=c),t},Or=function(e,t,n,r,i){Un(e,t,101010256),Un(e,t+8,n),Un(e,t+10,n),Un(e,t+12,r),Un(e,t+16,i)},Rr=function(){function e(e){this.filename=e,this.c=xn(),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}(),Ir=function(){function e(e,t){var n=this;t=t||{},Rr.call(this,e),this.d=new Kn(t,(function(e,t){n.ondata(null,e,t)})),this.compression=8,this.flag=Cr(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){Rr.prototype.push.call(this,e,t)},e}(),kr=function(){function e(e,t){var n=this;t=t||{},Rr.call(this,e),this.d=new Zn(t,(function(e,t,r){n.ondata(e,t,r)})),this.compression=8,this.flag=Cr(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){Rr.prototype.push.call(this,e,t)},e}(),Lr=function(){function e(e){this.ondata=e,this.u=[],this.d=1}return e.prototype.add=function(e){var t=this;if(2&this.d)throw"stream finished";var n=Mr(e.filename),r=n.length,i=(a=e.comment)&&Mr(a),a=r!=e.filename.length||i&&a.length!=i.length,s=r+Dr(e.extra)+30;if(65535<r)throw"filename too long";function o(){for(var e=0,n=l;e<n.length;e++){var r=n[e];t.ondata(null,r,!1)}l=[]}r=new Ot(s);var l=(Pr(r,0,e,n,a),[r]),u=this.d,c=(this.d=0,this.u.length),h=An(e,{f:n,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(n,r,i){n?(t.ondata(n,r,i),t.terminate()):(d+=r.length,l.push(r),i?(n=new Ot(16),Un(n,0,134695760),Un(n,4,e.crc),Un(n,8,d),Un(n,12,e.size),l.push(n),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,n=0,r=0,i=this.u;r<i.length;r++)n+=46+(l=i[r]).f.length+Dr(l.extra)+(l.o?l.o.length:0);for(var a=new Ot(n+22),s=0,o=this.u;s<o.length;s++){var l=o[s];Pr(a,e,l,l.f,l.u,l.c,t,l.o),e+=46+l.f.length+Dr(l.extra)+(l.o?l.o.length:0),t+=l.b}Or(a,e,this.u.length,n,t),this.ondata(null,a,!0),this.d=2},e.prototype.terminate=function(){for(var e=0,t=this.u;e<t.length;e++)t[e].t();this.d=2},e}(),Fr=function(){function e(){}return e.prototype.push=function(e,t){this.ondata(null,e,t)},e.compression=0,e}(),Ur=function(){function e(){var e=this;this.i=new Qn((function(t,n){e.ondata(null,t,n)}))}return e.prototype.push=function(e,t){try{this.i.push(e,t)}catch(n){this.ondata(n,e,t)}},e.compression=8,e}(),Gr=function(){function e(e,t){var n=this;t<32e4?this.i=new Qn((function(e,t){n.ondata(null,e,t)})):(this.i=new Yn((function(e,t,r){n.ondata(e,t,r)})),this.terminate=this.i.terminate)}return e.prototype.push=function(e,t){this.i.terminate&&(e=sn(e,0)),this.i.push(e,t)},e.compression=8,e}(),Nr=function(){function e(e){this.onfile=e,this.k=[],this.o={0:Fr},this.p=gn}return e.prototype.push=function(e,t){var n=this;if(!this.onfile)throw"no callback";if(!this.p)throw"stream finished";if(0<this.c){var r=Math.min(this.c,e.length),i=e.subarray(0,r);if(this.c-=r,this.d?this.d.push(i,!this.c):this.k[0].push(i),(e=e.subarray(r)).length)return this.push(e,t)}else{for(var a=0,s=0,o=void 0,l=void 0,u=(this.p.length?e.length?((l=new Ot(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,r,i,d,p,f,m,v,g,y,b=Fn(l,s);return 67324752==b?(a=1,o=s,h.d=null,h.c=0,r=Ln(l,s+6),e=Ln(l,s+8),t=2048&r,r&=8,i=Ln(l,s+26),d=Ln(l,s+28),s+30+i+d<u&&(h.k.unshift(p=[]),a=2,f=Fn(l,s+18),m=Fn(l,s+22),v=Br(l.subarray(s+30,s+=30+i),!t),4294967295==f?(i=r?[-2]:Tr(l,s),f=i[0],m=i[1]):r&&(f=-1),s+=d,h.c=f,y={name:v,compression:e,start:function(){if(!y.ondata)throw"no callback";if(f){var t=n.o[e];if(!t)throw"unknown compression type "+e;(g=f<0?new t(v):new t(v,f,m)).ondata=function(e,t,n){y.ondata(e,t,n)};for(var r=0,i=p;r<i.length;r++)g.push(i[r],!1);n.k[0]==p&&n.c?n.d=g:g.push(gn,!0)}else y.ondata(null,gn,!0)},terminate:function(){g&&g.terminate&&g.terminate()}},0<=f&&(y.size=f,y.originalSize=m),h.onfile(y)),"break"):c?134695760==b?(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=gn,c<0&&(r=a?l.subarray(0,o-12-(-2==c&&8)-(134695760==Fn(l,o-16)&&4)):l.subarray(0,s),i?i.push(r,!!a):this.k[+(2==a)].push(r)),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 jr(e,t,n){var r=n.length-e-1;if(t>=n[r])return r-1;if(t<=n[e])return e;for(var i=e,a=r,s=Math.floor((i+a)/2);t<n[s]||t>=n[s+1];)t<n[s]?a=s:i=s,s=Math.floor((i+a)/2);return s}function Hr(e,t,n,r){for(var i=[],a=[],s=[],o=i[0]=1;o<=n;++o){a[o]=t-r[e+1-o],s[o]=r[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 zr(e,t,r,i,a){for(var s=a<e?a:e,o=[],l=jr(e,i,t),u=function(e,t,n,r,i){for(var a=[],s=0;s<=n;++s)a[s]=0;for(var o=[],l=0;l<=r;++l)o[l]=a.slice(0);for(var u=[],c=0;c<=n;++c)u[c]=a.slice(0);u[0][0]=1;for(var h=a.slice(0),d=a.slice(0),p=1;p<=n;++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<=n;++b)o[0][b]=u[b][n];for(var x=0;x<=n;++x){for(var w=0,S=1,A=[],M=0;M<=n;++M)A[M]=a.slice(0);for(var B=A[0][0]=1;B<=r;++B){var C=0,_=x-B,E=n-B;B<=x&&(A[S][0]=A[w][0]/u[1+E][_],C=A[S][0]*u[_][E]);for(var T=x-1<=E?B-1:n-x,D=-1<=_?1:-_;D<=T;++D)A[S][D]=(A[w][D]-A[w][D-1])/u[1+E][_+D],C+=A[S][D]*u[_+D][E];x<=E&&(A[S][B]=-A[w][B-1]/u[1+E][x],C+=A[S][B]*u[x][E]),o[B][x]=C;var P=w;w=S,S=P}}for(var O=n,R=1;R<=r;++R){for(var I=0;I<=n;++I)o[R][I]*=O;O*=n-R}return o}(l,i,e,s,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<=s;++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]));o[f]=m}for(var g=s+1;g<=a+1;++g)o[g]=new n.Vector4(0,0,0);return o}function Vr(e){for(var t=e.length,r=[],i=[],a=0;a<t;++a){var s=e[a];r[a]=new n.Vector3(s.x,s.y,s.z),i[a]=s.w}for(var o=[],l=0;l<t;++l){for(var u=r[l].clone(),c=1;c<=l;++c)u.sub(o[l-c].clone().multiplyScalar(function(e,t){for(var n=1,r=2;r<=e;++r)n*=r;for(var i=1,a=2;a<=t;++a)i*=a;for(var s=2;s<=e-t;++s)i*=s;return n/i}(l,c)*i[c]));o[l]=u.divideScalar(i[0])}return o}function Jr(e){return(Jr="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 Kr(e,t){return(Kr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Zr(e){return(Zr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Wr,Xr,Qr,Yr=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&&Kr(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Zr(e);if(n=t?(n=Zr(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===Jr(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e,t,a,s,o){var l;if(!(this instanceof i))throw new TypeError("Cannot call a class as a function");(l=r.call(this)).degree=e,l.knots=t,l.controlPoints=[],l.startKnot=s||0,l.endKnot=o||l.knots.length-1;for(var u=0;u<a.length;++u){var c=a[u];l.controlPoints[u]=new n.Vector4(c.x,c.y,c.z,c.w)}return l}return t=i,(e=[{key:"getPoint",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new n.Vector3;return e=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),e=function(e,t,r,i){for(var a=jr(e,i,t),s=Hr(a,i,e,t),o=new n.Vector4(0,0,0,0),l=0;l<=e;++l){var u=r[a-e+l],c=s[l],h=u.w*c;o.x+=u.x*h,o.y+=u.y*h,o.z+=u.z*h,o.w+=u.w*c}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 n.Vector3,r=(e=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),Vr(zr(r=this.degree,this.knots,this.controlPoints,e,1)));return t.copy(r[1]).normalize(),t}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(n.Curve);function qr(e){return(qr="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 ei(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ti(e,t,n){t&&ei(e.prototype,t),n&&ei(e,n),Object.defineProperty(e,"prototype",{writable:!1})}function ni(e,t){return(ni=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ri(e){return(ri=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ii=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&&ni(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ri(e);if(n=t?(n=ri(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===qr(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e){return $r(this,i),r.call(this,e)}return ti(i,[{key:"load",value:function(e,t,r,i){var a=this,s=""===a.path?n.LoaderUtils.extractUrlBase(e):a.path,o=new n.FileLoader(this.manager);o.setPath(a.path),o.setResponseType("arraybuffer"),o.setRequestHeader(a.requestHeader),o.setWithCredentials(a.withCredentials),o.load(e,(function(n){try{t(a.parse(n,s))}catch(n){i?i(n):console.error(n),a.manager.itemError(e)}}),r,i)}},{key:"parse",value:function(e,t){if(i="Kaydara FBX Binary \0",(r=e).byteLength>=i.length&&i===wi(r,0,i.length))Wr=(new ui).parse(e);else{if(!function(e){for(var t=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"],n=0,r=0;r<t.length;++r)if(function(t){var r=e[0];return e=e.slice(n+1),n++,r}()===t[r])return;return 1}(r=wi(e)))throw new Error("THREE.FBXLoader: Unknown format.");if(di(r)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+di(r));Wr=(new li).parse(r)}var r,i=new n.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new ai(i,this.manager).parse(Wr)}}]),i}(n.Loader),ai=function(){function e(t,n){$r(this,e),this.textureLoader=t,this.manager=n}return ti(e,[{key:"parse",value:function(){Xr=this.parseConnections();var e=this.parseImages(),t=(e=this.parseTextures(e),e=this.parseMaterials(e),this.parseDeformers()),n=(new si).parse(t);return this.parseScene(t,n,e),Qr}},{key:"parseConnections",value:function(){var e=new Map;return"Connections"in Wr&&Wr.Connections.connections.forEach((function(t){var n=t[0],r=t[1],i=(t=t[2],e.has(n)||e.set(n,{parents:[],children:[]}),{ID:r,relationship:t});e.get(n).parents.push(i),e.has(r)||e.set(r,{parents:[],children:[]}),i={ID:n,relationship:t},e.get(r).children.push(i)})),e}},{key:"parseImages",value:function(){var e,t={},n={};if("Video"in Wr.Objects){var r,i=Wr.Objects.Video;for(r in i){var a,s,o=i[r];t[parseInt(r)]=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[r]),n[o.RelativeFilename||o.Filename]=s))}}for(e in t){var l=t[e];void 0!==n[l]?t[e]=n[l]:t[e]=t[e].split("\\").pop()}return t}},{key:"parseImage",value:function(e){var t,n=e.Content,r=e.RelativeFilename||e.Filename,i=r.slice(r.lastIndexOf(".")+1).toLowerCase();switch(i){case"bmp":t="image/bmp";break;case"jpg":case"jpeg":t="image/jpeg";break;case"png":t="image/png";break;case"tif":t="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",r),t="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+i+'" is not supported.')}return"string"==typeof n?"data:"+t+";base64,"+n:(e=new Uint8Array(n),window.URL.createObjectURL(new Blob([e],{type:t})))}},{key:"parseTextures",value:function(e){var t=new Map;if("Texture"in Wr.Objects){var n,r=Wr.Objects.Texture;for(n in r){var i=this.parseTexture(r[n],e);t.set(parseInt(n),i)}}return t}},{key:"parseTexture",value:function(e,t){var r=((t=this.loadTexture(e,t)).ID=e.id,t.name=e.attrName,e.WrapModeU),i=e.WrapModeV;return r=void 0!==r?r.value:0,i=void 0!==i?i.value:0,t.wrapS=0===r?n.RepeatWrapping:n.ClampToEdgeWrapping,t.wrapT=0===i?n.RepeatWrapping:n.ClampToEdgeWrapping,"Scaling"in e&&(r=e.Scaling.value,t.repeat.x=r[0],t.repeat.y=r[1]),"Translation"in e&&(i=e.Translation.value,t.offset.x=i[0],t.offset.y=i[1]),t}},{key:"loadTexture",value:function(e,t){var r,i=this.textureLoader.path,a=Xr.get(e.id).children;return a="tga"===(void 0!==a&&0<a.length&&void 0!==t[a[0].ID]&&(0!==(r=t[a[0].ID]).indexOf("blob:")&&0!==r.indexOf("data:")||this.textureLoader.setPath(void 0)),t=e.FileName.slice(-3).toLowerCase())?null===(a=this.manager.getHandler(".tga"))?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),new n.Texture):(a.setPath(this.textureLoader.path),a.load(r)):"psd"===t?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),new n.Texture):this.textureLoader.load(r),this.textureLoader.setPath(i),a}},{key:"parseMaterials",value:function(e){var t=new Map;if("Material"in Wr.Objects){var n,r=Wr.Objects.Material;for(n in r){var i=this.parseMaterial(r[n],e);null!==i&&t.set(parseInt(n),i)}}return t}},{key:"parseMaterial",value:function(e,t){var r,i=e.id,a=e.attrName,s=e.ShadingModel;if("object"===qr(s)&&(s=s.value),!Xr.has(i))return null;switch(e=this.parseParameters(e,t,i),s.toLowerCase()){case"phong":r=new n.MeshPhongMaterial;break;case"lambert":r=new n.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',s),r=new n.MeshPhongMaterial}return r.setValues(e),r.name=a,r}},{key:"parseParameters",value:function(e,t,r){var i={},a=(e.BumpFactor&&(i.bumpScale=e.BumpFactor.value),e.Diffuse?i.color=(new n.Color).fromArray(e.Diffuse.value):!e.DiffuseColor||"Color"!==e.DiffuseColor.type&&"ColorRGB"!==e.DiffuseColor.type||(i.color=(new n.Color).fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=(new n.Color).fromArray(e.Emissive.value):!e.EmissiveColor||"Color"!==e.EmissiveColor.type&&"ColorRGB"!==e.EmissiveColor.type||(i.emissive=(new n.Color).fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(i.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(i.opacity=parseFloat(e.Opacity.value)),i.opacity<1&&(i.transparent=!0),e.ReflectionFactor&&(i.reflectivity=e.ReflectionFactor.value),e.Shininess&&(i.shininess=e.Shininess.value),e.Specular?i.specular=(new n.Color).fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(i.specular=(new n.Color).fromArray(e.SpecularColor.value)),this);return Xr.get(r).children.forEach((function(e){var r=e.relationship;switch(r){case"Bump":i.bumpMap=a.getTexture(t,e.ID);break;case"Maya|TEX_ao_map":i.aoMap=a.getTexture(t,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=a.getTexture(t,e.ID),void 0!==i.map&&(i.map.encoding=n.sRGBEncoding);break;case"DisplacementColor":i.displacementMap=a.getTexture(t,e.ID);break;case"EmissiveColor":i.emissiveMap=a.getTexture(t,e.ID),void 0!==i.emissiveMap&&(i.emissiveMap.encoding=n.sRGBEncoding);break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=a.getTexture(t,e.ID);break;case"ReflectionColor":i.envMap=a.getTexture(t,e.ID),void 0!==i.envMap&&(i.envMap.mapping=n.EquirectangularReflectionMapping,i.envMap.encoding=n.sRGBEncoding);break;case"SpecularColor":i.specularMap=a.getTexture(t,e.ID),void 0!==i.specularMap&&(i.specularMap.encoding=n.sRGBEncoding);break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=a.getTexture(t,e.ID),i.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",r)}})),i}},{key:"getTexture",value:function(e,t){return"LayeredTexture"in Wr.Objects&&t in Wr.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Xr.get(t).children[0].ID),e.get(t)}},{key:"parseDeformers",value:function(){var e={},t={};if("Deformer"in Wr.Objects){var n,r=Wr.Objects.Deformer;for(n in r){var i,a=r[n],s=Xr.get(parseInt(n));"Skin"===a.attrType?((i=this.parseSkeleton(s,r)).ID=n,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[n]=i):"BlendShape"===a.attrType&&((i={id:n}).rawTargets=this.parseMorphTargets(s,r),i.id=n,1<s.parents.length&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[n]=i)}}return{skeletons:e,morphTargets:t}}},{key:"parseSkeleton",value:function(e,t){var r=[];return e.children.forEach((function(e){var i=t[e.ID];"Cluster"===i.attrType&&(e={ID:e.ID,indices:[],weights:[],transformLink:(new n.Matrix4).fromArray(i.TransformLink.a)},"Indexes"in i&&(e.indices=i.Indexes.a,e.weights=i.Weights.a),r.push(e))})),{rawBones:r,bones:[]}}},{key:"parseMorphTargets",value:function(e,t){for(var n=[],r=0;r<e.children.length;r++){var i=e.children[r],a=t[i.ID],s={name:a.attrName,initialWeight:a.DeformPercent,id:a.id,fullWeights:a.FullWeights.a};if("BlendShapeChannel"!==a.attrType)return;s.geoID=Xr.get(parseInt(i.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,n.push(s)}return n}},{key:"parseScene",value:function(e,t,r){Qr=new n.Group;var i=this.parseModels(e.skeletons,t,r),a=Wr.Objects.Model,s=this;i.forEach((function(e){var t=a[e.ID];s.setLookAtProperties(e,t),Xr.get(e.ID).parents.forEach((function(t){void 0!==(t=i.get(t.ID))&&t.add(e)})),null===e.parent&&Qr.add(e)})),this.bindSkeleton(e.skeletons,t,i),this.createAmbientLight(),Qr.traverse((function(e){var t;e.userData.transformData&&(e.parent&&(e.userData.transformData.parentMatrix=e.parent.matrix,e.userData.transformData.parentMatrixWorld=e.parent.matrixWorld),t=yi(e.userData.transformData),e.applyMatrix4(t),e.updateWorldMatrix())})),r=(new oi).parse(),1===Qr.children.length&&Qr.children[0].isGroup&&(Qr.children[0].animations=r,Qr=Qr.children[0]),Qr.animations=r}},{key:"parseModels",value:function(e,t,r){var i,a=new Map,s=Wr.Objects.Model;for(i in s){var o=parseInt(i),l=s[i],u=Xr.get(o),c=this.buildSkeleton(u,e,o,l.attrName);if(!c){switch(l.attrType){case"Camera":c=this.createCamera(u);break;case"Light":c=this.createLight(u);break;case"Mesh":c=this.createMesh(u,t,r);break;case"NurbsCurve":c=this.createCurve(u,t);break;case"LimbNode":case"Root":c=new n.Bone;break;default:c=new n.Group}c.name=l.attrName?n.PropertyBinding.sanitizeNodeName(l.attrName):"",c.ID=o}this.getTransformData(c,l),a.set(o,c)}return a}},{key:"buildSkeleton",value:function(e,t,r,i){var a=null;return e.parents.forEach((function(e){for(var s in t)!function(s){var o=t[s];o.rawBones.forEach((function(t,s){var l;t.ID===e.ID&&(l=a,(a=new n.Bone).matrixWorld.copy(t.transformLink),a.name=i?n.PropertyBinding.sanitizeNodeName(i):"",a.ID=r,o.bones[s]=a,null!==l&&a.add(l))}))}(s)})),a}},{key:"createCamera",value:function(e){var t,r;if(e.children.forEach((function(e){void 0!==(e=Wr.Objects.NodeAttribute[e.ID])&&(r=e)})),void 0===r)t=new n.Object3D;else{var i=0,a=(void 0!==r.CameraProjectionType&&1===r.CameraProjectionType.value&&(i=1),1),s=(void 0!==r.NearPlane&&(a=r.NearPlane.value/1e3),1e3),o=(void 0!==r.FarPlane&&(s=r.FarPlane.value/1e3),window.innerWidth),l=window.innerHeight,u=(void 0!==r.AspectWidth&&void 0!==r.AspectHeight&&(o=r.AspectWidth.value,l=r.AspectHeight.value),o/l),c=45,h=(void 0!==r.FieldOfView&&(c=r.FieldOfView.value),r.FocalLength?r.FocalLength.value:null);switch(i){case 0:t=new n.PerspectiveCamera(c,u,a,s),null!==h&&t.setFocalLength(h);break;case 1:t=new n.OrthographicCamera(-o/2,o/2,l/2,-l/2,a,s);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+i+"."),t=new n.Object3D}}return t}},{key:"createLight",value:function(e){var t,r;if(e.children.forEach((function(e){void 0!==(e=Wr.Objects.NodeAttribute[e.ID])&&(r=e)})),void 0===r)t=new n.Object3D;else{e=void 0===r.LightType?0:r.LightType.value;var i=16777215,a=(void 0!==r.Color&&(i=(new n.Color).fromArray(r.Color.value)),void 0===r.Intensity?1:r.Intensity.value/100),s=(void 0!==r.CastLightOnObject&&0===r.CastLightOnObject.value&&(a=0),0);switch(void 0!==r.FarAttenuationEnd&&(s=void 0!==r.EnableFarAttenuation&&0===r.EnableFarAttenuation.value?0:r.FarAttenuationEnd.value),e){case 0:t=new n.PointLight(i,a,s,1);break;case 1:t=new n.DirectionalLight(i,a);break;case 2:var o=Math.PI/3,l=(void 0!==r.InnerAngle&&(o=n.MathUtils.degToRad(r.InnerAngle.value)),0);void 0!==r.OuterAngle&&(l=n.MathUtils.degToRad(r.OuterAngle.value),l=Math.max(l,1)),t=new n.SpotLight(i,a,s,o,l,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+r.LightType.value+", defaulting to a PointLight."),t=new n.PointLight(i,a)}void 0!==r.CastShadows&&1===r.CastShadows.value&&(t.castShadow=!0)}return t}},{key:"createMesh",value:function(e,t,r){var i,a=null,s=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?s=o:0<o.length?s=o[0]:(s=new n.MeshPhongMaterial({color:13421772}),o.push(s)),"color"in a.attributes&&o.forEach((function(e){e.vertexColors=!0})),a.FBX_Deformer?(i=new n.SkinnedMesh(a,s)).normalizeSkinWeights():i=new n.Mesh(a,s),i}},{key:"createCurve",value:function(e,t){e=e.children.reduce((function(e,n){return t.has(n.ID)?t.get(n.ID):e}),null);var r=new n.LineBasicMaterial({color:3342591,linewidth:1});return new n.Line(e,r)}},{key:"getTransformData",value:function(e,t){var n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),n.eulerOrder="RotationOrder"in t?bi(t.RotationOrder.value):"ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}},{key:"setLookAtProperties",value:function(e,t){"LookAtProperty"in t&&Xr.get(e.ID).children.forEach((function(t){"LookAtProperty"===t.relationship&&"Lcl_Translation"in(t=Wr.Objects.Model[t.ID])&&(t=t.Lcl_Translation.value,void 0!==e.target?(e.target.position.fromArray(t),Qr.add(e.target)):e.lookAt((new n.Vector3).fromArray(t)))}))}},{key:"bindSkeleton",value:function(e,t,r){var i,a=this.parsePoseNodes();for(i in e)!function(i){var s=e[i];Xr.get(parseInt(s.ID)).parents.forEach((function(e){t.has(e.ID)&&(e=e.ID,Xr.get(e).parents.forEach((function(e){r.has(e.ID)&&r.get(e.ID).bind(new n.Skeleton(s.bones),a[e.ID])})))}))}(i)}},{key:"parsePoseNodes",value:function(){var e={};if("Pose"in Wr.Objects){var t,r,i=Wr.Objects.Pose;for(t in i)"BindPose"===i[t].attrType&&0<i[t].NbPoseNodes&&(r=i[t].PoseNode,Array.isArray(r)?r.forEach((function(t){e[t.Node]=(new n.Matrix4).fromArray(t.Matrix.a)})):e[r.Node]=(new n.Matrix4).fromArray(r.Matrix.a))}return e}},{key:"createAmbientLight",value:function(){var e,t,r;"GlobalSettings"in Wr&&"AmbientColor"in Wr.GlobalSettings&&(r=(t=Wr.GlobalSettings.AmbientColor.value)[0],e=t[1],t=t[2],0===r&&0===e&&0===t||(r=new n.Color(r,e,t),Qr.add(new n.AmbientLight(r,1))))}}]),e}(),si=function(){function e(){$r(this,e)}return ti(e,[{key:"parse",value:function(e){var t=new Map;if("Geometry"in Wr.Objects){var n,r=Wr.Objects.Geometry;for(n in r){var i=Xr.get(parseInt(n));i=this.parseGeometry(i,r[n],e),t.set(parseInt(n),i)}}return t}},{key:"parseGeometry",value:function(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}},{key:"parseMeshGeometry",value:function(e,t,n){var r,i=n.skeletons,a=[],s=e.parents.map((function(e){return Wr.Objects.Model[e.ID]}));if(0!==s.length)return r=e.children.reduce((function(e,t){return void 0!==i[t.ID]?i[t.ID]:e}),null),e.children.forEach((function(e){void 0!==n.morphTargets[e.ID]&&a.push(n.morphTargets[e.ID])})),e=s[0],s={},"RotationOrder"in e&&(s.eulerOrder=bi(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=yi(s),this.genGeometry(t,r,a,e)}},{key:"genGeometry",value:function(e,t,r,i){var a,s,o=new n.BufferGeometry,l=(e.attrName&&(o.name=e.attrName),this.parseGeoNode(e,t)),u=this.genBuffers(l),c=new n.Float32BufferAttribute(u.vertex,3);return c.applyMatrix4(i),o.setAttribute("position",c),0<u.colors.length&&o.setAttribute("color",new n.Float32BufferAttribute(u.colors,3)),t&&(o.setAttribute("skinIndex",new n.Uint16BufferAttribute(u.weightsIndices,4)),o.setAttribute("skinWeight",new n.Float32BufferAttribute(u.vertexWeights,4)),o.FBX_Deformer=t),0<u.normal.length&&(c=(new n.Matrix3).getNormalMatrix(i),(t=new n.Float32BufferAttribute(u.normal,3)).applyNormalMatrix(c),o.setAttribute("normal",t)),u.uvs.forEach((function(e,t){var r="uv"+(t+1).toString();o.setAttribute(r=0===t?"uv":r,new n.Float32BufferAttribute(u.uvs[t],2))})),l.material&&"AllSame"!==l.material.mappingType&&(a=u.materialIndex[0],s=0,u.materialIndex.forEach((function(e,t){e!==a&&(o.addGroup(s,t-s,a),a=e,s=t)})),0<o.groups.length&&(t=(c=o.groups[o.groups.length-1]).start+c.count)!==u.materialIndex.length&&o.addGroup(t,u.materialIndex.length-t,a),0===o.groups.length&&o.addGroup(0,u.materialIndex.length,u.materialIndex[0])),this.addMorphTargets(o,e,r,i),o}},{key:"parseGeoNode",value:function(e,t){var n={};if(n.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],n.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];for(var r=0;e.LayerElementUV[r];)e.LayerElementUV[r].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return n.weightTable={},null!==t&&(n.skeleton=t).rawBones.forEach((function(e,t){e.indices.forEach((function(r,i){void 0===n.weightTable[r]&&(n.weightTable[r]=[]),n.weightTable[r].push({id:t,weight:e.weights[i]})}))})),n}},{key:"genBuffers",value:function(e){var t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},n=0,r=0,i=!1,a=[],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=mi(p,n,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 n=e,r=b[t];v.forEach((function(e,t,i){e<n&&(i[t]=n,n=e,i=m[t],m[t]=r,r=i)}))})),b=m,x=v);x.length<4;)x.push(0),b.push(0);for(var w=0;w<4;++w)u.push(x[w]),c.push(b[w])}e.normal&&(g=mi(p,n,d,e.normal),s.push(g[0],g[1],g[2])),e.material&&"AllSame"!==e.material.mappingType&&(f=mi(p,n,d,e.material)[0]),e.uv&&e.uv.forEach((function(e,t){e=mi(p,n,d,e),void 0===l[t]&&(l[t]=[]),l[t].push(e[0]),l[t].push(e[1])})),r++,y&&(h.genFace(t,e,a,f,s,o,l,u,c,r),n++,r=0,a=[],s=[],o=[],l=[],u=[],c=[])})),t}},{key:"genFace",value:function(e,t,n,r,i,a,s,o,l,u){for(var c=2;c<u;c++)!function(u){e.vertex.push(t.vertexPositions[n[0]]),e.vertex.push(t.vertexPositions[n[1]]),e.vertex.push(t.vertexPositions[n[2]]),e.vertex.push(t.vertexPositions[n[3*(u-1)]]),e.vertex.push(t.vertexPositions[n[3*(u-1)+1]]),e.vertex.push(t.vertexPositions[n[3*(u-1)+2]]),e.vertex.push(t.vertexPositions[n[3*u]]),e.vertex.push(t.vertexPositions[n[3*u+1]]),e.vertex.push(t.vertexPositions[n[3*u+2]]),t.skeleton&&(e.vertexWeights.push(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(r),e.materialIndex.push(r),e.materialIndex.push(r)),t.normal&&(e.normal.push(i[0]),e.normal.push(i[1]),e.normal.push(i[2]),e.normal.push(i[3*(u-1)]),e.normal.push(i[3*(u-1)+1]),e.normal.push(i[3*(u-1)+2]),e.normal.push(i[3*u]),e.normal.push(i[3*u+1]),e.normal.push(i[3*u+2])),t.uv&&t.uv.forEach((function(t,n){void 0===e.uvs[n]&&(e.uvs[n]=[]),e.uvs[n].push(s[n][0]),e.uvs[n].push(s[n][1]),e.uvs[n].push(s[n][2*(u-1)]),e.uvs[n].push(s[n][2*(u-1)+1]),e.uvs[n].push(s[n][2*u]),e.uvs[n].push(s[n][2*u+1])}))}(c)}},{key:"addMorphTargets",value:function(e,t,n,r){var i;0!==n.length&&(e.morphTargetsRelative=!0,e.morphAttributes.position=[],i=this,n.forEach((function(n){n.rawTargets.forEach((function(n){var a=Wr.Objects.Geometry[n.geoID];void 0!==a&&i.genMorphGeometry(e,t,a,r,n.name)}))})))}},{key:"genMorphGeometry",value:function(e,t,r,i,a){t=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[];for(var s=void 0!==r.Vertices?r.Vertices.a:[],o=void 0!==r.Indexes?r.Indexes.a:[],l=3*e.attributes.position.count,u=new Float32Array(l),c=0;c<o.length;c++){var h=3*o[c];u[h]=s[3*c],u[1+h]=s[3*c+1],u[2+h]=s[3*c+2]}l=this.genBuffers({vertexIndices:t,vertexPositions:u}),(t=new n.Float32BufferAttribute(l.vertex,3)).name=a||r.attrName,t.applyMatrix4(i),e.morphAttributes.position.push(t)}},{key:"parseNormals",value:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Normals.a,i=[];return"IndexToDirect"===n&&("NormalIndex"in e?i=e.NormalIndex.a:"NormalsIndex"in e&&(i=e.NormalsIndex.a)),{dataSize:3,buffer:r,indices:i,mappingType:t,referenceType:n}}},{key:"parseUVs",value:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=[];return{dataSize:2,buffer:e.UV.a,indices:r="IndexToDirect"===n?e.UVIndex.a:r,mappingType:t,referenceType:n}}},{key:"parseVertexColors",value:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=[];return{dataSize:4,buffer:e.Colors.a,indices:r="IndexToDirect"===n?e.ColorIndex.a:r,mappingType:t,referenceType:n}}},{key:"parseMaterialIndices",value:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};for(var r=e.Materials.a,i=[],a=0;a<r.length;++a)i.push(a);return{dataSize:1,buffer:r,indices:i,mappingType:t,referenceType:n}}},{key:"parseNurbsGeometry",value:function(e){if(void 0===Yr)return console.error("THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new n.BufferGeometry;var t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new n.BufferGeometry;for(var r=t-1,i=(t=e.KnotVector.a,[]),a=e.Points.a,s=0,o=a.length;s<o;s+=4)i.push((new n.Vector4).fromArray(a,s));if("Closed"===e.Form)i.push(i[0]);else if("Periodic"===e.Form)for(var l=r,u=t.length-1-l,c=0;c<r;++c)i.push(i[c]);return e=new Yr(r,t,i,l,u).getPoints(12*i.length),(new n.BufferGeometry).setFromPoints(e)}}]),e}(),oi=function(){function e(){$r(this,e)}return ti(e,[{key:"parse",value:function(){var e=[],t=this.parseClips();if(void 0!==t)for(var n in t)n=t[n],n=this.addClip(n),e.push(n);return e}},{key:"parseClips",value:function(){var e;if(void 0!==Wr.Objects.AnimationCurve)return e=this.parseAnimationCurveNodes(),this.parseAnimationCurves(e),e=this.parseAnimationLayers(e),this.parseAnimStacks(e)}},{key:"parseAnimationCurveNodes",value:function(){var e,t=Wr.Objects.AnimationCurveNode,n=new Map;for(e in t){var r=t[e];null!==r.attrName.match(/S|R|T|DeformPercent/)&&(r={id:r.id,attr:r.attrName,curves:{}},n.set(r.id,r))}return n}},{key:"parseAnimationCurves",value:function(e){var t,n=Wr.Objects.AnimationCurve;for(t in n){var r,i={id:n[t].id,times:n[t].KeyTime.a.map(pi),values:n[t].KeyValueFloat.a},a=Xr.get(i.id);void 0!==a&&(r=a.parents[0].ID,(a=a.parents[0].relationship).match(/X/)?e.get(r).curves.x=i:a.match(/Y/)?e.get(r).curves.y=i:a.match(/Z/)?e.get(r).curves.z=i:a.match(/d|DeformPercent/)&&e.has(r)&&(e.get(r).curves.morph=i))}}},{key:"parseAnimationLayers",value:function(e){var t,r=Wr.Objects.AnimationLayer,i=new Map;for(t in r)!function(t){var r=[],a=Xr.get(parseInt(t));void 0!==a&&(a.children.forEach((function(t,i){if(e.has(t.ID)){var a=e.get(t.ID);if(void 0!==a.curves.x||void 0!==a.curves.y||void 0!==a.curves.z){if(void 0===r[i]){var s=Xr.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID;if(void 0!==s){var o=Wr.Objects.Model[s.toString()];if(void 0===o)return void console.warn("THREE.FBXLoader: Encountered a unused curve.",t);var l={modelName:o.attrName?n.PropertyBinding.sanitizeNodeName(o.attrName):"",ID:o.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};Qr.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 n.Matrix4),"PreRotation"in o&&(l.preRotation=o.PreRotation.value),"PostRotation"in o&&(l.postRotation=o.PostRotation.value),r[i]=l}}r[i]&&(r[i][a.attr]=a)}else void 0!==a.curves.morph&&(void 0===r[i]&&(s=Xr.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,t=Xr.get(s).parents[0].ID,t=Xr.get(t).parents[0].ID,t=Xr.get(t).parents[0].ID,t={modelName:(t=Wr.Objects.Model[t]).attrName?n.PropertyBinding.sanitizeNodeName(t.attrName):"",morphName:Wr.Objects.Deformer[s].attrName},r[i]=t),r[i][a.attr]=a)}})),i.set(parseInt(t),r))}(t);return i}},{key:"parseAnimStacks",value:function(e){var t,n=Wr.Objects.AnimationStack,r={};for(t in n){var i=(1<(i=Xr.get(parseInt(t)).children).length&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers."),e.get(i[0].ID));r[t]={name:n[t].attrName,layer:i}}return r}},{key:"addClip",value:function(e){var t=[],r=this;return e.layer.forEach((function(e){t=t.concat(r.generateTracks(e))})),new n.AnimationClip(e.name,-1,t)}},{key:"generateTracks",value:function(e){var t=[],r=new n.Vector3,i=new n.Quaternion,a=new n.Vector3;return e.transform&&e.transform.decompose(r,i,a),r=r.toArray(),i=(new n.Euler).setFromQuaternion(i,e.eulerOrder).toArray(),a=a.toArray(),void 0!==e.T&&0<Object.keys(e.T.curves).length&&void 0!==(r=this.generateVectorTrack(e.modelName,e.T.curves,r,"position"))&&t.push(r),void 0!==e.R&&0<Object.keys(e.R.curves).length&&void 0!==(r=this.generateRotationTrack(e.modelName,e.R.curves,i,e.preRotation,e.postRotation,e.eulerOrder))&&t.push(r),void 0!==e.S&&0<Object.keys(e.S.curves).length&&void 0!==(i=this.generateVectorTrack(e.modelName,e.S.curves,a,"scale"))&&t.push(i),void 0!==e.DeformPercent&&void 0!==(r=this.generateMorphTrack(e))&&t.push(r),t}},{key:"generateVectorTrack",value:function(e,t,r,i){var a=this.getTimesForAllAxes(t);return t=this.getKeyframeTrackValues(a,t,r),new n.VectorKeyframeTrack(e+"."+i,a,t)}},{key:"generateRotationTrack",value:function(e,t,r,i,a,s){void 0!==t.x&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(n.MathUtils.degToRad)),void 0!==t.y&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(n.MathUtils.degToRad)),void 0!==t.z&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(n.MathUtils.degToRad));for(var o=this.getTimesForAllAxes(t),l=this.getKeyframeTrackValues(o,t,r),u=(void 0!==i&&((i=i.map(n.MathUtils.degToRad)).push(s),i=(new n.Euler).fromArray(i),i=(new n.Quaternion).setFromEuler(i)),void 0!==a&&((a=a.map(n.MathUtils.degToRad)).push(s),a=(new n.Euler).fromArray(a),a=(new n.Quaternion).setFromEuler(a).invert()),new n.Quaternion),c=new n.Euler,h=[],d=0;d<l.length;d+=3)c.set(l[d],l[d+1],l[d+2],s),u.setFromEuler(c),void 0!==i&&u.premultiply(i),void 0!==a&&u.multiply(a),u.toArray(h,d/3*4);return new n.QuaternionKeyframeTrack(e+".quaternion",o,h)}},{key:"generateMorphTrack",value:function(e){var t=e.DeformPercent.curves.morph,r=t.values.map((function(e){return e/100})),i=Qr.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new n.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+i+"]",t.times,r)}},{key:"getTimesForAllAxes",value:function(e){var t=[];if(void 0!==e.x&&(t=t.concat(e.x.times)),void 0!==e.y&&(t=t.concat(e.y.times)),1<(t=(t=void 0!==e.z?t.concat(e.z.times):t).sort((function(e,t){return e-t}))).length){for(var n=1,r=t[0],i=1;i<t.length;i++){var a=t[i];a!==r&&(r=t[n]=a,n++)}t=t.slice(0,n)}return t}},{key:"getKeyframeTrackValues",value:function(e,t,n){var r=n,i=[],a=-1,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),r[0]=e):i.push(r[0]),-1!==s?(e=t.y.values[s],i.push(e),r[1]=e):i.push(r[1]),-1!==o?(e=t.z.values[o],i.push(e),r[2]=e):i.push(r[2])})),i}},{key:"interpolateRotations",value:function(e){for(var t=1;t<e.values.length;t++){var n=e.values[t-1],r=e.values[t]-n;if(180<=(i=Math.abs(r))){for(var i,a=r/(i/=180),s=n+a,o=(r=e.times[t-1],(e.times[t]-r)/i),l=r+o,u=[],c=[];l<e.times[t];)u.push(l),l+=o,c.push(s),s+=a;e.times=Si(e.times,t,u),e.values=Si(e.values,t,c)}}}}]),e}(),li=function(){function e(){$r(this,e)}return ti(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 hi,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var t=this,n=e.split(/[\r\n]+/);return n.forEach((function(e,r){var i,a=e.match(/^[\s\t]*;/),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,n[++r]):i?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e))})),this.allNodes}},{key:"parseNodeBegin",value:function(e,t){var n=t[1].trim().replace(/^"/,"").replace(/"$/,""),r=(t=t[2].split(",").map((function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")})),{name:n}),i=(t=this.parseNodeAttr(t),this.getCurrentNode());0===this.currentIndent?this.allNodes.add(n,r):n in i?("PoseNode"===n?i.PoseNode.push(r):void 0!==i[n].id&&(i[n]={},i[n][i[n].id]=i[n]),""!==t.id&&(i[n][t.id]=r)):"number"==typeof t.id?(i[n]={},i[n][t.id]=r):"Properties70"!==n&&(i[n]="PoseNode"===n?[r]:r),"number"==typeof t.id&&(r.id=t.id),""!==t.name&&(r.attrName=t.name),""!==t.type&&(r.attrType=t.type),this.pushStack(r)}},{key:"parseNodeAttr",value:function(e){var t=e[0],n=(""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0])),""),r="";return 1<e.length&&(n=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:n,type:r}}},{key:"parseNodeProperty",value:function(e,t,n){var r=t[1].replace(/^"/,"").replace(/"$/,"").trim();if(t=t[2].replace(/^"/,"").replace(/"$/,"").trim(),"Properties70"===("Content"===r&&","===t&&(t=n.replace(/"/g,"").replace(/,$/,"").trim()),n=this.getCurrentNode()).name)this.parseNodeSpecialProperty(e,r,t);else{if("C"===r){e=t.split(",").slice(1);for(var i=parseInt(e[0]),a=(e=parseInt(e[1]),(a=t.split(",").slice(3)).map((function(e){return e.trim().replace(/^"/,"")}))),s=(r="connections",t=[i,e]),o=a,l=0,u=s.length,c=o.length;l<c;l++,u++)s[u]=o[l];void 0===n[r]&&(n[r]=[])}"Node"===r&&(n.id=t),r in n&&Array.isArray(n[r])?n[r].push(t):"a"!==r?n[r]=t:n.a=t,this.setCurrentProp(n,r),"a"===r&&","!==t.slice(-1)&&(n.a=xi(t))}}},{key:"parseNodePropertyContinued",value:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=xi(t.a))}},{key:"parseNodeSpecialProperty",value:function(e,t,n){n=n.split('",').map((function(e){return e.trim().replace(/^\"/,"").replace(/\s/,"_")}));var r=n[0],i=n[1],a=n[2],s=n[3],o=n[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=xi(o)}this.getPrevNode()[r]={type:i,type2:a,flag:s,value:o},this.setCurrentProp(this.getPrevNode(),r)}}]),e}(),ui=function(){function t(){$r(this,t)}return ti(t,[{key:"parse",value:function(e){var t=new ci(e),n=(t.skip(23),t.getUint32());if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);for(var r=new hi;!this.endOfContent(t);){var i=this.parseNode(t,n);null!==i&&r.add(i.name,i)}return r}},{key:"endOfContent",value:function(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}},{key:"parseNode",value:function(e,t){var n={},r=7500<=t?e.getUint64():e.getUint32(),i=7500<=t?e.getUint64():e.getUint32(),a=(7500<=t?e.getUint64():e.getUint32(),e.getUint8()),s=e.getString(a);if(0===r)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(n.singleProperty=1===i&&e.getOffset()===r;r>e.getOffset();){var h=this.parseNode(e,t);null!==h&&this.parseSubNode(s,n,h)}return n.propertyList=o,"number"==typeof a&&(n.id=a),""!==u&&(n.attrName=u),""!==c&&(n.attrType=c),""!==s&&(n.name=s),n}},{key:"parseSubNode",value:function(e,t,n){var r,i,a,s,o;!0===n.singleProperty?(i=n.propertyList[0],Array.isArray(i)?(t[n.name]=n).a=i:t[n.name]=i):"Connections"===e&&"C"===n.name?(r=[],n.propertyList.forEach((function(e,t){0!==t&&r.push(e)})),void 0===t.connections&&(t.connections=[]),t.connections.push(r)):"Properties70"===n.name?Object.keys(n).forEach((function(e){t[e]=n[e]})):"Properties70"===e&&"P"===n.name?(i=n.propertyList[0],e=n.propertyList[1],a=n.propertyList[2],s=n.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_")?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],t[i]={type:e,type2:a,flag:s,value:o}):void 0===t[n.name]?"number"==typeof n.id?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:"PoseNode"===n.name?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):void 0===t[n.name][n.id]&&(t[n.name][n.id]=n)}},{key:"parseProperty",value:function(t){var n=t.getString(1);switch(n){case"C":return t.getBoolean();case"D":return t.getFloat64();case"F":return t.getFloat32();case"I":return t.getInt32();case"L":return t.getInt64();case"R":return i=t.getUint32(),t.getArrayBuffer(i);case"S":return i=t.getUint32(),t.getString(i);case"Y":return t.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":var r=t.getUint32(),i=t.getUint32(),a=t.getUint32();if(0===i)switch(n){case"b":case"c":return t.getBooleanArray(r);case"d":return t.getFloat64Array(r);case"f":return t.getFloat32Array(r);case"i":return t.getInt32Array(r);case"l":return t.getInt64Array(r)}void 0===e&&console.error("THREE.FBXLoader: External library fflate.min.js required."),i=fr(new Uint8Array(t.getArrayBuffer(a)));var s=new ci(i.buffer);switch(n){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 "+n)}}}]),t}(),ci=function(){function e(t,n){$r(this,e),this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===n||n}return ti(e,[{key:"getOffset",value:function(){return this.offset}},{key:"size",value:function(){return this.dv.buffer.byteLength}},{key:"skip",value:function(e){this.offset+=e}},{key:"getBoolean",value:function(){return 1==(1&this.getUint8())}},{key:"getBooleanArray",value:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getBoolean());return t}},{key:"getUint8",value:function(){var e=this.dv.getUint8(this.offset);return this.offset+=1,e}},{key:"getInt16",value:function(){var e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}},{key:"getInt32",value:function(){var e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getInt32Array",value:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getInt32());return t}},{key:"getUint32",value:function(){var e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getInt64",value:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),2147483648&t?(t=4294967295&~t,-(4294967296*(t=4294967295==(e=4294967295&~e)?t+1&4294967295:t)+(e=e+1&4294967295))):4294967296*t+e}},{key:"getInt64Array",value:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getInt64());return t}},{key:"getUint64",value:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),4294967296*t+e}},{key:"getFloat32",value:function(){var e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getFloat32Array",value:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getFloat32());return t}},{key:"getFloat64",value:function(){var e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}},{key:"getFloat64Array",value:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getFloat64());return t}},{key:"getArrayBuffer",value:function(e){var t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}},{key:"getString",value:function(e){for(var t=[],r=0;r<e;r++)t[r]=this.getUint8();var i=t.indexOf(0);return 0<=i&&(t=t.slice(0,i)),n.LoaderUtils.decodeText(new Uint8Array(t))}}]),e}(),hi=function(){function e(){$r(this,e)}return ti(e,[{key:"add",value:function(e,t){this[e]=t}}]),e}();function di(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 pi(e){return e/46186158e3}var fi=[];function mi(e,t,n,r){var i;switch(r.mappingType){case"ByPolygonVertex":i=e;break;case"ByPolygon":i=t;break;case"ByVertice":i=n;break;case"AllSame":i=r.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+r.mappingType)}for(var a=(i="IndexToDirect"===r.referenceType?r.indices[i]:i)*r.dataSize,s=a+r.dataSize,o=fi,l=r.buffer,u=s,c=a,h=0;c<u;c++,h++)o[h]=l[c];return o}var vi=new n.Euler,gi=new n.Vector3;function yi(e){var t=new n.Matrix4,r=new n.Matrix4,i=new n.Matrix4,a=new n.Matrix4,s=new n.Matrix4,o=new n.Matrix4,l=new n.Matrix4,u=new n.Matrix4,c=new n.Matrix4,h=new n.Matrix4,d=new n.Matrix4,p=new n.Matrix4,f=e.inheritType||0,m=(e.translation&&t.setPosition(gi.fromArray(e.translation)),e.preRotation&&((m=e.preRotation.map(n.MathUtils.degToRad)).push(e.eulerOrder),r.makeRotationFromEuler(vi.fromArray(m))),e.rotation&&((m=e.rotation.map(n.MathUtils.degToRad)).push(e.eulerOrder),i.makeRotationFromEuler(vi.fromArray(m))),e.postRotation&&((m=e.postRotation.map(n.MathUtils.degToRad)).push(e.eulerOrder),a.makeRotationFromEuler(vi.fromArray(m)),a.invert()),e.scale&&s.scale(gi.fromArray(e.scale)),e.scalingOffset&&l.setPosition(gi.fromArray(e.scalingOffset)),e.scalingPivot&&o.setPosition(gi.fromArray(e.scalingPivot)),e.rotationOffset&&u.setPosition(gi.fromArray(e.rotationOffset)),e.rotationPivot&&c.setPosition(gi.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(d.copy(e.parentMatrix),h.copy(e.parentMatrixWorld)),r.clone().multiply(i).multiply(a)),v=(((e=new n.Matrix4).extractRotation(h),v=new n.Matrix4).copyPosition(h),v.clone().invert().multiply(h)),g=(v=e.clone().invert().multiply(v),s),y=new n.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 n.Matrix4).scale((new n.Vector3).setFromMatrixScale(d)).clone().invert(),d=v.clone().multiply(f),y.copy(e).multiply(m).multiply(d).multiply(g)),v=c.clone().invert(),f=o.clone().invert(),e=t.clone().multiply(u).multiply(c).multiply(r).multiply(i).multiply(a).multiply(v).multiply(l).multiply(o).multiply(s).multiply(f),m=(new n.Matrix4).copyPosition(e),d=h.clone().multiply(m),p.copyPosition(d),(e=p.clone().multiply(y)).premultiply(h.invert()),e}function bi(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 xi(e){return e.split(",").map((function(e){return parseFloat(e)}))}function wi(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=e.byteLength),n.LoaderUtils.decodeText(new Uint8Array(e,t,r))}function Si(e,t,n){return e.slice(0,t).concat(n).concat(e.slice(t))}function Ai(e){return(Ai="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 Bi(e){return(Bi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ci=/^[og]\s*(.+)?/,_i=/^mtllib /,Ei=/^usemtl /,Ti=/^usemap /,Di=new n.Vector3,Pi=new n.Vector3,Oi=new n.Vector3,Ri=new n.Vector3,Ii=new n.Vector3,ki=new n.Color;function Li(){var e={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=e,void(this.object.fromDeclaration=!1!==t);var n=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:!1!==t,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(e,t){var n=this._finalize(!1);return n&&(n.inherited||n.groupCount<=0)&&this.materials.splice(n.index,1),e={index:this.materials.length,name:e||"",mtllib:Array.isArray(t)&&0<t.length?t[t.length-1]:"",smooth:(void 0!==n?n:this).smooth,groupStart:void 0!==n?n.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){return(e={index:"number"==typeof e?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1}).clone=this.clone.bind(e),e}},this.materials.push(e),e},currentMaterial:function(){if(0<this.materials.length)return this.materials[this.materials.length-1]},_finalize:function(e){var t=this.currentMaterial();if(t&&-1===t.groupEnd&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&1<this.materials.length)for(var n=this.materials.length-1;0<=n;n--)this.materials[n].groupCount<=0&&this.materials.splice(n,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},n&&n.name&&"function"==typeof n.clone&&((e=n.clone(0)).inherited=!0,this.object.materials.push(e)),this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){return 3*(0<=(e=parseInt(e,10))?e-1:e+t/3)},parseNormalIndex:function(e,t){return 3*(0<=(e=parseInt(e,10))?e-1:e+t/3)},parseUVIndex:function(e,t){return 2*(0<=(e=parseInt(e,10))?e-1:e+t/2)},addVertex:function(e,t,n){var r=this.vertices,i=this.object.geometry.vertices;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addVertexPoint:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){var r=this.normals,i=this.object.geometry.normals;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addFaceNormal:function(e,t,n){var r=this.vertices,i=this.object.geometry.normals;Di.fromArray(r,e),Pi.fromArray(r,t),Oi.fromArray(r,n),Ii.subVectors(Oi,Pi),Ri.subVectors(Di,Pi),Ii.cross(Ri),Ii.normalize(),i.push(Ii.x,Ii.y,Ii.z),i.push(Ii.x,Ii.y,Ii.z),i.push(Ii.x,Ii.y,Ii.z)},addColor:function(e,t,n){var r=this.colors,i=this.object.geometry.colors;void 0!==r[e]&&i.push(r[e+0],r[e+1],r[e+2]),void 0!==r[t]&&i.push(r[t+0],r[t+1],r[t+2]),void 0!==r[n]&&i.push(r[n+0],r[n+1],r[n+2])},addUV:function(e,t,n){var r=this.uvs,i=this.object.geometry.uvs;i.push(r[e+0],r[e+1]),i.push(r[t+0],r[t+1]),i.push(r[n+0],r[n+1])},addDefaultUV:function(){var e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){var t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,n,r,i,a,s,o,l){var u=this.vertices.length;e=this.parseVertexIndex(e,u),t=this.parseVertexIndex(t,u),n=this.parseVertexIndex(n,u),this.addVertex(e,t,n),this.addColor(e,t,n),void 0!==s&&""!==s?(u=this.normals.length,e=this.parseNormalIndex(s,u),t=this.parseNormalIndex(o,u),n=this.parseNormalIndex(l,u),this.addNormal(e,t,n)):this.addFaceNormal(e,t,n),void 0!==r&&""!==r?(s=this.uvs.length,e=this.parseUVIndex(r,s),t=this.parseUVIndex(i,s),n=this.parseUVIndex(a,s),this.addUV(e,t,n),this.object.geometry.hasUVIndices=!0):this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";for(var t=this.vertices.length,n=0,r=e.length;n<r;n++){var i=this.parseVertexIndex(e[n],t);this.addVertexPoint(i),this.addColor(i)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";for(var n=this.vertices.length,r=this.uvs.length,i=0,a=e.length;i<a;i++)this.addVertexLine(this.parseVertexIndex(e[i],n));for(var s=0,o=t.length;s<o;s++)this.addUVLine(this.parseUVIndex(t[s],r))}};return e.startObject("",!1),e}var Fi=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&&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 n,r=Bi(e);if(n=t?(n=Bi(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===Ai(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e){if(this instanceof i)return(e=r.call(this,e)).materials=null,e;throw new TypeError("Cannot call a class as a function")}return t=i,(e=[{key:"load",value:function(e,t,r,i){var a=this,s=new n.FileLoader(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(n){try{t(a.parse(n))}catch(n){i?i(n):console.error(n),a.manager.itemError(e)}}),r,i)}},{key:"setMaterials",value:function(e){return this.materials=e,this}},{key:"parse",value:function(e){for(var t,r,i,a=new Li,s=(e=-1!==(e=-1!==e.indexOf("\r\n")?e.replace(/\r\n/g,"\n"):e).indexOf("\\\n")?e.replace(/\\\n/g,""):e).split("\n"),o="",l=[],u="function"==typeof"".trimLeft,c=0,h=s.length;c<h;c++)if(o=s[c],0!==(o=u?o.trimLeft():o.trim()).length&&"#"!==(t=o.charAt(0)))if("v"===t){var d=o.split(/\s+/);switch(d[0]){case"v":a.vertices.push(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3])),7<=d.length?(ki.setRGB(parseFloat(d[4]),parseFloat(d[5]),parseFloat(d[6])).convertSRGBToLinear(),a.colors.push(ki.r,ki.g,ki.b)):a.colors.push(void 0,void 0,void 0);break;case"vn":a.normals.push(parseFloat(d[1]),parseFloat(d[2]),parseFloat(d[3]));break;case"vt":a.uvs.push(parseFloat(d[1]),parseFloat(d[2]))}}else if("f"===t){for(var p=o.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];a.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=o.substring(1).trim().split(" "),M=[],B=[];if(-1===o.indexOf("/"))M=A;else for(var C=0,_=A.length;C<_;C++){var E=A[C].split("/");""!==E[0]&&M.push(E[0]),""!==E[1]&&B.push(E[1])}a.addLineGeometry(M,B)}else"p"===t?(r=o.slice(1).trim().split(" "),a.addPointGeometry(r)):null!==(l=Ci.exec(o))?(r=(" "+l[0].slice(1).trim()).slice(1),a.startObject(r)):Ei.test(o)?a.object.startMaterial(o.substring(7).trim(),a.materialLibraries):_i.test(o)?a.materialLibraries.push(o.substring(7).trim()):Ti.test(o)?console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.'):"s"===t?(1<(l=o.split(" ")).length?(i=l[1].trim().toLowerCase(),a.object.smooth="0"!==i&&"off"!==i):a.object.smooth=!0,(i=a.object.currentMaterial())&&(i.smooth=a.object.smooth)):"\0"!==o&&console.warn('THREE.OBJLoader: Unexpected line: "'+o+'"');a.finalize();var T,D=new n.Group;if(1==(D.materialLibraries=[].concat(a.materialLibraries),e=!(1===a.objects.length&&0===a.objects[0].geometry.vertices.length)))for(var P=0,O=a.objects.length;P<O;P++){var R=a.objects[P],I=R.geometry,k=R.materials,L="Line"===I.type,F="Points"===I.type,U=!1;if(0!==I.vertices.length){for(var G=new n.BufferGeometry,N=(G.setAttribute("position",new n.Float32BufferAttribute(I.vertices,3)),0<I.normals.length&&G.setAttribute("normal",new n.Float32BufferAttribute(I.normals,3)),0<I.colors.length&&(U=!0,G.setAttribute("color",new n.Float32BufferAttribute(I.colors,3))),!0===I.hasUVIndices&&G.setAttribute("uv",new n.Float32BufferAttribute(I.uvs,2)),[]),j=0,H=k.length;j<H;j++){var z,V=k[j],J=V.name+"_"+V.smooth+"_"+U,K=a.materials[J];null!==this.materials&&(K=this.materials.create(V.name),!L||!K||K instanceof n.LineBasicMaterial?!F||!K||K instanceof n.PointsMaterial||(z=new n.PointsMaterial({size:10,sizeAttenuation:!1}),n.Material.prototype.copy.call(z,K),z.color.copy(K.color),z.map=K.map,K=z):(z=new n.LineBasicMaterial,n.Material.prototype.copy.call(z,K),z.color.copy(K.color),K=z)),void 0===K&&((K=L?new n.LineBasicMaterial:F?new n.PointsMaterial({size:1,sizeAttenuation:!1}):new n.MeshPhongMaterial).name=V.name,K.flatShading=!V.smooth,K.vertexColors=U,a.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?n.LineSegments:F?n.Points:n.Mesh)(G,N)}else I=new(L?n.LineSegments:F?n.Points:n.Mesh)(G,N[0]);I.name=R.name,D.add(I)}}else 0<a.vertices.length&&(e=new n.PointsMaterial({size:1,sizeAttenuation:!1}),(T=new n.BufferGeometry).setAttribute("position",new n.Float32BufferAttribute(a.vertices,3)),0<a.colors.length&&void 0!==a.colors[0]&&(T.setAttribute("color",new n.Float32BufferAttribute(a.colors,3)),e.vertexColors=!0),T=new n.Points(T,e),D.add(T));return D}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(n.Loader),Ui=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}))};const Gi=t.FBXLoader;class Ni{constructor(e){this.parses={fbx:new Gi,obj:new Fi,object:new n.ObjectLoader},this.runScene=e}getBack(e){return e.name.substring(e.name.lastIndexOf(".")+1).toLowerCase()}parseFiles(e){return Promise.all(e.map((e=>this.parse(e))))}parse(e){return Ui(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 Ui(this,void 0,void 0,(function*(){var t=yield(0,H.parseFile)(e,"arrayBuffer");let n="model";return t=yield this.runScene.loaderer.gltf.parse(t,{triggerCb:!0,callBack:{beforeParse:e=>{"scene"===(e=e.asset.ex.type)&&this.runScene.sceneEx.clean()},getJSON(e){n=(null==(e=e.asset.ex)?void 0:e.type)||"scene"}}}),{type:n,result:t}}))}fbx(e){return Ui(this,void 0,void 0,(function*(){var t=e instanceof ArrayBuffer?e:yield(0,H.parseFile)(e,"arrayBuffer");const n=this.parses.fbx.parse(t,"");return n.traverse((e=>{e.material&&(e.material=this.runScene.materialEx.create())})),{type:"model",result:this.runScene.sceneEx.cleanUnlessLevel(n)}}))}obj(e){return Ui(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,H.parseFile)(e,"text"):e;const n=this.parses.obj.parse(t);return n.traverse((e=>{e.material&&(e.material=this.runScene.materialEx.create())})),{type:"model",result:this.runScene.sceneEx.cleanUnlessLevel(n)}}))}json(e){return Ui(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,H.parseFile)(e,"text"):e,n=JSON.parse(t);return"timeLine"===n.type?{type:"timeLine",result:n.data}:{type:"model",result:this.runScene.loaderer.json.parse(t)}}))}}class ji extends z{constructor(e){super(e),this._lastRenderMode=null,this.setRenderMode=(()=>{let e=!1;const t=()=>{e||(this.runScene.cb.loaderer.gltf.loaded.add("global-config",(()=>{"controlsChange"===this._lastRenderMode&&this.runScene.render()})),this.runScene.cb.loaderer.gltf.complete.add("global-config",(()=>{"controlsChange"===this._lastRenderMode&&this.runScene.render()})),e=!0)},n=()=>{const{renderer:e,controls:t}=this.runScene.assetsEx;var n=this.runScene.render;"tick"===this._lastRenderMode?e.setAnimationLoop(null):"controlsChange"===this._lastRenderMode&&t.removeEventListener("change",n)},r=e=>{var t=this.runScene.render;const{renderer:n,controls:r}=this.runScene.assetsEx;"tick"===e?n.setAnimationLoop(t):"controlsChange"===e&&r.addEventListener("change",t)};return e=>{this._lastRenderMode!==e&&(t(),n(),r(e),this._lastRenderMode=e)}})()}setGlow(e){this.runScene.pp.bloomParams.isBloom=e}setRender2(e){this.runScene.assetsEx.setRender2(e)}setRender3(e){this.runScene.assetsEx.setRender3(e)}}class Hi extends S{constructor(e,t){super(e,t),this.transGizmo=this.children[0],this.scaleCoefficient=new n.Vector3,this.beginScale=new n.Vector3,this.posStart=new n.Vector2,this.posEnd=new n.Vector2,this.deleteRedundantParts()}deleteRedundantParts(){this.transGizmo.gizmo.translate.children.splice(1,1),this.transGizmo.gizmo.translate.children.splice(3,1),this.transGizmo.gizmo.translate.children.splice(5,1),this.transGizmo.gizmo.scale.children.splice(0,1),this.transGizmo.gizmo.scale.children.splice(2,1),this.transGizmo.gizmo.scale.children.splice(4,1)}pointerDown(e){void 0===this.object||null===this.axis||this.dragging||0!==e.button||(this.posStart.set(e.x,e.y),this.beginScale.set(this.object.scale.x,this.object.scale.y,this.object.scale.z),super.pointerDown(e))}pointerMove(e){if(super.pointerMove(e),void 0!==this.object&&null!==this.axis&&this.dragging&&-1===e.button&&"scale"===this.mode&&-1!==this.axis.search("XYZ")){this.posEnd.set(e.x,e.y),e=(Math.abs(this.beginScale.x)+Math.abs(this.beginScale.y)+Math.abs(this.beginScale.z))/3;let t=12*this.pointStart.distanceTo(this.pointEnd)/e;this.posEnd.x>this.posStart.x&&(t*=-1),(t=-1.1<t&&t<1.1?1:t)<0&&(t=-1.1/t),this.scaleCoefficient.set(t,t,t),this.object.scale.copy(this._scaleStart).multiply(this.scaleCoefficient)}}}class zi extends n.Object3D{constructor(e){super(),this.isViewHelper=!0,this.animating=!1,this.controls=null,this.dummy=new n.Object3D,this.turnRate=2*Math.PI,this.targetPosition=new n.Vector3,this.targetQuaternion=new n.Quaternion,this.q1=new n.Quaternion,this.q2=new n.Quaternion,this.radius=0,this.clock=new n.Clock,this.runScene=e,e=this.runScene.assetsEx.get().controls,this.controls=e,this.runScene.cb.render.add("view-helper",(()=>{this.update(this.clock.getDelta())}))}prepareAnimationData(e){const t=this.runScene.assetsEx.get().camera;var r=this.controls.target;switch(e){case"posX":this.targetPosition.set(1,0,0),this.targetQuaternion.setFromEuler(new n.Euler(0,.5*Math.PI,0));break;case"posY":this.targetPosition.set(0,1,0),this.targetQuaternion.setFromEuler(new n.Euler(.5*-Math.PI,0,0));break;case"posZ":this.targetPosition.set(0,0,1),this.targetQuaternion.setFromEuler(new n.Euler);break;case"negX":this.targetPosition.set(-1,0,0),this.targetQuaternion.setFromEuler(new n.Euler(0,.5*-Math.PI,0));break;case"negY":this.targetPosition.set(0,-1,0),this.targetQuaternion.setFromEuler(new n.Euler(.5*Math.PI,0,0));break;case"negZ":this.targetPosition.set(0,0,-1),this.targetQuaternion.setFromEuler(new n.Euler(0,Math.PI,0));break;default:console.error("ViewHelper: Invalid axis.")}this.radius=t.position.distanceTo(r),this.targetPosition.multiplyScalar(this.radius).add(r),this.dummy.position.copy(r),this.dummy.lookAt(t.position),this.q1.copy(this.dummy.quaternion),this.dummy.lookAt(this.targetPosition),this.q2.copy(this.dummy.quaternion),this.animating=!0}update(e){if(this.animating){const n=this.runScene.assetsEx.get().camera;e*=this.turnRate;var t=this.controls.target;this.q1.rotateTowards(this.q2,e),n.position.set(0,0,1).applyQuaternion(this.q1).multiplyScalar(this.radius).add(t),n.quaternion.rotateTowards(this.targetQuaternion,e),0===this.q1.angleTo(this.q2)&&(this.animating=!1)}}}class Vi{constructor(e){this.grid=null,this.transContro=null,this.boxHelper=null,this.clean=()=>{this.unfocus()},this.deepIsHelper=e=>"Scene"===e.type||!this.isHelper(e)&&!!e.parent&&this.deepIsHelper(e.parent),this.getBoxHelper=e=>(e=new n.BoxHelper(e),this.setHelper(e),this.runScene.assetsEx.get().scene.add(e),e),this.runScene=e,"running"!==this.runScene.optionsEx.options.mode&&(this.runScene.cb.clean.add("EngineHelper",this.clean),this.transContro=new class{constructor(e){this.tansControls=null,this.controlsMode="position",this.isDraggingChange=!1,this.modelNewVal=new J.Z.Vector3,this.transControlsStatusMap={position:"translate",rotation:"rotate",scale:"scale"},this.multipObj=null,this.speaceType="world",this.draggingChanged=e=>{var t=this.runScene.assetsEx.get().controls,n=this.controlsMode,r=this.runScene.modelEx.select||this.runScene.multipSelector.getLast();r&&(this.runScene.multipSelector.draggingchanged(e),t.enabled?(this.modelNewVal=this.runScene.modelEx.cloneV3(r[n]),this.isDraggingChange=!0):(this.runScene.multipSelector.isEmpty()&&this.runScene.modelEx.setV3({model:r,info:n,newV3:this.runScene.modelEx.cloneV3(r[n]),oldV3:this.modelNewVal},!0,!1),this.isDraggingChange=!1),this.runScene.assetsEx.get().controls.enabled=!e.value)},this.runScene=e}init(){const{camera:e,scene:t,engineDom:n}=this.runScene.assetsEx.get();this.tansControls=new Hi(e,n),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 zi(e),this.grid=this.createGrid(),this.init())}init(){this.transContro.init(),this.runScene.assetsEx.get().scene.add(this.grid)}createGrid(){const e=new J.Z.GridHelper(20,10);return e.name="helper",e.position.y=0,e.material.opacity=.75,e.material.transparent=!0,e}dispose(){}reset(){"running"!==this.runScene.optionsEx.options.mode&&this.transContro.reset()}isHelper(e){return"GridHelper"===e.type||"CubeCamera"===e.type||e.isTransformControls||e.userData.isHelper}setHelper(e,t=!1,n){return e.userData.isHelper=!0,t&&e.traverse((e=>{e.userData.isHelper=!0,n&&n(e)})),e}focus(e){"running"!==this.runScene.optionsEx.options.mode&&(this.boxHelper||(this.boxHelper=this.getBoxHelper(e)),(0,mt.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)}}Se=__webpack_require__(356);var Ji=__webpack_require__.n(Se),Ki=__webpack_require__(510),Zi=__webpack_require__(380),Wi=__webpack_require__(453);class Xi{constructor(e){this.selectors={},this.boxHelperMap={},this.savedV3=new se.Z,this.tempOldval=new bs.Vector3,this.runScene=e}add(e,t=!1){if("array"===(0,H.getType)(e))return e.map((e=>this.add(e)));var n=this.runScene.modelEx.select;if(n&&(this.runScene.modelEx.selectNull(),delete this.selectors[e.uuid],this.add(n)),"BoxHelper"!==e.type){if(this.selectors[e.uuid]){if(this.remove(e),this.removeBoxHelper(e),!t)return;this.add(e)}this.addBoxHelper(e),this.selectors[e.uuid]=e,this.runScene.cb.model.focus.cb({model:e,status:!0,domActive:!0}),this.runScene.helperEx.focus(e)}}setInfo(e,t,n,r,i,a){"position"!==t&&(i=r,a=n);const 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 Zi.Z({target:e,info:t,oldV3:this.runScene.modelEx.cloneV3(n),newV3:r,runScene:this.runScene}).execute()];s.map((n=>{if(n!==e){var{x:r,y:i,z:a}=n[t],r=r+=u,i=i+=c,a=a+=h;let e=n[t].clone();e.x=r,e.y=i,e.z=a,r=new Zi.Z({target:n,info:t,oldV3:this.runScene.modelEx.cloneV3(n[t]),newV3:e,runScene:this.runScene}).execute(),d.push(r),this.boxHelperMap[n.uuid].setFromObject(n)}})),this.boxHelperMap[e.uuid].setFromObject(e),this.runScene.undoEx.addUndo(d)}draggingchanged(e){const t=this.runScene.assetsEx.get().controls;var n;this.isEmpty()?this.runScene.events.mouse.enableUp=!0:this.runScene.events.mouse.enableUp=!1,e.value?this.isEmpty()||(t.enabled=!1,e=this.getLast(),n=this.runScene.helperEx.transContro.controlsMode,this.tempOldval="position"===n?(0,Wi.VU)(e,this.runScene.sceneEx.get()):this.runScene.modelEx.cloneV3(e[n]),this.saveV3(n)):t.enabled||this.isEmpty()||(this.runScene.events.mouse.enableUp=!1,this.useV3())}transChange(){if(!this.isEmpty()&&!this.runScene.assetsEx.controls.enabled){var e=this.runScene.helperEx.transContro.controlsMode,t=this.getLast();let n;this.runScene.events.mouse.enableUp=!1,this.runScene.helperEx.boxHelper.setFromObject(this.runScene.assetsEx.get().scene),n="position"===e?(0,Wi.VU)(t,this.runScene.sceneEx.get()):this.runScene.modelEx.cloneV3(t[e]),this.getInfo({model:t,type:e,newV3:n,oldV3:this.tempOldval}),this.tempOldval.copy(n)}}saveV3(e){this.getSelectedList("value").map((t=>{var n=(0,wt.K)(t);this.savedV3.set(n,{model:t,type:e,val:this.runScene.modelEx.cloneV3(t[e])})}))}useV3(){var e=this.savedV3.map(((e,{type:t,val:n,model:r})=>new Zi.Z({target:r,info:t,newV3:this.runScene.modelEx.cloneV3(r[t]),oldV3:n,runScene:this.runScene})));this.runScene.undoEx.addUndo(e),this.savedV3.clear()}getInfo(e){const{model:t,type:n,newV3:r,oldV3:i}=e,a=this.getSelectedList("value");var{x:e,y:s,z:o}=r;const l=e-i.x,u=s-i.y,c=o-i.z;t[n].copy(r),a.map((e=>{if(e!==t){var{x:r,y:i,z:a}=e[n],r=r+=l,i=i+=u,a=a+=c;let t=e[n].clone();t.x=r,t.y=i,t.z=a,e[n].copy(t),this.boxHelperMap[e.uuid].setFromObject(e)}})),this.boxHelperMap[t.uuid].setFromObject(t)}getLast(){var e=this.getSelectedList("value");return e[e.length-1]}addBoxHelper(e){var t=this.runScene.helperEx.getBoxHelper(e);this.boxHelperMap[e.uuid]=t}removeBoxHelper(e){this.runScene.assetsEx.get().scene.remove(this.boxHelperMap[e.uuid]),this.boxHelperMap[e.uuid]=null,delete this.selectors[e.uuid]}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));this.runScene.cb.model.unFocus.cb(e),this.selectors[e.uuid]=null,delete this.selectors[e.uuid]}isEmpty(){return 0===this.getSelectedList("key").length}getSelectedList(e){return"key"===e?Object.keys(this.selectors):Object.values(this.selectors)}getSelect(){var e=Object.values(this.selectors);return 0!==e.length?e:void 0}selectedLoop(e){return Object.keys(this.selectors).map((t=>e(t,this.selectors[t])))}delete(){this.setBoxHelperEmpty(),this.setEmpty(),this.runScene.helperEx.unfocus()}setBoxHelperEmpty(){var e=Object.values(this.boxHelperMap);this.runScene.assetsEx.get().scene.remove(...e),this.boxHelperMap={}}setEmpty(){this.isEmpty()||(this.getSelectedList("value").map((e=>{this.runScene.cb.model.unFocus.cb(e)})),this.setBoxHelperEmpty(),this.selectors={},this.runScene.cb.model.multiSelect.setEmpty.cb())}createGroup(){this.runScene.helperEx.unfocus(),this.runScene.modelEx.selectNull();var e=new n.Group;const t=new n.Group;this.runScene.modelEx.add(e,void 0,{addUndo:!1}),this.runScene.modelEx.add(t);var r=[...this.getSelectedList("value")],i=(this.runScene.cb.model.multipDrop.cb({models:this.getSelectedList("value"),dropModel:e}),Ji().group.getCenter(e));t.position.copy(i),this.runScene.cb.model.multipDrop.cb({models:r,dropModel:t}),this.runScene.modelEx.remove(e,!1),this.runScene.modelEx.select=t}getSelectorGroup(){const e=this.getSelectedList("value"),t=new n.Group;return e.forEach((e=>t.add(e.clone()))),this.setEmpty(),t}rename(e){const{prefix:t,rmPrefixLength:n,back:r,rmBackLength:i,fullName:a,step:s}=e,o=this.getSelectedList("value");0!==o.length&&(e=o.map(((e,o)=>{let l=e.name;if(0===a.length){if(0!==n){if(n>l.length)return;l=l.substring(n)}if(0!==i){if(i>l.length)return;l=l.substring(0,l.length-i)}0<t.length&&(l=t+l),0<r.length&&(l+=r)}else l=a+(o+1)*s;return new Ki.Z({target:e,info:"name",newVal:l,oldVal:e.name,runScene:this.runScene}).execute()})),this.runScene.undoEx.addUndo(e))}align(e){const t=this.getSelectedList("value");if(0!==t.length){const[r]=t;var n=t.map((t=>{var n=t.position.clone();const i=("all"===e?r:t).position.clone();return"all"!==e&&(i[e]=r.position[e]),new Zi.Z({target:t,info:"position",oldV3:n,newV3:i,runScene:this.runScene}).execute()}));this.runScene.multipSelector.add(t,!0),this.runScene.undoEx.addUndo(n)}}}function Qi(e){return(Qi="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 Yi(e,t){return(Yi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function qi(e){return(qi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var $i=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&&Yi(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=qi(e);if(n=t?(n=qi(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===Qi(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(){if(!(this instanceof i))throw new TypeError("Cannot call a class as a function");var e=i.SkyShader;return e=new n.ShaderMaterial({name:"SkyShader",fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:n.UniformsUtils.clone(e.uniforms),side:n.BackSide,depthWrite:!1}),r.call(this,new n.BoxGeometry(1,1,1),e)}return t=i,Object.defineProperty(t,"prototype",{writable:!1}),t}(n.Mesh),ea=($i.prototype.isSky=!0,$i.SkyShader={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new n.Vector3},up:{value:new n.Vector3(0,1,0)}},vertexShader:"\n\t\tuniform vec3 sunPosition;\n\t\tuniform float rayleigh;\n\t\tuniform float turbidity;\n\t\tuniform float mieCoefficient;\n\t\tuniform vec3 up;\n\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\t// constants for atmospheric scattering\n\t\tconst float e = 2.71828182845904523536028747135266249775724709369995957;\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\t// wavelength of used primaries, according to preetham\n\t\tconst vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );\n\t\t// this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:\n\t\t// (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))\n\t\tconst vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );\n\n\t\t// mie stuff\n\t\t// K coefficient for the primaries\n\t\tconst float v = 4.0;\n\t\tconst vec3 K = vec3( 0.686, 0.678, 0.666 );\n\t\t// MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K\n\t\tconst vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );\n\n\t\t// earth shadow hack\n\t\t// cutoffAngle = pi / 1.95;\n\t\tconst float cutoffAngle = 1.6110731556870734;\n\t\tconst float steepness = 1.5;\n\t\tconst float EE = 1000.0;\n\n\t\tfloat sunIntensity( float zenithAngleCos ) {\n\t\t\tzenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );\n\t\t\treturn EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );\n\t\t}\n\n\t\tvec3 totalMie( float T ) {\n\t\t\tfloat c = ( 0.2 * T ) * 10E-18;\n\t\t\treturn 0.434 * c * MieConst;\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\t\t\tvWorldPosition = worldPosition.xyz;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\tgl_Position.z = gl_Position.w; // set z to camera.far\n\n\t\t\tvSunDirection = normalize( sunPosition );\n\n\t\t\tvSunE = sunIntensity( dot( vSunDirection, up ) );\n\n\t\t\tvSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );\n\n\t\t\tfloat rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );\n\n\t\t\t// extinction (absorbtion + out scattering)\n\t\t\t// rayleigh coefficients\n\t\t\tvBetaR = totalRayleigh * rayleighCoefficient;\n\n\t\t\t// mie coefficients\n\t\t\tvBetaM = totalMie( turbidity ) * mieCoefficient;\n\n\t\t}",fragmentShader:"\n\t\tvarying vec3 vWorldPosition;\n\t\tvarying vec3 vSunDirection;\n\t\tvarying float vSunfade;\n\t\tvarying vec3 vBetaR;\n\t\tvarying vec3 vBetaM;\n\t\tvarying float vSunE;\n\n\t\tuniform float mieDirectionalG;\n\t\tuniform vec3 up;\n\n\t\tconst vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );\n\n\t\t// constants for atmospheric scattering\n\t\tconst float pi = 3.141592653589793238462643383279502884197169;\n\n\t\tconst float n = 1.0003; // refractive index of air\n\t\tconst float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius)\n\n\t\t// optical length at zenith for molecules\n\t\tconst float rayleighZenithLength = 8.4E3;\n\t\tconst float mieZenithLength = 1.25E3;\n\t\t// 66 arc seconds -> degrees, and the cosine of that\n\t\tconst float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;\n\n\t\t// 3.0 / ( 16.0 * pi )\n\t\tconst float THREE_OVER_SIXTEENPI = 0.05968310365946075;\n\t\t// 1.0 / ( 4.0 * pi )\n\t\tconst float ONE_OVER_FOURPI = 0.07957747154594767;\n\n\t\tfloat rayleighPhase( float cosTheta ) {\n\t\t\treturn THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );\n\t\t}\n\n\t\tfloat hgPhase( float cosTheta, float g ) {\n\t\t\tfloat g2 = pow( g, 2.0 );\n\t\t\tfloat inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );\n\t\t\treturn ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec3 direction = normalize( vWorldPosition - cameraPos );\n\n\t\t\t// optical length\n\t\t\t// cutoff angle at 90 to avoid singularity in next formula.\n\t\t\tfloat zenithAngle = acos( max( 0.0, dot( up, direction ) ) );\n\t\t\tfloat inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );\n\t\t\tfloat sR = rayleighZenithLength * inverse;\n\t\t\tfloat sM = mieZenithLength * inverse;\n\n\t\t\t// combined extinction factor\n\t\t\tvec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );\n\n\t\t\t// in scattering\n\t\t\tfloat cosTheta = dot( direction, vSunDirection );\n\n\t\t\tfloat rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );\n\t\t\tvec3 betaRTheta = vBetaR * rPhase;\n\n\t\t\tfloat mPhase = hgPhase( cosTheta, mieDirectionalG );\n\t\t\tvec3 betaMTheta = vBetaM * mPhase;\n\n\t\t\tvec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );\n\t\t\tLin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );\n\n\t\t\t// nightsky\n\t\t\tfloat theta = acos( direction.y ); // elevation --\x3e y-axis, [-pi/2, pi/2]\n\t\t\tfloat phi = atan( direction.z, direction.x ); // azimuth --\x3e x-axis [-pi/2, pi/2]\n\t\t\tvec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );\n\t\t\tvec3 L0 = vec3( 0.1 ) * Fex;\n\n\t\t\t// composition + solar disc\n\t\t\tfloat sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );\n\t\t\tL0 += ( vSunE * 19000.0 * Fex ) * sundisk;\n\n\t\t\tvec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );\n\n\t\t\tvec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );\n\n\t\t\tgl_FragColor = vec4( retColor, 1.0 );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\n\t\t}"},__webpack_require__(585)),ta=__webpack_require__(651);const na={color:"#000000",intensity:1};class ra{diff(e,t){const n={};return(0,H.mapObj)(na,(r=>{var i=e[r];(0,bt.Xq)(i,t[r])&&(n[r]=i)})),n}setConfig(e,t){var{color:t,intensity:n,shadow:r}=t,{mapSize:r,camera:i}=r||{},{far:i,near:a,scale: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!==r&&(e.shadow.mapSize.x=r,e.shadow.mapSize.y=r),void 0!==n&&(e.intensity=n),void 0!==t&&(e.color=(0,Wi.e9)(t)),e.shadow.camera.updateProjectionMatrix(),null!=(s=e.cameraHelper)&&s.update()}}class ia extends z{constructor(){super(...arguments),this.allState=["morning","noon","evening","night"],this.sun=new bs.Vector3,this.light=new ra,this.sky=new $i,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"))&&(console.log(e,"savedMap"),this.setState(e.state))}))}addScene(){gt.materialIgnore.set(this.sky.material,!0),(0,Z.setHelper)(this.sky),Z.selectableModel.close(this.sky),Z.selectableModel.close(this.directionalLight),(0,Z.setHelper)(this.directionalLight),this.directionalLight.helper&&(this.directionalLight.helper.visible=!1),this.runScene.modelEx.add(this.sky,void 0,{addToTree:!1})}setOpen(e){const t=this.runScene.assetsEx.get().renderer;this.sky.visible!==e&&(this.directionalLight.visible=e,t.toneMapping=e?4:0,this.skyData.isShow=e,this.sky.visible=e)}toJSON(){var{currentState:e,effectController:t,isShow:n,lightConfig:r,size:i}=this.skyData;return{currentState:e,effectController:t,isShow:n,lightConfig:r,size:i}}parseJSON(e){var t,n,r;e&&(({isShow:t,currentState:n,size:r}=e),this.skyData.isShow=t,this.parseLightConfig(e),this.inied||(this.init(),this.inied=!0),this.parseSkyConfig(n,r),this.setOpen(t))}parseLightConfig(e){var{isShow:e,effectController:t,currentState:n,lightConfig:r,size:i}=e,a=r.shadow,s=t[n].lightConfig;this.directionalLight||([s]=a=new ea.Z(this.runScene).parseJSON(Object.assign(Object.assign({shadow:a},s),this.baseLightConfig)),this.runScene.lightEx.add(a,{addToTree:!1}),this.directionalLight=s),this.directionalLight.visible=e,this.skyData.lightConfig=r,this.skyData.isShow=e,this.skyData.effectController=t,this.skyData.currentState=n,this.skyData.size=i,this.sky.visible=e,this.setLightSpecialConfig(n),this.lightAnima(n)}parseSkyConfig(e,t){this.setSkyConfig(e),this.setSkyScale(t)}setState(e){var t=this.skyData.currentState;this.doAnimaByState(e,t),this.saveLastTimeState({oldState:t,state:e,index:this.allState.findIndex((t=>t===e))})}saveLastTimeState(e){var{oldState:e,state:t,index:n}=e;this.lastTime.name=e,this.lastTime.index=n,this.skyData.currentState=t}getLightDataByState(e){let t=new bs.Vector3,n=new bs.Vector3;switch(e){case"morning":t.x=0,t.y=0,t.z=-this.skyData.size,n.x=0,n.y=this.skyData.size/2*-1,n.z=this.skyData.size/2;break;case"noon":t.x=0,t.y=this.skyData.size/2,t.z=0,n.x=0,n.y=-1*this.skyData.size,n.z=0;break;case"evening":case"night":t.x=0,t.y=0,t.z=this.skyData.size,n.x=0,n.y=this.skyData.size/2*-1,n.z=this.skyData.size/2*-1}return{position:t,targetPosition:n}}getIdxByState(e){return this.allState.findIndex((t=>t===e))}setSkyConfig(e){const{renderer:t,scene:n,camera:r}=this.runScene.assetsEx.get();this.sky.material.uniforms.turbidity.value=this.skyData.effectController[e].turbidity,this.sky.material.uniforms.mieCoefficient.value=this.skyData.effectController[e].mieCoefficient,this.sky.material.uniforms.mieDirectionalG.value=this.skyData.effectController[e].mieDirectionalG,t.toneMappingExposure=this.skyData.effectController[e].exposure,t.render(n,r);var i=bs.MathUtils.degToRad(90-this.skyData.effectController[e].elevation);e=bs.MathUtils.degToRad(this.skyData.effectController[e].azimuth),this.sun.setFromSphericalCoords(1,i,e),this.sky.material.uniforms.sunPosition.value.copy(this.sun)}setSkyScale(e){this.sky.scale.setScalar(e),this.skyData.size=e}setSky(e){var{state:e,type:t,val:n}=e;this.skyData.effectController[e][t]=n,this.setSkyConfig(e)}setCurrentState(e){this.skyData.currentState=e}setStateTime(e){var{info:e,time:t}=e;this.skyData.effectController[e].time=t}clean(){this.setOpen(!1),this.skyData=this.getData(),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!=(n=this.directionalLight.cameraHelper)&&n.update();break;case"color":this.skyData.effectController[this.skyData.currentState].lightConfig.color=t;var n=new bs.Color(t);this.directionalLight.color=n;break;case"intensity":this.skyData.effectController[this.skyData.currentState].lightConfig.intensity=t,this.directionalLight.intensity=t}}setLightSpecialConfig(e){var{color:e,intensity:t}=this.skyData.effectController[e].lightConfig;this.directionalLight.color=(0,Wi.e9)(e),this.directionalLight.intensity=t}getAnimasDataByState(e,t){e=this.getIdxByState(e);const n=[];if((t=this.getIdxByState(t))<e){this.animaIndex={begin:e,end:t};var r=e-t;let l=t;for(let e=0;e<r;e++){var{color:i,intensity:a}=this.skyData.effectController[this.allState[l]].lightConfig,{position:s,targetPosition:o}=this.getLightDataByState(this.allState[l]),{color:i,intensity:a}=(n.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[l]],color:i,intensity:a,position:s,targetPosition:o})}),l++,this.skyData.effectController[this.allState[l]].lightConfig),{position:s,targetPosition:o}=this.getLightDataByState(this.allState[l]);n.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 r=t;if(0==l)return n.push({onDone:this.getSpecialFn}),n;for(let e=0;e<l;e++){var{color:u,intensity:c}=this.skyData.effectController[this.allState[r]].lightConfig,{position:h,targetPosition:d}=this.getLightDataByState(this.allState[r]),{position:h,targetPosition:d}=(n.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[r]],color:u,intensity:c,position:h,targetPosition:d})}),r++,this.getLightDataByState(this.allState[r]));n.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[r]],color:u,intensity:c,position:h,targetPosition:d}),onDone:3===r?this.getSpecialFn:this.getNromalFn})}}return n}playSky(){if(0!==this.currentAnimas.length){const t=this.currentAnimas.shift();var e=this.currentAnimas.shift();if(!e)return t.onDone();this.playAnima(t,e)}}playAnima(e,t){const{renderer:n,scene:r,camera:i}=this.runScene.assetsEx.get();this.animaInstance=K.anima(Object.assign(Object.assign({},e.data),{x:this.directionalLight.position.x,y:this.directionalLight.position.y,z:this.directionalLight.position.z,tx:this.directionalLight.target.position.x,ty:this.directionalLight.target.position.y,tz:this.directionalLight.target.position.z}),Object.assign(Object.assign({},t.data),{ease:"none"}),e.data.time,(e=>{var{r:a,g:s,b:o}=e,l=(this.onUpdated(e),this.sky.material.uniforms.turbidity.value=e.turbidity,this.sky.material.uniforms.mieCoefficient.value=e.mieCoefficient,this.sky.material.uniforms.mieDirectionalG.value=e.mieDirectionalG,n.toneMappingExposure=e.exposure,n.render(r,i),bs.MathUtils.degToRad(90-e.elevation)),u=bs.MathUtils.degToRad(t.data.azimuth);this.sun.setFromSphericalCoords(1,l,u),this.sky.material.uniforms.sunPosition.value.copy(this.sun),l=new bs.Color(a,s,o),this.directionalLight.color=l,this.directionalLight.intensity=e.intensity,this.directionalLight.position.set(e.x,e.y,e.z),this.directionalLight.target.position.set(e.tx,e.ty,e.tz)}),(()=>{t.onDone(),this.animaInstance=null}))}doAnimaByState(e,t){e=this.getAnimasDataByState(e,t),this.animaInstance?this.awaitAnimas=e:(this.currentAnimas=e,this.playSky())}onUpdated(e){var t;0!==this.awaitAnimas.length&&(this.animaInstance.kill(),this.animaInstance=null,[t]=this.awaitAnimas,this.currentAnimas=[...this.awaitAnimas],this.awaitAnimas=[],null!=t&&t.data&&(this.currentAnimas.unshift({data:t.data,onDone:this.getNromalFn}),this.currentAnimas.unshift({data:e})),this.playSky())}lightAnima(e){var{position:e,targetPosition:t}=this.getLightDataByState(e);this.directionalLight.position.set(e.x,e.y,e.z),this.directionalLight.target.position.set(t.x,t.y,t.z)}transDataToAnimaData(e){var{sky:e,color:t,position:n,targetPosition:r,intensity:i}=e,{x:n,y:a,z:s}=n,{x:r,y:o,z:l}=r,{r:t,g:u,b:c}=(0,bt.fh)((0,bt.I8)(t));return Object.assign(Object.assign({},e),{r:t,g:u,b:c,x:n,y:a,z:s,tx:r,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,ta.d9)(na)),{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,ta.d9)(na)),{color:"#FFFFFF"})},evening:{turbidity:2,rayleigh:.3,mieCoefficient:.011,mieDirectionalG:.67,elevation:3,azimuth:0,exposure:.3762,lightConfig:Object.assign(Object.assign({},(0,ta.d9)(na)),{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,ta.d9)(na)),{color:"#B8A277"}),time:1}},currentState:"morning"}}}class aa{constructor(e){this.clean=()=>{this.sky.clean()},this.sky=new ia(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 sa(){var e=0,t=document.createElement("div");function n(e){return t.appendChild(e.dom),e}function r(n){for(var r=0;r<t.children.length;r++)t.children[r].style.display=r===n?"block":"none";e=n}t.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",t.addEventListener("click",(function(n){n.preventDefault(),r(++e%t.children.length)}),!1);var i,a=(performance||Date).now(),s=a,o=0,l=n(new sa.Panel("FPS","#0ff","#002")),u=n(new sa.Panel("MS","#0f0","#020"));return self.performance&&self.performance.memory&&(i=n(new sa.Panel("MB","#f08","#201"))),r(0),{REVISION:16,dom:t,addPanel:n,showPanel:r,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:r}}sa.Panel=function(e,t,n){var r=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=n,v.fillRect(0,0,o,l),v.fillStyle=t,v.fillText(e,u,c),v.fillRect(h,d,p,f),v.fillStyle=n,v.globalAlpha=.9,v.fillRect(h,d,p,f),{dom:m,update:function(l,g){r=Math.min(r,l),i=Math.max(i,l),v.fillStyle=n,v.globalAlpha=1,v.fillRect(0,0,o,d),v.fillStyle=t,v.fillText(a(l)+" "+e+" ("+a(r)+"-"+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=n,v.globalAlpha=.9,v.fillRect(h+p-s,d,s,a((1-l/g)*f))}}};const oa=sa;class la{constructor(e,t){this.options={msg:{show:!1,level:"base"},run:!0,decodePath:"./draco/",showFps:!1,loadInterval:2e3,mode:"running",hideLocal:!1,instanceClone:!0,render2:!1,render3:!1,coverSameId:!1,renderConfig:{mode:"tick",frame:-1,scriptFrame:-1,matrixAutoUpdate:!1},event:{base:"canvas"},texture:{load:!0,lazyLoad:{open:!1,intervalTime:16.6},quality:1}},this.exporterOptions={compressTexture:!1,notMaterial:!1,outTime:(0,K.getTime)(7)},this.sceneOptions={loaded:!1},this.setLoadInterval=(()=>{let e=null;return t=>{const{inputInterval:n,cb:r}=t;e&&clearTimeout(e),e=setTimeout((()=>{r(),e=null,clearTimeout(e)}),n)}})(),this.runScene=e,this.options=(0,K.deepMergeObject)(this.options,t||{})}init(e){this.options.showFps&&(this.addFps(e),this.runScene.cb.render.add("optionx-ex-render",this.render.bind(this)))}addFps(e){this.stats=oa(),this.stats.showPanel(0),e.appendChild(this.stats.dom)}render(){var e;null!=(e=this.stats)&&e.update()}log(e,t="detail",n="success"){var r;null!=(r=null==(r=this.options)?void 0:r.msg)&&r.show&&("base"===this.options.msg.level&&"base"===t&&this.runScene.cb.baseLog.cb({msg:e,type:n}),console.log(e))}}class ua{constructor(e){this.glowModelLength=new Set,this.outlineModelLength=new Set,this.runScene=e,this.initGlow(),this.initOutline()}initGlow(){const{setLayers:e,add:t,remove:n}=this.runScene.cb.model;e.add("pp-set-glow",(e=>{var{model:e,val:t}=e;0===t&&0===this.glowModelLength.size||this[0===t?"glowRemove":"glowAdd"](e)})),t.add("pp-set-glow",(({model:e})=>{1!==e.layers.mask&&this.glowAdd(e)})),n.add("pp-set-glow",(({model:e})=>{1!==e.layers.mask&&this.glowRemove(e)}))}glowAdd(e){this.glowModelLength.add(e.userData.id),0<this.glowModelLength.size&&(this.runScene.cb.pp.glow.setStatus.cb(!0),this.runScene.pp.bloomParams.isBloom=!0)}glowRemove(e){this.glowModelLength.delete(e.userData.id),this.glowModelLength.size<=0&&(this.runScene.cb.pp.glow.setStatus.cb(!1),this.runScene.pp.bloomParams.isBloom=!1)}initOutline(){const{setOutline:e,add:t,remove:n}=this.runScene.cb.model;e.add("pp-set-outline",(e=>{var{model:e,val:t}=e;!t&&0===this.outlineModelLength.size||this[t?"outlineAdd":"outlineRemove"](e)})),t.add("pp-set-outline",(({model:e})=>{e.userData.outline&&this.outlineAdd(e)})),n.add("pp-set-outline",(({model:e})=>{e.userData.outline&&this.outlineRemove(e)}))}outlineAdd(e){this.outlineModelLength.add(e.userData.id),0<this.outlineModelLength.size&&(this.runScene.cb.pp.outline.setStatus.cb(!0),this.runScene.pp.outlineParams.isOutline=!0)}outlineRemove(e){this.outlineModelLength.delete(e.userData.id),this.outlineModelLength.size<=0&&(this.runScene.cb.pp.outline.setStatus.cb(!1),this.runScene.pp.outlineParams.isOutline=!1)}}var ca={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}"},ha=__webpack_require__(180),da=__webpack_require__(819),pa={shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new n.Color(0)},defaultOpacity:{value:0}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform vec3 defaultColor;\n\t\tuniform float defaultOpacity;\n\t\tuniform float luminosityThreshold;\n\t\tuniform float smoothWidth;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\n\t\t\tvec3 luma = vec3( 0.299, 0.587, 0.114 );\n\n\t\t\tfloat v = dot( texel.xyz, luma );\n\n\t\t\tvec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );\n\n\t\t\tfloat alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );\n\n\t\t\tgl_FragColor = mix( outputColor, texel, alpha );\n\n\t\t}"};function fa(e){return(fa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ma(e,t){return(ma=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function va(e){return(va=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ga=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ma(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=va(e);if(n=t?(n=va(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===fa(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e,t,a,s){var o;if(!(this instanceof i))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=s,o.resolution=void 0!==e?new n.Vector2(e.x,e.y):new n.Vector2(256,256),o.clearColor=new n.Color(0,0,0),o.renderTargetsHorizontal=[],o.renderTargetsVertical=[],o.nMips=5;var l=Math.round(o.resolution.x/2),u=Math.round(o.resolution.y/2);o.renderTargetBright=new n.WebGLRenderTarget(l,u),o.renderTargetBright.texture.name="UnrealBloomPass.bright",o.renderTargetBright.texture.generateMipmaps=!1;for(var c=0;c<o.nMips;c++){var h;((h=new n.WebGLRenderTarget(l,u)).texture.name="UnrealBloomPass.h"+c,h.texture.generateMipmaps=!1,o.renderTargetsHorizontal.push(h),h=new n.WebGLRenderTarget(l,u)).texture.name="UnrealBloomPass.v"+c,h.texture.generateMipmaps=!1,o.renderTargetsVertical.push(h),l=Math.round(l/2),u=Math.round(u/2)}a=pa;for(var d=(o.highPassUniforms=n.UniformsUtils.clone(a.uniforms),o.highPassUniforms.luminosityThreshold.value=s,o.highPassUniforms.smoothWidth.value=.01,o.materialHighPassFilter=new n.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),u=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 n.Vector2(l,u),l=Math.round(l/2),u=Math.round(u/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 n.Vector3(1,1,1),new n.Vector3(1,1,1),new n.Vector3(1,1,1),new n.Vector3(1,1,1),new n.Vector3(1,1,1)],o.compositeMaterial.uniforms.bloomTintColors.value=o.bloomTintColors,e=ca,o.copyUniforms=n.UniformsUtils.clone(e.uniforms),o.copyUniforms.opacity.value=1,o.materialCopy=new n.ShaderMaterial({uniforms:o.copyUniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,blending:n.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0}),o.enabled=!0,o.needsSwap=!1,o._oldClearColor=new n.Color,o.oldClearAlpha=1,o.basic=new n.MeshBasicMaterial,o.fsQuad=new da.T(null),o}return t=i,(e=[{key:"dispose",value:function(){for(var e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(var t=0;t<this.renderTargetsVertical.length;t++)this.renderTargetsVertical[t].dispose();this.renderTargetBright.dispose()}},{key:"setSize",value:function(e,t){var r=Math.round(e/2),i=Math.round(t/2);this.renderTargetBright.setSize(r,i);for(var a=0;a<this.nMips;a++)this.renderTargetsHorizontal[a].setSize(r,i),this.renderTargetsVertical[a].setSize(r,i),this.separableBlurMaterials[a].uniforms.texSize.value=new n.Vector2(r,i),r=Math.round(r/2),i=Math.round(i/2)}},{key:"render",value:function(e,t,n,r,a){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();for(var 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=n.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=n.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this.fsQuad.render(e),this.renderTargetBright),l=0;l<this.nMips;l++)this.fsQuad.material=this.separableBlurMaterials[l],this.separableBlurMaterials[l].uniforms.colorTexture.value=o.texture,this.separableBlurMaterials[l].uniforms.direction.value=i.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[l]),e.clear(),this.fsQuad.render(e),this.separableBlurMaterials[l].uniforms.colorTexture.value=this.renderTargetsHorizontal[l].texture,this.separableBlurMaterials[l].uniforms.direction.value=i.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[l]),e.clear(),this.fsQuad.render(e),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(n),this.fsQuad.render(e),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=s}},{key:"getSeperableBlurMaterial",value:function(e){return new n.ShaderMaterial({defines:{KERNEL_RADIUS:e,SIGMA:e},uniforms:{colorTexture:{value:null},texSize:{value:new n.Vector2(.5,.5)},direction:{value:new n.Vector2(.5,.5)}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec2 direction;\n\n\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\n\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n\t\t\t\t}\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tfloat fSigma = float(SIGMA);\n\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, fSigma);\n\t\t\t\t\tvec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum;\n\t\t\t\t\tfor( int i = 1; i < KERNEL_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = float(i);\n\t\t\t\t\t\tfloat w = gaussianPdf(x, fSigma);\n\t\t\t\t\t\tvec2 uvOffset = direction * invSize * x;\n\t\t\t\t\t\tvec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb;\n\t\t\t\t\t\tvec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb;\n\t\t\t\t\t\tdiffuseSum += (sample1 + sample2) * w;\n\t\t\t\t\t\tweightSum += 2.0 * w;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n\t\t\t\t}"})}},{key:"getCompositeMaterial",value:function(e){return new n.ShaderMaterial({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\t\t\t\tuniform sampler2D blurTexture1;\n\t\t\t\tuniform sampler2D blurTexture2;\n\t\t\t\tuniform sampler2D blurTexture3;\n\t\t\t\tuniform sampler2D blurTexture4;\n\t\t\t\tuniform sampler2D blurTexture5;\n\t\t\t\tuniform float bloomStrength;\n\t\t\t\tuniform float bloomRadius;\n\t\t\t\tuniform float bloomFactors[NUM_MIPS];\n\t\t\t\tuniform vec3 bloomTintColors[NUM_MIPS];\n\n\t\t\t\tfloat lerpBloomFactor(const in float factor) {\n\t\t\t\t\tfloat mirrorFactor = 1.2 - factor;\n\t\t\t\t\treturn mix(factor, mirrorFactor, bloomRadius);\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tgl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );\n\t\t\t\t}"})}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(da.w);ga.BlurDirectionX=new n.Vector2(1,0),ga.BlurDirectionY=new n.Vector2(0,1);class ya extends da.w{constructor(e,t,r){super(),this.baseTextureID=void 0!==t?t:"tDiffuse",this.effectTextureID=void 0!==r?r:"tDiffuse",e instanceof n.ShaderMaterial?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=n.UniformsUtils.clone(e.uniforms),this.material=new n.ShaderMaterial({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new da.T(this.material)}render(e,t,n){this.uniforms[this.baseTextureID]&&(this.uniforms[this.baseTextureID].value=t.texture),this.uniforms[this.effectTextureID]&&(this.uniforms[this.effectTextureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)),this.fsQuad.render(e)}}class ba extends da.w{constructor(e,t,r,i,a){super(),this.scene=e,this.camera=t,this.layerIndex=0,this.overrideMaterial=r,this.clearColor=i,this.clearAlpha=void 0!==a?a:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.oldClearColor=new n.Color,this.oldCameraLayer=t.layers.mask}render(e,t,n){var r=e.autoClear;let i,a;e.autoClear=!1,void 0!==this.overrideMaterial&&(a=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this.oldClearColor),i=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.sceneBg&&(this.scene.background=null),e.setRenderTarget(this.renderToScreen?null:n),this.clear&&e.clear(e.autoClearColor,this.clearDepth,e.autoClearStencil),this.camera.layers.set(this.layerIndex),e.render(this.scene,this.camera),this.camera.layers.mask=this.oldCameraLayer,this.scene.background=this.sceneBg,this.clearColor&&e.setClearColor(this.oldClearColor,i),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=a),this.scene.background=this.sceneBg,e.autoClear=r}}const xa={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 wa{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 ba(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 ga(this.mtuPP.rtSize,1.5,.4,.85),this.bloomPass.radius=this.mtuPP.bloomParams.radius,this.bloomPass.strength=this.mtuPP.bloomParams.strength,this.bloomPass.threshold=this.mtuPP.bloomParams.threshold,this.mixingPass||(this.mixingPass=new ya(xa,"baseTexture","bloomTexture"),this.mixingPass.renderToScreen=!1),this.effectCopy||(this.effectCopy=new ha.T(ca),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 Sa(e){return(Sa="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 Aa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ma(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ba(e,t,n){t&&Ma(e.prototype,t),n&&Ma(e,n),Object.defineProperty(e,"prototype",{writable:!1})}function Ca(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 Ea(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Ta(e);if(n=t?(n=Ta(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===Sa(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function Ta(e){return(Ta=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Da=function(){Ca(t,da.w);var e=Ea(t);function t(n,r){var i;return Aa(this,t),(i=e.call(this)).scene=n,i.camera=r,i.clear=!0,i.needsSwap=!1,i.inverse=!1,i}return Ba(t,[{key:"render",value:function(e,t,n){var r,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?(r=0,1):(r=1,0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(a.REPLACE,a.REPLACE,a.REPLACE),s.buffers.stencil.setFunc(a.ALWAYS,r,4294967295),s.buffers.stencil.setClear(i),s.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),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}(),Pa=function(){Ca(t,da.w);var e=Ea(t);function t(){var n;return Aa(this,t),(n=e.call(this)).needsSwap=!1,n}return Ba(t,[{key:"render",value:function(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}]),t}();function Oa(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var Ra=function(){function e(t,r){var i;(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.renderer=t,void 0===r?(i=t.getSize(new n.Vector2),this._pixelRatio=t.getPixelRatio(),this._width=i.width,this._height=i.height,(r=new n.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio)).texture.name="EffectComposer.rt1"):(this._pixelRatio=1,this._width=r.width,this._height=r.height),this.renderTarget1=r,this.renderTarget2=r.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],void 0===ha.T&&console.error("THREE.EffectComposer relies on ShaderPass"),this.copyPass=new ha.T(ca),this.clock=new n.Clock}return function(e,t,n){t&&Oa(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1})}(e,[{key:"swapBuffers",value:function(){var e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}},{key:"addPass",value:function(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}},{key:"insertPass",value:function(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}},{key:"removePass",value:function(e){-1!==(e=this.passes.indexOf(e))&&this.passes.splice(e,1)}},{key:"isLastEnabledPass",value:function(e){for(var t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}},{key:"render",value:function(e){void 0===e&&(e=this.clock.getDelta());for(var t=this.renderer.getRenderTarget(),n=!1,r=0,i=this.passes.length;r<i;r++){var a,s,o=this.passes[r];!1!==o.enabled&&(o.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(r),o.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),o.needsSwap&&(n&&(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!==Da&&(o instanceof Da?n=!0:o instanceof Pa&&(n=!1)))}this.renderer.setRenderTarget(t)}},{key:"reset",value:function(e){var t;void 0===e&&(t=this.renderer.getSize(new n.Vector2),this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,(e=this.renderTarget1.clone()).setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)),this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}},{key:"setSize",value:function(e,t){this._width=e,this._height=t;var n=this._width*this._pixelRatio,r=this._height*this._pixelRatio;this.renderTarget1.setSize(n,r),this.renderTarget2.setSize(n,r);for(var i=0;i<this.passes.length;i++)this.passes[i].setSize(n,r)}},{key:"setPixelRatio",value:function(e){this._pixelRatio=e,this.setSize(this._width,this._height)}}]),e}();new n.OrthographicCamera(-1,1,1,-1,0,1),(we=new n.BufferGeometry).setAttribute("position",new n.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),we.setAttribute("uv",new n.Float32BufferAttribute([0,2,0,0,2,0],2));const Ia="\n varying vec2 vUv;\n \n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",ka="\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 La{constructor(e){this.mtuPP=e,this.bloomLayer=new bs.Layers,this.bloomLayer.set(this.mtuPP.BLOOM_SCENE),this.darkMaterial=new bs.MeshBasicMaterial({color:"black"}),this.materials={},(e=this.mtuPP.mainScene).fog&&(this.mtuPP.sceneFogColor||(this.mtuPP.sceneFogColor=new bs.Color),this.mtuPP.sceneFogColor.copy(e.fog.color)),e.background&&(this.mtuPP.sceneBackground=e.background),this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.bloomPass=new ga(this.mtuPP.rtSize,1.5,.4,.85),this.bloomPass.radius=this.mtuPP.bloomParams.radius,this.bloomPass.strength=this.mtuPP.bloomParams.strength,this.bloomPass.threshold=this.mtuPP.bloomParams.threshold,this.mtuPP.effectComposer.addPass(this.bloomPass),this.finalPass=new ha.T(new bs.ShaderMaterial({uniforms:{baseTexture:{value:null},bloomTexture:{value:this.mtuPP.effectComposer.renderTarget2.texture}},vertexShader:Ia,fragmentShader:ka,defines:{}}),"baseTexture"),this.finalPass.needsSwap=!0;var e=new bs.WebGLRenderTarget(this.mtuPP.rtSize.x,this.mtuPP.rtSize.y,{samples:this.mtuPP.ppParams.samples});this.finalComposer=new Ra(this.mtuPP.renderer,e),this.finalComposer.addPass(this.mtuPP.renderPass),this.finalComposer.addPass(this.finalPass)}renderBloom(e){var t;this.mtuPP.sceneFogColor&&null!=(t=this.mtuPP.mainScene.fog)&&t.color.copy(this.mtuPP.BLACK_COLOR),this.mtuPP.sceneBackground&&(this.mtuPP.mainScene.background=this.mtuPP.BLACK_COLOR),e?(this.mtuPP.mainScene.traverse((e=>{e.isMesh&&!this.bloomLayer.test(e.layers)&&(this.materials[e.uuid]=e.material,e.material=this.darkMaterial)})),this.mtuPP.effectComposer.render(),this.mtuPP.mainScene.traverse((e=>{this.materials[e.uuid]&&(e.material=this.materials[e.uuid],delete this.materials[e.uuid])}))):(this.mtuPP.mainCamera.layers.set(this.mtuPP.BLOOM_SCENE),this.mtuPP.effectComposer.render(),this.mtuPP.mainCamera.layers.set(this.mtuPP.ENTIRE_SCENE)),this.mtuPP.sceneFogColor&&null!=(t=this.mtuPP.mainScene.fog)&&t.color.copy(this.mtuPP.sceneFogColor),this.mtuPP.sceneBackground&&(this.mtuPP.mainScene.background=this.mtuPP.sceneBackground)}render(){this.renderBloom(!0),this.finalComposer.render()}setGlowData(e,t){this.bloomPass[e]=t}setSize(e,t){this.finalComposer&&this.finalComposer.setSize(e,t)}dispose(){this.bloomPass&&(this.bloomPass.dispose(),this.bloomPass=null),this.finalPass=null,this.finalComposer&&(this.finalComposer.renderTarget1&&(this.finalComposer.renderTarget1.dispose(),this.finalComposer.renderTarget1=null),this.finalComposer.renderTarget2&&(this.finalComposer.renderTarget2.dispose(),this.finalComposer.renderTarget2=null),this.finalComposer=null)}enablePass(e){this.bloomPass&&this.bloomPass.enabled!==e&&(this.bloomPass.enabled=e,this.finalPass.enabled=e)}}function Fa(e){return(Fa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ua(e,t){return(Ua=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ga(e){return(Ga=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Na=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ua(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Ga(e);if(n=t?(n=Ga(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===Fa(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e,t,a,s){var o;if(!(this instanceof i))throw new TypeError("Cannot call a class as a function");return(o=r.call(this)).renderScene=t,o.renderCamera=a,o.selectedObjects=void 0!==s?s:[],o.visibleEdgeColor=new n.Color(1,1,1),o.hiddenEdgeColor=new n.Color(.1,.04,.02),o.edgeGlow=0,o.usePatternTexture=!1,o.edgeThickness=1,o.edgeStrength=3,o.downSampleRatio=2,o.pulsePeriod=0,o._visibilityCache=new Map,o.resolution=void 0!==e?new n.Vector2(e.x,e.y):new n.Vector2(256,256),t=Math.round(o.resolution.x/o.downSampleRatio),a=Math.round(o.resolution.y/o.downSampleRatio),o.renderTargetMaskBuffer=new n.WebGLRenderTarget(o.resolution.x,o.resolution.y),o.renderTargetMaskBuffer.texture.name="OutlinePass.mask",o.renderTargetMaskBuffer.texture.generateMipmaps=!1,o.depthMaterial=new n.MeshDepthMaterial,o.depthMaterial.side=n.DoubleSide,o.depthMaterial.depthPacking=n.RGBADepthPacking,o.depthMaterial.blending=n.NoBlending,o.prepareMaskMaterial=o.getPrepareMaskMaterial(),o.prepareMaskMaterial.side=n.DoubleSide,o.prepareMaskMaterial.fragmentShader=function(e,t){return t=t.isPerspectiveCamera?"perspective":"orthographic",e.replace(/DEPTH_TO_VIEW_Z/g,t+"DepthToViewZ")}(o.prepareMaskMaterial.fragmentShader,o.renderCamera),o.renderTargetDepthBuffer=new n.WebGLRenderTarget(o.resolution.x,o.resolution.y),o.renderTargetDepthBuffer.texture.name="OutlinePass.depth",o.renderTargetDepthBuffer.texture.generateMipmaps=!1,o.renderTargetMaskDownSampleBuffer=new n.WebGLRenderTarget(t,a),o.renderTargetMaskDownSampleBuffer.texture.name="OutlinePass.depthDownSample",o.renderTargetMaskDownSampleBuffer.texture.generateMipmaps=!1,o.renderTargetBlurBuffer1=new n.WebGLRenderTarget(t,a),o.renderTargetBlurBuffer1.texture.name="OutlinePass.blur1",o.renderTargetBlurBuffer1.texture.generateMipmaps=!1,o.renderTargetBlurBuffer2=new n.WebGLRenderTarget(Math.round(t/2),Math.round(a/2)),o.renderTargetBlurBuffer2.texture.name="OutlinePass.blur2",o.renderTargetBlurBuffer2.texture.generateMipmaps=!1,o.edgeDetectionMaterial=o.getEdgeDetectionMaterial(),o.renderTargetEdgeBuffer1=new n.WebGLRenderTarget(t,a),o.renderTargetEdgeBuffer1.texture.name="OutlinePass.edge1",o.renderTargetEdgeBuffer1.texture.generateMipmaps=!1,o.renderTargetEdgeBuffer2=new n.WebGLRenderTarget(Math.round(t/2),Math.round(a/2)),o.renderTargetEdgeBuffer2.texture.name="OutlinePass.edge2",o.renderTargetEdgeBuffer2.texture.generateMipmaps=!1,o.separableBlurMaterial1=o.getSeperableBlurMaterial(4),o.separableBlurMaterial1.uniforms.texSize.value.set(t,a),o.separableBlurMaterial1.uniforms.kernelRadius.value=1,o.separableBlurMaterial2=o.getSeperableBlurMaterial(4),o.separableBlurMaterial2.uniforms.texSize.value.set(Math.round(t/2),Math.round(a/2)),o.separableBlurMaterial2.uniforms.kernelRadius.value=4,o.overlayMaterial=o.getOverlayMaterial(),s=ca,o.copyUniforms=n.UniformsUtils.clone(s.uniforms),o.copyUniforms.opacity.value=1,o.materialCopy=new n.ShaderMaterial({uniforms:o.copyUniforms,vertexShader:s.vertexShader,fragmentShader:s.fragmentShader,blending:n.NoBlending,depthTest:!1,depthWrite:!1,transparent:!0}),o.enabled=!0,o.needsSwap=!1,o._oldClearColor=new n.Color,o.oldClearAlpha=1,o.fsQuad=new da.T(null),o.tempPulseColor1=new n.Color,o.tempPulseColor2=new n.Color,o.textureMatrix=new n.Matrix4,o}return t=i,(e=[{key:"dispose",value:function(){this.renderTargetMaskBuffer.dispose(),this.renderTargetDepthBuffer.dispose(),this.renderTargetMaskDownSampleBuffer.dispose(),this.renderTargetBlurBuffer1.dispose(),this.renderTargetBlurBuffer2.dispose(),this.renderTargetEdgeBuffer1.dispose(),this.renderTargetEdgeBuffer2.dispose()}},{key:"setSize",value:function(e,t){this.renderTargetMaskBuffer.setSize(e,t),this.renderTargetDepthBuffer.setSize(e,t),e=Math.round(e/this.downSampleRatio),t=Math.round(t/this.downSampleRatio),this.renderTargetMaskDownSampleBuffer.setSize(e,t),this.renderTargetBlurBuffer1.setSize(e,t),this.renderTargetEdgeBuffer1.setSize(e,t),this.separableBlurMaterial1.uniforms.texSize.value.set(e,t),e=Math.round(e/2),t=Math.round(t/2),this.renderTargetBlurBuffer2.setSize(e,t),this.renderTargetEdgeBuffer2.setSize(e,t),this.separableBlurMaterial2.uniforms.texSize.value.set(e,t)}},{key:"changeVisibilityOfSelectedObjects",value:function(e){var t=this._visibilityCache;function n(n){n.isMesh&&(!0===e?n.visible=t.get(n):(t.set(n,n.visible),n.visible=e))}for(var r=0;r<this.selectedObjects.length;r++)this.selectedObjects[r].traverse(n)}},{key:"changeVisibilityOfNonSelectedObjects",value:function(e){var t=this._visibilityCache,n=[];function r(e){e.isMesh&&n.push(e)}for(var i=0;i<this.selectedObjects.length;i++)this.selectedObjects[i].traverse(r);this.renderScene.traverse((function(r){if(r.isMesh||r.isSprite){for(var i,a=!1,s=0;s<n.length;s++)if(n[s].id===r.id){a=!0;break}!1===a&&(i=r.visible,!1!==e&&!0!==t.get(r)||(r.visible=e),t.set(r,i))}else(r.isPoints||r.isLine)&&(!0===e?r.visible=t.get(r):(t.set(r,r.visible),r.visible=e))}))}},{key:"updateTextureMatrix",value:function(){this.textureMatrix.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),this.textureMatrix.multiply(this.renderCamera.projectionMatrix),this.textureMatrix.multiply(this.renderCamera.matrixWorldInverse)}},{key:"render",value:function(e,t,n,r,a){var 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=i.BlurDirectionX,this.separableBlurMaterial1.uniforms.kernelRadius.value=this.edgeThickness,e.setRenderTarget(this.renderTargetBlurBuffer1),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetBlurBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=i.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial2,this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial2.uniforms.direction.value=i.BlurDirectionX,e.setRenderTarget(this.renderTargetBlurBuffer2),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetBlurBuffer2.texture,this.separableBlurMaterial2.uniforms.direction.value=i.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer2),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.overlayMaterial,this.overlayMaterial.uniforms.maskTexture.value=this.renderTargetMaskBuffer.texture,this.overlayMaterial.uniforms.edgeTexture1.value=this.renderTargetEdgeBuffer1.texture,this.overlayMaterial.uniforms.edgeTexture2.value=this.renderTargetEdgeBuffer2.texture,this.overlayMaterial.uniforms.patternTexture.value=this.patternTexture,this.overlayMaterial.uniforms.edgeStrength.value=this.edgeStrength,this.overlayMaterial.uniforms.edgeGlow.value=this.edgeGlow,this.overlayMaterial.uniforms.usePatternTexture.value=this.usePatternTexture,a&&e.state.buffers.stencil.setTest(!0),e.setRenderTarget(n),this.fsQuad.render(e),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=s),this.renderToScreen&&(this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=n.texture,e.setRenderTarget(null),this.fsQuad.render(e))}},{key:"getPrepareMaskMaterial",value:function(){return new n.ShaderMaterial({uniforms:{depthTexture:{value:null},cameraNearFar:{value:new n.Vector2(.5,.5)},textureMatrix:{value:null}},vertexShader:"#include <morphtarget_pars_vertex>\n\t\t\t\t#include <skinning_pars_vertex>\n\n\t\t\t\tvarying vec4 projTexCoord;\n\t\t\t\tvarying vec4 vPosition;\n\t\t\t\tuniform mat4 textureMatrix;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\t#include <skinbase_vertex>\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <morphtarget_vertex>\n\t\t\t\t\t#include <skinning_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t\tvPosition = mvPosition;\n\t\t\t\t\tvec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n\t\t\t\t\tprojTexCoord = textureMatrix * worldPosition;\n\n\t\t\t\t}",fragmentShader:"#include <packing>\n\t\t\t\tvarying vec4 vPosition;\n\t\t\t\tvarying vec4 projTexCoord;\n\t\t\t\tuniform sampler2D depthTexture;\n\t\t\t\tuniform vec2 cameraNearFar;\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tfloat depth = unpackRGBAToDepth(texture2DProj( depthTexture, projTexCoord ));\n\t\t\t\t\tfloat viewZ = - DEPTH_TO_VIEW_Z( depth, cameraNearFar.x, cameraNearFar.y );\n\t\t\t\t\tfloat depthTest = (-vPosition.z > viewZ) ? 1.0 : 0.0;\n\t\t\t\t\tgl_FragColor = vec4(0.0, depthTest, 1.0, 1.0);\n\n\t\t\t\t}"})}},{key:"getEdgeDetectionMaterial",value:function(){return new n.ShaderMaterial({uniforms:{maskTexture:{value:null},texSize:{value:new n.Vector2(.5,.5)},visibleEdgeColor:{value:new n.Vector3(1,1,1)},hiddenEdgeColor:{value:new n.Vector3(1,1,1)}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\n\t\t\t\tuniform sampler2D maskTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec3 visibleEdgeColor;\n\t\t\t\tuniform vec3 hiddenEdgeColor;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tvec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\n\t\t\t\t\tvec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy);\n\t\t\t\t\tvec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy);\n\t\t\t\t\tvec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw);\n\t\t\t\t\tvec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw);\n\t\t\t\t\tfloat diff1 = (c1.r - c2.r)*0.5;\n\t\t\t\t\tfloat diff2 = (c3.r - c4.r)*0.5;\n\t\t\t\t\tfloat d = length( vec2(diff1, diff2) );\n\t\t\t\t\tfloat a1 = min(c1.g, c2.g);\n\t\t\t\t\tfloat a2 = min(c3.g, c4.g);\n\t\t\t\t\tfloat visibilityFactor = min(a1, a2);\n\t\t\t\t\tvec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;\n\t\t\t\t\tgl_FragColor = vec4(edgeColor, 1.0) * vec4(d);\n\t\t\t\t}"})}},{key:"getSeperableBlurMaterial",value:function(e){return new n.ShaderMaterial({defines:{MAX_RADIUS:e},uniforms:{colorTexture:{value:null},texSize:{value:new n.Vector2(.5,.5)},direction:{value:new n.Vector2(.5,.5)},kernelRadius:{value:1}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include <common>\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec2 direction;\n\t\t\t\tuniform float kernelRadius;\n\n\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\n\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\n\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, kernelRadius);\n\t\t\t\t\tvec4 diffuseSum = texture2D( colorTexture, vUv) * weightSum;\n\t\t\t\t\tvec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS);\n\t\t\t\t\tvec2 uvOffset = delta;\n\t\t\t\t\tfor( int i = 1; i <= MAX_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat w = gaussianPdf(uvOffset.x, kernelRadius);\n\t\t\t\t\t\tvec4 sample1 = texture2D( colorTexture, vUv + uvOffset);\n\t\t\t\t\t\tvec4 sample2 = texture2D( colorTexture, vUv - uvOffset);\n\t\t\t\t\t\tdiffuseSum += ((sample1 + sample2) * w);\n\t\t\t\t\t\tweightSum += (2.0 * w);\n\t\t\t\t\t\tuvOffset += delta;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = diffuseSum/weightSum;\n\t\t\t\t}"})}},{key:"getOverlayMaterial",value:function(){return new n.ShaderMaterial({uniforms:{maskTexture:{value:null},edgeTexture1:{value:null},edgeTexture2:{value:null},patternTexture:{value:null},edgeStrength:{value:1},edgeGlow:{value:1},usePatternTexture:{value:0}},vertexShader:"varying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\n\t\t\t\tuniform sampler2D maskTexture;\n\t\t\t\tuniform sampler2D edgeTexture1;\n\t\t\t\tuniform sampler2D edgeTexture2;\n\t\t\t\tuniform sampler2D patternTexture;\n\t\t\t\tuniform float edgeStrength;\n\t\t\t\tuniform float edgeGlow;\n\t\t\t\tuniform bool usePatternTexture;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 edgeValue1 = texture2D(edgeTexture1, vUv);\n\t\t\t\t\tvec4 edgeValue2 = texture2D(edgeTexture2, vUv);\n\t\t\t\t\tvec4 maskColor = texture2D(maskTexture, vUv);\n\t\t\t\t\tvec4 patternColor = texture2D(patternTexture, 6.0 * vUv);\n\t\t\t\t\tfloat visibilityFactor = 1.0 - maskColor.g > 0.0 ? 1.0 : 0.5;\n\t\t\t\t\tvec4 edgeValue = edgeValue1 + edgeValue2 * edgeGlow;\n\t\t\t\t\tvec4 finalColor = edgeStrength * maskColor.r * edgeValue;\n\t\t\t\t\tif(usePatternTexture)\n\t\t\t\t\t\tfinalColor += + visibilityFactor * (1.0 - maskColor.r) * (1.0 - patternColor.r);\n\t\t\t\t\tgl_FragColor = finalColor;\n\t\t\t\t}",blending:n.AdditiveBlending,depthTest:!1,depthWrite:!1,transparent:!0})}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(da.w);Na.BlurDirectionX=new n.Vector2(1,0),Na.BlurDirectionY=new n.Vector2(0,1);class ja{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.outlinePass||(this.outlinePass=new Na(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 bs.Color(t):t}dispose(){this.outlinePass&&(this.outlinePass.dispose(),this.outlinePass=null)}addSelectedObject(e,t=!0){this.outlinePass&&e&&(this.outlinePass.selectedObjects||(this.outlinePass.selectedObjects=[]),t?this.isObjExist(e)||(e.userData.outline=!0,this.outlinePass.selectedObjects.push(e)):this.outlinePass.selectedObjects.map(((t,n)=>{t.uuid===e.uuid&&(e.userData.outline=!1,this.outlinePass.selectedObjects.splice(n,1))})))}isObjExist(e){if(!e||!this.outlinePass||!this.outlinePass.selectedObjects)return!1;let t=!1;return this.outlinePass.selectedObjects.forEach((n=>{e.uuid===n.uuid&&(t=!0)})),t}enablePass(e){this.outlinePass&&this.outlinePass.enabled!==e&&(this.outlinePass.enabled=e)}}class Ha extends n.ShaderMaterial{constructor(...e){super(...e),["opacity","map","emissiveMap","roughnessMap","metalnessMap"].forEach((e=>{Object.defineProperty(this,e,{get(){if(e in this.uniforms)return this.uniforms[e].value},set(t){e in this.uniforms&&(this.uniforms[e].value=t)}})}))}}class za extends Ha{constructor(...e){super(...e),this.modifiedDefines={},this.modifiedUniforms={}}setDefine(e,t){const n=this.defines,r=this.modifiedDefines;null==t?e in n&&(e in r||(r[e]=n[e]),delete n[e]):n[e]!==t&&(e in r||(r[e]=e in n?n[e]:void 0),n[e]=t)}setTextureUniform(e,t){const n=this.uniforms,r=this.modifiedUniforms;e in r||(r[e]=n[e].value),n[e].value=t}finalize(){const e=this.modifiedDefines;var t=this.defines;for(const n in e)void 0===e[n]?n in t&&(this.needsUpdate=!0):t[n]!==e[n]&&(this.needsUpdate=!0),delete e[n];const n=this.modifiedUniforms;var r=this.uniforms;for(const e in n)n[e]!==r[e].value&&(this.needsUpdate=!0),delete n[e]}}const Va=new WeakMap;class Ja{constructor(e){this._replacementMaterial=new za(e),this._replacementMaterials=new WeakMap,this.overrideUniforms={},this.overrideDefines={}}replace(e,t=!1,n=!0){const r=this;function i(e){if(!e.isHelper&&(e.isMesh||e.isSkinnedMesh)){if(!a.has(e)){const t=r.createMaterial(e);a.set(e,t)}const t=a.get(e);if(null!==t){let i=e.material;n?s.set(e,i):i=s.get(e),i||console.error("ShaderReplacement : Material for object was not cached before replacing shader.",e),r.updateUniforms(e,i,t),t.finalize&&t.finalize(),e.material=t}}}const a=this._replacementMaterials,s=Va;if(Array.isArray(e))if(t)for(let t=0,n=e.length;t<n;t++)e[t].traverse(i);else for(let t=0,n=e.length;t<n;t++)i(e[t]);else t?e.traverse(i):i(e)}reset(e,t){function n(e){e.isHelper||(r.has(e)?(e.material=r.get(e),r.delete(e)):(e.isSkinnedMesh||e.isMesh)&&console.error("ShaderReplacement : Material for object was not cached before resetting.",e))}const r=Va;if(Array.isArray(e))if(t)for(let t=0,r=e.length;t<r;t++)n(e[t]);else for(let t=0,r=e.length;t<r;t++)e[t].traverse(n);else t?e.traverse(n):n(e)}createMaterial(e){return this._replacementMaterial.clone()}updateUniforms(e,t,n){var r=this._replacementMaterial.defines,i=t.defines;const a=n.defines;if(n.side=t.side,n.flatShading=t.flatShading,n.skinning=t.skinning,i){for(const e in i)n.setDefine(e,i[e]);for(const e in a)e in i?n.setDefine(e,i[e]):n.setDefine(e,r[e])}const s=n.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?n.setTextureUniform(e,l.value):t.value=l.value)}}else for(const e in s){const r=s[e];e in t&&t[e]!==r.value&&(r.value&&r.value.isTexture||t[e]&&t[e].isTexture?n.setTextureUniform(e,t[e]):r.value=t[e])}var{overrideDefines:u,overrideUniforms:c}=this;for(const e in u)null===u[e]||void 0===u[e]?delete a[e]:a[e]!==u[e]&&(a[e]=u[e],n.needsUpdate=!0);for(const e in c)e in s&&(s[e].value=c[e].value)}dispose(){}}class Ka extends Ja{constructor(){super({extensions:{derivatives:!0},defines:{USE_UV:""},uniforms:Object.assign(Object.assign({},n.ShaderLib.normal.uniforms),{alphaMap:{value:null},alphaTest:{value:0},map:{value:null},opacity:{value:1}}),vertexShader:n.ShaderLib.normal.vertexShader,fragmentShader:"\n\t\t\t\t#define NORMAL\n\t\t\t\tuniform float opacity;\n\t\t\t\t#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\t\t\t\t\tvarying vec3 vViewPosition;\n\t\t\t\t#endif\n\t\t\t\t#ifndef FLAT_SHADED\n\t\t\t\t\tvarying vec3 vNormal;\n\t\t\t\t\t#ifdef USE_TANGENT\n\t\t\t\t\t\tvarying vec3 vTangent;\n\t\t\t\t\t\tvarying vec3 vBitangent;\n\t\t\t\t\t#endif\n\t\t\t\t#endif\n\t\t\t\t#include <packing>\n\t\t\t\t#include <uv_pars_fragment>\n\t\t\t\t#include <map_pars_fragment>\n\t\t\t\t#include <bumpmap_pars_fragment>\n\t\t\t\t#include <normalmap_pars_fragment>\n\t\t\t\t#include <alphamap_pars_fragment>\n\t\t\t\t#include <logdepthbuf_pars_fragment>\n\t\t\t\t#include <clipping_planes_pars_fragment>\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t\t\t\t\t#include <clipping_planes_fragment>\n\t\t\t\t\t#include <logdepthbuf_fragment>\n\t\t\t\t\t#include <map_fragment>\n\t\t\t\t\t#include <alphamap_fragment>\n\t\t\t\t\t#include <alphatest_fragment>\n\t\t\t\t\t#include <normal_fragment_begin>\n\t\t\t\t\t#include <normal_fragment_maps>\n\t\t\t\t\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t\t\t\t}\n\t\t\t"}),this.useNormalMaps=!1}createMaterial(...e){return super.createMaterial(...e)}updateUniforms(e,t,n){super.updateUniforms(e,t,n),n.setDefine("USE_NORMALMAP",this.useNormalMaps&&n.uniforms.normalMap.value?"":void 0),n.setDefine("TANGENTSPACE_NORMALMAP",this.useNormalMaps&&n.uniforms.normalMap.value?"":void 0),n.setDefine("ALPHATEST",n.uniforms.alphaTest.value||void 0),n.setDefine("USE_ALPHAMAP",0!==n.defines.ALPHATEST&&n.uniforms.alphaMap.value?"":void 0),n.setDefine("USE_MAP",0!==n.defines.ALPHATEST&&n.uniforms.map.value?"":void 0),n.setDefine("USE_UV","USE_ALPHAMAP"in n.defines||"USE_MAP"in n.defines?"":void 0)}}class Za extends Ja{constructor(){super({extensions:{derivatives:!0},defines:{USE_UV:""},uniforms:Object.assign(Object.assign({},n.ShaderLib.normal.uniforms),{alphaMap:{value:null},alphaTest:{value:0},map:{value:null},opacity:{value:1}}),vertexShader:"\n\t\t\t\tvarying vec3 vViewPosition;\n\t\t\t\t#include <common>\n\t\t\t\t#include <uv_pars_vertex>\n\t\t\t\t#include <displacementmap_pars_vertex>\n\t\t\t\t#include <morphtarget_pars_vertex>\n\t\t\t\t#include <skinning_pars_vertex>\n\t\t\t\t#include <logdepthbuf_pars_vertex>\n\t\t\t\t#include <clipping_planes_pars_vertex>\n\t\t\t\tvoid main() {\n\t\t\t\t\t#include <uv_vertex>\n\t\t\t\t\t#include <beginnormal_vertex>\n\t\t\t\t\t#include <morphnormal_vertex>\n\t\t\t\t\t#include <skinbase_vertex>\n\t\t\t\t\t#include <skinnormal_vertex>\n\t\t\t\t\t#include <defaultnormal_vertex>\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <morphtarget_vertex>\n\t\t\t\t\t#include <skinning_vertex>\n\t\t\t\t\t#include <displacementmap_vertex>\n\t\t\t\t\t#include <project_vertex>\n\t\t\t\t\t#include <logdepthbuf_vertex>\n\t\t\t\t\t#include <clipping_planes_vertex>\n\t\t\t\t\tvViewPosition = mvPosition.xyz;\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\t\t\t\tuniform float opacity;\n\t\t\t\tvarying vec3 vViewPosition;\n\t\t\t\t#include <uv_pars_fragment>\n\t\t\t\t#include <map_pars_fragment>\n\t\t\t\t#include <bumpmap_pars_fragment>\n\t\t\t\t#include <normalmap_pars_fragment>\n\t\t\t\t#include <alphamap_pars_fragment>\n\t\t\t\t#include <logdepthbuf_pars_fragment>\n\t\t\t\t#include <clipping_planes_pars_fragment>\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t\t\t\t\t#include <clipping_planes_fragment>\n\t\t\t\t\t#include <logdepthbuf_fragment>\n\t\t\t\t\t#include <map_fragment>\n\t\t\t\t\t#include <alphamap_fragment>\n\t\t\t\t\t#include <alphatest_fragment>\n\t\t\t\t\tgl_FragColor = vec4( vViewPosition.z );\n\t\t\t\t}\n\t\t\t"}),this.invertSide=!1}updateUniforms(e,t,r){super.updateUniforms(e,t,r),this.invertSide&&(r.side=r.side===n.FrontSide?n.BackSide:n.FrontSide),e=r.defines.ALPHATEST,0===r.uniforms.alphaTest.value?delete r.defines.ALPHATEST:r.defines.ALPHATEST=r.uniforms.alphaTest.value,e!==r.defines.ALPHATEST&&(r.needsUpdate=!0),e=r.defines.USE_ALPHAMAP,0!==r.defines.ALPHATEST&&r.uniforms.alphaMap.value?r.defines.USE_ALPHAMAP="":delete r.defines.USE_ALPHAMAP,e!==r.defines.USE_ALPHAMAP&&(r.needsUpdate=!0),e=r.defines.USE_MAP,0!==r.defines.ALPHATEST&&r.uniforms.map.value?r.defines.USE_MAP="":delete r.defines.USE_MAP,e!==r.defines.USE_MAP&&(r.needsUpdate=!0),e=r.defines.USE_UV,"USE_ALPHAMAP"in r.defines||"USE_MAP"in r.defines?r.defines.USE_UV="":delete r.defines.USE_UV,e!==r.defines.USE_UV&&(r.needsUpdate=!0)}}const Wa={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"},Xa={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"},Qa={defines:{NUM_DIRECTIONS:32,NUM_STEPS:16,RADIUS:"2.0",ENABLE_FALLOFF:1,FALLOFF_START2:"0.16",FALLOFF_END2:"4.0",ENABLE_ROTATION_JITTER:1,ENABLE_RADIUS_JITTER:1,ENABLE_COLOR_BOUNCE:1,JITTER_TYPE:0},uniforms:{colorBuffer:{value:null},normalBuffer:{value:null},depthBuffer:{value:null},renderSize:{value:new n.Vector2},blueNoiseTex:{value:null},blueNoiseSize:{value:1},clipInfo:{value:new n.Vector4},projInfo:{value:new n.Vector4},params:{value:new n.Vector2},lightBounceIntensity:{value:1}},vertexShader:"\n\t\tvarying vec2 vUv;\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}\n\t",fragmentShader:"\n\t\t#define TWO_PI\t\t\t6.2831853071795864\n\t\t#define HALF_PI\t\t\t1.5707963267948966\n\t\t#define ONE_OVER_PI\t\t0.3183098861837906\n\n\t\t#include <common>\n\t\t#include <packing>\n\t\tvarying vec2 vUv;\n\n\t\tuniform sampler2D noiseTexture;\n\t\tuniform sampler2D normalBuffer;\n\t\tuniform sampler2D depthBuffer;\n\t\tuniform sampler2D colorBuffer;\n\t\tuniform vec2 renderSize;\n\n\t\tuniform vec4 projInfo;\n\t\tuniform vec4 clipInfo;\n\t\tuniform vec4 params;\n\t\tuniform float lightBounceIntensity;\n\n\t\t#if ENABLE_ROTATION_JITTER == 2 || ENABLE_RADIUS_JITTER == 2\n\t\tuniform float blueNoiseSize;\n\t\tuniform sampler2D blueNoiseTex;\n\t\t#endif\n\n\t\tfloat roundF(float f) {\n\t\t\treturn f < 0.5 ? floor(f) : ceil(f);\n\t\t}\n\n\t\tvec2 roundV2(vec2 v) {\n\t\t\tv.x = roundF(v.x);\n\t\t\tv.y = roundF(v.y);\n\t\t\treturn v;\n\t\t}\n\n\t\tvec3 UnpackNormal(vec4 d) {\n\t\t\treturn d.xyz * 2.0 - 1.0;\n\t\t}\n\n\t\tvec4 GetViewPosition( vec2 uv ) {\n\n\t\t\tfloat near = clipInfo.x;\n\t\t\tfloat far = clipInfo.y;\n\n\t\t\tvec2 basesize = renderSize;\n\t\t\tvec2 coord = ( uv / basesize );\n\n\t\t\t// d is expected to be [ 0.0, 1.0 ]\n\t\t\tfloat d = texture2D( depthBuffer, coord ).r;\n\t\t\td = d == 0.0 ? far : d;\n\t\t\td = ( abs( d ) - near ) / ( far - near );\n\n\t\t\tvec4 ret = vec4( 0.0 );\n\t\t\tret.w = d;\n\t\t\tret.z = near + d * ( far - near );\n\t\t\tret.xy = ( uv * projInfo.xy + projInfo.zw ) * ret.z;\n\n\t\t\treturn ret;\n\n\t\t}\n\n\t\tfloat Falloff( float dist2 ) {\n\n\t\t\treturn 2.0 * clamp(\n\t\t\t\t( dist2 - FALLOFF_START2 ) / ( FALLOFF_END2 - FALLOFF_START2 ),\n\t\t\t\t0.0,\n\t\t\t\t1.0\n\t\t\t);\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvec2 screenCoord = gl_FragCoord.xy;\n\t\t\tvec4 vpos = GetViewPosition( renderSize * vUv );\n\n\t\t\t// if it's the background\n\t\t\tif ( vpos.w == 1.0 ) {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0);\n\t\t\t\treturn;\n\n\t\t\t}\n\n\t\t\tvec4 s;\n\t\t\tvec3 vnorm\t= UnpackNormal( texture2D( normalBuffer, vUv ) );\n\t\t\tvec3 vdir\t= normalize( - vpos.xyz );\n\t\t\tvec3 dir, ws;\n\n\t\t\t// calculation uses left handed system\n\t\t\tvnorm.z = - vnorm.z;\n\n\t\t\tvec2 noises\t= vec2( 0.0 );\n\t\t\tvec2 offset;\n\t\t\tvec2 horizons = vec2( - 1.0, - 1.0 );\n\n\t\t\t// scale the search radius by the depth and camera FOV\n\t\t\tfloat radius = ( RADIUS * clipInfo.z ) / vpos.z;\n\t\t\tradius = max( float( NUM_STEPS ), radius );\n\n\t\t\tfloat stepSize\t= radius / float( NUM_STEPS );\n\t\t\tfloat phi\t\t= 0.0;\n\t\t\tfloat ao\t\t= 0.0;\n\t\t\tfloat division\t= noises.y * stepSize;\n\t\t\tfloat currStep\t= 1.0 + division + 0.25 * stepSize * params.y;\n\t\t\tfloat dist2, invdist, falloff, cosh;\n\n\t\t\t#if ENABLE_COLOR_BOUNCE\n\t\t\tvec3 color = vec3( 0.0 );\n\t\t\t#endif\n\n\t\t\t#if ENABLE_ROTATION_JITTER == 1\n\n\t\t\t// Rotation jitter approach from\n\t\t\t// https://github.com/MaxwellGengYF/Unity-Ground-Truth-Ambient-Occlusion/blob/9cc30e0f31eb950a994c71866d79b2798d1c508e/Shaders/GTAO_Common.cginc#L152-L155\n\t\t\tfloat rotJitterOffset = PI * fract( 52.9829189 * fract( dot( screenCoord, vec2( 0.06711056, 0.00583715 ) ) ) );\n\n\t\t\t#elif ENABLE_ROTATION_JITTER == 2\n\n\t\t\tfloat rotJitterOffset = PI * texture2D( blueNoiseTex, gl_FragCoord.xy / blueNoiseSize ).r;\n\n\t\t\t#endif\n\n\t\t\t#if ENABLE_RADIUS_JITTER == 1\n\n\t\t\tfloat jitterMod = ( gl_FragCoord.x + gl_FragCoord.y ) * 0.25;\n\t\t\tfloat radiusJitterOffset = mod( jitterMod, 1.0 ) * stepSize * 0.25;\n\n\t\t\t#elif ENABLE_RADIUS_JITTER == 2\n\n\t\t\tfloat radiusJitterOffset = PI * texture2D( blueNoiseTex, gl_FragCoord.xy / blueNoiseSize ).g;\n\n\t\t\t#endif\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = 0; i < NUM_DIRECTIONS; i ++ ) {\n\n\t\t\t\tphi = float( i ) * ( PI / float( NUM_DIRECTIONS ) ) + params.x * PI;\n\n\t\t\t\t#if ENABLE_ROTATION_JITTER != 0\n\n\t\t\t\tphi += rotJitterOffset;\n\n\t\t\t\t#endif\n\n\t\t\t\tcurrStep = 1.0 + 0.25 * stepSize * params.y;\n\n\n\t\t\t\t#if ENABLE_RADIUS_JITTER != 0\n\n\t\t\t\tcurrStep += radiusJitterOffset;\n\n\t\t\t\t#endif\n\n\t\t\t\tdir = vec3( cos( phi ), sin( phi ), 0.0 );\n\t\t\t\thorizons = vec2( - 1.0 );\n\n\t\t\t\t// calculate horizon angles\n\t\t\t\tfor ( int j = 0; j < NUM_STEPS; ++ j ) {\n\n\t\t\t\t\toffset = roundV2(dir.xy * currStep);\n\n\t\t\t\t\t// h1\n\t\t\t\t\ts = GetViewPosition( screenCoord + offset );\n\t\t\t\t\tws = s.xyz - vpos.xyz;\n\n\t\t\t\t\tdist2 = dot( ws, ws );\n\t\t\t\t\tinvdist = inversesqrt( dist2 );\n\t\t\t\t\tcosh = invdist * dot( ws, vdir );\n\n\t\t\t\t\t#if ENABLE_FALLOFF\n\n\t\t\t\t\tfalloff = Falloff( dist2 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\thorizons.x = max( horizons.x, cosh - falloff );\n\n\t\t\t\t\t#if ENABLE_COLOR_BOUNCE\n\n\t\t\t\t\tvec3 ptColor, ptDir;\n\t\t\t\t\tfloat alpha;\n\t\t\t\t\tptColor = texture2D( colorBuffer, ( screenCoord + offset ) / renderSize ).rgb;\n\t\t\t\t\tptDir = normalize( ws );\n\t\t\t\t\talpha = saturate( length( ws ) / float( RADIUS ) );\n\t\t\t\t\tcolor += ptColor * saturate( dot( ptDir, vnorm ) ) * pow( ( 1.0 - alpha ), 2.0 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\t// h2\n\t\t\t\t\ts = GetViewPosition( screenCoord - offset );\n\t\t\t\t\tws = s.xyz - vpos.xyz;\n\n\t\t\t\t\tdist2 = dot( ws, ws );\n\t\t\t\t\tinvdist = inversesqrt( dist2 );\n\t\t\t\t\tcosh = invdist * dot( ws, vdir );\n\n\t\t\t\t\t#if ENABLE_FALLOFF\n\n\t\t\t\t\tfalloff = Falloff( dist2 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t\thorizons.y = max( horizons.y, cosh - falloff );\n\n\t\t\t\t\t// increment\n\t\t\t\t\tcurrStep += stepSize;\n\n\t\t\t\t\t#if ENABLE_COLOR_BOUNCE\n\n\t\t\t\t\tptColor = texture2D( colorBuffer, ( screenCoord - offset ) / renderSize ).rgb;\n\t\t\t\t\tptDir = normalize( ws );\n\t\t\t\t\talpha = saturate( length( ws ) / float( RADIUS ) );\n\t\t\t\t\tcolor += ptColor * saturate( dot( ptDir, vnorm ) ) * pow( ( 1.0 - alpha ), 2.0 );\n\n\t\t\t\t\t#endif\n\n\t\t\t\t}\n\n\t\t\t\thorizons = acos( horizons );\n\n\t\t\t\t// calculate gamma\n\t\t\t\tvec3 bitangent\t= normalize( cross( dir, vdir ) );\n\t\t\t\tvec3 tangent\t= cross( vdir, bitangent );\n\t\t\t\tvec3 nx\t\t\t= vnorm - bitangent * dot( vnorm, bitangent );\n\n\t\t\t\tfloat nnx\t\t= length( nx );\n\t\t\t\tfloat invnnx\t= 1.0 / ( nnx + 1e-6 );\t\t\t// to avoid division with zero\n\t\t\t\tfloat cosxi\t\t= dot( nx, tangent ) * invnnx;\t// xi = gamma + HALF_PI\n\t\t\t\tfloat gamma\t\t= acos( cosxi ) - HALF_PI;\n\t\t\t\tfloat cosgamma\t= dot( nx, vdir ) * invnnx;\n\t\t\t\tfloat singamma2\t= - 2.0 * cosxi;\t\t\t\t\t// cos(x + HALF_PI) = -sin(x)\n\n\t\t\t\t// clamp to normal hemisphere\n\t\t\t\thorizons.x = gamma + max( - horizons.x - gamma, - HALF_PI );\n\t\t\t\thorizons.y = gamma + min( horizons.y - gamma, HALF_PI );\n\n\t\t\t\t// Riemann integral is additive\n\t\t\t\tao += nnx * 0.25 * (\n\t\t\t\t\t( horizons.x * singamma2 + cosgamma - cos( 2.0 * horizons.x - gamma ) ) +\n\t\t\t\t\t( horizons.y * singamma2 + cosgamma - cos( 2.0 * horizons.y - gamma ) ) );\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t// PDF = 1 / pi and must normalize with pi because of Lambert\n\t\t\tao = ao / float( NUM_DIRECTIONS );\n\n\t\t\t#if ENABLE_COLOR_BOUNCE\n\n\t\t\tcolor /= float( NUM_STEPS * NUM_DIRECTIONS ) * 2.0 / lightBounceIntensity;\n\t\t\tgl_FragColor = vec4( color, ao );\n\n\t\t\t#else\n\n\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, ao );\n\n\t\t\t#endif\n\t\t}\n\t"},Ya={defines:{BLUR_ITERATIONS:5,BLUR_MODE:0,AO_ONLY:0,COLOR_ONLY:0,DEPTH_THRESHOLD:"5e-1"},uniforms:{fullSize:{value:new n.Vector2},aoSize:{value:new n.Vector2},normalBuffer:{value:null},depthBuffer:{value:null},colorBuffer:{value:null},gtaoBuffer:{value:null},intensity:{value:1},blurStride:{value:1},ambientColor:{value:new n.Color},ambientIntensity:{value:0}},vertexShader:"\n\t\tvarying vec2 vUv;\n\t\tvoid main() {\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t}\n\t",fragmentShader:"\n\t\tvarying vec2 vUv;\n\t\tuniform vec3 ambientColor;\n\t\tuniform float ambientIntensity;\n\t\tuniform vec2 aoSize;\n\t\tuniform vec2 fullSize;\n\t\tuniform sampler2D colorBuffer;\n\t\tuniform sampler2D depthBuffer;\n\t\tuniform sampler2D normalBuffer;\n\t\tuniform sampler2D gtaoBuffer;\n\t\tuniform float intensity;\n\t\tuniform int blurStride;\n\n\t\tvec3 UnpackNormal( vec4 d ) {\n\t\t\treturn d.xyz * 2.0 - 1.0;\n\t\t}\n\n\t\tvec3 MultiBounce( float ao, vec3 albedo ) {\n\t\t\tvec3 x = vec3( ao );\n\t\t\tvec3 a = 2.0404 * albedo - vec3( 0.3324 );\n\t\t\tvec3 b = -4.7951 * albedo + vec3( 0.6417 );\n\t\t\tvec3 c = 2.7552 * albedo + vec3( 0.6903 );\n\t\t\treturn max( x, ( ( x * a + b ) * x + c ) * x );\n\t\t}\n\n\t\tvoid main() {\n\t\t\tvec4 color = texture2D( colorBuffer, vUv );\n\t\t\t// NO_BLUR\n\t\t\t#if BLUR_MODE == 0\n\t\t\t\tvec4 accumSample = texture2D( gtaoBuffer, vUv );\n\t\t\t#else\n\t\t\tvec2 currTexel = vUv * fullSize;\n\t\t\tvec2 currAoTexel = vUv * aoSize;\n\n\t\t\t// aoPixels per full size ones. Should be 1/2 at\n\t\t\tvec2 texelRatio = aoSize / fullSize;\n\n\t\t\tvec3 currNormal = UnpackNormal( texture2D( normalBuffer, vUv ) );\n\t\t\tfloat currDepth = texture2D( depthBuffer, vUv ).r;\n\n\t\t\t// TODO: pull this sampling out into a function\n\t\t\tvec4 accumSample = vec4( 0.0 );\n\t\t\tfloat totalWeight = 1e-10;\n\t\t\tfloat pixelOffset = - float( BLUR_ITERATIONS ) / 2.0;\n\t\t\tpixelOffset += mod( float( BLUR_ITERATIONS ), 2.0 ) == 0.0 ? 0.0 : 0.5;\n\t\t\tpixelOffset *= float( blurStride );\n\n\t\t\t// BOX_BLUR\n\t\t\t#if BLUR_MODE == 1\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int x = 0; x < BLUR_ITERATIONS; x ++ ) {\n\n\t\t\t\t#pragma unroll_loop_start\n\t\t\t\tfor ( int y = 0; y < BLUR_ITERATIONS; y ++ ) {\n\n\t\t\t\t\tvec2 step = vec2( float( x ), float( y ) ) * float( blurStride );\n\n\t\t\t\t\t// iterate over full res pixels\n\t\t\t\t\tvec2 offsetUv = currTexel + ( pixelOffset + step ) / texelRatio;\n\t\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\t\t// get the associated pixel in the AO buffer\n\t\t\t\t\tvec2 aoUv = currAoTexel + pixelOffset + step;\n\t\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t\t// if the pixels are close enough in space then blur them together\n\t\t\t\t\tfloat offsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\t\tif ( abs( offsetDepth - currDepth ) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\t\t// Weigh the sample based on normal similarity\n\t\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\t\tfloat weight = max( 0.0, dot( offsetNormal, currNormal ) );\n\n\t\t\t\t\t\t// square the weight to give pixels with a closer normal even higher priority\n\t\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\t\t// accumulate\n\t\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\t#pragma unroll_loop_end\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t// CROSS_BLUR\n\t\t\t#elif BLUR_MODE == 2\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = 0; i < BLUR_ITERATIONS; i ++ ) {\n\n\t\t\t\tvec2 offsetUv, aoUv;\n\t\t\t\tfloat offsetDepth;\n\n\t\t\t\t// X sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( pixelOffset + float( i * blurStride ), 0.0 ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( pixelOffset + float( i * blurStride ), 0.0 );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t\t// TODO: this should not be here if on the center pixel\n\t\t\t\t// Y sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( 0.0, pixelOffset + float( i * blurStride ) ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( 0.0, pixelOffset + float( i * blurStride ) );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t// DIAGONAL_BLUR\n\t\t\t#elif BLUR_MODE == 3\n\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = 0; i < BLUR_ITERATIONS; i ++ ) {\n\n\t\t\t\tvec2 offsetUv, aoUv;\n\t\t\t\tfloat offsetDepth;\n\n\t\t\t\t// X sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( pixelOffset + float( i * blurStride ), pixelOffset + float( i * blurStride ) ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( pixelOffset + float( i * blurStride ), pixelOffset + float( i * blurStride ) );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t\t// TODO: this should not be here if on the center pixel\n\t\t\t\t// Y sample\n\t\t\t\t// iterate over full res pixels\n\t\t\t\toffsetUv = currTexel + vec2( - pixelOffset - float( i * blurStride ), pixelOffset + float( i * blurStride ) ) / texelRatio;\n\t\t\t\toffsetUv /= fullSize;\n\n\t\t\t\taoUv = currAoTexel + vec2( - pixelOffset - float( i * blurStride ), pixelOffset + float( i * blurStride ) );\n\t\t\t\taoUv /= aoSize;\n\n\t\t\t\t// further more negative\n\t\t\t\toffsetDepth = texture2D( depthBuffer, offsetUv ).r;\n\t\t\t\tif ( abs(offsetDepth - currDepth) <= DEPTH_THRESHOLD ) {\n\n\t\t\t\t\tvec3 offsetNormal = UnpackNormal( texture2D( normalBuffer, offsetUv ) );\n\t\t\t\t\tfloat weight = max(0.0, dot( offsetNormal, currNormal ) );\n\t\t\t\t\tweight *= weight;\n\n\t\t\t\t\tvec4 val = texture2D( gtaoBuffer, aoUv );\n\t\t\t\t\taccumSample += val * weight;\n\t\t\t\t\ttotalWeight += weight;\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\n\t\t\t#endif\n\n\t\t\taccumSample /= totalWeight;\n\n\t\t\t#endif\n\n\t\t\tfloat gtao = accumSample.a;\n\n\t\t\t#if COLOR_ONLY\n\n\t\t\tgl_FragColor = vec4( accumSample.rgb, 1.0 );\n\n\t\t\t#elif AO_ONLY\n\n\t\t\tvec3 rgb = mix( vec3( 1.0 ), vec3( accumSample.a ), intensity );\n\t\t\tgl_FragColor = vec4( rgb, 1.0 );\n\n\t\t\t#else\n\n\t\t\tvec3 rgb = mix( color.rgb, color.rgb * MultiBounce( gtao, color.rgb ), intensity );\n\t\t\tvec3 delta = color.rgb - rgb;\n\t\t\tvec3 ambient = ambientColor * delta * ambientIntensity;\n\n\t\t\tfloat colorFade = ( 1.0 - pow( 1.0 - gtao, 2.0 ) );\n\t\t\tgl_FragColor = vec4( rgb + ambient + accumSample.rgb * ( 0.75 + colorFade * 0.25 ), color.a );\n\n\t\t\t#endif\n\n\t\t}\n\t\t"};class qa{constructor(e){this.count=0,this.size=-1,this.sigma=-1,this.radius=-1,this.lookupTable=null,this.score=null,this.binaryPattern=null,this.resize(e),this.setSigma(1.5)}findVoid(){var e,{score:t,binaryPattern:n}=this;let r=1/0,i=-1;for(let a=0,s=n.length;a<s;a++)0===n[a]&&(e=t[a])<r&&(r=e,i=a);return i}findCluster(){var e,{score:t,binaryPattern:n}=this;let r=-1/0,i=-1;for(let a=0,s=n.length;a<s;a++)1===n[a]&&(e=t[a])>r&&(r=e,i=a);return i}setSigma(e){if(e!==this.sigma){var t=~~(Math.sqrt(20*Math.pow(e,2))+1),n=2*t+1;const s=new Float32Array(n*n);var r=e*e;for(let e=-t;e<=t;e++)for(let o=-t;o<=t;o++){var i=(t+o)*n+e+t,a=e*e+o*o;s[i]=Math.pow(Math.E,-a/(2*r))}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:n}=this;t.fill(0);for(let t=0,a=e.length;t<a;t++){var r,i;0===e[t]?(r=~~(t/n),i=t-r*n,this.updateScore(i,r,1),e[t]=1):e[t]=0}}updateScore(e,t,n){const{size:r,score:i,lookupTable:a}=this;var 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?r+d:d%r,t+h);var u=(p=p<0?r+p:p%r)*r+d;i[u]+=n*l}}addPointIndex(e){this.binaryPattern[e]=1;var t=this.size,n=~~(e/t);this.updateScore(e-n*t,n,1),this.count++}removePointIndex(e){this.binaryPattern[e]=0;var t=this.size,n=~~(e/t);this.updateScore(e-n*t,n,-1),this.count--}copy(e){this.resize(e.size),this.score.set(e.score),this.binaryPattern.set(e.binaryPattern),this.setSigma(e.sigma),this.count=e.count}}class $a{constructor(){this.random=Math.random,this.sigma=1.5,this.size=64,this.majorityPointsRatio=.1,this.samples=new qa(1),this.savedSamples=new qa(1)}generate(){const{samples:e,savedSamples:t,sigma:n,majorityPointsRatio:r,size:i}=this;e.resize(i),e.setSigma(n);var a=Math.floor(i*i*r),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,n=s.length;t<n;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 es extends da.w{constructor(e,t){super(),this.enabled=!0,this.needsSwap=!0,this.scene=e,this.camera=t,this.debug={display:es.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=es.BOX_BLUR,this.blurIterations=4,this.blurStride=1,this.enableFalloff=!0,this.falloffStart=.4,this.falloffEnd=2,this.ambientColor=new n.Color,this.ambientIntensity=0,this.lightBounceIntensity=1,this._gtaoBuffer=new n.WebGLRenderTarget(1,1,{format:n.RGBAFormat}),this._depthBuffer=new n.WebGLRenderTarget(1,1,{minFilter:n.NearestFilter,magFilter:n.NearestFilter,format:n.RGBFormat,type:n.HalfFloatType}),this._depthReplacement=new Za,this._normalBuffer=new n.WebGLRenderTarget(1,1,{minFilter:n.NearestFilter,magFilter:n.NearestFilter,format:n.RGBAFormat}),this._normalReplacement=new Ka,this.gtaoQuad=new da.T(new n.ShaderMaterial(Qa)),this.debugPackedQuad=new da.T(new n.ShaderMaterial(Wa)),this.debugDepthQuad=new da.T(new n.ShaderMaterial(Xa)),this.compositeQuad=new da.T(new n.ShaderMaterial(Ya));const r=new $a,i=(r.size=32,new Uint8Array(4*Math.pow(32,2)));for(let e=0;e<4;e++){var a=r.generate(),s=a.data,o=a.maxValue;for(let t=0,n=s.length;t<n;t++)i[4*t+e]=s[t]/o*255}this.blueNoiseTex=new n.DataTexture(i,r.size,r.size,n.RGBAFormat),this.blueNoiseTex.wrapS=n.RepeatWrapping,this.blueNoiseTex.wrapT=n.RepeatWrapping,this.blueNoiseTex.minFilter=n.LinearFilter,this.blueNoiseTex.needsUpdate=!0}dispose(){}setSize(e,t){var n=this.renderTargetScale,r=Math.floor(e*n);n=Math.floor(t*n),this._depthBuffer.setSize(e,t),this._normalBuffer.setSize(e,t),this._gtaoBuffer.setSize(r,n)}render(e,t,r){t=this.renderToScreen?null:t;const{scene:i,camera:a,debug:s,debugPackedQuad:o,debugDepthQuad:l,compositeQuad:u,gtaoQuad:c}=this,h=c.material;es.RendererState.copy(e,i);var d=()=>{es.RendererState.restore(e,i),f.reset(i,!0)},p=this._depthBuffer;const f=this._depthReplacement;if(i.background=null,f.replace(i,!0,!0),e.setRenderTarget(p),e.setClearColor(es.BlackColor,0),e.clear(),e.render(i,a),s.display===es.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(i,!0,!1),e.setRenderTarget(v),e.clear(),e.render(i,a),s.display===es.NORMAL)return e.setRenderTarget(t),e.clear(),o.material.uniforms.displayRoughness.value=0,o.material.uniforms.texture.value=v.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 g=this._gtaoBuffer,y=Math.floor(g.texture.image.width),b=Math.floor(g.texture.image.height),x=a.projectionMatrix,w=n.MathUtils.DEG2RAD*a.fov;h.uniforms.params.value.set(this.directionOffset,this.stepOffset),h.uniforms.projInfo.value.set(2/(y*x.elements[0]),2/(b*x.elements[5]),-1/x.elements[0],-1/x.elements[5]),h.uniforms.clipInfo.value.set(a.near,a.far,b/(2*Math.tan(.5*w))*.5,0),h.uniforms.normalBuffer.value=v.texture,h.uniforms.depthBuffer.value=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),s.display===es.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),s.display===es.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()}}es.NO_JITTER=0,es.RANDOM_JITTER=1,es.BLUENOISE_JITTER=2,es.DEFAULT=0,es.DEPTH=1,es.NORMAL=2,es.AO_SAMPLE=3,es.COLOR_SAMPLE=4,es.NO_BLUR=0,es.BOX_BLUR=1,es.CROSS_BLUR=2,es.DIAGONAL_BLUR=3,es.BlackColor=new n.Color(0),es.RendererState=new class{constructor(){this.clearAlpha=0,this.clearColor=new n.Color,this.renderTarget=null,this.outputEncoding=n.LinearEncoding,this.overrideMaterial=null,this.shadowsEnabled=!1,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.background=null,this.autoUpdate=!0}copy(e,t){e&&(this.clearAlpha=e.getClearAlpha(),this.clearColor=e.getClearColor(this.clearColor),this.renderTarget=e.getRenderTarget(),this.shadowsEnabled=e.shadowMap.enabled,this.outputEncoding=e.outputEncoding,this.autoClear=e.autoClear,this.autoClearColor=e.autoClearColor,this.autoClearDepth=e.autoClearDepth,this.autoClearStencil=e.autoClearStencil),t&&(this.overrideMaterial=t.overrideMaterial,this.background=t.background,this.autoUpdate=t.autoUpdate)}restore(e,t){e&&(e.setClearAlpha(this.clearAlpha),e.setClearColor(this.clearColor),e.setRenderTarget(this.renderTarget),e.shadowMap.enabled=this.shadowsEnabled,e.outputEncoding=this.outputEncoding,e.autoClear=this.autoClear,e.autoClearColor=this.autoClearColor,e.autoClearDepth=this.autoClearDepth,e.autoClearStencil=this.autoClearStencil),t&&(t.overrideMaterial=this.overrideMaterial,t.background=this.background,t.autoUpdate=this.autoUpdate),this.renderTarget=null,this.overrideMaterial=null}};class ts{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.gtaoPass||(this.gtaoPass=new es(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 bs.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 ns(e){return(ns="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function rs(e,t){return(rs=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function is(e){return(is=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var as=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&&rs(t,e);var r=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=is(e);if(n=t?(n=is(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===ns(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(e,t,a,s,o){var l;if(this instanceof i)return(l=r.call(this)).scene=e,l.camera=t,l.overrideMaterial=a,l.clearColor=s,l.clearAlpha=void 0!==o?o:0,l.clear=!0,l.clearDepth=!1,l.needsSwap=!1,l._oldClearColor=new n.Color,l;throw new TypeError("Cannot call a class as a function")}return t=i,(e=[{key:"render",value:function(e,t,n){var r,i,a=e.autoClear;e.autoClear=!1,void 0!==this.overrideMaterial&&(i=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this._oldClearColor),r=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor&&e.setClearColor(this._oldClearColor,r),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=i),e.autoClear=a}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(da.w),ss={uniforms:{tDiffuse:{value:null},resolution:{value:new n.Vector2(1/1024,1/512)}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\tprecision highp float;\n\n\tuniform sampler2D tDiffuse;\n\n\tuniform vec2 resolution;\n\n\tvarying vec2 vUv;\n\n\t// FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)\n\n\t//----------------------------------------------------------------------------------\n\t// File: es3-keplerFXAAassetsshaders/FXAA_DefaultES.frag\n\t// SDK Version: v3.00\n\t// Email: gameworks@nvidia.com\n\t// Site: http://developer.nvidia.com/\n\t//\n\t// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.\n\t//\n\t// Redistribution and use in source and binary forms, with or without\n\t// modification, are permitted provided that the following conditions\n\t// are met:\n\t// * Redistributions of source code must retain the above copyright\n\t// notice, this list of conditions and the following disclaimer.\n\t// * Redistributions in binary form must reproduce the above copyright\n\t// notice, this list of conditions and the following disclaimer in the\n\t// documentation and/or other materials provided with the distribution.\n\t// * Neither the name of NVIDIA CORPORATION nor the names of its\n\t// contributors may be used to endorse or promote products derived\n\t// from this software without specific prior written permission.\n\t//\n\t// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY\n\t// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n\t// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n\t// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n\t// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n\t// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n\t// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n\t// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n\t// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n\t// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\t// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\t//\n\t//----------------------------------------------------------------------------------\n\n\t#ifndef FXAA_DISCARD\n\t\t\t//\n\t\t\t// Only valid for PC OpenGL currently.\n\t\t\t// Probably will not work when FXAA_GREEN_AS_LUMA = 1.\n\t\t\t//\n\t\t\t// 1 = Use discard on pixels which don't need AA.\n\t\t\t// For APIs which enable concurrent TEX+ROP from same surface.\n\t\t\t// 0 = Return unchanged color on pixels which don't need AA.\n\t\t\t//\n\t\t\t#define FXAA_DISCARD 0\n\t#endif\n\n\t/*--------------------------------------------------------------------------*/\n\t#define FxaaTexTop(t, p) texture2D(t, p, -100.0)\n\t#define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), -100.0)\n\t/*--------------------------------------------------------------------------*/\n\n\t#define NUM_SAMPLES 5\n\n\t// assumes colors have premultipliedAlpha, so that the calculated color contrast is scaled by alpha\n\tfloat contrast( vec4 a, vec4 b ) {\n\t\t\tvec4 diff = abs( a - b );\n\t\t\treturn max( max( max( diff.r, diff.g ), diff.b ), diff.a );\n\t}\n\n\t/*============================================================================\n\n\t\t\t\t\t\t\t\t\tFXAA3 QUALITY - PC\n\n\t============================================================================*/\n\n\t/*--------------------------------------------------------------------------*/\n\tvec4 FxaaPixelShader(\n\t\t\tvec2 posM,\n\t\t\tsampler2D tex,\n\t\t\tvec2 fxaaQualityRcpFrame,\n\t\t\tfloat fxaaQualityEdgeThreshold,\n\t\t\tfloat fxaaQualityinvEdgeThreshold\n\t) {\n\t\t\tvec4 rgbaM = FxaaTexTop(tex, posM);\n\t\t\tvec4 rgbaS = FxaaTexOff(tex, posM, vec2( 0.0, 1.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaE = FxaaTexOff(tex, posM, vec2( 1.0, 0.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaN = FxaaTexOff(tex, posM, vec2( 0.0,-1.0), fxaaQualityRcpFrame.xy);\n\t\t\tvec4 rgbaW = FxaaTexOff(tex, posM, vec2(-1.0, 0.0), fxaaQualityRcpFrame.xy);\n\t\t\t// . S .\n\t\t\t// W M E\n\t\t\t// . N .\n\n\t\t\tbool earlyExit = max( max( max(\n\t\t\t\t\tcontrast( rgbaM, rgbaN ),\n\t\t\t\t\tcontrast( rgbaM, rgbaS ) ),\n\t\t\t\t\tcontrast( rgbaM, rgbaE ) ),\n\t\t\t\t\tcontrast( rgbaM, rgbaW ) )\n\t\t\t\t\t< fxaaQualityEdgeThreshold;\n\t\t\t// . 0 .\n\t\t\t// 0 0 0\n\t\t\t// . 0 .\n\n\t\t\t#if (FXAA_DISCARD == 1)\n\t\t\t\t\tif(earlyExit) FxaaDiscard;\n\t\t\t#else\n\t\t\t\t\tif(earlyExit) return rgbaM;\n\t\t\t#endif\n\n\t\t\tfloat contrastN = contrast( rgbaM, rgbaN );\n\t\t\tfloat contrastS = contrast( rgbaM, rgbaS );\n\t\t\tfloat contrastE = contrast( rgbaM, rgbaE );\n\t\t\tfloat contrastW = contrast( rgbaM, rgbaW );\n\n\t\t\tfloat relativeVContrast = ( contrastN + contrastS ) - ( contrastE + contrastW );\n\t\t\trelativeVContrast *= fxaaQualityinvEdgeThreshold;\n\n\t\t\tbool horzSpan = relativeVContrast > 0.;\n\t\t\t// . 1 .\n\t\t\t// 0 0 0\n\t\t\t// . 1 .\n\n\t\t\t// 45 deg edge detection and corners of objects, aka V/H contrast is too similar\n\t\t\tif( abs( relativeVContrast ) < .3 ) {\n\t\t\t\t\t// locate the edge\n\t\t\t\t\tvec2 dirToEdge;\n\t\t\t\t\tdirToEdge.x = contrastE > contrastW ? 1. : -1.;\n\t\t\t\t\tdirToEdge.y = contrastS > contrastN ? 1. : -1.;\n\t\t\t\t\t// . 2 . . 1 .\n\t\t\t\t\t// 1 0 2 ~= 0 0 1\n\t\t\t\t\t// . 1 . . 0 .\n\n\t\t\t\t\t// tap 2 pixels and see which ones are \"outside\" the edge, to\n\t\t\t\t\t// determine if the edge is vertical or horizontal\n\n\t\t\t\t\tvec4 rgbaAlongH = FxaaTexOff(tex, posM, vec2( dirToEdge.x, -dirToEdge.y ), fxaaQualityRcpFrame.xy);\n\t\t\t\t\tfloat matchAlongH = contrast( rgbaM, rgbaAlongH );\n\t\t\t\t\t// . 1 .\n\t\t\t\t\t// 0 0 1\n\t\t\t\t\t// . 0 H\n\n\t\t\t\t\tvec4 rgbaAlongV = FxaaTexOff(tex, posM, vec2( -dirToEdge.x, dirToEdge.y ), fxaaQualityRcpFrame.xy);\n\t\t\t\t\tfloat matchAlongV = contrast( rgbaM, rgbaAlongV );\n\t\t\t\t\t// V 1 .\n\t\t\t\t\t// 0 0 1\n\t\t\t\t\t// . 0 .\n\n\t\t\t\t\trelativeVContrast = matchAlongV - matchAlongH;\n\t\t\t\t\trelativeVContrast *= fxaaQualityinvEdgeThreshold;\n\n\t\t\t\t\tif( abs( relativeVContrast ) < .3 ) { // 45 deg edge\n\t\t\t\t\t\t\t// 1 1 .\n\t\t\t\t\t\t\t// 0 0 1\n\t\t\t\t\t\t\t// . 0 1\n\n\t\t\t\t\t\t\t// do a simple blur\n\t\t\t\t\t\t\treturn mix(\n\t\t\t\t\t\t\t\t\trgbaM,\n\t\t\t\t\t\t\t\t\t(rgbaN + rgbaS + rgbaE + rgbaW) * .25,\n\t\t\t\t\t\t\t\t\t.4\n\t\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\thorzSpan = relativeVContrast > 0.;\n\t\t\t}\n\n\t\t\tif(!horzSpan) rgbaN = rgbaW;\n\t\t\tif(!horzSpan) rgbaS = rgbaE;\n\t\t\t// . 0 . 1\n\t\t\t// 1 0 1 -> 0\n\t\t\t// . 0 . 1\n\n\t\t\tbool pairN = contrast( rgbaM, rgbaN ) > contrast( rgbaM, rgbaS );\n\t\t\tif(!pairN) rgbaN = rgbaS;\n\n\t\t\tvec2 offNP;\n\t\t\toffNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\n\t\t\toffNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\n\n\t\t\tbool doneN = false;\n\t\t\tbool doneP = false;\n\n\t\t\tfloat nDist = 0.;\n\t\t\tfloat pDist = 0.;\n\n\t\t\tvec2 posN = posM;\n\t\t\tvec2 posP = posM;\n\n\t\t\tint iterationsUsed = 0;\n\t\t\tint iterationsUsedN = 0;\n\t\t\tint iterationsUsedP = 0;\n\t\t\tfor( int i = 0; i < NUM_SAMPLES; i++ ) {\n\t\t\t\t\titerationsUsed = i;\n\n\t\t\t\t\tfloat increment = float(i + 1);\n\n\t\t\t\t\tif(!doneN) {\n\t\t\t\t\t\t\tnDist += increment;\n\t\t\t\t\t\t\tposN = posM + offNP * nDist;\n\t\t\t\t\t\t\tvec4 rgbaEndN = FxaaTexTop(tex, posN.xy);\n\t\t\t\t\t\t\tdoneN = contrast( rgbaEndN, rgbaM ) > contrast( rgbaEndN, rgbaN );\n\t\t\t\t\t\t\titerationsUsedN = i;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(!doneP) {\n\t\t\t\t\t\t\tpDist += increment;\n\t\t\t\t\t\t\tposP = posM - offNP * pDist;\n\t\t\t\t\t\t\tvec4 rgbaEndP = FxaaTexTop(tex, posP.xy);\n\t\t\t\t\t\t\tdoneP = contrast( rgbaEndP, rgbaM ) > contrast( rgbaEndP, rgbaN );\n\t\t\t\t\t\t\titerationsUsedP = i;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(doneN || doneP) break;\n\t\t\t}\n\n\n\t\t\tif ( !doneP && !doneN ) return rgbaM; // failed to find end of edge\n\n\t\t\tfloat dist = min(\n\t\t\t\t\tdoneN ? float( iterationsUsedN ) / float( NUM_SAMPLES - 1 ) : 1.,\n\t\t\t\t\tdoneP ? float( iterationsUsedP ) / float( NUM_SAMPLES - 1 ) : 1.\n\t\t\t);\n\n\t\t\t// hacky way of reduces blurriness of mostly diagonal edges\n\t\t\t// but reduces AA quality\n\t\t\tdist = pow(dist, .5);\n\n\t\t\tdist = 1. - dist;\n\n\t\t\treturn mix(\n\t\t\t\t\trgbaM,\n\t\t\t\t\trgbaN,\n\t\t\t\t\tdist * .5\n\t\t\t);\n\t}\n\n\tvoid main() {\n\t\t\tconst float edgeDetectionQuality = .2;\n\t\t\tconst float invEdgeDetectionQuality = 1. / edgeDetectionQuality;\n\n\t\t\tgl_FragColor = FxaaPixelShader(\n\t\t\t\t\tvUv,\n\t\t\t\t\ttDiffuse,\n\t\t\t\t\tresolution,\n\t\t\t\t\tedgeDetectionQuality, // [0,1] contrast needed, otherwise early discard\n\t\t\t\t\tinvEdgeDetectionQuality\n\t\t\t);\n\n\t}\n\t"},os={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 ls={radius:{type:"number",val:.6,shortKey:"r",onUpdate(e){const{type:t,data:n,runScene:r}=e;r.pp.setGlowData(t,n)}},strength:{type:"number",val:1.5,shortKey:"s",onUpdate({type:e,data:t,runScene:n}){n.pp.setGlowData(e,t)}},threshold:{type:"number",val:0,shortKey:"t",onUpdate({type:e,data:t,runScene:n}){n.pp.setGlowData(e,t)}}};class us{constructor(e){this.ppParams={samples:2},this.bloomParams={isBloom:!1,radius:.6,strength:1.5,threshold:0},this.outlineParams={isOutline:!1,edgeStrength:3,edgeGlow:0,edgeThickness:1,pulsePeriod:0,visibleEdgeColor:"#FFFFFF",hiddenEdgeColor:"#190A05"},this.aoParams={isAO:!1,directionOffset:0,stepOffset:0,rotationJitter:"NONE",radiusJitter:"NONE",numSteps:8,numDirections:1,intensity:1,radius:2,enableFalloff:!0,falloffStart:.4,falloffEnd:2,renderTargetScale:.5,blurMode:"NO_BLUR",blurIterations:5,blurStride:1,ambientColor:"#FFFFFF",ambientIntensity:0,lightBounceIntensity:0},this.vignetteParams={isVignette:!1,offset:1,darkness:1},this.clean=()=>{this.reset()},this.ENTIRE_SCENE=0,this.BLOOM_SCENE=1,this.BLACK_COLOR=new bs.Color(0),this.runScene=e,this.info=new ua(this.runScene),this.isSafari=-1<navigator.userAgent.indexOf("Safari"),this.isChrome=-1<navigator.userAgent.indexOf("Chrome"),this.rtSize=new bs.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 bs.Color(t.color)),"background"===e&&(this.sceneBackground&&(0,pt.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.bloomParams,def:ls})}init(){try{var{camera:e,scene:t,renderer:n}=this.runScene.assetsEx.get();this.mainScene=t,this.mainCamera=e,this.renderer=n,this.renderer&&(this.renderer.getSize(this.rtSize),this.postProcessing())}catch(e){console.log("Error: ",e)}this.runScene.cb.loaderer.gltf.loadNode.add("outline-objects",(({node:e,nodeDef:t})=>{t.extras&&t.extras.outline&&this.mtOutline.addSelectedObject(e)}))}postProcessing(){this.effectComposer=new Ra(this.renderer,this.getNewRenderTarget(this.ppParams.samples)),this.renderPass=new as(this.mainScene,this.mainCamera),this.fxaaPass=new ha.T(ss),this.fxaaPass.uniforms.resolution.value.set(1/window.innerWidth,1/window.innerHeight),this.vignettePass=new ha.T(os),this.effectComposer.addPass(this.renderPass),this.ppOutline(),this.ppGlow(),this.ppAO(),this.effectComposer.addPass(this.vignettePass)}getNewRenderTarget(e){const t=new bs.WebGLRenderTarget(this.rtSize.x,this.rtSize.y,{samples:e});return t.depthTexture=new bs.DepthTexture(this.rtSize.x,this.rtSize.y),t.depthTexture.type=bs.UnsignedIntType,t.depthTexture.format=bs.DepthFormat,t.texture.format=bs.RGBAFormat,t.texture.encoding=bs.sRGBEncoding,t}ppOutline(){this.mtOutline=new ja(this)}ppGlow(){this.isChrome?(this.effectComposer.renderToScreen=!0,this.mtuGlow=new wa(this)):this.isSafari&&(this.effectComposer.renderToScreen=!1,this.threeGlow=new La(this))}ppAO(){this.mtAO=new ts(this)}toJSON(){const e={};var{ppParams:t,bloomParams:n,outlineParams:r,aoParams:i,vignetteParams:a}=this;return e.ppParams=Object.assign({},t),e.bloomParams=Object.assign({},n),e.outlineParams=Object.assign({},r),e.aoParams=Object.assign({},i),e.vignetteParams=Object.assign({},a),JSON.stringify(e)}fromJSON(e){var{ppParams:e,bloomParams:t,outlineParams:n,aoParams:r,vignetteParams:i}=e;e&&(e=e.samples,this.ppParams.samples=e,this.effectComposer&&this.effectComposer.reset(this.getNewRenderTarget(this.ppParams.samples))),t&&(this.bloomParams.isBloom=t.isBloom,this.setGlowData("radius",t.radius),this.setGlowData("strength",t.strength),this.setGlowData("threshold",t.threshold),this.runScene.cb.pp.glow.setData.cb(this.bloomParams)),n&&this.mtOutline&&(this.outlineParams.isOutline=n.isOutline,this.setOutlineData("edgeStrength",n.edgeStrength),this.setOutlineData("edgeGlow",n.edgeGlow),this.setOutlineData("edgeThickness",n.edgeThickness),this.setOutlineData("pulsePeriod",n.pulsePeriod),this.setOutlineData("visibleEdgeColor",n.visibleEdgeColor),this.setOutlineData("hiddenEdgeColor",n.hiddenEdgeColor),this.runScene.cb.pp.outline.setData.cb(this.outlineParams)),r&&this.mtAO&&(this.aoParams.isAO=r.isAO,this.setAOData("directionOffset",r.directionOffset),this.setAOData("stepOffset",r.stepOffset),this.setAOData("rotationJitter",r.rotationJitter),this.setAOData("radiusJitter",r.radiusJitter),this.setAOData("numSteps",r.numSteps),this.setAOData("numDirections",r.numDirections),this.setAOData("intensity",r.intensity),this.setAOData("radius",r.radius),this.setAOData("enableFalloff",r.enableFalloff),this.setAOData("falloffStart",r.falloffStart),this.setAOData("falloffEnd",r.falloffEnd),this.setAOData("renderTargetScale",r.renderTargetScale),this.setAOData("blurMode",r.blurMode),this.setAOData("blurIterations",r.blurIterations),this.setAOData("blurStride",r.blurStride),this.setAOData("ambientColor",r.ambientColor),this.setAOData("ambientIntensity",r.ambientIntensity),this.setAOData("lightBounceIntensity",r.lightBounceIntensity),this.runScene.cb.pp.ao.setData.cb(this.aoParams)),i&&this.vignettePass&&(this.vignetteParams.isVignette=i.isVignette,this.setVignetteData("offset",i.offset),this.setVignetteData("darkness",i.darkness),this.runScene.cb.pp.vignette.setData.cb(this.vignetteParams))}setUpdate(e){this.isUpdate=e}update(){this.isUpdate&&this.mainScene&&this.mainCamera&&this.renderer&&(this.bloomParams.isBloom||this.outlineParams.isOutline||this.aoParams.isAO||this.vignetteParams.isVignette?(this.vignettePass.enabled=this.vignetteParams.isVignette,this.mtAO.enablePass(this.aoParams.isAO),this.mtOutline.enablePass(this.outlineParams.isOutline),this.isChrome?(this.mtuGlow.enablePass(this.bloomParams.isBloom),this.effectComposer.render()):this.isSafari&&(this.threeGlow.enablePass(this.bloomParams.isBloom),this.threeGlow.render())):this.renderer.render(this.mainScene,this.mainCamera))}setSize(e,t){this.rtSize.x=e,this.rtSize.y=t,this.effectComposer&&this.effectComposer.setSize(e,t),this.isChrome&&this.mtuGlow||this.isSafari&&this.threeGlow&&this.threeGlow.setSize(e,t)}reset(){this.runScene.pp.dispose(),this.runScene.pp.init()}dispose(){this.isChrome&&this.mtuGlow?this.mtuGlow.dispose():this.isSafari&&this.threeGlow&&this.threeGlow.dispose(),this.mtOutline&&this.mtOutline.dispose(),this.renderPass=null,this.effectComposer&&(this.effectComposer.renderTarget1&&(this.effectComposer.renderTarget1.dispose(),this.effectComposer.renderTarget1=null),this.effectComposer.renderTarget2&&(this.effectComposer.renderTarget2.dispose(),this.effectComposer.renderTarget2=null),this.effectComposer=null)}setPPData(e,t){this.ppParams[e]=t,"samples"===e&&this.effectComposer&&this.effectComposer.reset(this.getNewRenderTarget(this.ppParams.samples))}setGlowData(e,t){this.bloomParams[e]=t,this.isChrome&&this.mtuGlow?this.mtuGlow.setGlowData(e,t):this.isSafari&&this.threeGlow&&this.threeGlow.setGlowData(e,t)}setOutlineData(e,t){this.outlineParams[e]=t,this.mtOutline&&this.mtOutline.setOutlineData(e,t)}addOutlineObj(e,t=!0){this.mtOutline.addSelectedObject(e,t)}setAOData(e,t){this.aoParams[e]=t,this.mtAO&&this.mtAO.setAOData(e,t)}setVignetteData(e,t){this.vignetteParams[e]=t,this.vignettePass&&(this.vignettePass.uniforms[e].value=t)}}var cs=__webpack_require__(738);class hs extends z{constructor(e){super(e),this.map=new se.Z,this.playLimit=new bt.cM,this.renderName="script-texture-render",this._clock=new n.Clock,this.bindEvent()}parse(e,t){var n=(0,wt.K)(t);0===Object.keys(e).length?this.map.has(n)&&this.map.delete(n):this.map.set(n,{texture:t,uvScript:e})}bindEvent(){this.runScene.cb.texture.setAnima.add("script-texture-set-anima",(({uvScript:e,texture:t})=>this.parse(e,t))),this.runScene.cb.texture.add.add("script-texture-add-texture",(e=>{var t=e.userData.uvScript;t&&this.parse(t,e)}))}_playAll(){this.map.forEach((e=>{const{texture:t,uvScript:n}=e;var{moveX:e,moveY:r,rotate:i}=n;t.userData.scriptTextre||(t.userData.scriptTextre={offsetX:t.offset.x,offsetY:t.offset.y,rotation:t.rotation}),e&&(t.offset.x+=e),r&&(t.offset.y+=r),i&&(t.rotation+=i)}))}playAll(){const{scriptFrame:e,mode:t}=this.runScene.optionsEx.options.renderConfig;-1===e&&"tick"===t?this.runScene.cb.render.add(this.renderName,(()=>{this._playAll()})):this.runScene.cb.render.add(this.renderName,(()=>{this.playLimit.update({cb:()=>{this._playAll()},cbRate:1/e,now:this._clock.getDelta()})}))}closeAll(){this.map.forEach((e=>{const t=e.texture;let n=0,r=0,i=0;t.userData.scriptTextre&&(n=(e=t.userData.scriptTextre).offsetX,r=e.offsetY,i=e.rotation,delete t.userData.scriptTextre),t.offset.x=n,t.offset.y=r,t.rotation=i})),this.runScene.cb.render.delete(this.renderName)}has(e){return void 0!==e.userData.uvScript}get(e){return e.userData.uvScript}set(e,t){t.userData.uvScript=e}}class ds extends z{constructor(e){super(e),this.runAll=!1,this.texture=new hs(e)}playAll(){this.runAll||(this.runAll=!0,this.texture.playAll())}closeAll(){this.runAll&&(this.runAll=!1,this.texture.closeAll())}}class ps{constructor(e){this.map=new se.Z,this.clean=()=>{this.clear()},this.runScene=e,this.runScene.cb.clean.add("Tags",this.clean)}get(e){return this.map.get(e)}add(e){this.get(e)||this.map.set(e,new ht.Z)}rename(e,t){const n=this.get(e);n&&(this.addId(t,n.toArray()),this.remove(e))}addId(e,t){this.map.has(e)||this.add(e),this.map.get(e).add(t)}addModel(e,t){if(this.map.has(e)||this.add(e),(0,bt.lG)(t,"array"))return t.map((t=>{this.addModel(e,t)}));this.map.get(e).add((0,wt.K)(t))}removeModel(e,t){if(this.map.has(e))return(0,bt.lG)(t,"array")?t.map((t=>{this.removeModel(e,t)})):void this.map.get(e).remove((0,wt.K)(t))}remove(e){this.map.delete(e)}clear(){this.map.clear(),this.runScene.cb.tags.clear.cb()}toJSON(){const e={};return this.map.map(((t,n)=>{e[t]=[...n.filter((e=>this.runScene.modelEx.getById(e)))]})),e}parseJSON(e){let t={};(0,H.mapObj)(e,((e,n)=>{t[e]=new ht.Z(n)})),this.map=se.Z.formJSON(t),this.runScene.cb.tags.parseJSON.cb(e)}}class fs{constructor(e,t){this.showTransform=!1,this.data=new Proxy({},{set:(e,t,n)=>(e[t]=n,!0)}),this.uuid="",this.getAnimaByModelData=(()=>{const e=(e,t,n,r)=>{const i={},a={};if(e=fs.isNotNow(e)?this.getAllData():e,(0,H.mapObj)(r,((n,r)=>{void 0!==e[n]&&("number"===(r=r.type)?(i[n]=t[n],a[n]=e[n]):"color"===r&&(0,H.mapObj)(e[n],((e,r)=>{var s=n+e;i[s]=t[n][e],a[s]=r})))})),!(0,H.emptyObj)(i))return{begin:i,end:a}};return(t,n,r,i=!1,a)=>{let s=i?r.time:0;const o=Object.keys(t).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t)));var l=(0,H.lastArrayEle)(o),u=i?"0.00":String(r.time);return l!==u&&(t[u]=Object.assign({},l),o.push(u)),o.map((o=>{var l=t[String(o)],u=.001*((u=i?s-o:o-s)<=0?.001:u)*r.speed;s=o;{var c=n,h=l,d=u,p=a;const t={color(e){const{animaData:t,defType:n}=e,r={};(0,H.mapObj)(t,(e=>{var i;-1!==e.indexOf(n)&&(i=e.substring(n.length),["r","g","b"].includes(i)&&(r[i]=t[e]))}));var{r:e,g:i,b:a}=r;if(e&&i&&a)return r}};return()=>{let n;return{promise:new Promise((r=>{var i;if(!(i=e(h,c,0,p)))return r(0);var{begin:i,end:a}=i;return n=(0,K.anima)(i,a,d,(e=>{(0,H.mapObj)(p,((n,r)=>{r=r.type;var i,a=e[n];"number"===r?c[n]=a:"color"===r&&(a=t.color({animaData:e,defType:n}))&&(({r,g:a,b:i}=a),c[n].setRGB(r,a,i))}))}),r)})),anima:n}}}}))}})(),this.runScene=t,this.target=e,this.target.userData.isTimeLineUsed=!0,this.uuid=this.getId(e)}toJSON(){var{data:e,type:t}=this;return{data:e,type:t}}addData(e,t,n=!1){return 1e3<Number(e)&&(e="1000.00"),n?this.data[e]=this.getAllData():(this.data[e]||(this.data[e]={}),this.data[e][t]=this.getData(t)),this.data[e]}addTriggerNowData(e){return this.data[e]=this.getAllData(!0)}removeData(e){delete this.data[e]}static isNotNow(e){return"notNow"===Object.values(e)[0]}static getAllDefValByType(e,t,n=!1){const r={};return(0,H.mapObj)(e,(i=>{r[i]=n?"notNow":fs.getValByType(t,i,e)})),r}static getValByType(e,t,n){var r,i;return n=n[t].type,e=e[t],"number"===n?e:"color"===n?(({r:t,g:r,b:i}=e),{r:t,g:r,b:i}):"V3"===n?Ji().model.v3ToMap(e):""}static SetTargetByData(e){const{baseType:t,data:n,defType:r,target:i}=e;var a,s;"number"===t?i[r]=n:"color"===t&&(({r:e,g:a,b:s}=n),i[r].setRGB(e,a,s))}getAllData(e=!1){return fs.getAllDefValByType(this.defOptions,this.target,e)}getData(e){return fs.getValByType(this.target,e,this.defOptions)}static getTarget(e,t){}getAnima(e,t){return this.getAnimaByModelData(this.data,this.target,e,t,this.defOptions)}setTargetByBetween(e,t,n){fs.setTargetByBetween(e,t,n,this.defOptions,this.target)}clone(e){var{data:t,type:n}=this;const r=new(0,gs[n])(e);return r.data=t,r}reset(){(0,H.mapObj)(this.defOptions,((e,t)=>{fs.SetTargetByData({baseType:t.type,data:fs.getValByType(this.beginData,e,this.defOptions),target:this.target,defType:e})}))}remove(){delete this.target.userData.isTimeLineUsed}}fs.setTargetByBetween=(()=>{const e=(e,t,n)=>e!==t?(t-e)*n+e:e;return(t,n,r,i,a)=>{(0,H.mapObj)(i,((i,s)=>{var o,l,u,c,h,d;s=s.type,void 0!==t[i]&&void 0!==n[i]&&fs.SetTargetByData({baseType:s,data:(o=t[i],l=n[i],u=r,"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 ms=fs;class vs extends z{constructor(){super(...arguments),this.mount=e=>{e.core.module.set("timeline",this)},this.after=e=>{var t,{json:e,config:n}=e;"scene"===(null==(t=e.asset.ex)?void 0:t.type)&&n.module.timeline&&this.runScene.timeLineEx.parseSavedGroupMap((null==(t=e.asset.ex)?void 0:t.timeLine)||{})}}init(){var e={name:"timeline",loadCallBacks:new se.Z({afterParse:this.after,mountModule:this.mount}),exportCallBacks:new se.Z};this.runScene.exporter.gltf.module.bind(e)}}const gs={model:class extends ms{constructor(e,t){super(e,t),this.type="model",this.defOptions={position:{type:"V3"},scale:{type:"V3"},rotation:{type:"V3"}},this.setTargetByBetween=(()=>{const e=(e,t,n)=>{var{x:e,y:r,z:i}=e,{x:t,y:a,z:s}=t;return{x:e!==t?(t-e)*n+e:e,y:r!==a?(a-r)*n+r:r,z:i!==s?(s-i)*n+i:i}};return(t,n,r)=>{var i,{position:t,scale:a,rotation:s}=t,{position:n,scale:o,rotation:l}=n;t&&n&&(({x:t,y:n,z:i}=e(t,n,r)),this.target.position.set(t,n,i)),a&&o&&(({x:t,y:n,z:i}=e(a,o,r)),this.target.scale.set(t,n,i)),s&&l&&(({x:a,y:o,z:t}=e(s,l,r)),this.target.rotation.set(a,o,t))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,n)=>{var{position:t,scale:r,rotation:i}=t,{position:e,scale:a,rotation:s}=ms.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},a?{sx:r.x,sy:r.y,sz:r.z}:{},s?{rx:i.x,ry:i.y,rz:i.z}:{}),end:Object.assign({},n.curve?{ease:"none"}:{},e?{px:e.x,py:e.y,pz:e.z}:{},a?{sx:a.x,sy:a.y,sz:a.z}:{},s?{rx:s.x,ry:s.y,rz:s.z}:{})}};return(t,n,r,i=!1)=>{let a=i?r.time:0;const s=Object.keys(t).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t)));var o=(0,H.lastArrayEle)(s),l=i?"0.00":String(r.time)+".00";return o!==l&&(t[l]={position:"notNow",rotation:"notNow",scale:"notNow"},s.push(l)),s.map((s=>{var o,l,u,c,h=t[String(s)],d=.001*((d=i?a-s:s-a)<=0?.001:d)*r.speed;return a=s,o=n,l=h,u=d,c=r,()=>{let t;return{promise:new Promise((n=>{var{begin:r,end:i}=e(l,o,c);return t=(0,K.anima)(r,i,u,(e=>{var{px:e,py:t,pz:n,sx:r,sy:i,sz:a,rx:s,ry:u,rz:c}=e;l.position&&o.position.set(e,t,n),l.scale&&o.scale.set(r,i,a),l.rotation&&o.rotation.set(s,u,c)}),n)})),anima:t}}}))}})(),this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.model.get(e)}isRemoved(){return!(this.target&&this.target.parent)}getAnima(e,t=!1){return this.getAnimaByModelData(this.data,this.target,e,t)}getId(){return this.runScene.uniqueEx.getId(this.target)}reset(){var{position:e,scale:t,rotation:n}=this.beginData;this.target.position.set(e.x,e.y,e.z),this.target.scale.set(t.x,t.y,t.z),this.target.rotation.set(n.x,n.y,n.z)}},camera:class extends ms{constructor(e,t){super(e,t),this.type="camera",this.defOptions={position:{type:"V3"},scale:{type:"V3"},rotation:{type:"V3"},target:{type:"V3"}},this.setTargetByBetween=(()=>{const e=(e,t,n)=>{var{x:e,y:r,z:i}=e,{x:t,y:a,z:s}=t;return{x:e!==t?(t-e)*n+e:e,y:r!==a?(a-r)*n+r:r,z:i!==s?(s-i)*n+i:i}};return(t,n,r)=>{var i,{position:t,scale:a,rotation:s,target:o}=t,{position:n,scale:l,rotation:u,target:c}=n;t&&n&&(({x:t,y:n,z:i}=e(t,n,r)),this.target.position.set(t,n,i)),a&&l&&(({x:t,y:n,z:i}=e(a,l,r)),this.target.scale.set(t,n,i)),s&&u&&(({x:a,y:l,z:t}=e(s,u,r)),this.target.rotation.set(a,l,t)),o&&c&&(({x:n,y:i,z:s}=e(o,c,r)),this.controls.target.set(n,i,s))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,n)=>{var{position:t,scale:r,rotation:i}=t,{position:e,scale:a,rotation:s,target:o}=ms.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},a?{sx:r.x,sy:r.y,sz:r.z}:{},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({},n.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,n,r,i)=>()=>{let a;return{promise:new Promise((s=>{var{begin:o,end:l}=e(n,t,i);return a=(0,K.anima)(o,l,r,(e=>{var{px:e,py:r,pz:i,sx:a,sy:s,sz:o,rx:l,ry:u,rz:c,tx:h,ty:d,tz:p}=e;n.position&&t.position.set(e,r,i),n.scale&&t.scale.set(a,s,o),n.rotation&&t.rotation.set(l,u,c),n.target&&this.controls.target.set(h,d,p)}),s)})),anima:K.anima}};return(e,n,r,i=!1)=>{let a=i?r.time:0;const s=Object.keys(e).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t)));var o=(0,H.lastArrayEle)(s),l=i?"0.00":String(r.time);return o!==l&&(e[l]=Object.assign({},o),s.push(l)),s.map((s=>{var o=e[String(s)],l=.001*((l=i?a-s:s-a)<=0?.001:l)*r.speed;return a=s,t(n,o,l,r)}))}})(),this.controls=this.runScene.assetsEx.get().controls,this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.model.get(e)}getBeginData(e){return this.getAllData()}isRemoved(){return!this.target}getAllData(e=!1){var{position:t,scale:n,rotation:r}=this.target;return{position:e?"notNow":Ji().model.v3ToMap(t),scale:e?"notNow":Ji().model.v3ToMap(n),rotation:e?"notNow":Ji().model.v3ToMap(r),target:e?"notNow":Ji().model.v3ToMap(this.controls.target)}}getData(e){var{position:t,scale:n,rotation:r}=this.target;let i;if("position"===e)i=Ji().model.v3ToMap(t);else if("scale"===e)i=Ji().model.v3ToMap(n);else if("rotation"===e)i=Ji().model.v3ToMap(r);else{if("target"!==e)throw TypeError("输入值不存在");i=Ji().model.v3ToMap(this.controls.target)}return i}getAnima(e,t=!1){return this.getAnimaByModelData(this.data,this.target,e,t)}getId(){return this.runScene.uniqueEx.getId(this.target)}reset(){var{position:e,scale:t,rotation:n,target:r}=this.beginData;this.target.position.set(e.x,e.y,e.z),this.target.scale.set(t.x,t.y,t.z),this.target.rotation.set(n.x,n.y,n.z),this.controls.target.set(r.x,r.y,r.z)}},material:class extends ms{constructor(e,t){super(e,t),this.type="material",this.defOptions={roughness:{type:"number"},metalness:{type:"number"},opacity:{type:"number"},emissive:{type:"color"},color:{type:"color"}},this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.material.get(e)}isRemoved(){return!0}getId(){return this.runScene.uniqueEx.getId(this.target)}}};var ys=__webpack_require__(398);__webpack_require__(263);const bs=J.Z,xs={RunScene:class{constructor(e){this._clock=new n.Clock,this.cb=new $,this.script=new ds(this),this.uniqueEx=new wt.Z(this),this.fileEx=new Ni(this),this.snapshot=new ys.ZP(this),this.undoEx=new ta.ZP(this),this.textureEx=new pt.default(this),this.controlsEx=new ie,this.assetsEx=new Y(this),this.renderEx=new cs.Z(this),this.events=new class{constructor(e){this.key=new ue(this),this.mouse=new he(this),this.drag=new ae(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 Xi(this),this.helperEx=null,this.materialEx=new gt.default(this),this.cameraEx=new ee.Z(this),this.sceneEx=new yt.ZP(this),this.modelEx=new Z.default(this),this.loaderer=new V.Z(this),this.exporter=new Et(this),this.lightEx=new mt.ZP(this),this.timeLineEx=new class{constructor(e){this.timerMap={},this.animaMap={},this.groupMap={},this.clean=()=>{this.reset()},this.setModelLocal=(e,t)=>{Object.values(e.data).map((e=>{var n,r,i=((e,t)=>{let n=-1,r=1e3;const i=Object.keys(e).sort(((e,t)=>Number(e)-Number(t)));if(1!==i.length&&(i.map(((e,i)=>{e=Number(e),0<(e=t-e)&&e<r&&(r=e,n=i)})),-1!==n)){var a=i[n],s=i[n+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:n,progress:r}=i),e.setTargetByBetween(i,n,r))}))},this.runScene=e,this.runScene.cb.clean.add("TimeLine",this.clean),this.exportAndImport=new vs(e)}init(){this.exportAndImport.init()}reset(){this.timerMap={},this.animaMap={},this.groupMap={},this.runScene.cb.timeLine.reset.cb("")}closeGroup(e){var t,n;this.timerMap[e]&&(({setProgressTime:t,awaitRuned:n}=this.timerMap[e]),t&&clearInterval(t),n&&clearInterval(n)),this.groupMap[e].run=!1,this.runScene.cb.timeLine.closeGroup.cb(e);const r=this.animaMap[e];r&&r.length&&r.map((e=>{e.controls.clean=!0}))}resetGroup(e){var t=this.groupMap[e];t&&(this.closeGroup(e),this.runScene.cb.timeLine.setProgress.cb(0),Object.values(t.data).map((e=>e.reset())))}getSavedData(){return(0,H.mapObj)(this.groupMap,((e,t)=>{t.run=!1})),this.groupMap}parseSavedGroupMap(e){Object.keys(e).map((t=>{const n=e[t],r={};(0,H.mapObj)(n.data,((e,t)=>{var{type:t,data:n}=t;const i=gs[t];if(t=i.getTarget(e,this.runScene)){const a=new i(t,this.runScene);a.data=n,r[e]=a}})),n.data=r,this.groupMap[t]=n,this.runScene.cb.timeLine.setGroupMap.cb({group:n,groupName:t})}))}playGroup(e,t){const n=(0,bt.Gm)({onlyReverse:!1},t).onlyReverse,r=(this.runScene.helperEx.unfocus(),this.groupMap[e]);if(r&&!r.run){r.run=!0;const i=Object.keys(r.data).map((e=>{const t=r.data[e];if(t.data=new Proxy(t.data,{set:(e,t,n)=>(e[t]=n,!0)}),n)return t.getAnima(r,!0);const i=t.getAnima(r);return r.reverse&&(e=t.getAnima(r,!0),i.push(...e)),i}));this.animaMap[e]||(this.animaMap[e]=[]),this.animaMap[e]=i.map((e=>(0,H.eachTriggerArrGetControls)(e)));let a=0;a=n?r.time*r.speed:r.time*r.speed*(r.reverse?2:1);const s=(new Date).valueOf(),o=a;let l;t=setInterval((()=>{var t=((new Date).valueOf()-s)/o;this.runScene.cb.timeLine.playGroup.cb({groupName:e,progress:t})}),16.6);const u=new Promise((e=>l=setTimeout(e,a)));return this.timerMap[e]={setProgressTime:t,awaitRuned:l},u.then((()=>{if(clearInterval(this.timerMap[e].setProgressTime),r.run)return r.run=!1,r.loop?this.playGroup(e):void 0}))}}}(this),this.anima=new W(this),this.tags=new ps(this),this.globalConfig=new ji(this),this.pp=new us(this),this.objects=new aa(this),this.inited=!1,this._renderLimit=new bt.cM,this._render=()=>{const{render2:e,render3:t}=this.assetsEx;var{scene:n,camera:r}=this.assetsEx.get();this.cb.render.cb(""),this.pp.update(),null!=t&&t.render(n,r),null!=e&&e.render(n,r)},this.render=()=>{if(null!=(e=this.optionsEx.options)&&e.run){const n=this._render;var{frame:e,mode:t}=this.optionsEx.options.renderConfig;-1!==e&&"tick"===t?(t=this._clock.getDelta(),this._renderLimit.update({cb(){n()},cbRate:1/e,now:t})):this._render()}},this.optionsEx=new la(this,e)}initLibs(e){if(!this.inited){this.snapshot.init(),this.materialEx.init(),this.modelEx.init(),this.sceneEx.init(),this.timeLineEx.init(),this.loaderer.init(),this.inited=!0,this.assetsEx.init(e),this.events.init(e),this.globalConfig.setRenderMode(this.optionsEx.options.renderConfig.mode),this.helperEx=new Vi(this);const{camera:t,controls:n}=this.assetsEx.get();this.uniqueEx.model.add(t),this.renderEx.setSize(),n.update(),this.pp.init(),this.cameraEx.reset(t)}}init(e){return this.initLibs(e),this}load(e){var{path:e,dom:t,loadConfig:n}=e;return this.init(t),this.loadScene(e,n).then((e=>{0!==(null==e?void 0:e.length)&&this.modelEx.add(e)})),this.cb.inited.cb(0),this}loadScene(e,t){return function(e,t,n,r){return new(n=n||Promise)((function(t,i){function a(e){try{o(r.next(e))}catch(e){i(e)}}function s(e){try{o(r.throw(e))}catch(e){i(e)}}function o(e){var r;e.done?t(e.value):((r=e.value)instanceof n?r:new n((function(e){e(r)}))).then(a,s)}o((r=r.apply(e,[])).next())}))}(this,0,void 0,(function*(){const{getJSON:n,progress:r,complete:i}=this.cb.load;t=t||{};var a=Object.assign(Object.assign({},t),{callBack:Object.assign(Object.assign({},t.callBack),{getJSON:e=>{var r,i;null!=(i=null==(r=null==t?void 0:t.callBack)?void 0:r.getJSON)&&i.call(r,e),n.cb(e)},progress:e=>{var n,i;null!=(i=null==(n=null==t?void 0:t.callBack)?void 0:n.progress)&&i.call(n,e),r.cb(e)},complete:e=>{var n,r;null!=(r=null==(n=null==t?void 0:t.callBack)?void 0:n.complete)&&r.call(n,e),i.cb(e)}}),triggerCb:!1});if(e instanceof ArrayBuffer)return this.optionsEx.log("正在解析二进制文件","base","info"),this.loaderer.gltf.parse(e,a);this.optionsEx.log("正在拉取场景","base","info");var s=yield j().get(e,{responseType:"arraybuffer",onDownloadProgress:e=>{var{total:e,loaded:t}=e;let n=t/e;1<(n=n<0?0:n)&&(n=1),t=Number(n.toFixed(2)),e=Math.floor(100*t),this.optionsEx.log("下载场景进度:"+e,"detail"),this.cb.load.progress.cb(e)}}).then((e=>e.data)).catch((e=>{this.sceneEx.clean(),this.optionsEx.log("下载场景失败:",e)}));return s?(this.optionsEx.log("拉取场景成功、正在解析","base","success"),this.loaderer.gltf.parse(s,a)):void 0}))}dispose(){this.assetsEx.dispose(),this.sceneEx.clean()}on(e,t){return null!=(e=this.cb.load[e])&&e.add("load-callback"+(0,H.getId)(),t),this}setSize(e,t){const{render2:n,render3:r}=this.assetsEx,i=this.assetsEx.get().renderer;this.cameraEx.setSize(),null!=r&&r.setSize(e,t),null!=n&&n.setSize(e,t),i.setSize(e,t,!0),this.pp.setSize(e,t)}clean(){this.cb.clean.cb(0)}},Utils:K,ModelEx:Z,MaterialEx:gt,TextureEx:pt,Three:bs,ThreeEx:{TransformControls:S},Bus:class{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]}}}})(),__webpack_exports__=__webpack_exports__.default,__webpack_exports__})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("three"),require("axios"),require("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,n)=>{function r(){return(r="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=l(e)););return e}(e,t);if(r)return(r=Object.getOwnPropertyDescriptor(r,t)).get?r.get.call(arguments.length<3?e:n):r.value}).apply(this,arguments)}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&a(e,t)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=l(e);if(n=t?(n=l(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===f(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return o(r)}}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 n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e,t,n){return t&&u(e.prototype,t),n&&u(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e){return function(e){if(Array.isArray(e))return 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 n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?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 n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}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(rt=E(e,nt))&&An}function b(e,t){return!t&&console.warn(e)}function x(e,t){return e&&(nt[e]=t)&&rt&&(rt[e]=t)||nt}function w(){return 0}function S(e,t,n){return(n=e[t])&&He(n)?e[t]():m(n)&&e.getAttribute&&e.getAttribute(t)||n}function A(e,t){(e=e.split(",")).forEach(t)}function M(e,t,n,r){st.length&&vt(),e.render(t,n,r),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 n in t)e[n]=t[n];return e}function T(e,t){for(var n in t)"__proto__"!==n&&"constructor"!==n&&"prototype"!==n&&(e[n]=Je(t[n])?T(e[n]||(e[n]={}),t[n]):t[n]);return e}function _(e){var t,n=e.parent||le,r=e.keyframes?(t=We(e.keyframes),function(e,n){for(var r in n)r in e||"duration"===r&&t||"ease"===r||(e[r]=n[r])}):gt;if(Ke(e.inherit))for(;n;)r(e,n.vars.defaults),n=n.parent||n._dp;return e}function D(e){return!e||e._ts&&D(e.parent)}function P(e){return e._repeat?O(e._tTime,e=e.duration()+e._rDelay)*e:0}function O(e,t){return t=Math.floor(e/=t),e&&t===e?t-1:t}function R(e,t){return(e-t._start)*t._ts+(0<=t._ts?0:t._dirty?t.totalDuration():t._tDur)}function I(e,t){var n;if((t._time||t._initted&&!t._dur)&&(n=R(e.rawTime(),t),(!t._dur||V(0,t.totalDuration(),n)-t._tTime>Le)&&t.render(n,!0)),wt(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur<e.duration())for(n=e;n._dp;)0<=n.rawTime()&&n.totalTime(n._tTime),n=n._dp;e._zTime=-Le}}function L(e,t,n,r){return t.parent&&xt(t),t._start=mt((Ve(n)?n:n||e!==le?z(e,n,t):e._time)+t._delay),t._end=mt(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),function(e,t){var n,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"_first",i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"_last",a=4<arguments.length?arguments[4]:void 0,s=e[i];if(a)for(n=t[a];s&&s[a]>n;)s=s._prev;s?(t._next=s._next,s._next=t):(t._next=e[r],e[r]=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),r||I(e,t),e}function k(e,t){(nt.ScrollTrigger||it("scrollTrigger",t))&&nt.ScrollTrigger.create(t,e)}function F(e,t,n,r){return Zt(e,t),e._initted?!n&&e._pt&&(e._dur&&!1!==e.vars.lazy||!e._dur&&e.vars.lazy)&&pe!==Ut.frame?(st.push(e),e._lazy=[t,r]):void 0:1}function U(e){return(e=e.parent)&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||U(e))}function G(e){return"isFromStart"===(e=e.data)||"isStart"===e}function N(e,t,n,r){var i=e._repeat,a=mt(t)||0;return(t=e._tTime/e._tDur)&&!r&&(e._time*=a/e._dur),e._dur=a,e._tDur=i?i<0?1e10:mt(a*(i+1)+e._rDelay*i):a,0<t&&!r?At(e,e._tTime=e._tDur*t):e.parent&&St(e),n||wt(e.parent,e),e}function j(e){return e instanceof sn?wt(e):N(e,e._dur)}function z(e,t,n){var r,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),r=t.indexOf("="),"<"===i||">"===i?(0<=r&&(t=t.replace(/=/,"")),("<"===i?o._start:o.endTime(0<=o._repeat))+(parseFloat(t.substr(1))||0)*(a?(r<0?o:n).totalDuration()/100:1)):r<0?(t in s||(s[t]=l),s[t]):(i=parseFloat(t.charAt(r-1)+t.substr(r+1)),a&&n&&(i=i/100*(We(n)?n[0]:n).totalDuration()),1<r?z(e,t.substr(0,r-1),n)+i:l+i)):null==t?l:+t}function H(e,t,n){var r,i,a=Ve(t[1]),s=(a?2:1)+(e<2?0:1),o=t[s];if(a&&(o.duration=t[1]),o.parent=n,e){for(r=o,i=n;i&&!("immediateRender"in r);)r=i.vars.defaults||{},i=Ke(i.vars.inherit)&&i.parent;o.immediateRender=Ke(r.immediateRender),e<2?o.runBackwards=1:o.startAt=t[s-1]}return new dn(t[0],o,t[1+s])}function V(e,t,n){return n<e?e:t<n?t:n}function J(e){if(He(e))return e;var t=Je(e)?e:{each:e},n=Vt(t.ease),r=t.from||0,i=parseFloat(t.base)||0,a={},s=(e=0<r&&r<1,isNaN(r)||e),o=t.axis,l=r,u=r;return ze(r)?l=u={center:.5,edges:.5,end:1}[r]||0:!e&&s&&(l=r[0],u=r[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:r%b,p=b===Ie?0:s?x*u/b-.5:r/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"===r&&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"===r?-1:1),w.b=x<0?i-x:i,w.u=Ct(t.amount||t.each)||0,n=n&&x<0?Ht(n):n}return x=(w[e]-w.min)/w.max||0,mt(w.b+(n?n(x):x)*w.v)+w.u}}function K(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(n){var r=Math.round(parseFloat(n)/e)*e*t;return(r-r%1)/t+(Ve(n)?0:Ct(n))}}function Z(e,t){var n,r,i=We(e);return!i&&Je(e)&&(n=i=e.radius||Ie,e.values?(e=_t(e.values),(r=!Ve(e[0]))&&(n*=n)):e=K(e.increment)),Bt(t,i?He(e)?function(t){return r=e(t),Math.abs(r-t)<=n?r:t}:function(t){for(var i,a,s=parseFloat(r?t.x:t),o=parseFloat(r?t.y:0),l=Ie,u=0,c=e.length;c--;)(i=r?(i=e[c].x-s)*i+(a=e[c].y-o)*a:Math.abs(e[c]-s))<l&&(l=i,u=c);return u=!n||l<=n?e[u]:t,r||u===t||Ve(t)?u:u+Ct(t)}:K(e))}function W(e,t,n,r){return Bt(We(e)?!t:!0===n?!!(n=0):!r,(function(){return We(e)?e[~~(Math.random()*e.length)]:(n=n||1e-5)&&(r=n<1?Math.pow(10,(n+"").length-2):1)&&Math.floor(Math.round((e-n/2+Math.random()*(t-e+.99*n))/n)*n*r)/r}))}function X(e,t,n){return Bt(n,(function(n){return e[~~t(n)]}))}function Q(e,t,n,r,i){var a=t-e,s=r-n;return Bt(i,(function(t){return n+((t-e)/a*s||0)}))}function Y(e,t,n){var r,i,a,s=e.labels,o=Ie;for(r in s)(i=s[r]-t)<0==!!n&&i&&o>(i=Math.abs(i))&&(a=r,o=i);return a}function q(e,t,n){var r=e.vars,i=r[t];i&&(t=r[t+"Params"],r=r.callbackScope||e,n&&st.length&&vt(),t?i.apply(r,t):i.call(r))}function $(e){return xt(e),e.scrollTrigger&&e.scrollTrigger.kill(!1),e.progress()<1&&q(e,"onInterrupt"),e}function ee(e,t,n){return(6*(e+=e<0?1:1<e?-1:0)<1?t+(n-t)*e*6:e<.5?n:3*e<2?t+(n-t)*(2/3-e)*6:t)*Ot+.5|0}function te(e,t,n){var r,i,a,s,o="",l=(e+o).match(kt),u=t?"hsla(":"rgba(",c=0;if(!l)return e;if(l=l.map((function(e){return(e=It(e,t,1))&&u+(t?e[0]+","+e[1]+"%,"+e[2]+"%,"+e[3]:e.join(","))+")"})),n&&(a=Lt(e),(r=n.c).join(o)!==a.c.join(o)))for(s=(i=e.replace(kt,"1").split(Ye)).length-1;c<s;c++)o+=i[c]+(~r.indexOf(c)?l.shift()||u+"0,0,0,0)":(a.length?a:l.length?l:n).shift());if(!i)for(s=(i=e.split(kt)).length-1;c<s;c++)o+=i[c]+l[c];return o+i[s]}function ne(e,t){for(var n,r=e._first;r;)r instanceof sn?ne(r,t):!r.vars.yoyoEase||r._yoyo&&r._repeat||r._yoyo===t||(r.timeline?ne(r.timeline,t):(n=r._ease,r._ease=r._yEase,r._yEase=n,r._yoyo=t)),r=r._next}function re(e,t){var n,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:function(e){return 1-t(1-e)},i={easeIn:t,easeOut:r,easeInOut:3<arguments.length&&void 0!==arguments[3]?arguments[3]:function(e){return e<.5?t(2*e)/2:1-t(2*(1-e))/2}};A(e,(function(e){for(var t in Nt[e]=nt[e]=i,Nt[n=e.toLowerCase()]=r,i)Nt[n+("easeIn"===t?".in":"easeOut"===t?".out":".inOut")]=Nt[e+"."+t]=i[t]}))}function ie(e){return function(t){return t<.5?(1-e(1-2*t))/2:.5+e(2*(t-.5))/2}}function ae(e,t,n){function r(e){return 1===e?1:i*Math.pow(2,-10*e)*je((e-a)*s)+1}var i=1<=t?t:1,a=(s=(n||(e?.3:.45))/(t<1?t:1))/ke*(Math.asin(1/i)||0),s=(n="out"===e?r:"in"===e?function(e){return 1-r(1-e)}:ie(r),ke/s);return n.config=function(t,n){return ae(e,t,n)},n}function se(e){function t(e){return e?--e*e*((n+1)*e+n)+1:0}var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1.70158,r="out"===e?t:"in"===e?function(e){return 1-t(1-e)}:ie(t);return r.config=function(t){return se(e,t)},r}n.d(t,{Q3:()=>dn});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,Le=1/Ie,ke=2*Math.PI,Fe=ke/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,nt={},rt={},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,n,r=e[0];if(Je(r)||He(r)||(e=[e]),!(t=(r._gsap||{}).harness)){for(n=ht.length;n--&&!ht[n].targetTest(r););t=ht[n]}for(n=e.length;n--;)e[n]&&(e[n]._gsap||(e[n]._gsap=new rn(e[n],t)))||e.splice(n,1);return e},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,n=st.length,r=st.slice(0);for(ot={},e=st.length=0;e<n;e++)(t=r[e])&&t._lazy&&(t.render(t._lazy[0],t._lazy[1],!0)._lazy=0)},gt=function(e,t){for(var n in t)n in e||(e[n]=t[n]);return e},yt=function(e,t){var n,r={};for(n in e)n in t||(r[n]=e[n]);return r},bt=function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"_first",r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"_last",i=t._prev,a=t._next;i?i._next=a:e[n]===t&&(e[n]=a),a?a._prev=i:e[r]===t&&(e[r]=i),t._next=t._prev=t.parent=null},xt=function(e,t){!e.parent||t&&!e.parent.autoRemoveChildren||e.parent.remove(e),e._act=0},wt=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var n=e;n;)n._dirty=1,n=n.parent;return e},St=function(e){return e._end=mt(e._start+(e._tDur/Math.abs(e._ts||e._rts||Le)||0))},At=function(e,t){var n=e._dp;return n&&n.smoothChildTiming&&e._ts&&(e._start=mt(n._time-(0<e._ts?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),St(e),n._dirty||wt(n,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,n){return!ze(e)||n||!ce&&Gt()?We(e)?function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[];return e.forEach((function(e){return ze(e)&&!t||Tt(e,1)?n.push.apply(n,d(_t(e))):n.push(e)}))||n}(e,n):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,n,r,i,a=0,s="";~(t=e.indexOf("random(",a));)r=e.indexOf(")",t),i="["===e.charAt(t+7),n=e.substr(t+7,r-t-7).match(i?et:Xe),s+=e.substr(a,t-a)+W(i?n:+n[0],i?0:+n[1],+n[2]||1e-5),a=r+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,n){var r,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?"#"+(r=e.charAt(1))+r+(i=e.charAt(2))+i+(a=e.charAt(3))+a+(5===e.length?e.charAt(4)+e.charAt(4):""):e).length)return[(c=parseInt(e.substr(1,6),16))>>16,c>>8&Ot,c&Ot,parseInt(e.substr(7),16)/255];c=[(e=parseInt(e.substr(1),16))>>16,e>>8&Ot,e&Ot]}else if("hsl"===e.substr(0,3))if(c=u=e.match(Xe),t){if(~e.indexOf("="))return c=e.match(Qe),n&&c.length<4&&(c[3]=1),c}else s=+c[0]%360/360,o=+c[1]/100,r=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,r,i),c[1]=ee(s,r,i),c[2]=ee(s-1/3,r,i);else c=e.match(Xe)||Rt.transparent;c=c.map(Number)}return t&&!u&&(r=c[0]/Ot,i=c[1]/Ot,a=c[2]/Ot,l=((e=Math.max(r,i,a))+(t=Math.min(r,i,a)))/2,e===t?s=o=0:(u=e-t,o=.5<l?u/(2-e-t):u/(e+t),s=e===r?(i-a)/u+(i<a?6:0):e===i?(a-r)/u+2:(r-i)/u+4,s*=60),c[0]=~~(s+.5),c[1]=~~(100*o+.5),c[2]=~~(100*l+.5)),n&&c.length<4&&(c[3]=1),c},Lt=function(e){var t=[],n=[],r=-1;return e.split(kt).forEach((function(e){e=e.match(Ye)||[],t.push.apply(t,d(e)),n.push(r+=e.length+1)})),t.c=n,t},kt=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||{},nt.gsap=An,(ue.gsapVersions||(ue.gsapVersions=[])).push(An.version),y(rt||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/Le,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,n,r,i=(e+"").split("("),a=Nt[i[0]];return a&&1<i.length&&a.config?a.config.apply(null,~e.indexOf("{")?[function(e){for(var t,n,r,i={},a=e.substr(1,e.length-3).split(":"),s=a[0],o=1,l=a.length;o<l;o++)n=a[o],t=o!==l-1?n.lastIndexOf(","):n.length,r=n.substr(0,t),i[s]=isNaN(r)?r.replace(zt,"").trim():+r,s=n.substr(t+1).trim();return i}(i[1])]:(t=(i=e).indexOf("(")+1,n=i.indexOf(")"),r=i.indexOf("(",t),i.substring(t,~r&&r<n?i.indexOf(")",n+1):n).split(",").map(B))):Nt._CE&&jt.test(e)?Nt._CE("",e):a}(e))||t};function Jt(e){var t,n,r,i=we()-Be,a=!0===e;if(Se<i&&(Me+=i-Ae),(0<(i=(n=(Be+=i)-Me)-Ee)||a)&&(r=++_e.frame,be=n-1e3*_e.time,_e.time=n/=1e3,Ee+=i+(Ce<=i?4:Ce-i),t=1),a||(ve=ge(Jt)),t)for(xe=0;xe<Te.length;xe++)Te[xe](n,be,r,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 n,r,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],n=yt(m,at),T&&xt(T.render(-1,!0)),g)if(xt(e._startAt=dn.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},n),p&&(i[u.prop]=p),xt(e._startAt=dn.set(_,i)),t<0&&e._startAt.render(-1,!0),e._zTime=t,y){if(!t)return}else Zt(e._startAt,Le);for(e._pt=0,b=E&&Ke(b)||b&&!E,r=0;r<_.length;r++){if(l=(s=_[r])._gsap||pt(_)[r]._gsap,e._ptLookup[r]=h={},ot[l.id]&&st.length&&vt(),d=P===_?r:P.indexOf(s),u&&!1!==(c=new u).init(s,p||n,e,d,P)&&(e._pt=a=new xn(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 n)lt[i]&&(c=un(i,n,e,d,s,P))?c.priority&&(o=1):h[i]=a=ln.call(e,s,i,"get",n[i],d,P,0,m.stringFilter);e._op&&e._op[r]&&e.kill(s,e._op[r]),O&&e._pt&&(nn=e,le.killTweensOf(s,h,e.globalTime(t)),f=!e.parent,nn=0),e._pt&&b&&(ot[l.id]=1)}o&&bn(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,n,r,i){return He(e)?e.call(t,n,r,i):ze(e)&&~e.indexOf("random(")?Pt(e):e}function Xt(e,t,n){return e.setAttribute(t,n)}function Qt(e,t){var n=t._pt,r="";if(!e&&t.b)r=t.b;else if(1===e&&t.e)r=t.e;else{for(;n;)r=n.p+(n.m?n.m(n.s+n.c*e):Math.round(1e4*(n.s+n.c*e))/1e4)+r,n=n._next;r+=t.c}t.set(t.t,t.p,r,t)}function Yt(e,t){for(var n=t._pt;n;)n.r(e,n.d),n=n._next}function qt(e,t,n,r){for(var i,a=this._pt;a;)i=a._next,a.p===r&&a.modifier(e,t,n),a=i}function $t(e){for(var t,n,r=this._pt;r;)n=r._next,r.p===e&&!r.op||r.op===e?bt(this,r,"_pt"):r.dep||(t=1),r=n;return!t}function en(e,t,n,r){r.mSet(e,t,r.m.call(r.tween,n,r.mt),r)}function tn(e,t){return{name:e,rawVars:1,init:function(e,n,r){r._onInit=function(e){var r,i;if(ze(n)&&(r={},A(n,(function(e){return r[e]=1})),n=r),t){for(i in r={},n)r[i]=t(n[i]);n=r}var a,s,o,l=e,u=n,c=l._targets;for(a in u)for(s=c.length;s--;)(o=(o=l._ptLookup[s][a])&&o.d)&&(o=o._pt?Sn(o,a):o)&&o.modifier&&o.modifier(u[a],l,c[s],a)}}}}A("Linear,Quad,Cubic,Quart,Quint,Strong",(function(e,t){var n=t<5?t+1:t;re(e+",Power"+(n-1),t?function(e){return Math.pow(e,n)}:function(e){return e},(function(e){return 1-Math.pow(1-e,n)}),(function(e){return e<.5?Math.pow(2*e,n)/2:1-Math.pow(2*(1-e),n)/2}))})),Nt.Linear.easeNone=Nt.none=Nt.Linear.easeIn,re("Elastic",ae("in"),ae("out"),ae()),De=7.5625,Pe=1/2.75,re("Bounce",(function(e){return 1-Kt(1-e)}),Kt),re("Expo",(function(e){return e?Math.pow(2,10*(e-1)):0})),re("Circ",(function(e){return-(Ge(1-e*e)-1)})),re("Sine",(function(e){return 1===e?1:1-Ne(e*Fe)})),re("Back",se("in"),se("out"),se()),Nt.SteppedEase=Nt.steps=nt.SteppedEase={config:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length?arguments[1]:void 0,n=1/e,r=e+(t?0:1),i=t?1:0,a=1-Le;return function(e){return((r*V(0,a,e)|0)+i)*n}}},Re.ease=Nt["quad.out"],A("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",(function(e){return dt+=e+","+e+"Params,"}));var nn,rn=c((function e(t,n){h(this,e),this.id=Ue++,(t._gsap=this).target=t,this.harness=n,this.get=n?n.get:S,this.set=n?n.getSetter:vn})),an=function(){function e(t){h(this,e),this.vars=t,this._delay=+t.delay||0,(this._repeat=t.repeat===1/0?-2:t.repeat||0)&&(this._rDelay=t.repeatDelay||0,this._yoyo=!!t.yoyo||!!t.yoyoEase),this._ts=1,N(this,+t.duration,1,1),this.data=t.data,me||Ut.wake()}return c(e,[{key:"delay",value:function(e){return e||0===e?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+e-this._delay),this._delay=e,this):this._delay}},{key:"duration",value:function(e){return arguments.length?this.totalDuration(0<this._repeat?e+(e+this._rDelay)*this._repeat:e):this.totalDuration()&&this._dur}},{key:"totalDuration",value:function(e){return arguments.length?(this._dirty=0,N(this,this._repeat<0?e:(e-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur}},{key:"totalTime",value:function(e,t){if(Gt(),!arguments.length)return this._tTime;var n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(At(this,e),n._dp&&!n.parent&&I(n,this);n&&n.parent;)n.parent._time!==n._start+(0<=n._ts?n._tTime/n._ts:(n.totalDuration()-n._tTime)/-n._ts)&&n.totalTime(n._tTime,!0),n=n.parent;!this.parent&&this._dp.autoRemoveChildren&&(0<this._ts&&e<this._tDur||this._ts<0&&0<e||!this._tDur&&!e)&&L(this._dp,this,this._start-this._delay)}return(this._tTime!==e||!this._dur&&!t||this._initted&&Math.abs(this._zTime)===Le||!e&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=e),M(this,e,t)),this}},{key:"time",value:function(e,t){return arguments.length?this.totalTime(Math.min(this.totalDuration(),e+P(this))%(this._dur+this._rDelay)||(e?this._dur:0),t):this._time}},{key:"totalProgress",value:function(e,t){return arguments.length?this.totalTime(this.totalDuration()*e,t):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.ratio}},{key:"progress",value:function(e,t){return arguments.length?this.totalTime(this.duration()*(!this._yoyo||1&this.iteration()?e:1-e)+P(this),t):this.duration()?Math.min(1,this._time/this._dur):this.ratio}},{key:"iteration",value:function(e,t){var n=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(e-1)*n,t):this._repeat?O(this._tTime,n)+1:1}},{key:"timeScale",value:function(e){if(!arguments.length)return this._rts===-Le?0:this._rts;if(this._rts===e)return this;for(var t=this.parent&&this._ts?R(this.parent._time,this):this._tTime,n=(this._rts=+e||0,this._ts=this._ps||e===-Le?0:this._rts,e=this.totalTime(V(-this._delay,this._tDur,t),!0)).parent;n&&n.parent;)n._dirty=1,n.totalDuration(),n=n.parent;return 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)!==Le&&(this._tTime-=Le)))),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||L(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,n=arguments.length?e:t.rawTime();t;)n=t._start+n/(t._ts||1),t=t._dp;return n}},{key:"repeat",value:function(e){return arguments.length?(this._repeat=e===1/0?-2:e,j(this)):-2===this._repeat?1/0:this._repeat}},{key:"repeatDelay",value:function(e){var t;return arguments.length?(t=this._time,this._rDelay=e,j(this),t?this.time(t):this):this._rDelay}},{key:"yoyo",value:function(e){return arguments.length?(this._yoyo=e,this):this._yoyo}},{key:"seek",value:function(e,t){return this.totalTime(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?-Le:0)),this):this._rts<0}},{key:"invalidate",value:function(){return this._initted=this._act=0,this._zTime=-Le,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)-Le))}},{key:"eventCallback",value:function(e,t,n){var r=this.vars;return 1<arguments.length?(t?(r[e]=t,n&&(r[e+"Params"]=n),"onUpdate"===e&&(this._onUpdate=t)):delete r[e],this):r[e]}},{key:"then",value:function(e){var t=this;return new Promise((function(n){function r(){var e=t.then;t.then=null,He(i)&&(i=i(t))&&(i.then||i===t)&&(t.then=e),n(i),t.then=e}var i=He(e)?e:C;t._initted&&1===t.totalProgress()&&0<=t._ts||!t._tTime&&t._ts<0?r():t._prom=r}))}},{key:"kill",value:function(){$(this)}}]),e}(),sn=(gt(an.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-Le,_prom:0,_ps:!1,_rts:1}),function(){i(t,an);var e=s(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},i=1<arguments.length?arguments[1]:void 0;return h(this,t),(n=e.call(this,r)).labels={},n.smoothChildTiming=!!r.smoothChildTiming,n.autoRemoveChildren=!!r.autoRemoveChildren,n._sort=Ke(r.sortChildren),le&&L(r.parent||le,o(n),i),r.reversed&&n.reverse(),r.paused&&n.paused(!0),r.scrollTrigger&&k(o(n),r.scrollTrigger),n}return c(t,[{key:"to",value:function(e,t,n){return H(0,arguments,this),this}},{key:"from",value:function(e,t,n){return H(1,arguments,this),this}},{key:"fromTo",value:function(e,t,n,r){return H(2,arguments,this),this}},{key:"set",value:function(e,t,n){return t.duration=0,t.parent=this,_(t).repeatDelay||(t.repeat=0),t.immediateRender=!!t.immediateRender,new dn(e,t,z(this,n),1),this}},{key:"call",value:function(e,t,n){return L(this,dn.delayedCall(0,e,t),n)}},{key:"staggerTo",value:function(e,t,n,r,i,a,s){return n.duration=t,n.stagger=n.stagger||r,n.onComplete=a,n.onCompleteParams=s,n.parent=this,new dn(e,n,z(this,i)),this}},{key:"staggerFrom",value:function(e,t,n,r,i,a,s){return n.runBackwards=1,_(n).immediateRender=Ke(n.immediateRender),this.staggerTo(e,t,n,r,i,a,s)}},{key:"staggerFromTo",value:function(e,t,n,r,i,a,s,o){return r.startAt=n,_(r).immediateRender=Ke(r.immediateRender),this.staggerTo(e,t,r,i,a,s,o)}},{key:"render",value:function(e,t,n){var r,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||n||g){if(p!==this._time&&m&&(v+=this._time-p,e+=this._time-p),r=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,n);if(r=mt(v%s),v===f?(a=this._repeat,r=m):((a=~~(v/s))&&a===v/s&&(r=m,a--),m<r&&(r=m)),h=O(this._tTime,s),g&&1&a&&(r=m-r,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;ne(this,d)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(l=function(e,t,n){var r;if(t<n)for(r=e._first;r&&r._start<=n;){if("isPause"===r.data&&r._start>t)return r;r=r._next}else for(r=e._last;r&&r._start>=n;){if("isPause"===r.data&&r._start<t)return r;r=r._prev}}(this,mt(p),mt(r)))&&(v-=r-(r=l._start)),this._tTime=v,this._time=r,this._act=!u,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=e,p=0),!p&&r&&!t&&(q(this,"onStart"),this._tTime!==v))return this;if(p<=r&&0<=e)for(b=this._first;b;){if(i=b._next,(b._act||r>=b._start)&&b._ts&&l!==b){if(b.parent!==this)return this.render(e,t,n);if(b.render(0<b._ts?(r-b._start)*b._ts:(b._dirty?b.totalDuration():b._tDur)+(r-b._start)*b._ts,t,n),r!==this._time||!this._ts&&!o){l=0,i&&(v+=this._zTime=-Le);break}}b=i}else for(var b=this._last,x=e<0?e:r;b;){if(i=b._prev,(b._act||x<=b._end)&&b._ts&&l!==b){if(b.parent!==this)return this.render(e,t,n);if(b.render(0<b._ts?(x-b._start)*b._ts:(b._dirty?b.totalDuration():b._tDur)+(x-b._start)*b._ts,t,n),r!==this._time||!this._ts&&!o){l=0,i&&(v+=this._zTime=x?-Le:Le);break}}b=i}if(l&&!t&&(this.pause(),l.render(p<=r?0:-Le)._zTime=p<=r?1:-1,this._ts))return this._start=c,St(this),this.render(e,t,n);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 n=this;if(Ve(t)||(t=z(this,t,e)),!(e instanceof an)){if(We(e))return e.forEach((function(e){return n.add(e,t)})),this;if(ze(e))return this.addLabel(e,t);if(!He(e))return this;e=dn.delayedCall(0,e)}return this!==e?L(this,e,t):this}},{key:"getChildren",value:function(){for(var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],n=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:-Ie,i=[],a=this._first;a;)a._start>=r&&(a instanceof dn?t&&i.push(a):(n&&i.push(a),e&&i.push.apply(i,d(a.getChildren(!0,t,n))))),a=a._next;return i}},{key:"getById",value:function(e){for(var t=this.getChildren(1,1,1),n=t.length;n--;)if(t[n].vars.id===e)return t[n]}},{key:"remove",value:function(e){return 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,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=mt(Ut.time-(0<this._ts?e/this._ts:(this.totalDuration()-e)/-this._ts))),r(l(t.prototype),"totalTime",this).call(this,e,n),this._forcing=0,this):this._tTime}},{key:"addLabel",value:function(e,t){return this.labels[e]=z(this,t),this}},{key:"removeLabel",value:function(e){return delete this.labels[e],this}},{key:"addPause",value:function(e,t,n){return(t=dn.delayedCall(0,t||w,n)).data="isPause",this._hasPause=1,L(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,n){for(var r=this.getTweensOf(e,n),i=r.length;i--;)nn!==r[i]&&r[i].kill(e,t);return this}},{key:"getTweensOf",value:function(e,t){for(var n,r=[],i=_t(e),a=this._first,s=Ve(t);a;)a instanceof dn?function(e,t){for(var n=t.length,r=0;e.indexOf(t[r])<0&&++r<n;);return r<n}(a._targets,i)&&(s?(!nn||a._initted&&a._ts)&&a.globalTime(0)<=t&&a.globalTime(a.totalDuration())>t:!t||a.isActive())&&r.push(a):(n=a.getTweensOf(i,t)).length&&r.push.apply(r,d(n)),a=a._next;return r}},{key:"tweenTo",value:function(e,t){t=t||{};var n,r=this,i=z(r,e),a=(e=t).startAt,s=e.onStart,o=e.onStartParams,l=(e=e.immediateRender,dn.to(r,gt({ease:t.ease||"none",lazy:!1,immediateRender:!1,time:i,overwrite:"auto",duration:t.duration||Math.abs((i-(a&&"time"in a?a.time:r._time))/r.timeScale())||Le,onStart:function(){var e;r.pause(),n||(e=t.duration||Math.abs((i-(a&&"time"in a?a.time:r._time))/r.timeScale()),l._dur!==e&&N(l,e,0,1).render(l._time,!0,!0),n=1),s&&s.apply(l,o||[])}},t)));return e?l.render(0):l}},{key:"tweenFromTo",value:function(e,t,n){return this.tweenTo(t,gt({startAt:{time:z(this,e)}},n))}},{key:"recent",value:function(){return this._recent}},{key:"nextLabel",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this._time;return Y(this,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+Le)}},{key:"shiftChildren",value:function(e,t){for(var n,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=this._first,a=this.labels;i;)i._start>=r&&(i._start+=e,i._end+=e),i=i._next;if(t)for(n in a)a[n]>=r&&(a[n]+=e);return wt(this)}},{key:"invalidate",value:function(){var e=this._first;for(this._lock=0;e;)e.invalidate(),e=e._next;return r(l(t.prototype),"invalidate",this).call(this)}},{key:"clear",value:function(){for(var e,t=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],n=this._first;n;)e=n._next,this.remove(n),n=e;return this._dp&&(this._time=this._tTime=this._pTime=0),t&&(this.labels={}),wt(this)}},{key:"totalDuration",value:function(e){var t,n,r,i=0,a=this,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(r=a.parent;s;)t=s._prev,s._dirty&&s.totalDuration(),(n=s._start)>o&&a._sort&&s._ts&&!a._lock?(a._lock=1,L(a,s,n-s._delay,1)._lock=0):o=n,n<0&&s._ts&&(i-=n,(!r&&!a._dp||r&&r.smoothChildTiming)&&(a._start+=n/a._ts,a._time-=n,a._tTime-=n),a.shiftChildren(-n,!1,-1/0),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}()),on=(gt(sn.prototype,{_lock:0,_hasPause:0,_forcing:0}),function(e,t,n,r,i,a,s){var o,l,u,c,h,d=new xn(this._pt,e,t,0,1,Qt,null,i),p=0,f=0;for(d.b=n,d.e=r,n+="",(i=~(r+="").indexOf("random("))&&(r=Pt(r)),a&&(a(a=[n,r],e,t),n=a[0],r=a[1]),o=n.match(qe)||[];c=qe.exec(r);)u=c[0],c=r.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<r.length?r.substring(p,r.length):"",d.fp=s,($e.test(r)||i)&&(d.e=0),this._pt=d}),ln=function(e,t,n,r,i,a,s,o,l){var u;if(He(r)&&(r=r(i||0,e,a)),i=e[t],a="get"!==n?n:He(i)?l?e[t.indexOf("set")||!He(e["get"+t.substr(3)])?t:"get"+t.substr(3)](l):e[t]():i,n=He(i)?l?mn:fn:pn,ze(r)&&"="===(r=~r.indexOf("random(")?Pt(r):r).charAt(1)&&(!(u=parseFloat(a)+parseFloat(r.substr(2))*("-"===r.charAt(0)?-1:1)+(Ct(a)||0))&&0!==u||(r=u)),a!==r)return isNaN(a*r)||""===r?(i||t in e||it(t,r),on.call(this,e,t,a,r,n,o||Oe.stringFilter,l)):(u=new xn(this._pt,e,t,+a||0,r-(a||0),"boolean"==typeof i?yn:gn,0,n),l&&(u.fp=l),s&&u.modifier(s,this,e),this._pt=u)},un=function(e,t,n,r,i,a){var s,o,l,u;if(lt[e]&&!1!==(s=new lt[e]).init(i,s.rawVars?t[e]:function(e,t,n,r,i){if(He(e)&&(e=Wt(e,i,t,n,r)),!Je(e)||e.style&&e.nodeType||We(e)||Ze(e))return ze(e)?Wt(e,i,t,n,r):e;var a,s={};for(a in e)s[a]=Wt(e[a],i,t,n,r);return s}(t[e],r,i,a,n),n,r,a)&&(n._pt=o=new xn(n._pt,i,e,0,1,s.render,s,0,s.priority),n!==fe))for(l=n._ptLookup[n._targets.indexOf(i)],u=s._props.length;u--;)l[s._props[u]]=o;return s},cn=dt+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase",hn={},dn=(A(cn+",id,stagger,delay,duration,paused,scrollTrigger",(function(e){return hn[e]=1})),function(){i(t,an);var e=s(t);function t(n,r,i,a){h(this,t),"number"==typeof r&&(i.duration=r,r=i,i=null);var s,l,u,c,d,p,f,m,v,y=(a=(s=e.call(this,a?r:_(r))).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=r.parent||le,(We(n)||Ze(n)?Ve(n[0]):"length"in r)?[n]:_t(n));if(s._targets=P.length?pt(P):b("GSAP target "+n+" not found. https://greensock.com",!Oe.nullTargetWarn)||[],s._ptLookup=[],s._overwrite=A,M||S||g(y)||g(x)){if(r=s.vars,(l=s.timeline=new sn({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)~cn.indexOf(p)&&((v=v||{})[p]=S[p]);for(u=0;u<d;u++)(c=yt(r,hn)).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||r.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,n,r){var i,a,s=t.ease||r||"power1.inOut";if(We(t))a=n[e]||(n[e]=[]),t.forEach((function(e,n){return a.push({t:n/(t.length-1)*100,v:e,e:s})}));else for(i in t)a=n[i]||(n[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||(nn=o(s),le.killTweensOf(P),nn=0),L(a,o(s),i),r.reversed&&s.reverse(),r.paused&&s.paused(!0),(w||!y&&!M&&s._start===mt(a._time)&&Ke(w)&&D(o(s))&&"nested"!==a.data)&&(s._tTime=-Le,s.render(Math.max(0,-x))),C&&k(o(s),C),s}return c(t,[{key:"render",value:function(e,t,n){var r,i,a=this._time,s=this._tDur,o=this._dur,l=s-Le<e&&0<=e?s:e<Le?0:e;if(o){if(l!==this._tTime||!e||n||!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,n);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&&!n&&this._initted)return this;g!==y&&(f&&this._yEase&&ne(f,p),!this.vars.repeatRefresh||p||this._lock||(this._lock=n=1,this.render(mt(h*g),!0).invalidate()._lock=0))}if(!this._initted){if(F(this,e<0?e:m,n,t))return this._tTime=0,this;if(o!==this._dur)return this.render(e,t,n)}if(this._tTime=l,this._time=m,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=i=(d||this._ease)(m/o),this._from&&(this.ratio=i=1-i),m&&!a&&!t&&(q(this,"onStart"),this._tTime!==l))return this;for(r=this._pt;r;)r.r(i,r.d),r=r._next;f&&f.render(e<0?e:!m&&p?-Le:f._dur*f._ease(m/this._dur),t,n)||this._startAt&&(this._zTime=e),this._onUpdate&&!t&&(e<0&&this._startAt&&this._startAt.render(e,!0,n),q(this,"onUpdate")),this._repeat&&g!==y&&this.vars.onRepeat&&!t&&this.parent&&q(this,"onRepeat"),l!==this._tDur&&l||this._tTime!==l||(e<0&&this._startAt&&!this._onUpdate&&this._startAt.render(e,!0,!0),!e&&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=n,m=h.ratio,v=d<0||!d&&(!h._start&&U(h)&&(h._initted||!G(h))||(h._ts<0||h._dp._ts<0)&&!G(h))?0:1,g=h._rDelay,y=0;if(g&&h._repeat&&(c=O(y=V(0,h._tDur,d),g),h._yoyo&&1&c&&(v=1-v),c!==O(h._tTime,g)&&(m=1-v,h.vars.repeatRefresh&&h._initted&&h.invalidate())),v!==m||f||h._zTime===Le||!d&&h._zTime){if(h._initted||!F(h,d,f,p)){for(c=h._zTime,h._zTime=d||(p?Le: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(),r(l(t.prototype),"invalidate",this).call(this)}},{key:"kill",value:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"all";if(!(e||t&&"all"!==t))return this._lazy=this._pt=0,this.parent?$(this):this;if(this.timeline)return d=this.timeline.totalDuration(),this.timeline.killTweensOf(e,t,nn&&!0!==nn.vars.overwrite)._first||$(this),this.parent&&d!==this.timeline.totalDuration()&&N(this,this._dur*this.timeline._tDur/d,0,1),this;var n,r,i,a,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 n=e.length,r=n===t.length;r&&n--&&e[n]===t[n];);return n<0}(u,c))return"all"===t&&(this._pt=0),$(this);for(n=this._op=this._op||[],"all"!==t&&(ze(t)&&(s={},A(t,(function(e){return s[e]=1})),t=s),t=function(e,t){var n,r,i,a,s=(e=e[0]?ft(e[0]).harness:0)&&e.aliases;if(!s)return t;for(r in n=E({},t),s)if(r in n)for(i=(a=s[r].split(",")).length;i--;)n[a[i]]=n[r];return n}(u,t)),l=u.length;l--;)if(~c.indexOf(u[l]))for(s in r=h[l],"all"===t?(n[l]=t,a=r,i={}):(i=n[l]=n[l]||{},a=t),a)(o=r&&r[s])&&("kill"in o.d&&!0!==o.d.kill(s)||bt(this,o,"_pt"),delete r[s]),"all"!==i&&(i[s]=1);return this._initted&&!this._pt&&d&&$(this),this}}],[{key:"to",value:function(e,n){return new t(e,n,arguments[2])}},{key:"from",value:function(e,t){return H(1,arguments)}},{key:"delayedCall",value:function(e,n,r,i){return new t(n,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:e,onComplete:n,onReverseComplete:n,onCompleteParams:r,onReverseCompleteParams:r,callbackScope:i})}},{key:"fromTo",value:function(e,t,n){return H(2,arguments)}},{key:"set",value:function(e,n){return n.duration=0,n.repeatDelay||(n.repeat=0),new t(e,n)}},{key:"killTweensOf",value:function(e,t,n){return le.killTweensOf(e,t,n)}}]),t}()),pn=(gt(dn.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),A("staggerTo,staggerFrom,staggerFromTo",(function(e){dn[e]=function(){var t=new sn,n=Et.call(arguments,0);return n.splice("staggerFromTo"===e?5:4,0,0),t[e].apply(t,n)}})),function(e,t,n){return e[t]=n}),fn=function(e,t,n){return e[t](n)},mn=function(e,t,n,r){return e[t](r.fp,n)},vn=function(e,t){return He(e[t])?fn:m(e[t])&&e.setAttribute?Xt:pn},gn=function(e,t){return t.set(t.t,t.p,Math.round(1e6*(t.s+t.c*e))/1e6,t)},yn=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},bn=function(e){for(var t,n,r,i,a=e._pt;a;){for(t=a._next,n=r;n&&n.pr>a.pr;)n=n._next;(a._prev=n?n._prev:i)?a._prev._next=a:r=a,(a._next=n)?n._prev=a:i=a,a=t}e._pt=r},xn=function(){function e(t,n,r,i,a,s,o,l,u){h(this,e),this.t=n,this.s=i,this.c=a,this.p=r,this.r=s||gn,this.d=o||this,this.set=l||pn,this.pr=u||0,(this._next=t)&&(t._prev=this)}return c(e,[{key:"modifier",value:function(e,t,n){this.mSet=this.mSet||this.set,this.set=en,this.m=e,this.mt=n,this.tween=t}}]),e}(),wn=(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})),nt.TweenMax=nt.TweenLite=dn,nt.TimelineLite=nt.TimelineMax=sn,le=new sn({sortChildren:!1,defaults:Re,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Oe.stringFilter=function(e){var t=e.join(" ");if(kt.lastIndex=0,kt.test(t))return t=Ft.test(t),e[1]=te(e[1],t),e[0]=te(e[0],t,Lt(e[1])),!0},{registerPlugin:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.forEach((function(e){var t=(e=!e.name&&e.default||e).name,n=He(e),r=(n=t&&!n&&e.init?function(){this._props=[]}:e,{init:w,render:Yt,add:ln,kill:$t,modifier:qt,rawVars:0}),i={targetTest:0,get:0,getSetter:vn,aliases:{},register:0};if(Gt(),e!==n){if(lt[t])return;gt(n,gt(yt(e,r),i)),E(n.prototype,E(r,yt(e,i))),lt[n.prop=t]=n,e.targetTest&&(ht.push(n),at[t]=1),t=("css"===t?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}x(t,n),e.register&&e.register(An,n,xn)}))},timeline:function(e){return new sn(e)},getTweensOf:function(e,t){return le.getTweensOf(e,t)},getProperty:function(e,t,n,r){ze(e)&&(e=_t(e)[0]);var i=ft(e||{}).get,a=n?C:B;return"native"===n&&(n=""),e&&(t?a((lt[t]&&lt[t].get||i)(e,t,n,r)):function(t,n,r){return a((lt[t]&&lt[t].get||i)(e,t,n,r))})},quickSetter:function(e,t,n){var r,i;if(1<(e=_t(e)).length)return r=e.map((function(e){return An.quickSetter(e,t,n)})),i=r.length,function(e){for(var t=i;t--;)r[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 r=new a;fe._pt=0,r.init(e,n?t+n:t,fe,0,[e]),r.render(1,r),fe._pt&&Yt(1,fe)}:s.set(e,o);return a?l:function(t){return l(e,o,n?t+n: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,n=e.effect,r=e.plugins,i=e.defaults;e=e.extendTimeline,(r||"").split(",").forEach((function(e){return e&&!lt[e]&&!nt[e]&&b(t+" effect requires "+e+" plugin.")})),ut[t]=function(e,t,r){return n(_t(e),gt(t||{},i),r)},e&&(sn.prototype[t]=function(e,n,r){return this.add(ut[t](e,Je(n)?n:(r=n)&&{},this),r)})},registerEase:function(e,t){Nt[e]=Vt(t)},parseEase:function(e,t){return arguments.length?Vt(e,t):Nt},getById:function(e){return le.getById(e)},exportRoot:function(){var e,t,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},r=1<arguments.length?arguments[1]:void 0,i=new sn(n);for(i.smoothChildTiming=Ke(n.smoothChildTiming),le.remove(i),i._dp=0,i._time=i._tTime=le._time,e=le._first;e;)t=e._next,!r&&!e._dur&&e instanceof dn&&e.vars.onComplete===e._targets[0]||L(i,e,e._start-e._delay),e=t;return L(le,i,0),i},utils:{wrap:function e(t,n,r){var i=n-t;return We(t)?X(t,e(0,t.length),n):Bt(r,(function(e){return(i+(e-t)%i)%i+t}))},wrapYoyo:function e(t,n,r){var i=n-t,a=2*i;return We(t)?X(t,e(0,t.length-1),n):Bt(r,(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,n){return Q(e,t,0,1,n)},getUnit:Ct,clamp:function(e,t,n){return Bt(n,(function(n){return V(e,t,n)}))},splitColor:It,toArray:_t,selector:function(e){return e=_t(e)[0]||b("Invalid scope")||{},function(t){var n=e.current||e.nativeElement||e;return _t(t,n.querySelectorAll?n:n===e?b("Invalid scope")||he.createElement("div"):e)}},mapRange:Q,pipe:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return t.reduce((function(e,t){return t(e)}),e)}},unitize:function(e,t){return function(n){return e(parseFloat(n))+(t||Ct(n))}},interpolate:function e(t,n,r,i){var a=isNaN(t+n)?0:function(e){return(1-e)*t+e*n};if(!a){var s,o,l,u,c,h=ze(t),d={};if(!0===r&&(i=1)&&(r=null),h)t={p:t},n={p:n};else if(We(t)&&!We(n)){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)},r=n}else i||(t=E(We(t)?[]:{},t));if(!l){for(s in n)ln.call(d,t,s,"get",n[s]);a=function(e){return Yt(e,d),h?t.p:t}}}return Bt(r,a)},shuffle:Dt},install:y,effects:ut,ticker:Ut,updateRoot:sn.updateRoot,plugins:lt,globalTimeline:le,core:{PropTween:xn,globals:x,Tween:dn,Timeline:sn,Animation:an,getCache:ft,_removeLinkedListItem:bt,suppressOverwrites:function(e){return oe=e}}}),Sn=(A("to,from,fromTo,delayedCall,set,killTweensOf",(function(e){return wn[e]=dn[e]})),Ut.add(sn.updateRoot),fe=wn.to({},{duration:0}),function(e,t){for(var n=e._pt;n&&n.p!==t&&n.op!==t&&n.fp!==t;)n=n._next;return n}),An=wn.registerPlugin({name:"attr",init:function(e,t,n,r,i){var a,s;for(a in t)(s=this.add(e,"setAttribute",(e.getAttribute(a)||0)+"",t[a],r,i,0,0,a))&&(s.op=a),this._props.push(a)}},{name:"endArray",init:function(e,t){for(var n=t.length;n--;)this.add(e,n,e[n]||0,t[n])}},tn("roundProps",K),tn("modifiers"),tn("snap",Z))||wn;dn.version=sn.version=An.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,n)=>{n.d(t,{N:()=>o,Z:()=>s});var r=n(881),i=n(794),a=n(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 n,r;this.backgroudDom||(this.backgroudDom=document.createElement("div"),({width:n,height:r}=this.runScene.renderEx.getDomSize()),this.backgroudDom.style.position="absolute",this.backgroudDom.style.width=n+"px",this.backgroudDom.style.height=r+"px",t.appendChild(this.backgroudDom)),e?(this.backgroudDom.style.display="block",this.backgroudDom.style.backgroundImage="url("+e+")",this.backgroudDom.style.backgroundRepeat="no-repeat",this.backgroudDom.style.backgroundSize="100% 100%"):this.backgroudDom.style.display="none"}create(){return new r.PerspectiveCamera}createOrthographic(){return new r.OrthographicCamera}setMode(e){if(e!==this.mode){this.runScene.helperEx.transContro.reset(),this.mode=e,this.runScene.assetsEx.reset(),this.reset(this.getCamera()),this.setSize();const t=this.runScene.assetsEx.get().controls;"OrthographicCamera"===e&&(t.enableRotate=!1,t.enablePan=!1)}}getCamera(){return"OrthographicCamera"===this.mode?this.oCam:this.pCam}reset(e){e.position.set(0,20,20);const t=this.runScene.assetsEx.get().controls;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 n=this.getCamera();n.aspect=e/t,n.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:n,z:r}=e.position,{x:t,y:i,z:a}=t.target;return{x:e,y:n,z:r,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((n=>{const{time:r,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,r||.5,(e=>{var{x:t,y:n,z:r,tx:i,ty:a,tz:u}=e;o.position.set(t,n,r),l.target.set(i,a,u),l.update(),null!=s&&s(e)}),(()=>{null!=i&&i(),n(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,n)=>{n.d(t,{sG:()=>r,zX:()=>i});const r=["map","normalMap","aoMap"],i=["map","metalnessMap","roughnessMap","normalMap","aoMap","emissiveMap","alphaMap","lightMap","envMap","displacementMap"]},263:(e,t,n)=>{n.d(t,{F6:()=>r,YD:()=>u});var r={};n.r(r),n.d(r,{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 n=0;n<e.length;n++)if(e[n]!==t[n])return!0;return!1};n(794),n(272);var u=n(201)},794:(e,t,n)=>{n.d(t,{Z:()=>i});var r=n(1);class i extends Map{constructor(e){e?super((0,r.mapObj)(e,((e,t)=>[e,t]))):super()}toArray(e){let t=[];for(const n of this.entries())"key"==e?t.push(n[0]):t.push(n[1]);return t}map(e){return[...this.entries()].map((t=>{var[t,n]=t;return e(t,n)}))}toJSON(){const e={};return this.forEach(((t,n)=>{e[n]=t})),e}toString(){return JSON.stringify(this.map)}filter(e,t){let n=[];for(var[r,i]of this.entries())e(r,i)&&n.push("key"===t?r:i);return n}find(e){for(var[t,n]of this.entries())if(e(t,n))return n}static formJSON(e){return new i(e)}copy(e){e.map(((e,t)=>this.set(e,t)))}}},201:(e,t,n)=>{n.r(t),n.d(t,{is:()=>a,isDef:()=>i,logObj:()=>c,objToStr:()=>u,replaceKVForObj:()=>o,replaceKeyForObj:()=>l,replaceValForObj:()=>s});var r=n(1);const i=(e,t)=>{if(!a(e))return!0;var n=Object.keys(e);for(let o=0;o<n.length;o++){var r=n[o],s=e[r];if(r=t[r],a(s))return!a(r)||i(s,r);if(s!==r)return!0}return!1},a=e=>(null==e?void 0:e.constructor)===Object,s=(e,t)=>{let n={};return Object.keys(e).map(((r,i)=>{var a=e[r];n[r]=t(r,a,i)})),n},o=(e,t)=>{let n={};return Object.keys(e).map(((r,i)=>{var a=e[r],{k:r,v:a}=t(r,a,i);n[r]=a})),n},l=(e,t)=>{let n={};return Object.keys(e).map(((r,i)=>{var a=e[r];n[t(r,a,i)]=a})),n},u=e=>{let t="";return(0,r.mapObj)(e,((e,n)=>{t=(t+=e+":")+(a(n)?u(n):n)})),t},c=e=>{console.log(u(e))}},272:(e,t,n)=>{n.d(t,{Z:()=>r});class r extends Set{constructor(e){super(),this.isSet=!0,this.add(e||[])}add(e){return Array.isArray(e)?e.map((e=>this.add(e))):super.add(e),this}remove(e){if(Array.isArray(e))e.map((e=>this.remove(e)));else{if(!super.has(e))return;super.delete(e)}return this}toArray(){return[...this]}map(e,t=!1){const n=[];return this.forEach((r=>{if(r=e(r),!t)return n.push(r);r&&n.push(r)})),n}find(e){for(const t of this)if(e(t))return t}filter(e){const t=[];for(const n of this)e(n)&&t.push(n);return t}}},247:(e,t,n)=>{n.d(t,{Z:()=>r});const r=t=n(881)},598:(e,t,n)=>{n.d(t,{Z:()=>r});class r{constructor(e){this.runScene=e}}},585:(e,t,n)=>{n.d(t,{Z:()=>c});var r=n(247),i=n(736),a=n(398),s=n(729),o=n(457);t=n(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:n,type:r,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:r,intensity:t,name:n,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[n]=t;return c.setConfig(n,e),(0,i.M)(n,"id",e.id),t}get(e){return this.runScene.lightEx.get("DirectionalLight",e)}static setConfig(e,t){const{intensity:n,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=n,e.name=o,e.visible=l,e.castShadow=c,e.color=new r.Z.Color(u.includes(u)?u:"#"+u),i&&e.position.set(i.x,i.y,i.z),a&&e.rotation.set(a.x,a.y,a.z),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 n=e.shadow,{mapSize:n,camera:r}=n,{scale:r,near:i,far:s}=r,{x:e,y:c,z:h}=e.target.position;return(0,o.isDef)(n.x,l.mapSizeX)&&(t.m=n.x),(0,o.isDef)({x:e,y:c,z:h},l.targetPosition)&&(t.tp={x:e,y:c,z:h}),(0,o.isDef)(r.x,l.scaleX)&&(t.s=r.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:n,runScene:r,data:i}=e,{m:s,tp:o,s:c,n:h,f:d}=(a.LV.set({def:u,data:i,runScene:r,map:t,target:n}),i);t.data.completedCbs.push((()=>{var{far:e,near:t,mapSizeX:r,scaleX:i,targetPosition:a}=l,{x:a,y:u,z:p}=o||a,a=(n.target.position.set(a,u,p),s||r),u=(n.shadow.mapSize.x=a,n.shadow.mapSize.y=a,c||i);n.shadow.camera.scale.x=u,n.shadow.camera.scale.y=u,n.shadow.camera.scale.z=u,n.shadow.camera.near=h||t,n.shadow.camera.far=d||e,n.shadow.camera.updateProjectionMatrix(),null!=(p=n.cameraHelper)&&p.update()}))}}},269:(e,t,n)=>{n.d(t,{ZP:()=>E,RQ:()=>T});var r=n(1),i=n(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 n,r=l(e);if(n=t?(n=l(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===a(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var u=function(e){var t=r;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e);var n=o(r);function r(e,t){if(!(this instanceof r))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=n.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=r,(e=[{key:"updateMatrixWorld",value:function(){var e,t;this.scale.set(.5*this.light.width,.5*this.light.height,1),void 0!==this.color?(this.material.color.set(this.color),this.children[0].material.color.set(this.color)):(this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity),e=this.material.color,1<(t=Math.max(e.r,e.g,e.b))&&e.multiplyScalar(1/t),this.children[0].material.color.copy(this.material.color)),this.matrixWorld.extractRotation(this.light.matrixWorld).scale(this.scale).copyPosition(this.light.matrixWorld),this.children[0].matrixWorld.copy(this.matrixWorld)}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),r}(i.Line),c=n(247),h=n(736),d=n(398),p=n(729);t=n(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:n,name:r,visible:i,color:a}=e;return{type:t,intensity:n,name:r,visible:i,id:(0,p.Ki)(e),color:a.getHexString()}}parseJSON(e){var t=this.runScene.lightEx.get("AmbientLight");const[n]=t;var{type:e,intensity:r,name:i,visible:a,color:s,id:o}=e;return n.intensity=r,n.type=e,n.name=i,n.visible=a,n.color=new c.Z.Color("#"+s),(0,h.M)(n,"id",o),t}}m.snapshot={create:e=>d.LV.getDiff(f,e),set:e=>{var{map:e,light:t,runScene:n,data:r}=e;d.LV.set({def:f,data:r,runScene:n,map:e,target:t})}};var v=n(585);class g extends t.Z{get(){throw new Error("Method not implemented.")}static toJSON(e){const{type:t,intensity:n,name:r,visible:i,color:a,groundColor:s,position:o}=e;return{name:r,id:(0,p.Ki)(e),type:t,intensity:n,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[n]=t;var{type:e,intensity:r,name:i,visible:a,color:s,groundColor:o,id:l,position:u}=e;return n.type=e,n.intensity=r,n.name=i,n.visible=a,n.color=new c.Z.Color("#"+s),n.groundColor=new c.Z.Color("#"+o),n.position.set(u.x,u.y,u.z),(0,h.M)(n,"id",l),t}}class y extends t.Z{get(){throw new Error("Method not implemented.")}static toJSON(e){const{name:t,type:n,intensity:r,distance:i,decay:a,renderOrder: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:n,intensity:r,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[n]=t;var{name:e,type:r,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 n.intensity=i,n.type=r,n.name=e,n.visible=u,n.castShadow=d,n.distance=a,n.renderOrder=o,n.color=new c.Z.Color("#"+l),n.position.set(f.x,f.y,f.z),n.shadow.mapSize.x=p,n.shadow.mapSize.y=p,n.shadow.bias=g,n.decay=s,n.shadow.radius=y,n.shadow.camera.scale.x=v,n.shadow.camera.scale.y=v,n.shadow.camera.scale.z=v,n.shadow.camera.near=b,(0,h.M)(n,"id",m),n.shadow.camera.far=x,n.shadow.camera.updateProjectionMatrix(),t}}class b{constructor(e){this.runScene=e}static toJSON(e){const{type:t,intensity:n,name:r,visible:i,color:a,position:s}=e;return{name:r,type:t,intensity:n,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[n]=t;var{type:e,intensity:r,name:i,visible:a,color:s,position:o,id:l}=e;return n.type=e,(0,h.M)(n,"id",l),n.intensity=r,n.name=i,n.visible=a,n.color=new c.Z.Color("#"+s),n.position.set(o.x,o.y,o.z),t}}class x{constructor(e){this.runScene=e}static toJSON(e){const{name:t,type:n,color:r,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:n,intensity:s,name:t,visible:u,distance:i,angle:o,id:(0,p.Ki)(e),decay:a,penumbra:l,renderOrder:d,color:r.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[n]=t;var{name:e,type:r,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 n.intensity=o,n.type=r,n.name=e,n.visible=d,n.distance=a,n.decay=s,n.angle=l,n.penumbra=u,n.renderOrder=m,n.castShadow=p,n.color=new c.Z.Color("#"+i),n.position.set(g.x,g.y,g.z),n.shadow.mapSize.x=w,n.shadow.mapSize.y=w,n.shadow.camera.near=b,n.target.position.set(y.x,y.y,y.z),n.shadow.bias=f,n.shadow.normalBias=x,n.shadow.radius=S,(0,h.M)(n,"id",v),n.shadow.camera.updateProjectionMatrix(),t}}var w=n(749),S=n(735),A=n(510),M=n(169),B=n(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))),n={};t.map((e=>{var t=e.type,r=(0,p.Ki)(e),i=null==(i=null==(t=C[t].snapshot)?void 0:t.create)?void 0:i.call(t,e);i&&r&&(n[r]=i)})),e.data.set("light",n)},set:e=>{var t=e.snapshot.data.get("light");t&&(0,r.mapObj)(t,((t,n)=>{var r,i=((t=this.runScene.modelEx.getById(t))||{}).type;i&&null!=(r=null==(i=C[i].snapshot)?void 0:i.set)&&r.call(i,{data:n,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,r.getId)()},t).id;let n=new c.Z[e],i=[n];return n.position.y=10,n.name=e,n.userData.id=t,this.shadowList.includes(e)&&(n.castShadow=!0),this.setLight(n),i.push(...this.setLightHelper(n)),null!=(t=null==n?void 0:n.lightHelper)&&t.update(),i}setNull(e){e.userData.light&&this.setNull(e.userData.light),this.isLight(e)&&("DirectionalLight"===e.type?e.cameraHelper&&(e.cameraHelper.visible=!1):"SpotLight"===e.type&&(e.cameraHelper&&(e.cameraHelper.visible=!1),e.helper&&(e.helper.visible=!0)))}setSelect(e){e.userData.light&&this.setSelect(e.userData.light),this.isLight(e)&&("DirectionalLight"===e.type?e.cameraHelper&&(e.cameraHelper.visible=!0):"SpotLight"===e.type&&(e.cameraHelper&&(e.cameraHelper.visible=!0),e.helper&&(e.helper.visible=!0)))}update(e){var t;e.userData.isLightTarget&&e.userData.light&&(e=e.userData.light),this.isLight(e)&&("DirectionalLight"===e.type||"SpotLight"===e.type?(null!=(t=e.helper)&&t.update(),null!=(t=e.cameraHelper)&&t.update()):null!=(e=null==(t=e.helper)?void 0:t.update)&&e.call(t))}remove(e,t=!0){let n;return this.runScene.helperEx.unfocus(),n="DirectionalLight"===e.type||"SpotLight"===e.type?[e,e.cameraHelper,e.helper].map((t=>{if(t)return new 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&&n&&this.runScene.undoEx.addUndo(n),n}getLightHelper(e,t){this.runScene.uniqueEx.model.add(t);const n=(0,p.Ki)(t);let r,i=[];switch(e){case"RectAreaLight":r=new u(t,16773120);break;case"DirectionalLight":if(r=new c.Z.DirectionalLightHelper(t,1,16711680),t.children[0])t.target=t.children[0];else{let e=new c.Z.Object3D;(t.target=e).name="helperModel",e.position.y=-10,t.shadow.autoUpdate=!0,e.userData.isLightTarget=!0,(e.userData.light=t).add(e)}t.shadow.camera.layers.set(1),t.shadow.camera.far=1e5,t.shadowCameraLeft=-5,t.shadowCameraRight=5,t.shadowCameraTop=5,t.shadowCameraBottom=-5,t.shadow.camera.updateProjectionMatrix();const e=new c.Z.CameraHelper(t.shadow.camera);t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(e,!0,(e=>{e.userData.id=n,e.userData.unClick=!0})),e.userData.id=n,e.userData.unClick=!0,e.visible=!1,t.cameraHelper=e,i.push(e);break;case"PointLight":r=new c.Z.PointLightHelper(t,1,16711935);break;case"SpotLight":r=new c.Z.SpotLightHelper(t);let a=new c.Z.Object3D;(t.target=a).name="helperModel",a.userData.isLightTarget=!0,a.userData.light=t,a.position.y=-10,t.shadow.autoUpdate=!0,t.add(a);const s=new c.Z.CameraHelper(t.shadow.camera);t.shadow.camera.matrixWorldNeedsUpdate=!0,this.runScene.helperEx.setHelper(s,!0,(e=>{e.userData.id=n})),s.userData.id=n,s.visible=!1,t.cameraHelper=s,i.push(s);break;case"HemisphereLight":r=new c.Z.HemisphereLightHelper(t,1,16773135)}return r.name="helperModel",this.runScene.helperEx.setHelper(r,!0,(e=>{e.userData.id=n})),r.userData.id=n,(r.light=t).helper=r,this.update(t),i.push(r),i}setLightHelper(e){return"editor"===this.runScene.optionsEx.options.mode&&this.helperList.includes(e.type)?this.getLightHelper(e.type,e):[]}isUpdateHelper(e){return this.helperUpdateList.includes(e)}initLight(e){e.forEach((e=>this.setLightHelper(e)))}setNormal(e,t=0){var{model:e,info:n,val:r,cb:i}=e;return new A.Z({target:e,runScene:this.runScene,info:n,oldVal:e[n],newVal:r,cb:i}).execute()}setMultip(e,t,n=!0,r=!0){if(e instanceof Array)return i=e.map((e=>{var{model:e,typeList:r,newVal:i}=e;const a=new S.Z({target:e,typeList:r,newVal:i,cb:t});return n?a.execute():a})),r&&this.runScene.undoEx.addUndo(i),i;{var{model:i,typeList:e,newVal:a}=e;const s=new S.Z({target:i,typeList:e,newVal:a,cb:t});return r&&this.runScene.undoEx.addUndo(s),n?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,n)=>{n.d(t,{B:()=>Pe,Z:()=>De});var r=n(881),i=(t=n(300),n.n(t));function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}n(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 n,r="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB";function i(e,t,r,i,a,s){var o=n.exports.sbrk,l=r+3&-4,u=o(l*i),c=o(a.length),h=new Uint8Array(n.exports.memory.buffer);if(0==(h.set(a,c),e=e(u,r,i,c,a.length))&&s&&s(u,l,i),t.set(h.subarray(u,u+r*i)),o(u-o(0)),0!=e)throw new Error("Malformed buffer data: "+e)}WebAssembly.validate(e)&&(r="B9h9z9tFBBBFiI9gBB9gLaaaaaFa9gEaaaB9gFaFaEMcBBFBFFGGGEILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBOn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBNI9z9iqlBVc+N9IcIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMk8lLbaE97F9+FaL978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAeDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAeDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBReCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBH8ZCFD9tA8ZAPD9OD9hD9RH8ZDQBTFtGmEYIPLdKeOnHpAIAQJDBIBHyCFD9tAyAPD9OD9hD9RHyAIASJDBIBH8cCFD9tA8cAPD9OD9hD9RH8cDQBTFtGmEYIPLdKeOnH8dDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAeD9uHeDyBjGBAEAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeApA8dDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNiV8ZcpMyS8cQ8df8eb8fHdAyA8cDQNiV8ZcpMyS8cQ8df8eb8fH8ZDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/dLEK97FaF97GXGXAGCI9HQBAF9FQFCBRGEXABABDBBBHECiD+rFCiD+sFD/6FHIAECND+rFCiD+sFD/6FAID/gFAECTD+rFCiD+sFD/6FHLD/gFD/kFD/lFHKCBDtD+2FHOAICUUUU94DtHND9OD9RD/kFHI9DBB/+hDYAIAID/mFAKAKD/mFALAOALAND9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHLD/mF9DBBX9LDYHOD/kFCgFDtD9OAECUUU94DtD9OD9QAIALD/mFAOD/kFCND+rFCU/+EDtD9OD9QAKALD/mFAOD/kFCTD+rFCUU/8ODtD9OD9QDMBBABCTJRBAGCIJHGAF9JQBSGMMAF9FQBCBRGEXABCTJHVAVDBBBHECBDtHOCUU98D8cFCUU98D8cEHND9OABDBBBHKAEDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAKAEDQBFGENVcMTtmYi8ZpyHECTD+sFD/6FHID/gFAECTD+rFCTD+sFD/6FHLD/gFD/kFD/lFHE9DB/+g6DYALAEAOD+2FHOALCUUUU94DtHcD9OD9RD/kFHLALD/mFAEAED/mFAIAOAIAcD9OD9RD/kFHEAED/mFD/kFD/kFD/jFD/nFHID/mF9DBBX9LDYHOD/kFCTD+rFALAID/mFAOD/kFCggEDtD9OD9QHLAEAID/mFAOD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHEDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAKAND9OALAEDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM/hEIGaF97FaL978jUUUUBCTlREGXAF9FQBCBRIEXAEABDBBBHLABCTJHKDBBBHODQILKOSQfbPden8c8d8e8fHNCTD+sFHVCID+rFDMIBAB9DBBU8/DY9D/zI818/DYAVCEDtD9QD/6FD/nFHVALAODQBFGENVcMTtmYi8ZpyHLCTD+rFCTD+sFD/6FD/mFHOAOD/mFAVALCTD+sFD/6FD/mFHcAcD/mFAVANCTD+rFCTD+sFD/6FD/mFHNAND/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHVD/mF9DBBX9LDYHLD/kFCggEDtHMD9OAcAVD/mFALD/kFCTD+rFD9QHcANAVD/mFALD/kFCTD+rFAOAVD/mFALD/kFAMD9OD9QHVDQBFTtGEmYILPdKOenHLD8dBAEDBIBDyB+t+J83EBABCNJALD8dFAEDBIBDyF+t+J83EBAKAcAVDQNVi8ZcMpySQ8c8dfb8e8fHVD8dBAEDBIBDyG+t+J83EBABCiJAVD8dFAEDBIBDyE+t+J83EBABCAJRBAICIJHIAF9JQBMMM9jFF97GXAGCGrAF9sHG9FQBCBRFEXABABDBBBHECND+rFCND+sFD/6FAECiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBABCTJRBAFCIJHFAG9JQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",console.log("Warning: meshopt_decoder is using experimental SIMD support")),e=WebAssembly.instantiate(function(e){for(var n=new Uint8Array(e.length),r=0;r<e.length;++r){var i=e.charCodeAt(r);n[r]=96<i?i-71:64<i?i-65:47<i?i+4:46<i?63:62}var a=0;for(r=0;r<e.length;++r)n[a++]=n[r]<60?t[n[r]]:64*(n[r]-60)+n[++r];return n.buffer.slice(0,a)}(r),{}).then((function(e){(n=e.instance).exports.__wasm_call_ctors()}));var 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,r,a,o){i(n.exports.meshopt_decodeVertexBuffer,e,t,r,a,n.exports[s[o]])},decodeIndexBuffer:function(e,t,r,a){i(n.exports.meshopt_decodeIndexBuffer,e,t,r,a)},decodeIndexSequence:function(e,t,r,a){i(n.exports.meshopt_decodeIndexSequence,e,t,r,a)},decodeGltfBuffer:function(e,t,r,a,l,u){i(n.exports[o[l]],e,t,r,a,n.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 n,r=c(e);if(n=t?(n=c(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===o(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var h=new WeakMap,d=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e);var n=u(i);function i(e){if(this instanceof i)return(e=n.call(this,e)).decoderPath="",e.decoderConfig={},e.decoderBinary=null,e.decoderPending=null,e.workerLimit=4,e.workerPool=[],e.workerNextTaskID=1,e.workerSourceURL="",e.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},e.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"},e;throw new TypeError("Cannot call a class as a function")}return t=i,(e=[{key:"setDecoderPath",value:function(e){return this.decoderPath=e,this}},{key:"setDecoderConfig",value:function(e){return this.decoderConfig=e,this}},{key:"setWorkerLimit",value:function(e){return this.workerLimit=e,this}},{key:"load",value:function(e,t,n,i){var a=this,s=new r.FileLoader(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(e){var n={attributeIDs:a.defaultAttributeIDs,attributeTypes:a.defaultAttributeTypes,useUniqueIDs:!1};a.decodeGeometry(e,n).then(t).catch(i)}),n,i)}},{key:"decodeDracoFile",value:function(e,t,n,r){r={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!n},this.decodeGeometry(e,r).then(t)}},{key:"decodeGeometry",value:function(e,t){var n,r=this;for(n in t.attributeTypes){var i=t.attributeTypes[n];void 0!==i.BYTES_PER_ELEMENT&&(t.attributeTypes[n]=i.name)}var a,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(n){return a=n,new Promise((function(n,r){a._callbacks[o]={resolve:n,reject:r},a.postMessage({type:"decode",id:o,taskConfig:t,buffer:e},[e])}))})).then((function(e){return r._createGeometry(e.geometry)})),l.catch((function(){return!0})).then((function(){a&&o&&r._releaseTask(a,o)})),h.set(e,{key:s,promise:l}),l}},{key:"_createGeometry",value:function(e){var t=new r.BufferGeometry;e.index&&t.setIndex(new r.BufferAttribute(e.index.array,1));for(var n=0;n<e.attributes.length;n++){var i=(s=e.attributes[n]).name,a=s.array,s=s.itemSize;t.setAttribute(i,new r.BufferAttribute(a,s))}return t}},{key:"_loadLibrary",value:function(e,t){var n=new r.FileLoader(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((function(t,r){n.load(e,t,void 0,r)}))}},{key:"preload",value:function(){return this._initDecoder(),this}},{key:"_initDecoder",value:function(){var e=this;if(this.decoderPending)return this.decoderPending;var t="object"!==("undefined"==typeof WebAssembly?"undefined":o(WebAssembly))||"js"===this.decoderConfig.type,n=[];return t?n.push(this._loadLibrary("draco_decoder.js","text")):(n.push(this._loadLibrary("draco_wasm_wrapper.js","text")),n.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(n).then((function(n){var r=n[0];t||(e.decoderConfig.wasmBinary=n[1]),n=function(){var e,t;onmessage=function(n){var r=n.data;switch(r.type){case"init":e=r.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":var i=r.buffer,a=r.taskConfig;t.then((function(e){var t=new(e=e.draco).Decoder,n=new e.DecoderBuffer;n.Init(new Int8Array(i),i.byteLength);try{var s=function(e,t,n,r){var i,a=r.attributeIDs,s=r.attributeTypes,o=t.GetEncodedGeometryType(n);if(o===e.TRIANGULAR_MESH)i=new e.Mesh,g=t.DecodeBufferToMesh(n,i);else{if(o!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");i=new e.PointCloud,g=t.DecodeBufferToPointCloud(n,i)}if(!g.ok()||0===i.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+g.error_msg());var l,u,c,h,d,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(r.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=(n=e,g=t,b=4*(y=3*(o=i).num_faces()),x=n._malloc(b),g.GetTrianglesUInt32Array(o,b,x),g=new Uint32Array(n.HEAPF32.buffer,x,y).slice(),n._free(x),{array:g,itemSize:1})),e.destroy(i),w}(e,t,n,a),o=s.attributes.map((function(e){return e.array.buffer}));s.index&&o.push(s.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:s},o)}catch(e){console.error(e),self.postMessage({type:"error",id:r.id,error:e.message})}finally{e.destroy(n),e.destroy(t)}}))}}}.toString(),r=["/* draco decoder */",r,"","/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n"),e.workerSourceURL=URL.createObjectURL(new Blob([r]))})),this.decoderPending}},{key:"_getWorker",value:function(e,t){var n=this;return this._initDecoder().then((function(){n.workerPool.length<n.workerLimit?((r=new Worker(n.workerSourceURL))._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:n.decoderConfig}),r.onmessage=function(e){var t=e.data;switch(t.type){case"decode":r._callbacks[t.id].resolve(t);break;case"error":r._callbacks[t.id].reject(t);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+t.type+'"')}},n.workerPool.push(r)):n.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));var r,i=n.workerPool[n.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i}))}},{key:"_releaseTask",value:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}},{key:"debug",value:function(){console.log("Task load: ",this.workerPool.map((function(e){return e._taskLoad})))}},{key:"dispose",value:function(){for(var e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.Loader),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,n){return Object.defineProperty(e,"prototype",{writable:!1}),e}((function e(t,n,r){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var i=this,a=!1,s=0,o=0,l=void 0,u=[];this.onStart=void 0,this.onLoad=t,this.onProgress=n,this.onError=r,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,n=u.length;t<n;t+=2){var r=u[t],i=u[t+1];if(r.global&&(r.lastIndex=0),r.test(e))return i}return null}})));var m=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.manager=void 0!==t?t:f,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}var t,n;return t=e,(n=[{key:"load",value:function(){}},{key:"loadAsync",value:function(e,t){var n=this;return new Promise((function(r,i){n.load(e,r,t,i)}))}},{key:"parse",value:function(){}},{key:"setCrossOrigin",value:function(e){return this.crossOrigin=e,this}},{key:"setWithCredentials",value:function(e){return this.withCredentials=e,this}},{key:"setPath",value:function(e){return this.path=e,this}},{key:"setResourcePath",value:function(e){return this.resourcePath=e,this}},{key:"setRequestHeader",value:function(e){return this.requestHeader=e,this}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function v(e){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function y(e,t){return(y=Object.setPrototypeOf||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=r,t=m;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&y(e,t);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=b(e);if(n=t?(n=b(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===v(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(r);function r(e){if(this instanceof r)return e=n.call(this,e),"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),e.options={premultiplyAlpha:"none"},e;throw new TypeError("Cannot call a class as a function")}return e=r,(t=[{key:"setOptions",value:function(e){return this.options=e,this}},{key:"load",value:function(e,t,n,r,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var a=this,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 n=(r=a.options).textureQuality,r=r.reverseTexture,s=i.notCompress,o=i.size,l=0===e.size?new ImageData(1,1):e;t(o&&1!==n?(o=(t=i.size).w,t=t.h,s=s?1:n,createImageBitmap(l,Object.assign(a.options,{imageOrientation:r?"none":"flipY",resizeHeight:t*s,resizeWidth:o*s}))):createImageBitmap(l,Object.assign(a.options,{imageOrientation:r?"none":"flipY"})))})),Promise.resolve(e)])})).then((function(n){n=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],s=!0,o=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(a.push(r.value),2!==a.length);s=!0);}catch(e){o=!0,i=e}finally{try{s||null==n.return||n.return()}finally{if(o)throw i}}return a}}(e)||function(e,t){if(e){if("string"==typeof e)return g(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(e,2):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(n);var r=n[0];n=n[1],p.add(e,r),t&&t(r,n),a.manager.itemEnd(e)})).catch((function(t){r&&r(t),a.manager.itemError(e),a.manager.itemEnd(e)})),a.manager.itemStart(e)}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),r}(),w=(x.prototype.isImageBitmapLoader=!0,n(457));function S(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],s=!0,o=!1;try{for(n=n.call(e);!(s=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);s=!0);}catch(e){o=!0,i=e}finally{try{s||null==n.return||n.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 n,r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=B(e))||t&&e&&"number"==typeof e.length)return r&&(e=r),n=0,{s:t=function(){},n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.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 n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?C(e,t):void 0}}function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function 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,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=k(e)););return e}(e,t);if(r)return(r=Object.getOwnPropertyDescriptor(r,t)).get?r.get.call(arguments.length<3?e:n):r.value}).apply(this,arguments)}function _(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function D(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function P(e,t,n){return t&&D(e.prototype,t),n&&D(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function O(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&R(e,t)}function R(e,t){return(R=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function I(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=k(e);if(n=t?(n=k(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===E(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return L(r)}}function L(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function k(e){return(k=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var F=function(){O(t,r.Loader);var e=I(t);function t(n){return _(this,t),(n=e.call(this,n)).dracoLoader=null,n.ktx2Loader=null,n.meshoptDecoder=null,n.pluginCallbacks=[],n.register((function(e){return new z(e)})),n.register((function(e){return new W(e)})),n.register((function(e){return new X(e)})),n.register((function(e){return new H(e)})),n.register((function(e){return new V(e)})),n.register((function(e){return new J(e)})),n.register((function(e){return new K(e)})),n.register((function(e){return new Z(e)})),n.register((function(e){return new N(e)})),n.register((function(e){return new Q(e)})),n}return P(t,[{key:"load",value:function(e,t,n,i){function a(t){i?i(t):console.error(t),s.manager.itemError(e),s.manager.itemEnd(e)}var s=this,o=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:r.LoaderUtils.extractUrlBase(e),l=(this.manager.itemStart(e),new r.FileLoader(this.manager));l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,(function(n){try{s.parse(n,o,(function(n){t(n),s.manager.itemEnd(e)}),a)}catch(n){a(n)}}),n,a)}},{key:"setDRACOLoader",value:function(e){return this.dracoLoader=e,this}},{key:"setDDSLoader",value:function(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}},{key:"setKTX2Loader",value:function(e){return this.ktx2Loader=e,this}},{key:"setMeshoptDecoder",value:function(e){return this.meshoptDecoder=e,this}},{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,n,i,a){var s,o={},l={};if("string"==typeof e)s=e;else if(r.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=r.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 ne;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 re;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(n,i)}}},{key:"parseAsync",value:function(e,t){var n=this;return new Promise((function(r,i){n.parse(e,t,r,i)}))}}]),t}();function U(){var e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}var G={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"},N=function(){function e(t){_(this,e),this.parser=t,this.name=G.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}return P(e,[{key:"_markDefs",value:function(){for(var e=this.parser,t=this.parser.json.nodes||[],n=0,r=t.length;n<r;n++){var i=t[n];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}},{key:"_loadLight",value:function(e){var t=this.parser,n="light:"+e,i=t.cache.get(n);if(i)return i;var a,s=t.json,o=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e],l=new r.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 r.DirectionalLight(l)).target.position.set(0,0,-1),a.add(a.target);break;case"point":(a=new r.PointLight(l)).distance=u;break;case"spot":(a=new r.SpotLight(l)).distance=u,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(n,i),i}},{key:"createNodeAttachment",value:function(e){var t=this,n=this.parser,r=((e=n.json.nodes[e]).extensions&&e.extensions[this.name]||{}).light;return void 0===r?null:this._loadLight(r).then((function(e){return n._getNodeRef(t.cache,r,e)}))}}]),e}(),j=function(){function e(){_(this,e),this.name=G.KHR_MATERIALS_UNLIT}return P(e,[{key:"getMaterialType",value:function(){return r.MeshBasicMaterial}},{key:"extendParams",value:function(e,t,n){var i,a=[];return e.color=new r.Color(1,1,1),e.opacity=1,(t=t.pbrMetallicRoughness)&&(Array.isArray(t.baseColorFactor)&&(i=t.baseColorFactor,e.color.fromArray(i),e.opacity=i[3]),void 0!==t.baseColorTexture&&a.push(n.assignTexture(e,"map",t.baseColorTexture))),Promise.all(a)}}]),e}(),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]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser;if(!(e=n.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var i=[];return void 0!==(e=e.extensions[this.name]).clearcoatFactor&&(t.clearcoat=e.clearcoatFactor),void 0!==e.clearcoatTexture&&i.push(n.assignTexture(t,"clearcoatMap",e.clearcoatTexture)),void 0!==e.clearcoatRoughnessFactor&&(t.clearcoatRoughness=e.clearcoatRoughnessFactor),void 0!==e.clearcoatRoughnessTexture&&i.push(n.assignTexture(t,"clearcoatRoughnessMap",e.clearcoatRoughnessTexture)),void 0!==e.clearcoatNormalTexture&&(i.push(n.assignTexture(t,"clearcoatNormalMap",e.clearcoatNormalTexture)),void 0!==e.clearcoatNormalTexture.scale&&(n=e.clearcoatNormalTexture.scale,t.clearcoatNormalScale=new r.Vector2(n,n))),Promise.all(i)}}]),e}(),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]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser;if(!(e=n.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var i=[];return void 0!==(t.sheenColor=new r.Color(0,0,0),t.sheenRoughness=0,t.sheen=1,e=e.extensions[this.name]).sheenColorFactor&&t.sheenColor.fromArray(e.sheenColorFactor),void 0!==e.sheenRoughnessFactor&&(t.sheenRoughness=e.sheenRoughnessFactor),void 0!==e.sheenColorTexture&&i.push(n.assignTexture(t,"sheenColorMap",e.sheenColorTexture)),void 0!==e.sheenRoughnessTexture&&i.push(n.assignTexture(t,"sheenRoughnessMap",e.sheenRoughnessTexture)),Promise.all(i)}}]),e}(),V=function(){function e(t){_(this,e),this.parser=t,this.name=G.KHR_MATERIALS_TRANSMISSION}return P(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser;if(!(e=n.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var r=[];return void 0!==(e=e.extensions[this.name]).transmissionFactor&&(t.transmission=e.transmissionFactor),void 0!==e.transmissionTexture&&r.push(n.assignTexture(t,"transmissionMap",e.transmissionTexture)),Promise.all(r)}}]),e}(),J=function(){function e(t){_(this,e),this.parser=t,this.name=G.KHR_MATERIALS_VOLUME}return P(e,[{key:"getMaterialType",value:function(e){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){if(!(e=(i=this.parser).json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var n=[],i=(e=e.extensions[this.name],t.thickness=void 0!==e.thicknessFactor?e.thicknessFactor:0,void 0!==e.thicknessTexture&&n.push(i.assignTexture(t,"thicknessMap",e.thicknessTexture)),t.attenuationDistance=e.attenuationDistance||0,e.attenuationColor||[1,1,1]);return t.attenuationColor=new r.Color(i[0],i[1],i[2]),Promise.all(n)}}]),e}(),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]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){return(e=this.parser.json.materials[e]).extensions&&e.extensions[this.name]?(e=e.extensions[this.name],t.ior=void 0!==e.ior?e.ior:1.5,Promise.resolve()):Promise.resolve()}}]),e}(),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]?r.MeshPhysicalMaterial:null}},{key:"extendMaterialParams",value:function(e,t){var n=this.parser;if(!(e=n.json.materials[e]).extensions||!e.extensions[this.name])return Promise.resolve();var i=[],a=(e=e.extensions[this.name],t.specularIntensity=void 0!==e.specularFactor?e.specularFactor:1,void 0!==e.specularTexture&&i.push(n.assignTexture(t,"specularIntensityMap",e.specularTexture)),e.specularColorFactor||[1,1,1]);return t.specularColor=new r.Color(a[0],a[1],a[2]),void 0!==e.specularColorTexture&&i.push(n.assignTexture(t,"specularColorMap",e.specularColorTexture).then((function(e){e.encoding=r.sRGBEncoding}))),Promise.all(i)}}]),e}(),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,n=t.json;if(!(r=n.textures[e]).extensions||!r.extensions[this.name])return null;var r=r.extensions[this.name],i=t.options.ktx2Loader;if(i)return t.loadTextureImage(e,r.source,i);if(n.extensionsRequired&&0<=n.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}}]),e}(),X=function(){function e(t){_(this,e),this.parser=t,this.name=G.EXT_TEXTURE_WEBP,this.isSupported=null}return P(e,[{key:"loadTexture",value:function(e){var t=this.name,n=this.parser,r=n.json;if(!(i=r.textures[e]).extensions||!i.extensions[t])return null;var i=i.extensions[t],a=r.images[i.source],s=n.textureLoader;return a.uri&&null!==(i=n.options.manager.getHandler(a.uri))&&(s=i),this.detectSupport().then((function(i){if(i)return n.loadTextureImage(e,a,s);if(r.extensionsRequired&&0<=r.extensionsRequired.indexOf(t))throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)}))}},{key:"detectSupport",value:function(){return this.isSupported||(this.isSupported=new Promise((function(e){var t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}]),e}(),Q=function(){function e(t){_(this,e),this.name=G.EXT_MESHOPT_COMPRESSION,this.parser=t}return P(e,[{key:"loadBufferView",value:function(e){var t=this.parser.json;if((e=t.bufferViews[e]).extensions&&e.extensions[this.name]){var n=e.extensions[this.name],r=(e=this.parser.getDependency("buffer",n.buffer),this.parser.options.meshoptDecoder);if(r&&r.supported)return Promise.all([e,r.ready]).then((function(e){var t=n.byteOffset||0,i=n.byteLength||0,a=n.count,s=n.byteStride,o=new ArrayBuffer(a*s);return e=new Uint8Array(e[0],t,i),r.decodeGltfBuffer(new Uint8Array(o),a,s,e,n.mode,n.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 n=new DataView(t,0,12);if(this.header={magic:r.LoaderUtils.decodeText(new Uint8Array(t.slice(0,4))),version:n.getUint32(4,!0),length:n.getUint32(8,!0)},this.header.magic!==Y)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var i=this.header.length-12,a=new DataView(t,12),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=r.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,n){if(_(this,e),!n)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=G.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=n,this.dracoLoader.preload()}return P(e,[{key:"decodePrimitive",value:function(e,t){var n,r,i=this.json,a=this.dracoLoader,s=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,l={},u={},c={};for(n in o){var h=he[n]||n.toLowerCase();l[h]=o[n]}for(r in e.attributes){var d,p,f=he[r]||r.toLowerCase();void 0!==o[r]&&(d=i.accessors[e.attributes[r]],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 n in e.attributes){var r=e.attributes[n];void 0!==(n=u[n])&&(r.normalized=n)}t(e)}),l,c)}))}))}}]),e}(),ee=function(){function e(){_(this,e),this.name=G.KHR_TEXTURE_TRANSFORM}return P(e,[{key:"extendTexture",value:function(e,t){return void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),void 0===t.offset&&void 0===t.rotation&&void 0===t.scale||(e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}]),e}(),te=function(){O(t,r.MeshStandardMaterial);var e=I(t);function t(n){_(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 r.Color).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};return i._extraUniforms=c,i.onBeforeCompile=function(e){for(var t in c)e.uniforms[t]=c[t];e.fragmentShader=e.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>",a).replace("#include <metalnessmap_pars_fragment>",s).replace("#include <roughnessmap_fragment>",o).replace("#include <metalnessmap_fragment>",l).replace("#include <lights_physical_fragment>",u)},Object.defineProperties(L(i),{specular:{get:function(){return c.specular.value},set:function(e){c.specular.value=e}},specularMap:{get:function(){return c.specularMap.value},set:function(e){(c.specularMap.value=e)?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return c.glossiness.value},set:function(e){c.glossiness.value=e}},glossinessMap:{get:function(){return c.glossinessMap.value},set:function(e){(c.glossinessMap.value=e)?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete i.metalness,delete i.roughness,delete i.metalnessMap,delete i.roughnessMap,i.setValues(n),i}return P(t,[{key:"copy",value:function(e){return T(k(t.prototype),"copy",this).call(this,e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this}}]),t}(),ne=function(){function e(){_(this,e),this.name=G.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.specularGlossinessParams=["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"]}return P(e,[{key:"getMaterialType",value:function(){return te}},{key:"extendParams",value:function(e,t,n){t=t.extensions[this.name];var i,a=(e.color=new r.Color(1,1,1),e.opacity=1,[]);return Array.isArray(t.diffuseFactor)&&(i=t.diffuseFactor,e.color.fromArray(i),e.opacity=i[3]),void 0!==t.diffuseTexture&&a.push(n.assignTexture(e,"map",t.diffuseTexture)),e.emissive=new r.Color(0,0,0),e.glossiness=void 0!==t.glossinessFactor?t.glossinessFactor:1,e.specular=new r.Color(1,1,1),Array.isArray(t.specularFactor)&&e.specular.fromArray(t.specularFactor),void 0!==t.specularGlossinessTexture&&(i=t.specularGlossinessTexture,a.push(n.assignTexture(e,"glossinessMap",i)),a.push(n.assignTexture(e,"specularMap",i))),Promise.all(a)}},{key:"createMaterial",value:function(e){var t=new te(e);return t.fog=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,t.normalMapType=r.TangentSpaceNormalMap,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t}}]),e}(),re=P((function e(){_(this,e),this.name=G.KHR_MESH_QUANTIZATION})),ie=function(){O(t,r.Interpolant);var e=I(t);function t(n,r,i,a){return _(this,t),e.call(this,n,r,i,a)}return P(t,[{key:"copySampleValue_",value:function(e){for(var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r*3+r,a=0;a!==r;a++)t[a]=n[i+a];return t}}]),t}(),ae=(ie.prototype.beforeStart_=ie.prototype.copySampleValue_,ie.prototype.afterEnd_=ie.prototype.copySampleValue_,ie.prototype.interpolate_=function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=2*s,l=3*s,u=r-t,c=e*l,h=c-l,d=-2*(t=(n=(r=(n-t)/u)*r)*r)+3*n,p=t-n,f=1-d,m=p-n+r,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 r.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,n,r,i){return e=T(k(t.prototype),"interpolate_",this).call(this,e,n,r,i),ae.fromArray(e).normalize().toArray(e),e}}]),t}(),oe={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},le={9728:r.NearestFilter,9729:r.LinearFilter,9984:r.NearestMipmapNearestFilter,9985:r.LinearMipmapNearestFilter,9986:r.NearestMipmapLinearFilter,9987:r.LinearMipmapLinearFilter},ue={33071:r.ClampToEdgeWrapping,33648:r.MirroredRepeatWrapping,10497:r.RepeatWrapping},ce={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},he={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},de={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},pe={CUBICSPLINE:void 0,LINEAR:r.InterpolateLinear,STEP:r.InterpolateDiscrete};function fe(e,t,n){for(var r in n.extensions)void 0===e[r]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=n.extensions[r])}function me(e,t){void 0!==t.extras&&("object"===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="",n=Object.keys(e).sort(),r=0,i=n.length;r<i;r++)t+=n[r]+":"+e[n[r]]+";";return t}function ge(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}var ye=function(){function e(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};_(this,e),this.json=t,this.extensions={},this.plugins={},this.options=n,this.cache=new U,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={},"undefined"!=typeof createImageBitmap&&!1===/Firefox|^((?!chrome|android).)*safari/i.test(navigator.userAgent)?this.textureLoader=new x(this.options.manager):this.textureLoader=new r.TextureLoader(this.options.manager),this.options.myOptions.core.options.setTextureLoader(this.textureLoader),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new r.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}return P(e,[{key:"setExtensions",value:function(e){this.extensions=e}},{key:"setPlugins",value:function(e){this.plugins=e}},{key:"parse",value:function(e,t){var n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(M(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()})))).then((function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])})).then((function(t){var a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};fe(i,a,r),me(a,r),Promise.all(n._invokeAll((function(e){return e.afterRoot&&e.afterRoot(a)}))).then((function(){e(a)}))})).catch(t)}},{key:"_markDefs",value:function(){for(var e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[],r=0,i=t.length;r<i;r++)for(var a=t[r].joints,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&&(n[c.mesh].isSkinnedMesh=!0)),void 0!==c.camera&&this._addNodeRef(this.cameraCache,c.camera)}}},{key:"_addNodeRef",value:function(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}},{key:"_getNodeRef",value:function(e,t,n){var r=this;if(e.refs[t]<=1)return n;var i=n.clone();return function e(t,n){var i,a=r.associations.get(t),s=(null!=a&&r.associations.set(n,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],n.children[l])}}catch(e){s.e(e)}finally{s.f()}}(n,i),i.name+="_instance_"+e.uses[t]++,i}},{key:"_invokeOne",value:function(e){var t=Object.values(this.plugins);t.push(this);for(var n=0;n<t.length;n++){var r=e(t[n]);if(r)return r}return null}},{key:"_invokeAll",value:function(e){for(var t=Object.values(this.plugins),n=(t.unshift(this),[]),r=0;r<t.length;r++){var i=e(t[r]);i&&n.push(i)}return n}},{key:"getDependency",value:function(e,t){var n=e+":"+t,r=this.cache.get(n);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this.loadNode(t);break;case"mesh":r=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":r=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":r=this.loadSkin(t);break;case"animation":r=this.loadAnimation(t);break;case"camera":r=this.loadCamera(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(n,r)}return r}},{key:"getDependencies",value:function(e){var t,n,r=this.cache.get(e);return r||(n=(t=this).json[e+("mesh"===e?"es":"s")]||[],r=Promise.all(n.map((function(n,r){return t.getDependency(e,r)}))),this.cache.add(e,r)),r}},{key:"loadBuffer",value:function(e){var t=this.json.buffers[e],n=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[G.KHR_BINARY_GLTF].body);var i=this.options;return new Promise((function(e,a){n.load(r.LoaderUtils.resolveURL(t.uri,i.path),e,void 0,(function(){a(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))}},{key:"loadBufferView",value:function(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var n=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+n)}))}},{key:"loadAccessor",value:function(e){var t=this,n=this.json,i=this.json.accessors[e];return void 0===i.bufferView&&void 0===i.sparse?Promise.resolve(null):(e=[],void 0!==i.bufferView?e.push(this.getDependency("bufferView",i.bufferView)):e.push(null),void 0!==i.sparse&&(e.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),e.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(e).then((function(e){var a,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?n.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 r.InterleavedBuffer(a,h/u),t.cache.add(m,v)),new r.InterleavedBufferAttribute(v,o,c%h/u,d)):(a=null===s?new l(i.count*o):new l(s,c,i.count*o),new r.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 r.BufferAttribute(p.array.slice(),p.itemSize,p.normalized));for(var b=0,x=g.length;b<x;b++){var w=g[b];if(p.setX(w,y[b*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,n=this.options,r=t.textures[e].source,i=(t=t.images[r],this.textureLoader);return t.uri&&null!==(n=n.manager.getHandler(t.uri))&&(i=n),this.loadTextureImage(e,r,i)}},{key:"loadTextureImage",value:function(e,t,n){var i=this,a=this.json,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,n,e).then((function(t){t.flipY=!1,s.name&&(t.name=s.name);var n=(a.samplers||{})[s.sampler]||{};return t.magFilter=le[n.magFilter]||r.LinearFilter,t.minFilter=le[n.minFilter]||r.LinearMipmapLinearFilter,t.wrapS=ue[n.wrapS]||r.RepeatWrapping,t.wrapT=ue[n.wrapT]||r.RepeatWrapping,i.associations.set(t,{textures:e}),i.options.myOptions.core.loadTexture({texture:t,textureDef:s}),t})).catch((function(e){return null})),this.textureCache[o]=t)}},{key:"loadImageSource",value:function(e,t,n){var i=this.json,a=this.options,s=i.textures[n];if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((function(e){return e.clone()})).catch((function(e){throw e}));var 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 n=Promise.resolve(u).then((function(e){return new Promise((function(n,i){var o,l;!0===t.isImageBitmapLoader?(o=function(e,t){(e=new r.Texture(e)).needsUpdate=!0,n({texture:e,blob:t})},t.load(r.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 r.Texture(i));l||(t.clearRect(0,0,i.width,i.height),t.translate(0,i.height),t.scale(1,-1),t.drawImage(e,0,0,i.width,i.height)),n(a)})).catch(i))}))})).then((function(e){var n=(e=t.isImageBitmapLoader?e:{texture:e,blob:null}).texture;return e=e.blob,!0===t.isImageBitmapLoader&&(n.userData.url=u,n.userData.blob=e),n.url=u,n})).catch((function(e){throw console.log(e,"error"),console.error("THREE.GLTFLoader: Couldn't load texture",u),e})),this.sourceCache[e]=n}},{key:"assignTexture",value:function(e,t,n){var r=this;return this.getDependency("texture",n.index).then((function(i){var a,s;return void 0===n.texCoord||0==n.texCoord||"aoMap"===t&&1==n.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+n.texCoord+" for texture "+t+" not yet supported."),r.extensions[G.KHR_TEXTURE_TRANSFORM]&&(a=void 0!==n.extensions?n.extensions[G.KHR_TEXTURE_TRANSFORM]:void 0)&&(s=r.associations.get(i),i=r.extensions[G.KHR_TEXTURE_TRANSFORM].extendTexture(i,a),r.associations.set(i,s)),e[t]=i}))}},{key:"assignFinalMaterial",value:function(e){var t,n,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,(n=this.cache.get(t))||(n=new r.PointsMaterial,r.Material.prototype.copy.call(n,a),n.color.copy(a.color),n.map=a.map,n.sizeAttenuation=!1,this.cache.add(t,n)),a=n):e.isLine&&(t="LineBasicMaterial:"+a.uuid,(n=this.cache.get(t))||(n=new r.LineBasicMaterial,r.Material.prototype.copy.call(n,a),n.color.copy(a.color),this.cache.add(t,n)),a=n),(s||o||l)&&(t="ClonedMaterial:"+a.uuid+":",a.isGLTFSpecularGlossinessMaterial&&(t+="specular-glossiness:"),s&&(t+="derivative-tangents:"),o&&(t+="vertex-colors:"),l&&(t+="flat-shading:"),(n=this.cache.get(t))||(n=a.clone(),o&&(n.vertexColors=!0),l&&(n.flatShading=!0),s&&(n.normalScale&&(n.normalScale.y*=-1),n.clearcoatNormalScale&&(n.clearcoatNormalScale.y*=-1)),this.cache.add(t,n),this.associations.set(n,this.associations.get(a)))),a.aoMap&&void 0===i.attributes.uv2&&void 0!==i.attributes.uv&&i.setAttribute("uv2",i.attributes.uv),this.options.myOptions.core.loadMaterial({material:a,materialDef:a.userData,model:e}),e.material=a}},{key:"getMaterialType",value:function(){return r.MeshStandardMaterial}},{key:"loadMaterial",value:function(e){var t,n=this,i=this.json,a=this.extensions,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,n))):i[G.KHR_MATERIALS_UNLIT]?(u=a[G.KHR_MATERIALS_UNLIT],t=u.getMaterialType(),l.push(u.extendParams(o,s,n))):(i=s.pbrMetallicRoughness||{},o.color=new r.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(n.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(n.assignTexture(o,"metalnessMap",i.metallicRoughnessTexture)),l.push(n.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=r.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!==r.MeshBasicMaterial&&(l.push(n.assignTexture(o,"normalMap",s.normalTexture)),o.normalScale=new r.Vector2(1,1),void 0!==s.normalTexture.scale&&(i=s.normalTexture.scale,o.normalScale.set(i,i))),void 0!==s.occlusionTexture&&t!==r.MeshBasicMaterial&&(l.push(n.assignTexture(o,"aoMap",s.occlusionTexture)),void 0!==s.occlusionTexture.strength&&(o.aoMapIntensity=s.occlusionTexture.strength)),void 0!==s.emissiveFactor&&t!==r.MeshBasicMaterial&&(o.emissive=(new r.Color).fromArray(s.emissiveFactor)),void 0!==s.emissiveTexture&&t!==r.MeshBasicMaterial&&l.push(n.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=r.sRGBEncoding),i.emissiveMap&&(i.emissiveMap.encoding=r.sRGBEncoding),me(i,s),n.associations.set(i,{materials:e}),s.extensions&&fe(a,i,s),i}))}},{key:"createUniqueName",value:function(e){for(var t=r.PropertyBinding.sanitizeNodeName(e||""),n=t,i=1;this.nodeNamesUsed[n];++i)n=t+"_"+i;return this.nodeNamesUsed[n]=!0,n}},{key:"loadGeometries",value:function(e){for(var t=this,n=this.extensions,i=this.primitiveCache,a=[],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 n[G.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(n){return be(n,e,t)}))}(l):be(new r.BufferGeometry,l,t),i[u]={primitive:l,promise:c},a.push(c))}return Promise.all(a)}},{key:"loadMesh",value:function(e){for(var t=this,n=this.json,i=this.extensions,a=n.meshes[e],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 r.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:r.FrontSide})),c.DefaultMaterial):this.getDependency("material",s[l].material);o.push(c)}return o.push(t.loadGeometries(s)),Promise.all(o).then((function(n){for(var o=n.slice(0,n.length-1),l=n[n.length-1],u=[],c=0,h=l.length;c<h;c++){var d=l[c],p=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?r.SkinnedMesh:r.Mesh)(d,m)).isSkinnedMesh||f.geometry.attributes.skinWeight.normalized||f.normalizeSkinWeights(),5===p.mode?f.geometry=xe(f.geometry,r.TriangleStripDrawMode):6===p.mode&&(f.geometry=xe(f.geometry,r.TriangleFanDrawMode));else if(1===p.mode)f=new r.LineSegments(d,m);else if(3===p.mode)f=new r.Line(d,m);else if(2===p.mode)f=new r.LineLoop(d,m);else{if(0!==p.mode)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+p.mode);f=new r.Points(d,m)}if(0<Object.keys(f.geometry.morphAttributes).length){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 r.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,n=(e=this.json.cameras[e])[e.type];if(n)return"perspective"===e.type?t=new r.PerspectiveCamera(r.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===e.type&&(t=new r.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),e.name&&(t.name=this.createUniqueName(e.name)),me(t,e),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}},{key:"loadSkin",value:function(e){var t={joints:(e=this.json.skins[e]).joints};return void 0===e.inverseBindMatrices?Promise.resolve(t):this.getDependency("accessor",e.inverseBindMatrices).then((function(e){return t.inverseBindMatrices=e,t}))}},{key:"loadAnimation",value:function(e){for(var t=this.json.animations[e],n=[],i=[],a=[],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;n.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(n),Promise.all(i),Promise.all(a),Promise.all(s),Promise.all(o)]).then((function(n){for(var i=n[0],a=n[1],s=n[2],o=n[3],l=n[4],u=[],c=0,h=i.length;c<h;c++)!function(e){var t=i[e],n=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=r.NumberKeyframeTrack;break;case de.rotation:p=r.QuaternionKeyframeTrack;break;default:p=r.VectorKeyframeTrack}e=t.name||t.uuid;var f=void 0!==h.interpolation?pe[h.interpolation]:r.InterpolateLinear,m=[],v=(de[d.path]===de.weights?t.traverse((function(e){e.morphTargetInfluences&&m.push(e.name||e.uuid)})):m.push(e),c.array);if(c.normalized){for(var g=ge(v.constructor),y=new Float32Array(v.length),b=0,x=v.length;b<x;b++)y[b]=v[b]*g;v=y}for(var w=0,S=m.length;w<S;w++){var A=new p(m[w]+"."+de[d.path],n.array,v,f);"CUBICSPLINE"===h.interpolation&&(A.createInterpolant=function(e){return new(this instanceof r.QuaternionKeyframeTrack?se:ie)(this.times,this.values,this.getValueSize()/3,e)},A.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),u.push(A)}}}(c);return n=t.name||"animation_"+e,new r.AnimationClip(n,void 0,u)}))}},{key:"createNodeMesh",value:function(e){var t=this.json,n=this,r=t.nodes[e];return void 0===r.mesh?null:n.getDependency("mesh",r.mesh).then((function(e){return e=n._getNodeRef(n.meshCache,r.mesh,e),void 0!==r.weights&&e.traverse((function(e){if(e.isMesh)for(var t=0,n=r.weights.length;t<n;t++)e.morphTargetInfluences[t]=r.weights[t]})),e}))}},{key:"loadNode",value:function(e){var t,n=this.json,i=this.extensions,a=this,s=n.nodes[e],o=s.name?a.createUniqueName(s.name):"";return t=[],(n=a._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)})))&&t.push(n),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 n,l=!0===s.isBone?new r.Bone:1<t.length?new r.Group:1===t.length?t[0]:new r.Object3D;if(l!==t[0])for(var u=0,c=t.length;u<c;u++)l.add(t[u]);return s.name&&(l.userData.name=s.name,l.name=o),me(l,s),s.extensions&&fe(i,l,s),void 0!==s.matrix?((n=new r.Matrix4).fromArray(s.matrix),l.applyMatrix4(n)):(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,n=this.extensions,i=(e=this.json.scenes[e],this),a=new r.Group,s=(a.isLoadScene=!0,e.name&&(a.name=i.createUniqueName(e.name)),me(a,e),e.extensions&&fe(n,a,e),e.nodes||[]),o=[],l=0,u=s.length;l<u;l++)o.push(function e(t){var n=t.nodeId,i=t.parentObject,a=t.json,s=t.parser,o=t.idMap,l=t.children,u=a.nodes[n];return s.getDependency("node",n).then((function(e){return void 0===u.skin?e:s.getDependency("skin",u.skin).then((function(e){for(var n=[],r=0,i=(t=e).joints.length;r<i;r++)n.push(s.getDependency("node",t.joints[r]));return Promise.all(n)})).then((function(n){return e.traverse((function(e){if(e.isMesh){for(var i=[],a=[],s=0,o=n.length;s<o;s++){var l=n[s];l?(i.push(l),l=new r.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 r.Skeleton(i,a),e.matrixWorld)}})),e}));var t})).then((function(t){var r,c;i.isLoadScene&&null!=(r=a.asset.ex)&&r.type,o&&o.set(n,t),i.add(t);try{void 0!==l&&(null==l?void 0:l.length)===i.children.length&&(l[0],c=!0,l.forEach((function(e){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,n=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 r.Material||o instanceof r.Texture)&&n.set(o,l)}}catch(e){a.e(e)}finally{a.f()}return e.traverse((function(e){var t=i.associations.get(e);null!=t&&n.set(e,t)})),n}(a),a}))}}]),e}();function be(e,t,n){var i,a=t.attributes,s=[];for(i in a){var o=he[i]||i.toLowerCase();o in e.attributes||s.push(function(t,r){return n.getDependency("accessor",t).then((function(t){e.setAttribute(r,t)}))}(a[i],o))}void 0===t.indices||e.index||(l=n.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)})),s.push(l)),me(e,t);var l=e,u=t,c=n,h=u.attributes,d=new r.Box3;if(void 0!==h.POSITION){var p=(h=c.json.accessors[h.POSITION]).min,f=h.max;if(void 0===p||void 0===f)console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");else{d.set(new r.Vector3(p[0],p[1],p[2]),new r.Vector3(f[0],f[1],f[2])),h.normalized&&(p=ge(oe[h.componentType]),d.min.multiplyScalar(p),d.max.multiplyScalar(p));var m=u.targets;if(void 0!==m){for(var v=new r.Vector3,g=new r.Vector3,y=0,b=m.length;y<b;y++){var x,w,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 r.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 r=e,i=t.targets,a=n,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(r);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):r.attributes.position,d.push(g)),o&&(g=void 0!==y.NORMAL?a.getDependency("accessor",y.NORMAL):r.attributes.normal,p.push(g)),l&&(y=void 0!==y.COLOR_0?a.getDependency("accessor",y.COLOR_0):r.attributes.color,f.push(y))}return Promise.all([Promise.all(d),Promise.all(p),Promise.all(f)]).then((function(e){var t=e[0],n=e[1];return e=e[2],s&&(r.morphAttributes.position=t),o&&(r.morphAttributes.normal=n),l&&(r.morphAttributes.color=e),r.morphTargetsRelative=!0,r}))}))}function xe(e,t){var n=e.getIndex();if(null===n){var i=[],a=e.getAttribute("position");if(void 0===a)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var s=0;s<a.count;s++)i.push(s);e.setIndex(i),n=e.getIndex()}var o=n.count-2,l=[];if(t===r.TriangleFanDrawMode)for(var u=1;u<=o;u++)l.push(n.getX(0)),l.push(n.getX(u)),l.push(n.getX(u+1));else for(var c=0;c<o;c++)c%2==0?(l.push(n.getX(c)),l.push(n.getX(c+1)),l.push(n.getX(c+2))):(l.push(n.getX(c+2)),l.push(n.getX(c+1)),l.push(n.getX(c)));return l.length/3!=o&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles."),(t=e.clone()).setIndex(l),t}var we=n(794),Se=n(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 n,r;return this.loadConfig.triggerCb&&null!=(n=null==(r=this.runScene.cb.loaderer.gltf[e])?void 0:r.cb)&&n.call(r,t),null!=(r=null==(n=this.loadConfig.callBack)?void 0:n[e])&&r.call(n,t),this.runScene.exporter.gltf.module.loadCallback({type:e,json:this.json,data:t,config:this.loadConfig,core:this})}loadMaterial(e){this.callback("loadMaterial",e)}loadNode(e){if(1===(e=this.callback("loadNode",e)).length)return e[0]}}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,n,r){return new(n=n||Promise)((function(t,i){function a(e){try{o(r.next(e))}catch(e){i(e)}}function s(e){try{o(r.throw(e))}catch(e){i(e)}}function o(e){var r;e.done?t(e.value):((r=e.value)instanceof n?r:new n((function(e){e(r)}))).then(a,s)}o((r=r.apply(e,[])).next())}))}(this,0,void 0,(function*(){var n=yield i().get(e,{responseType:"arraybuffer",onDownloadProgress:e=>{var n,{total:e,loaded:r}=e;let i=r/e;1<(i=i<0?0:i)&&(i=1);var r=Number(i.toFixed(2));e=Math.floor(100*r),null!=(n=null==(r=null==t?void 0:t.callBack)?void 0:r.progress)&&n.call(r,e),this.runScene.optionsEx.log("下载场景进度:"+e,"detail"),null!=t&&t.triggerCb&&this.runScene.cb.loaderer.gltf.progress.cb(e)}}).then((e=>e.data)).catch((e=>{this.runScene.optionsEx.log("下载场景失败:",e)}));return n?this.parse(n,t):Promise.resolve()}))}parse(e,t){const n=(0,w.deepMergeObject)({cleanJSON:!0,triggerCb:!1,reverseTexture:!1,callBack:{mountModule:void 0,getJSON:void 0,beforeParse:void 0,afterParse:void 0,lazyLoadedTexture:void 0,loaded:void 0,loadMaterial:void 0,loadNode:void 0,modelLoaded:void 0,progress:void 0,getArrayBuffer:void 0,complete:void 0,loadedGltf:void 0,loadTexture:void 0},module:{light:!0,model:!0,camera:!0,controls:!0,tags:!0,objects:!0,timeline:!0,sceneConfig:!0}},t||{}),r=new Me(this.runScene,n);return r.callback("getArrayBuffer",e),new Promise((t=>{e instanceof ArrayBuffer&&this._gltf.parse(e,"",(e=>{r.callback("loadedGltf",e);try{this.afterParse(e.parser.options.myOptions,e,n)}catch(e){console.log(e,"e")}t(r.models)}),(e=>{console.log(e,"_a")}),{rootModel:this.runScene.assetsEx.get().scene,models:[],core:r,runScene:this.runScene,loadConfig:n})}))}afterParse(e,t,n){var r;const i=e.core;i.callback("afterParse",{options:e,json:t,loadConfig:n});var{cleanJSON:n,callBack:a}=n;if(!t.asset.ex){const{models:n,core:r}=e,i=this.runScene.sceneEx.cleanUnlessLevel(n[0]);r.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!=(r=null==a?void 0:a.getJSON)&&r.call(a,t),n&&this.disposeJSON(t)}disposeJSON(e){}}var Ce=n(736),Ee=n(110);class Te{constructor(e){this._objectLoader=new r.ObjectLoader,this.runScene=e,this._parser=new _e(e)}parse(e){return function(e,t,n,r){return new(n=n||Promise)((function(t,i){function a(e){try{o(r.next(e))}catch(e){i(e)}}function s(e){try{o(r.throw(e))}catch(e){i(e)}}function o(e){var r;e.done?t(e.value):((r=e.value)instanceof n?r:new n((function(e){e(r)}))).then(a,s)}o((r=r.apply(e,[])).next())}))}(this,0,void 0,(function*(){var t=yield this._objectLoader.parseAsync(JSON.parse(e));return this._parser.afterParse(this.runScene.sceneEx.cleanUnlessLevel(t))}))}}class _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 r.ImageBitmapLoader,this.object=new r.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 r.AnimationLoader}parse(e){return this.load.parse(e)}}},880:(e,t,n)=>{n.d(t,{Ws:()=>X,ZP:()=>Q,ee:()=>Y});var r,i,a,s,o=n(707),l=n(881),u=n(932),c=n(651),h=n(735),d=n(736);class p{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:n}=e;this.runScene.undoEx.addUndo(new h.Z({target:e,typeList:["uniforms",...t],newVal:n}).execute())}}(r=p).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],p.TextureNames=["sideWallTex","backWallTex","floorTex","ceilingTex"],p.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 n=new l.ShaderMaterial({uniforms:(0,c.d9)(f.uniforms),vertexShader:f.vertexShader,fragmentShader:f.fragmentShader});return r.tools.bind(n),n},parseData:e=>{const{texture:t,normal:n,material:i}=e,{data:a,load:s}=t,o=new l.ShaderMaterial({uniforms:(0,c.d9)(f.uniforms),vertexShader:f.vertexShader,fragmentShader:f.fragmentShader}),u=[];return s&&u.push(...a.map((e=>()=>{"ceilingTex"===e.type?o.uniforms.ceilingTex.value=e.texture||null:"floorTex"===e.type?o.uniforms.floorTex.value=e.texture||null:"sideWallTex"===e.type?o.uniforms.sideWallTex.value=e.texture||null:"backWallTex"===e.type&&(o.uniforms.backWallTex.value=e.texture||null)}))),Object.keys(n.uniforms).filter((e=>!p.TextureNames.includes(e))).map((e=>{var t=n.uniforms[e];o.uniforms[e].value="roomsXYZPropsW"===e||"positionOffsetRoomsXYZPropsW"===e||"roomColorTint"===e?new l.Vector4(t.x,t.y,t.z,t.w):t})),o.name=n.name,o.userData.id=i.userData.id,r.tools.bind(o),{material:o,setTextureFns:u}},toNormal:e=>{const t=(0,u.createDefMaterial)(),n=(t.userData=Object.assign({},t.userData),{}),i=e.uniforms,a=f.uniforms;return Object.keys(i).filter((e=>!p.TextureNames.includes(e))).map((e=>{var t,r,s,o,u,c,h=i[e].value,d=a[e].value;h instanceof l.Vector4?(({x:t,y:r,z:s}=h),({x:o,y:u,z:c}=d),t===o&&r===u&&s===c||(n[e]=h)):h!==d&&(n[e]=h)})),{material:t,normal:{type:r.tools.type,uniforms:n,name:e.name},textures:r.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const n=r.tools.create(t);return Object.keys(n).filter((e=>!p.IgnoredAttributes.includes(e))).map((t=>{n[t]=e[t]})),n},bind:e=>{(0,d.M)(e,"type",r.tools.type)},validType:e=>"FakeInterior"===e.userData.type};const f={uniforms:{roomIntensity:{value:1},roomColorTint:{value:new l.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 l.Vector4(.35,.65,.1,1)},positionOffsetRoomsXYZPropsW:{value:new l.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 m{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:n}=e;this.runScene.undoEx.addUndo(new h.Z({target:e,typeList:[...t],newVal:n}).execute())}}(i=m).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],m.TextureNames=["envMap","displacementMap"],m.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 n=new v(void 0,void 0,e);return n.insertFresnelShader(),i.tools.bind(n),(t=t||e.modelEx.select)&&(n.name=t.name),n},parseData:(e,t)=>{const{texture:n,normal:r,material:a}=e,{data:s,load:o}=n,l=(0,u.mergeMaterial)(a,new v(void 0,void 0,t)),c=[];return o&&c.push(...s.map((e=>()=>{l[e.type]=e.texture}))),Object.keys(r.uniforms).filter((e=>!m.TextureNames.includes(e))).map((e=>{l[e]=r.uniforms[e]})),l.insertFresnelShader(),l.name=r.name,l.userData.id=a.userData.id,i.tools.bind(l),{material:l,setTextureFns:c}},toNormal:e=>{const t=(0,u.mergeMaterial)(e,(0,u.createDefMaterial)()),n=(t.userData=Object.assign({},t.userData),t.name=e.name,{}),r=g.uniforms;return Object.keys(r).filter((e=>!m.TextureNames.includes(e))).map((t=>{var i=e[t],a=r[t].value;"fresnelBias"===t||"fresnelScale"===t||"fresnelPower"===t||"isSurge"===t?i.value!==a&&(n[t]=i):i!==a&&(n[t]=i)})),{material:t,normal:{type:i.tools.type,uniforms:n,name:e.name},textures:i.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const n=i.tools.create(t);return Object.keys(n).filter((e=>!m.IgnoredAttributes.includes(e))).map((t=>{n[t]=e[t]})),n},bind:e=>{(0,d.M)(e,"type",i.tools.type)},validType:e=>"Fresnel"===e.userData.type};class v extends l.MeshPhysicalMaterial{constructor(e,t,n){if(e?super(e):(super(),this.emissive=new l.Color(65535),this.envMap=null,this.displacementMap=null,this.metalness=0,this.roughness=0,this.ior=1.5,this.transmission=1,this.opacity=1,this.transparent=!0,this.thickness=0),this.runScene=n,this.isSpecialMaterial=!0,t?(this.fresnelBias=new l.Uniform(t.fresnelBias),this.fresnelScale=new l.Uniform(t.fresnelScale),this.fresnelPower=new l.Uniform(t.fresnelPower)):(this.fresnelBias=new l.Uniform(g.uniforms.fresnelBias.value),this.fresnelScale=new l.Uniform(g.uniforms.fresnelScale.value),this.fresnelPower=new l.Uniform(g.uniforms.fresnelPower.value)),this.clock=new l.Clock,this.isSurge=new l.Uniform(!1),this.deltaTime=new l.Uniform(0),!this.cubeCamera){const e=new l.WebGLCubeRenderTarget(2048);e.texture.mapping=l.CubeRefractionMapping,this.cubeCamera=new l.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 l.Uniform(!0),depthWrite:new l.Uniform(!0),isSurge:new l.Uniform(!1),deltaTime:new l.Uniform(0),fresnelBias:new l.Uniform(0),fresnelScale:new l.Uniform(1),fresnelPower:new l.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 y{constructor(e){this.runScene=e}undo(e){const{material:t,list:n,val:r}=e;this.runScene.undoEx.addUndo(new h.Z({target:t,typeList:[...n],newVal:r,cb:()=>{t.needsUpdate=!0}}).execute())}}(a=y).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],y.TextureNames=["alphaMap","bumpMap","displacementMap","map","normalMap","matcap"],y.tools={type:"Matcap",getTextures:e=>{const t=[];return y.TextureNames.forEach((n=>{e[n]&&t.push({type:n,texture:e[n]})})),t},create:(e,t)=>{const n=new l.MeshMatcapMaterial;return a.tools.bind(n),(t=t||e.modelEx.select)&&(n.name="Matcap-"+t.name),n},parseData:e=>{const{normal:t,texture:n,material:r}=e,{data:i,load:s}=n,o=(0,u.mergeMaterial)(r,new l.MeshMatcapMaterial),c=(delete o.emissive,[]);return s&&c.push(...i.map((e=>()=>{o[e.type]=e.texture}))),Object.keys(t.uniforms).filter((e=>!y.IgnoredAttributes.includes(e))).map((e=>{o[e]="normalScale"===e?new l.Vector2(t.uniforms[e].x,t.uniforms[e].y):t.uniforms[e]})),o.name=t.name,o.userData.id=r.userData.id,a.tools.bind(o),{material:o,setTextureFns:c}},toNormal:e=>{var t=a.tools.getTextures(e);const n=(0,u.mergeMaterial)(e,(0,u.createDefMaterial)()),r=(n.userData=Object.assign({},n.userData),n.name=e.name,{}),i=new l.MeshMatcapMaterial;return Object.keys(e).filter((e=>!y.TextureNames.includes(e))).filter((e=>!y.IgnoredAttributes.includes(e))).map((t=>{var n=e[t],a=i[t];"bumpScale"===t||"displacementScale"===t||"displacementBias"===t||"depthTest"===t||"depthWrite"===t||"transparent"===t||"opacity"===t?n!==a&&(r[t]=n):"normalScale"!==t||n.x===a.x&&n.y===a.y||(r[t]=n)})),{material:n,normal:{type:a.tools.type,uniforms:r,name:e.name},textures:t}},clone:(e,t)=>e,copy:(e,t)=>{const n=a.tools.create(t);return Object.keys(n).filter((e=>!y.IgnoredAttributes.includes(e))).map((t=>{n[t]=e[t]})),n},bind:e=>{(0,d.M)(e,"type",a.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 ",x="\n vec3 mod289(vec3 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n }\n \n vec4 mod289(vec4 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n }\n \n vec4 permute(vec4 x) {\n return mod289(((x*34.0)+1.0)*x);\n }\n \n vec4 taylorInvSqrt(vec4 r) {\n return 1.79284291400159 - 0.85373472095314 * r;\n }\n \n float 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 ",w={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 l.Matrix3,new l.Matrix3,new l.Matrix3,new l.Matrix3,new l.Matrix3,new l.Matrix3]},maskUvTransArray:{value:[new l.Matrix3,new l.Matrix3,new l.Matrix3,new l.Matrix3,new l.Matrix3]},diffuse:{value:new l.Color(16777215)},uvTransform:{value:new l.Matrix3},shadowShade:{value:.6}},vertex:"\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n #include <uv_vertex>\n #include <uv2_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n // vUv = (uvTransform * vec3(uv, 1.0)).xy;\n}\n ",fragment:"\nuniform vec3 diffuse;\nuniform float opacity;\n\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\n#define MAX_TEX 6\nuniform mat3 mapUvTransArray[MAX_TEX];\nuniform mat3 maskUvTransArray[MAX_TEX - 1];\nuniform sampler2D mapArray[MAX_TEX];\nuniform sampler2D maskArray[MAX_TEX - 1];\nuniform float shadowShade;\n\n// Insert Noise2D\nfloat sum(vec3 v) {return v.x + v.y + v.z;}\nvec3 textureNoTile(sampler2D tex, vec2 tUv, float offsetScale) {\n // cheap (cache friendly) lookup\n float k = noise2D(0.25 * tUv);\n\n float l = k * 8.0;\n float f = fract(l);\n float ia = floor(l);\n float ib = ia + 1.0;\n\n // can replace with any other hash\n vec2 offa = sin(vec2(3.0, 7.0) * ia);\n vec2 offb = sin(vec2(3.0, 7.0) * ib);\n\n vec2 duvdx = dFdx(tUv);\n vec2 duvdy = dFdy(tUv);\n vec3 cola = textureGrad(tex, tUv + offsetScale * offa, duvdx, duvdy).xyz;\n vec3 colb = textureGrad(tex, tUv + offsetScale * offb, duvdx, duvdy).xyz;\n\n return mix(cola, colb, smoothstep(0.2, 0.8, f - 0.1 * sum(cola-colb)));\n}\nvec4 texSampler(sampler2D tex, vec2 tUv, float offsetScale) {\n return vec4(textureNoTile(tex, tUv, offsetScale), 1.0);\n}\n\nvoid main() {\n #include <clipping_planes_fragment>\n vec4 diffuseColor = vec4(diffuse, opacity);\n #include <logdepthbuf_fragment>\n \n // Custom UV Start\n #if MAX_TEX > 0\n vec2 vCustomMapUv[MAX_TEX];\n for (int i = 0; i < MAX_TEX; i++) {\n vCustomMapUv[i] = (mapUvTransArray[i] * vec3(vUv, 1.0)).xy;\n }\n #endif\n #if MAX_TEX > 1\n vec2 vCustomMaskUv[MAX_TEX - 1];\n for (int i = 0; i < MAX_TEX - 1; i++) {\n vCustomMaskUv[i] = (maskUvTransArray[i] * vec3(vUv, 1.0)).xy;\n }\n #endif\n // Custom UV End\n \n // Custom Texture Start\n float offsetScale = 1.2;\n vec4 maskColor = vec4(1.0);\n vec4 textureColor = vec4(1.0);\n #if MAX_TEX > 0\n textureColor = texSampler(mapArray[0], vCustomMapUv[0], offsetScale);\n #endif\n #if MAX_TEX > 1\n maskColor = texture2D(maskArray[0], vCustomMaskUv[0]);\n textureColor = mix(textureColor, texSampler(mapArray[1], vCustomMapUv[1], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 2\n maskColor = texture2D(maskArray[1], vCustomMaskUv[1]);\n textureColor = mix(textureColor, texSampler(mapArray[2], vCustomMapUv[2], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 3\n maskColor = texture2D(maskArray[2], vCustomMaskUv[2]);\n textureColor = mix(textureColor, texSampler(mapArray[3], vCustomMapUv[3], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 4\n maskColor = texture2D(maskArray[3], vCustomMaskUv[3]);\n textureColor = mix(textureColor, texSampler(mapArray[4], vCustomMapUv[4], offsetScale), maskColor.r);\n #endif\n #if MAX_TEX > 5\n maskColor = texture2D(maskArray[4], vCustomMaskUv[4]);\n textureColor = mix(textureColor, texSampler(mapArray[5], vCustomMapUv[5], offsetScale), maskColor.r);\n #endif\n diffuseColor *= textureColor;\n // Custom Texture End\n \n // ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n // reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n // vec3 outgoingLight = reflectedLight.indirectDiffuse;\n vec3 outgoingLight = diffuseColor.rgb;\n #include <output_fragment>\n \n // gl_FragColor = vec4(diffuse, opacity * (1.0 - getShadowMask()));\n gl_FragColor.rgb *= vec3(getShadowMask() * (1.0 - shadowShade) + shadowShade);\n #include <tonemapping_fragment>\n #include <encodings_fragment>\n #include <fog_fragment>\n}\n "};class S{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:n}=e;this.runScene.undoEx.addUndo(new h.Z({target:e,typeList:["uniforms",...t],newVal:n}).execute())}insertShader(e){e&&(e.onBeforeCompile=t=>{t.defines=w.defines,this.mergeUniforms(e.uniforms,t.uniforms),t.vertexShader=w.vertex,t.fragmentShader=w.fragment,t.fragmentShader=t.fragmentShader.replace(/\/\/ Insert Noise2D/g,b)})}mergeUniforms(e,t){if(e&&t)for(const n in e)t[n]=e[n]}onTexRepeatChange(e,t,n){e&&0<=t&&(n?(n=e.uniforms.mapArray.value[t],e.uniforms.mapUvTransArray.value[t].identity(),e.uniforms.mapUvTransArray.value[t].scale(n.repeat.x,n.repeat.y)):(n=e.uniforms.maskArray.value[t],e.uniforms.maskUvTransArray.value[t].identity(),e.uniforms.maskUvTransArray.value[t].scale(n.repeat.x,n.repeat.y)))}}(s=S).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],S.TextureNames=["terrainMap0","terrainMap1","terrainMap2","terrainMap3","terrainMap4","terrainMap5","terrainMap6","terrainMap7","terrainMask0","terrainMask1","terrainMask2","terrainMask3","terrainMask4","terrainMask5","terrainMask6"],S.tools={type:"MixTexture",getTextures:e=>{const t=[];return S.TextureNames.forEach((n=>{var r=parseInt(n.slice(-1));n.startsWith("terrainMap")?e.uniforms.mapArray.value[r]&&t.push({type:n,texture:e.uniforms.mapArray.value[r]}):n.startsWith("terrainMask")&&e.uniforms.maskArray.value[r]&&t.push({type:n,texture:e.uniforms.maskArray.value[r]})})),t},create:(e,t)=>{const n=new l.ShadowMaterial({color:0,opacity:1});return n.uniforms=l.UniformsUtils.clone(w.uniforms),e.materialEx.def.map.MixTexture.insertShader(n),s.tools.bind(n),n},parseData:(e,t)=>{const{texture:n,normal:r,material:i}=e,{data:a,load:o}=n,u=new l.ShadowMaterial({color:0,opacity:1}),c=(u.uniforms=l.UniformsUtils.clone(w.uniforms),t.materialEx.def.map.MixTexture.insertShader(u),[]);return o&&c.push(...a.map((e=>()=>{var n=parseInt(e.type.slice(-1));e.type.startsWith("terrainMap")?(u.uniforms.mapArray.value[n]=e.texture,t.materialEx.def.map.MixTexture.onTexRepeatChange(u,n,!0)):e.type.startsWith("terrainMask")&&(u.uniforms.maskArray.value[n]=e.texture,t.materialEx.def.map.MixTexture.onTexRepeatChange(u,n,!1))}))),Object.keys(r.uniforms).filter((e=>!S.TextureNames.includes(e))).map((e=>{var t=r.uniforms[e];"diffuse"===e?u.uniforms[e].value=new l.Color(parseInt(t,16)):"uvTransform"!==e&&(u.uniforms[e].value=t)})),u.name=r.name,u.userData.id=i.userData.id,s.tools.bind(u),{material:u,setTextureFns:c}},toNormal:e=>{const t=(0,u.createDefMaterial)(),n=(t.userData=Object.assign(Object.assign({},t.userData),{normal:{type:s.tools.type,uniforms:{},name:e.name},textures:s.tools.getTextures(e)}),{}),r=e.uniforms,i=w.uniforms;return Object.keys(r).filter((e=>"mapArray"!==e&&"maskArray"!==e&&"mapUvTransArray"!==e&&"maskUvTransArray"!==e)).map((e=>{const t=r[e].value,a=i[e].value;"diffuse"===e?t.getHexString()!==a.getHexString()&&(n[e]=t.getHexString()):"uvTransform"!==e&&t!==a&&(n[e]=t)})),{material:t,normal:{type:s.tools.type,uniforms:n,name:e.name},textures:s.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const n=s.tools.create(t);return Object.keys(n).filter((e=>!S.IgnoredAttributes.includes(e))).map((t=>{n[t]=e[t]})),n},bind:e=>{(0,d.M)(e,"type",s.tools.type)},validType:e=>"MixTexture"===e.userData.type};var A,M=n(110);class B{constructor(e){this.runScene=e}undo(e){var{material:e,list:t,val:n}=e;this.runScene.undoEx.addUndo(new h.Z({target:e,typeList:[...t],newVal:n}).execute())}}(A=B).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],B.TextureNames=["alphaMap","aoMap","bumpMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap","clearcoatMap","clearcoatNormalMap","clearcoatRoughnessMap","sheenRoughnessMap","sheenColorMap","specularIntensityMap","specularColorMap","thicknessMap","transmissionMap"],B.tools={type:"Physical",getTextures:e=>{const t=[];return B.TextureNames.forEach((n=>{e[n]&&t.push({type:n,texture:e[n]})})),t},create:(e,t)=>{const n=new l.MeshPhysicalMaterial;return A.tools.bind(n),(t=t||e.modelEx.select)&&(n.name="MeshPhysicalMaterial-"+t.name),n},parseData:e=>{const{normal:t,texture:n,material:r}=e,{data:i,load:a}=n,s=(0,u.mergeMaterial)(r,new l.MeshPhysicalMaterial),o=[];return a&&o.push(...i.map((e=>()=>{s[e.type]=e.texture}))),Object.keys(t.uniforms).filter((e=>!B.IgnoredAttributes.includes(e))).map((e=>{var n=t.uniforms[e];s[e]="attenuationColor"===e||"sheenColor"===e||"specularColor"===e?new l.Color(n):"clearcoatNormalScale"===e?new l.Vector2(n.x,n.y):n})),s.name=t.name,s.userData.id=r.userData.id,A.tools.bind(s),{material:s,setTextureFns:o}},toNormal:e=>{const t=(0,u.mergeMaterial)(e,(0,u.createDefMaterial)()),n=(t.userData=Object.assign({},t.userData),t.name=e.name,{}),r=new l.MeshPhysicalMaterial;return Object.keys(e).filter((e=>!B.TextureNames.includes(e))).filter((e=>!B.IgnoredAttributes.includes(e))).filter((e=>void 0===t[e])).map((t=>{const i=e[t],a=r[t];"attenuationColor"===t||"sheenColor"===t||"specularColor"===t?i.getHexString()!==a.getHexString()&&(n[t]=i.getHexString()):"clearcoatNormalScale"===t?i.x===a.x&&i.y===a.y||(n[t]=i):i!==a&&(n[t]=i)})),{material:t,normal:{type:A.tools.type,uniforms:n,name:e.name},textures:A.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const n=A.tools.create(t);return Object.keys(n).filter((e=>!B.IgnoredAttributes.includes(e))).map((t=>{n[t]=e[t]})),n},bind:e=>{(0,d.M)(e,"type",A.tools.type)},validType:e=>"MeshPhysicalMaterial"===e.type};var C=n(1),E=n(180);const T={uniforms:{tDiffuse:new l.Uniform(null),h:new l.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}"},_={uniforms:{tDiffuse:new l.Uniform(null),v:new l.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 D;new l.Uniform(null),new l.Uniform(null),new l.Uniform(0),new l.Uniform(0),new l.Uniform(0),new l.Uniform(new l.Vector2),new l.Uniform(.1),new l.Uniform(1e3);class P{constructor(e){this.materials={},this.render=()=>{(0,C.mapObj)(this.materials,((e,t)=>{const{model:n,material:r}=t;r.update(n)}))},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 n=(0,C.getId)();t.userData.id=n,this.materials[n]=e}undo(e){var{material:e,list:t,val:n}=e;this.runScene.undoEx.addUndo(new h.Z({target:e,typeList:[...t],newVal:n}).execute())}dispose(){this.materials={}}}(D=P).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines"],P.TextureNames=["map","normalMap","roughnessMap","metalnessMap","tDiffuse","tDiffuseBlur"],P.tools={type:"Reflector",getTextures:e=>(0,u.getTexturesByMaterial)(e),create:(e,t)=>{const n=new O(void 0,void 0,e);return n.insertReflectorShader(),D.tools.bind(n),(t=t||e.modelEx.select)&&(n.name=t.name),e.materialEx.def.map.Reflector.bindData({model:t,material:n}),n},parseData:(e,t)=>{const{texture:n,normal:r,models:i,material:a}=e,{data:s,load:o}=n,c=(0,u.mergeMaterial)(a,new O(void 0,void 0,t)),h=[];return o&&h.push(...s.map((e=>()=>{c[e.type]=e.texture}))),Object.keys(r.uniforms).filter((e=>!P.TextureNames.includes(e))).map((e=>{c[e]="normalScale"===e?new l.Vector2(r.uniforms[e].x,r.uniforms[e].y):r.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=r.name,c.userData.id=a.userData.id,D.tools.bind(c),{material:c,setTextureFns:h}},toNormal:e=>{const t=(0,u.mergeMaterial)(e,(0,u.createDefMaterial)()),n=(t.userData=Object.assign({},t.userData),t.name=e.name,{}),r=R.uniforms;return Object.keys(r).filter((e=>!P.TextureNames.includes(e))).map((t=>{var i=e[t],a=r[t].value;"mirror"===t||"mixBlur"===t||"mixStrength"===t||"mixContrast"===t?i.value!==a&&(n[t]=i):i!==a&&(n[t]=i)})),t.normalScale&&(n.normalScale=t.normalScale),{material:t,normal:{type:D.tools.type,uniforms:n,name:e.name},textures:D.tools.getTextures(e)}},clone:(e,t)=>e,copy:(e,t)=>{const n=D.tools.create(t);return Object.keys(n).filter((e=>!P.IgnoredAttributes.includes(e))).map((t=>{n[t]=e[t]})),n},bind:e=>{(0,d.M)(e,"type",D.tools.type)},validType:e=>"Reflector"===e.userData.type};class O extends l.MeshStandardMaterial{constructor(e,t,n){e?super(e):(super(),this.opacity=R.uniforms.opacity.value,this.transparent=R.uniforms.transparent.value,this.roughness=R.uniforms.roughness.value,this.metalness=R.uniforms.metalness.value),this.runScene=n,this.isSpecialMaterial=!0,t?(this.resolution=t.resolution,this.blurSize=t.blurSize,this.mirror=new l.Uniform(t.mirror),this.mixBlur=new l.Uniform(t.mixBlur),this.mixStrength=new l.Uniform(t.mixStrength),this.mixContrast=new l.Uniform(t.mixContrast)):(this.resolution=R.uniforms.resolution.value,this.blurSize=R.uniforms.blurSize.value,this.mirror=new l.Uniform(R.uniforms.mirror.value),this.mixBlur=new l.Uniform(R.uniforms.mixBlur.value),this.mixStrength=new l.Uniform(R.uniforms.mixStrength.value),this.mixContrast=new l.Uniform(R.uniforms.mixContrast.value)),this.textureMatrix=new l.Uniform(new l.Matrix4),this.reflectorWorldPosition=new l.Vector3,this.cameraWorldPosition=new l.Vector3,this.rotationMatrix=new l.Matrix4,this.normal=new l.Vector3,this.view=new l.Vector3,this.lookAtPosition=new l.Vector3,this.target=new l.Vector3,this.tempQuaternion=new l.Vector4,this.virtualCamera=new l.PerspectiveCamera,this.reflectorPlane=new l.Plane,this.clipPlane=new l.Vector4,e={minFilter:l.LinearFilter,magFilter:l.LinearFilter,type:l.HalfFloatType,encoding:this.runScene.assetsEx.get().renderer.outputEncoding},this.glRT1=new l.WebGLRenderTarget(this.resolution,this.resolution,e),this.glRT2=new l.WebGLRenderTarget(this.resolution,this.resolution,e),this.tDiffuse=new l.Uniform(this.glRT1.texture),this.tDiffuseBlur=new l.Uniform(this.glRT2.texture),this.hBlurPass=new E.T(T),this.hBlurPass.uniforms.h.value=1/this.blurSize,this.hBlurPass.clear=!1,this.hBlurPass.renderToScreen=!1,this.hBlurPass.enabled=0<this.blurSize,this.hBlurPass.material.depthWrite=!1,this.vBlurPass=new E.T(_),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=R.vertexParas+""+e.vertexShader,e.vertexShader=e.vertexShader.replace("#include <project_vertex>",R.vertexShader),e.fragmentShader=R.fragmentParas+""+e.fragmentShader,e.fragmentShader=e.fragmentShader.replace("#include <emissivemap_fragment>",R.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 R={uniforms:{opacity:new l.Uniform(1),transparent:new l.Uniform(!1),roughness:new l.Uniform(1),metalness:new l.Uniform(.6),resolution:new l.Uniform(1024),blurSize:new l.Uniform(1024),mirror:new l.Uniform(0),mixBlur:new l.Uniform(10),mixStrength:new l.Uniform(2),mixContrast:new l.Uniform(1),depthTest:new l.Uniform(!0),depthWrite:new l.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 "},I="\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 ",L="\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 ";var k,F=n(398);const U={emissive:o.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 G{constructor(e){this.runScene=e}undo(e){const{material:t,list:n,val:r}=e;this.runScene.undoEx.addUndo(new h.Z({target:t,typeList:[...n],newVal:r,cb:()=>{t.needsUpdate=!0}}).execute())}}(k=G).IgnoredAttributes=["_listeners","version","userData","uuid","name","type","defines","onBeforeCompile"],G.TextureNames=["alphaMap","aoMap","displacementMap","emissiveMap","envMap","lightMap","map","metalnessMap","normalMap","roughnessMap"],G.tools={type:"TreeLeaf",getTextures:e=>{const t=[];return G.TextureNames.forEach((n=>{e[n]&&t.push({type:n,texture:e[n]})})),t},create:(e,t)=>{const n=new j(e);return k.tools.bind(n),(t=t||e.modelEx.select)&&(n.name=t.name,n.setSize(t),n.setWorldPos(t)),n},parseData:(e,t)=>{const{normal:n,texture:r,material:i,models:a}=e,{data:s,load:o}=(console.log(i,i.userData,"material,"),r),c=(0,u.mergeMaterial)(i,new j(t)),h=(c.setSize(a[0]),c.setWorldPos(a[0]),[]);return o&&h.push(...s.map((e=>()=>{c[e.type]=e.texture}))),Object.keys(n.uniforms).filter((e=>!G.IgnoredAttributes.includes(e))).map((e=>{var t=n.uniforms[e];"color"!==e&&"emissive"!==e&&("normalScale"===e?c[e]=new l.Vector2(t.x,t.y):"windForce"===e||"windSpeed"===e||"windWaveScale"===e||"colorLevel"===e||"colorFade"===e||"leavesCore"===e?c.uniforms[e]=new l.Uniform(t):"colorGradient"===e?c.uniforms[e]=new l.Uniform(new l.Color(parseInt(t,16))):c[e]=n.uniforms[e])})),c.name=n.name,c.userData.id=i.userData.id,k.tools.bind(c),{material:c,setTextureFns:h}},toNormal:(e,t)=>{var n=k.tools.getTextures(e);const r=(0,u.mergeMaterial)(e,(0,u.createDefMaterial)()),i=(r.name=e.name,{}),a=new j(t);return Object.keys(e).filter((e=>!G.TextureNames.includes(e))).filter((e=>!G.IgnoredAttributes.includes(e))).map((t=>{var n=e[t],r=a[t];"color"!==t&&"emissive"!==t&&("normalScale"===t?n.x===r.x&&n.y===r.y||(i[t]=n):"uniforms"===t?Object.keys(n).map((t=>{const n=e.uniforms[t].value,r=a.uniforms[t].value;"windForce"===t||"windSpeed"===t||"windWaveScale"===t||"colorLevel"===t||"colorFade"===t||"leavesCore"===t?n!==r&&(i[t]=n):"colorGradient"===t&&n.getHexString()!==r.getHexString()&&(i[t]=n.getHexString())})):n!==r&&(i[t]=n))})),{material:r,normal:{type:k.tools.type,uniforms:i,name:e.name},textures:n}},clone:(e,t)=>e,copy:(e,t)=>{const n=k.tools.create(t);return Object.keys(n).filter((e=>!G.IgnoredAttributes.includes(e))).map((t=>{n[t]=e[t]})),n},bind:e=>{(0,d.M)(e,"type",k.tools.type)},validType:e=>"TreeLeaf"===e.userData.type,snapshot:{getDiff:e=>F.LV.getDiff(U,e),set:e=>{const{map:t,material:n,runScene:r,data:i}=e;F.LV.set({def:U,data:i,runScene:r,map:t,target:n}),t.data.completedCbs.push((()=>{(0,u.updateMaterial)(n)}))}}};const N=new l.Clock;class j extends l.MeshStandardMaterial{constructor(e){super(),this.isSpecialMaterial=!0,this.uniforms={time:new l.Uniform(0),windForce:new l.Uniform(.3),windSpeed:new l.Uniform(.5),windWaveScale:new l.Uniform(.25),colorGradient:new l.Uniform(new l.Color(65280)),colorLevel:new l.Uniform(-.5),colorFade:new l.Uniform(-.25),leavesCore:new l.Uniform(.3),leavesSize:new l.Uniform(new l.Vector3),leavesPos:new l.Uniform(new l.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=I,e.fragmentShader=L,e.vertexShader=e.vertexShader.replace(/\/\/ Insert Noise3D/g,x)}}update(){this.uniforms.time.value=N.getElapsedTime()}setSize(e){var t=new l.Vector3;e.getWorldScale(t),t=new l.Vector3,(new l.Box3).setFromObject(e).getSize(t),this.uniforms.leavesSize.value=t}setWorldPos(e){var t=new l.Vector3;e.getWorldPosition(t),this.uniforms.leavesPos.value=t}}var z,H=n(263);const V={color:o.Gf.color,opacity:o.Gf.opacity};class J{constructor(e){this.runScene=e}}(z=J).tools={type:"LineBasicMaterial",bind(e){(0,d.M)(e,"type","LineBasicMaterial")},create:()=>{var e=new l.LineBasicMaterial;return z.tools.bind(e),e},parseData:e=>{const{texture:t,normal:n,core:r,material:i}=e,{data:a,load:s}=t,o=[];return s&&o.push(...H.F6.filter(a.map((e=>{const{type:t,texture:n}=e;if(n)return()=>{r.runScene.uniqueEx.texture.addMaterial(n,{material:i,type:t})}})))),r.runScene.materialEx.parseNromals(n,i),z.tools.bind(i),{material:i,setTextureFns:o}},toNormal:e=>({material:e.clone(),normal:{type:z.tools.type},textures:[]}),clone:(e,t)=>e,copy:e=>e.clone(),getTextures:()=>[],snapshot:{getDiff:e=>F.LV.getDiff(V,e),set:e=>{const{map:t,material:n,runScene:r,data:i}=e;F.LV.set({def:V,data:i,runScene:r,map:t,target:n}),t.data.completedCbs.push((()=>{(0,u.updateMaterial)(n)}))}},validType:e=>e.type===z.tools.type};var K,Z=n(729);class W{constructor(e){this.runScene=e}}(K=W).tools={type:"MyPointsMaterial",bind(e){(0,d.M)(e,"type","MyPointsMaterial")},getTextures:e=>["map","alphaMap"].map((t=>{var n=e[t];if(n)return{type:t,texture:n}})).filter((e=>e)),create:(e,t)=>(t=t.modelEx.def.vertices.rain.createMaterial(e),K.tools.bind(t),t),parseData:(e,t)=>{var{texture:e,material:n,normal:r}=e;const{data:i,load:a}=e,s=[];var{name:e,size:r}=r;const o=W.tools.create({size:r},t);return(0,Z.x)(o,(0,Z.Ki)(n)),e&&(o.name=e),a&&s.push(...i.map((e=>{const{type:t,texture:n}=e;return()=>{o[t]=n,(0,u.updateMaterial)(o)}}))),{material:o,setTextureFns:s}},toNormal:e=>{const t=(0,u.createDefMaterial)();var n={type:W.tools.type,name:e.name,size:e.size};return t.map=e.map,t.userData=Object.assign({},t.userData),{normal:n,textures:W.tools.getTextures(e),material:t}},clone:e=>e,copy:e=>{const t=e.clone();return t.userData.type=W.tools.type,t}};const X={SpriteMaterial:M.Z,FakeInterior:p,Fresnel:m,Matcap:y,MixTexture:S,Physical:B,Reflector:P,TreeLeaf:G,BasicMaterial:o.ZP,LineBasicMaterial:J,MyPointsMaterial:W};class Q{constructor(e){this.runScene=e,this.map={SpriteMaterial:new M.Z(e),FakeInterior:new p(e),Fresnel:new m(e),Matcap:new y(e),MixTexture:new S(e),Physical:new B(e),Reflector:new P(e),TreeLeaf:new G(e),BasicMaterial:new o.ZP(e)}}static create(e,t){return X[e].tools.create(t)}static copy(e,t,n){return X[e].tools.copy(t,n)}static clone(e,t){return X[e].tools.clone(t)}static toNromal(e,t,n){return X[e].tools.toNormal(t,n)}static parseData(e,t,n){var r=t.material;let i=e;return X.LineBasicMaterial.tools.validType(r)&&(i=X.LineBasicMaterial.tools.type),X[i].tools.parseData(t,n)}static bind(e){e.material&&("MeshStandardMaterial"===e.material.type?o.ZP.tools.bind(e):"SpriteMaterial"===e.material.type&&M.Z.tools.bind(e))}static getTextures(e){var t=Y(e);if(t)return X[t].tools.getTextures(e);throw TypeError("该材质没有类型")}static parseNode(e){e.material&&(e=e.material,(0,u.isBaseMaterial)(e)&&o.ZP.tools.bind(e),e.isSpriteMaterial&&M.Z.tools.bind(e))}static validType(e,t){return!X[e].tools.validType||X[e].tools.validType(t)}}Q.snapshot={getDiff:e=>{var t=Y(e);if(X[t])return X[t].tools.snapshot.getDiff(e);throw TypeError("该材质没有类型")},set:e=>{var t=e.material;if(t=Y(t),X[t])return X[t].tools.snapshot.set(e);throw TypeError("该材质没有类型")}};const Y=e=>{var t=e.userData.type;if(t)return Q.validType(t,e)?t:void 0}},932:(e,t,n)=>{n.r(t),n.d(t,{SpecialMaterial:()=>I,createDefMaterial:()=>w,defAllMaterialMap:()=>b,defBaseMaterialMap:()=>y,default:()=>x,disposeMaterial:()=>A,getBaseTextures:()=>C,getMaterialType:()=>L,getTextures:()=>B,getTexturesByMaterial:()=>M,initMaterial:()=>T,isBaseMaterial:()=>R,isColor:()=>_,isMaterial:()=>P,materialIgnore:()=>k,mergeMaterial:()=>S,setDefMaterialForSameGeo:()=>O,setMaterialTexture:()=>E,updateMaterial:()=>D});var r=n(1),i=n(881),a=n(330),s=n(794),o=n(736),l=n(625),u=n(24),c=n(510),h=n(729),d=n(723),p=n(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.data=this.getData()},this.load=e=>{e=e.data;var{materialDef:e,material:t,model:n}=e;T(t),this.data.materialIns[e.id]||(this.data.materialIns[e.id]={material:t,models:[]}),this.data.materialIns[e.id].models.push(n)},this.done=e=>{const{json:t,core:n}=e;var{materialMap:e,textureMap:r}=(null==(e=t.asset)?void 0:e.ex)||{};this.processTextureMap(r||{}),this.processMaterialMap(e||{},t),this.processClonedTextures(),this.pending.push(this.loadTextures(n)),n.pending.push(Promise.all(this.pending))},this.parser=null,this.loadTexture=e=>{e=e.data;const{textureDef:t,texture:n}=e;var{md5:e,format:r,size:i,uvScript:a,unDelAble:s,id:u,cloneSourceId:c,minFilter:h}=t;n.userData.md5=e,r&&(n.format=r,n.userData.format=r),a&&(n.userData.uvScript=a),c&&((0,l.setTextureCloneId)(n,c),this.clonedTextures.push(n)),"nearest"===h&&((0,l.setTextureMinFilter)(n,"nearest"),(0,o.M)(n,"minFilter",h)),s&&l.unDelAbleTexture.set(n,s),n.userData.id=u,n.userData.size=i,this.data.textureIns[t.id]=this.runScene.textureEx.getSameTexture(e,n)||n},this.processTextureMap=(()=>{const e=e=>{const{target:t,data:n}=e;var r;n&&(({x:e,y:r}="object"==typeof n?n:{x:n,y:n}),t.x=e,t.y=r)};return t=>{(0,r.mapObj)(t,((t,n)=>{var{format:n,center:r,rotation:i,offset:a,repeat:s}=n;const o=this.data.textureIns[t];o&&(o.format=n,e({target:o.repeat,data:s}),e({target:o.center,data:r}),e({target:o.offset,data:a}),i&&(o.rotation=i),this.runScene.textureEx.initTextureAndAddtoAll(o))}))}})(),this.processMaterialMap=(()=>{const e=e=>{const{textures:t,normal:n,models:i,material:a}=e;e=(0,r.mapObj)(t,((e,t)=>({type:e,texture:this.data.textureIns[t]})));const{material:s,setTextureFns:o}=this.runScene.materialEx.parseData(n.type,{normal:n,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,n)=>{(0,r.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=n.asset)?void 0:t.ex)?void 0:i.type)&&n.asset.ex.sceneEx.materialId===a.userData.id&&(0,r.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=(n,r,i)=>{const a=this.lazyLoadFns[n];if(!a)return r(0),e(i);a(),setTimeout((()=>t(++n,r,i)),this.runScene.optionsEx.options.texture.lazyLoad.intervalTime)};return e=>new Promise((n=>{this.runScene.optionsEx.options.texture.lazyLoad.open?t(0,n,e):(n(0),this.lazyLoadFns.map((e=>e())))}))})(),this.afterParse=e=>{const{data:t,core:n,json:r}=e;if("material"===(null==(e=null==(e=r.asset)?void 0:e.ex)?void 0:e.type)){e=t.options.models;const[r]=e,i=[];r.material?(this.runScene.materialEx.add(r.material),i.push(r.material)):r.children.map((e=>{e.material&&(i.push(e.material),this.runScene.materialEx.add(e.material))})),n.models.push(...i)}},this.runScene=e}getData(){return{materialMap:{},textureMap:{},materialIns:{},textureIns:{}}}getMap(){return new 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,n,r){return new(n=n||Promise)((function(t,i){function a(e){try{o(r.next(e))}catch(e){i(e)}}function s(e){try{o(r.throw(e))}catch(e){i(e)}}function o(e){var r;e.done?t(e.value):((r=e.value)instanceof n?r:new n((function(e){e(r)}))).then(a,s)}o((r=r.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))}))}}var m=n(880);t=n(110);class v{constructor(e){this.getDiff=()=>{let e={};return this.runScene.uniqueEx.material.getAll("values").map((t=>{t=t.material;var n=(0,m.ee)(t);n&&m.Ws[n].tools.snapshot&&(n=(0,h.Ki)(t))&&(e[n]=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,r.mapObj)(t,((t,n)=>{(t=this.runScene.uniqueEx.material.get(t))&&m.ZP.snapshot.set({material:t,data:n,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,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.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,!0)}add(e,t,n){k.is(e)||this.runScene.uniqueEx.material.add(e,t,n)}setEnvStrength(e,t,n=!1){void 0===e.envMapIntensity||e.envMapIntensity===t||!n&&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,r.mapObj)(this.runScene.uniqueEx.material.map,((e,t)=>t.material))}copy(e){var t=L(e);if(t){const n=m.ZP.copy(t,e,this.runScene);return n.userData.id=(0,r.getId)(),n}}clone(e){var t=L(e);if(t){const n=m.ZP.clone(t,e);return n.userData.id=(0,r.getId)(),n}}setNormals(e,t=!0){const{info:n,newVal:r,materials:i,oldval:a,cb:s}=e;let o=r;return o.isVector2&&(o=o.clone()),e=i.map((e=>new u.Z({info:n,target:e,newVal:o,oldVal:a||e[n],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:n,newVal:r,materials:i,oldVal:a}=e;r instanceof File&&(e.newVal=yield this.runScene.textureEx.parse(r)),"envMap"===n&&(0,l.setTextureMapping)(e.newVal);var s=i.map((t=>new u.Z({info:n,target:t,newVal:e.newVal,oldVal:a||t[n],runScene:this.runScene}).execute()));return t&&this.runScene.undoEx.addUndo(s),i[0][n]}))}setTexture(e,t=!0){return g(this,void 0,void 0,(function*(){var{info:n,newVal:r,target:i}=e,r=(r instanceof File&&(e.newVal=yield this.runScene.textureEx.parse(r)),"envMap"===n&&(0,l.setTextureMapping)(e.newVal),new u.Z(Object.assign(Object.assign({},e),{oldVal:i[n],runScene:this.runScene})).execute());return t&&this.runScene.undoEx.addUndo(r),e.newVal}))}resetMaterial(e,t,n){const{addUndo:r,includeChild:i}=n=(0,d.Gm)({addUndo:!0,includeChild:!1},n);if(e&&t){const n=new Set;((0,d.lG)(e,"array")?e:[e]).map((e=>{i?e.traverse((e=>{R(e.material)&&n.add(e)})):e.material&&n.add(e)}));const a=[];n.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),r&&this.runScene.undoEx.addUndo(a)}}toNromal(e){var t=L(e);if(t){const n=m.ZP.toNromal(t,e,this.runScene);return n.material.userData=Object.assign(Object.assign({},n.material.userData),e.userData),n}}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;if("BasicMaterial"!==(null==(t=e.userData)?void 0:t.type))return{};const n={};return(0,r.mapObj)(y,((t,r)=>{const i=e[t];if("object"==typeof i)for(const e in i)if(i[e]!==r[e])return void(n[t]=i.clone());i!==r&&(n[t]=i)})),n}parseNromals(e,t){(0,r.mapObj)(e,((e,n)=>{var r,i,a,s,o;void 0!==y[e]&&("object"==typeof n?(({x:a,y:s,z:o}=n),null!=(i=null==(r=t[e])?void 0:r.set)&&i.call(r,a,s,o)):t[e]=n)}))}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,r.getId)(),p.ZP.tools.bind(t),t},S=(e,t)=>(b.map((n=>{const r=e[n];"object"==typeof r&&(t[n]=r.clone()),t[n]=r})),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:n,texture:r}=e;"envMap"===n&&(0,l.setTextureMapping)(r),t[n]=r,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},L=e=>{var t;return(null==(t=null==e?void 0:e.userData)?void 0:t.type)||(null==e?void 0:e.type)},k={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,n)=>{n.d(t,{ZP:()=>g,Gf:()=>v});var r=n(881),i=n(330),a=n(263),s=n(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=n(398),m=n(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))}},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 r.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 n=this.defVal[t],i=e[t];if(n instanceof r.Color){if(n.getHexString()!==i.getHexString())return!1}else if("object"==typeof n){if(i.x!==n.x)return!1}else if(i!==n)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 r.MeshStandardMaterial;return p.tools.bind(e),e},parseData:e=>{const{texture:t,normal:n,core:r,material:i}=e,{data:s,load:o}=t,l=[];return o&&l.push(...a.F6.filter(s.map((e=>{const{type:t,texture:n}=e;if(n)return()=>{r.runScene.uniqueEx.texture.addMaterial(n,{material:i,type:t}),(0,m.setMaterialTexture)({material:i,type:t,texture:n})}})))),r.runScene.materialEx.parseNromals(n,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:n,runScene:r,data:i}=e;f.LV.set({def:v,data:i,runScene:r,map:t,target:n}),t.data.completedCbs.push((()=>{(0,m.updateMaterial)(n)}))}},validType:e=>"MeshStandardMaterial"===e.type},g.defVal={color:new r.Color(16777215),emissive:new r.Color(0),roughness:1,metalness:0,lightMapIntensity:1,aoMapIntensity:1,emissiveIntensity:1,bumpScale:1,normalScale:new r.Vector2(1,1),displacementScale:1,envMapIntensity:1,wireframe:!1,transparent:!1,depthTest:!0,depthWrite:!0,opacity:1,fog:!0}},110:(e,t,n)=>{n.d(t,{Z:()=>h});var r,i=n(881),a=n(749),s=n(736),o=n(398),l=n(729),u=n(932);const c={color:(t=n(707)).Gf.color,map:t.Gf.map,opacity:t.Gf.opacity};class h{constructor(e){this.runScene=e}}(r=h).tools={type:"SpriteMaterial",bind(e){(0,s.M)(e,"type","SpriteMaterial")},getTextures:e=>["map","alphaMap"].map((t=>{var n=e[t];if(n)return{type:t,texture:n}})).filter((e=>e)),create:()=>{var e=new i.SpriteMaterial;return r.tools.bind(e),e},parseData:(e,t)=>{var{texture:e,material:n,normal:r}=e;const{data:i,load:a}=e,s=[],o=(0,u.mergeMaterial)(n,h.tools.create(t));(0,l.x)(o,(0,l.Ki)(n));var{depthWrite:e,depthTest:t,name:n,fog:r}=r;return!1===r&&(o.fog=!1),void 0!==e&&(o.depthWrite=e),void 0!==t&&(o.depthTest=t),n&&(o.name=n),a&&s.push(...i.map((e=>{const{type:t,texture:n}=e;return()=>{o[t]=n}}))),{material:o,setTextureFns:s}},toNormal:e=>{const t=(0,u.mergeMaterial)(e,(0,u.createDefMaterial)());var n=Object.assign({},t.userData);const r={type:h.tools.type,name:e.name};return e.fog||(r.fog=!1),e.depthWrite!==u.defBaseMaterialMap.depthWrite&&(r.depthWrite=e.depthWrite),e.depthTest!==u.defBaseMaterialMap.depthTest&&(r.depthTest=e.depthTest),t.userData=n,{normal:r,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:n,runScene:r,data:i}=e;o.LV.set({def:c,data:i,runScene:r,map:t,target:n}),t.data.completedCbs.push((()=>{(0,u.updateMaterial)(n)}))}}},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 n=(0,a.createDefModel)("Sprite");var r=e.userData.layers;return(0,a.setLayers)(n,r),n.userData=Object.assign(Object.assign({},t),n.userData),h.modelTools.merge(e,n),n.material=e.material,n},type:"MySpriteMaterial"}},801:(e,t,n)=>{n.d(t,{Ju:()=>a,t9:()=>i,zf:()=>s});var r=n(736);const i={isDynamic:()=>{}},a={isDeleted(e,t=!1){var n;return!!e&&(!(null==(n=null==e?void 0:e.userData)||!n.isDeleted)||!!t&&a.isDeleted(e.parent,t))},setDeleted(e,t){e.userData&&(t?(0,r.M)(e,"isDeleted",!0):null!=(t=null==e?void 0:e.userData)&&delete t.isDeleted)}},s={setLock(e){(0,r.M)(e,"lock",!0)},reLock(e){delete e.userData.lock},isLock(e,t=!1){if(!e||"Scene"===e.type)return!1;var n=e.userData.lock;return t?!!n||s.isLock(e.parent,t):void 0!==n&&n}}},749:(e,t,n)=>{n.r(t),n.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:()=>re,isHelper:()=>K,isSprite:()=>ne,lockModel:()=>F.zf,mergeModel:()=>H,normalModel:()=>se,selectableModel:()=>ae,setClonedModel:()=>$,setDynamicModel:()=>Q,setHelper:()=>J,setLayers:()=>Z,tempModel:()=>ce,uselessGroup:()=>le,withAnima:()=>V}),t=n(356);var r=n.n(t),i=n(1),a=n(881);function s(e){for(var t,n,r,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((n=void 0===n?o.itemSize:n)!==o.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if((r=void 0===r?o.normalized:r)!==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,n,r)}var o=n(230);const l=["Group","Box","Circle","Cylinder","Dodecahedron","Icosahedron","Lathe","Octahedron","Plane","Ring","Sphere","Sprite","Tetrahedron","Torus","TorusKnot","Tube","Reflector","VerticesRain"];var u=n(794),c=n(272),h=n(247),d=n(269),p=n(880),f=n(932),m=n(736);class v extends n(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=n(735),y=n(510);class b extends n(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=n(169),S=n(380),A=n(729),M=n(868);class B{constructor(e){this.definfo={speed:1,size:10,length:2e3},this.map=new u.Z,this.update=()=>{const e=this.runScene.assetsEx.get().camera;this.map.map(((t,n)=>{const{model:r,length:i,speed:a,del:s}=n;if(!s){r.position.set(e.position.x,e.position.y,e.position.z);for(let e=0;e<i;e++)r.geometry.attributes.position.setY(e,r.geometry.attributes.position.getY(e)-a),0<=a?r.geometry.attributes.position.getY(e)<=-1e3&&r.geometry.attributes.position.setY(e,1e3):1e3<=r.geometry.attributes.position.getY(e)&&r.geometry.attributes.position.setY(e,-1e3),r.geometry.attributes.position.needsUpdate=!0}}))},this.tools={type:"VerticesRain",merge:function(e,t){},toNormal:function(e){const t=N("Box");var n=(0,A.Ki)(e),r=this.map.get(n);if(t.material.map=e.material.map,n&&r)return t.userData.normal=Object.assign({type:this.tools.type},r),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()}))}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 n=new M.Sf.Points(this.createGeo(t),this.createMaterial(e));return n.name="雨雪",n.renderOrder=1,t=(0,i.getId)(),(0,m.M)(n,"id",t),this.bindMaterial(n.material),(0,m.M)(n,"type",this.tools.type),(0,m.M)(n,"normal",{type:this.tools.type}),this.map.set(t,{model:n,length:e.length,size:e.size,speed:e.speed,del:!1}),n}createGeo(e){let t=[];const n=new a.BufferGeometry;for(let n=0;n<e;n++){var r=2e3*Math.random()-1e3,i=2e3*Math.random()-1e3,s=2e3*Math.random()-1e3;t.push(r,i,s)}return n.setAttribute("position",new a.Float32BufferAttribute(t,3)),n}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:n}=e;(e=(0,A.Ki)(e))&&this.set(e,t,n)}set(e,t,n){const r=this.map.get(e);if(r){const{model:e,size:a}=r;switch(t){case"show":e.visible=n;break;case"length":e.geometry=this.createGeo(n),r[t]=n;break;case"size":var i=e.material;e.material=this.createMaterial({map:e.material.map,size:n}),this.bindMaterial(e.material,(0,A.Ki)(i)),r[t]=n;break;case"speed":r[t]=n;break;case"texture":i=e.material,e.material=this.createMaterial({map:n,size:a}),this.bindMaterial(e.material,(0,A.Ki)(i))}}}}B.modelTools={type:"VerticesRain",parseData:function(e,t,n){const r=n.modelEx.def.create(B.modelTools.type,t);return r.material=e.material,r.material.userData.id=t.materialId,r},toNormal:(e,t,n)=>{const r=N("Box");var i=(0,A.Ki)(e);if(t=t.modelEx.def.vertices.rain.map.get(i),r.material=e.material,!i||!t)throw TypeError("缺少属性");var{length:i,size:t,speed:a}=t;return r.userData.normal={type:B.modelTools.type,length:i,size:t,speed:a,materialId:(0,A.Ki)(e.material)},r}};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 n;return"VerticesRain"===e?n=this.vertices.rain.create(t):l.includes(e)&&(n=r().model.getModelByType(e,t)),p.ZP.parseNode(n),n}}var T=n(457);class _{constructor(e){this.runScene=e}init(){this.bindEvent()}bindEvent(){}}var D=n(143),P=n(110);class O{constructor(e){this.data=this.getData(),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:n}=e;(0,i.mapObj)(this.runScene.modelEx.defNodeMap,((e,r)=>{var i=n[e];null!=i&&(t[e]=i)})),n.wireframe&&(t.material.wireframe=!0)},this.load=e=>{var{data:e,core:t}=e;return this.loadNodeDef(e),this.loadExtras(e,t),e.node},this.done=()=>{this.removeHelperModel()},this.afterParse=e=>{const{config:t,data:n,json:r,core:i}=e;if("model"===(null==(e=null==(e=r.asset)?void 0:e.ex)?void 0:e.type)){if(null==(e=t.module)||!e.model)return[];let r=["glb_model"===(e=(e=n.options).models[0]).name&&(null==e?void 0:e.children[0])||e];var[e]=r;le.is(e)&&(r=[...e.children]),i.models.push(...r),this.mergeClone()}},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})}loadExtras(e,t){let{node:n,nodeDef:r}=e;if(r.extras){const{layers:o,normal:l,local:u,cloneId:c,id:h,animations:d,isDynamic:p}=r.extras;var i,a=Y(n,!0);if("running"!==this.runScene.optionsEx.options.mode||a||null!=(s=this.runScene.optionsEx.options.renderConfig)&&s.matrixAutoUpdate||(n.matrixAutoUpdate=!1),d&&(n.animations=D.B.parse(d)),p&&(n.userData.isDynamic=!0),!c||a||(this.data.instancedMap[c]||(this.data.instancedMap[c]=new Set),this.data.instancedMap[c].add(n)),u&&([s,a,i]=u.split(","),n.position.set(s,a,i)),o&&(n.layers.enable(1),this.runScene.cb.model.setLayers.cb({model:n,val:1})),r.extras.isHelper&&this.data.helperModels.push(n),l){const t=this.nodeType[null==l?void 0:l.type];e.node=t.modelTools.parseData(n,l,this.runScene)}h&&this.data.map.set(h,e.node);var s=null==(i=null==(a=null==(s=e.node)?void 0:s.material)?void 0:a.userData)?void 0:i.id;if(s){const n=t.module.get("material").data.materialIns[s];n&&n.models.push(e.node)}}}removeHelperModel(){this.data.helperModels.map((e=>{var t;return null==(t=e.parent)?void 0:t.remove(e)}))}mergeClone(){var e;this.runScene.optionsEx.options.instanceClone&&"running"===this.runScene.optionsEx.options.mode&&(this.runScene.assetsEx.scene.updateMatrixWorld(),e=this.data.instancedMap,(0,i.mapObj)(e,((e,t)=>{var n,r=this.runScene.uniqueEx.model.map[e];t.size<2||!r||!r.geometry||Y(r,!0)||(n=z(r,[...t]),this.runScene.modelEx.add(n,void 0,{isClone:!1,select:!1,addUndo:!1}),te(r)&&this.runScene.modelEx.setGlow(n,!0),this.runScene.modelEx.remove(r,!1),t.forEach((e=>this.runScene.modelEx.remove(e,!1))),t.clear(),delete this.data.instancedMap[e])}))),this.data.instancedMap={}}mergeGeometry(){}}var R=n(228),I=n(398);const L={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 k{constructor(e){this.create=e=>{e.data.set("model",this.getDiff())},this.set=e=>{var t=e.snapshot.data.get("model");if(t){const n=e.data.completedCbs;this.runScene.pp.clearAllOutlineObj(),(0,i.mapObj)(t,((t,r)=>{const i=this.runScene.uniqueEx.model.get(t);i&&(I.LV.set({def:L,runScene:this.runScene,data:r,target:i,map:e}),void 0!==r.visible&&r.visible&&(i.visible=r.visible),n.push((()=>{Z(i,r.isGLow?1:0),r.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 n=(0,A.Ki)(t);n&&(e[n]=I.LV.getDiff(L,t),te(t)&&(e[n].isGLow=!0),(0,R.S)(t)&&(e[n].isOutline=!0))}))})),e}getData(){}}var F=n(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,n,r)=>{var{addUndo:i,isClone:a,select:s,addToTree:o}=(0,T.mergeObject)({addUndo:!0,isClone:!1,select:!1,addToTree:!0},r);return t instanceof Array?t.map((e=>this.add(e,n,r))):(e(t,a),this.setGeometryMap(t),this.setCloneMap(t),o=new v({model:t,parent:n||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,n=!0)=>{if(e.lightEx.isLight(t))return e.lightEx.clone(t);var r,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,n=new Map,r=e.clone();return function e(t,n,r){r(t,n);for(var i=0;i<t.children.length;i++)e(t.children[i],n.children[i],r)}(e,r,(function(e,r){t.set(r,e),n.set(e,r)})),r.traverse((function(e){var r,i;e.isSkinnedMesh&&(i=(r=t.get(e)).skeleton.bones,e.skeleton=r.skeleton.clone(),e.bindMatrix.copy(r.bindMatrix),e.skeleton.bones=i.map((function(e){return n.get(e)})),e.bind(e.skeleton,e.bindMatrix))})),r}(t):t.clone(),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)&&(r=p.ZP.clone((0,p.ee)(a),a))&&r.uuid!==a.uuid&&(e.materialEx.resetMaterial(u,r,{addUndo:!0}),e.materialEx.add(r,t,a));{var u={newModel:s,newModelMap:l,animaMap:o};const{animaMap:t,newModelMap:n}=u;(0,i.mapObj)(t,((t,r)=>{const a=n[t],s={};a&&(a.animations=[...r.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,n)=>{var r=a.getObjectByName(t);if(r){(0,m.M)(r,"id",(0,i.getId)());const a=e.uniqueEx.model.parseName(r);n.map((e=>{e.name=a+e.name.slice(t.length)}))}})))}))}return n&&e.uniqueEx.model.add(s,{hasReset:!0}),s})(e),this.runScene.cb.clean.add("EngineModel",this.clean),this.export=new _(e),this.import=new O(e),this.snapsot=new k(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.import.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:n,uv:r}=e.attributes,{normal:t,position:i,uv:a}=t.attributes;return e.array.length===t.array.length&&n.array.length===i.array.length&&r.array.length===a.array.length&&(e=(0,T.sameArr)([...e.array],[...t.array],20),t=(0,T.sameArr)([...n.array],[...i.array],20),n=(0,T.sameArr)([...r.array],[...a.array],20),e&&t&&n)}getClonedIdFromModel(e){if(e.geometry){for(const e of this.clonedMap){const[n,r]=e;if(0!==r.size){var t=r.values()[0];if(!t)return;const e=this.runScene.uniqueEx.model.get(t);if(!e||!e.geometry)return;if(this.isSameGeo(e.geometry,e.geometry))return n}}this.clonedMap.map(((e,t)=>{t.size}))}}setCloneMap(e){if((0,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 n=this.clonedMap.get(t);n&&0!==n.size&&(e.userData.id=t,n.map((t=>{if(t=this.runScene.modelEx.getById(t)){var{position:n,rotation:r,scale:i,name:a,parent:s}=t;this.remove(t,!1);const o=this.runScene.modelEx.clone(e);o.userData.id=(0,A.Ki)(t),o.position.copy(n),o.rotation.copy(r),o.scale.copy(i),o.name=a,this.add(o,s,{addUndo:!1,isClone:!0,select:!1})}})))}replaceGeometry(e,t){t=t.uuid;const n=this.geometryMap.get(t);n&&0!==n.size&&(n.forEach((t=>{const n=this.runScene.uniqueEx.model.get(t);n&&(n.geometry=e,n.updateMatrix())})),this.geometryMap.delete(t),this.geometryMap.set(e.uuid,n))}setSelectByModel(e,t){this.runScene.optionsEx.log([e,"选中的模型",(0,A.Ki)(e)],"detail");var{isDomTreeActive:t,isClone:n}=t||{};if(this.runScene.events.key.ctrl&&!n)this.runScene.multipSelector.add(e);else{if(this.runScene.multipSelector.isEmpty()||this.runScene.multipSelector.setEmpty(),this._selectModel){if(this._selectModel===e)return void(this.runScene.helperEx.focusModelId||this.runScene.helperEx.focus(e));this.runScene.lightEx.setNull(this._selectModel),this.runScene.cb.model.unFocus.cb(this._selectModel)}e&&(this.runScene.cb.model.focus.cb({model:e,status:!0,domActive:!t}),this.runScene.materialEx.setSelect(e.material),this.runScene.cb.model.setSelect.cb(e),(this._selectModel=e).isCamera||(this.runScene.helperEx.focus(e),this.runScene.lightEx.setSelect(e)))}}setSelectById(e){(e=this.runScene.uniqueEx.model.get(e))&&this.setSelectByModel(e)}remove(e,t=!0){let n=[];Array.isArray(e)?n.push(...e):n.push(e),e=n.map((e=>new w.Z({runScene:this.runScene,model:e,parent:e.parent||this.runScene.sceneEx.get()}).execute())),t&&this.runScene.undoEx.addUndo(e)}isNavieV3(e,t=0){var{x:e,y:n,z:r}=e;return e+n+r===t}isNavieV2(e,t=0){var{x:e,y:n}=e;return e===t&&n===t}isUnless(e){return!e.material&&this.isNavieV3(e.position)&&this.isNavieV3(e.rotation)&&this.isNavieV3(e.scale,3)&&0===e.children.length}isUnlessLevel(e){return this.isNavieV3(e.position)&&this.isNavieV3(e.rotation)&&this.isNavieV3(e.scale,3)&&1===e.children.length&&!V(e)}create(){var e=r().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,n=!0){if(t=new x({oldParent:e.parent,newParent:t,target:e,runScene:this.runScene}).execute(),!n)return t;this.runScene.undoEx.addUndo(t)}_setV3(e){const{model:t,info:n,newV3:r}=e;if(Array.isArray(t))return t.map((e=>{e[n].set(r.x,r.y,r.z),e.updateMatrix()}));t[n].set(r.x,r.y,r.z),t.updateMatrix()}update(e){if(Array.isArray(e))return e.map((e=>e.updateMatrix()));e.updateMatrix()}setV3(e,t=!0,n=!0){let{model:r,info:i,newV3: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=r instanceof Array?r.map((e=>new S.Z({target:e,info:i,runScene:this.runScene,oldV3:o||e[i].clone(),newV3:s}).execute(n))):new S.Z({target:r,info:i,oldV3:o||r[i].clone(),newV3:s,runScene:this.runScene}).execute(n);t&&this.runScene.undoEx.addUndo(c)}setNormal(e,t=!0){const{model:n,oldVal:r,info:i,val:a,executeCb:s}=e;return e=n instanceof Array?n.map((e=>new y.Z({target:e,info:i,runScene:this.runScene,oldVal:r||n[i],newVal:a,executeCb:s}).execute())):new y.Z({target:n,info:i,runScene:this.runScene,oldVal:r||n[i],newVal:a,executeCb:s}).execute(),t&&this.runScene.undoEx.addUndo(e),e}setMaterial(e,t,n=!0){var r=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,n&&this.runScene.undoEx.addUndo(r)}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 n=this.getIndexByModel(e);if(t=this.getIndexByModel(t),-1!==n&&-1!==t){const r=Math.max(n,t),i=n===r?t:n;return e.parent.children.map(((e,t)=>t>i&&t<r&&e)).filter((e=>e))}}}setMultip(e){var{model:e,typeList:t,newVal:n}=e;this.runScene.undoEx.addUndo(new g.Z({target:e,typeList:t,newVal:n}).execute())}createGroup(e,t,n){const r=t||new a.Group,i=[];i.push(new v({model:r,runScene:this.runScene,parent:n||this.runScene.assetsEx.get().scene}).execute()),e instanceof Array?i.push(...e.map((e=>new x({target:e,oldParent:e.parent,newParent:r,runScene:this.runScene}).execute()))):i.push(new x({target:e,oldParent:e.parent,newParent:r,runScene:this.runScene}).execute()),n&&this.runScene.cb.model.setOpen.cb({isOpen:!0,model:n}),this.runScene.cb.model.setOpen.cb({isOpen:!0,model:r}),this.runScene.cb.model.setMainStatue.cb({status:!0,model:r}),this.runScene.undoEx.addUndo(i),this.setSelectByModel(r)}cleanGroup(e,t=!0){if(e instanceof Array){const t=(0,i.multiArrToArr)(e.map((e=>(this.runScene.cb.model.unFocus.cb(e),this.cleanGroup(e,!1)))).filter((e=>e)));return this.runScene.undoEx.addUndo(t),t}if(this.runScene.cb.model.unFocus.cb(e),0!==e.children.length){const n=[],r=e.children.map((e=>{if(e.parent.parent)return new x({target:e,oldParent:e.parent,newParent:e.parent.parent,runScene:this.runScene})})).filter((e=>e));return n.push(...r.map((e=>e.execute()))),n.push(new w.Z({runScene:this.runScene,model:e,parent:e.parent}).execute()),t&&this.runScene.undoEx.addUndo(n),n}}hideOther(e){const t=e.uuid,n=0<e.children.length,i=this.runScene.sceneEx.getClearModels(),a=[];i.map((i=>{i.traverse((i=>{n?!1===r().model.deepFindParentByUuid(i,t)&&i.uuid!==e.uuid&&a.push(i):i.uuid!==e.uuid&&a.push(i)}))}));var 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),r().model.setParentVisible(e,!0)}showAll(){const e=this.runScene.sceneEx.getClearModels(),t=[];e.map((e=>{e.traverse((e=>{"materialHelper"!==e.name&&!1===e.visible&&t.push(e)}))}));var n=t.map((e=>new y.Z({target:e,info:"visible",runScene:this.runScene,newVal:!0,oldVal:e.visible}).execute()));this.runScene.undoEx.addUndo(n)}removeHide(){const e=this.runScene.sceneEx.getClearModels(),t=new Set,n=[];e.map((e=>{e.traverse((e=>{e.visible||t.add(e)}))})),t.forEach((e=>{n.push(new w.Z({runScene:this.runScene,model:e,parent:e.parent}).execute())})),this.runScene.undoEx.addUndo(n)}_getModel(e){var t=this.runScene.uniqueEx.model.nameMap[e];if(t)return this.runScene.uniqueEx.model.get(t)||this.runScene.assetsEx.scene.getObjectByName(e)}getModel(e,t="array"){if(!(e instanceof Array))return this._getModel(e);if("array"===t)return e.map((e=>this._getModel(e)));if("map"===t){const t={};return e.map((e=>{t[e]=this.getModel(e)})),t}}getWorldLocal(e){this.runScene.assetsEx.scene.updateMatrixWorld(!0);var t=new a.Vector3;return e.getWorldPosition(t),t}getClickObj(e,t,n=!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(n){if(0===(e=o.filter((e=>r().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:n}=this.runScene.assetsEx.camera.position,{x:r,y:i,z:a}=this.runScene.assetsEx.controls.target;return{cx:e,cy:t,cz:n,tx:r,ty:i,tz:a}}camAnima(e,t,n=1,r,i){return(0,T.anima)(e,t,n,(e=>{i&&i(e),this.runScene.assetsEx.camera.position.set(e.cx,e.cy,e.cz),this.runScene.assetsEx.controls.target.set(e.tx,e.ty,e.tz),this.runScene.assetsEx.camera.lookAt(this.runScene.assetsEx.controls.target)}),(e=>{r&&r()}))}setGlow(e,t=!0){t=t?1:0,0==(e.userData.layers=t)?e.layers.set(0):e.layers.enable(1),this.runScene.cb.model.setLayers.cb({model:e,val:t})}setOutline(e,t=!0){e.userData.outline=t,this.runScene.pp.addOutlineObj(e,t),this.runScene.cb.model.setOutline.cb({model:e,val:t})}beforeLoad(e){return e instanceof Array?e.map((e=>this.beforeLoad(e))):e}focus(e){const{scene:t,camera:n,renderer:r,controls:i}=this.runScene.assetsEx.get(),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=r.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(n.position,o),u.projectOnPlane(new a.Vector3(0,1,0)),u.normalize(),1<t&&(t=1/t),l=2*Math.tan(.5*n.fov*Math.PI/180),l=i.length()/t/l,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 r=new a.Vector3;r.subVectors(n.position,o),r.projectOnPlane(new a.Vector3(0,1,0)),r.normalize(),s.addVectors(o,r.multiplyScalar(3))}(0,T.anima)({positionX:n.position.x,positionY:n.position.y,positionZ:n.position.z,targetX:i.target.x,targetY:i.target.y,targetZ:i.target.z},{positionX:s.x,positionY:s.y,positionZ:s.z,targetX:o.x,targetY:o.y,targetZ:o.z},.5,(e=>{n.position.set(e.positionX,e.positionY,e.positionZ),n.lookAt(e.targetX,e.targetY,e.targetZ),i.target.set(e.targetX,e.targetY,e.targetZ),i.update()}))}instance(e){this.runScene.assetsEx.scene.updateMatrixWorld();const t={},n=Array.isArray(e)?e:[e],r=[];n.map((e=>{e.traverse((e=>{var n;e.geometry&&!Y(e)&&(n=q(e))&&(r.push(e),t[n]||(t[n]=new Set),t[n].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))})),r.map((e=>{this.runScene.modelEx.remove(e,!1)}))}reset(){const e=this.runScene.sceneEx.getClearModels();let t=[];e.map((e=>e.traverse((e=>t.push(e))))),t.map((e=>{j(e,{remove:!1}),this.runScene.cb.model.dispose.cb(e)})),this.runScene.modelEx.selectNull(),this.geometryMap.clear()}getHoverFromModels(e,t,n){const{getOriginData:r,ignoreMove:i}=(0,T.mergeObject)({ignoreMove:!1,getOriginData:!1},n);this.runScene.cb.events.pointer.move.add("get-hover-from-models",(n=>{if(i||!this.runScene.events.mouse.isMove){const i=new 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=n.pageX-o;n=n.pageY-s,c.x=o/l*2-1,c.y=-n/u*2+1,i.setFromCamera(c,d);const p=i.intersectObjects(e||[],!0);null!=t&&t(0===p.length?null:r?p:p.map((e=>e.object)))}}))}}const G=e=>{},N=e=>{if(l.includes(e))return e=r().model.getModelByType(e),p.ZP.parseNode(e),e;throw TypeError("")},j=(e,t)=>{t=(t||{}).remove;const{geometry:n,material:r}=e;n&&(null!=n&&n.dispose(),delete e.geometry),r&&((0,f.disposeMaterial)(e.material),e.material.dispose(),delete e.material),!1!==t&&e.parent&&e.parent.remove(e)},z=(e,t)=>{var{material:n,geometry:r}=e;const i=new h.Z.InstancedMesh(r,n,t.length+1);return[e,...t].map(((e,t)=>{e.updateMatrix(),i.setMatrixAt(t,e.matrixWorld)})),i.name=e.name,i},H=(e,t)=>{const n=[];if(t.map((e=>{e=e.geometry,n.push(e)})),t=function(e,t){for(var n,r,i=1<arguments.length&&void 0!==t&&t,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(n in c){var C=s(c[n]);if(!C)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+n+" attribute."),null;p.setAttribute(n,C)}for(r in h){var E=h[r][0].length;if(0===E)break;p.morphAttributes=p.morphAttributes||{},p.morphAttributes[r]=[];for(var T=0;T<E;++T){for(var _=[],D=0;D<h[r].length;++D)_.push(h[r][D][T]);var P=s(_);if(!P)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+r+" morphAttribute."),null;p.morphAttributes[r].push(P)}}return p}(n),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,ne=e=>e.isSprite,re=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 n=[];Array.isArray(e)?n.push(...e):n.push(e);const r={};return n.map((e=>e.traverse((e=>{null!=t&&t(e),r[(0,A.Ki)(e)]=e})))),r},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,n)=>{n.d(t,{Q:()=>d,S:()=>p});var r=n(868),i=n(881),a=n(819),s=n(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 n,r=c(e);if(n=t?(n=c(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===o(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var h=function(e){var t=r;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e);var n=u(r);function r(e,t,o,l){var u;if(!(this instanceof r))throw new TypeError("Cannot call a class as a function");return(u=n.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=r,(e=[{key:"dispose",value:function(){this.renderTargetMaskBuffer.dispose(),this.renderTargetDepthBuffer.dispose(),this.renderTargetMaskDownSampleBuffer.dispose(),this.renderTargetBlurBuffer1.dispose(),this.renderTargetBlurBuffer2.dispose(),this.renderTargetEdgeBuffer1.dispose(),this.renderTargetEdgeBuffer2.dispose()}},{key:"setSize",value:function(e,t){this.renderTargetMaskBuffer.setSize(e,t),this.renderTargetDepthBuffer.setSize(e,t),e=Math.round(e/this.downSampleRatio),t=Math.round(t/this.downSampleRatio),this.renderTargetMaskDownSampleBuffer.setSize(e,t),this.renderTargetBlurBuffer1.setSize(e,t),this.renderTargetEdgeBuffer1.setSize(e,t),this.separableBlurMaterial1.uniforms.texSize.value.set(e,t),e=Math.round(e/2),t=Math.round(t/2),this.renderTargetBlurBuffer2.setSize(e,t),this.renderTargetEdgeBuffer2.setSize(e,t),this.separableBlurMaterial2.uniforms.texSize.value.set(e,t)}},{key:"changeVisibilityOfSelectedObjects",value:function(e){var t=this._visibilityCache;function n(n){n.isMesh&&(!0===e?n.visible=t.get(n):(t.set(n,n.visible),n.visible=e))}for(var r=0;r<this.selectedObjects.length;r++)this.selectedObjects[r].traverse(n)}},{key:"changeVisibilityOfNonSelectedObjects",value:function(e){var t=this._visibilityCache,n=[];function r(e){e.isMesh&&n.push(e)}for(var i=0;i<this.selectedObjects.length;i++)this.selectedObjects[i].traverse(r);this.renderScene.traverse((function(r){if(r.isMesh||r.isSprite){for(var i,a=!1,s=0;s<n.length;s++)if(n[s].id===r.id){a=!0;break}!1===a&&(i=r.visible,!1!==e&&!0!==t.get(r)||(r.visible=e),t.set(r,i))}else(r.isPoints||r.isLine)&&(!0===e?r.visible=t.get(r):(t.set(r,r.visible),r.visible=e))}))}},{key:"updateTextureMatrix",value:function(){this.textureMatrix.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),this.textureMatrix.multiply(this.renderCamera.projectionMatrix),this.textureMatrix.multiply(this.renderCamera.matrixWorldInverse)}},{key:"render",value:function(e,t,n,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=r.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=r.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=r.BlurDirectionX,e.setRenderTarget(this.renderTargetBlurBuffer2),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetBlurBuffer2.texture,this.separableBlurMaterial2.uniforms.direction.value=r.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer2),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.overlayMaterial,this.overlayMaterial.uniforms.maskTexture.value=this.renderTargetMaskBuffer.texture,this.overlayMaterial.uniforms.edgeTexture1.value=this.renderTargetEdgeBuffer1.texture,this.overlayMaterial.uniforms.edgeTexture2.value=this.renderTargetEdgeBuffer2.texture,this.overlayMaterial.uniforms.patternTexture.value=this.patternTexture,this.overlayMaterial.uniforms.edgeStrength.value=this.edgeStrength,this.overlayMaterial.uniforms.edgeGlow.value=this.edgeGlow,this.overlayMaterial.uniforms.usePatternTexture.value=this.usePatternTexture,a&&e.state.buffers.stencil.setTest(!0),e.setRenderTarget(n),this.fsQuad.render(e),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=s),this.renderToScreen&&(this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=n.texture,e.setRenderTarget(null),this.fsQuad.render(e))}},{key:"getPrepareMaskMaterial",value:function(){return new 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 n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),r}(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 r.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,n)=>{t.uuid===e.uuid&&(e.userData.outline=!1,this.outlinePass.selectedObjects.splice(n,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((n=>{e.uuid===n.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,n)=>{n.d(t,{Z:()=>i,s:()=>a});var r=n(881);class i{constructor(e){this.setSize=(e,t)=>{var{width:n,height:r}=this.getDomSize();this.runScene.setSize(e||n,t||r)},this.runScene=e,this.runScene.cb.resize.add("render-ex-resize",(({width:e,height:t})=>{this.setSize(e,t)}))}setBackground(e){this.runScene.assetsEx.engineDom.style.background=e}create(e){let t=new r.WebGLRenderer({antialias:!0,alpha:!0,powerPreference:"high-performance"});return t.domElement.style.position="absolute",t.setPixelRatio(window.devicePixelRatio),t.shadowMap.enabled=!0,t.shadowMap.type=r.PCFSoftShadowMap,t.physicallyCorrectLights=!0,t.localClippingEnabled=!0,e.appendChild(t.domElement),t}getDomSize(){var{clientWidth:e,clientHeight:t}=this.runScene.assetsEx.get().engineDom;return{width:e,height:t}}}const a=(e,t)=>{t=(t||{}).removeDom,!(e.render=()=>{})!==t&&e.domElement.remove(),e.setAnimationLoop(null),e.dispose(),e.renderLists&&e.renderLists.dispose()}},868:(e,t,n)=>{n.d(t,{Gc:()=>ka,al:()=>ke,ch:()=>d,Az:()=>Oe,Sf:()=>Fa,cQ:()=>h,ZP:()=>Ua});var r={},i=(n.r(r),n.d(r,{AsyncCompress:()=>xn,AsyncDecompress:()=>Ln,AsyncDeflate:()=>dn,AsyncGunzip:()=>Mn,AsyncGzip:()=>xn,AsyncInflate:()=>vn,AsyncUnzipInflate:()=>ir,AsyncUnzlib:()=>Pn,AsyncZipDeflate:()=>er,AsyncZlib:()=>Tn,Compress:()=>bn,DecodeUTF8:()=>jn,Decompress:()=>In,Deflate:()=>hn,EncodeUTF8:()=>zn,Gunzip:()=>An,Gzip:()=>bn,Inflate:()=>mn,Unzip:()=>ar,UnzipInflate:()=>rr,UnzipPassThrough:()=>nr,Unzlib:()=>Dn,Zip:()=>tr,ZipDeflate:()=>$n,ZipPassThrough:()=>qn,Zlib:()=>En,compress:()=>wn,compressSync:()=>Sn,decompress:()=>function(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return(31==e[0]&&139==e[1]&&8==e[2]?Bn:8!=(15&e[0])||7<e[0]>>4||(e[0]<<8|e[1])%31?gn:On)(e,t,n)},decompressSync:()=>function(e,t){return(31==e[0]&&139==e[1]&&8==e[2]?Cn:8!=(15&e[0])||7<e[0]>>4||(e[0]<<8|e[1])%31?yn:Rn)(e,t)},deflate:()=>pn,deflateSync:()=>fn,gunzip:()=>Bn,gunzipSync:()=>Cn,gzip:()=>wn,gzipSync:()=>Sn,inflate:()=>gn,inflateSync:()=>yn,strFromU8:()=>Vn,strToU8:()=>Hn,unzip:()=>function(e,t){if("function"!=typeof t)throw"no callback";for(var n=[],r=function(){for(var e=0;e<n.length;++e)n[e]()},i={},a=e.length-22;101010256!=tn(e,a);--a)if(!a||65558<e.length-a)return void t("invalid zip file",null);var s=en(e,a+8);s||t(null,{});var o=s,l=tn(e,a+16),u=4294967295==l;if(u){if(a=tn(e,a-12),101075792!=tn(e,a))return void t("invalid zip file",null);o=s=tn(e,a+32),l=tn(e,a+48)}for(var c=function(a){function o(e,n){e?(r(),t(e,null)):(i[p]=n,--s||t(null,i))}var c=(m=Zn(e,l,u))[0],h=m[1],d=m[2],p=m[3],f=m[4],m=m[5];if(m=Kn(e,m),l=f,c)if(8==c)if(f=e.subarray(m,m+h),h<32e4)try{o(null,yn(f,new Ye(d)))}catch(a){o(a,null)}else n.push(gn(f,{size:d},o));else o("unknown compression type "+c,null);else o(null,Mt(e,m,m+h))},h=0;h<o;++h)c();return r},unzipSync:()=>function(e){for(var t={},n=e.length-22;101010256!=tn(e,n);--n)if(!n||65558<e.length-n)throw"invalid zip file";var r=en(e,n+8);if(!r)return{};var i=tn(e,n+16),a=4294967295==i;if(a){if(n=tn(e,n-12),101075792!=tn(e,n))throw"invalid zip file";r=tn(e,n+32),i=tn(e,n+48)}for(var s=0;s<r;++s){var o=(d=Zn(e,i,a))[0],l=d[1],u=d[2],c=d[3],h=d[4],d=d[5];if(d=Kn(e,d),i=h,o){if(8!=o)throw"unknown compression type "+o;t[c]=yn(e.subarray(d,d+l),new Ye(u))}else t[c]=Mt(e,d,d+l)}return t},unzlib:()=>On,unzlibSync:()=>Rn,zip:()=>function(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";function r(){for(var e=0;e<d.length;++e)d[e]()}function i(){for(var e=new Ye(u+22),t=l,r=u-l,i=u=0;i<c;++i){var a=h[i];try{var s=a.c.length,o=(Qn(e,u,a,a.f,a.u,s),30+a.f.length+Xn(a.extra)),d=u+o;e.set(a.c,d),Qn(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 n(e,null)}}Yn(e,l,h.length,r,t),n(null,e)}var a={},s=(kn(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?(r(),n(t,null)):(t=a.length,h[e]=jt(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=Ut(),g=f.length,y=(v.p(f),Hn(c)),b=y.length,x=m.comment,w=x&&Hn(x),S=w&&w.length,A=Xn(m.extra),M=0==m.level?0:8;if(65535<b&&t("filename too long",null),M)if(g<16e4)try{t(null,fn(f,m))}catch(p){t(p,null)}else d.push(pn(f,m,t));else t(null,f)},f=0;f<c;++f)p(f);return r},zipSync:()=>function(e,t){var n,r={},i=[],a=(kn(e,"",r,t=t||{}),0),s=0;for(n in r){var o,l=(o=r[n])[0],u=0==(o=o[1]).level?0:8,c=(x=Hn(n)).length,h=o.comment,d=h&&Hn(h),p=d&&d.length,f=Xn(o.extra);if(65535<c)throw"filename too long";var m=u?fn(l,o):l,v=m.length,g=Ut();g.p(l),i.push(jt(o,{size:l.length,crc:g.d(),c:m,f:x,m:d,u:c!=n.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 Ye(s+22),b=(e=a,t=s-a,0);b<i.length;++b){var x=i[b],w=(Qn(y,x.o,x,x.f,x.u,x.c.length),30+x.f.length+Xn(x.extra));y.set(x.c,x.o+w),Qn(y,a,x,x.f,x.u,x.c.length,x.o,x.m),a+=16+w+(x.m?x.m.length:0)}return Yn(y,a,i.length,t,e),y},zlib:()=>function(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return $t(e,t,[Kt,Xt,function(){return[_n]}],(function(e){return Yt(_n(e.data[0],e.data[1]))}),4,n)},zlibSync:()=>_n}),t={},n.r(t),n.d(t,{FBXLoader:()=>Ar}),n(300)),a=n.n(i),s=n(1),o=n(881);class l{constructor(e){this.runScene=e}}var u=n(143),c=n(247),h=n(457),d=n(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 n of e.animations)if(n.name===t)return n.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 n=(0,s.getId)(),r=(t.id=n,a.clipAction(t));const i={finished:()=>{},loop:()=>{}};a.addEventListener("finished",(()=>i.finished())),a.addEventListener("loop",(()=>i.loop())),this.map[n]={mixer:a,action:r,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,n){e=this.findId(e,t);const r=this.map[e];if(r&&!this.playings.has(r)){t=(0,h.mergeObject)({onLoop:()=>{},onProgress:()=>{},onFinished:()=>{},onClose:()=>{},onPause:()=>{},onResume:()=>{},onBeforeEnd:()=>{},loop:!1,lastFrame:!0,reset:!0},n);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,r);p.stop(),n=d?0:r.time,p.time=n,this.setPlayState(r,!0),d&&p.reset(),p.play();let v=!(r.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(r,!1),i(100),o()})}}pause(e,t){e=this.findId(e,t);const n=this.map[e];n&&this.playings.has(n)&&(this.updateTime(n),this.setPlayState(n,!1),n.options.onPause(),n.runState="pause")}resume(e,t){var n=this.findId(e,t);const r=this.map[n];r&&this.playings.has(r)&&(r.options.onResume(),this.play(e,t,null==(n=this.map[t])?void 0:n.options))}playAll(){this.pauseAll(),this.playings.clear(),Object.values(this.map).map((e=>{this.playings.add(e);const t=e.action;t.time=0,t.play()})),this.anima()}setValue(e){let t=this.clock.getDelta();Object.keys(this.map).map((n=>{const{mixer:r,action:i}=this.map[n];i.play(),i.time=e,r.update(t)}))}getDetal(){return this.clock.getDelta()}update(e){const t=e||this.getDetal();(0,s.mapObj)(this.updates,((e,n)=>n(t)))}anima(){let e=this.clock.getDelta();this.update(e),this.playings.forEach((t=>{t.mixer.update(e)})),this.tickIndex=window.requestAnimationFrame(this.anima.bind(this))}closeAnima(){window.cancelAnimationFrame(this.tickIndex)}resetItem(e){const{mixer:t,action:n}=e;n.reset(),n.stop(),t.time=0}pauseAll(){this.closeAnima(),this.playings.forEach((e=>this.resetItem(e))),this.playings.clear()}reset(){this.pauseAll(),this.map={},this.playings.clear(),this.closeAnima()}updateTime(e,t){e.time=t||e.action.time}setPlayState(e,t){t?(this.playings.add(e),1===this.playings.size&&this.anima()):(this.playings.delete(e),delete this.updates[e.clip.id],0===this.playings.size&&this.closeAnima())}getItem(e,t){return e=this.findId(e,t),this.map[e]}close(e,t,n){e=this.findId(e,t);const r=this.map[e];r&&this.playings.has(r)&&r.options&&((t=(0,h.mergeObject)({resetAction:!0},n).resetAction)&&r.action.reset(),this.setPlayState(r,!1),this.updateTime(r,0),r.options.onClose(),r.options=null,r.runState="pause")}setUpdates(e,t){this.updates[e]=t}fadeTo(e){var{lastModel:e,lastName:t,nextModel:n,nextName:r,duration:i}=e;e=this.findId(e,t);const a=this.map[e];a&&(t=this.findId(n,r),(e=this.map[t])&&a.action.crossFadeTo(e.action,i,!0))}resetTime(e,t){const n=this.getItem(e,t);n&&(n.action.time=0)}}var f=n(693),m=n(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:n})=>{e.setSize(t,n)})),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:n})=>{e.setSize(t,n)})),e}reset(){var e=this.get().camera;this.runScene.renderEx.setSize(),this.runScene.cameraEx.reset(e)}dispose(){this.disposeRender(this.render2),this.disposeRender(this.render3)}setRender2(e){e?this.render2=this.initRender2():this.render2&&(this.disposeRender(this.render2),this.render2=null)}setRender3(e){e?this.render3=this.initRender3():this.render3&&(this.disposeRender(this.render3),this.render3=null)}init(e){var t=this.runScene.sceneEx.create(),n=this.runScene.cameraEx.pCam,r=this.runScene.renderEx.create(e),i=this.runScene.controlsEx.create(n,e),{render2:a,render3:s}=this.runScene.optionsEx.options;return this.camera=n,this.scene=t,this.renderer=r,this.controls=i,this.engineDom=e,this.runScene.renderEx.setSize(),this.setRender2(a),this.setRender3(s),{scene:t,camera:n,render:r,controls:i,engineDom:e}}get(){var{scene:e,renderer:t,controls:n,engineDom:r}=this;return{scene:e,camera:this.runScene.cameraEx.getCamera(),renderer:t,controls:n,engineDom:r}}}class g{constructor(){this.cbs=[],this.cb=e=>this.cbs.map((t=>{var n;return null==(n=t.fn)?void 0:n.call(t,e)})),this.emit=this.cb}add(e,t){return this.cbs.push({fn:t,name:e})}on(e,t){return this.add(t||"custom_"+(0,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=n(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 n,r,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=(n=new c.Z.Vector3,function(e){var t=this.object.matrix.elements;n.set(t[0],t[1],t[2]),n.multiplyScalar(-e),w.add(n)}),this.panUp=(r=new c.Z.Vector3,function(e,n){t.screenSpacePanning?r.setFromMatrixColumn(n,1):(r.setFromMatrixColumn(n,0),r.crossVectors(m.object.up,r)),r.multiplyScalar(e),w.add(r)}),this.pan=function(e,t,n,r){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/r),m.panUp(2*t*i/r,m.object.matrix)):m.object instanceof c.Z.OrthographicCamera?(m.panLeft(e*(m.object.right-m.object.left)/n),m.panUp(t*(m.object.top-m.object.bottom)/r)):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 n=new x(e,this),r=(this.domElement=void 0!==t?t:document,Object.defineProperty(this,"constraint",{get:function(){return n}}),this.getPolarAngle=function(){return n.getPolarAngle()},this.getAzimuthalAngle=function(){return n.getAzimuthalAngle()},this.setPolarAngle=function(e){return n.setPolarAngle(e)},this.setAzimuthalAngle=function(e){return n.setAzimuthalAngle(e)},this.enabled=!0,this.center=this.target,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.screenSpacePanning=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={ORBIT: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=r.domElement===document?r.domElement.body:r.domElement;n.pan(e,t,i.clientWidth,i.clientHeight)}function w(){return Math.pow(.95,r.zoomSpeed)}function S(e){if(!1!==r.enabled){if(e.preventDefault(),e.button===r.mouseButtons.ORBIT){if(!1===r.enableRotate)return;m=0,i.set(e.clientX,e.clientY)}else if(e.button===r.mouseButtons.ZOOM){if(!1===r.enableZoom)return;m=1,h.set(e.clientX,e.clientY)}else if(e.button===r.mouseButtons.PAN){if(!1===r.enablePan)return;m=2,o.set(e.clientX,e.clientY)}m!==f&&(document.addEventListener("mousemove",A,!1),document.addEventListener("mouseup",M,!1),r.dispatchEvent(g))}}function A(e){if(null!=e&&null!=(t=e.preventDefault)&&t.call(e),!1!==r.enabled){var t=r.domElement===document?r.domElement.body:r.domElement;if(0===m){if(!1===r.enableRotate)return;a.set(e.clientX,e.clientY),s.subVectors(a,i),n.rotateLeft(2*Math.PI*s.x/t.clientWidth*r.rotateSpeed),n.rotateUp(2*Math.PI*s.y/t.clientHeight*r.rotateSpeed),i.copy(a)}else if(1===m){if(!1===r.enableZoom)return;d.set(e.clientX,e.clientY),p.subVectors(d,h),0<p.y?n.dollyIn(w()):p.y<0&&n.dollyOut(w()),h.copy(d)}else if(2===m){if(!1===r.enablePan)return;l.set(e.clientX,e.clientY),u.subVectors(l,o),b(u.x,u.y),o.copy(l)}m!==f&&r.update()}}function M(){!1!==r.enabled&&(document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",M),r.dispatchEvent(y),m=f)}function B(e){var t;!1!==r.enabled&&!1!==r.enableZoom&&m===f&&(e.stopPropagation(),void(t=0)!==e.wheelDelta?t=e.wheelDelta:void 0!==e.detail&&(t=-e.detail),0<t?n.dollyOut(w()):t<0&&n.dollyIn(w()),r.update(),r.dispatchEvent(g),r.dispatchEvent(y))}function C(e){if(!1!==r.enabled&&!1!==r.enableKeys&&!1!==r.enablePan)switch(e.keyCode){case r.keys.UP:b(0,r.keyPanSpeed),r.update();break;case r.keys.BOTTOM:b(0,-r.keyPanSpeed),r.update();break;case r.keys.LEFT:b(r.keyPanSpeed,0),r.update();break;case r.keys.RIGHT:b(-r.keyPanSpeed,0),r.update()}}function E(e){if(!1!==r.enabled){switch(e.touches.length){case 1:if(!1===r.enableRotate)return;m=3,i.set(e.touches[0].pageX,e.touches[0].pageY);break;case 2:if(!1===r.enableZoom)return;m=4;var t=e.touches[0].pageX-e.touches[1].pageX,n=e.touches[0].pageY-e.touches[1].pageY;t=Math.sqrt(t*t+n*n),h.set(0,t);break;case 3:if(!1===r.enablePan)return;m=5,o.set(e.touches[0].pageX,e.touches[0].pageY);break;default:m=f}m!==f&&r.dispatchEvent(g)}}function T(e){if(e.stopPropagation(),!1!==r.enabled){var t=r.domElement===document?r.domElement.body:r.domElement;switch(e.touches.length){case 1:if(!1===r.enableRotate)return;if(3!==m)return;a.set(e.touches[0].pageX,e.touches[0].pageY),s.subVectors(a,i),n.rotateLeft(2*Math.PI*s.x/t.clientWidth*r.rotateSpeed),n.rotateUp(2*Math.PI*s.y/t.clientHeight*r.rotateSpeed),i.copy(a),r.update();break;case 2:if(!1===r.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?n.dollyOut(w()):p.y<0&&n.dollyIn(w()),h.copy(d),r.update();break;case 3:if(!1===r.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),r.update();break;default:m=f}}}function _(){!1!==r.enabled&&(r.dispatchEvent(y),m=f)}function D(e){e.preventDefault()}this.update=function(){this.autoRotate&&m===f&&n.rotateLeft(2*Math.PI/60/60*r.autoRotateSpeed),!0===n.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,n){var{x:r,y:i,z:a}=t,{x:n,y:s,z:o}=n||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:n,y:s,z:o},{x:r,y:i,z:a},.5,(t=>{var{x:n,y:r,z:i}=t;e.target.set(n,r,i),e.update(),this.setTargetData.nowData=t}),(()=>{this.setTargetData.anima=null}))}}A.setTargetData={anima:null,nowData:null};class M{constructor(e){this._state=!1,this._libsState=!1,this.map={val:"Box",type:"base-model"},this.libsMap={data:"Box",type:"texture"},this.events=e}get state(){return this._state}set state(e){this._state=e}setVal(e){this.state=!0,this.map=e}getVal(){if(this.state)return this.state=!1,this.map}setLibsVal(e){this._libsState=!0,this.libsMap=e}getLibsVal(){if(this._libsState)return this._libsState=!1,this.libsMap}}var B=n(794),C=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}))};const E=s.fnDebounce;class T{constructor(e){this.alt=!1,this.ctrl=!1,this.shift=!1,this.unExec=new B.Z,this.specialKeyDebounce=E((()=>{this.ctrl=!1,this.shift=!1,this.alt=!1}),1e3),this.allFn={s_saveScene:()=>C(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 C(this,void 0,void 0,(function*(){if("INPUT"!==document.activeElement.nodeName){var t=e.key.toLowerCase();if(this.events.runScene.cb.events.key.down.cb({key:t,event:e}),!this.unExec.get(t))switch(t){case" ":break;case"s":this.ctrl&&(e.preventDefault(),this.allFn.s_saveScene());break;case"d":this.ctrl&&(e.preventDefault(),this.allFn.d_copyModel());break;case"alt":this.alt=!0,this.specialKeyDebounce();break;case"control":case"ctrl":this.ctrl=!0,this.specialKeyDebounce();break;case"shift":this.shift=!0,this.specialKeyDebounce();break;case"f11":this.events.runScene.cb.resize.cb(this.events.runScene.renderEx.getDomSize());break;case"w":e.preventDefault(),e.stopPropagation(),this.events.runScene.helperEx.transContro.changeMode("position");break;case"e":this.events.runScene.helperEx.transContro.changeMode("rotation");break;case"r":this.events.runScene.helperEx.transContro.changeMode("scale"),e.preventDefault();break;case"f":this.allFn.f_focusModel();break;case"delete":this.events.runScene.helperEx.unfocus();var n=this.events.runScene.multipSelector.getSelectedList("value");this.events.runScene.sceneEx.remove(this.events.runScene.modelEx.select||n),n&&this.events.runScene.multipSelector.delete();break;case"z":if(!this.ctrl)return;this.allFn.z_undo(e);break;case"y":if(!this.ctrl)return;this.allFn.y_redo(e)}}}))}keyUp(e){if("INPUT"!==document.activeElement.nodeName){var t=e.key.toLowerCase();switch(this.events.runScene.cb.events.key.up.cb({key:t,event:e}),t){case"meta":break;case"s":if(this.ctrl)break;return;case"alt":this.alt=!1;break;case"control":case"ctrl":this.ctrl=!1;break;case"shift":this.shift=!1}}}}var _=n(801);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,n,r,i;this.isMove=!1,1===e.button||null!=(t=this.events.runScene.helperEx.transContro)&&t.isDraggingChange||(t=e.offsetX,n=e.offsetY,({x:r,y:i}=this.downPosition[e.button]),t===r&&n===i&&(0===e.button&&this.trigger(e),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 n=e;"canvas"===t?n=e:"window"===t&&(n=window),n.addEventListener("pointerdown",this.down.bind(this)),n.addEventListener("pointerup",this.up.bind(this)),n.addEventListener("pointerdown",this.events.runScene.cb.events.pointer.down.cb),n.addEventListener("pointerup",this.events.runScene.cb.events.pointer.up.cb),n.addEventListener("pointermove",(e=>{this.moveEvent=e,this.events.runScene.cb.events.pointer.move.cb(e)})),n.addEventListener("mousemove",this.events.runScene.cb.events.mouse.move.cb),n.addEventListener("mousedown",this.events.runScene.cb.events.mouse.down.cb),n.addEventListener("mouseup",this.events.runScene.cb.events.mouse.up.cb)}getTriggerModels(e){const t=new o.Raycaster,n=new o.Vector2,{engineDom:r,camera:i,scene:a}=this.events.runScene.assetsEx.get();var{top:s,left:l,width:u,height:c}=r.getBoundingClientRect(),l=e.pageX-l,s=(e=e.pageY-s,n.x=l/u*2-1,n.y=-e/c*2+1,t.setFromCamera(n,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)&&!_.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 P(){P=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=(p="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",i=p.asyncIterator||"@@asyncIterator",a=p.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(t){s=function(e,t,n){return e[t]=n}}function o(e,t,n,r){var i,a,s,o;return t=t&&t.prototype instanceof c?t:c,t=Object.create(t.prototype),r=new x(r||[]),t._invoke=(i=e,a=n,s=r,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 n=s.delegate;if(n&&(n=function e(t,n){var r=t.iterator[n.method];if(void 0===r){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=void 0,e(t,n),"throw"===n.method))return u;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}return"throw"===(r=l(r,t.iterator,n.arg)).type?(n.method="throw",n.arg=r.arg,n.delegate=null,u):(r=r.arg)?r.done?(n[t.resultName]=r.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,u):r:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,u)}(n,s),n)){if(n===u)continue;return n}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"===(n=l(i,a,s)).type){if(o=s.done?"completed":"suspendedYield",n.arg===u)continue;return{value:n.arg,done:s.done}}"throw"===n.type&&(o="completed",s.method="throw",s.arg=n.arg)}}),t}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=o;var u={};function c(){}function h(){}function d(){}var p,f,m=(s(p={},r,(function(){return this})),(f=(f=Object.getPrototypeOf)&&f(f(w([]))))&&f!==t&&n.call(f,r)&&(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 r;this._invoke=function(i,a){function s(){return new t((function(r,s){!function r(i,a,s,o){var u;if("throw"!==(i=l(e[i],e,a)).type)return(a=(u=i.arg).value)&&"object"==R(a)&&n.call(a,"__await")?t.resolve(a.__await).then((function(e){r("next",e,s,o)}),(function(e){r("throw",e,s,o)})):t.resolve(a).then((function(e){u.value=e,s(u)}),(function(e){return r("throw",e,s,o)}));o(i.arg)}(i,a,r,s)}))}return r=r?r.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[r];if(i)return i.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(i=function r(){for(;++t<e.length;)if(n.call(e,t))return r.value=e[t],r.done=!1,r;return r.value=void 0,r.done=!0,r}).next=i}return{next: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,n,r,i,a){void 0===a&&(a=Promise);var s=new g(o(t,n,r,i),a);return e.isGeneratorFunction(n)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},v(m),s(m,a,"Generator"),s(m,r,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,n=[];for(t in e)n.push(t);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=w,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(b),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return s.type="throw",s.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;0<=i;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var o=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(o&&l){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(o){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;0<=r;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}var 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 n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),b(n),u}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var n,r,i=this.tryEntries[t];if(i.tryLoc===e)return"throw"===(n=i.completion).type&&(r=n.arg,b(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:w(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},e}function O(e,t,n,r,i,a,s){try{var o=e[a](s),l=o.value}catch(e){return void n(e)}o.done?t(l):Promise.resolve(l).then(r,i)}function R(e){return(R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function I(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function L(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function k(e,t,n){t&&L(e.prototype,t),n&&L(e,n),Object.defineProperty(e,"prototype",{writable:!1})}var F=function(){function e(){I(this,e),this.pluginCallbacks=[],this.register((function(e){return new te(e)})),this.register((function(e){return new ne(e)})),this.register((function(e){return new re(e)})),this.register((function(e){return new ae(e)})),this.register((function(e){return new se(e)})),this.register((function(e){return new ie(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,n,r){"object"===R(n)&&(console.warn("THREE.GLTFExporter: parse() expects options as the fourth argument now."),r=n);for(var i=new ee,a=[],s=0,o=this.pluginCallbacks.length;s<o;s++)a.push(this.pluginCallbacks[s](i));i.setPlugins(a),i.write(e,t,r).catch(n)}},{key:"parseAsync",value:function(e,t){var n=this;return new Promise((function(r,i){n.parse(e,r,i,t)}))}}]),e}(),U=5121,G=5123,N=(i=9728,9729),j=9984,z=9985,H=9986,V=9987,J=33071,K=33648,Z=10497,W={},X=(W[o.NearestFilter]=i,W[o.NearestMipmapNearestFilter]=j,W[o.NearestMipmapLinearFilter]=H,W[o.LinearFilter]=N,W[o.LinearMipmapNearestFilter]=z,W[o.LinearMipmapLinearFilter]=V,W[o.ClampToEdgeWrapping]=J,W[o.RepeatWrapping]=Z,W[o.MirroredRepeatWrapping]=K,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"});function Q(e,t){return e.length===t.length&&e.every((function(e,n){return e===t[n]}))}function Y(e){return 4*Math.ceil(e/4)}function q(e,t){var n=1<arguments.length&&void 0!==t?t:0,r=Y(e.byteLength);if(r===e.byteLength)return e;var i=new Uint8Array(r);if(i.set(new Uint8Array(e)),0!==n)for(var a=e.byteLength;a<r;a++)i[a]=n;return i.buffer}var $=null,ee=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.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}var t,n;return k(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=P().mark((function e(t,n,r){var i,a,s,o,l,u,c;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.options=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(t),e.next=5,Promise.all(this.pending);case 5:return a=(i=this).buffers,s=i.json,r=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===r.binary?((u=new window.FileReader).readAsArrayBuffer(o),u.onloadend=function(){var e=q(u.result),t=new DataView(new ArrayBuffer(8)),r=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),q(function(e){if(void 0!==window.TextEncoder)return(new TextEncoder).encode(e).buffer;for(var t=new Uint8Array(new ArrayBuffer(e.length)),n=0,r=e.length;n<r;n++){var i=e.charCodeAt(n);t[n]=255<i?32:i}return t.buffer}(JSON.stringify(s)),32)),i=new DataView(new ArrayBuffer(8)),a=(i.setUint32(0,r.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+r.byteLength+t.byteLength+e.byteLength),l=(l.setUint32(8,o,!0),new Blob([a,i,r,t,e],{type:"application/octet-stream"})),c=new window.FileReader;c.readAsArrayBuffer(l),c.onloadend=function(){n(c.result)}}):s.buffers&&0<s.buffers.length?((c=new window.FileReader).readAsDataURL(o),c.onloadend=function(){var e=c.result;s.buffers[0].uri=e,n(s)}):n(s);case 17:case"end":return e.stop()}}),e,this)})),n=function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function s(e){O(a,r,i,s,o,"next",e)}function o(e){O(a,r,i,s,o,"throw",e)}s(void 0)}))},function(e,t,r){return n.apply(this,arguments)})},{key:"serializeUserData",value:function(e,t){if(0!==Object.keys(e.userData).length){var n=this.options,r=this.extensionsUsed;try{var i=JSON.parse(JSON.stringify(e.userData));if(n.includeCustomExtensions&&i.gltfExtensions){for(var a in void 0===t.extensions&&(t.extensions={}),i.gltfExtensions)t.extensions[a]=i.gltfExtensions[a],r[a]=!0;delete i.gltfExtensions}0<Object.keys(i).length&&(t.extras=i)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}}},{key:"getUID",value:function(e){return this.uids.has(e)||this.uids.set(e,this.uid++),this.uids.get(e)}},{key:"isNormalizedNormalAttribute",value:function(e){if(this.cache.attributesNormalized.has(e))return!1;for(var t=new o.Vector3,n=0,r=e.count;n<r;n++)if(5e-4<Math.abs(t.fromBufferAttribute(e,n).length()-1))return!1;return!0}},{key:"createNormalizedNormalAttribute",value:function(e){var t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);for(var n=e.clone(),r=new o.Vector3,i=0,a=n.count;i<a;i++)r.fromBufferAttribute(n,i),0===r.x&&0===r.y&&0===r.z?r.setX(1):r.normalize(),n.setXYZ(i,r.x,r.y,r.z);return t.attributesNormalized.set(e,n),n}},{key:"applyTextureTransform",value:function(e,t){var n=!1,r={};0===t.offset.x&&0===t.offset.y||(r.offset=t.offset.toArray(),n=!0),0!==t.rotation&&(r.rotation=t.rotation,n=!0),1===t.repeat.x&&1===t.repeat.y||(r.scale=t.repeat.toArray(),n=!0),n&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=r,this.extensionsUsed.KHR_texture_transform=!0)}},{key:"buildORMTexture",value:function(e){var t=null==(t=e.aoMap)?void 0:t.image,n=null==(n=e.roughnessMap)?void 0:n.image,r=null==(r=e.metalnessMap)?void 0:r.image;if(t===n&&n===r)return e.aoMap;if(t||n||r){e=Math.max((null==t?void 0:t.width)||0,(null==n?void 0:n.width)||0,(null==r?void 0:r.width)||0);var i=Math.max((null==t?void 0:t.height)||0,(null==n?void 0:n.height)||0,(null==r?void 0:r.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(n){s.drawImage(n,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(r){s.drawImage(r,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,n=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),n.push(e),0}},{key:"processBufferView",value:function(e,t,n,r,i){for(var a,s=this.json,o=(s.bufferViews||(s.bufferViews=[]),a=t===U?1:t===G?2:4,Y(r*e.itemSize*a)),l=new DataView(new ArrayBuffer(o)),u=0,c=n;c<n+r;c++)for(var h=0;h<e.itemSize;h++){var d=void 0;4<e.itemSize?d=e.array[c*e.itemSize+h]:0===h?d=e.getX(c):1===h?d=e.getY(c):2===h?d=e.getZ(c):3===h&&(d=e.getW(c)),5126===t?l.setFloat32(u,d,!0):5125===t?l.setUint32(u,d,!0):t===G?l.setUint16(u,d,!0):t===U&&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,n=t.json;return n.bufferViews||(n.bufferViews=[]),new Promise((function(r,i){var a=new window.FileReader;if(!(e instanceof Blob))return i();a.readAsArrayBuffer(e),a.onloadend=function(){var e=q(a.result),i={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,r(n.bufferViews.push(i)-1)}}))}},{key:"processAccessor",value:function(e,t,n,r){var i,a=this.options,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=G;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");i=U}if(void 0===n&&(n=0),void 0===r&&(r=e.count),a.truncateDrawRange&&void 0!==t&&null===t.index&&(a=n+r,l=t.drawRange.count===1/0?e.count:t.drawRange.start+t.drawRange.count,n=Math.max(n,t.drawRange.start),(r=Math.min(a,l)-n)<0&&(r=0)),0===r)return null;a=function(e,t,n){for(var r={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},i=t;i<t+n;i++)for(var a=0;a<e.itemSize;a++){var 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)),r.min[a]=Math.min(r.min[a],s),r.max[a]=Math.max(r.max[a],s)}return r}(e,n,r);var o,l=(void 0!==t&&(o=e===t.index?34963:34962),this.processBufferView(e,i,n,r,o));return t={bufferView:l.id,byteOffset:l.byteOffset,componentType:i,count:r,max:a.max,min:a.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]},!0===e.normalized&&(t.normalized=!0),s.accessors||(s.accessors=[]),s.accessors.push(t)-1}},{key:"processImage",value:function(e,t,n,r){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[n=c+":flipY/"+n.toString()])return a[n];s.images||(s.images=[]);var h={mimeType:c};if(!0===l.binary&&null!=r&&null!=(p=r.userData)&&p.blob&&(null==r||null==(p=r.userData)?void 0:p.blob)instanceof Blob)u.push(new Promise((function(e){i.processBufferViewImage(r.userData.blob).then((function(t){h.bufferView=t,e()}))})));else if(l.embedImages){var d=$=$||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[n]=t}},{key:"processSampler",value:function(e){var t=this.json;return t.samplers||(t.samplers=[]),e={magFilter:W[e.magFilter],minFilter:W[e.minFilter],wrapS:W[e.wrapS],wrapT:W[e.wrapT]},t.samplers.push(e)-1}},{key:"processTexture",value:function(e){var t=this.cache,n=this.json;if(t.textures.has(e))return t.textures.get(e);n.textures||(n.textures=[]);var r={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,e)};return e.name&&(r.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,r)})),n=n.textures.push(r)-1,t.textures.set(e,n),this.options.myOptions.helper.parseTexture({texture:e,textureDef:r}),n}},{key:"processMaterial",value:function(e){var t=this.cache,n=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;n.materials||(n.materials=[]);var r,i={pbrMetallicRoughness:{}},a=(Q((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<(r=Math.max(a.r,a.g,a.b))&&(a.multiplyScalar(1/r),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),0<r&&(i.emissiveFactor=a.toArray()),e.emissiveMap&&(r={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(r,e.emissiveMap),i.emissiveTexture=r)),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&&(r={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(r.strength=e.aoMapIntensity),this.applyTextureTransform(r,e.aoMap),i.occlusionTexture=r),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=n.materials.push(i)-1,t.materials.set(e,a),a}},{key:"processMesh",value:function(e){var t=this.cache,n=this.json,r=[e.geometry.uuid];if(Array.isArray(e.material))for(var i=0,a=e.material.length;i<a;i++)r.push(e.material[i].uuid);else r.push(e.material.uuid);var s=r.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],L=y?l.groups:[{materialIndex:0,start:void 0,count:void 0}],k=0,F=L.length;k<F;k++){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===L[k].start&&void 0===L[k].count||(G+=":"+L[k].start+":"+L[k].count),t.attributes.has(G)?U.indices=t.attributes.get(G):(U.indices=this.processAccessor(l.index,l,L[k].start,L[k].count),t.attributes.set(G,U.indices)),null===U.indices&&delete U.indices),this.processMaterial(I[L[k].materialIndex]));null!==G&&(U.material=G),m.push(U)}return p.primitives=m,n.meshes||(n.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,p)})),y=n.meshes.push(p)-1,t.meshes.set(s,y),y}},{key:"processCamera",value:function(e){var t=this.json,n=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),r={type:n?"orthographic":"perspective"};return n?r.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:r.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&&(r.name=e.type),t.cameras.push(r)-1}},{key:"processAnimation",value:function(e,t){for(var n=this.json,r=this.nodeMap,i=(n.animations||(n.animations=[]),(e=F.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=X[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===X.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:r.get(h),path:d}})}return n.animations.push({name:e.name||"clip_"+n.animations.length,samplers:s,channels:a}),n.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,n=this.nodeMap,r=t.nodes[n.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,n),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:n.get(a)}),r.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,n,r=this.json,i=this.options,a=this.nodeMap,s=(r.nodes||(r.nodes=[]),{});if(e=i.myOptions.helper.parseNode({object:e,nodeDef:s,options:this}),i.trs?(n=e.quaternion.toArray(),h=e.position.toArray(),t=e.scale.toArray(),Q(n,[0,0,0,1])||(s.rotation=n),Q(h,[0,0,0])||(s.translation=h),Q(t,[1,1,1])||(s.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===Q(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!==(n=this.processMesh(e))&&(s.mesh=n):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=r.nodes.push(s)-1;return a.set(e,h),h}},{key:"processScene",value:function(e){for(var t=this.json,n=this.options,r=(t.scenes||(t.scenes=[],t.scene=0),{}),i=(""!==e.name&&(r.name=e.name),t.scenes.push(r),[]),a=0,s=e.children.length;a<s;a++){var o=e.children[a];o.userData.isTemp||!o.visible&&!1!==n.onlyVisible||null!==(o=this.processNode(o))&&i.push(o)}0<i.length&&(r.nodes=i),this.serializeUserData(e,r)}},{key:"processObjects",value:function(e){var t=new o.Scene;t.name="AuxScene";for(var n=0;n<e.length;n++)t.children.push(e[n]);this.processScene(t)}},{key:"processInput",value:function(e){for(var t,n,r=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"===r.myOptions.helper.type&&((n=new o.Group).name="glb_model",n.add(t),t=n),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<r.animations.length;++l)this.processAnimation(r.animations[l],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}},{key:"_invokeAll",value:function(e){for(var t=0,n=this.plugins.length;t<n;t++)e(this.plugins[t])}}]),e}(),te=function(){function e(t){I(this,e),this.writer=t,this.name="KHR_lights_punctual"}return k(e,[{key:"writeNode",value:function(e,t){var n,r,i;e.isLight&&(e.isDirectionalLight||e.isPointLight||e.isSpotLight?(n=(i=this.writer).json,i=i.extensionsUsed,r={},e.name&&(r.name=e.name),r.color=e.color.toArray(),r.intensity=e.intensity,e.isDirectionalLight?r.type="directional":e.isPointLight?(r.type="point",0<e.distance&&(r.range=e.distance)):e.isSpotLight&&(r.type="spot",0<e.distance&&(r.range=e.distance),r.spot={},r.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,r.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),i[this.name]||(n.extensions=n.extensions||{},n.extensions[this.name]={lights:[]},i[this.name]=!0),(i=n.extensions[this.name].lights).push(r),t.extensions=t.extensions||{},t.extensions[this.name]={light:i.length-1}):console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e))}}]),e}(),ne=function(){function e(t){I(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){I(this,e),this.writer=t,this.name="KHR_materials_pbrSpecularGlossiness"}return k(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isGLTFSpecularGlossinessMaterial&&(r=(n=this.writer).extensionsUsed,i={},t.pbrMetallicRoughness.baseColorFactor&&(i.diffuseFactor=t.pbrMetallicRoughness.baseColorFactor),e.specular.toArray(a=[1,1,1],0),i.specularFactor=a,i.glossinessFactor=e.glossiness,t.pbrMetallicRoughness.baseColorTexture&&(i.diffuseTexture=t.pbrMetallicRoughness.baseColorTexture),e.specularMap&&(a={index:n.processTexture(e.specularMap)},n.applyTextureTransform(a,e.specularMap),i.specularGlossinessTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),ie=function(){function e(t){I(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return k(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&(r=(n=this.writer).extensionsUsed,(i={}).clearcoatFactor=e.clearcoat,e.clearcoatMap&&(a={index:n.processTexture(e.clearcoatMap)},n.applyTextureTransform(a,e.clearcoatMap),i.clearcoatTexture=a),i.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap&&(a={index:n.processTexture(e.clearcoatRoughnessMap)},n.applyTextureTransform(a,e.clearcoatRoughnessMap),i.clearcoatRoughnessTexture=a),e.clearcoatNormalMap&&(a={index:n.processTexture(e.clearcoatNormalMap)},n.applyTextureTransform(a,e.clearcoatNormalMap),i.clearcoatNormalTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),ae=function(){function e(t){I(this,e),this.writer=t,this.name="KHR_materials_transmission"}return k(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&0!==e.transmission&&(r=(n=this.writer).extensionsUsed,(i={}).transmissionFactor=e.transmission,e.transmissionMap&&(a={index:n.processTexture(e.transmissionMap)},n.applyTextureTransform(a,e.transmissionMap),i.transmissionTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),se=function(){function e(t){I(this,e),this.writer=t,this.name="KHR_materials_volume"}return k(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&0!==e.transmission&&(r=(n=this.writer).extensionsUsed,(i={}).thicknessFactor=e.thickness,e.thicknessMap&&(a={index:n.processTexture(e.thicknessMap)},n.applyTextureTransform(a,e.thicknessMap),i.thicknessTexture=a),i.attenuationDistance=e.attenuationDistance,i.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}();function oe(){oe=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=(p="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",i=p.asyncIterator||"@@asyncIterator",a=p.toStringTag||"@@toStringTag";function s(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(t){s=function(e,t,n){return e[t]=n}}function o(e,t,n,r){var i,a,s,o;return t=t&&t.prototype instanceof c?t:c,t=Object.create(t.prototype),r=new x(r||[]),t._invoke=(i=e,a=n,s=r,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 n=s.delegate;if(n&&(n=function e(t,n){var r=t.iterator[n.method];if(void 0===r){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=void 0,e(t,n),"throw"===n.method))return u;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}return"throw"===(r=l(r,t.iterator,n.arg)).type?(n.method="throw",n.arg=r.arg,n.delegate=null,u):(r=r.arg)?r.done?(n[t.resultName]=r.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,u):r:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,u)}(n,s),n)){if(n===u)continue;return n}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"===(n=l(i,a,s)).type){if(o=s.done?"completed":"suspendedYield",n.arg===u)continue;return{value:n.arg,done:s.done}}"throw"===n.type&&(o="completed",s.method="throw",s.arg=n.arg)}}),t}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=o;var u={};function c(){}function h(){}function d(){}var p,f,m=(s(p={},r,(function(){return this})),(f=(f=Object.getPrototypeOf)&&f(f(w([]))))&&f!==t&&n.call(f,r)&&(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 r;this._invoke=function(i,a){function s(){return new t((function(r,s){!function r(i,a,s,o){var u;if("throw"!==(i=l(e[i],e,a)).type)return(a=(u=i.arg).value)&&"object"==ue(a)&&n.call(a,"__await")?t.resolve(a.__await).then((function(e){r("next",e,s,o)}),(function(e){r("throw",e,s,o)})):t.resolve(a).then((function(e){u.value=e,s(u)}),(function(e){return r("throw",e,s,o)}));o(i.arg)}(i,a,r,s)}))}return r=r?r.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[r];if(i)return i.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return t=-1,(i=function r(){for(;++t<e.length;)if(n.call(e,t))return r.value=e[t],r.done=!1,r;return r.value=void 0,r.done=!0,r}).next=i}return{next: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,n,r,i,a){void 0===a&&(a=Promise);var s=new g(o(t,n,r,i),a);return e.isGeneratorFunction(n)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},v(m),s(m,a,"Generator"),s(m,r,(function(){return this})),s(m,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t,n=[];for(t in e)n.push(t);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=w,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(b),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(n,r){return s.type="throw",s.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;0<=i;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var o=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(o&&l){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(o){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;0<=r;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}var 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 n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),b(n),u}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var n,r,i=this.tryEntries[t];if(i.tryLoc===e)return"throw"===(n=i.completion).type&&(r=n.arg,b(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:w(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),u}},e}function le(e,t,n,r,i,a,s){try{var o=e[a](s),l=o.value}catch(e){return void n(e)}o.done?t(l):Promise.resolve(l).then(r,i)}function ue(e){return(ue="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 ce(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function he(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function de(e,t,n){t&&he(e.prototype,t),n&&he(e,n),Object.defineProperty(e,"prototype",{writable:!1})}F.Utils={insertKeyframe:function(e,t){var n,r=e.getValueSize(),i=new e.TimeBufferType(e.times.length+1),a=new e.ValueBufferType(e.values.length+r),s=e.createInterpolant(new e.ValueBufferType(r));if(0===e.times.length){i[0]=t;for(var o=0;o<r;o++)a[o]=0;n=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<.001)return 0;i[0]=t,i.set(e.times,1),a.set(s.evaluate(t),0),a.set(e.values,r),n=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<.001)return e.times.length-1;i[i.length-1]=t,i.set(e.times,0),a.set(e.values,0),a.set(s.evaluate(t),e.values.length),n=i.length-1}else for(var l=0;l<e.times.length;l++){if(Math.abs(e.times[l]-t)<.001)return l;if(e.times[l]<t&&e.times[l+1]>t){i.set(e.times.slice(0,l+1),0),i[l+1]=t,i.set(e.times.slice(l+1),l+2),a.set(e.values.slice(0,(l+1)*r),0),a.set(s.evaluate(t),(l+1)*r),a.set(e.values.slice((l+1)*r),(l+2)*r),n=l+1;break}}return e.times=i,e.values=a,n},mergeMorphTargetTracks:function(e,t){for(var n=[],r={},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)n.push(s);else{if(s.createInterpolant!==s.InterpolantFactoryMethodDiscrete&&s.createInterpolant!==s.InterpolantFactoryMethodLinear){if(s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),(s=s.clone()).setInterpolation(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===r[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,r[u.uuid]=d,n.push(d)}else{var m=s.createInterpolant(new s.ValueBufferType(1));d=r[u.uuid];for(var v=0;v<d.times.length;v++)d.values[v*c+h]=m.evaluate(d.times[v]);for(var g=0;g<s.times.length;g++){var y=this.insertKeyframe(d,s.times[g]);d.values[y*c+h]=s.values[g]}}}}return e.tracks=n,e}};var pe=function(){function e(){ce(this,e),this.pluginCallbacks=[],this.register((function(e){return new Me(e)})),this.register((function(e){return new Be(e)})),this.register((function(e){return new Ce(e)})),this.register((function(e){return new Te(e)})),this.register((function(e){return new _e(e)})),this.register((function(e){return new Ee(e)}))}return de(e,[{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,n,r){"object"===ue(n)&&(console.warn("THREE.GLTFExporter: parse() expects options as the fourth argument now."),r=n);for(var i=new Ae,a=[],s=0,o=this.pluginCallbacks.length;s<o;s++)a.push(this.pluginCallbacks[s](i));i.setPlugins(a),i.write(e,t,r).catch(n)}},{key:"parseAsync",value:function(e,t){var n=this;return new Promise((function(r,i){n.parse(e,r,i,t)}))}}]),e}(),fe=5121,me=5123,ve=(i=9728,j=9729,H=9984,N=9985,z=9986,V=9987,J=33071,Z=33648,K=10497,{}),ge=(ve[o.NearestFilter]=i,ve[o.NearestMipmapNearestFilter]=H,ve[o.NearestMipmapLinearFilter]=z,ve[o.LinearFilter]=j,ve[o.LinearMipmapNearestFilter]=N,ve[o.LinearMipmapLinearFilter]=V,ve[o.ClampToEdgeWrapping]=J,ve[o.RepeatWrapping]=K,ve[o.MirroredRepeatWrapping]=Z,{scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"});function ye(e,t){return e.length===t.length&&e.every((function(e,n){return e===t[n]}))}function be(e){return 4*Math.ceil(e/4)}function xe(e,t){var n=1<arguments.length&&void 0!==t?t:0,r=be(e.byteLength);if(r===e.byteLength)return e;var i=new Uint8Array(r);if(i.set(new Uint8Array(e)),0!==n)for(var a=e.byteLength;a<r;a++)i[a]=n;return i.buffer}var we=null;function Se(){return we=we||("undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"))}var Ae=function(){function e(){ce(this,e),this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}var t,n;return de(e,[{key:"setPlugins",value:function(e){this.plugins=e}},{key:"write",value:(t=oe().mark((function e(t,n,r){var i,a,s,o,l;return oe().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.options=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(t),e.next=5,Promise.all(this.pending);case 5:a=(s=this).buffers,i=s.json,r=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===r.binary?((o=new FileReader).readAsArrayBuffer(a),o.onloadend=function(){var e=xe(o.result),t=new DataView(new ArrayBuffer(8)),r=(t.setUint32(0,e.byteLength,!0),t.setUint32(4,5130562,!0),xe((r=JSON.stringify(i),(new TextEncoder).encode(r).buffer),32)),a=new DataView(new ArrayBuffer(8)),s=(a.setUint32(0,r.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+r.byteLength+t.byteLength+e.byteLength),u=(u.setUint32(8,l,!0),new Blob([s,a,r,t,e],{type:"application/octet-stream"})),c=new FileReader;c.readAsArrayBuffer(u),c.onloadend=function(){n(c.result)}}):i.buffers&&0<i.buffers.length?((l=new FileReader).readAsDataURL(a),l.onloadend=function(){var e=l.result;i.buffers[0].uri=e,n(i)}):n(i);case 15:case"end":return e.stop()}}),e,this)})),n=function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function s(e){le(a,r,i,s,o,"next",e)}function o(e){le(a,r,i,s,o,"throw",e)}s(void 0)}))},function(e,t,r){return n.apply(this,arguments)})},{key:"serializeUserData",value:function(e,t){if(0!==Object.keys(e.userData).length){var n=this.options,r=this.extensionsUsed;try{var i=JSON.parse(JSON.stringify(e.userData));if(n.includeCustomExtensions&&i.gltfExtensions){for(var a in void 0===t.extensions&&(t.extensions={}),i.gltfExtensions)t.extensions[a]=i.gltfExtensions[a],r[a]=!0;delete i.gltfExtensions}0<Object.keys(i).length&&(t.extras=i)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}}},{key:"getUID",value:function(e){return this.uids.has(e)||this.uids.set(e,this.uid++),this.uids.get(e)}},{key:"isNormalizedNormalAttribute",value:function(e){if(this.cache.attributesNormalized.has(e))return!1;for(var t=new o.Vector3,n=0,r=e.count;n<r;n++)if(5e-4<Math.abs(t.fromBufferAttribute(e,n).length()-1))return!1;return!0}},{key:"createNormalizedNormalAttribute",value:function(e){var t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);for(var n=e.clone(),r=new o.Vector3,i=0,a=n.count;i<a;i++)r.fromBufferAttribute(n,i),0===r.x&&0===r.y&&0===r.z?r.setX(1):r.normalize(),n.setXYZ(i,r.x,r.y,r.z);return t.attributesNormalized.set(e,n),n}},{key:"applyTextureTransform",value:function(e,t){var n=!1,r={};0===t.offset.x&&0===t.offset.y||(r.offset=t.offset.toArray(),n=!0),0!==t.rotation&&(r.rotation=t.rotation,n=!0),1===t.repeat.x&&1===t.repeat.y||(r.scale=t.repeat.toArray(),n=!0),n&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=r,this.extensionsUsed.KHR_texture_transform=!0)}},{key:"buildMetalRoughTexture",value:function(e,t){if(e===t)return e;console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures.");var n=null==e?void 0:e.image,r=null==t?void 0:t.image,i=Math.max((null==n?void 0:n.width)||0,(null==r?void 0:r.width)||0),a=Math.max((null==n?void 0:n.height)||0,(null==r?void 0:r.height)||0),s=Se(),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(n){l.drawImage(n,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(r){l.drawImage(r,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),(n=(e||t).clone()).source=new o.Source(s),n}},{key:"processBuffer",value:function(e){var t=this.json,n=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),n.push(e),0}},{key:"processBufferView",value:function(e,t,n,r,i){for(var a,s=this.json,o=(s.bufferViews||(s.bufferViews=[]),a=t===fe?1:t===me?2:4,be(r*e.itemSize*a)),l=new DataView(new ArrayBuffer(o)),u=0,c=n;c<n+r;c++)for(var h=0;h<e.itemSize;h++){var d=void 0;4<e.itemSize?d=e.array[c*e.itemSize+h]:0===h?d=e.getX(c):1===h?d=e.getY(c):2===h?d=e.getZ(c):3===h&&(d=e.getW(c)),5126===t?l.setFloat32(u,d,!0):5125===t?l.setUint32(u,d,!0):t===me?l.setUint16(u,d,!0):t===fe&&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,n=t.json;return n.bufferViews||(n.bufferViews=[]),new Promise((function(r){var i=new FileReader;i.readAsArrayBuffer(e),i.onloadend=function(){var e=xe(i.result),a={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,r(n.bufferViews.push(a)-1)}}))}},{key:"processAccessor",value:function(e,t,n,r){var i,a=this.options,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=me;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");i=fe}if(void 0===n&&(n=0),void 0===r&&(r=e.count),a.truncateDrawRange&&void 0!==t&&null===t.index&&(a=n+r,l=t.drawRange.count===1/0?e.count:t.drawRange.start+t.drawRange.count,n=Math.max(n,t.drawRange.start),(r=Math.min(a,l)-n)<0&&(r=0)),0===r)return null;a=function(e,t,n){for(var r={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},i=t;i<t+n;i++)for(var a=0;a<e.itemSize;a++){var 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)),r.min[a]=Math.min(r.min[a],s),r.max[a]=Math.max(r.max[a],s)}return r}(e,n,r);var o,l=(void 0!==t&&(o=e===t.index?34963:34962),this.processBufferView(e,i,n,r,o));return t={bufferView:l.id,byteOffset:l.byteOffset,componentType:i,count:r,max:a.max,min:a.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]},!0===e.normalized&&(t.normalized=!0),s.accessors||(s.accessors=[]),s.accessors.push(t)-1}},{key:"processImage",value:function(e,t,n){var r=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),r+":flipY/"+n.toString());if(void 0!==a[c])return a[c];s.images||(s.images=[]);var h={mimeType:r};if(l.embedImages){var d=Se(),p=(d.width=Math.min(e.width,l.maxTextureSize),d.height=Math.min(e.height,l.maxTextureSize),d.getContext("2d"));if(!0===n&&(p.translate(0,d.height),p.scale(1,-1)),void 0!==e.data){t!==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?(n=void 0!==d.toBlob?new Promise((function(e){return d.toBlob(e,r)})):d.convertToBlob({type:r}),u.push(n.then((function(e){return i.processBufferViewImage(e).then((function(e){h.bufferView=e}))})))):h.uri=d.toDataURL(r)}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:ve[e.magFilter],minFilter:ve[e.minFilter],wrapS:ve[e.wrapS],wrapT:ve[e.wrapT]},t.samplers.push(e)-1}},{key:"processTexture",value:function(e){var t=this.cache,n=this.json;if(t.textures.has(e))return t.textures.get(e);n.textures||(n.textures=[]);var r=("image/webp"===(i=e.userData.mimeType)&&(i="image/png"),{sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,i)}),i=(e.name&&(r.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,r)})),n.textures.push(r)-1);return t.textures.set(e,i),i}},{key:"processMaterial",value:function(e){var t=this.cache,n=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;n.materials||(n.materials=[]);var r={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=(ye(i,[1,1,1,1])||(r.pbrMetallicRoughness.baseColorFactor=i),e.isMeshStandardMaterial?(r.pbrMetallicRoughness.metallicFactor=e.metalness,r.pbrMetallicRoughness.roughnessFactor=e.roughness):(r.pbrMetallicRoughness.metallicFactor=.5,r.pbrMetallicRoughness.roughnessFactor=.5),(e.metalnessMap||e.roughnessMap)&&(i=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),a={index:this.processTexture(i)},this.applyTextureTransform(a,i),r.pbrMetallicRoughness.metallicRoughnessTexture=a),e.map&&(i={index:this.processTexture(e.map)},this.applyTextureTransform(i,e.map),r.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&&(r.emissiveFactor=a.toArray()),e.emissiveMap&&(i={index:this.processTexture(e.emissiveMap)},this.applyTextureTransform(i,e.emissiveMap),r.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),r.normalTexture=a),e.aoMap&&(i={index:this.processTexture(e.aoMap),texCoord:1},1!==e.aoMapIntensity&&(i.strength=e.aoMapIntensity),this.applyTextureTransform(i,e.aoMap),r.occlusionTexture=i),e.transparent?r.alphaMode="BLEND":0<e.alphaTest&&(r.alphaMode="MASK",r.alphaCutoff=e.alphaTest),e.side===o.DoubleSide&&(r.doubleSided=!0),""!==e.name&&(r.name=e.name),this.serializeUserData(e,r),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,r)})),n.materials.push(r)-1);return t.materials.set(e,a),a}},{key:"processMesh",value:function(e){var t=this.cache,n=this.json,r=[e.geometry.uuid];if(Array.isArray(e.material))for(var i=0,a=e.material.length;i<a;i++)r.push(e.material[i].uuid);else r.push(e.material.uuid);var s=r.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],L=y?l.groups:[{materialIndex:0,start:void 0,count:void 0}],k=0,F=L.length;k<F;k++){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===L[k].start&&void 0===L[k].count||(G+=":"+L[k].start+":"+L[k].count),t.attributes.has(G)?U.indices=t.attributes.get(G):(U.indices=this.processAccessor(l.index,l,L[k].start,L[k].count),t.attributes.set(G,U.indices)),null===U.indices&&delete U.indices),this.processMaterial(I[L[k].materialIndex]));null!==G&&(U.material=G),m.push(U)}return p.primitives=m,n.meshes||(n.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,p)})),y=n.meshes.push(p)-1,t.meshes.set(s,y),y}},{key:"processCamera",value:function(e){var t=this.json,n=(t.cameras||(t.cameras=[]),e.isOrthographicCamera),r={type:n?"orthographic":"perspective"};return n?r.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:r.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&&(r.name=e.type),t.cameras.push(r)-1}},{key:"processAnimation",value:function(e,t){for(var n=this.json,r=this.nodeMap,i=(n.animations||(n.animations=[]),(e=pe.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=ge[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===ge.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:r.get(h),path:d}})}return n.animations.push({name:e.name||"clip_"+n.animations.length,samplers:s,channels:a}),n.animations.length-1}},{key:"processSkin",value:function(e){var t=this.json,n=this.nodeMap,r=t.nodes[n.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(n.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:n.get(a)}),r.skin=t.skins.length-1}},{key:"processNode",value:function(e){var t,n,r=this.json,i=this.options,a=this.nodeMap,s=(r.nodes||(r.nodes=[]),{});if(i.trs?(n=e.quaternion.toArray(),h=e.position.toArray(),t=e.scale.toArray(),ye(n,[0,0,0,1])||(s.rotation=n),ye(h,[0,0,0])||(s.translation=h),ye(t,[1,1,1])||(s.scale=t)):(e.matrixAutoUpdate&&e.updateMatrix(),!1===ye(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!==(n=this.processMesh(e))&&(s.mesh=n):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=r.nodes.push(s)-1;return a.set(e,h),h}},{key:"processScene",value:function(e){for(var t=this.json,n=this.options,r=(t.scenes||(t.scenes=[],t.scene=0),{}),i=(""!==e.name&&(r.name=e.name),t.scenes.push(r),[]),a=0,s=e.children.length;a<s;a++){var o=e.children[a];!o.visible&&!1!==n.onlyVisible||null!==(o=this.processNode(o))&&i.push(o)}0<i.length&&(r.nodes=i),this.serializeUserData(e,r)}},{key:"processObjects",value:function(e){var t=new o.Scene;t.name="AuxScene";for(var n=0;n<e.length;n++)t.children.push(e[n]);this.processScene(t)}},{key:"processInput",value:function(e){for(var t=this.options,n=(e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)})),[]),r=0;r<e.length;r++)e[r]instanceof o.Scene?this.processScene(e[r]):n.push(e[r]);0<n.length&&this.processObjects(n);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,n=this.plugins.length;t<n;t++)e(this.plugins[t])}}]),e}(),Me=function(){function e(t){ce(this,e),this.writer=t,this.name="KHR_lights_punctual"}return de(e,[{key:"writeNode",value:function(e,t){var n,r,i;e.isLight&&(e.isDirectionalLight||e.isPointLight||e.isSpotLight?(n=(i=this.writer).json,i=i.extensionsUsed,r={},e.name&&(r.name=e.name),r.color=e.color.toArray(),r.intensity=e.intensity,e.isDirectionalLight?r.type="directional":e.isPointLight?(r.type="point",0<e.distance&&(r.range=e.distance)):e.isSpotLight&&(r.type="spot",0<e.distance&&(r.range=e.distance),r.spot={},r.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,r.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),i[this.name]||(n.extensions=n.extensions||{},n.extensions[this.name]={lights:[]},i[this.name]=!0),(i=n.extensions[this.name].lights).push(r),t.extensions=t.extensions||{},t.extensions[this.name]={light:i.length-1}):console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e))}}]),e}(),Be=function(){function e(t){ce(this,e),this.writer=t,this.name="KHR_materials_unlit"}return de(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}(),Ce=function(){function e(t){ce(this,e),this.writer=t,this.name="KHR_materials_pbrSpecularGlossiness"}return de(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isGLTFSpecularGlossinessMaterial&&(r=(n=this.writer).extensionsUsed,i={},t.pbrMetallicRoughness.baseColorFactor&&(i.diffuseFactor=t.pbrMetallicRoughness.baseColorFactor),e.specular.toArray(a=[1,1,1],0),i.specularFactor=a,i.glossinessFactor=e.glossiness,t.pbrMetallicRoughness.baseColorTexture&&(i.diffuseTexture=t.pbrMetallicRoughness.baseColorTexture),e.specularMap&&(a={index:n.processTexture(e.specularMap)},n.applyTextureTransform(a,e.specularMap),i.specularGlossinessTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),Ee=function(){function e(t){ce(this,e),this.writer=t,this.name="KHR_materials_clearcoat"}return de(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&(r=(n=this.writer).extensionsUsed,(i={}).clearcoatFactor=e.clearcoat,e.clearcoatMap&&(a={index:n.processTexture(e.clearcoatMap)},n.applyTextureTransform(a,e.clearcoatMap),i.clearcoatTexture=a),i.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap&&(a={index:n.processTexture(e.clearcoatRoughnessMap)},n.applyTextureTransform(a,e.clearcoatRoughnessMap),i.clearcoatRoughnessTexture=a),e.clearcoatNormalMap&&(a={index:n.processTexture(e.clearcoatNormalMap)},n.applyTextureTransform(a,e.clearcoatNormalMap),i.clearcoatNormalTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),Te=function(){function e(t){ce(this,e),this.writer=t,this.name="KHR_materials_transmission"}return de(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&0!==e.transmission&&(r=(n=this.writer).extensionsUsed,(i={}).transmissionFactor=e.transmission,e.transmissionMap&&(a={index:n.processTexture(e.transmissionMap)},n.applyTextureTransform(a,e.transmissionMap),i.transmissionTexture=a),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),_e=function(){function e(t){ce(this,e),this.writer=t,this.name="KHR_materials_volume"}return de(e,[{key:"writeMaterial",value:function(e,t){var n,r,i,a;e.isMeshPhysicalMaterial&&0!==e.transmission&&(r=(n=this.writer).extensionsUsed,(i={}).thicknessFactor=e.thickness,e.thicknessMap&&(a={index:n.processTexture(e.thicknessMap)},n.applyTextureTransform(a,e.thicknessMap),i.thicknessTexture=a),i.attenuationDistance=e.attenuationDistance,i.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=i,r[this.name]=!0)}}]),e}(),De=(pe.Utils={insertKeyframe:function(e,t){var n,r=e.getValueSize(),i=new e.TimeBufferType(e.times.length+1),a=new e.ValueBufferType(e.values.length+r),s=e.createInterpolant(new e.ValueBufferType(r));if(0===e.times.length){i[0]=t;for(var o=0;o<r;o++)a[o]=0;n=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<.001)return 0;i[0]=t,i.set(e.times,1),a.set(s.evaluate(t),0),a.set(e.values,r),n=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<.001)return e.times.length-1;i[i.length-1]=t,i.set(e.times,0),a.set(e.values,0),a.set(s.evaluate(t),e.values.length),n=i.length-1}else for(var l=0;l<e.times.length;l++){if(Math.abs(e.times[l]-t)<.001)return l;if(e.times[l]<t&&e.times[l+1]>t){i.set(e.times.slice(0,l+1),0),i[l+1]=t,i.set(e.times.slice(l+1),l+2),a.set(e.values.slice(0,(l+1)*r),0),a.set(s.evaluate(t),(l+1)*r),a.set(e.values.slice((l+1)*r),(l+2)*r),n=l+1;break}}return e.times=i,e.values=a,n},mergeMorphTargetTracks:function(e,t){for(var n=[],r={},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)n.push(s);else{if(s.createInterpolant!==s.InterpolantFactoryMethodDiscrete&&s.createInterpolant!==s.InterpolantFactoryMethodLinear){if(s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),(s=s.clone()).setInterpolation(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===r[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,r[u.uuid]=d,n.push(d)}else{var m=s.createInterpolant(new s.ValueBufferType(1));d=r[u.uuid];for(var v=0;v<d.times.length;v++)d.values[v*c+h]=m.evaluate(d.times[v]);for(var g=0;g<s.times.length;g++){var y=this.insertKeyframe(d,s.times[g]);d.values[y*c+h]=s.values[g]}}}}return e.tracks=n,e}},n(272));class Pe{constructor(e){this.map=new De.Z,this.loadMap=new B.Z,this.exportMap=new B.Z,this.runScene=e,this.loadMap}bind(e){this.processMap(e),this.map.add(e)}processMap(e){e.loadCallBacks.map(((e,t)=>{let n=this.loadMap.get(e);n||(n=new De.Z,this.loadMap.set(e,n)),n.add(t)})),e.exportCallBacks.map(((e,t)=>{let n=this.exportMap.get(e);n||(n=new De.Z,this.exportMap.set(e,n)),n.add(t)}))}loadCallback(e){const{type:t,json:n,data:r,config:i,core:a}=e;return null==(e=this.loadMap.get(t))?void 0:e.map((e=>e({json:n,data:r,config:i,core:a})))}}var Oe=n(625),Re=n(330),Ie=n(269),Le=n(110),ke=n(932),Fe=n(736),Ue=n(723);class Ge{constructor(e){this.materialMap={},this.textureMap={},this.modelType={Sprite:Le.Z},this.geoDefMaterialMap=new B.Z;var{type:e,runScene:t,helper:n}=e;this.type=e,this.helper=n,this.runScene=t}parse(e){var t=this.createTextureGroup(e);"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,Oe.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(),n=this.runScene.assetsEx.get().controls,r=this.runScene.optionsEx.exporterOptions.outTime,i=this.runScene.sceneEx.envStrength;return{version:{core:"0.0.78",editor:"0.0.2"},base64:(0,Ue.Ni)(String(r)),lights:Ie.ZP.toJSON(this.runScene.lightEx.getLightsByScene()),camera:b.Z.toJSON(this.runScene),sceneEx:Object.assign(Object.assign({},Fe.ZP.toJSON(t,this.runScene)),this._bindSceneTextures(e)),timeLine:this.runScene.timeLineEx.getSavedData(),envStrength:i,controls:A.toJSON(n),objects:this.runScene.objects.toJSON(),tags:this.runScene.tags.toJSON(),options:this.runScene.exporter.gltf.options.getOptions(t)}}_bindSceneTextures(e){var t=this.runScene.sceneEx.get();const n={};if((0,Oe.isTexture)(t.background)||(0,Oe.isTexture)(t.environment)){this.runScene.pp.setUpdate(!1);const{background:r,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,n.materialId=t;let o=[];(0,Oe.isTexture)(r)&&(r.userData.notCompress=!0,o.push({type:"map",texture:r}),303===(s.map=r).mapping&&(n.backgroundMapping=303)),(0,Oe.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 n}compressLocal(e){var{x:t,y:n,z:r}=e.position;0===t&&0===n&&0===r||(e.position.set(0,0,0),e.userData.local=t+","+n+","+r)}parseModel(e){const t=new Set;e.traverse((e=>t.add(e))),t.forEach((e=>{this._processMaterial(e),this._processModel(e)}))}_processModel(e){var t;(0,d.withAnima)(e)&&(t=e.animations.map((e=>e.toJSON())),(0,Fe.M)(e,"animations",t));let n=e;const r=this.modelType[e.type];r&&(t=r.modelTools.toNormal(e),e.parent.add(t),e.parent.remove(e),n=t),this.runScene.optionsEx.options.hideLocal&&this.compressLocal(n)}_processMaterial(e){if((0,ke.isMaterial)(e.material)){const r=this.materialMap[e.material.userData.id];if(r)return r.normalMaterial&&(e.material=r.normalMaterial),void r.models.push(e);var t=this.runScene.materialEx.isBaseMaterial(e.material),n=e.material;const{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=n.userData.id,i.userData.id=t,this.materialMap[t]={oldMaterial:n,normalMaterial:i,models:[e],normal:a,textures:s}}}materialMapToJson(){(0,s.mapObj)(this.materialMap,((e,t)=>{var{normalMaterial:t,textures:n,normal:r}=t,i=t.userData.id;this.helper.ex.materialMap[i]||(this.helper.ex.materialMap[i]={normal:r,textures:{}},this.mergeAndRemoveTexture(n,t))}))}mergeSame(e){e.userData||(e.userData={});var t=e.userData;if((0,Oe.isClonedTexture)(e))e=this.parseCloneTexture(e);else for(const a in this.textureMap){var n=this.textureMap[a],{md5:r,texture:i}=n;if(t.md5===r&&e.mapping===i.mapping&&!(0,Oe.isClonedTexture)(n.texture))return{isSame:!0,texture:i}}return this.textureMap[e.userData.id]=Object.assign(Object.assign({},t),{texture:e}),{isSame:!1,texture:e}}parseTexture(e){var t,{format:n,repeat:r,center:i,rotation:a,offset:s}=e;const o={format:n};this.runScene.modelEx.isNavieV2(r,1)||(({x:n,y:t}=r),o.repeat=n===t?n:r),this.runScene.modelEx.isNavieV2(i,0)||(({x:t,y:n}=i),o.center=t===n?t:i),this.runScene.modelEx.isNavieV2(s,0)||(({x:r,y:n}=s),o.offset=r===n?r:s),0!==a&&(o.rotation=a),this.helper.ex.textureMap[e.userData.id]=o}mergeAndRemoveTexture(e,t){return function(e,t,n,r){return new(n=n||Promise)((function(t,i){function a(e){try{o(r.next(e))}catch(e){i(e)}}function s(e){try{o(r.throw(e))}catch(e){i(e)}}function o(e){var r;e.done?t(e.value):((r=e.value)instanceof n?r:new n((function(e){e(r)}))).then(a,s)}o((r=r.apply(e,[])).next())}))}(this,0,void 0,(function*(){return e.map((e=>{var{type:e,texture:n}=e;this.runScene.uniqueEx.texture.add(n),t[e]=null;const r=this.mergeSame(n).texture;this.helper.ex.textureMap[r.userData.id]||this.parseTexture(r),"normalMap"!==e||r.userData.isNormalMap||(r.userData.isNormalMap=!0),this.helper.ex.materialMap[t.userData.id].textures[e]=r.userData.id}))}))}parseCloneTexture(e){const t=e.clone();t.userData=Object.assign({},e.userData);var{width:e,height:n}=e.image;const r=document.createElement("canvas");return r.width=e,r.height=n,t.image=r,t.userData.blob=new Blob([]),t}setMultipMaterial(e,t){const n=this.runScene.modelEx.create(),r=(0,ke.createDefMaterial)();n.material=r,e.add(n);for(const e of Re.sG){if(!t.length)return;var i=t.pop();if(!i)return;r[e]=this.textureMap[i].texture}t.length&&this.setMultipMaterial(e,t)}getMaterialFromModel(e){return e&&e.geometry?(e=e.geometry.uuid,this.geoDefMaterialMap.get(e)||this.geoDefMaterialMap.set(e,(0,ke.createDefMaterial)()),{material:this.geoDefMaterialMap.get(e),normal:{},textures:[]}):{material:this.runScene.materialEx.defMaterial,normal:{},textures:[]}}}var Ne=n(729);class je extends l{constructor(){super(...arguments),this.savedMap=new B.Z,this.clonedMap=new B.Z}getSameNode(e){return this.savedMap.find(((t,n)=>n.materialUuid===e.material.uuid&&n.geometryUuid===e.geometry.uuid))}parseUnClonedModel(e){var t,n=(0,Ne.Ki)(e);e.material&&e.geometry&&((t=this.getSameNode(e))&&(0,d.setClonedModel)(e,t.id),this.savedMap.set(n,{id:n,geometryUuid:e.geometry.uuid,materialUuid:e.material.uuid}))}parseClonedModel(e){var t=(0,d.getClonedIdModel)(e),n=(0,Ne.Ki)(e);this.clonedMap.get(t)||this.clonedMap.set(t,{newId:void 0,ids:new Set});const r=this.clonedMap.get(t);r&&(r.ids.add(n),r.newId||this.runScene.uniqueEx.model.get(t)||(t=(0,Ne.Ki)(e),r.newId=t),r.newId&&(r.newId!==n?(0,d.setClonedModel)(e,r.newId):(0,d.delClonedModel)(e)))}parseNode(e){(0,d.getClonedIdModel)(e)?this.parseClonedModel(e):this.parseUnClonedModel(e)}}class ze{constructor(){this.savedMap=new B.Z}getSameCount(e){return this.savedMap.filter(((t,n)=>n.geometry.attributes.normal.count===e),"value")}setSameNode(e,t){e.geometry=t}getSameGeo(e,t){var{normal:n,position:r,uv:i}=e.attributes;for(const e of t){var{normal:a,position:s,uv:o}=e.attributes;if(n.array.length===a.array.length&&r.array.length===s.array.length&&i.array.length===o.array.length&&(a=(0,Ue.F1)([...n.array],[...a.array],20),s=(0,Ue.F1)([...r.array],[...s.array],20),o=(0,Ue.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,n=(n=t.attributes.normal).count;const i=this.getSameCount(n);if(i){var r=this.getSameGeo(t,i.map((e=>e.geometry)));if(r)return this.setSameNode(e,r)}this.savedMap.set(t.uuid,{count:n,geometry:t})}}}class He{constructor(){this.optionsConfigs={}}getParse(e){return this.optionsConfigs[e]}addOption(e){var t=e.type;if(this.optionsConfigs[t])throw TypeError("该配置项已被挂载");this.optionsConfigs[t]=e}getOptions(e){return Object.values(this.optionsConfigs).map((t=>{const{process:n,type:r}=t;return{type:r,data:n(e)}}))}}class Ve{constructor(e){this.helperModels=[],this.mergeSameGeo=new ze;var{type:e,runScene:t,model:n}=e;this.runScene=t,this.type=e,this.bindClondId=new je(t),this.ex={materialMap:{},textureMap:{},type:e},this.before=new Ge({helper:this,type:e,runScene:t}),this.before.parse(n)}parseNode(e){let{object:t,nodeDef:n}=e;return this.mergeSameGeo.parseNode(t),this.bindClondId.parseNode(t),(0,s.mapObj)(this.runScene.modelEx.defNodeMap,((e,r)=>{t[e]!==r&&(n[e]=t[e])})),t.material&&t.material.wireframe&&(t.material.wireframe=!1,n.wireframe=!0),e=((null==(e=t.userData)?void 0:e.normal)||{}).type,t=e?this.runScene.modelEx.import.nodeType[e].modelTools.toNormal(t,this.runScene):t}parseMaterial(e){const{material:t,materialDef:n}=e;n.id=t.userData.id,this.ex.materialMap[t.userData.id]||(this.ex.materialMap[t.userData.id]={normal:{},textures:{}}),this.ex.materialMap[t.userData.id].normal=Object.assign(Object.assign({},this.ex.materialMap[t.userData.id].normal),this.runScene.materialEx.getDefNromals(t))}parseTexture(e){const{texture:t,textureDef:n}=e;var{notCompress:e,minFilter:r}=t.userData,{width:e,height:r}=(e&&(n.notCompress=!0),n.unDelAble=t.userData.unDelAble,n.uvScript=t.userData.uvScript,n.md5=t.userData.md5,n.id=t.userData.id,r&&(n.minFilter=r),(0,Oe.isClonedTexture)(t)&&(n.cloneSourceId=(0,Oe.getCloneIdFromTexture)(t)),n.format=t.userData.format,(0,Oe.getSizeByTexture)(t));n.size={w:e,h:r}}getNodeMapValueWithBone(e,t){for(const n of t.keys())if(n.userData.id===e.userData.id)return t.get(n)}done(e){e.asset.ex=this.ex,this.runScene.optionsEx.log([e,"json"]),this.runScene.cb.exporter.gltf.complete.cb({json:e})}}var Je=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}))};class Ke extends l{constructor(e){super(e),this._gltf=new F,this._originGltf=new pe,this.options=new He,this.module=new Pe(e)}getArrayBuffer(e=this.runScene.sceneEx.getClear(),t){return Je(this,void 0,void 0,(function*(){const n=new Ve({type:t,runScene:this.runScene,model:e});return new Promise((t=>{this._gltf.parse(e,(e=>{t(e)}),{binary:!0,onlyVisible:!1,includeCustomExtensions:!0,myOptions:{helper:n,optionsEx:this.runScene.optionsEx}})}))}))}getOriginArrayBuffer(e){return Je(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 Je(this,void 0,void 0,(function*(){let n=e||this.runScene.modelEx.select,r=[];if(0!==(r=n?[n]:this.runScene.multipSelector.getSelectedList("value")).length){var i=(n=r[0]).name||n.type;const e=new o.Group;e.name="models",d.uselessGroup.set(e,!0),r.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 Je(this,void 0,void 0,(function*(){if(n=e||(null==(t=this.runScene.modelEx.select)?void 0:t.material)){const e=(0,d.createDefModel)("Group");let t=n;(t=n instanceof Array?t:[n]).map((t=>{const n=(0,d.createDefModel)("Box");n.material=t,e.add(n)}));var n=n.name||"material",r=yield this.getArrayBuffer(e,"material");(0,s.downloadFile)(new Blob([r]),n+".glb")}}))}scene(e=!0,t="scene"){return Je(this,void 0,void 0,(function*(){this.runScene.cb.exporter.gltf.before.cb(null);var n=yield this.getArrayBuffer(this.runScene.sceneEx.getClear(),t);return e&&(0,s.downloadFile)(new Blob([n]),"scene.glb"),n}))}originModel(e){return Je(this,void 0,void 0,(function*(){var t,n;e&&(t=e.name||e.type,n=yield this.getOriginArrayBuffer(e),(0,s.downloadFile)(new Blob([n]),t+".glb"))}))}}class Ze extends l{constructor(e){super(e),this.gltf=new Ke(e)}}var We={},Xe=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},Qe=function(e){return new Worker(e)};try{URL.revokeObjectURL(Xe(""))}catch(n){Xe=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)},Qe=function(e){return new Worker(e,{type:"module"})}}for(var Ye=Uint8Array,qe=Uint16Array,$e=Uint32Array,et=new Ye([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]),tt=new Ye([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]),nt=new Ye([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 n=new qe(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new $e(n[30]);for(r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return[n,i]},(H=i(et,2))[0]),it=H[1],at=(rt[28]=258,it[258]=28,z=i(tt,0))[0],st=z[1],ot=new qe(32768),lt=0;lt<32768;++lt){var ut=(43690&lt)>>>1|(21845&lt)<<1;ot[lt]=((65280&(ut=(61680&(ut=(52428&ut)>>>2|(13107&ut)<<2))>>>4|(3855&ut)<<4))>>>8|(255&ut)<<8)>>>1}var ct=function(e,t,n){for(var r=e.length,i=0,a=new qe(t);i<r;++i)++a[e[i]-1];var s=new qe(t);for(i=0;i<t;++i)s[i]=s[i-1]+a[i-1]<<1;if(n){var o=new qe(1<<t),l=15-t;for(i=0;i<r;++i)if(e[i])for(var u=i<<4|e[i],c=t-e[i],h=s[e[i]-1]++<<c,d=h|(1<<c)-1;h<=d;++h)o[ot[h]>>>l]=u}else for(o=new qe(r),i=0;i<r;++i)e[i]&&(o[i]=ot[s[e[i]-1]++]>>>15-e[i]);return o},ht=new Ye(288);for(lt=0;lt<144;++lt)ht[lt]=8;for(lt=144;lt<256;++lt)ht[lt]=9;for(lt=256;lt<280;++lt)ht[lt]=7;for(lt=280;lt<288;++lt)ht[lt]=8;var dt=new Ye(32);for(lt=0;lt<32;++lt)dt[lt]=5;function pt(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 ft(e,t,n,r,i){var a,s=Vt(e,r,i,(function(e,n){e?(s.terminate(),t.ondata.call(t,e)):(n[1]&&s.terminate(),t.ondata.call(t,e,n[0],n[1]))}));s.postMessage(n),t.push=function(e,n){if(a)throw"stream finished";if(!t.ondata)throw"no stream handler";s.postMessage([e,a=n],[e.buffer])},t.terminate=function(){s.terminate()}}function mt(e,t){return tn(e,t)+4294967296*tn(e,t+4)}var vt=ct(ht,9,0),gt=ct(ht,9,1),yt=ct(dt,5,0),bt=ct(dt,5,1),xt=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},wt=function(e,t,n){var r=t/8|0;return(e[r]|e[1+r]<<8)>>(7&t)&n},St=function(e,t){var n=t/8|0;return(e[n]|e[1+n]<<8|e[2+n]<<16)>>(7&t)},At=function(e){return(e/8|0)+(7&e&&1)},Mt=function(e,t,n){(null==n||n>e.length)&&(n=e.length);var r=new(e instanceof qe?qe:e instanceof $e?$e:Ye)(n-(t=null==t||t<0?0:t));return r.set(e.subarray(t,n)),r},Bt=function(e,t,n){var r=e.length;if(!r||n&&!n.l&&r<5)return t||new Ye(0);function i(e){var n=t.length;n<e&&((n=new Ye(Math.max(2*n,e))).set(t),t=n)}var a=!t||n,s=!n||n.i,o=(n=n||{},t=t||new Ye(3*r),n.f||0),l=n.p||0,u=n.b||0,c=n.l,h=n.d,d=n.m,p=n.n,f=8*r;do{if(!c){n.f=o=wt(e,l,1);var m=wt(e,l+1,3);if(l+=3,!m){var v=e[(B=At(l)+4)-4]|e[B-3]<<8;if(r<(S=B+v)){if(s)throw"unexpected EOF";break}a&&i(u+v),t.set(e.subarray(B,S),u),n.b=u+=v,n.p=l=8*S;continue}if(1==m)c=gt,h=bt,d=9,p=5;else{if(2!=m)throw"invalid block type";v=wt(e,l,31)+257;for(var g=wt(e,l+10,15)+4,y=v+wt(e,l+5,31)+1,b=(l+=14,new Ye(y)),x=new Ye(19),w=0;w<g;++w)x[nt[w]]=wt(e,l+3*w,7);l+=3*g;var S,A=(1<<(S=xt(x)))-1,M=ct(x,S,1);for(w=0;w<y;){var B,C=M[wt(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+wt(e,l,3),l+=2,E=b[w-1]):17==B?(T=3+wt(e,l,7),l+=3):18==B&&(T=11+wt(e,l,127),l+=7);T--;)b[w++]=E}}m=b.subarray(0,v);var _=b.subarray(v);d=xt(m),p=xt(_),c=ct(m,d,1),h=ct(_,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[St(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,L=R-254,k=(264<R&&(I=et[w=R-257],L=wt(e,l,(1<<I)-1)+rt[w],l+=I),(R=h[St(e,l)&P])>>>4);if(!R)throw"invalid distance";if(l+=15&R,_=at[k],3<k&&(I=tt[k],_+=St(e,l)&(1<<I)-1,l+=I),f<l){if(s)throw"unexpected EOF";break}a&&i(u+131072);for(var F=u+L;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}}n.l=c,n.p=O,n.b=u,c&&(o=1,n.m=d,n.d=h,n.n=p)}while(!o);return u==t.length?t:Mt(t,0,u)},Ct=function(e,t,n){var r=t/8|0;e[r]|=n<<=7&t,e[1+r]|=n>>>8},Et=function(e,t,n){var r=t/8|0;e[r]|=n<<=7&t,e[1+r]|=n>>>8,e[2+r]|=n>>>16},Tt=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return[Lt,0];if(1==i)return(m=new Ye(n[0].s+1))[n[0].s]=1,[m,1];n.sort((function(e,t){return e.f-t.f})),n.push({s:-1,f:25001});var s=n[0],o=n[1],l=0,u=1,c=2;for(n[0]={s:-1,f:s.f+o.f,l:s,r:o};u!=i-1;)s=n[n[l].f<n[c].f?l++:c++],o=n[l!=u&&n[l].f<n[c].f?l++:c++],n[u++]={s:-1,f:s.f+o.f,l:s,r:o};var h=a[0].s;for(r=1;r<i;++r)a[r].s>h&&(h=a[r].s);var d=new qe(h+1),p=_t(n[u-1],d,0);if(t<p){r=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}));r<i;++r){var g=a[r].s;if(!(d[g]>t))break;f+=v-(1<<p-d[g]),d[g]=t}for(f>>>=m;0<f;){var y=a[r].s;d[y]<t?f-=1<<t-d[y]++-1:++r}for(;0<=r&&f;--r){var b=a[r].s;d[b]==t&&(--d[b],++f)}p=t}return[new Ye(d),p]},_t=function e(t,n,r){return-1==t.s?Math.max(e(t.l,n,r+1),e(t.r,n,r+1)):n[t.s]=r},Dt=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new qe(++t),r=0,i=e[0],a=1,s=function(e){n[r++]=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[n.subarray(0,r),t]},Pt=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},Ot=function(e,t,n){var r=n.length,i=At(t+2);e[i]=255&r,e[i+1]=r>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var a=0;a<r;++a)e[i+a+4]=n[a];return 8*(i+4+r)},Rt=function(e,t,n,r,i,a,s,o,l,u,c){Ct(t,c++,n),++i[256];for(var h=(n=Tt(i,15))[0],d=(n=n[1],(p=Tt(a,15))[0]),p=p[1],f=(m=Dt(h))[0],m=m[1],v=(g=Dt(d))[0],g=g[1],y=new qe(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=Tt(y,7))[0],w=w[1],S=19;4<S&&!x[nt[S-1]];--S);var A,M=u+5<<3,B=Pt(i,ht)+Pt(a,dt)+s;if(i=Pt(i,h)+Pt(a,d)+s+14+3*S+Pt(y,x)+(2*y[16]+3*y[17]+7*y[18]),M<=B&&M<=i)return Ot(t,c,e.subarray(l,l+u));if(Ct(t,c,1+(i<B)),c+=2,i<B){var C=ct(h,n,0),E=h,T=ct(d,p,0),_=d,D=ct(x,w,0);for(Ct(t,c,m-257),Ct(t,c+5,g-1),Ct(t,c+10,S-4),c+=14,b=0;b<S;++b)Ct(t,c+3*b,x[nt[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];Ct(t,c,D[I]),c+=x[I],15<I&&(Ct(t,c,R[b]>>>5&127),c+=R[b]>>>12)}}}else C=vt,E=ht,T=yt,_=dt;for(b=0;b<o;++b)255<r[b]?(I=r[b]>>>18&31,Et(t,c,C[I+257]),c+=E[I+257],7<I&&(Ct(t,c,r[b]>>>23&31),c+=et[I]),A=31&r[b],Et(t,c,T[A]),c+=_[A],3<A&&(Et(t,c,r[b]>>>5&8191),c+=tt[A])):(Et(t,c,C[r[b]]),c+=E[r[b]]);return Et(t,c,C[256]),c+E[256]},It=new $e([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Lt=new Ye(0),kt=function(e,t,n,r,i,a){var s=e.length,o=new Ye(r+s+5*(1+Math.ceil(s/7e3))+i),l=o.subarray(r,o.length-i),u=0;if(!t||s<8)for(var c=0;c<=s;c+=65535){var h=c+65535;u=h<s?Ot(l,u,e.subarray(c,h)):(l[c]=a,Ot(l,u,e.subarray(c,s)))}else{for(var d=(t=It[t-1])>>>13,p=8191&t,f=(1<<n)-1,m=new qe(32768),v=new qe(1+f),g=Math.ceil(n/3),y=2*g,b=function(t){return(e[t]^e[t+1]<<g^e[t+2]<<y)&f},x=new $e(25e3),w=new qe(288),S=new qe(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=Rt(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,L=p,k=_-D&32767;if(2<P&&T==b(c-k))for(var F=Math.min(d,P)-1,U=Math.min(32767,c),G=Math.min(258,P);k<=U&&--L&&_!=D;){if(e[c+R]==e[c+R-k]){for(var N=0;N<G&&e[c+N]==e[c+N-k];++N);if(R<N){if(I=k,F<(R=N))break;var j=Math.min(k,N-2),z=0;for(O=0;O<j;++O){var H=c-k+O+32768&32767,V=H-m[H]+32768&32767;z<V&&(z=V,D=H)}}}k+=(_=D)-(D=m[_])+32768&32767}I?(x[B++]=268435456|it[R]<<18|st[I],T=31&it[R],P=31&st[I],M+=et[T]+tt[P],++w[257+T],++S[P],C=c+R,++A):(x[B++]=e[c],++w[e[c]])}}u=Rt(e,l,a,x,w,S,M,B,E,c-E,u),!a&&7&u&&(u=Ot(l,u+1,Lt))}return Mt(o,0,r+At(u)+i)},Ft=function(){for(var e=new $e(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),Ut=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=Ft[255&n^t[r]]^n>>>8;e=n},d:function(){return~e}}},Gt=function(){var e=1,t=0;return{p:function(n){for(var r=e,i=t,a=n.length,s=0;s!=a;){for(var o=Math.min(s+2655,a);s<o;++s)i+=r+=n[s];r=(65535&r)+15*(r>>16),i=(65535&i)+15*(i>>16)}e=r,t=i},d:function(){return(255&(e%=65521))<<24|e>>>8<<16|(255&(t%=65521))<<8|t>>>8}}},Nt=function(e,t,n,r,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,n,r,!i)},jt=function(e,t){var n,r={};for(n in e)r[n]=e[n];for(n in t)r[n]=t[n];return r},zt=function(e,t,n){for(var r=e(),i=(e=e.toString()).slice(e.indexOf("[")+1,e.lastIndexOf("]")).replace(/ /g,"").split(","),a=0;a<r.length;++a){var s=r[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 n[o]=s}return[t,n]},Ht=[],Vt=function(e,t,n,r){var i;if(!Ht[n]){for(var a="",s={},o=e.length-1,l=0;l<o;++l)a=(i=zt(e[l],a,s))[0],s=i[1];Ht[n]=zt(e[o],a,s)}var u=jt({},Ht[n][1]);return function(e,t,n,r,i){return(t=Qe(We[t]||(We[t]=Xe(e)))).onerror=function(e){return i(e.error,null)},t.onmessage=function(e){return i(null,e.data)},t.postMessage(n,r),t}(Ht[n][0]+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",n,u,function(e){var t,n=[];for(t in e)(e[t]instanceof Ye||e[t]instanceof qe||e[t]instanceof $e)&&n.push((e[t]=new e[t].constructor(e[t])).buffer);return n}(u),r)},Jt=function(){return[Ye,qe,$e,et,tt,nt,rt,at,gt,bt,ot,ct,xt,wt,St,At,Mt,Bt,yn,Yt,qt]},Kt=function(){return[Ye,qe,$e,et,tt,nt,it,st,vt,ht,yt,dt,ot,It,Lt,ct,Ct,Et,Tt,_t,Dt,Pt,Ot,Rt,At,Mt,kt,Nt,fn,Yt]},Zt=function(){return[rn,on,nn,Ut,Ft]},Wt=function(){return[an,sn]},Xt=function(){return[ln,nn,Gt]},Qt=function(){return[un]},Yt=function(e){return postMessage(e,[e.buffer])},qt=function(e){return e&&e.size&&new Ye(e.size)},$t=function(e,t,n,r,i,a){var s=Vt(n,r,i,(function(e,t){s.terminate(),a(e,t)}));return s.postMessage([e,t],t.consume?[e.buffer]:[]),function(){s.terminate()}},en=function(e,t){return e[t]|e[t+1]<<8},tn=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},nn=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},rn=function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&nn(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;r<=n.length;++r)e[r+10]=n.charCodeAt(r)}},an=function(e){if(31!=e[0]||139!=e[1]||8!=e[2])throw"invalid gzip data";var t=e[3],n=10;4&t&&(n+=e[10]|2+(e[11]<<8));for(var r=(t>>3&1)+(t>>4&1);0<r;r-=!e[n++]);return n+(2&t)},sn=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},on=function(e){return 10+(e.filename&&e.filename.length+1||0)},ln=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)},un=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 cn(e,t){return t||"function"!=typeof e||(t=e,e={}),this.ondata=t,e}var hn=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(Nt(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}(),dn=function(e,t){ft([Kt,function(){return[pt,hn]}],this,cn.call(this,e,t),(function(e){e=new hn(e.data),onmessage=pt(e)}),6)};function pn(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return $t(e,t,[Kt],(function(e){return Yt(fn(e.data[0],e.data[1]))}),0,n)}function fn(e,t){return Nt(e,t||{},0,0)}var mn=function(){function e(e){this.s={},this.p=new Ye(0),this.ondata=e}return e.prototype.e=function(e){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";var t=this.p.length,n=new Ye(t+e.length);n.set(this.p),n.set(e,t),this.p=n},e.prototype.c=function(e){this.d=this.s.i=e||!1,e=this.s.b;var t=Bt(this.p,this.o,this.s);this.ondata(Mt(t,e,this.s.b),this.d),this.o=Mt(t,this.s.b-32768),this.s.b=this.o.length,this.p=Mt(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),vn=function(e){this.ondata=e,ft([Jt,function(){return[pt,mn]}],this,0,(function(){var e=new mn;onmessage=pt(e)}),7)};function gn(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return $t(e,t,[Jt],(function(e){return Yt(yn(e.data[0],qt(e.data[1])))}),1,n)}function yn(e,t){return Bt(e,t)}var bn=function(){function e(e,t){this.c=Ut(),this.l=0,this.v=1,hn.call(this,e,t)}return e.prototype.push=function(e,t){hn.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),this.l+=e.length,e=Nt(e,this.o,this.v&&on(this.o),t&&8,!t),this.v&&(rn(e,this.o),this.v=0),t&&(nn(e,e.length-8,this.c.d()),nn(e,e.length-4,this.l)),this.ondata(e,t)},e}(),xn=function(e,t){ft([Kt,Zt,function(){return[pt,hn,bn]}],this,cn.call(this,e,t),(function(e){e=new bn(e.data),onmessage=pt(e)}),8)};function wn(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return $t(e,t,[Kt,Zt,function(){return[Sn]}],(function(e){return Yt(Sn(e.data[0],e.data[1]))}),2,n)}function Sn(e,t){t=t||{};var n=Ut(),r=e.length,i=(n.p(e),e=Nt(e,t,on(t),8)).length;return rn(e,t),nn(e,i-8,n.d()),nn(e,i-4,r),e}var An=function(){function e(e){this.v=1,mn.call(this,e)}return e.prototype.push=function(e,t){if(mn.prototype.e.call(this,e),this.v){if((e=3<this.p.length?an(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)}mn.prototype.c.call(this,t)},e}(),Mn=function(e){this.ondata=e,ft([Jt,Wt,function(){return[pt,mn,An]}],this,0,(function(){var e=new An;onmessage=pt(e)}),9)};function Bn(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return $t(e,t,[Jt,Wt,function(){return[Cn]}],(function(e){return Yt(Cn(e.data[0]))}),3,n)}function Cn(e,t){return Bt(e.subarray(an(e),-8),t||new Ye(sn(e)))}var En=function(){function e(e,t){this.c=Gt(),this.v=1,hn.call(this,e,t)}return e.prototype.push=function(e,t){hn.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),e=Nt(e,this.o,this.v&&2,t&&4,!t),this.v&&(ln(e,this.o),this.v=0),t&&nn(e,e.length-4,this.c.d()),this.ondata(e,t)},e}(),Tn=function(e,t){ft([Kt,Xt,function(){return[pt,hn,En]}],this,cn.call(this,e,t),(function(e){e=new En(e.data),onmessage=pt(e)}),10)};function _n(e,t){t=t||{};var n=Gt();return n.p(e),e=Nt(e,t,2,4),ln(e,t),nn(e,e.length-4,n.d()),e}var Dn=function(){function e(e){this.v=1,mn.call(this,e)}return e.prototype.push=function(e,t){if(mn.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)}mn.prototype.c.call(this,t)},e}(),Pn=function(e){this.ondata=e,ft([Jt,Qt,function(){return[pt,mn,Dn]}],this,0,(function(){var e=new Dn;onmessage=pt(e)}),11)};function On(e,t,n){if(n||(n=t,t={}),"function"!=typeof n)throw"no callback";return $t(e,t,[Jt,Qt,function(){return[Rn]}],(function(e){return Yt(Rn(e.data[0],qt(e.data[1])))}),5,n)}function Rn(e,t){return Bt((un(e),e.subarray(2,-4)),t)}var In=function(){function e(e){this.G=An,this.I=mn,this.Z=Dn,this.ondata=e}return e.prototype.push=function(e,t){if(!this.ondata)throw"no stream handler";var n,r;this.s?this.s.push(e,t):(this.p&&this.p.length?((n=new Ye(this.p.length+e.length)).set(this.p),n.set(e,this.p.length)):this.p=e,2<this.p.length&&((r=this).s=new(31==this.p[0]&&139==this.p[1]&&8==this.p[2]?this.G:8!=(15&this.p[0])||7<this.p[0]>>4||(this.p[0]<<8|this.p[1])%31?this.I:this.Z)((function(){r.ondata.apply(r,arguments)})),this.s.push(this.p,t),this.p=null))},e}(),Ln=function(){function e(e){this.G=Mn,this.I=vn,this.Z=Pn,this.ondata=e}return e.prototype.push=function(e,t){In.prototype.push.call(this,e,t)},e}(),kn=function e(t,n,r,i){for(var a in t){var s=t[a];a=n+a,s instanceof Ye?r[a]=[s,i]:Array.isArray(s)?r[a]=[s[0],jt(i,s[1])]:e(s,a+"/",r,i)}},Fn="undefined"!=typeof TextEncoder&&new TextEncoder,Un="undefined"!=typeof TextDecoder&&new TextDecoder,Gn=0;try{Un.decode(Lt,{stream:!0}),Gn=1}catch(n){}var Nn=function(e){for(var t="",n=0;;){var r=e[n++],i=(127<r)+(223<r)+(239<r);if(n+i>e.length)return[t,Mt(e,n-1)];i?3==i?(r=((15&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t+=String.fromCharCode(55296|r>>10,56320|1023&r)):t+=1&i?String.fromCharCode((31&r)<<6|63&e[n++]):String.fromCharCode((15&r)<<12|(63&e[n++])<<6|63&e[n++]):t+=String.fromCharCode(r)}},jn=function(){function e(e){this.ondata=e,Gn?this.t=new TextDecoder:this.p=Lt}return e.prototype.push=function(e,t){if(!this.ondata)throw"no callback";if(t=!!t,this.t){if(this.ondata(this.t.decode(e,{stream:!0}),t),t){if(this.t.decode().length)throw"invalid utf-8 data";this.t=null}}else{if(!this.p)throw"stream finished";var n=((n=new Ye(this.p.length+e.length)).set(this.p),n.set(e,this.p.length),e=Nn(n))[0];if(e=e[1],t){if(e.length)throw"invalid utf-8 data";this.p=null}else this.p=e;this.ondata(n,t)}},e}(),zn=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(Hn(e),this.d=t||!1)},e}();function Hn(e,t){if(t){for(var n=new Ye(e.length),r=0;r<e.length;++r)n[r]=e.charCodeAt(r);return n}if(Fn)return Fn.encode(e);var i=e.length,a=new Ye(e.length+(e.length>>1)),s=0,o=function(e){a[s++]=e};for(r=0;r<i;++r){s+5>a.length&&((l=new Ye(s+8+(i-r<<1))).set(a),a=l);var l=e.charCodeAt(r);l<128||t?o(l):(l<2048?o(192|l>>6):(55295<l&&l<57344?(o(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++r))>>18),o(128|l>>12&63)):o(224|l>>12),o(128|l>>6&63)),o(128|63&l))}return Mt(a,0,s)}function Vn(e,t){if(t){for(var n="",r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}if(Un)return Un.decode(e);var i=(t=Nn(e))[0];if(t[1].length)throw"invalid utf-8 data";return i}function Jn(e){return 1==e?3:e<6?2:9==e?1:0}var Kn=function(e,t){return t+30+en(e,t+26)+en(e,t+28)},Zn=function(e,t,n){var r=en(e,t+28),i=Vn(e.subarray(t+46,t+46+r),!(2048&en(e,t+8))),a=(r=t+46+r,tn(e,t+20)),s=(a=(n=n&&4294967295==a?Wn(e,r):[a,tn(e,t+24),tn(e,t+42)])[0],n[1]);return n=n[2],[en(e,t+10),a,s,i,r+en(e,t+30)+en(e,t+32),n]},Wn=function(e,t){for(;1!=en(e,t);t+=4+en(e,t+2));return[mt(e,t+12),mt(e,t+4),mt(e,t+20)]},Xn=function(e){var t=0;if(e)for(var n in e){if(65535<(n=e[n].length))throw"extra field too long";t+=n+4}return t},Qn=function(e,t,n,r,i,a,s,o){var l=r.length,u=n.extra,c=o&&o.length,h=Xn(u),d=(nn(e,t,null!=s?33639248:67324752),t+=4,null!=s&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(null==a&&8),e[t++]=i&&8,e[t++]=255&n.compression,e[t++]=n.compression>>8,i=new Date(null==n.mtime?Date.now():n.mtime)).getFullYear()-1980;if(d<0||119<d)throw"date not in range 1980-2099";if(nn(e,t,d<<25|i.getMonth()+1<<21|i.getDate()<<16|i.getHours()<<11|i.getMinutes()<<5|i.getSeconds()>>>1),t+=4,null!=a&&(nn(e,t,n.crc),nn(e,t+4,a),nn(e,t+8,n.size)),nn(e,t+12,l),nn(e,t+14,h),t+=16,null!=s&&(nn(e,t,c),nn(e,t+6,n.attrs),nn(e,t+10,s),t+=14),e.set(r,t),t+=l,h)for(var p in u){var f=u[p],m=f.length;nn(e,t,+p),nn(e,t+2,m),e.set(f,t+4),t+=4+m}return c&&(e.set(o,t),t+=c),t},Yn=function(e,t,n,r,i){nn(e,t,101010256),nn(e,t+8,n),nn(e,t+10,n),nn(e,t+12,r),nn(e,t+16,i)},qn=function(){function e(e){this.filename=e,this.c=Ut(),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}(),$n=function(){function e(e,t){var n=this;t=t||{},qn.call(this,e),this.d=new hn(t,(function(e,t){n.ondata(null,e,t)})),this.compression=8,this.flag=Jn(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){qn.prototype.push.call(this,e,t)},e}(),er=function(){function e(e,t){var n=this;t=t||{},qn.call(this,e),this.d=new dn(t,(function(e,t,r){n.ondata(e,t,r)})),this.compression=8,this.flag=Jn(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){qn.prototype.push.call(this,e,t)},e}(),tr=function(){function e(e){this.ondata=e,this.u=[],this.d=1}return e.prototype.add=function(e){var t=this;if(2&this.d)throw"stream finished";var n=Hn(e.filename),r=n.length,i=(a=e.comment)&&Hn(a),a=r!=e.filename.length||i&&a.length!=i.length,s=r+Xn(e.extra)+30;if(65535<r)throw"filename too long";function o(){for(var e=0,n=l;e<n.length;e++){var r=n[e];t.ondata(null,r,!1)}l=[]}r=new Ye(s);var l=(Qn(r,0,e,n,a),[r]),u=this.d,c=(this.d=0,this.u.length),h=jt(e,{f:n,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(n,r,i){n?(t.ondata(n,r,i),t.terminate()):(d+=r.length,l.push(r),i?(n=new Ye(16),nn(n,0,134695760),nn(n,4,e.crc),nn(n,8,d),nn(n,12,e.size),l.push(n),h.c=d,h.b=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,n=0,r=0,i=this.u;r<i.length;r++)n+=46+(l=i[r]).f.length+Xn(l.extra)+(l.o?l.o.length:0);for(var a=new Ye(n+22),s=0,o=this.u;s<o.length;s++){var l=o[s];Qn(a,e,l,l.f,l.u,l.c,t,l.o),e+=46+l.f.length+Xn(l.extra)+(l.o?l.o.length:0),t+=l.b}Yn(a,e,this.u.length,n,t),this.ondata(null,a,!0),this.d=2},e.prototype.terminate=function(){for(var e=0,t=this.u;e<t.length;e++)t[e].t();this.d=2},e}(),nr=function(){function e(){}return e.prototype.push=function(e,t){this.ondata(null,e,t)},e.compression=0,e}(),rr=function(){function e(){var e=this;this.i=new mn((function(t,n){e.ondata(null,t,n)}))}return e.prototype.push=function(e,t){try{this.i.push(e,t)}catch(n){this.ondata(n,e,t)}},e.compression=8,e}(),ir=function(){function e(e,t){var n=this;t<32e4?this.i=new mn((function(e,t){n.ondata(null,e,t)})):(this.i=new vn((function(e,t,r){n.ondata(e,t,r)})),this.terminate=this.i.terminate)}return e.prototype.push=function(e,t){this.i.terminate&&(e=Mt(e,0)),this.i.push(e,t)},e.compression=8,e}(),ar=function(){function e(e){this.onfile=e,this.k=[],this.o={0:nr},this.p=Lt}return e.prototype.push=function(e,t){var n=this;if(!this.onfile)throw"no callback";if(!this.p)throw"stream finished";if(0<this.c){var r=Math.min(this.c,e.length),i=e.subarray(0,r);if(this.c-=r,this.d?this.d.push(i,!this.c):this.k[0].push(i),(e=e.subarray(r)).length)return this.push(e,t)}else{for(var a=0,s=0,o=void 0,l=void 0,u=(this.p.length?e.length?((l=new Ye(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,r,i,d,p,f,m,v,g,y,b=tn(l,s);return 67324752==b?(a=1,o=s,h.d=null,h.c=0,r=en(l,s+6),e=en(l,s+8),t=2048&r,r&=8,i=en(l,s+26),d=en(l,s+28),s+30+i+d<u&&(h.k.unshift(p=[]),a=2,f=tn(l,s+18),m=tn(l,s+22),v=Vn(l.subarray(s+30,s+=30+i),!t),4294967295==f?(i=r?[-2]:Wn(l,s),f=i[0],m=i[1]):r&&(f=-1),s+=d,h.c=f,y={name:v,compression:e,start:function(){if(!y.ondata)throw"no callback";if(f){var t=n.o[e];if(!t)throw"unknown compression type "+e;(g=f<0?new t(v):new t(v,f,m)).ondata=function(e,t,n){y.ondata(e,t,n)};for(var r=0,i=p;r<i.length;r++)g.push(i[r],!1);n.k[0]==p&&n.c?n.d=g:g.push(Lt,!0)}else y.ondata(null,Lt,!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=Lt,c<0&&(r=a?l.subarray(0,o-12-(-2==c&&8)-(134695760==tn(l,o-16)&&4)):l.subarray(0,s),i?i.push(r,!!a):this.k[+(2==a)].push(r)),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 sr(e,t,n){var r=n.length-e-1;if(t>=n[r])return r-1;if(t<=n[e])return e;for(var i=e,a=r,s=Math.floor((i+a)/2);t<n[s]||t>=n[s+1];)t<n[s]?a=s:i=s,s=Math.floor((i+a)/2);return s}function or(e,t,n,r){for(var i=[],a=[],s=[],o=i[0]=1;o<=n;++o){a[o]=t-r[e+1-o],s[o]=r[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 lr(e,t,n,r,i){for(var a=i<e?i:e,s=[],l=sr(e,r,t),u=function(e,t,n,r,i){for(var a=[],s=0;s<=n;++s)a[s]=0;for(var o=[],l=0;l<=r;++l)o[l]=a.slice(0);for(var u=[],c=0;c<=n;++c)u[c]=a.slice(0);u[0][0]=1;for(var h=a.slice(0),d=a.slice(0),p=1;p<=n;++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<=n;++b)o[0][b]=u[b][n];for(var x=0;x<=n;++x){for(var w=0,S=1,A=[],M=0;M<=n;++M)A[M]=a.slice(0);for(var B=A[0][0]=1;B<=r;++B){var C=0,E=x-B,T=n-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:n-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=n,R=1;R<=r;++R){for(var I=0;I<=n;++I)o[R][I]*=O;O*=n-R}return o}(l,r,e,a,t),c=[],h=0;h<n.length;++h){var d=n[h].clone(),p=d.w;d.x*=p,d.y*=p,d.z*=p,c[h]=d}for(var f=0;f<=a;++f){for(var m=c[l-e].clone().multiplyScalar(u[f][0]),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 ur(e){for(var t=e.length,n=[],r=[],i=0;i<t;++i){var a=e[i];n[i]=new o.Vector3(a.x,a.y,a.z),r[i]=a.w}for(var s=[],l=0;l<t;++l){for(var u=n[l].clone(),c=1;c<=l;++c)u.sub(s[l-c].clone().multiplyScalar(function(e,t){for(var n=1,r=2;r<=e;++r)n*=r;for(var i=1,a=2;a<=t;++a)i*=a;for(var s=2;s<=e-t;++s)i*=s;return n/i}(l,c)*r[c]));s[l]=u.divideScalar(r[0])}return s}function cr(e){return(cr="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 hr(e,t){return(hr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function dr(e){return(dr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var pr,fr,mr,vr=function(e){var t=r;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&hr(t,e);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=dr(e);if(n=t?(n=dr(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===cr(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(r);function r(e,t,i,a,s){var l;if(!(this instanceof r))throw new TypeError("Cannot call a class as a function");(l=n.call(this)).degree=e,l.knots=t,l.controlPoints=[],l.startKnot=a||0,l.endKnot=s||l.knots.length-1;for(var u=0;u<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=r,(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,n,r){for(var i=sr(e,r,t),a=or(i,r,e,t),s=new o.Vector4(0,0,0,0),l=0;l<=e;++l){var u=n[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,n=(e=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),ur(lr(n=this.degree,this.knots,this.controlPoints,e,1)));return t.copy(n[1]).normalize(),t}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),r}(o.Curve);function gr(e){return(gr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function yr(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function br(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function xr(e,t,n){t&&br(e.prototype,t),n&&br(e,n),Object.defineProperty(e,"prototype",{writable:!1})}function wr(e,t){return(wr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Sr(e){return(Sr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Ar=function(e){var t=r;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&wr(t,e);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Sr(e);if(n=t?(n=Sr(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===gr(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(r);function r(e){return yr(this,r),n.call(this,e)}return xr(r,[{key:"load",value:function(e,t,n,r){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(n){try{t(i.parse(n,a))}catch(n){r?r(n):console.error(n),i.manager.itemError(e)}}),n,r)}},{key:"parse",value:function(e,t){if(r="Kaydara FBX Binary \0",(n=e).byteLength>=r.length&&r===Nr(n,0,r.length))pr=(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","\\","\\"],n=0,r=0;r<t.length;++r)if(function(t){var r=e[0];return e=e.slice(n+1),n++,r}()===t[r])return;return 1}(n=Nr(e)))throw new Error("THREE.FBXLoader: Unknown format.");if(Pr(n)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Pr(n));pr=(new Er).parse(n)}var n,r=new o.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new Mr(r,this.manager).parse(pr)}}]),r}(o.Loader),Mr=function(){function e(t,n){yr(this,e),this.textureLoader=t,this.manager=n}return xr(e,[{key:"parse",value:function(){fr=this.parseConnections();var e=this.parseImages(),t=(e=this.parseTextures(e),e=this.parseMaterials(e),this.parseDeformers()),n=(new Br).parse(t);return this.parseScene(t,n,e),mr}},{key:"parseConnections",value:function(){var e=new Map;return"Connections"in pr&&pr.Connections.connections.forEach((function(t){var n=t[0],r=t[1],i=(t=t[2],e.has(n)||e.set(n,{parents:[],children:[]}),{ID:r,relationship:t});e.get(n).parents.push(i),e.has(r)||e.set(r,{parents:[],children:[]}),i={ID:n,relationship:t},e.get(r).children.push(i)})),e}},{key:"parseImages",value:function(){var e,t={},n={};if("Video"in pr.Objects){var r,i=pr.Objects.Video;for(r in i){var a,s,o=i[r];t[parseInt(r)]=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[r]),n[o.RelativeFilename||o.Filename]=s))}}for(e in t){var l=t[e];void 0!==n[l]?t[e]=n[l]:t[e]=t[e].split("\\").pop()}return t}},{key:"parseImage",value:function(e){var t,n=e.Content,r=e.RelativeFilename||e.Filename,i=r.slice(r.lastIndexOf(".")+1).toLowerCase();switch(i){case"bmp":t="image/bmp";break;case"jpg":case"jpeg":t="image/jpeg";break;case"png":t="image/png";break;case"tif":t="image/tiff";break;case"tga":null===this.manager.getHandler(".tga")&&console.warn("FBXLoader: TGA loader not found, skipping ",r),t="image/tga";break;default:return void console.warn('FBXLoader: Image type "'+i+'" is not supported.')}return"string"==typeof n?"data:"+t+";base64,"+n:(e=new Uint8Array(n),window.URL.createObjectURL(new Blob([e],{type:t})))}},{key:"parseTextures",value:function(e){var t=new Map;if("Texture"in pr.Objects){var n,r=pr.Objects.Texture;for(n in r){var i=this.parseTexture(r[n],e);t.set(parseInt(n),i)}}return t}},{key:"parseTexture",value:function(e,t){var n=((t=this.loadTexture(e,t)).ID=e.id,t.name=e.attrName,e.WrapModeU),r=e.WrapModeV;return n=void 0!==n?n.value:0,r=void 0!==r?r.value:0,t.wrapS=0===n?o.RepeatWrapping:o.ClampToEdgeWrapping,t.wrapT=0===r?o.RepeatWrapping:o.ClampToEdgeWrapping,"Scaling"in e&&(n=e.Scaling.value,t.repeat.x=n[0],t.repeat.y=n[1]),"Translation"in e&&(r=e.Translation.value,t.offset.x=r[0],t.offset.y=r[1]),t}},{key:"loadTexture",value:function(e,t){var n,r=this.textureLoader.path,i=fr.get(e.id).children;return i="tga"===(void 0!==i&&0<i.length&&void 0!==t[i[0].ID]&&(0!==(n=t[i[0].ID]).indexOf("blob:")&&0!==n.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(n)):"psd"===t?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),new o.Texture):this.textureLoader.load(n),this.textureLoader.setPath(r),i}},{key:"parseMaterials",value:function(e){var t=new Map;if("Material"in pr.Objects){var n,r=pr.Objects.Material;for(n in r){var i=this.parseMaterial(r[n],e);null!==i&&t.set(parseInt(n),i)}}return t}},{key:"parseMaterial",value:function(e,t){var n,r=e.id,i=e.attrName,a=e.ShadingModel;if("object"===gr(a)&&(a=a.value),!fr.has(r))return null;switch(e=this.parseParameters(e,t,r),a.toLowerCase()){case"phong":n=new o.MeshPhongMaterial;break;case"lambert":n=new o.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',a),n=new o.MeshPhongMaterial}return n.setValues(e),n.name=i,n}},{key:"parseParameters",value:function(e,t,n){var r={},i=(e.BumpFactor&&(r.bumpScale=e.BumpFactor.value),e.Diffuse?r.color=(new o.Color).fromArray(e.Diffuse.value):!e.DiffuseColor||"Color"!==e.DiffuseColor.type&&"ColorRGB"!==e.DiffuseColor.type||(r.color=(new o.Color).fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(r.displacementScale=e.DisplacementFactor.value),e.Emissive?r.emissive=(new o.Color).fromArray(e.Emissive.value):!e.EmissiveColor||"Color"!==e.EmissiveColor.type&&"ColorRGB"!==e.EmissiveColor.type||(r.emissive=(new o.Color).fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(r.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(r.opacity=parseFloat(e.Opacity.value)),r.opacity<1&&(r.transparent=!0),e.ReflectionFactor&&(r.reflectivity=e.ReflectionFactor.value),e.Shininess&&(r.shininess=e.Shininess.value),e.Specular?r.specular=(new o.Color).fromArray(e.Specular.value):e.SpecularColor&&"Color"===e.SpecularColor.type&&(r.specular=(new o.Color).fromArray(e.SpecularColor.value)),this);return fr.get(n).children.forEach((function(e){var n=e.relationship;switch(n){case"Bump":r.bumpMap=i.getTexture(t,e.ID);break;case"Maya|TEX_ao_map":r.aoMap=i.getTexture(t,e.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":r.map=i.getTexture(t,e.ID),void 0!==r.map&&(r.map.encoding=o.sRGBEncoding);break;case"DisplacementColor":r.displacementMap=i.getTexture(t,e.ID);break;case"EmissiveColor":r.emissiveMap=i.getTexture(t,e.ID),void 0!==r.emissiveMap&&(r.emissiveMap.encoding=o.sRGBEncoding);break;case"NormalMap":case"Maya|TEX_normal_map":r.normalMap=i.getTexture(t,e.ID);break;case"ReflectionColor":r.envMap=i.getTexture(t,e.ID),void 0!==r.envMap&&(r.envMap.mapping=o.EquirectangularReflectionMapping,r.envMap.encoding=o.sRGBEncoding);break;case"SpecularColor":r.specularMap=i.getTexture(t,e.ID),void 0!==r.specularMap&&(r.specularMap.encoding=o.sRGBEncoding);break;case"TransparentColor":case"TransparencyFactor":r.alphaMap=i.getTexture(t,e.ID),r.transparent=!0;break;default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",n)}})),r}},{key:"getTexture",value:function(e,t){return"LayeredTexture"in pr.Objects&&t in pr.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=fr.get(t).children[0].ID),e.get(t)}},{key:"parseDeformers",value:function(){var e={},t={};if("Deformer"in pr.Objects){var n,r=pr.Objects.Deformer;for(n in r){var i,a=r[n],s=fr.get(parseInt(n));"Skin"===a.attrType?((i=this.parseSkeleton(s,r)).ID=n,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[n]=i):"BlendShape"===a.attrType&&((i={id:n}).rawTargets=this.parseMorphTargets(s,r),i.id=n,1<s.parents.length&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[n]=i)}}return{skeletons:e,morphTargets:t}}},{key:"parseSkeleton",value:function(e,t){var n=[];return e.children.forEach((function(e){var r=t[e.ID];"Cluster"===r.attrType&&(e={ID:e.ID,indices:[],weights:[],transformLink:(new o.Matrix4).fromArray(r.TransformLink.a)},"Indexes"in r&&(e.indices=r.Indexes.a,e.weights=r.Weights.a),n.push(e))})),{rawBones:n,bones:[]}}},{key:"parseMorphTargets",value:function(e,t){for(var n=[],r=0;r<e.children.length;r++){var i=e.children[r],a=t[i.ID],s={name:a.attrName,initialWeight:a.DeformPercent,id:a.id,fullWeights:a.FullWeights.a};if("BlendShapeChannel"!==a.attrType)return;s.geoID=fr.get(parseInt(i.ID)).children.filter((function(e){return void 0===e.relationship}))[0].ID,n.push(s)}return n}},{key:"parseScene",value:function(e,t,n){mr=new o.Group;var r=this.parseModels(e.skeletons,t,n),i=pr.Objects.Model,a=this;r.forEach((function(e){var t=i[e.ID];a.setLookAtProperties(e,t),fr.get(e.ID).parents.forEach((function(t){void 0!==(t=r.get(t.ID))&&t.add(e)})),null===e.parent&&mr.add(e)})),this.bindSkeleton(e.skeletons,t,r),this.createAmbientLight(),mr.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=Fr(e.userData.transformData),e.applyMatrix4(t),e.updateWorldMatrix())})),n=(new Cr).parse(),1===mr.children.length&&mr.children[0].isGroup&&(mr.children[0].animations=n,mr=mr.children[0]),mr.animations=n}},{key:"parseModels",value:function(e,t,n){var r,i=new Map,a=pr.Objects.Model;for(r in a){var s=parseInt(r),l=a[r],u=fr.get(s),c=this.buildSkeleton(u,e,s,l.attrName);if(!c){switch(l.attrType){case"Camera":c=this.createCamera(u);break;case"Light":c=this.createLight(u);break;case"Mesh":c=this.createMesh(u,t,n);break;case"NurbsCurve":c=this.createCurve(u,t);break;case"LimbNode":case"Root":c=new 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,n,r){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=r?o.PropertyBinding.sanitizeNodeName(r):"",i.ID=n,s.bones[a]=i,null!==l&&i.add(l))}))}(a)})),i}},{key:"createCamera",value:function(e){var t,n;if(e.children.forEach((function(e){void 0!==(e=pr.Objects.NodeAttribute[e.ID])&&(n=e)})),void 0===n)t=new o.Object3D;else{var r=0,i=(void 0!==n.CameraProjectionType&&1===n.CameraProjectionType.value&&(r=1),1),a=(void 0!==n.NearPlane&&(i=n.NearPlane.value/1e3),1e3),s=(void 0!==n.FarPlane&&(a=n.FarPlane.value/1e3),window.innerWidth),l=window.innerHeight,u=(void 0!==n.AspectWidth&&void 0!==n.AspectHeight&&(s=n.AspectWidth.value,l=n.AspectHeight.value),s/l),c=45,h=(void 0!==n.FieldOfView&&(c=n.FieldOfView.value),n.FocalLength?n.FocalLength.value:null);switch(r){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 "+r+"."),t=new o.Object3D}}return t}},{key:"createLight",value:function(e){var t,n;if(e.children.forEach((function(e){void 0!==(e=pr.Objects.NodeAttribute[e.ID])&&(n=e)})),void 0===n)t=new o.Object3D;else{e=void 0===n.LightType?0:n.LightType.value;var r=16777215,i=(void 0!==n.Color&&(r=(new o.Color).fromArray(n.Color.value)),void 0===n.Intensity?1:n.Intensity.value/100),a=(void 0!==n.CastLightOnObject&&0===n.CastLightOnObject.value&&(i=0),0);switch(void 0!==n.FarAttenuationEnd&&(a=void 0!==n.EnableFarAttenuation&&0===n.EnableFarAttenuation.value?0:n.FarAttenuationEnd.value),e){case 0:t=new o.PointLight(r,i,a,1);break;case 1:t=new o.DirectionalLight(r,i);break;case 2:var s=Math.PI/3,l=(void 0!==n.InnerAngle&&(s=o.MathUtils.degToRad(n.InnerAngle.value)),0);void 0!==n.OuterAngle&&(l=o.MathUtils.degToRad(n.OuterAngle.value),l=Math.max(l,1)),t=new o.SpotLight(r,i,a,s,l,1);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),t=new o.PointLight(r,i)}void 0!==n.CastShadows&&1===n.CastShadows.value&&(t.castShadow=!0)}return t}},{key:"createMesh",value:function(e,t,n){var r,i=null,a=null,s=[];return e.children.forEach((function(e){t.has(e.ID)&&(i=t.get(e.ID)),n.has(e.ID)&&s.push(n.get(e.ID))})),1<s.length?a=s:0<s.length?a=s[0]:(a=new o.MeshPhongMaterial({color:13421772}),s.push(a)),"color"in i.attributes&&s.forEach((function(e){e.vertexColors=!0})),i.FBX_Deformer?(r=new o.SkinnedMesh(i,a)).normalizeSkinWeights():r=new o.Mesh(i,a),r}},{key:"createCurve",value:function(e,t){e=e.children.reduce((function(e,n){return t.has(n.ID)?t.get(n.ID):e}),null);var n=new o.LineBasicMaterial({color:3342591,linewidth:1});return new o.Line(e,n)}},{key:"getTransformData",value:function(e,t){var n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),n.eulerOrder="RotationOrder"in t?Ur(t.RotationOrder.value):"ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}},{key:"setLookAtProperties",value:function(e,t){"LookAtProperty"in t&&fr.get(e.ID).children.forEach((function(t){"LookAtProperty"===t.relationship&&"Lcl_Translation"in(t=pr.Objects.Model[t.ID])&&(t=t.Lcl_Translation.value,void 0!==e.target?(e.target.position.fromArray(t),mr.add(e.target)):e.lookAt((new o.Vector3).fromArray(t)))}))}},{key:"bindSkeleton",value:function(e,t,n){var r,i=this.parsePoseNodes();for(r in e)!function(r){var a=e[r];fr.get(parseInt(a.ID)).parents.forEach((function(e){t.has(e.ID)&&(e=e.ID,fr.get(e).parents.forEach((function(e){n.has(e.ID)&&n.get(e.ID).bind(new o.Skeleton(a.bones),i[e.ID])})))}))}(r)}},{key:"parsePoseNodes",value:function(){var e={};if("Pose"in pr.Objects){var t,n,r=pr.Objects.Pose;for(t in r)"BindPose"===r[t].attrType&&0<r[t].NbPoseNodes&&(n=r[t].PoseNode,Array.isArray(n)?n.forEach((function(t){e[t.Node]=(new o.Matrix4).fromArray(t.Matrix.a)})):e[n.Node]=(new o.Matrix4).fromArray(n.Matrix.a))}return e}},{key:"createAmbientLight",value:function(){var e,t,n;"GlobalSettings"in pr&&"AmbientColor"in pr.GlobalSettings&&(n=(t=pr.GlobalSettings.AmbientColor.value)[0],e=t[1],t=t[2],0===n&&0===e&&0===t||(n=new o.Color(n,e,t),mr.add(new o.AmbientLight(n,1))))}}]),e}(),Br=function(){function e(){yr(this,e)}return xr(e,[{key:"parse",value:function(e){var t=new Map;if("Geometry"in pr.Objects){var n,r=pr.Objects.Geometry;for(n in r){var i=fr.get(parseInt(n));i=this.parseGeometry(i,r[n],e),t.set(parseInt(n),i)}}return t}},{key:"parseGeometry",value:function(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}},{key:"parseMeshGeometry",value:function(e,t,n){var r,i=n.skeletons,a=[],s=e.parents.map((function(e){return pr.Objects.Model[e.ID]}));if(0!==s.length)return r=e.children.reduce((function(e,t){return void 0!==i[t.ID]?i[t.ID]:e}),null),e.children.forEach((function(e){void 0!==n.morphTargets[e.ID]&&a.push(n.morphTargets[e.ID])})),e=s[0],s={},"RotationOrder"in e&&(s.eulerOrder=Ur(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=Fr(s),this.genGeometry(t,r,a,e)}},{key:"genGeometry",value:function(e,t,n,r){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(r),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(r),(t=new o.Float32BufferAttribute(u.normal,3)).applyNormalMatrix(c),s.setAttribute("normal",t)),u.uvs.forEach((function(e,t){var n="uv"+(t+1).toString();s.setAttribute(n=0===t?"uv":n,new 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,n,r),s}},{key:"parseGeoNode",value:function(e,t){var n={};if(n.vertexPositions=void 0!==e.Vertices?e.Vertices.a:[],n.vertexIndices=void 0!==e.PolygonVertexIndex?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];for(var r=0;e.LayerElementUV[r];)e.LayerElementUV[r].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[r])),r++}return n.weightTable={},null!==t&&(n.skeleton=t).rawBones.forEach((function(e,t){e.indices.forEach((function(r,i){void 0===n.weightTable[r]&&(n.weightTable[r]=[]),n.weightTable[r].push({id:t,weight:e.weights[i]})}))})),n}},{key:"genBuffers",value:function(e){var t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]},n=0,r=0,i=!1,a=[],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=Ir(p,n,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 n=e,r=b[t];v.forEach((function(e,t,i){e<n&&(i[t]=n,n=e,i=m[t],m[t]=r,r=i)}))})),b=m,x=v);x.length<4;)x.push(0),b.push(0);for(var w=0;w<4;++w)u.push(x[w]),c.push(b[w])}e.normal&&(g=Ir(p,n,d,e.normal),s.push(g[0],g[1],g[2])),e.material&&"AllSame"!==e.material.mappingType&&(f=Ir(p,n,d,e.material)[0]),e.uv&&e.uv.forEach((function(e,t){e=Ir(p,n,d,e),void 0===l[t]&&(l[t]=[]),l[t].push(e[0]),l[t].push(e[1])})),r++,y&&(h.genFace(t,e,a,f,s,o,l,u,c,r),n++,r=0,a=[],s=[],o=[],l=[],u=[],c=[])})),t}},{key:"genFace",value:function(e,t,n,r,i,a,s,o,l,u){for(var c=2;c<u;c++)!function(u){e.vertex.push(t.vertexPositions[n[0]]),e.vertex.push(t.vertexPositions[n[1]]),e.vertex.push(t.vertexPositions[n[2]]),e.vertex.push(t.vertexPositions[n[3*(u-1)]]),e.vertex.push(t.vertexPositions[n[3*(u-1)+1]]),e.vertex.push(t.vertexPositions[n[3*(u-1)+2]]),e.vertex.push(t.vertexPositions[n[3*u]]),e.vertex.push(t.vertexPositions[n[3*u+1]]),e.vertex.push(t.vertexPositions[n[3*u+2]]),t.skeleton&&(e.vertexWeights.push(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(r),e.materialIndex.push(r),e.materialIndex.push(r)),t.normal&&(e.normal.push(i[0]),e.normal.push(i[1]),e.normal.push(i[2]),e.normal.push(i[3*(u-1)]),e.normal.push(i[3*(u-1)+1]),e.normal.push(i[3*(u-1)+2]),e.normal.push(i[3*u]),e.normal.push(i[3*u+1]),e.normal.push(i[3*u+2])),t.uv&&t.uv.forEach((function(t,n){void 0===e.uvs[n]&&(e.uvs[n]=[]),e.uvs[n].push(s[n][0]),e.uvs[n].push(s[n][1]),e.uvs[n].push(s[n][2*(u-1)]),e.uvs[n].push(s[n][2*(u-1)+1]),e.uvs[n].push(s[n][2*u]),e.uvs[n].push(s[n][2*u+1])}))}(c)}},{key:"addMorphTargets",value:function(e,t,n,r){var i;0!==n.length&&(e.morphTargetsRelative=!0,e.morphAttributes.position=[],i=this,n.forEach((function(n){n.rawTargets.forEach((function(n){var a=pr.Objects.Geometry[n.geoID];void 0!==a&&i.genMorphGeometry(e,t,a,r,n.name)}))})))}},{key:"genMorphGeometry",value:function(e,t,n,r,i){t=void 0!==t.PolygonVertexIndex?t.PolygonVertexIndex.a:[];for(var a=void 0!==n.Vertices?n.Vertices.a:[],s=void 0!==n.Indexes?n.Indexes.a:[],l=3*e.attributes.position.count,u=new Float32Array(l),c=0;c<s.length;c++){var h=3*s[c];u[h]=a[3*c],u[1+h]=a[3*c+1],u[2+h]=a[3*c+2]}l=this.genBuffers({vertexIndices:t,vertexPositions:u}),(t=new o.Float32BufferAttribute(l.vertex,3)).name=i||n.attrName,t.applyMatrix4(r),e.morphAttributes.position.push(t)}},{key:"parseNormals",value:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=e.Normals.a,i=[];return"IndexToDirect"===n&&("NormalIndex"in e?i=e.NormalIndex.a:"NormalsIndex"in e&&(i=e.NormalsIndex.a)),{dataSize:3,buffer:r,indices:i,mappingType:t,referenceType:n}}},{key:"parseUVs",value:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=[];return{dataSize:2,buffer:e.UV.a,indices:r="IndexToDirect"===n?e.UVIndex.a:r,mappingType:t,referenceType:n}}},{key:"parseVertexColors",value:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType,r=[];return{dataSize:4,buffer:e.Colors.a,indices:r="IndexToDirect"===n?e.ColorIndex.a:r,mappingType:t,referenceType:n}}},{key:"parseMaterialIndices",value:function(e){var t=e.MappingInformationType,n=e.ReferenceInformationType;if("NoMappingInformation"===t)return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};for(var r=e.Materials.a,i=[],a=0;a<r.length;++a)i.push(a);return{dataSize:1,buffer:r,indices:i,mappingType:t,referenceType:n}}},{key:"parseNurbsGeometry",value:function(e){if(void 0===vr)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 n=t-1,r=(t=e.KnotVector.a,[]),i=e.Points.a,a=0,s=i.length;a<s;a+=4)r.push((new o.Vector4).fromArray(i,a));if("Closed"===e.Form)r.push(r[0]);else if("Periodic"===e.Form)for(var l=n,u=t.length-1-l,c=0;c<n;++c)r.push(r[c]);return e=new vr(n,t,r,l,u).getPoints(12*r.length),(new o.BufferGeometry).setFromPoints(e)}}]),e}(),Cr=function(){function e(){yr(this,e)}return xr(e,[{key:"parse",value:function(){var e=[],t=this.parseClips();if(void 0!==t)for(var n in t)n=t[n],n=this.addClip(n),e.push(n);return e}},{key:"parseClips",value:function(){var e;if(void 0!==pr.Objects.AnimationCurve)return e=this.parseAnimationCurveNodes(),this.parseAnimationCurves(e),e=this.parseAnimationLayers(e),this.parseAnimStacks(e)}},{key:"parseAnimationCurveNodes",value:function(){var e,t=pr.Objects.AnimationCurveNode,n=new Map;for(e in t){var r=t[e];null!==r.attrName.match(/S|R|T|DeformPercent/)&&(r={id:r.id,attr:r.attrName,curves:{}},n.set(r.id,r))}return n}},{key:"parseAnimationCurves",value:function(e){var t,n=pr.Objects.AnimationCurve;for(t in n){var r,i={id:n[t].id,times:n[t].KeyTime.a.map(Or),values:n[t].KeyValueFloat.a},a=fr.get(i.id);void 0!==a&&(r=a.parents[0].ID,(a=a.parents[0].relationship).match(/X/)?e.get(r).curves.x=i:a.match(/Y/)?e.get(r).curves.y=i:a.match(/Z/)?e.get(r).curves.z=i:a.match(/d|DeformPercent/)&&e.has(r)&&(e.get(r).curves.morph=i))}}},{key:"parseAnimationLayers",value:function(e){var t,n=pr.Objects.AnimationLayer,r=new Map;for(t in n)!function(t){var n=[],i=fr.get(parseInt(t));void 0!==i&&(i.children.forEach((function(t,r){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===n[r]){var a=fr.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID;if(void 0!==a){var s=pr.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]};mr.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),n[r]=l}}n[r]&&(n[r][i.attr]=i)}else void 0!==i.curves.morph&&(void 0===n[r]&&(a=fr.get(t.ID).parents.filter((function(e){return void 0!==e.relationship}))[0].ID,t=fr.get(a).parents[0].ID,t=fr.get(t).parents[0].ID,t=fr.get(t).parents[0].ID,t={modelName:(t=pr.Objects.Model[t]).attrName?o.PropertyBinding.sanitizeNodeName(t.attrName):"",morphName:pr.Objects.Deformer[a].attrName},n[r]=t),n[r][i.attr]=i)}})),r.set(parseInt(t),n))}(t);return r}},{key:"parseAnimStacks",value:function(e){var t,n=pr.Objects.AnimationStack,r={};for(t in n){var i=(1<(i=fr.get(parseInt(t)).children).length&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers."),e.get(i[0].ID));r[t]={name:n[t].attrName,layer:i}}return r}},{key:"addClip",value:function(e){var t=[],n=this;return e.layer.forEach((function(e){t=t.concat(n.generateTracks(e))})),new o.AnimationClip(e.name,-1,t)}},{key:"generateTracks",value:function(e){var t=[],n=new o.Vector3,r=new o.Quaternion,i=new o.Vector3;return e.transform&&e.transform.decompose(n,r,i),n=n.toArray(),r=(new o.Euler).setFromQuaternion(r,e.eulerOrder).toArray(),i=i.toArray(),void 0!==e.T&&0<Object.keys(e.T.curves).length&&void 0!==(n=this.generateVectorTrack(e.modelName,e.T.curves,n,"position"))&&t.push(n),void 0!==e.R&&0<Object.keys(e.R.curves).length&&void 0!==(n=this.generateRotationTrack(e.modelName,e.R.curves,r,e.preRotation,e.postRotation,e.eulerOrder))&&t.push(n),void 0!==e.S&&0<Object.keys(e.S.curves).length&&void 0!==(r=this.generateVectorTrack(e.modelName,e.S.curves,i,"scale"))&&t.push(r),void 0!==e.DeformPercent&&void 0!==(n=this.generateMorphTrack(e))&&t.push(n),t}},{key:"generateVectorTrack",value:function(e,t,n,r){var i=this.getTimesForAllAxes(t);return t=this.getKeyframeTrackValues(i,t,n),new o.VectorKeyframeTrack(e+"."+r,i,t)}},{key:"generateRotationTrack",value:function(e,t,n,r,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,n),u=(void 0!==r&&((r=r.map(o.MathUtils.degToRad)).push(a),r=(new o.Euler).fromArray(r),r=(new o.Quaternion).setFromEuler(r)),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!==r&&u.premultiply(r),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,n=t.values.map((function(e){return e/100})),r=mr.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new o.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+r+"]",t.times,n)}},{key:"getTimesForAllAxes",value:function(e){var t=[];if(void 0!==e.x&&(t=t.concat(e.x.times)),void 0!==e.y&&(t=t.concat(e.y.times)),1<(t=(t=void 0!==e.z?t.concat(e.z.times):t).sort((function(e,t){return e-t}))).length){for(var n=1,r=t[0],i=1;i<t.length;i++){var a=t[i];a!==r&&(r=t[n]=a,n++)}t=t.slice(0,n)}return t}},{key:"getKeyframeTrackValues",value:function(e,t,n){var r=n,i=[],a=-1,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),r[0]=e):i.push(r[0]),-1!==s?(e=t.y.values[s],i.push(e),r[1]=e):i.push(r[1]),-1!==o?(e=t.z.values[o],i.push(e),r[2]=e):i.push(r[2])})),i}},{key:"interpolateRotations",value:function(e){for(var t=1;t<e.values.length;t++){var n=e.values[t-1],r=e.values[t]-n;if(180<=(i=Math.abs(r))){for(var i,a=r/(i/=180),s=n+a,o=(r=e.times[t-1],(e.times[t]-r)/i),l=r+o,u=[],c=[];l<e.times[t];)u.push(l),l+=o,c.push(s),s+=a;e.times=jr(e.times,t,u),e.values=jr(e.values,t,c)}}}}]),e}(),Er=function(){function e(){yr(this,e)}return xr(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 Dr,this.nodeStack=[],this.currentProp=[],this.currentPropName="";var t=this,n=e.split(/[\r\n]+/);return n.forEach((function(e,r){var i,a=e.match(/^[\s\t]*;/),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,n[++r]):i?t.popStack():e.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(e))})),this.allNodes}},{key:"parseNodeBegin",value:function(e,t){var n=t[1].trim().replace(/^"/,"").replace(/"$/,""),r=(t=t[2].split(",").map((function(e){return e.trim().replace(/^"/,"").replace(/"$/,"")})),{name:n}),i=(t=this.parseNodeAttr(t),this.getCurrentNode());0===this.currentIndent?this.allNodes.add(n,r):n in i?("PoseNode"===n?i.PoseNode.push(r):void 0!==i[n].id&&(i[n]={},i[n][i[n].id]=i[n]),""!==t.id&&(i[n][t.id]=r)):"number"==typeof t.id?(i[n]={},i[n][t.id]=r):"Properties70"!==n&&(i[n]="PoseNode"===n?[r]:r),"number"==typeof t.id&&(r.id=t.id),""!==t.name&&(r.attrName=t.name),""!==t.type&&(r.attrType=t.type),this.pushStack(r)}},{key:"parseNodeAttr",value:function(e){var t=e[0],n=(""!==e[0]&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0])),""),r="";return 1<e.length&&(n=e[1].replace(/^(\w+)::/,""),r=e[2]),{id:t,name:n,type:r}}},{key:"parseNodeProperty",value:function(e,t,n){var r=t[1].replace(/^"/,"").replace(/"$/,"").trim();if(t=t[2].replace(/^"/,"").replace(/"$/,"").trim(),"Properties70"===("Content"===r&&","===t&&(t=n.replace(/"/g,"").replace(/,$/,"").trim()),n=this.getCurrentNode()).name)this.parseNodeSpecialProperty(e,r,t);else{if("C"===r){e=t.split(",").slice(1);for(var i=parseInt(e[0]),a=(e=parseInt(e[1]),(a=t.split(",").slice(3)).map((function(e){return e.trim().replace(/^"/,"")}))),s=(r="connections",t=[i,e]),o=a,l=0,u=s.length,c=o.length;l<c;l++,u++)s[u]=o[l];void 0===n[r]&&(n[r]=[])}"Node"===r&&(n.id=t),r in n&&Array.isArray(n[r])?n[r].push(t):"a"!==r?n[r]=t:n.a=t,this.setCurrentProp(n,r),"a"===r&&","!==t.slice(-1)&&(n.a=Gr(t))}}},{key:"parseNodePropertyContinued",value:function(e){var t=this.getCurrentNode();t.a+=e,","!==e.slice(-1)&&(t.a=Gr(t.a))}},{key:"parseNodeSpecialProperty",value:function(e,t,n){n=n.split('",').map((function(e){return e.trim().replace(/^\"/,"").replace(/\s/,"_")}));var r=n[0],i=n[1],a=n[2],s=n[3],o=n[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=Gr(o)}this.getPrevNode()[r]={type:i,type2:a,flag:s,value:o},this.setCurrentProp(this.getPrevNode(),r)}}]),e}(),Tr=function(){function e(){yr(this,e)}return xr(e,[{key:"parse",value:function(e){var t=new _r(e),n=(t.skip(23),t.getUint32());if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);for(var r=new Dr;!this.endOfContent(t);){var i=this.parseNode(t,n);null!==i&&r.add(i.name,i)}return r}},{key:"endOfContent",value:function(e){return e.size()%16==0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}},{key:"parseNode",value:function(e,t){var n={},r=7500<=t?e.getUint64():e.getUint32(),i=7500<=t?e.getUint64():e.getUint32(),a=(7500<=t?e.getUint64():e.getUint32(),e.getUint8()),s=e.getString(a);if(0===r)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(n.singleProperty=1===i&&e.getOffset()===r;r>e.getOffset();){var h=this.parseNode(e,t);null!==h&&this.parseSubNode(s,n,h)}return n.propertyList=o,"number"==typeof a&&(n.id=a),""!==u&&(n.attrName=u),""!==c&&(n.attrType=c),""!==s&&(n.name=s),n}},{key:"parseSubNode",value:function(e,t,n){var r,i,a,s,o;!0===n.singleProperty?(i=n.propertyList[0],Array.isArray(i)?(t[n.name]=n).a=i:t[n.name]=i):"Connections"===e&&"C"===n.name?(r=[],n.propertyList.forEach((function(e,t){0!==t&&r.push(e)})),void 0===t.connections&&(t.connections=[]),t.connections.push(r)):"Properties70"===n.name?Object.keys(n).forEach((function(e){t[e]=n[e]})):"Properties70"===e&&"P"===n.name?(i=n.propertyList[0],e=n.propertyList[1],a=n.propertyList[2],s=n.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_")?[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:n.propertyList[4],t[i]={type:e,type2:a,flag:s,value:o}):void 0===t[n.name]?"number"==typeof n.id?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:"PoseNode"===n.name?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):void 0===t[n.name][n.id]&&(t[n.name][n.id]=n)}},{key:"parseProperty",value:function(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 n=e.getUint32(),i=e.getUint32(),a=e.getUint32();if(0===i)switch(t){case"b":case"c":return e.getBooleanArray(n);case"d":return e.getFloat64Array(n);case"f":return e.getFloat32Array(n);case"i":return e.getInt32Array(n);case"l":return e.getInt64Array(n)}void 0===r&&console.error("THREE.FBXLoader: External library fflate.min.js required."),i=Rn(new Uint8Array(e.getArrayBuffer(a)));var s=new _r(i.buffer);switch(t){case"b":case"c":return s.getBooleanArray(n);case"d":return s.getFloat64Array(n);case"f":return s.getFloat32Array(n);case"i":return s.getInt32Array(n);case"l":return s.getInt64Array(n)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}]),e}(),_r=function(){function e(t,n){yr(this,e),this.dv=new DataView(t),this.offset=0,this.littleEndian=void 0===n||n}return xr(e,[{key:"getOffset",value:function(){return this.offset}},{key:"size",value:function(){return this.dv.buffer.byteLength}},{key:"skip",value:function(e){this.offset+=e}},{key:"getBoolean",value:function(){return 1==(1&this.getUint8())}},{key:"getBooleanArray",value:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getBoolean());return t}},{key:"getUint8",value:function(){var e=this.dv.getUint8(this.offset);return this.offset+=1,e}},{key:"getInt16",value:function(){var e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}},{key:"getInt32",value:function(){var e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getInt32Array",value:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getInt32());return t}},{key:"getUint32",value:function(){var e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getInt64",value:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),2147483648&t?(t=4294967295&~t,-(4294967296*(t=4294967295==(e=4294967295&~e)?t+1&4294967295:t)+(e=e+1&4294967295))):4294967296*t+e}},{key:"getInt64Array",value:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getInt64());return t}},{key:"getUint64",value:function(){var e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),4294967296*t+e}},{key:"getFloat32",value:function(){var e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}},{key:"getFloat32Array",value:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getFloat32());return t}},{key:"getFloat64",value:function(){var e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}},{key:"getFloat64Array",value:function(e){for(var t=[],n=0;n<e;n++)t.push(this.getFloat64());return t}},{key:"getArrayBuffer",value:function(e){var t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}},{key:"getString",value:function(e){for(var t=[],n=0;n<e;n++)t[n]=this.getUint8();var r=t.indexOf(0);return 0<=r&&(t=t.slice(0,r)),o.LoaderUtils.decodeText(new Uint8Array(t))}}]),e}(),Dr=function(){function e(){yr(this,e)}return xr(e,[{key:"add",value:function(e,t){this[e]=t}}]),e}();function Pr(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 Or(e){return e/46186158e3}var Rr=[];function Ir(e,t,n,r){var i;switch(r.mappingType){case"ByPolygonVertex":i=e;break;case"ByPolygon":i=t;break;case"ByVertice":i=n;break;case"AllSame":i=r.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+r.mappingType)}for(var a=(i="IndexToDirect"===r.referenceType?r.indices[i]:i)*r.dataSize,s=a+r.dataSize,o=Rr,l=r.buffer,u=s,c=a,h=0;c<u;c++,h++)o[h]=l[c];return o}var Lr=new o.Euler,kr=new o.Vector3;function Fr(e){var t=new o.Matrix4,n=new o.Matrix4,r=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(kr.fromArray(e.translation)),e.preRotation&&((m=e.preRotation.map(o.MathUtils.degToRad)).push(e.eulerOrder),n.makeRotationFromEuler(Lr.fromArray(m))),e.rotation&&((m=e.rotation.map(o.MathUtils.degToRad)).push(e.eulerOrder),r.makeRotationFromEuler(Lr.fromArray(m))),e.postRotation&&((m=e.postRotation.map(o.MathUtils.degToRad)).push(e.eulerOrder),i.makeRotationFromEuler(Lr.fromArray(m)),i.invert()),e.scale&&a.scale(kr.fromArray(e.scale)),e.scalingOffset&&l.setPosition(kr.fromArray(e.scalingOffset)),e.scalingPivot&&s.setPosition(kr.fromArray(e.scalingPivot)),e.rotationOffset&&u.setPosition(kr.fromArray(e.rotationOffset)),e.rotationPivot&&c.setPosition(kr.fromArray(e.rotationPivot)),e.parentMatrixWorld&&(d.copy(e.parentMatrix),h.copy(e.parentMatrixWorld)),n.clone().multiply(r).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(n).multiply(r).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 Ur(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 Gr(e){return e.split(",").map((function(e){return parseFloat(e)}))}function Nr(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=e.byteLength),o.LoaderUtils.decodeText(new Uint8Array(e,t,n))}function jr(e,t,n){return e.slice(0,t).concat(n).concat(e.slice(t))}function zr(e){return(zr="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 Hr(e,t){return(Hr=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 Jr=/^[og]\s*(.+)?/,Kr=/^mtllib /,Zr=/^usemtl /,Wr=/^usemap /,Xr=new o.Vector3,Qr=new o.Vector3,Yr=new o.Vector3,qr=new o.Vector3,$r=new o.Vector3,ei=new o.Color;function ti(){var e={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=e,void(this.object.fromDeclaration=!1!==t);var n=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:!1!==t,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(e,t){var n=this._finalize(!1);return n&&(n.inherited||n.groupCount<=0)&&this.materials.splice(n.index,1),e={index:this.materials.length,name:e||"",mtllib:Array.isArray(t)&&0<t.length?t[t.length-1]:"",smooth:(void 0!==n?n:this).smooth,groupStart:void 0!==n?n.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){return(e={index:"number"==typeof e?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1}).clone=this.clone.bind(e),e}},this.materials.push(e),e},currentMaterial:function(){if(0<this.materials.length)return this.materials[this.materials.length-1]},_finalize:function(e){var t=this.currentMaterial();if(t&&-1===t.groupEnd&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&1<this.materials.length)for(var n=this.materials.length-1;0<=n;n--)this.materials[n].groupCount<=0&&this.materials.splice(n,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},n&&n.name&&"function"==typeof n.clone&&((e=n.clone(0)).inherited=!0,this.object.materials.push(e)),this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){return 3*(0<=(e=parseInt(e,10))?e-1:e+t/3)},parseNormalIndex:function(e,t){return 3*(0<=(e=parseInt(e,10))?e-1:e+t/3)},parseUVIndex:function(e,t){return 2*(0<=(e=parseInt(e,10))?e-1:e+t/2)},addVertex:function(e,t,n){var r=this.vertices,i=this.object.geometry.vertices;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addVertexPoint:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){var r=this.normals,i=this.object.geometry.normals;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addFaceNormal:function(e,t,n){var r=this.vertices,i=this.object.geometry.normals;Xr.fromArray(r,e),Qr.fromArray(r,t),Yr.fromArray(r,n),$r.subVectors(Yr,Qr),qr.subVectors(Xr,Qr),$r.cross(qr),$r.normalize(),i.push($r.x,$r.y,$r.z),i.push($r.x,$r.y,$r.z),i.push($r.x,$r.y,$r.z)},addColor:function(e,t,n){var r=this.colors,i=this.object.geometry.colors;void 0!==r[e]&&i.push(r[e+0],r[e+1],r[e+2]),void 0!==r[t]&&i.push(r[t+0],r[t+1],r[t+2]),void 0!==r[n]&&i.push(r[n+0],r[n+1],r[n+2])},addUV:function(e,t,n){var r=this.uvs,i=this.object.geometry.uvs;i.push(r[e+0],r[e+1]),i.push(r[t+0],r[t+1]),i.push(r[n+0],r[n+1])},addDefaultUV:function(){var e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){var t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,n,r,i,a,s,o,l){var u=this.vertices.length;e=this.parseVertexIndex(e,u),t=this.parseVertexIndex(t,u),n=this.parseVertexIndex(n,u),this.addVertex(e,t,n),this.addColor(e,t,n),void 0!==s&&""!==s?(u=this.normals.length,e=this.parseNormalIndex(s,u),t=this.parseNormalIndex(o,u),n=this.parseNormalIndex(l,u),this.addNormal(e,t,n)):this.addFaceNormal(e,t,n),void 0!==r&&""!==r?(s=this.uvs.length,e=this.parseUVIndex(r,s),t=this.parseUVIndex(i,s),n=this.parseUVIndex(a,s),this.addUV(e,t,n),this.object.geometry.hasUVIndices=!0):this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";for(var t=this.vertices.length,n=0,r=e.length;n<r;n++){var i=this.parseVertexIndex(e[n],t);this.addVertexPoint(i),this.addColor(i)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";for(var n=this.vertices.length,r=this.uvs.length,i=0,a=e.length;i<a;i++)this.addVertexLine(this.parseVertexIndex(e[i],n));for(var s=0,o=t.length;s<o;s++)this.addUVLine(this.parseUVIndex(t[s],r))}};return e.startObject("",!1),e}var ni=function(e){var t=r;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Hr(t,e);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Vr(e);if(n=t?(n=Vr(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===zr(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(r);function r(e){if(this instanceof r)return(e=n.call(this,e)).materials=null,e;throw new TypeError("Cannot call a class as a function")}return t=r,(e=[{key:"load",value:function(e,t,n,r){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(n){try{t(i.parse(n))}catch(n){r?r(n):console.error(n),i.manager.itemError(e)}}),n,r)}},{key:"setMaterials",value:function(e){return this.materials=e,this}},{key:"parse",value:function(e){for(var t,n,r,i=new ti,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?(ei.setRGB(parseFloat(d[4]),parseFloat(d[5]),parseFloat(d[6])).convertSRGBToLinear(),i.colors.push(ei.r,ei.g,ei.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?(n=s.slice(1).trim().split(" "),i.addPointGeometry(n)):null!==(l=Jr.exec(s))?(n=(" "+l[0].slice(1).trim()).slice(1),i.startObject(n)):Zr.test(s)?i.object.startMaterial(s.substring(7).trim(),i.materialLibraries):Kr.test(s)?i.materialLibraries.push(s.substring(7).trim()):Wr.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?(r=l[1].trim().toLowerCase(),i.object.smooth="0"!==r&&"off"!==r):i.object.smooth=!0,(r=i.object.currentMaterial())&&(r.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,L=R.materials,k="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=L.length;j<z;j++){var H,V=L[j],J=V.name+"_"+V.smooth+"_"+U,K=i.materials[J];null!==this.materials&&(K=this.materials.create(V.name),!k||!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=k?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=L.length;Z<W;Z++){var X=L[Z];G.addGroup(X.groupStart,X.groupCount,Z)}I=new(k?o.LineSegments:F?o.Points:o.Mesh)(G,N)}else I=new(k?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 n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),r}(o.Loader),ri=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}))};const ii=t.FBXLoader;class ai{constructor(e){this.parses={fbx:new ii,obj:new ni,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 n="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){n=(null==(e=e.asset.ex)?void 0:e.type)||"model"}}}),{type:n,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 n=this.parses.fbx.parse(t,"");return n.traverse((e=>{e.material&&(e.material=this.runScene.materialEx.create())})),{type:"model",result:this.runScene.sceneEx.cleanUnlessLevel(n)}}))}obj(e){return ri(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,s.parseFile)(e,"text"):e;const n=this.parses.obj.parse(t);return n.traverse((e=>{e.material&&(e.material=this.runScene.materialEx.create())})),{type:"model",result:this.runScene.sceneEx.cleanUnlessLevel(n)}}))}json(e){return ri(this,void 0,void 0,(function*(){var t=e instanceof File?yield(0,s.parseFile)(e,"text"):e,n=JSON.parse(t);return"timeLine"===n.type?{type:"timeLine",result:n.data}:{type:"model",result:this.runScene.loaderer.json.parse(t)}}))}}class si 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)},n=()=>{const{renderer:e,controls:t}=this.runScene.assetsEx;var n=this.runScene.render;"tick"===this._lastRenderMode?e.setAnimationLoop(null):"controlsChange"===this._lastRenderMode&&t.removeEventListener("change",n)},r=e=>{var t=this.runScene.render;const{renderer:n,controls:r}=this.runScene.assetsEx;"tick"===e?n.setAnimationLoop(t):"controlsChange"===e&&r.addEventListener("change",t)};return e=>{this._lastRenderMode!==e&&(t(),n(),r(e),this._lastRenderMode=e)}})()}setGlow(e){this.runScene.pp.params.glow.isBloom=e}setRender2(e){this.runScene.assetsEx.setRender2(e)}setRender3(e){this.runScene.assetsEx.setRender3(e)}}class oi extends n(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 li 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 n=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(n),this.targetPosition.multiplyScalar(this.radius).add(n),this.dummy.position.copy(n),this.dummy.lookAt(t.position),this.q1.copy(this.dummy.quaternion),this.dummy.lookAt(this.targetPosition),this.q2.copy(this.dummy.quaternion),this.animating=!0}update(e){if(this.animating){const n=this.runScene.assetsEx.get().camera;e*=this.turnRate;var t=this.controls.target;this.q1.rotateTowards(this.q2,e),n.position.set(0,0,1).applyQuaternion(this.q1).multiplyScalar(this.radius).add(t),n.quaternion.rotateTowards(this.targetQuaternion,e),0===this.q1.angleTo(this.q2)&&(this.animating=!1)}}}class ui{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,n=this.controlsMode,r=this.runScene.modelEx.select||this.runScene.multipSelector.getLast();r&&(this.runScene.multipSelector.draggingchanged(e),t.enabled?(this.modelNewVal=this.runScene.modelEx.cloneV3(r[n]),this.isDraggingChange=!0):(this.runScene.multipSelector.isEmpty()&&this.runScene.modelEx.setV3({model:r,info:n,newV3:this.runScene.modelEx.cloneV3(r[n]),oldV3:this.modelNewVal},!0,!1),this.isDraggingChange=!1),this.runScene.assetsEx.get().controls.enabled=!e.value)},this.runScene=e}init(){const{camera:e,scene:t,engineDom:n}=this.runScene.assetsEx.get();this.tansControls=new oi(e,n),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 li(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,n){return e.userData.isHelper=!0,t&&e.traverse((e=>{e.userData.isHelper=!0,n&&n(e)})),e}focus(e){"running"!==this.runScene.optionsEx.options.mode&&(this.boxHelper||(this.boxHelper=this.getBoxHelper(e)),(0,Ie.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)}}j=n(356);var ci=n.n(j),hi=n(510),di=n(380),pi=n(453);class fi{constructor(e){this.selectors={},this.boxHelperMap={},this.savedV3=new B.Z,this.tempOldval=new Fa.Vector3,this.runScene=e}add(e,t=!1){if("array"===(0,s.getType)(e))return e.map((e=>this.add(e)));var n=this.runScene.modelEx.select;if(n&&(this.runScene.modelEx.selectNull(),delete this.selectors[e.uuid],this.add(n)),"BoxHelper"!==e.type){if(this.selectors[e.uuid]){if(this.remove(e),this.removeBoxHelper(e),!t)return;this.add(e)}this.addBoxHelper(e),this.selectors[e.uuid]=e,this.runScene.cb.model.focus.cb({model:e,status:!0,domActive:!0}),this.runScene.helperEx.focus(e)}}setInfo(e,t,n,r,i,a){"position"!==t&&(i=r,a=n);const 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 di.Z({target:e,info:t,oldV3:this.runScene.modelEx.cloneV3(n),newV3:r,runScene:this.runScene}).execute()];s.map((n=>{if(n!==e){var{x:r,y:i,z:a}=n[t],r=r+=u,i=i+=c,a=a+=h;let e=n[t].clone();e.x=r,e.y=i,e.z=a,r=new di.Z({target:n,info:t,oldV3:this.runScene.modelEx.cloneV3(n[t]),newV3:e,runScene:this.runScene}).execute(),d.push(r),this.boxHelperMap[n.uuid].setFromObject(n)}})),this.boxHelperMap[e.uuid].setFromObject(e),this.runScene.undoEx.addUndo(d)}draggingchanged(e){const t=this.runScene.assetsEx.get().controls;var n;this.isEmpty()?this.runScene.events.mouse.enableUp=!0:this.runScene.events.mouse.enableUp=!1,e.value?this.isEmpty()||(t.enabled=!1,e=this.getLast(),n=this.runScene.helperEx.transContro.controlsMode,this.tempOldval="position"===n?(0,pi.VU)(e,this.runScene.sceneEx.get()):this.runScene.modelEx.cloneV3(e[n]),this.saveV3(n)):t.enabled||this.isEmpty()||(this.runScene.events.mouse.enableUp=!1,this.useV3())}transChange(){if(!this.isEmpty()&&!this.runScene.assetsEx.controls.enabled){var e=this.runScene.helperEx.transContro.controlsMode,t=this.getLast();let n;this.runScene.events.mouse.enableUp=!1,this.runScene.helperEx.boxHelper.setFromObject(this.runScene.assetsEx.get().scene),n="position"===e?(0,pi.VU)(t,this.runScene.sceneEx.get()):this.runScene.modelEx.cloneV3(t[e]),this.getInfo({model:t,type:e,newV3:n,oldV3:this.tempOldval}),this.tempOldval.copy(n)}}saveV3(e){this.getSelectedList("value").map((t=>{var n=(0,Ne.Ki)(t);this.savedV3.set(n,{model:t,type:e,val:this.runScene.modelEx.cloneV3(t[e])})}))}useV3(){var e=this.savedV3.map(((e,{type:t,val:n,model:r})=>new di.Z({target:r,info:t,newV3:this.runScene.modelEx.cloneV3(r[t]),oldV3:n,runScene:this.runScene})));this.runScene.undoEx.addUndo(e),this.savedV3.clear()}getInfo(e){const{model:t,type:n,newV3:r,oldV3:i}=e,a=this.getSelectedList("value");var{x:e,y:s,z:o}=r;const l=e-i.x,u=s-i.y,c=o-i.z;t[n].copy(r),a.map((e=>{if(e!==t){var{x:r,y:i,z:a}=e[n],r=r+=l,i=i+=u,a=a+=c;let t=e[n].clone();t.x=r,t.y=i,t.z=a,e[n].copy(t),this.boxHelperMap[e.uuid].setFromObject(e)}})),this.boxHelperMap[t.uuid].setFromObject(t)}getLast(){var e=this.getSelectedList("value");return e[e.length-1]}addBoxHelper(e){var t=this.runScene.helperEx.getBoxHelper(e);this.boxHelperMap[e.uuid]=t}removeBoxHelper(e){this.runScene.assetsEx.get().scene.remove(this.boxHelperMap[e.uuid]),this.boxHelperMap[e.uuid]=null,delete this.selectors[e.uuid]}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));this.runScene.cb.model.unFocus.cb(e),this.selectors[e.uuid]=null,delete this.selectors[e.uuid]}isEmpty(){return 0===this.getSelectedList("key").length}getSelectedList(e){return"key"===e?Object.keys(this.selectors):Object.values(this.selectors)}getSelect(){var e=Object.values(this.selectors);return 0!==e.length?e:void 0}selectedLoop(e){return Object.keys(this.selectors).map((t=>e(t,this.selectors[t])))}delete(){this.setBoxHelperEmpty(),this.setEmpty(),this.runScene.helperEx.unfocus()}setBoxHelperEmpty(){var e=Object.values(this.boxHelperMap);this.runScene.assetsEx.get().scene.remove(...e),this.boxHelperMap={}}setEmpty(){this.isEmpty()||(this.getSelectedList("value").map((e=>{this.runScene.cb.model.unFocus.cb(e)})),this.setBoxHelperEmpty(),this.selectors={},this.runScene.cb.model.multiSelect.setEmpty.cb())}createGroup(){this.runScene.helperEx.unfocus(),this.runScene.modelEx.selectNull();var e=new o.Group;const t=new o.Group;this.runScene.modelEx.add(e,void 0,{addUndo:!1}),this.runScene.modelEx.add(t);var n=[...this.getSelectedList("value")],r=(this.runScene.cb.model.multipDrop.cb({models:this.getSelectedList("value"),dropModel:e}),ci().group.getCenter(e));t.position.copy(r),this.runScene.cb.model.multipDrop.cb({models:n,dropModel:t}),this.runScene.modelEx.remove(e,!1),this.runScene.modelEx.select=t}getSelectorGroup(){const e=this.getSelectedList("value"),t=new o.Group;return e.forEach((e=>t.add(e.clone()))),this.setEmpty(),t}rename(e){const{prefix:t,rmPrefixLength:n,back:r,rmBackLength:i,fullName:a,step:s}=e,o=this.getSelectedList("value");0!==o.length&&(e=o.map(((e,o)=>{let l=e.name;if(0===a.length){if(0!==n){if(n>l.length)return;l=l.substring(n)}if(0!==i){if(i>l.length)return;l=l.substring(0,l.length-i)}0<t.length&&(l=t+l),0<r.length&&(l+=r)}else l=a+(o+1)*s;return new hi.Z({target:e,info:"name",newVal:l,oldVal:e.name,runScene:this.runScene}).execute()})),this.runScene.undoEx.addUndo(e))}align(e){const t=this.getSelectedList("value");if(0!==t.length){const[r]=t;var n=t.map((t=>{var n=t.position.clone();const i=("all"===e?r:t).position.clone();return"all"!==e&&(i[e]=r.position[e]),new di.Z({target:t,info:"position",oldV3:n,newV3:i,runScene:this.runScene}).execute()}));this.runScene.multipSelector.add(t,!0),this.runScene.undoEx.addUndo(n)}}}function mi(e){return(mi="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 vi(e,t){return(vi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function gi(e){return(gi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var yi=function(e){var t=r;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&vi(t,e);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=gi(e);if(n=t?(n=gi(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===mi(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(r);function r(){if(!(this instanceof r))throw new TypeError("Cannot call a class as a function");var e=r.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}),n.call(this,new o.BoxGeometry(1,1,1),e)}return t=r,Object.defineProperty(t,"prototype",{writable:!1}),t}(o.Mesh),bi=(yi.prototype.isSky=!0,yi.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}"},n(585)),xi=n(651);const wi={color:"#000000",intensity:1};class Si{diff(e,t){const n={};return(0,s.mapObj)(wi,(r=>{var i=e[r];(0,Ue.Xq)(i,t[r])&&(n[r]=i)})),n}setConfig(e,t){var{color:t,intensity:n,shadow:r}=t,{mapSize:r,camera:i}=r||{},{far:i,near:a,scale: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!==r&&(e.shadow.mapSize.x=r,e.shadow.mapSize.y=r),void 0!==n&&(e.intensity=n),void 0!==t&&(e.color=(0,pi.e9)(t)),e.shadow.camera.updateProjectionMatrix(),null!=(s=e.cameraHelper)&&s.update()}}class Ai extends l{constructor(){super(...arguments),this.allState=["morning","noon","evening","night"],this.sun=new Fa.Vector3,this.light=new Si,this.sky=new yi,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"))&&this.setState(e.state)}))}initLight(){var e,t;this.directionalLight||([t]=e=new bi.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:n,lightConfig:r,size:i}=this.skyData;return{currentState:e,effectController:t,isShow:n,lightConfig:r,size:i}}parseJSON(e){var t,n,r;e&&(({isShow:t,currentState:n,size:r}=e),this.skyData.isShow=t,this.initLight(),this.parseLightConfig(e),this.inied||(this.init(),this.inied=!0),this.parseSkyConfig(n,r),this.setOpen(t))}parseLightConfig(e){var t,{isShow:n,effectController:r,currentState:i,lightConfig:a,size:s}=e;e&&a&&(e=a.shadow,t=r[i].lightConfig,bi.Z.setConfig(this.directionalLight,Object.assign(Object.assign({shadow:e},t),this.baseLightConfig)),this.directionalLight.visible=n,this.skyData.lightConfig=a,this.skyData.isShow=n,this.skyData.effectController=r,this.skyData.currentState=i,this.skyData.size=s,this.sky.visible=n,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:n}=e;this.lastTime.name=e,this.lastTime.index=n,this.skyData.currentState=t}getLightDataByState(e){let t=new Fa.Vector3,n=new Fa.Vector3;switch(e){case"morning":t.x=0,t.y=0,t.z=-this.skyData.size,n.x=0,n.y=this.skyData.size/2*-1,n.z=this.skyData.size/2;break;case"noon":t.x=0,t.y=this.skyData.size/2,t.z=0,n.x=0,n.y=-1*this.skyData.size,n.z=0;break;case"evening":case"night":t.x=0,t.y=0,t.z=this.skyData.size,n.x=0,n.y=this.skyData.size/2*-1,n.z=this.skyData.size/2*-1}return{position:t,targetPosition:n}}getIdxByState(e){return this.allState.findIndex((t=>t===e))}setSkyConfig(e){const{renderer:t,scene:n,camera:r}=this.runScene.assetsEx.get();this.sky.material.uniforms.turbidity.value=this.skyData.effectController[e].turbidity,this.sky.material.uniforms.mieCoefficient.value=this.skyData.effectController[e].mieCoefficient,this.sky.material.uniforms.mieDirectionalG.value=this.skyData.effectController[e].mieDirectionalG,t.toneMappingExposure=this.skyData.effectController[e].exposure,t.render(n,r);var i=Fa.MathUtils.degToRad(90-this.skyData.effectController[e].elevation);e=Fa.MathUtils.degToRad(this.skyData.effectController[e].azimuth),this.sun.setFromSphericalCoords(1,i,e),this.sky.material.uniforms.sunPosition.value.copy(this.sun)}setSkyScale(e){this.sky.scale.setScalar(e),this.skyData.size=e}setSky(e){var{state:e,type:t,val:n}=e;this.skyData.effectController[e][t]=n,this.setSkyConfig(e)}setCurrentState(e){this.skyData.currentState=e}setStateTime(e){var{info:e,time:t}=e;this.skyData.effectController[e].time=t}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!=(n=this.directionalLight.cameraHelper)&&n.update();break;case"color":this.skyData.effectController[this.skyData.currentState].lightConfig.color=t;var n=new Fa.Color(t);this.directionalLight.color=n;break;case"intensity":this.skyData.effectController[this.skyData.currentState].lightConfig.intensity=t,this.directionalLight.intensity=t}}setLightSpecialConfig(e){var{color:e,intensity:t}=this.skyData.effectController[e].lightConfig;this.directionalLight.color=(0,pi.e9)(e),this.directionalLight.intensity=t}getAnimasDataByState(e,t){e=this.getIdxByState(e);const n=[];if((t=this.getIdxByState(t))<e){this.animaIndex={begin:e,end:t};var r=e-t;let l=t;for(let e=0;e<r;e++){var{color:i,intensity:a}=this.skyData.effectController[this.allState[l]].lightConfig,{position:s,targetPosition:o}=this.getLightDataByState(this.allState[l]),{color:i,intensity:a}=(n.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[l]],color:i,intensity:a,position:s,targetPosition:o})}),l++,this.skyData.effectController[this.allState[l]].lightConfig),{position:s,targetPosition:o}=this.getLightDataByState(this.allState[l]);n.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 r=t;if(0==l)return n.push({onDone:this.getSpecialFn}),n;for(let e=0;e<l;e++){var{color:u,intensity:c}=this.skyData.effectController[this.allState[r]].lightConfig,{position:h,targetPosition:d}=this.getLightDataByState(this.allState[r]),{position:h,targetPosition:d}=(n.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[r]],color:u,intensity:c,position:h,targetPosition:d})}),r++,this.getLightDataByState(this.allState[r]));n.push({data:this.transDataToAnimaData({sky:this.skyData.effectController[this.allState[r]],color:u,intensity:c,position:h,targetPosition:d}),onDone:3===r?this.getSpecialFn:this.getNromalFn})}}return n}playSky(){if(0!==this.currentAnimas.length){const t=this.currentAnimas.shift();var e=this.currentAnimas.shift();if(!e)return t.onDone();this.playAnima(t,e)}}playAnima(e,t){const{renderer:n,scene:r,camera:i}=this.runScene.assetsEx.get();this.animaInstance=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:a,g:s,b:o}=e,l=(this.onUpdated(e),this.sky.material.uniforms.turbidity.value=e.turbidity,this.sky.material.uniforms.mieCoefficient.value=e.mieCoefficient,this.sky.material.uniforms.mieDirectionalG.value=e.mieDirectionalG,n.toneMappingExposure=e.exposure,n.render(r,i),Fa.MathUtils.degToRad(90-e.elevation)),u=Fa.MathUtils.degToRad(t.data.azimuth);this.sun.setFromSphericalCoords(1,l,u),this.sky.material.uniforms.sunPosition.value.copy(this.sun),l=new Fa.Color(a,s,o),this.directionalLight.color=l,this.directionalLight.intensity=e.intensity,this.directionalLight.position.set(e.x,e.y,e.z),this.directionalLight.target.position.set(e.tx,e.ty,e.tz)}),(()=>{t.onDone(),this.animaInstance=null}))}doAnimaByState(e,t){e=this.getAnimasDataByState(e,t),this.animaInstance?this.awaitAnimas=e:(this.currentAnimas=e,this.playSky())}onUpdated(e){var t;0!==this.awaitAnimas.length&&(this.animaInstance.kill(),this.animaInstance=null,[t]=this.awaitAnimas,this.currentAnimas=[...this.awaitAnimas],this.awaitAnimas=[],null!=t&&t.data&&(this.currentAnimas.unshift({data:t.data,onDone:this.getNromalFn}),this.currentAnimas.unshift({data:e})),this.playSky())}lightAnima(e){var{position:e,targetPosition:t}=this.getLightDataByState(e);this.directionalLight.position.set(e.x,e.y,e.z),this.directionalLight.target.position.set(t.x,t.y,t.z)}transDataToAnimaData(e){var{sky:e,color:t,position:n,targetPosition:r,intensity:i}=e,{x:n,y:a,z:s}=n,{x:r,y:o,z:l}=r,{r:t,g:u,b:c}=(0,Ue.fh)((0,Ue.I8)(t));return Object.assign(Object.assign({},e),{r:t,g:u,b:c,x:n,y:a,z:s,tx:r,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,xi.d9)(wi)),{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,xi.d9)(wi)),{color:"#FFFFFF"})},evening:{turbidity:2,rayleigh:.3,mieCoefficient:.011,mieDirectionalG:.67,elevation:3,azimuth:0,exposure:.3762,lightConfig:Object.assign(Object.assign({},(0,xi.d9)(wi)),{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,xi.d9)(wi)),{color:"#B8A277"}),time:1}},currentState:"morning"}}}class Mi{constructor(e){this.clean=()=>{this.sky.clean()},this.sky=new Ai(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 Bi(){var e=0,t=document.createElement("div");function n(e){return t.appendChild(e.dom),e}function r(n){for(var r=0;r<t.children.length;r++)t.children[r].style.display=r===n?"block":"none";e=n}t.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",t.addEventListener("click",(function(n){n.preventDefault(),r(++e%t.children.length)}),!1);var i,a=(performance||Date).now(),s=a,o=0,l=n(new Bi.Panel("FPS","#0ff","#002")),u=n(new Bi.Panel("MS","#0f0","#020"));return self.performance&&self.performance.memory&&(i=n(new Bi.Panel("MB","#f08","#201"))),r(0),{REVISION:16,dom:t,addPanel:n,showPanel:r,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:r}}Bi.Panel=function(e,t,n){var r=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=n,v.fillRect(0,0,o,l),v.fillStyle=t,v.fillText(e,u,c),v.fillRect(h,d,p,f),v.fillStyle=n,v.globalAlpha=.9,v.fillRect(h,d,p,f),{dom:m,update:function(l,g){r=Math.min(r,l),i=Math.max(i,l),v.fillStyle=n,v.globalAlpha=1,v.fillRect(0,0,o,d),v.fillStyle=t,v.fillText(a(l)+" "+e+" ("+a(r)+"-"+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=n,v.globalAlpha=.9,v.fillRect(h+p-s,d,s,a((1-l/g)*f))}}};const Ci=Bi;class Ei{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:n,cb:r}=t;e&&clearTimeout(e),e=setTimeout((()=>{r(),e=null,clearTimeout(e)}),n)}})(),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=Ci(),this.stats.showPanel(0),e.appendChild(this.stats.dom)}render(){var e;null!=(e=this.stats)&&e.update()}log(e,t="detail",n="success"){var r;null!=(r=null==(r=this.options)?void 0:r.msg)&&r.show&&("base"===this.options.msg.level&&"base"===t&&this.runScene.cb.baseLog.cb({msg:e,type:n}),console.log(e))}}class Ti{constructor(e){this.glowModelLength=new Set,this.outlineModelLength=new Set,this.runScene=e,this.initGlow(),this.initOutline()}initGlow(){const{setLayers:e,add:t,remove:n}=this.runScene.cb.model;e.add("pp-set-glow",(e=>{var{model:e,val:t}=e;0===t&&0===this.glowModelLength.size||this[0===t?"glowRemove":"glowAdd"](e)})),t.add("pp-set-glow",(({model:e})=>{1!==e.layers.mask&&this.glowAdd(e)})),n.add("pp-set-glow",(({model:e})=>{1!==e.layers.mask&&this.glowRemove(e)}))}glowAdd(e){this.glowModelLength.add(e.userData.id),0<this.glowModelLength.size&&(this.runScene.cb.pp.glow.setStatus.cb(!0),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:n}=this.runScene.cb.model;e.add("pp-set-outline",(e=>{var{model:e,val:t}=e;!t&&0===this.outlineModelLength.size||this[t?"outlineAdd":"outlineRemove"](e)})),t.add("pp-set-outline",(({model:e})=>{e.userData.outline&&this.outlineAdd(e)})),n.add("pp-set-outline",(({model:e})=>{e.userData.outline&&this.outlineRemove(e)}))}outlineAdd(e){this.outlineModelLength.add(e.userData.id),0<this.outlineModelLength.size&&(this.runScene.cb.pp.outline.setStatus.cb(!0),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 _i=n(608),Di=n(180),Pi=n(819),Oi={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 Ri(e){return(Ri="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 Ii(e,t){return(Ii=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Li(e){return(Li=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var ki=function(e){var t=r;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ii(t,e);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Li(e);if(n=t?(n=Li(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===Ri(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(r);function r(e,t,i,a){var s;if(!(this instanceof r))throw new TypeError("Cannot call a class as a function");(s=n.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=Oi;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===_i.C&&console.error("THREE.UnrealBloomPass relies on CopyShader"),e=_i.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 Pi.T(null),s}return t=r,(e=[{key:"dispose",value:function(){for(var e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(var t=0;t<this.renderTargetsVertical.length;t++)this.renderTargetsVertical[t].dispose();this.renderTargetBright.dispose()}},{key:"setSize",value:function(e,t){var n=Math.round(e/2),r=Math.round(t/2);this.renderTargetBright.setSize(n,r);for(var i=0;i<this.nMips;i++)this.renderTargetsHorizontal[i].setSize(n,r),this.renderTargetsVertical[i].setSize(n,r),this.separableBlurMaterials[i].uniforms.texSize.value=new o.Vector2(n,r),n=Math.round(n/2),r=Math.round(r/2)}},{key:"render",value:function(e,t,n,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=n.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=n.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this.fsQuad.render(e),this.renderTargetBright),l=0;l<this.nMips;l++)this.fsQuad.material=this.separableBlurMaterials[l],this.separableBlurMaterials[l].uniforms.colorTexture.value=o.texture,this.separableBlurMaterials[l].uniforms.direction.value=r.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=r.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(n),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 n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),r}(Pi.w);ki.BlurDirectionX=new o.Vector2(1,0),ki.BlurDirectionY=new o.Vector2(0,1);class Fi extends Pi.w{constructor(e,t,n){super(),this.baseTextureID=void 0!==t?t:"tDiffuse",this.effectTextureID=void 0!==n?n:"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 Pi.T(this.material)}render(e,t,n){this.uniforms[this.baseTextureID]&&(this.uniforms[this.baseTextureID].value=t.texture),this.uniforms[this.effectTextureID]&&(this.uniforms[this.effectTextureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)),this.fsQuad.render(e)}}class Ui extends Pi.w{constructor(e,t,n,r,i){super(),this.scene=e,this.camera=t,this.layerIndex=0,this.overrideMaterial=n,this.clearColor=r,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,n){var r=e.autoClear;let i,a;e.autoClear=!1,void 0!==this.overrideMaterial&&(a=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this.oldClearColor),i=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.sceneBg&&(this.scene.background=null),e.setRenderTarget(this.renderToScreen?null:n),this.clear&&e.clear(e.autoClearColor,this.clearDepth,e.autoClearStencil),this.camera.layers.set(this.layerIndex),e.render(this.scene,this.camera),this.camera.layers.mask=this.oldCameraLayer,this.scene.background=this.sceneBg,this.clearColor&&e.setClearColor(this.oldClearColor,i),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=a),this.scene.background=this.sceneBg,e.autoClear=r}}const Gi={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 Ni{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 Ui(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 Fi(Gi,"baseTexture","bloomTexture"),this.mixingPass.renderToScreen=!1),this.effectCopy||(this.effectCopy=new Di.T(_i.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 ji(e){return(ji="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 zi(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Hi(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Vi(e,t,n){t&&Hi(e.prototype,t),n&&Hi(e,n),Object.defineProperty(e,"prototype",{writable:!1})}function Ji(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&&Ki(e,t)}function Ki(e,t){return(Ki=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Zi(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Wi(e);if(n=t?(n=Wi(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===ji(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function Wi(e){return(Wi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var Xi=function(){Ji(t,Pi.w);var e=Zi(t);function t(n,r){var i;return zi(this,t),(i=e.call(this)).scene=n,i.camera=r,i.clear=!0,i.needsSwap=!1,i.inverse=!1,i}return Vi(t,[{key:"render",value:function(e,t,n){var r,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?(r=0,1):(r=1,0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(a.REPLACE,a.REPLACE,a.REPLACE),s.buffers.stencil.setFunc(a.ALWAYS,r,4294967295),s.buffers.stencil.setClear(i),s.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),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}(),Qi=function(){Ji(t,Pi.w);var e=Zi(t);function t(){var n;return zi(this,t),(n=e.call(this)).needsSwap=!1,n}return Vi(t,[{key:"render",value:function(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}]),t}();function Yi(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var qi=function(){function e(t,n){var r;(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),this.renderer=t,void 0===n?(r=t.getSize(new o.Vector2),this._pixelRatio=t.getPixelRatio(),this._width=r.width,this._height=r.height,(n=new o.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio)).texture.name="EffectComposer.rt1"):(this._pixelRatio=1,this._width=n.width,this._height=n.height),this.renderTarget1=n,this.renderTarget2=n.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],void 0===_i.C&&console.error("THREE.EffectComposer relies on CopyShader"),void 0===Di.T&&console.error("THREE.EffectComposer relies on ShaderPass"),this.copyPass=new Di.T(_i.C),this.clock=new o.Clock}return function(e,t,n){t&&Yi(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1})}(e,[{key:"swapBuffers",value:function(){var e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}},{key:"addPass",value:function(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}},{key:"insertPass",value:function(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}},{key:"removePass",value:function(e){-1!==(e=this.passes.indexOf(e))&&this.passes.splice(e,1)}},{key:"isLastEnabledPass",value:function(e){for(var t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}},{key:"render",value:function(e){void 0===e&&(e=this.clock.getDelta());for(var t=this.renderer.getRenderTarget(),n=!1,r=0,i=this.passes.length;r<i;r++){var a,s,o=this.passes[r];!1!==o.enabled&&(o.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(r),o.render(this.renderer,this.writeBuffer,this.readBuffer,e,n),o.needsSwap&&(n&&(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!==Xi&&(o instanceof Xi?n=!0:o instanceof Qi&&(n=!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 n=this._width*this._pixelRatio,r=this._height*this._pixelRatio;this.renderTarget1.setSize(n,r),this.renderTarget2.setSize(n,r);for(var i=0;i<this.passes.length;i++)this.passes[i].setSize(n,r)}},{key:"setPixelRatio",value:function(e){this._pixelRatio=e,this.setSize(this._width,this._height)}}]),e}();new o.OrthographicCamera(-1,1,1,-1,0,1),(N=new o.BufferGeometry).setAttribute("position",new o.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),N.setAttribute("uv",new o.Float32BufferAttribute([0,2,0,0,2,0],2));const $i="\n varying vec2 vUv;\n \n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",ea="\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 ta{constructor(e){this.mtuPP=e,this.bloomLayer=new Fa.Layers,this.bloomLayer.set(this.mtuPP.BLOOM_SCENE),this.darkMaterial=new Fa.MeshBasicMaterial({color:"black"}),this.materials={},(e=this.mtuPP.mainScene).fog&&(this.mtuPP.sceneFogColor||(this.mtuPP.sceneFogColor=new Fa.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 Di.T(new Fa.ShaderMaterial({uniforms:{baseTexture:{value:null},bloomTexture:{value:this.mtuPP.effectComposer.renderTarget2.texture}},vertexShader:$i,fragmentShader:ea,defines:{}}),"baseTexture"),this.finalPass.needsSwap=!0;var e=new Fa.WebGLRenderTarget(this.mtuPP.rtSize.x,this.mtuPP.rtSize.y,{samples:this.mtuPP.params.pp.samples});this.finalComposer=new qi(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 na=n(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 ia extends ra{constructor(...e){super(...e),this.modifiedDefines={},this.modifiedUniforms={}}setDefine(e,t){const n=this.defines,r=this.modifiedDefines;null==t?e in n&&(e in r||(r[e]=n[e]),delete n[e]):n[e]!==t&&(e in r||(r[e]=e in n?n[e]:void 0),n[e]=t)}setTextureUniform(e,t){const n=this.uniforms,r=this.modifiedUniforms;e in r||(r[e]=n[e].value),n[e].value=t}finalize(){const e=this.modifiedDefines;var t=this.defines;for(const n in e)void 0===e[n]?n in t&&(this.needsUpdate=!0):t[n]!==e[n]&&(this.needsUpdate=!0),delete e[n];const n=this.modifiedUniforms;var r=this.uniforms;for(const e in n)n[e]!==r[e].value&&(this.needsUpdate=!0),delete n[e]}}const aa=new WeakMap;class sa{constructor(e){this._replacementMaterial=new ia(e),this._replacementMaterials=new WeakMap,this.overrideUniforms={},this.overrideDefines={}}replace(e,t=!1,n=!0){const r=this;function i(e){if(!e.isHelper&&(e.isMesh||e.isSkinnedMesh)){if(!a.has(e)){const t=r.createMaterial(e);a.set(e,t)}const t=a.get(e);if(null!==t){let i=e.material;n?s.set(e,i):i=s.get(e),i||console.error("ShaderReplacement : Material for object was not cached before replacing shader.",e),r.updateUniforms(e,i,t),t.finalize&&t.finalize(),e.material=t}}}const a=this._replacementMaterials,s=aa;if(Array.isArray(e))if(t)for(let t=0,n=e.length;t<n;t++)e[t].traverse(i);else for(let t=0,n=e.length;t<n;t++)i(e[t]);else t?e.traverse(i):i(e)}reset(e,t){function n(e){e.isHelper||(r.has(e)?(e.material=r.get(e),r.delete(e)):(e.isSkinnedMesh||e.isMesh)&&console.error("ShaderReplacement : Material for object was not cached before resetting.",e))}const r=aa;if(Array.isArray(e))if(t)for(let t=0,r=e.length;t<r;t++)n(e[t]);else for(let t=0,r=e.length;t<r;t++)e[t].traverse(n);else t?e.traverse(n):n(e)}createMaterial(e){return this._replacementMaterial.clone()}updateUniforms(e,t,n){var r=this._replacementMaterial.defines,i=t.defines;const a=n.defines;if(n.side=t.side,n.flatShading=t.flatShading,n.skinning=t.skinning,i){for(const e in i)n.setDefine(e,i[e]);for(const e in a)e in i?n.setDefine(e,i[e]):n.setDefine(e,r[e])}const s=n.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?n.setTextureUniform(e,l.value):t.value=l.value)}}else for(const e in s){const r=s[e];e in t&&t[e]!==r.value&&(r.value&&r.value.isTexture||t[e]&&t[e].isTexture?n.setTextureUniform(e,t[e]):r.value=t[e])}var{overrideDefines:u,overrideUniforms:c}=this;for(const e in u)null===u[e]||void 0===u[e]?delete a[e]:a[e]!==u[e]&&(a[e]=u[e],n.needsUpdate=!0);for(const e in c)e in s&&(s[e].value=c[e].value)}dispose(){}}class oa extends sa{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,n){super.updateUniforms(e,t,n),n.setDefine("USE_NORMALMAP",this.useNormalMaps&&n.uniforms.normalMap.value?"":void 0),n.setDefine("TANGENTSPACE_NORMALMAP",this.useNormalMaps&&n.uniforms.normalMap.value?"":void 0),n.setDefine("ALPHATEST",n.uniforms.alphaTest.value||void 0),n.setDefine("USE_ALPHAMAP",0!==n.defines.ALPHATEST&&n.uniforms.alphaMap.value?"":void 0),n.setDefine("USE_MAP",0!==n.defines.ALPHATEST&&n.uniforms.map.value?"":void 0),n.setDefine("USE_UV","USE_ALPHAMAP"in n.defines||"USE_MAP"in n.defines?"":void 0)}}class la extends sa{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,n){super.updateUniforms(e,t,n),this.invertSide&&(n.side=n.side===o.FrontSide?o.BackSide:o.FrontSide),e=n.defines.ALPHATEST,0===n.uniforms.alphaTest.value?delete n.defines.ALPHATEST:n.defines.ALPHATEST=n.uniforms.alphaTest.value,e!==n.defines.ALPHATEST&&(n.needsUpdate=!0),e=n.defines.USE_ALPHAMAP,0!==n.defines.ALPHATEST&&n.uniforms.alphaMap.value?n.defines.USE_ALPHAMAP="":delete n.defines.USE_ALPHAMAP,e!==n.defines.USE_ALPHAMAP&&(n.needsUpdate=!0),e=n.defines.USE_MAP,0!==n.defines.ALPHATEST&&n.uniforms.map.value?n.defines.USE_MAP="":delete n.defines.USE_MAP,e!==n.defines.USE_MAP&&(n.needsUpdate=!0),e=n.defines.USE_UV,"USE_ALPHAMAP"in n.defines||"USE_MAP"in n.defines?n.defines.USE_UV="":delete n.defines.USE_UV,e!==n.defines.USE_UV&&(n.needsUpdate=!0)}}const ua={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"},ca={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"},ha={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"},da={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 pa{constructor(e){this.count=0,this.size=-1,this.sigma=-1,this.radius=-1,this.lookupTable=null,this.score=null,this.binaryPattern=null,this.resize(e),this.setSigma(1.5)}findVoid(){var e,{score:t,binaryPattern:n}=this;let r=1/0,i=-1;for(let a=0,s=n.length;a<s;a++)0===n[a]&&(e=t[a])<r&&(r=e,i=a);return i}findCluster(){var e,{score:t,binaryPattern:n}=this;let r=-1/0,i=-1;for(let a=0,s=n.length;a<s;a++)1===n[a]&&(e=t[a])>r&&(r=e,i=a);return i}setSigma(e){if(e!==this.sigma){var t=~~(Math.sqrt(20*Math.pow(e,2))+1),n=2*t+1;const s=new Float32Array(n*n);var r=e*e;for(let e=-t;e<=t;e++)for(let o=-t;o<=t;o++){var i=(t+o)*n+e+t,a=e*e+o*o;s[i]=Math.pow(Math.E,-a/(2*r))}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:n}=this;t.fill(0);for(let t=0,a=e.length;t<a;t++){var r,i;0===e[t]?(r=~~(t/n),i=t-r*n,this.updateScore(i,r,1),e[t]=1):e[t]=0}}updateScore(e,t,n){const{size:r,score:i,lookupTable:a}=this;var 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?r+d:d%r,t+h);var u=(p=p<0?r+p:p%r)*r+d;i[u]+=n*l}}addPointIndex(e){this.binaryPattern[e]=1;var t=this.size,n=~~(e/t);this.updateScore(e-n*t,n,1),this.count++}removePointIndex(e){this.binaryPattern[e]=0;var t=this.size,n=~~(e/t);this.updateScore(e-n*t,n,-1),this.count--}copy(e){this.resize(e.size),this.score.set(e.score),this.binaryPattern.set(e.binaryPattern),this.setSigma(e.sigma),this.count=e.count}}class fa{constructor(){this.random=Math.random,this.sigma=1.5,this.size=64,this.majorityPointsRatio=.1,this.samples=new pa(1),this.savedSamples=new pa(1)}generate(){const{samples:e,savedSamples:t,sigma:n,majorityPointsRatio:r,size:i}=this;e.resize(i),e.setSigma(n);var a=Math.floor(i*i*r),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,n=s.length;t<n;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 ma extends Pi.w{constructor(e,t){super(),this.enabled=!0,this.needsSwap=!0,this.scene=e,this.camera=t,this.debug={display:ma.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=ma.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 la,this._normalBuffer=new o.WebGLRenderTarget(1,1,{minFilter:o.NearestFilter,magFilter:o.NearestFilter,format:o.RGBAFormat}),this._normalReplacement=new oa,this.gtaoQuad=new Pi.T(new o.ShaderMaterial(ha)),this.debugPackedQuad=new Pi.T(new o.ShaderMaterial(ua)),this.debugDepthQuad=new Pi.T(new o.ShaderMaterial(ca)),this.compositeQuad=new Pi.T(new o.ShaderMaterial(da));const n=new fa,r=(n.size=32,new Uint8Array(4*Math.pow(32,2)));for(let e=0;e<4;e++){var i=n.generate(),a=i.data,s=i.maxValue;for(let t=0,n=a.length;t<n;t++)r[4*t+e]=a[t]/s*255}this.blueNoiseTex=new o.DataTexture(r,n.size,n.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 n=this.renderTargetScale,r=Math.floor(e*n);n=Math.floor(t*n),this._depthBuffer.setSize(e,t),this._normalBuffer.setSize(e,t),this._gtaoBuffer.setSize(r,n)}render(e,t,n){t=this.renderToScreen?null:t;const{scene:r,camera:i,debug:a,debugPackedQuad:s,debugDepthQuad:l,compositeQuad:u,gtaoQuad:c}=this,h=c.material;ma.RendererState.copy(e,r);var d=()=>{ma.RendererState.restore(e,r),f.reset(r,!0)},p=this._depthBuffer;const f=this._depthReplacement;if(r.background=null,f.replace(r,!0,!0),e.setRenderTarget(p),e.setClearColor(ma.BlackColor,0),e.clear(),e.render(r,i),a.display===ma.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(r,!0,!1),e.setRenderTarget(v),e.clear(),e.render(r,i),a.display===ma.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=n.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=n.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(n.width,n.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===ma.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===ma.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()}}ma.NO_JITTER=0,ma.RANDOM_JITTER=1,ma.BLUENOISE_JITTER=2,ma.DEFAULT=0,ma.DEPTH=1,ma.NORMAL=2,ma.AO_SAMPLE=3,ma.COLOR_SAMPLE=4,ma.NO_BLUR=0,ma.BOX_BLUR=1,ma.CROSS_BLUR=2,ma.DIAGONAL_BLUR=3,ma.BlackColor=new o.Color(0),ma.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 va{constructor(e){this.mtuPP=e,this.mtuPP.renderer&&this.postProcessing()}postProcessing(){this.gtaoPass||(this.gtaoPass=new ma(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 Fa.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 ga(e){return(ga="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 ya(e,t){return(ya=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ba(e){return(ba=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var xa=function(e){var t=r;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ya(t,e);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=ba(e);if(n=t?(n=ba(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===ga(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(r);function r(e,t,i,a,s){var l;if(this instanceof r)return(l=n.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=r,(e=[{key:"render",value:function(e,t,n){var r,i,a=e.autoClear;e.autoClear=!1,void 0!==this.overrideMaterial&&(i=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this._oldClearColor),r=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:n),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor&&e.setClearColor(this._oldClearColor,r),void 0!==this.overrideMaterial&&(this.scene.overrideMaterial=i),e.autoClear=a}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),r}(Pi.w),wa={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"},Sa={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 Aa={radius:{type:"number",val:.6,shortKey:"r",onUpdate({type:e,data:t,runScene:n}){n.pp.setGlowData(e,t)}},strength:{type:"number",val:1.5,shortKey:"s",onUpdate({type:e,data:t,runScene:n}){n.pp.setGlowData(e,t)}},threshold:{type:"number",val:0,shortKey:"t",onUpdate({type:e,data:t,runScene:n}){n.pp.setGlowData(e,t)}}},Ma={edgeStrength:{type:"number",val:3,shortKey:"es",onUpdate({type:e,data:t,runScene:n}){n.pp.setOutlineData(e,t)}},edgeGlow:{type:"number",val:0,shortKey:"eg",onUpdate({type:e,data:t,runScene:n}){n.pp.setOutlineData(e,t)}},edgeThickness:{type:"number",val:1,shortKey:"et",onUpdate({type:e,data:t,runScene:n}){n.pp.setOutlineData(e,t)}},pulsePeriod:{type:"number",val:0,shortKey:"pp",onUpdate({type:e,data:t,runScene:n}){n.pp.setOutlineData(e,t)}},visibleEdgeColor:{type:"color_str",val:"#FFFFFF",shortKey:"vec",onUpdate({type:e,data:t,runScene:n}){n.pp.setOutlineData(e,t)}},hiddenEdgeColor:{type:"color_str",val:"#190A05",shortKey:"hec",onUpdate({type:e,data:t,runScene:n}){n.pp.setOutlineData(e,t)}}},Ba={directionOffset:{type:"number",val:0,shortKey:"do",onUpdate({type:e,data:t,runScene:n}){n.pp.setAOData(e,t)}},stepOffset:{type:"number",val:0,shortKey:"so",onUpdate({type:e,data:t,runScene:n}){n.pp.setAOData(e,t)}},rotationJitter:{type:"other",val:"NONE",shortKey:"roj",onUpdate({type:e,data:t,runScene:n}){n.pp.setAOData(e,t)}},radiusJitter:{type:"other",val:"NONE",shortKey:"raj",onUpdate({type:e,data:t,runScene:n}){n.pp.setAOData(e,t)}},numSteps:{type:"number",val:8,shortKey:"ns",onUpdate({type:e,data:t,runScene:n}){n.pp.setAOData(e,t)}},numDirections:{type:"number",val:1,shortKey:"nd",onUpdate({type:e,data:t,runScene:n}){n.pp.setAOData(e,t)}},intensity:{type:"number",val:1,shortKey:"i",onUpdate({type:e,data:t,runScene:n}){n.pp.setAOData(e,t)}},radius:{type:"number",val:2,shortKey:"r",onUpdate({type:e,data:t,runScene:n}){n.pp.setAOData(e,t)}},enableFalloff:{type:"other",val:!0,shortKey:"ef",onUpdate({type:e,data:t,runScene:n}){n.pp.setAOData(e,t)}},falloffStart:{type:"number",val:.4,shortKey:"fs",onUpdate({type:e,data:t,runScene:n}){n.pp.setAOData(e,t)}},falloffEnd:{type:"number",val:2,shortKey:"fe",onUpdate({type:e,data:t,runScene:n}){n.pp.setAOData(e,t)}},renderTargetScale:{type:"number",val:.5,shortKey:"rts",onUpdate({type:e,data:t,runScene:n}){n.pp.setAOData(e,t)}},blurMode:{type:"other",val:"NO_BLUR",shortKey:"bm",onUpdate({type:e,data:t,runScene:n}){n.pp.setAOData(e,t)}},blurIterations:{type:"number",val:5,shortKey:"bi",onUpdate({type:e,data:t,runScene:n}){n.pp.setAOData(e,t)}},blurStride:{type:"number",val:1,shortKey:"bs",onUpdate({type:e,data:t,runScene:n}){n.pp.setAOData(e,t)}},ambientColor:{type:"color_str",val:"#FFFFFF",shortKey:"ac",onUpdate({type:e,data:t,runScene:n}){n.pp.setAOData(e,t)}},ambientIntensity:{type:"number",val:0,shortKey:"ai",onUpdate({type:e,data:t,runScene:n}){n.pp.setAOData(e,t)}},lightBounceIntensity:{type:"number",val:0,shortKey:"lbi",onUpdate({type:e,data:t,runScene:n}){n.pp.setAOData(e,t)}}};var Ca=n(398);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 Fa.Color(0),this.runScene=e,this.info=new Ti(this.runScene),this.isSafari=-1<navigator.userAgent.indexOf("Safari"),this.isChrome=-1<navigator.userAgent.indexOf("Chrome"),this.rtSize=new Fa.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 Fa.Color(t.color)),"background"===e&&(this.sceneBackground&&(0,Oe.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:Aa}),this.runScene.snapshot.bind({name:"outline",target:this.params.outline,def:Ma}),this.runScene.snapshot.bind({name:"ao",target:this.params.ao,def:Ba,set:e=>{const t=e.snapshot.data.get("ao");t&&(Ca.LV.set({def:Ba,runScene:this.runScene,data:t,target:this.params.ao,map:e}),e.data.completedCbs.push((()=>{(0,s.mapObj)(Ba,((e,n)=>{var{type:n,val:r,shortKey:i}=n;"other"===n&&this.setAOData(e,void 0!==t[i]?t[i]:r)}))})))}})}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,Ue.U)(this.params,this.getDefaultParams())}init(){try{var{camera:e,scene:t,renderer:n}=this.runScene.assetsEx.get();this.mainScene=t,this.mainCamera=e,this.renderer=n,this.renderer&&(this.renderer.getSize(this.rtSize),this.postProcessing())}catch(e){console.log("Error: ",e)}this.runScene.cb.loaderer.gltf.loadNode.add("outline-objects",(({node:e,nodeDef:t})=>{t.extras&&t.extras.outline&&this.mtOutline.addSelectedObject(e)}))}postProcessing(){this.effectComposer=new qi(this.renderer,this.getNewRenderTarget(this.params.pp.samples)),this.renderPass=new xa(this.mainScene,this.mainCamera),this.fxaaPass=new Di.T(wa),this.fxaaPass.uniforms.resolution.value.set(1/window.innerWidth,1/window.innerHeight),this.vignettePass=new Di.T(Sa),this.effectComposer.addPass(this.renderPass),this.ppOutline(),this.ppGlow(),this.ppAO(),this.effectComposer.addPass(this.vignettePass)}getNewRenderTarget(e){const t=new Fa.WebGLRenderTarget(this.rtSize.x,this.rtSize.y,{samples:e});return t.depthTexture=new Fa.DepthTexture(this.rtSize.x,this.rtSize.y),t.depthTexture.type=Fa.UnsignedIntType,t.depthTexture.format=Fa.DepthFormat,t.texture.format=Fa.RGBAFormat,t.texture.encoding=Fa.sRGBEncoding,t}ppOutline(){this.mtOutline=new na.Q(this)}ppGlow(){this.isChrome?(this.effectComposer.renderToScreen=!0,this.mtuGlow=new Ni(this)):this.isSafari&&(this.effectComposer.renderToScreen=!1,this.threeGlow=new ta(this))}ppAO(){this.mtAO=new va(this)}toJSON(){const e={};var{pp:t,glow:n,outline:r,ao:i,vignette:a}=this.params;return e.ppParams=Object.assign({},t),e.bloomParams=Object.assign({},n),e.outlineParams=Object.assign({},r),e.aoParams=Object.assign({},i),e.vignetteParams=Object.assign({},a),JSON.stringify(e)}fromJSON(e){var{ppParams:e,bloomParams:t,outlineParams:n,aoParams:r,vignetteParams:i}=e;e&&(e=e.samples,this.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)),n&&this.mtOutline&&(this.params.outline.isOutline=n.isOutline,this.setOutlineData("edgeStrength",n.edgeStrength),this.setOutlineData("edgeGlow",n.edgeGlow),this.setOutlineData("edgeThickness",n.edgeThickness),this.setOutlineData("pulsePeriod",n.pulsePeriod),this.setOutlineData("visibleEdgeColor",n.visibleEdgeColor),this.setOutlineData("hiddenEdgeColor",n.hiddenEdgeColor),this.runScene.cb.pp.outline.setData.cb(this.params.outline)),r&&this.mtAO&&(this.params.ao.isAO=r.isAO,this.setAOData("directionOffset",r.directionOffset),this.setAOData("stepOffset",r.stepOffset),this.setAOData("rotationJitter",r.rotationJitter),this.setAOData("radiusJitter",r.radiusJitter),this.setAOData("numSteps",r.numSteps),this.setAOData("numDirections",r.numDirections),this.setAOData("intensity",r.intensity),this.setAOData("radius",r.radius),this.setAOData("enableFalloff",r.enableFalloff),this.setAOData("falloffStart",r.falloffStart),this.setAOData("falloffEnd",r.falloffEnd),this.setAOData("renderTargetScale",r.renderTargetScale),this.setAOData("blurMode",r.blurMode),this.setAOData("blurIterations",r.blurIterations),this.setAOData("blurStride",r.blurStride),this.setAOData("ambientColor",r.ambientColor),this.setAOData("ambientIntensity",r.ambientIntensity),this.setAOData("lightBounceIntensity",r.lightBounceIntensity),this.runScene.cb.pp.ao.setData.cb(this.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 Ta=n(738);class _a extends l{constructor(e){super(e),this.map=new B.Z,this.playLimit=new Ue.cM,this.renderName="script-texture-render",this._clock=new o.Clock,this.bindEvent()}parse(e,t){var n=(0,Ne.Ki)(t);0===Object.keys(e||{}).length?this.map.has(n)&&this.map.delete(n):this.map.set(n,{texture:t,uvScript:e})}bindEvent(){this.runScene.cb.texture.setAnima.add("script-texture-set-anima",(({uvScript:e,texture:t})=>this.parse(e,t))),this.runScene.cb.texture.add.add("script-texture-add-texture",(e=>{var t=e.userData.uvScript;t&&this.parse(t,e)}))}_playAll(){this.map.forEach((e=>{const{texture:t,uvScript:n}=e;var{moveX:e,moveY:r,rotate:i}=n;t.userData.scriptTextre||(t.userData.scriptTextre={offsetX:t.offset.x,offsetY:t.offset.y,rotation:t.rotation}),e&&(t.offset.x+=e),r&&(t.offset.y+=r),i&&(t.rotation+=i)}))}playAll(){const{scriptFrame:e,mode:t}=this.runScene.optionsEx.options.renderConfig;-1===e&&"tick"===t?this.runScene.cb.render.add(this.renderName,(()=>{this._playAll()})):this.runScene.cb.render.add(this.renderName,(()=>{this.playLimit.update({cb:()=>{this._playAll()},cbRate:1/e,now:this._clock.getDelta()})}))}closeAll(){this.map.forEach((e=>{const t=e.texture;let n=0,r=0,i=0;t.userData.scriptTextre&&(n=(e=t.userData.scriptTextre).offsetX,r=e.offsetY,i=e.rotation,delete t.userData.scriptTextre),t.offset.x=n,t.offset.y=r,t.rotation=i})),this.runScene.cb.render.delete(this.renderName)}has(e){return void 0!==e.userData.uvScript}get(e){return e.userData.uvScript}set(e,t){t.userData.uvScript=e}}class Da extends l{constructor(e){super(e),this.runAll=!1,this.texture=new _a(e)}playAll(){this.runAll||(this.runAll=!0,this.texture.playAll())}closeAll(){this.runAll&&(this.runAll=!1,this.texture.closeAll())}}class Pa{constructor(e){this.map=new B.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,Ne.Ki)(e);t&&this.map.map(((e,n)=>{n.delete(t)}))}))}get(e){return this.map.get(e)}add(e){this.get(e)||this.map.set(e,new De.Z)}rename(e,t){const n=this.get(e);n&&(this.addId(t,n.toArray()),this.remove(e))}addId(e,t){this.map.has(e)||this.add(e),this.map.get(e).add(t)}addModel(e,t){if(this.map.has(e)||this.add(e),(0,Ue.lG)(t,"array"))return t.map((t=>{this.addModel(e,t)}));this.map.get(e).add((0,Ne.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,Ue.lG)(t,"array")?t.map((t=>{this.removeModel(e,t)})):void this.map.get(e).remove((0,Ne.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,n)=>{e[t]=[...n.filter((e=>this.runScene.modelEx.getById(e)))]})),e}parseJSON(e){let t={};(0,s.mapObj)(e,((e,n)=>{t[e]=new De.Z(n)})),this.map=B.Z.formJSON(t),this.runScene.cb.tags.parseJSON.cb(e)}}class Oa{constructor(e,t){this.showTransform=!1,this.data=new Proxy({},{set:(e,t,n)=>(e[t]=n,!0)}),this.uuid="",this.getAnimaByModelData=(()=>{const e=(e,t,n,r)=>{const i={},a={};if(e=Oa.isNotNow(e)?this.getAllData():e,(0,s.mapObj)(r,((n,r)=>{void 0!==e[n]&&("number"===(r=r.type)?(i[n]=t[n],a[n]=e[n]):"color"===r&&(0,s.mapObj)(e[n],((e,r)=>{var s=n+e;i[s]=t[n][e],a[s]=r})))})),!(0,s.emptyObj)(i))return{begin:i,end:a}};return(t,n,r,i=!1,a)=>{let o=i?r.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(r.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)*r.speed;o=l;{var d=n,p=u,f=c,m=a;const t={color(e){const{animaData:t,defType:n}=e,r={};(0,s.mapObj)(t,(e=>{var i;-1!==e.indexOf(n)&&(i=e.substring(n.length),["r","g","b"].includes(i)&&(r[i]=t[e]))}));var{r:e,g:i,b:a}=r;if(e&&i&&a)return r}};return()=>{let n;return{promise:new Promise((r=>{var i;if(!(i=e(p,d,0,m)))return r(0);var{begin:i,end:a}=i;return n=(0,h.anima)(i,a,f,(e=>{(0,s.mapObj)(m,((n,r)=>{r=r.type;var i,a=e[n];"number"===r?d[n]=a:"color"===r&&(a=t.color({animaData:e,defType:n}))&&(({r,g:a,b:i}=a),d[n].setRGB(r,a,i))}))}),r)})),anima:n}}}}))}})(),this.runScene=t,this.target=e,this.target.userData.isTimeLineUsed=!0,this.uuid=this.getId(e)}toJSON(){var{data:e,type:t}=this;return{data:e,type:t}}addData(e,t,n=!1){return 1e3<Number(e)&&(e="1000.00"),n?this.data[e]=this.getAllData():(this.data[e]||(this.data[e]={}),this.data[e][t]=this.getData(t)),this.data[e]}addTriggerNowData(e){return this.data[e]=this.getAllData(!0)}removeData(e){delete this.data[e]}static isNotNow(e){return"notNow"===Object.values(e)[0]}static getAllDefValByType(e,t,n=!1){const r={};return(0,s.mapObj)(e,(i=>{r[i]=n?"notNow":Oa.getValByType(t,i,e)})),r}static getValByType(e,t,n){var r,i;return n=n[t].type,e=e[t],"number"===n?e:"color"===n?(({r:t,g:r,b:i}=e),{r:t,g:r,b:i}):"V3"===n?ci().model.v3ToMap(e):""}static SetTargetByData(e){const{baseType:t,data:n,defType:r,target:i}=e;var a,s;"number"===t?i[r]=n:"color"===t&&(({r:e,g:a,b:s}=n),i[r].setRGB(e,a,s))}getAllData(e=!1){return Oa.getAllDefValByType(this.defOptions,this.target,e)}getData(e){return Oa.getValByType(this.target,e,this.defOptions)}static getTarget(e,t){}getAnima(e,t){return this.getAnimaByModelData(this.data,this.target,e,t,this.defOptions)}setTargetByBetween(e,t,n){Oa.setTargetByBetween(e,t,n,this.defOptions,this.target)}clone(e){var{data:t,type:n}=this;const r=new(0,La[n])(e);return r.data=t,r}reset(){(0,s.mapObj)(this.defOptions,((e,t)=>{Oa.SetTargetByData({baseType:t.type,data:Oa.getValByType(this.beginData,e,this.defOptions),target:this.target,defType:e})}))}remove(){delete this.target.userData.isTimeLineUsed}}Oa.setTargetByBetween=(()=>{const e=(e,t,n)=>e!==t?(t-e)*n+e:e;return(t,n,r,i,a)=>{(0,s.mapObj)(i,((i,s)=>{var o,l,u,c,h,d;s=s.type,void 0!==t[i]&&void 0!==n[i]&&Oa.SetTargetByData({baseType:s,data:(o=t[i],l=n[i],u=r,"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 Ra=Oa;class Ia extends l{constructor(){super(...arguments),this.mount=e=>{e.core.module.set("timeline",this)},this.after=e=>{var t,{json:e,config:n}=e;"scene"===(null==(t=null==(t=e.asset)?void 0:t.ex)?void 0:t.type)&&n.module.timeline&&this.runScene.timeLineEx.parseSavedGroupMap((null==(t=e.asset.ex)?void 0:t.timeLine)||{})}}init(){var e={name:"timeline",loadCallBacks:new B.Z({afterParse:this.after,mountModule:this.mount}),exportCallBacks:new B.Z};this.runScene.exporter.gltf.module.bind(e)}}const La={model:class extends Ra{constructor(e,t){super(e,t),this.type="model",this.defOptions={position:{type:"V3"},scale:{type:"V3"},rotation:{type:"V3"}},this.setTargetByBetween=(()=>{const e=(e,t,n)=>{var{x:e,y:r,z:i}=e,{x:t,y:a,z:s}=t;return{x:e!==t?(t-e)*n+e:e,y:r!==a?(a-r)*n+r:r,z:i!==s?(s-i)*n+i:i}};return(t,n,r)=>{var i,{position:t,scale:a,rotation:s}=t,{position:n,scale:o,rotation:l}=n;t&&n&&(({x:t,y:n,z:i}=e(t,n,r)),this.target.position.set(t,n,i)),a&&o&&(({x:t,y:n,z:i}=e(a,o,r)),this.target.scale.set(t,n,i)),s&&l&&(({x:a,y:o,z:t}=e(s,l,r)),this.target.rotation.set(a,o,t))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,n)=>{var{position:t,scale:r,rotation:i}=t,{position:e,scale:a,rotation:s}=Ra.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},a?{sx:r.x,sy:r.y,sz:r.z}:{},s?{rx:i.x,ry:i.y,rz:i.z}:{}),end:Object.assign({},n.curve?{ease:"none"}:{},e?{px:e.x,py:e.y,pz:e.z}:{},a?{sx:a.x,sy:a.y,sz:a.z}:{},s?{rx:s.x,ry:s.y,rz:s.z}:{})}};return(t,n,r,i=!1)=>{let a=i?r.time:0;const o=Object.keys(t).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t)));var l=(0,s.lastArrayEle)(o),u=i?"0.00":String(r.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)*r.speed;return a=s,o=n,l=d,u=p,c=r,()=>{let t;return{promise:new Promise((n=>{var{begin:r,end:i}=e(l,o,c);return t=(0,h.anima)(r,i,u,(e=>{var{px:e,py:t,pz:n,sx:r,sy:i,sz:a,rx:s,ry:u,rz:c}=e;l.position&&o.position.set(e,t,n),l.scale&&o.scale.set(r,i,a),l.rotation&&o.rotation.set(s,u,c)}),n)})),anima:t}}}))}})(),this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.model.get(e)}isRemoved(){return!(this.target&&this.target.parent)}getAnima(e,t=!1){return this.getAnimaByModelData(this.data,this.target,e,t)}getId(){return this.runScene.uniqueEx.getId(this.target)}reset(){var{position:e,scale:t,rotation:n}=this.beginData;this.target.position.set(e.x,e.y,e.z),this.target.scale.set(t.x,t.y,t.z),this.target.rotation.set(n.x,n.y,n.z)}},camera:class extends Ra{constructor(e,t){super(e,t),this.type="camera",this.defOptions={position:{type:"V3"},scale:{type:"V3"},rotation:{type:"V3"},target:{type:"V3"}},this.setTargetByBetween=(()=>{const e=(e,t,n)=>{var{x:e,y:r,z:i}=e,{x:t,y:a,z:s}=t;return{x:e!==t?(t-e)*n+e:e,y:r!==a?(a-r)*n+r:r,z:i!==s?(s-i)*n+i:i}};return(t,n,r)=>{var i,{position:t,scale:a,rotation:s,target:o}=t,{position:n,scale:l,rotation:u,target:c}=n;t&&n&&(({x:t,y:n,z:i}=e(t,n,r)),this.target.position.set(t,n,i)),a&&l&&(({x:t,y:n,z:i}=e(a,l,r)),this.target.scale.set(t,n,i)),s&&u&&(({x:a,y:l,z:t}=e(s,u,r)),this.target.rotation.set(a,l,t)),o&&c&&(({x:n,y:i,z:s}=e(o,c,r)),this.controls.target.set(n,i,s))}})(),this.getAnimaByModelData=(()=>{const e=(e,t,n)=>{var{position:t,scale:r,rotation:i}=t,{position:e,scale:a,rotation:s,target:o}=Ra.isNotNow(e)?this.getAllData():e;return{begin:Object.assign({},e?{px:t.x,py:t.y,pz:t.z}:{},a?{sx:r.x,sy:r.y,sz:r.z}:{},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({},n.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,n,r,i)=>()=>{let a;return{promise:new Promise((s=>{var{begin:o,end:l}=e(n,t,i);return a=(0,h.anima)(o,l,r,(e=>{var{px:e,py:r,pz:i,sx:a,sy:s,sz:o,rx:l,ry:u,rz:c,tx:h,ty:d,tz:p}=e;n.position&&t.position.set(e,r,i),n.scale&&t.scale.set(a,s,o),n.rotation&&t.rotation.set(l,u,c),n.target&&this.controls.target.set(h,d,p)}),s)})),anima:h.anima}};return(e,n,r,i=!1)=>{let a=i?r.time:0;const o=Object.keys(e).sort(((e,t)=>i?Number(t)-Number(e):Number(e)-Number(t)));var l=(0,s.lastArrayEle)(o),u=i?"0.00":String(r.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)*r.speed;return a=s,t(n,o,l,r)}))}})(),this.controls=this.runScene.assetsEx.get().controls,this.beginData=this.getAllData()}static getTarget(e,t){return t.uniqueEx.model.get(e)}getBeginData(e){return this.getAllData()}isRemoved(){return!this.target}getAllData(e=!1){var{position:t,scale:n,rotation:r}=this.target;return{position:e?"notNow":ci().model.v3ToMap(t),scale:e?"notNow":ci().model.v3ToMap(n),rotation:e?"notNow":ci().model.v3ToMap(r),target:e?"notNow":ci().model.v3ToMap(this.controls.target)}}getData(e){var{position:t,scale:n,rotation:r}=this.target;let i;if("position"===e)i=ci().model.v3ToMap(t);else if("scale"===e)i=ci().model.v3ToMap(n);else if("rotation"===e)i=ci().model.v3ToMap(r);else{if("target"!==e)throw TypeError("输入值不存在");i=ci().model.v3ToMap(this.controls.target)}return i}getAnima(e,t=!1){return this.getAnimaByModelData(this.data,this.target,e,t)}getId(){return this.runScene.uniqueEx.getId(this.target)}reset(){var{position:e,scale:t,rotation:n,target:r}=this.beginData;this.target.position.set(e.x,e.y,e.z),this.target.scale.set(t.x,t.y,t.z),this.target.rotation.set(n.x,n.y,n.z),this.controls.target.set(r.x,r.y,r.z)}},material:class extends Ra{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)}}};n(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 Fa=c.Z,Ua=class{constructor(e){this._clock=new o.Clock,this.cb=new y,this.script=new Da(this),this.uniqueEx=new Ne.ZP(this),this.fileEx=new ai(this),this.snapshot=new Ca.ZP(this),this.undoEx=new xi.ZP(this),this.textureEx=new Oe.default(this),this.controlsEx=new A,this.assetsEx=new v(this),this.renderEx=new Ta.Z(this),this.events=new class{constructor(e){this.key=new T(this),this.mouse=new D(this),this.drag=new M(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 fi(this),this.helperEx=null,this.materialEx=new ke.default(this),this.cameraEx=new b.Z(this),this.sceneEx=new Fe.ZP(this),this.modelEx=new d.default(this),this.loaderer=new u.Z(this),this.exporter=new Ze(this),this.lightEx=new Ie.ZP(this),this.timeLineEx=new class{constructor(e){this.timerMap={},this.animaMap={},this.groupMap={},this.clean=()=>{this.reset()},this.setModelLocal=(e,t)=>{Object.values(e.data).map((e=>{var n,r,i=((e,t)=>{let n=-1,r=1e3;const i=Object.keys(e).sort(((e,t)=>Number(e)-Number(t)));if(1!==i.length&&(i.map(((e,i)=>{e=Number(e),0<(e=t-e)&&e<r&&(r=e,n=i)})),-1!==n)){var a=i[n],s=i[n+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:n,progress:r}=i),e.setTargetByBetween(i,n,r))}))},this.runScene=e,this.runScene.cb.clean.add("TimeLine",this.clean),this.exportAndImport=new Ia(e)}init(){this.exportAndImport.init()}reset(){this.timerMap={},this.animaMap={},this.groupMap={},this.runScene.cb.timeLine.reset.cb("")}pause(e){var t,n;if(this.groupMap[e]){this.timerMap[e]&&(({setProgressTime:t,awaitRuned:n}=this.timerMap[e]),t&&clearInterval(t),n&&clearInterval(n)),this.groupMap[e].run=!1;const r=this.animaMap[e];r&&r.length&&r.map((e=>{e.controls.run=!1}))}}resume(e){const t=this.groupMap[e];if(t){this.groupMap[e].run=!0;const n=this.animaMap[e];n&&n.length&&n.map((n=>{const{controls:r,promise:i}=n;r.run=!0,i.then((()=>{if(t.run)return t.run=!1,t.loop?this.playGroup(e):void 0}))}))}}closeGroup(e){var t,n;this.timerMap[e]&&(({setProgressTime:t,awaitRuned:n}=this.timerMap[e]),t&&clearInterval(t),n&&clearInterval(n)),this.groupMap[e].run=!1,this.runScene.cb.timeLine.closeGroup.cb(e);const r=this.animaMap[e];r&&r.length&&r.map((e=>{e.controls.clean=!0}))}resetGroup(e){var t=this.groupMap[e];t&&(this.closeGroup(e),this.runScene.cb.timeLine.setProgress.cb(0),Object.values(t.data).map((e=>e.reset())))}getSavedData(){return(0,s.mapObj)(this.groupMap,((e,t)=>{t.run=!1})),this.groupMap}parseSavedGroupMap(e){Object.keys(e).map((t=>{const n=e[t],r={};(0,s.mapObj)(n.data,((e,t)=>{var{type:t,data:n}=t;const i=La[t];if(t=i.getTarget(e,this.runScene)){const a=new i(t,this.runScene);a.data=n,r[e]=a}})),n.data=r,this.groupMap[t]=n,this.runScene.cb.timeLine.setGroupMap.cb({group:n,groupName:t})}))}playGroup(e,t){const n=(0,Ue.Gm)({onlyReverse:!1},t).onlyReverse,r=(this.runScene.helperEx.unfocus(),this.groupMap[e]);if(r&&!r.run){r.run=!0;const i=Object.keys(r.data).map((e=>{const t=r.data[e];if(t.data=new Proxy(t.data,{set:(e,t,n)=>(e[t]=n,!0)}),n)return t.getAnima(r,!0);const i=t.getAnima(r);return r.reverse&&(e=t.getAnima(r,!0),i.push(...e)),i}));this.animaMap[e]||(this.animaMap[e]=[]),this.animaMap[e]=i.map((e=>(0,s.eachTriggerArrGetControls)(e)));let a=0;a=n?r.time*r.speed:r.time*r.speed*(r.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),r.run)return r.run=!1,r.loop?this.playGroup(e):void 0}))}}}(this),this.anima=new p(this),this.tags=new Pa(this),this.globalConfig=new si(this),this.pp=new Ea(this),this.objects=new Mi(this),this.inited=!1,this._renderLimit=new Ue.cM,this._render=()=>{const{render2:e,render3:t}=this.assetsEx;var{scene:n,camera:r}=this.assetsEx.get();this.cb.render.cb(""),this.pp.update(),null!=t&&t.render(n,r),null!=e&&e.render(n,r)},this.render=()=>{if(null!=(e=this.optionsEx.options)&&e.run){const n=this._render;var{frame:e,mode:t}=this.optionsEx.options.renderConfig;-1!==e&&"tick"===t?(t=this._clock.getDelta(),this._renderLimit.update({cb(){n()},cbRate:1/e,now:t})):this._render()}},this.optionsEx=new Ei(this,e)}initLibs(e){if(!this.inited){this.snapshot.init(),this.materialEx.init(),this.modelEx.init(),this.sceneEx.init(),this.timeLineEx.init(),this.loaderer.init(),this.inited=!0,this.assetsEx.init(e),this.events.init(e),this.globalConfig.setRenderMode(this.optionsEx.options.renderConfig.mode),this.helperEx=new ui(this);const{camera:t,controls:n}=this.assetsEx.get();this.uniqueEx.model.add(t),this.renderEx.setSize(),n.update(),this.pp.init(),this.cameraEx.reset(t),this.cb.inited.cb(0)}}init(e){return this.initLibs(e),this}load(e){var{path:e,dom:t,loadConfig:n}=e;return this.init(t),this.loadScene(e,n).then((e=>{0!==(null==e?void 0:e.length)&&this.modelEx.add(e)})),this}loadScene(e,t){return function(e,t,n,r){return new(n=n||Promise)((function(t,i){function a(e){try{o(r.next(e))}catch(e){i(e)}}function s(e){try{o(r.throw(e))}catch(e){i(e)}}function o(e){var r;e.done?t(e.value):((r=e.value)instanceof n?r:new n((function(e){e(r)}))).then(a,s)}o((r=r.apply(e,[])).next())}))}(this,0,void 0,(function*(){const{getJSON:n,progress:r,complete:i}=this.cb.load;t=t||{};var s=Object.assign(Object.assign({},t),{callBack:Object.assign(Object.assign({},t.callBack),{getJSON:e=>{var r,i;null!=(i=null==(r=null==t?void 0:t.callBack)?void 0:r.getJSON)&&i.call(r,e),n.cb(e)},progress:e=>{var n,i;null!=(i=null==(n=null==t?void 0:t.callBack)?void 0:n.progress)&&i.call(n,e),r.cb(e)},complete:e=>{var n,r;null!=(r=null==(n=null==t?void 0:t.callBack)?void 0:n.complete)&&r.call(n,e),i.cb(e)}}),triggerCb:!1});if(e instanceof ArrayBuffer)return this.optionsEx.log("正在解析二进制文件","base","info"),this.loaderer.gltf.parse(e,s);this.optionsEx.log("正在拉取场景","base","info");var o=yield a().get(e,{responseType:"arraybuffer",onDownloadProgress:e=>{var{total:e,loaded:t}=e;let n=t/e;1<(n=n<0?0:n)&&(n=1),t=Number(n.toFixed(2)),e=Math.floor(100*t),this.optionsEx.log("下载场景进度:"+e,"detail"),this.cb.load.progress.cb(e)}}).then((e=>e.data)).catch((e=>{this.sceneEx.clean(),this.optionsEx.log("下载场景失败:",e)}));return o?(this.optionsEx.log("拉取场景成功、正在解析","base","success"),this.loaderer.gltf.parse(o,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:n,render3:r}=this.assetsEx,i=this.assetsEx.get().renderer;this.cameraEx.setSize(),null!=r&&r.setSize(e,t),null!=n&&n.setSize(e,t),i.setSize(e,t,!0),this.pp.setSize(e,t)}clean(){this.cb.clean.cb(0)}}},736:(e,t,n)=>{n.d(t,{ZP:()=>y,bv:()=>A,is:()=>S,UE:()=>w,M:()=>b});var r=n(1),i=n(881),a=n(932),s=n(749),o=n(738),l=n(794),u=n(625);class c{constructor(e){this.mount=e=>{e.core.module.set("scene",this)},this.parse={before:e=>{var t,n,r,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:n,controls:r,tags:i,envStrength:a,objects:s}=e.asset.ex),void 0!==a&&(this.runScene.sceneEx.envStrength=a),this.parse.camera(t,o),this.parse.light(e,o,l),this.parse.controls(r,o),o.module.tags&&this.runScene.tags.parseJSON(i||{}),this.parse.options(n),s&&this.runScene.objects.parseJSON(s))},after:e=>{const{core:t,json:n,data:r,config:i}=e;if("scene"===(null==(e=null==(e=n.asset)?void 0:e.ex)?void 0:e.type)){var{options:e,json:a}=r;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(n,i,t),t.models.push(...e)}},controls:(e,t)=>{var n;t.module.controls||(({x:t,y:e,z:n}=e),this.runScene.assetsEx.controls.target.set(t,e,n),this.runScene.assetsEx.controls.update())},camera:(e,t)=>{if(t.module.camera){let o=e;e.temp&&(o=e.camera,this.runScene.cameraEx.temp=l.Z.formJSON(e.temp));var{position:t,far:e,near:n,fov:r,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=n,u.fov=r,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,n)=>{if(t.module.light){const t=[];e.map((e=>{var n=e.type;t.push(...this.runScene.lightEx.lightExMap[n].parseJSON(e))})),n.models.push(...t)}},scene:(e,t,n)=>{if(t.module.sceneConfig){const s=this.runScene.sceneEx.get();t=n.module.get("material").data.materialIns;var{materialId:n,backgroundMapping:e,backgroundColor:r,fog:a}=e.asset.ex.sceneEx;if(n&&(n=null==(t=t[n])?void 0:t.material)){const{map:t,envMap:r}=n;t&&(t.mapping=e||300,t.needsUpdate=!0,this.runScene.sceneEx.setBackground(t,!1),t.userData.isBackgroud=!0),r&&(s.environment=(0,u.setTextureMapping)(r))}if(r&&this.runScene.sceneEx.setBackground(new i.Color("#"+r)),a){const{color:e,far:t,near:n,show:r}=a,o=new i.Fog(e.includes("#")?e:"#"+e,n,t);!1===r?this.runScene.sceneEx.oldFog=o:s.fog=o,o.show=r,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 n=this.runScene.exporter.gltf.options.getParse(e);null!=n&&n.parse(t)}))}},this.toJSON=()=>{},this.runScene=e}init(){this.bindEvent()}bindEvent(){var e={name:"sceneConfig",loadCallBacks:new 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=n(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:n}=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:n})):(0,u.isTexture)(b)&&y.push((()=>{this.runScene.sceneEx.setBackground(new i.Color(n))}));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 n,r,s,o,l;y.push((()=>{v.environment=this.runScene.uniqueEx.texture.get(null==p?void 0:p.data)})),v.fog&&c?(({color:e,near:n,far:r}=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!==n&&g.push({target:v,label:["fog","near"],begin:s,end:n,type:"number",isUpdate:!0}),o!==r&&g.push({target:v,label:["fog","far"],begin:o,end:r,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")),n=this.runScene.assetsEx.scene;return void 0!==(t&&"texture"===(e.bgc=t).type&&303===n.background.mapping&&(e.bgcm=303),(t=this.runScene.sceneEx.getJson("environment"))&&(e.env=t),n=this.runScene.sceneEx.getEnvStrength())&&1!==n&&(e.envS=n),e}}var p=n(735),f=n(510),m=n(169),v=n(729),g=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.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,n)=>(e[t]=n,!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 n in this.removeMap){const{valid:i,remove:a}=this.removeMap[n];if(i(e))return t.push(...(0,r.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:n,remove:r}=this.removeMap[t];if(n(e))return r(e)}this.runScene.modelEx.remove(e),this.runScene.helperEx.unfocus()}}cleanUnlessLevel(e){return this.runScene.modelEx.isUnlessLevel(e)&&!this.runScene.helperEx.isHelper(e)&&0!==e.children.length&&1===e.children.length?this.cleanUnlessLevel(e.children[0]):e}searchModel(e){return this.runScene.uniqueEx.model.findModelWithName(e)}getClearModels(){return this.get().children.filter((e=>!this.runScene.helperEx.isHelper(e)&&!this.runScene.lightEx.isLight(e)))}getClear(){const e=this.get(),t=new i.Group;return e.children.filter((e=>!this.runScene.helperEx.isHelper(e)&&!this.runScene.lightEx.isLight(e)&&s.normalModel.is(e))).map((e=>{const n=e.clone();(0,s.withAnima)(e)&&(n.animations=[...e.animations]),t.add(n)})),this.runScene.helperEx.setHelper(t),this.cleanUnlessLevel(t)}cleanNormal(){this.getNromal().map((e=>this.remove(e)))}cleanSceneInfo(e){this.setBackground(null).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 n=this.get(),r=new f.Z({target:n,info:"background",newVal:e,oldVal:n.background,runScene:this.runScene,cb:e=>{}}).execute();return t&&this.runScene.undoEx.addUndo(r),this.runScene.cb.setScene.cb({scene:n,type:"background",val:n.background}),e}))}isBackground(e){return e.userData.isBackgroud}dispose(){const{renderer:e,controls:t}=this.runScene.assetsEx.get();this.clean(),(0,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 n;return e instanceof String&&(n=yield this.runScene.textureEx.load(e)),e instanceof File&&(n=yield this.runScene.textureEx.parse(e)),n=(n=null!=e&&e.isTexture?this.runScene.textureEx.clone(e):n)&&(0,u.setTextureMapping)(n),this.setNormal({model:t,info:"environment",val:n}),this.runScene.cb.setScene.cb({scene:t,type:"environment",val:n}),n}))}setNormal(e,t=!0){var{model:e,info:n,val:r}=e;e=new f.Z({target:e,info:n,oldVal:e[n],newVal:r,runScene:this.runScene}).execute(),t&&this.runScene.undoEx.addUndo(e)}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:n}=e;if(e){let e=this.oldFog||new i.Fog(n||"#ffffff");e.show=!0,this.setNormal({model:t,info:"fog",val:e})}else this.oldFog=t.fog,this.setNormal({model:t,info:"fog",val:null}),this.oldFog.show=!1;this.runScene.cb.setScene.cb({scene:t,type:"fog",val:t.fog})}setFog(e){var t=this.runScene.assetsEx.scene,{type:e,val:n,cb:r}=e;t=new p.Z({target:t,typeList:["fog",e],newVal:n,cb:r}).execute(),this.runScene.undoEx.addUndo(t)}sreenShotDefFile(e,t){e=e||Number(prompt("请输入截图的宽"))||1920,t=t||Number(prompt("请输入截图的高"))||1080;var{width:n,height: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,r.base64ToFile)(e,"screenShot.png"),this.runScene.pp.setSize(n,i),this.runScene.renderEx.setSize(),this.runScene.pp.update(),t}getJson(e){let t;var n=this.runScene.assetsEx.scene;if("fog"===e){var r=n.fog;r&&(t=x(r,null!==n.fog))}else if("background"===e){if(!n.background)return;t={type:(r=(0,a.isColor)(n.background))?"color":"texture",data:(r?h.J6:v.Ki)(n.background)}}else if("environment"===e){if(!n.environment)return;t={type:"texture",data:(0,v.Ki)(n.environment)}}return t}static toJSON(e,t){const n={};let r=!1,i=e.fog;return i?r=!0:i=t.sceneEx.oldFog,i&&(n.fog=x(i,r)),(0,a.isColor)(e.background)&&(n.backgroundColor=e.background.getHexString()),n}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,n)=>{e.userData[t]=n},x=(e,t)=>{var{color:e,far:n,near:r}=e;return{color:(0,h.J6)(e),show:t,far:n,near:r}},w=e=>{var{color:e,far:t,near:n}=e;return new i.Fog(e,n,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,n)=>{n.d(t,{LV:()=>p,ZP:()=>d});var r=n(1),i=n(263),a=n(794),s=n(201),o=n(625),l=n(729),u=n(457),c=n(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 n,r,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),n=(0,c.sS)(e.end),a=o+"_"+t+"_r",s=o+"_"+t+"_g",r=o+"_"+t+"_b",l.begin.push({type:a,data:i.r}),l.begin.push({type:s,data:i.g}),l.begin.push({type:r,data:i.b}),l.end.push({type:a,data:n.r}),l.end.push({type:s,data:n.g}),l.end.push({type:r,data:n.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:n,type:r}=e;return e=e.label instanceof Array?e.label.join("."):e.label,"v2"===r||"v3"===r?(t.push(e+"_"+n+"_x"),t.push(e+"_"+n+"_y"),t.push(e+"_"+n+"_z")):"color"===r||"color_obj"===r||"color_str"===r?(t.push(e+"_"+n+"_r"),t.push(e+"_"+n+"_g"),t.push(e+"_"+n+"_b")):"number"===r&&t.push(e+"_"+n),t},update:(e,t)=>{var n;const i=this.trans.getKey(e);let a=e.target,s=e.label,o=(e.label instanceof Array&&(s=(0,r.lastArrayEle)(e.label),a=(0,r.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[,,n]=e.split("_");e=t[e]/255,o[n]=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[,,n]=e.split("_");o[n]=t[e]}))),null!=(n=e.onUpdate)&&n.call(e,{target:a,data:o,type:l,runScene:this.runScene})},exec:(e,t)=>{const n=this.trans.getKey(e);let i=e.target,a=e.label;e.label instanceof Array&&(a=(0,r.lastArrayEle)(e.label),i=(0,r.objLastMap)(e.target,e.label)),"color"===e.type||"color_str"===e.type||"color_obj"===e.type?n.map((e=>{var[,,n]=e.split("_");e=1<t[e]?t[e]/255:t[e],i[a][n]=e})):"number"===e.type?i[a]=t[n[0]]:"v2"!==e.type&&"v3"!==e.type||n.map((e=>{var[,,n]=e.split("_");i[a][n]=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){if(e=this.map.get(e)){const t={animas:[],completedCbs:[]};this.runScene.cb.snapshot.set.cb({snapshot:e,data:t}),0===t.animas.length?0!==t.completedCbs.length&&t.completedCbs.map((e=>e())):this.anima(t,e)}}del(e){this.map.delete(e)}anima(e,t){if(this.runScene.modelEx.selectNull(),!this.playing.animaIns){const n=new a.Z,i={},s={};t=t.time,this.playing.data=e,this.playing.data.animas.map(((e,t)=>{t=String(t);const{begin:r,end:a}=this.trans.set(e,t);r.map((e=>i[e.type]=e.data)),a.map((e=>s[e.type]=e.data)),n.set(t,Object.assign({unique:t},e))})),this.playing.animaIns=(0,u.anima)(i,s,t,(e=>{(0,r.mapObj)(e,(t=>{var[,t]=t.split("_");(t=n.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:n,completedCbs:i}=t.data,{target:a,type:s,begin:o,end:l,label:c,onUpdate:d}=e;if((0,u.isDef)(o,l))if(h.includes(s))n.push({target:a,type:s,begin:o,end:l,label:c,isUpdate:void 0===d,onUpdate:d});else{let e=a,t=c;c instanceof Array&&(e=(0,r.objLastMap)(a,c),t=(0,r.lastArrayEle)(c)),"texture"===s?e[t]=l:i.push((()=>{e[t]=l}))}}bind(e){const{name:t,def:n,target:r,create:i,set:a}=e;this.runScene.cb.snapshot.create.add(t,i||(e=>{e.data.set(t,p.getDiff(n,r))})),this.runScene.cb.snapshot.set.add(t,a||(e=>{var i=e.snapshot.data.get(t);i&&p.set({def:n,runScene:this.runScene,data:i,target:r,map:e})}))}}const p={toNormal(e){var t,{type:e,val:n}=e;let r=n;return"color"===e?r=(0,c.Lv)(n):"color_obj"===e?r=n:"color_str"===e?r=(0,u.MyHextoRgb)(n,!0):"texture"===e?(0,o.isTexture)(n)&&(r=(0,l.Ki)(n)):"v3"!==e&&"v2"!==e||(({x:e,y:n,z:t}=n),r={x:e,y:n,z:t}),r},parse(e){const{type:t,val:n,runScene:r}=e;let a=n;return"color"===t?a=i.YD.is(n)?n:(0,u.HextoRgb)(n,!0):"color_obj"===t?a=n:"color_str"===t&&(a=i.YD.is(n)?n:(0,u.HextoRgb)(n,!0)),"texture"===t&&null!==n?r.uniqueEx.texture.get(n):a},getDiff(e,t){let n={};return(0,r.mapObj)(e,((e,i)=>{i=i.label;let a=t[e];i&&(a=(0,r.objLastMap)(t,i)[(0,r.lastArrayEle)(i)]),n[e]=a})),(0,s.replaceKVForObj)((0,u.getDiff)((0,s.replaceValForObj)(e,((e,t)=>t.val)),n),((t,n)=>{var{shortKey:t,type:r}=e[t];return{k:t,v:p.toNormal({type:r,val:n})}}))},set(e){const{def:t,data:n,target:i,runScene:a,map:s}=e;(0,r.mapObj)(t,((e,t)=>{const{type:o,val:l,shortKey:c,before:h,label:d,onUpdate:f}=t;let m=i,v=e;d&&(m=(0,r.objLastMap)(i,d),v=(0,r.lastArrayEle)(d)),t=p.toNormal({type:o,val:m[v]}),e=p.parse({type:o,val:void 0!==n[c]?n[c]:l,runScene:a}),(0,u.isDef)(t,e)&&(null!=h&&h({target:m,begin:t,end:e}),a.snapshot.parseNromal({target:m,label:v,type:o,begin:t,end:e,onUpdate:f},s))}))}}},625:(e,t,n)=>{n.r(t),n.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:()=>k,textureNameMap:()=>b,unDelAbleTexture:()=>G,updateTexture:()=>L});var r=n(1),i=n(881),a=n(247),s=n(24),o=n(457),l=n(729),u=n(510);class c extends n(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=n(932),p=n(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 n=(0,l.Ki)(t);n&&(e[n]=p.LV.getDiff(f,t),(t=this.runScene.script.texture.get(t))&&(e[n].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,r.mapObj)(t,((t,n)=>{(t=this.runScene.uniqueEx.texture.get(t))&&(p.LV.set({def:f,data:n,runScene:this.runScene,map:e,target:t}),this.runScene.script.texture.parse(n.uvScript,t),this.runScene.script.texture.set(n.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=n(736),g=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}))};class y{constructor(e){this.allTextures=new Set,this.setAnima=e=>{const{texture:t,type:n,val:r}=e,i=t.userData.uvScript||{};t.userData.uvScript||(t.userData.uvScript=i),0===r?delete i[n]:i[n]=r,this.runScene.cb.texture.setAnima.cb({texture:t,uvScript:i})},this.runScene=e,this.snapshot=new m(e)}load(e,t){return g(this,void 0,void 0,(function*(){var n=yield(0,o.urlToBlob)(e);return this.parse(n,t)}))}parse(e,t){return g(this,void 0,void 0,(function*(){t=(0,o.mergeObject)({flipY:!0},t);var n="Blob"===(0,o.getType)(e)?e:yield(0,o.fileToBlob)(e);return this.afterLoad(yield E(n,t),n)}))}clone(e){const t=new i.Texture(e.image);return t.userData=Object.assign(Object.assign({},e.userData),{id:(0,r.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 r in this.runScene.uniqueEx.texture.map){var n=this.runScene.uniqueEx.texture.get(r);if(n.userData.md5===e&&n.mapping===t.mapping)return n}}initTextureAndAddtoAll(e){return 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 n;n=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,r.mapObj)(i,((r,i)=>{const a=this.runScene.uniqueEx.material.get(r);a&&i.forEach((r=>{t.push(new s.Z({target:a,info:r,newVal:n,oldVal:e,runScene:this.runScene}).execute())}))})),this.runScene.undoEx.addUndo(t)}}))}remove(e){const t=(0,l.Ki)(e);var n=this.runScene.uniqueEx.texture.map[t];if(n){const i=[];n=n.materialMap,(0,r.mapObj)(n,((e,t)=>{const n=this.runScene.uniqueEx.material.get(e);n&&(t.forEach((e=>{i.push(new u.Z({target:n,info:e,oldVal:n[e],newVal:null,runScene:this.runScene,cb(){(0,d.updateMaterial)(n)}}).execute())})),(0,d.updateMaterial)(n))}));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:n}=yield(0,o.reverseImageBitMap)(e.image);const a=new i.Texture(n);return a.needsUpdate=!0,n=this.runScene.uniqueEx.texture.map[e.userData.id],(0,r.mapObj)(n.materialMap,((e,t)=>{const n=this.runScene.uniqueEx.material.get(e);t.forEach((e=>{n[e]=a,this.runScene.uniqueEx.texture.addMaterial(a,{material:n,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,n;e&&(t=e.image,n=e.userData.url,t instanceof ImageBitmap?(0,o.disposeImageBitMap)(t):t instanceof HTMLCanvasElement&&(0,o.disposeCanvas)(t),URL.revokeObjectURL(n),e.dispose())},A=(e,t)=>g(void 0,void 0,void 0,(function*(){var n=(0,o.isBlob)(e.userData.blob)?e.userData.blob:null;const r=t||n||(yield M(e));e.userData.blob=r;var{md5:n,url:i}=e.userData;return n||(e.userData.md5=(0,o.getMd5)(yield r.arrayBuffer())),i||(e.userData.url=URL.createObjectURL(r)),e.userData.gm=w(e),e.format=e.userData.format||-1!==r.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 n={resizeQuality:"pixelated"};return null!=t&&t.flipY&&(n.imageOrientation="flipY"),createImageBitmap(e,n)},E=(e,t)=>g(void 0,void 0,void 0,(function*(){var n=yield C(e instanceof Blob?e:yield(0,o.urlToBlob)(e),t);return new i.Texture(n)})),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},L=e=>{e.needsUpdate=!0},k=(e,t)=>{e.minFilter=a.Z["linear"===t?"LinearMipmapLinearFilter":"NearestFilter"],(0,v.M)(e,"minFilter",t),L(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,n)=>{n.d(t,{ZP:()=>r,d9:()=>i});class r{constructor(e){this.undos=[],this.redos=[],this.dataMap={history:[],index:0},this.clean=()=>{this.reset()},this.runScene=e,this.runScene.cb.clean.add("Undo",this.clean)}undo(){if(0!==this.undos.length){const e=this.removeUndos(-1)[0];e&&(e instanceof Array?e.reverse().map((e=>e.undo())):e.undo(),this.redos.push(e))}}addUndos(e){var t;return this.undos.push(e),t=this.dataMap.history.push(e),this.dataMap.index=this.undos.length-1,this.runScene.cb.undo.addUndos.cb({undoVal:e,undos:this.undos}),t}removeUndos(e){var t;return this.undos.splice(e),t=this.dataMap.history.splice(e),this.dataMap.index=this.undos.length-1,this.runScene.cb.undo.removeUndos.cb({index:e}),t}undoByIndex(e){e>this.dataMap.index?this.undos.slice(this.dataMap.index+1,e+1).map((e=>{e instanceof Array?e.map((e=>e.redo())):e.redo()})):e<this.dataMap.index&&this.undos.slice(e+1,this.dataMap.index+1).reverse().map((e=>{e instanceof Array?e.map((e=>e.undo())):e.undo()})),this.dataMap.index=e,this.runScene.cb.undo.undoByIndex.cb(e)}addUndo(e){this.dataMap.index!==this.undos.length&&this.removeUndos(this.dataMap.index+1),this.addUndos(e)}addRedo(e){this.redos.push(e)}redo(){if(0!==this.redos.length){const e=this.redos.splice(-1)[0];e&&(e instanceof Array?e.reverse().map((e=>e.redo())):e.redo(),this.addUndo(e))}}reset(){this.undos=[],this.redos=[],this.dataMap.history=[],this.dataMap.index=0,this.runScene.cb.undo.reset.cb("")}}var i=function(e){if("object"!=typeof e)return e;if(null===e)return null;if(e){var t,n,r=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(n=i(e[t]),r[t]=n);return r}}},773:(e,t,n)=>{n.d(t,{Z:()=>i});var r=n(269);class i{constructor(e){this.addTree=!0,this.isClone=!1,this.cb=(e,t)=>{};var{model:e,parent:t,cb:n,addTree:r,isClone:i,runScene:a}=e;this.runScene=a,this.model=e,this.parent=t,!1===r&&(this.addTree=r),!0===i&&(this.isClone=i),n&&(this.cb=n)}remove(e){const{model:t,parent:n,addTree:r,runScene:i}=e;i.modelEx.select===t&&i.modelEx.selectNull(),n.remove(t),r&&i.uniqueEx.model.remove(t),r&&i.cb.model.remove.cb({model:t,parent:n}),this.cb(t,"remove"),i.uniqueEx.material.addModel(t,void 0,t.material)}add(e){const{model:t,parent:n,addTree:i,isClone:a,runScene:s}=e;n.add(t),i&&s.uniqueEx.model.add(t),i&&s.cb.model.add.cb({model:t,parent:n,isClone:a}),this.cb(t,"add"),s.uniqueEx.material.addModel(t,t.material),(0,r.RQ)(t)&&setTimeout((()=>{this.runScene.lightEx.update(t)}))}}},616:(e,t,n)=>{n.d(t,{Z:()=>r});class r{}},24:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(330);class i extends n(616).Z{constructor(e){super(),this.isUndoMaterial=!0,this.type="修改材质";var{target:e,info:t,newVal:n,oldVal:r,runScene:i,cb:a}=e;this.runScene=i,this.target=e,this.info=t,this.newVal=n,this.oldVal=r,this.cb=a}_execute(e,t){if(this.target[this.info]=e,this.target.needsUpdate=!0,r.zX.includes(this.info)){if(!e)return;this.runScene.uniqueEx.texture.addMaterial(e,{material:this.target,type:this.info})}"depthWrite"===this.info&&!0===e&&delete this.target.userData[this.info],null!=(e=this.cb)&&e.call(this,this)}execute(){return this.redo(),this}undo(){this._execute(this.oldVal,this.newVal)}redo(){this._execute(this.newVal,this.oldVal)}}const a=i},735:(e,t,n)=>{n.d(t,{Z:()=>a});var r=n(1);class i extends n(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,r.objLastMap)(e.target,this.typeList)[(0,r.lastArrayEle)(e.typeList)]}execute(){return this.redo(),this}_execute(e){const t=(0,r.objLastMap)(this.target,this.typeList);t[(0,r.lastArrayEle)(this.typeList)]=e,this.cb&&this.cb(t),"shadow"!==this.typeList[0]&&this.typeList[1]}undo(){this._execute(this.old)}redo(){this._execute(this.new)}}const a=i},510:(e,t,n)=>{n.d(t,{Z:()=>i});class r extends n(616).Z{constructor(e){super(),this.type="修改属性",this.isUndoNormal=!0,this.cb=e=>{};var{target:e,info:t,oldVal:n,newVal:r,runScene:i,cb:a,executeCb:s}=e;this.runScene=i,this.target=e,this.info=t,this.newVal=r,this.oldVal=n,a&&(this.cb=a),s&&(this.executeCb=s)}_execute(e){var{target:t,info:n}=this;if(this.executeCb)return this.executeCb({target:t,info:n,val:e});this.target[this.info]=e,"name"===this.info&&this.target.isObject3D?(t=this.runScene.uniqueEx.model.parseName(this.target),n=e,this.runScene.cb.model.changeName.cb({model:this.target,name:e=t||e,oldName:n})):"material"===this.info?this.runScene.uniqueEx.material.addModel(this.target,e,e===this.newVal?this.oldVal:this.newVal):"visible"===this.info&&this.runScene.cb.model.setVisible.cb({model:this.target,visible:e}),this.runScene.cb.model.change.cb({type:this.info,model:this.target,val:e}),this.cb(this.target)}execute(){return this.redo(),this}undo(){this._execute(this.oldVal)}redo(){this._execute(this.newVal)}}const i=r},169:(e,t,n)=>{n.d(t,{Z:()=>r});class r extends n(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,n)=>{n.d(t,{Z:()=>i});class r extends n(616).Z{constructor(e){super(),this.isUndoV3=!0,this.type="三维矩阵修改";var{target:e,info:t,newV3:n,oldV3:r,runScene:i}=e;this.target=e,this.info=t,this.runScene=i,this.newV3=n,this.oldV3=r,this.target.uuid===(null==(e=this.runScene.modelEx.select)?void 0:e.uuid)&&(this.runScene.cb.model.setSelect.cb(null),this.runScene.cb.model.setSelect.cb(this.target))}_execute(e){this.target[this.info].copy(e),this.target.uuid===(null==(e=this.runScene.modelEx.select)?void 0:e.uuid)&&this.runScene.helperEx.focus(this.target)}execute(e=!0){return e&&this.redo(),this}undo(){this._execute(this.oldV3)}redo(){this._execute(this.newV3)}}const i=r},729:(e,t,n)=>{n.d(t,{ZP:()=>d,Ki:()=>p,x:()=>f});var r=n(1),i=n(272),a=n(932);class s{constructor(e){this.map={},this.removes=[],this.unique=e}add(e,t,n){if(null!=e&&e.userData&&!a.materialIgnore.is(e)){let a=e.userData.id;if(a||(a=(0,r.getId)(),e.userData.id=a),this.map[a]){if(this.map[a].material.name!==e.name){const t=(0,r.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,n)}}addModel(e,t,n){n&&t&&p(n)===p(t)||(null!=t&&t.userData&&(t=p(t),null!=(t=this.map[t])&&t.models.add(e)),n&&null!=(t=this.map[p(n)])&&t.models.delete(e))}each(e){return this.getAll("values").map((({material:t})=>e(t)))}getAll(e){return Object[e](this.map)}get(e){return null==(e=this.map[e])?void 0:e.material}getModels(e){return null==(e=this.map[e])?void 0:e.models}remove(e){delete this.map[e]}addRemoved(e){this.map[e.uuid]&&this.removes.push(e.uuid)}dispose(){(0,r.mapObj)(this.map,((e,t)=>{t.material.dispose()})),this.map={}}}var o=n(269),l=n(749),u=n(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,r.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),r.type.isNumber(e)?Number.parseInt(e):-1)},t=(n,r)=>{var i=(t=>{if(-1===e(t))return t;var n=t.lastIndexOf("_");return-1===n?t:t.slice(0,n)})(n)+"_"+r++;return this.nameMap[i]?t(n,r):i},n=e=>Object.keys(this.nameMap).find((t=>this.nameMap[t]===e)),i=["PerspectiveCamera"];return r=>{if(i.includes(r.type))return r.name=r.type;let a=r.name;if(a=a||r.type,!this.nameMap[a])return s=this.unique.getId(r),(o=n(s))&&delete this.nameMap[o],void(this.nameMap[a]=s);var s,o=this.nameMap[a];return this.unique.model.get(o)!==r?(s=e(a),s=t(a,o=-1===s?0:s),this.nameMap[s]=this.unique.getId(r),r.name=s):void 0}})()}add(e,t){var{reset:n,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&&!n||(a=(0,r.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,r.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 n=t.toLowerCase();return n===(t=e.toLowerCase())||-1!==n.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,r.getId)(),e.userData.id=t),this.map[t]?void 0:(this.map[t]={texture:e,materialMap:{}},t)}}getLength(){return Object.keys(this.map).length}addMaterial(e,t,n){var r;e=e.userData.id||this.add(e),t&&(({material:t,type:r}=t),this.map[e].materialMap[t.userData.id]||(this.map[e].materialMap[t.userData.id]=new Set),this.map[e].materialMap[t.userData.id].add(r)),n&&(({material:t,type:r}=n),this.map[e].materialMap[t.userData.id]&&this.map[e].materialMap[t.userData.id].delete(r))}get(e){return null==(e=this.map[e])?void 0:e.texture}getMaterials(e){return null==(e=this.map[e])?void 0:e.materialMap}remove(e){if(e instanceof Array)return e.map((e=>this.remove(e)));var t=this.map[e.userData.id];t&&((0,r.mapObj)(t.materialMap,((e,t)=>{const n=this.unique.runScene.uniqueEx.material.get(e);n&&t.forEach((e=>{n[e]=null}))})),delete this.map[e.userData.id])}dispose(){(0,r.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,n)=>{n.r(t),n.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:()=>r.Rd,blobToFile:()=>i.hl,bufferToArrayBuffer:()=>i.cO,canvasToBlob:()=>i._c,changeModelOpc:()=>a.Hg,changeModelOpcs:()=>a.Z7,clone:()=>i.d9,colorToRgb:()=>a.sS,compressImgToUrl:()=>r.jH,deepMergeObject:()=>i.U,disposeCanvas:()=>r.eZ,disposeImageBitMap:()=>r.oZ,domTo2Dui:()=>a.UZ,domTo3DSprite:()=>a.YG,domTo3Dui:()=>a.ol,fileAndBlobToCanvas:()=>i.OE,fileToBlob:()=>i.a_,filterFiles:()=>i.Rz,fromCode:()=>i.Ne,getArrIndexByItem:()=>i.B1,getBetweenByV3:()=>a.A2,getBetweenDomByIdx:()=>l,getCamAnimaData:()=>a.Gm,getClock:()=>a.aM,getColorByHex:()=>a.e9,getCurve:()=>a.kG,getDiff:()=>i.ad,getDistance:()=>a.Sp,getEmptyImageData:()=>r.mH,getFilesByDataTransfer:()=>i.xl,getFilesFromFileList:()=>i.kk,getHexByColor:()=>a.J6,getIdxInParent:()=>o,getImg:()=>r.Pk,getImgPixels:()=>r.BW,getImgPixels1:()=>r.Cm,getLine2:()=>a.SI,getMacro:()=>i.Ls,getMapByRgb:()=>i.fh,getMd5:()=>i.ZM,getModelMap:()=>a.yT,getNamesByNum:()=>i.nR,getOptions:()=>s.FW,getProgress:()=>i.xC,getRGBByHex:()=>a.OR,getRandomColor:()=>i.mr,getRes:()=>i.sR,getResultFromCanvas:()=>r.xK,getTime:()=>i.hK,getTruthBase64:()=>i.Mh,getType:()=>i.oL,getTypeByBase64:()=>i.Op,getTypeFromGlb:()=>s.te,getVideoTexture:()=>a.hX,getWorldLocal:()=>a.VU,hslToRgb:()=>r.ve,imgArrayBufferToBlobUrl:()=>r.lU,imgBitMapToBase64:()=>r.s4,imgBitMapToBlob:()=>r.gW,imgBitMapToBlobAndBase64:()=>r.v1,isBlob:()=>i.Lj,isDef:()=>i.Xq,isEditor:()=>s.hz,isEmpty:()=>i.xb,isRunning:()=>s.An,longestCommonPrefix:()=>i.GG,mergeObject:()=>i.Gm,removeUnLess:()=>a.hs,reverseImageBitMap:()=>r.Fs,reverseImg:()=>r.rx,rgbToHex:()=>a.vq,rgbToHsl:()=>r.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 r=n(137),i=n(723),a=n(453),s=n(158);const o=e=>[...e.parentElement.children].findIndex((t=>t===e)),l=e=>{var{dom:e,beginIdx:t,endIdx:n}=e;return[...e.children].slice(t,n+1)};var u=n(881);const c=(e,t,n)=>{const{}=n||{},r={},a={};e.map(((e,t)=>{const{begin:n,end:s,type:o,label:l}=e,c="_"+o+"_"+l+"_"+String(t);if("color"===o&&n instanceof u.Color&&s instanceof u.Color){const e=(0,i.I8)("#"+n.getHexString(),!0),t=(0,i.I8)("#"+s.getHexString(),!0);["r","g","b"].map((n=>{var i=n+c;r[i]=e[n],a[i]=t[n]}))}"number"===o&&(r[e=l+c]=n,a[e]=s),"vector3"===o&&["x","y","z"].map((e=>{var t=e+c;r[t]=n[e],a[t]=s[e]})),"vector2"===o&&["x","y"].map((e=>{var t=e+c;r[t]=n[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,n)=>{n.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 r=n(247),i=n(625),a=n(723),s=function(e,t,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.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"),n=(t.width=e.width,t.height=e.height,t.getContext("2d"));n.translate(0,t.height),n.scale(1,-1),n.drawImage(e,0,0,t.width,t.height)},c=e=>s(void 0,void 0,void 0,(function*(){var t=e.image;const n=document.createElement("canvas"),r=(n.width=t.width,n.height=t.height,n.getContext("2d")),a=(0,i.getMimeByTexture)(e);return r.drawImage(t,0,0,n.width,n.height),new Promise((e=>{n.toBlob((t=>{e({blob:t,base64:n.toDataURL(a)})}),a)}))})),h=(e,t)=>URL.createObjectURL(new Blob([e],t)),d=(e,t)=>{const n=document.createElement("canvas"),r=n.getContext("2d");return n.width=e.width,n.height=e.height,r.drawImage(e,0,0,e.width,e.height),new Promise((e=>{n.toBlob((t=>{t&&e(URL.createObjectURL(t))}),"image/webp",t)}))},p=e=>s(void 0,void 0,void 0,(function*(){var{bitmap:t,texture:n}=e;const{ctx:i,canvas:s}=yield(0,a.OE)(URL.createObjectURL(n.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 r.Z.Texture(s)})),f=e=>{for(var t=(e=e.bitmap).width,n=e.height,r=m(e).ctx.getImageData(0,0,t,n).data,i=[],a=0;a<r/4;a+=1)i.push(r.slice(4*a,4*(a+1)))},m=e=>{const t=document.createElement("canvas"),n=t.getContext("2d");return n.drawImage(e,0,0,e.width,e.height),{ctx:n,canvas:t}},v=(e,t,n)=>{e/=255,t/=255,n/=255;var r,i=Math.max(e,t,n),a=Math.min(e,t,n),s=(i+a)/2;if(i==a)r=l=0;else{var o=i-a,l=.5<s?o/(2-i-a):o/(i+a);switch(i){case e:r=(t-n)/o+(t<n?6:0);break;case t:r=(n-e)/o+2;break;case n:r=(e-t)/o+4}r/=6}return[100*r,100*l,100*s]},g=(e,t,n)=>{var r,i,a,s;return 0==t?i=a=s=n:(i=(r=function(e,t,n){return n<0&&(n+=1),1<n&&--n,n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e})(t=2*n-(n=n<.5?n*(1+t):n+t-n*t),n,e+1/3),a=r(t,n,e),s=r(t,n,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,n)=>{const r=(0,a.Gm)({base64Type:"webp"},n).base64Type;return new Promise(((n,i)=>{"blob"===t?e.toBlob((e=>{(e?n:i)(e)})):"base64"===t&&n(e.toDataURL("image/"+r))}))},x=e=>s(void 0,void 0,void 0,(function*(){var{width:t,height:n}=e;const r=document.createElement("canvas"),i=(r.width=t,r.height=n,r.getContext("2d"));if(i)return i.translate(0,n),i.scale(1,-1),i.drawImage(e,0,0,t,n),{imageBitMap:yield createImageBitmap(i.getImageData(0,0,t,n)),canvas:r}})),w=e=>{e.remove()},S=e=>{e.close()},A=e=>{var{width:e,height:t}=e;const n=document.createElement("canvas");return(n.width=e,n.height=t,n.getContext("2d")).drawImage(new Image,0,0),n}},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,n,r){return new(n=n||Promise)((function(i,a){function s(e){try{l(r.next(e))}catch(e){a(e)}}function o(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(s,o)}l((r=r.apply(e,t||[])).next())}))};const anima=(e,t,n,r,i)=>{let a=Object.assign({},e),s=new _libs_Anima__WEBPACK_IMPORTED_MODULE_3__.Q3(a,n,t).eventCallback("onUpdate",(e=>r&&r(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 n=t.length;const r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.charCodeAt(e);return r.buffer})),getTruthBase64=e=>e.substring(e.indexOf(",")+1),arrayBufferToBlobUr=e=>URL.createObjectURL(new Blob([e])),arrayBufferToBase64=e=>{let t="";var n=new Uint8Array(e);for(let e=0,r=n.byteLength;e<r;e++)t+=String.fromCharCode(n[e]);return"data:image/jpg;base64,"+window.btoa(t)},urlToBlob=e=>__awaiter(void 0,void 0,void 0,(function*(){return(yield axios__WEBPACK_IMPORTED_MODULE_1___default().get(e,{responseType:"blob"})).data})),base64ToBlob=e=>{let t=e.split(","),n=t[0].match(/:(.*?);/)[1],r=atob(t[1]),i=r.length,a=new Uint8Array(i);for(;i--;)a[i]=r.charCodeAt(i);return new Blob([a],{type:n})},fileToBlob=e=>__awaiter(void 0,void 0,void 0,(function*(){return base64ToBlob(yield(0,js_funcs__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 n=t=e<102.4?e.toFixed(2)+"B":e<1048576?(e/1024).toFixed(2)+"KB":e<1073741824?(e/1048576).toFixed(2)+"M":(e/1073741824).toFixed(2)+"G";return e=n.indexOf("."),"00"==n.substr(e+1,2)?n.substring(0,e)+n.substr(e+3,2):t},getMd5=e=>(0,_allex_md5__WEBPACK_IMPORTED_MODULE_0__.md5)(e),fileAndBlobToCanvas=(e,t)=>{var{width:t,height:n}=t;let r=new Image,i=(r.src=e,r.width=t,r.height=n,document.createElement("canvas")),a=(i.width=t,i.height=n,i.getContext("2d"));return new Promise((e=>{r.onload=function(){a.drawImage(r,0,0,i.width,i.height),e({canvas:i,ctx:a})}}))},getFilesByDataTransfer=e=>new Array(e.files.length).fill(0).map(((t,n)=>e.files.item(n))).filter((e=>null!==e)),canvasToBlob=e=>new Promise((t=>{e.toBlob((e=>{t(e)}))})),getRes=(e,t)=>axios__WEBPACK_IMPORTED_MODULE_1___default().get(e,{responseType:t||"arraybuffer"}).then((e=>e.data)).catch((e=>{console.log(e,"加载出错")})),mergeObject=(e,t)=>Object.assign(e,t||{}),getMacro=(e,t=0)=>{let n=setTimeout((()=>(null!==n&&clearTimeout(n),n=null,e())),t)},clone=e=>{if(null===e)return null;if("object"!=typeof e)return e;var t,n,r=new e.constructor;for(t in e)e.hasOwnProperty(t)&&(n=e[t],r[t]=n);return r},getNamesByNum=(e,t,n=1,r)=>new Array(t).fill("").map(((t,i)=>e+(i+n)+(r||""))),getType=e=>null==e?void 0:e.toString().replace(/(\[object )([a-zA-Z]+)(])/,"$2"),deepMergeObject=(e,t)=>((0,js_funcs__WEBPACK_IMPORTED_MODULE_2__.mapObj)(e,((n,r)=>{let i=t[n];void 0!==i&&("Object"===getType(r)&&"Object"===getType(i)&&(i=deepMergeObject(r,i)),e[n]=i)})),e),getArrIndexByItem=(e,t)=>e.find((e=>e===t)),getProgress=(e,t,n=!1)=>{let r=e/t;return n&&(r*=100),Number(r.toFixed(2))},urlToCanvas=e=>__awaiter(void 0,void 0,void 0,(function*(){if(!e)throw TypeError("该参数为空");var t=yield(0,_UtilsImage__WEBPACK_IMPORTED_MODULE_5__.Pk)(e);const n=document.createElement("canvas"),r=(n.width=t.width,n.height=t.height,n.getContext("2d"));return r.drawImage(t,0,0),{img:t,canvas:n,ctx:r}})),bufferToArrayBuffer=e=>{for(var t=new ArrayBuffer(e.length),n=new Uint8Array(t),r=0;r<e.length;++r)n[r]=e[r];return t},isEmpty=e=>null==e||(Array.isArray(e)||"string"==typeof e?0===e.length:"number"==typeof e?0===e:"object"==typeof e?0===Object.keys(e).length:void 0),isBlob=e=>e&&e instanceof Blob,getTime=e=>{const t=new Date;return t.setTime(t.getTime()+864e5*e),t.getTime()},key="gltf-version-2.0",toCode=e=>{for(var t,n,r=key.length,i=key.split(""),a="",s=0;s<e.length;s++)a+=i[((n=((n=e.charCodeAt(s))-(t=n%r))/r)-(n%=r))/r%r]+i[n]+i[t];return a},fromCode=str=>{for(var st=key.length,b,b1,b2,b3,d=0,s,s=new Array(Math.floor(str.length/3)),b=s.length,i=0;i<b;i++)b1=key.indexOf(str.charAt(d)),d++,b2=key.indexOf(str.charAt(d)),d++,b3=key.indexOf(str.charAt(d)),d++,s[i]=b1*st*st+b2*st+b3;return b=eval("String.fromCharCode("+s.join(",")+")"),b},getFilesFromFileList=e=>{const t=[];for(let r=0;r<e.length;r++){var n=e.item(r);t.push(n)}return t},filterFiles=(e,t)=>"any"===t?e:e.filter((e=>-1!==e.type.indexOf(t))),toTimeString=e=>{if(e)return e.getFullYear()+"/"+(e.getMonth()+1)+"/"+e.getDate()},rmPartOfString=(e,t)=>e.replace(new RegExp(t),""),rmArrEle=(e,t)=>{var n=e.findIndex((e=>e===t));if(-1!==n)return e.splice(n,1),n},addElesFromIndexToArr=(e,t,n)=>(t=Array.isArray(t)?t:[t],e.splice(n,0,...t)),sameArr=(e,t,n)=>{if("fill"===n){for(var[r,i]of e)if(r!==t[i])return!1;return!0}var a=e.length;const s=Math.floor(a/n);for(const r of new Array(n).fill("").map(((e,t)=>(t+1)*s)))if(e[r]!==t[r])return!1;return!0};class LimitCb{constructor(){this.timer=0}update(e){const{cb:t,now:n,cbRate:r}=e;this.timer+=n,this.timer>r&&(t(),this.timer=0)}}const longestCommonPrefix=e=>{if(0==e.length)return"";for(var t=e[0],n="",r=1;r<e.length;r++){for(var i=0;i<=e[r].length;i++){if(t[i]!=e[r][i]){t=n;break}n+=t[i]}n=""}return t},getRandomColor=()=>{let e=[];for(let t=0;t<3;++t){let t=Math.floor(256*Math.random()).toString(16);t=1==t.length?"0"+t:t,e.push(t)}return"#"+e.join("")},validType=(e,t)=>{var n;return"number"===t?(n=Number(e),!isNaN(n)):"array"===t?Array.isArray(e):void 0},isDef=(e,t)=>e instanceof Array?_Ex_Ex__WEBPACK_IMPORTED_MODULE_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 n={r:0,g:0,b:0};for(let e=0;e<rgbArr.length;e++){var r=rgbArr[e],i=t[e];if(!i)return;i=strToNum(i),n[r]=i}return n};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 n="#",r=1;r<4;r+=1)n+=e.slice(r,r+1).concat(e.slice(r,r+1));e=n}var i,a,s=[];for(r=1;r<7;r+=2)s.push(parseInt("0x"+e.slice(r,r+2)));return t?([t,i,a]=s,{r:t,g:i,b:a}):"RGB("+s.join(",")+")"}return e}const getDiff=(e,t,n=0)=>{const r={};return(0,js_funcs__WEBPACK_IMPORTED_MODULE_2__.mapObj)(e,((e,n)=>{var i=t[e];isDef(n,i)&&(r[e]=i)})),r};function MyHextoRgb(e,t){if(-1!==(e=e.toLocaleLowerCase().slice(1)).indexOf("rgb"))return e;var[e,n,r,i,a,s]=e.split(""),n=(e=parseInt("0x"+e+n),parseInt("0x"+r+i)),r=parseInt("0x"+a+s);return t?{r:e,g:n,b:r}:"RGB("+e+","+n+","+r+")"}},158:(e,t,n)=>{n.d(t,{An:()=>a,FW:()=>s,hz:()=>i,te:()=>r});const r=e=>{},i=e=>"editor"===e.optionsEx.options.mode,a=e=>"running"===e.optionsEx.options.mode,s=e=>e.optionsEx.options},453:(e,t,n)=>{n.d(t,{Zv:()=>de,F:()=>ce,Hg:()=>ie,Z7:()=>ae,sS:()=>Ae,UZ:()=>ne,YG:()=>re,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 r=n(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 n,r=o(e);if(n=t?(n=o(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===i(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var l=new r.Box3,u=new r.Vector3,c=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e);var n=s(i);function i(){var e;if(!(this instanceof i))throw new TypeError("Cannot call a class as a function");return(e=n.call(this)).type="LineSegmentsGeometry",e.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),e.setAttribute("position",new r.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),e.setAttribute("uv",new r.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),e}return t=i,(e=[{key:"applyMatrix4",value:function(e){var t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"setPositions",value:function(e){var t;return e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e)),e=new r.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceStart",new r.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceEnd",new r.InterleavedBufferAttribute(e,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}},{key:"setColors",value:function(e){var t;return e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e)),e=new r.InstancedInterleavedBuffer(t,6,1),this.setAttribute("instanceColorStart",new r.InterleavedBufferAttribute(e,3,0)),this.setAttribute("instanceColorEnd",new r.InterleavedBufferAttribute(e,3,3)),this}},{key:"fromWireframeGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromEdgesGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromMesh",value:function(e){return this.fromWireframeGeometry(new r.WireframeGeometry(e.geometry)),this}},{key:"fromLineSegments",value:function(e){if(!(e=e.geometry).isGeometry)return e.isBufferGeometry&&this.setPositions(e.attributes.position.array),this;console.error("THREE.LineSegmentsGeometry no longer supports Geometry. Use THREE.BufferGeometry instead.")}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new r.Box3);var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),l.setFromBufferAttribute(t),this.boundingBox.union(l))}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new r.Sphere),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){for(var n=this.boundingSphere.center,i=(this.boundingBox.getCenter(n),0),a=0,s=e.count;a<s;a++)u.fromBufferAttribute(e,a),i=Math.max(i,n.distanceToSquared(u)),u.fromBufferAttribute(t,a),i=Math.max(i,n.distanceToSquared(u));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}},{key:"toJSON",value:function(){}},{key:"applyMatrix",value:function(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.InstancedBufferGeometry);function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function d(e,t){return(d=Object.setPrototypeOf||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,r.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new r.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},r.ShaderLib.line={uniforms:r.UniformsUtils.merge([r.UniformsLib.common,r.UniformsLib.fog,r.UniformsLib.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// get the offset direction as perpendicular to the view vector\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 offset;\n\t\t\t\tif ( position.y < 0.5 ) {\n\n\t\t\t\t\toffset = normalize( cross( start.xyz, worldDir ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toffset = normalize( cross( end.xyz, worldDir ) );\n\n\t\t\t\t}\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\tfloat forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// extend the line bounds to encompass endcaps\n\t\t\t\t\tstart.xyz += - worldDir * linewidth * 0.5;\n\t\t\t\t\tend.xyz += worldDir * linewidth * 0.5;\n\n\t\t\t\t\t// shift the position of the quad so it hugs the forward edge of the line\n\t\t\t\t\toffset.xy -= dir * forwardOffset;\n\t\t\t\t\toffset.z += 0.5;\n\n\t\t\t\t#endif\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\toffset.xy += dir * 2.0 * forwardOffset;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth * 0.5;\n\n\t\t\t\t// set the world position\n\t\t\t\tworldPos = ( position.y < 0.5 ) ? start : end;\n\t\t\t\tworldPos.xyz += offset;\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"};var m=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=f(e);if(n=t?(n=f(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===h(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return p(r)}}(i);function i(e){var t;if(this instanceof i)return t=n.call(this,{type:"LineMaterial",uniforms:r.UniformsUtils.clone(r.ShaderLib.line.uniforms),vertexShader:r.ShaderLib.line.vertexShader,fragmentShader:r.ShaderLib.line.fragmentShader,clipping:!0}),Object.defineProperties(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}(r.ShaderMaterial);function v(e){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function g(e,t){return(g=Object.setPrototypeOf||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 r.Vector3,M=new r.Vector3,B=new r.Vector4,C=new r.Vector4,E=new r.Vector4,T=new r.Vector3,_=new r.Matrix4,D=new r.Line3,P=new r.Vector3,O=new r.Box3,R=new r.Sphere,I=new r.Vector4;function L(e,t,n){return I.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),I.multiplyScalar(1/I.w),I.x=S/n.width,I.y=S/n.height,I.applyMatrix4(e.projectionMatrixInverse),I.multiplyScalar(1/I.w),Math.abs(Math.max(I.x,I.y))}var k=function(e){var t=i;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&g(t,e);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=y(e);if(n=t?(n=y(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===v(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(i);function i(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new c,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new m({color:16777215*Math.random()}),r=this,a=i;if(r instanceof a)return(r=n.call(this,e,t)).type="LineSegments2",r;throw new TypeError("Cannot call a class as a function")}return t=i,(e=[{key:"computeLineDistances",value:function(){for(var e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,i=new Float32Array(2*t.count),a=0,s=0,o=t.count;a<o;a++,s+=2)A.fromBufferAttribute(t,a),M.fromBufferAttribute(n,a),i[s]=0===s?0:i[s-1],i[s+1]=i[s]+A.distanceTo(M);var l=new r.InstancedInterleavedBuffer(i,2,1);return e.setAttribute("instanceDistanceStart",new r.InterleavedBufferAttribute(l,1,0)),e.setAttribute("instanceDistanceEnd",new r.InterleavedBufferAttribute(l,1,1)),this}},{key:"raycast",value:function(e,t){var n=this.material.worldUnits,i=e.camera,a=(null!==i||n||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'),void 0!==e.params.Line2&&e.params.Line2.threshold||0),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=n?.5*S:L(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=n?.5*S:L(i,Math.max(i.near,O.distanceToPoint(b.origin)),o.resolution),O.expandByScalar(a),!1!==b.intersectsBox(O)))if(n)for(var l=t,u=0,c=x.count;u<c;u++){D.start.fromBufferAttribute(x,u),D.end.fromBufferAttribute(w,u);var h=new r.Vector3,d=new r.Vector3;b.distanceSqToSegment(D.start,D.end,d,h),d.distanceTo(h)<.5*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,k,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,k=(C.z-M)/I,C.lerp(B,k)),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,k=D.closestPointToPointParameter(T,!0),D.at(k,P),F=-1<=(F=r.MathUtils.lerp(B.z,C.z,k))&&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 r.Vector3,U=new r.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 n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),i}(r.Mesh);function F(e){return(F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function U(){return(U="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=N(e)););return e}(e,t);if(r)return(r=Object.getOwnPropertyDescriptor(r,t)).get?r.get.call(arguments.length<3?e:n):r.value}).apply(this,arguments)}function G(e,t){return(G=Object.setPrototypeOf||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)}k.prototype.isLineSegments2=!0;var j=function(){var e=r,t=c;if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&G(e,t);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=N(e);if(n=t?(n=N(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===F(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(r);function r(){var e;if(this instanceof r)return(e=n.call(this)).type="LineGeometry",e;throw new TypeError("Cannot call a class as a function")}return e=r,(t=[{key:"setPositions",value:function(e){for(var t=e.length-3,n=new Float32Array(2*t),i=0;i<t;i+=3)n[2*i]=e[i],n[2*i+1]=e[i+1],n[2*i+2]=e[i+2],n[2*i+3]=e[i+3],n[2*i+4]=e[i+4],n[2*i+5]=e[i+5];return U(N(r.prototype),"setPositions",this).call(this,n),this}},{key:"setColors",value:function(e){for(var t=e.length-3,n=new Float32Array(2*t),i=0;i<t;i+=3)n[2*i]=e[i],n[2*i+1]=e[i+1],n[2*i+2]=e[i+2],n[2*i+3]=e[i+3],n[2*i+4]=e[i+4],n[2*i+5]=e[i+5];return U(N(r.prototype),"setColors",this).call(this,n),this}},{key:"fromLine",value:function(e){if(!(e=e.geometry).isGeometry)return e.isBufferGeometry&&this.setPositions(e.attributes.position.array),this;console.error("THREE.LineGeometry no longer supports Geometry. Use THREE.BufferGeometry instead.")}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),r}();function 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=r,t=k;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 n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=V(e);if(n=t?(n=V(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===z(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(r);function r(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new j,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new m({color:16777215*Math.random()}),i=this,a=r;if(i instanceof a)return(i=n.call(this,e,t)).type="Line2",i;throw new TypeError("Cannot call a class as a function")}return e=r,Object.defineProperty(e,"prototype",{writable:!1}),e}(),K=(J.prototype.isLine2=!0,n(699)),Z=n(693),W=n(263),X=n(247),Q=n(932),Y=n(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:n}=e;return void 0===n?new r.Vector2(e,t):new r.Vector3(e,t,n)},toJSON(e){var{x:e,y:t,z:n}=e;return null==n?{x:e,y:t}:{x:e,y:t,z:n}}},ee=(e,t)=>e.distanceTo(t),te=e=>new Z.cp(e),ne=e=>new K.j(e),re=e=>new Z.P7(e),ie=(e,t=.5,n=!1)=>{if("Group"===e.type)throw TypeError("该模型为Group类型");if(!e.material)throw TypeError("该模型没有材质");if(void 0===e.material.oldOpc&&(e.material.oldOpc=e.material.opacity,e.material.oldTransparent=e.material.transparent),n)return e.material.opacity=e.material.oldOpc,void(e.material.transparent=e.material.oldTransparent);1===t?(e.material.transparent=!1,e.material.opacity=1):(e.material.transparent=!0,e.material.opacity=t)},ae=(e,t,n)=>{"Group"===e.type||"Object3D"===e.type?e.children.forEach((e=>ae(e,t,n))):ie(e,t,n)},se=e=>(e.mapping=r.EquirectangularReflectionMapping,e),oe=e=>{let t=e=>"Group"!==e.type&&"Object3D"!==e.type||1!==e.children.length?e:t(e.children[0]);return t(e)},le=(e,t)=>{let n=document.createElement("video");return n.style="position:absolute;top:0;left:0;z-index:1000000;",n.src=e,n.loop="loop",n.muted="muted",n.play(),t.appendChild(n),new r.VideoTexture(n)},ue=(e,t=!1)=>{let n=new r.CatmullRomCurve3(e),i=new r.BufferGeometry;e=n.getSpacedPoints(100),i.setFromPoints(e),e=new r.LineBasicMaterial({color:26214});let a=new r.Line(i,e);return a.visible=t,{line:a,curve:n}},ce=e=>{let t=0;const n=[],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),n.push(new r.Vector3(s,o,l))),i[a[t]]=e,t++})),n},he=e=>{var{pointArray:e,material:t,lineWidth:n,colorArray:i}=e;const a=new j,s=(a.setPositions(e),t||new m({transparent:!0,side:r.DoubleSide,linewidth:n||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",n)=>{const r={};return e.traverse((e=>{"id"===t?r[e.userData.id]=e:r[e[t]]=e,null!=n&&n(e)})),r},fe=(e,t,n,r,i,a)=>({cx:e,cy:t,cz:n,tx:r,ty:i,tz:a}),me=(e,t)=>{var{x:e,y:n,z:r}=e,{x:t,y:i,z:a}=t;return{x:e-t,y:n-i,z:r-a}},ve=()=>new X.Z.Clock,ge=e=>{var{r:e,g:t,b:n}=(0,Y.fh)((0,Y.I8)(e.includes("#")?e:"#"+e));return new X.Z.Color(e,t,n)},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:n,b:r}=e;return"rgb("+[t,n,r].map((e=>1<e?e:255*e)).join(",")+")"},Se=e=>{var{r:e,g:t,b:n}=e;return{r:e,g:t,b:n}},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="#",n=e.replace(/(?:\(|\)|rgb|RGB)*/g,"").split(","),r=0;r<n.length;r++){var i=Number(n[r]).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,n)=>{n.d(t,{Ys:()=>A});var r=n(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 n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){t&&s(e.prototype,t),n&&s(e,n),Object.defineProperty(e,"prototype",{writable:!1})}function l(){return(l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=p(e)););return e}(e,t);if(r)return(r=Object.getOwnPropertyDescriptor(r,t)).get?r.get.call(arguments.length<3?e:n):r.value}).apply(this,arguments)}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p(e);if(n=t?(n=p(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===i(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return d(r)}}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 r.Raycaster,m=new r.Vector3,v=new r.Vector3,g=new r.Quaternion,y={X:new r.Vector3(1,0,0),Y:new r.Vector3(0,1,0),Z:new r.Vector3(0,0,1)},b={type:"change"},x={type:"mouseDown"},w={type:"mouseUp",mode:null},S={type:"objectChange"},A=function(){u(t,r.Object3D);var e=h(t);function t(n,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 n=t;Object.defineProperty(u,e,{get:function(){return void 0!==n?n:t},set:function(t){n!==t&&(n=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",n),c("object",void 0),c("enabled",!0),c("axis",null),c("mode","translate"),c("translationSnap",null),c("rotationSnap",null),c("scaleSnap",null),c("space","world"),c("size",1),c("dragging",!1),c("showX",!0),c("showY",!0),c("showZ",!0),i=new r.Vector3,n=new r.Vector3;var h=new r.Quaternion,p=new r.Quaternion,f=new r.Vector3,m=new r.Quaternion,v=new r.Vector3,g=new r.Vector3,y=new r.Vector3,x=new r.Vector3;return c("worldPosition",i),c("worldPositionStart",n),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 r.Vector3,s._startNorm=new r.Vector3,s._endNorm=new r.Vector3,s._cameraScale=new r.Vector3,s._parentPosition=new r.Vector3,s._parentQuaternion=new r.Quaternion,s._parentQuaternionInv=new r.Quaternion,s._parentScale=new r.Vector3,s._worldScaleStart=new r.Vector3,s._worldQuaternionInv=new r.Quaternion,s._worldScale=new r.Vector3,s._positionStart=new r.Vector3,s._quaternionStart=new r.Quaternion,s._scaleStart=new r.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,n=this.mode,r=this.object,i=this.space;"scale"===n?i="local":"E"!==t&&"XYZE"!==t&&"XYZ"!==t||(i="world"),void 0!==r&&null!==t&&!1!==this.dragging&&-1===e.button&&(f.setFromCamera(e,this.camera),(e=M(this._plane,f,!0))&&(this.pointEnd.copy(e.point).sub(this.worldPositionStart),"translate"===n?(this._offset.copy(this.pointEnd).sub(this.pointStart),"local"===i&&"XYZ"!==t&&this._offset.applyQuaternion(this._worldQuaternionInv),-1===t.indexOf("X")&&(this._offset.x=0),-1===t.indexOf("Y")&&(this._offset.y=0),-1===t.indexOf("Z")&&(this._offset.z=0),("local"===i&&"XYZ"!==t?this._offset.applyQuaternion(this._quaternionStart):this._offset.applyQuaternion(this._parentQuaternionInv)).divide(this._parentScale),r.position.copy(this._offset).add(this._positionStart),this.translationSnap&&("local"===i&&(r.position.applyQuaternion(g.copy(this._quaternionStart).invert()),-1!==t.search("X")&&(r.position.x=Math.round(r.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(r.position.y=Math.round(r.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(r.position.z=Math.round(r.position.z/this.translationSnap)*this.translationSnap),r.position.applyQuaternion(this._quaternionStart)),"world"===i&&(r.parent&&r.position.add(m.setFromMatrixPosition(r.parent.matrixWorld)),-1!==t.search("X")&&(r.position.x=Math.round(r.position.x/this.translationSnap)*this.translationSnap),-1!==t.search("Y")&&(r.position.y=Math.round(r.position.y/this.translationSnap)*this.translationSnap),-1!==t.search("Z")&&(r.position.z=Math.round(r.position.z/this.translationSnap)*this.translationSnap),r.parent&&r.position.sub(m.setFromMatrixPosition(r.parent.matrixWorld))))):"scale"===n?(-1!==t.search("XYZ")?(e=this.pointEnd.length()/this.pointStart.length(),this.pointEnd.dot(this.pointStart)<0&&(e*=-1),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)),r.scale.copy(this._scaleStart).multiply(v),this.scaleSnap&&(-1!==t.search("X")&&(r.scale.x=Math.round(r.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Y")&&(r.scale.y=Math.round(r.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==t.search("Z")&&(r.scale.z=Math.round(r.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))):"rotate"===n&&(this._offset.copy(this.pointEnd).sub(this.pointStart),e=20/this.worldPosition.distanceTo(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?(r.quaternion.copy(this._quaternionStart),r.quaternion.multiply(g.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),r.quaternion.copy(g.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),r.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,n){for(var r=t.intersectObject(e,!0),i=0;i<r.length;i++)if(r[i].object.visible||n)return r[i];return!1}A.prototype.isTransformControls=!0;var B=new r.Euler,C=new r.Vector3(0,1,0),E=new r.Vector3(0,0,0),T=new r.Matrix4,_=new r.Quaternion,D=new r.Quaternion,P=new r.Vector3,O=new r.Matrix4,R=new r.Vector3(1,0,0),I=new r.Vector3(0,1,0),L=new r.Vector3(0,0,1),k=new r.Vector3,F=new r.Vector3,U=new r.Vector3,G=function(){u(t,r.Object3D);var e=h(t);function t(){a(this,t),(n=e.call(this)).type="TransformControlsGizmo";var n,i=new r.MeshBasicMaterial({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),s=new r.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 r.CylinderGeometry(0,.04,.1,12)).translate(0,.05,0),new r.BoxGeometry(.08,.08,.08)),f=(p.translate(0,.04,0),new r.BufferGeometry);function m(e,t){return(e=new r.TorusGeometry(e,.0075,3,64,t*Math.PI*2)).rotateY(Math.PI/2),e.rotateX(Math.PI/2),e}(f.setAttribute("position",new r.Float32BufferAttribute([0,0,0,1,0,0],3)),A=new r.CylinderGeometry(.0075,.0075,.5,3)).translate(0,.25,0);var v={X:[[new r.Mesh(v,w),[.5,0,0],[0,0,-Math.PI/2]],[new r.Mesh(v,w),[-.5,0,0],[0,0,Math.PI/2]],[new r.Mesh(A,w),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new r.Mesh(v,S),[0,.5,0]],[new r.Mesh(v,S),[0,-.5,0],[Math.PI,0,0]],[new r.Mesh(A,S)]],Z:[[new r.Mesh(v,l),[0,0,.5],[Math.PI/2,0,0]],[new r.Mesh(v,l),[0,0,-.5],[-Math.PI/2,0,0]],[new r.Mesh(A,l),null,[Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.OctahedronGeometry(.1,0),d.clone()),[0,0,0]]],XY:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),h.clone()),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),u.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),c.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},g={X:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.OctahedronGeometry(.2,0),o)]],XY:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]]},y={START:[[new r.Mesh(new r.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],END:[[new r.Mesh(new r.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],DELTA:[[new r.Line(((y=new r.BufferGeometry).setAttribute("position",new r.Float32BufferAttribute([0,0,0,1,1,1],3)),y),s),null,null,null,"helper"]],X:[[new r.Line(f,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new r.Line(f,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new r.Line(f,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},b=(i={XYZE:[[new r.Mesh(m(.5,1),i),null,[0,Math.PI/2,0]]],X:[[new r.Mesh(m(.5,.5),w)]],Y:[[new r.Mesh(m(.5,.5),S),null,[0,0,-Math.PI/2]]],Z:[[new r.Mesh(m(.5,.5),l),null,[0,Math.PI/2,0]]],E:[[new r.Mesh(m(.75,1),b),null,[0,Math.PI/2,0]]]},{AXIS:[[new r.Line(f,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]}),x={XYZE:[[new r.Mesh(new r.SphereGeometry(.25,10,8),o)]],X:[[new r.Mesh(new r.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new r.Mesh(new r.TorusGeometry(.5,.1,4,24),o),[0,0,0],[Math.PI/2,0,0]]],Z:[[new r.Mesh(new r.TorusGeometry(.5,.1,4,24),o),[0,0,0],[0,0,-Math.PI/2]]],E:[[new r.Mesh(new r.TorusGeometry(.75,.1,2,24),o)]]},w={X:[[new r.Mesh(p,w),[.5,0,0],[0,0,-Math.PI/2]],[new r.Mesh(A,w),[0,0,0],[0,0,-Math.PI/2]],[new r.Mesh(p,w),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new r.Mesh(p,S),[0,.5,0]],[new r.Mesh(A,S)],[new r.Mesh(p,S),[0,-.5,0],[0,0,Math.PI]]],Z:[[new r.Mesh(p,l),[0,0,.5],[Math.PI/2,0,0]],[new r.Mesh(A,l),[0,0,0],[Math.PI/2,0,0]],[new r.Mesh(p,l),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),h),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),u),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.15,.15,.01),c),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.BoxGeometry(.1,.1,.1),d.clone())]]},S={X:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),o),[.3,0,0],[0,0,-Math.PI/2]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),o),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),o),[0,.3,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),o),[0,-.3,0],[0,0,Math.PI]]],Z:[[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),o),[0,0,.3],[Math.PI/2,0,0]],[new r.Mesh(new r.CylinderGeometry(.2,0,.6,4),o),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),o),[.15,.15,0]]],YZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),o),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.01),o),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new r.Mesh(new r.BoxGeometry(.2,.2,.2),o),[0,0,0]]]},A={X:[[new r.Line(f,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new r.Line(f,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new r.Line(f,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function M(e){var t,n=new r.Object3D;for(t in e)for(var i=e[t].length;i--;){var a=e[t][i][0].clone(),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),n.add(a)}return n}return n.gizmo={},n.picker={},n.helper={},n.add(n.gizmo.translate=M(v)),n.add(n.gizmo.rotate=M(i)),n.add(n.gizmo.scale=M(w)),n.add(n.picker.translate=M(g)),n.add(n.picker.rotate=M(x)),n.add(n.picker.scale=M(S)),n.add(n.helper.translate=M(y)),n.add(n.helper.rotate=M(b)),n.add(n.helper.scale=M(A)),n.picker.translate.visible=!1,n.picker.rotate.visible=!1,n.picker.scale.visible=!1,n}return o(t,[{key:"updateMatrixWorld",value:function(e){var n=this,r="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(n.worldPosition),e=n.camera.isOrthographicCamera?(n.camera.top-n.camera.bottom)/n.camera.zoom:n.worldPosition.distanceTo(n.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*n.camera.fov/360)/n.camera.zoom,7),t.scale.set(1,1,1).multiplyScalar(e*n.size/4),"helper"===t.tag)return t.visible=!1,"AXIS"===t.name?(t.position.copy(n.worldPositionStart),t.visible=!!n.axis,"X"===n.axis&&(g.setFromEuler(B.set(0,0,0)),t.quaternion.copy(r).multiply(g),.9<Math.abs(C.copy(R).applyQuaternion(r).dot(n.eye))&&(t.visible=!1)),"Y"===n.axis&&(g.setFromEuler(B.set(0,0,Math.PI/2)),t.quaternion.copy(r).multiply(g),.9<Math.abs(C.copy(I).applyQuaternion(r).dot(n.eye))&&(t.visible=!1)),"Z"===n.axis&&(g.setFromEuler(B.set(0,Math.PI/2,0)),t.quaternion.copy(r).multiply(g),.9<Math.abs(C.copy(L).applyQuaternion(r).dot(n.eye))&&(t.visible=!1)),"XYZE"===n.axis&&(g.setFromEuler(B.set(0,Math.PI/2,0)),C.copy(n.rotationAxis),t.quaternion.setFromRotationMatrix(T.lookAt(E,C,I)),t.quaternion.multiply(g),t.visible=n.dragging),"E"===n.axis&&(t.visible=!1)):"START"===t.name?(t.position.copy(n.worldPositionStart),t.visible=n.dragging):"END"===t.name?(t.position.copy(n.worldPosition),t.visible=n.dragging):"DELTA"===t.name?(t.position.copy(n.worldPositionStart),t.quaternion.copy(n.worldQuaternionStart),m.set(1e-10,1e-10,1e-10).add(n.worldPositionStart).sub(n.worldPosition).multiplyScalar(-1),m.applyQuaternion(n.worldQuaternionStart.clone().invert()),t.scale.copy(m),t.visible=n.dragging):(t.quaternion.copy(r),n.dragging?t.position.copy(n.worldPositionStart):t.position.copy(n.worldPosition),n.axis&&(t.visible=-1!==n.axis.search(t.name)));t.quaternion.copy(r),"translate"===n.mode||"scale"===n.mode?("X"===t.name&&.99<Math.abs(C.copy(R).applyQuaternion(r).dot(n.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Y"===t.name&&.99<Math.abs(C.copy(I).applyQuaternion(r).dot(n.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"Z"===t.name&&.99<Math.abs(C.copy(L).applyQuaternion(r).dot(n.eye))&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XY"===t.name&&Math.abs(C.copy(L).applyQuaternion(r).dot(n.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"YZ"===t.name&&Math.abs(C.copy(R).applyQuaternion(r).dot(n.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1),"XZ"===t.name&&Math.abs(C.copy(I).applyQuaternion(r).dot(n.eye))<.2&&(t.scale.set(1e-10,1e-10,1e-10),t.visible=!1)):"rotate"===n.mode&&(_.copy(r),C.copy(n.eye).applyQuaternion(g.copy(r).invert()),-1!==t.name.search("E")&&t.quaternion.setFromRotationMatrix(T.lookAt(n.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(L,Math.atan2(C.y,C.x)),g.multiplyQuaternions(_,g),t.quaternion.copy(g))),t.visible=t.visible&&(-1===t.name.indexOf("X")||n.showX),t.visible=t.visible&&(-1===t.name.indexOf("Y")||n.showY),t.visible=t.visible&&(-1===t.name.indexOf("Z")||n.showZ),t.visible=t.visible&&(-1===t.name.indexOf("E")||n.showX&&n.showY&&n.showZ),t.material._color=t.material._color||t.material.color.clone(),t.material._opacity=t.material._opacity||t.material.opacity,t.material.color.copy(t.material._color),t.material.opacity=t.material._opacity,n.enabled&&n.axis&&(t.name===n.axis||n.axis.split("").some((function(e){return t.name===e})))&&(t.material.color.setHex(16776960),t.material.opacity=1)}(a);l(p(t.prototype),"updateMatrixWorld",this).call(this,e)}}]),t}(),N=(G.prototype.isTransformControlsGizmo=!0,function(){u(t,r.Mesh);var e=h(t);function t(){var n;return a(this,t),(n=e.call(this,new r.PlaneGeometry(1e5,1e5,2,2),new r.MeshBasicMaterial({visible:!1,wireframe:!0,side:r.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1}))).type="TransformControlsPlane",n}return o(t,[{key:"updateMatrixWorld",value:function(e){var n=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(n="local"),k.copy(R).applyQuaternion("local"===n?this.worldQuaternion:D),F.copy(I).applyQuaternion("local"===n?this.worldQuaternion:D),U.copy(L).applyQuaternion("local"===n?this.worldQuaternion:D),C.copy(F),this.mode){case"translate":case"scale":switch(this.axis){case"X":C.copy(this.eye).cross(k),P.copy(k).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(k);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,n)=>{n.d(t,{T:()=>c,w:()=>o});var r=n(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 n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t,n){t&&a(e.prototype,t),n&&a(e,n),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 r.OrthographicCamera(-1,1,1,-1,0,1),u=new r.BufferGeometry,c=(u.setAttribute("position",new r.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),u.setAttribute("uv",new r.Float32BufferAttribute([0,2,0,0,2,0],2)),function(){function e(t){i(this,e),this._mesh=new r.Mesh(u,t)}return 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,n)=>{n.d(t,{T:()=>u});var r=n(881),i=n(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 n,r=l(e);if(n=t?(n=l(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===a(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf: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 n=o(a);function a(e,t){var s;if(this instanceof a)return(s=n.call(this)).textureID=void 0!==t?t:"tDiffuse",e instanceof r.ShaderMaterial?(s.uniforms=e.uniforms,s.material=e):e&&(s.uniforms=r.UniformsUtils.clone(e.uniforms),s.material=new r.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,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil)),this.fsQuad.render(e)}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),a}(i.w)},699:(e,t,n)=>{function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=u(e)););return e}(e,t);if(r)return(r=Object.getOwnPropertyDescriptor(r,t)).get?r.get.call(arguments.length<3?e:n):r.value}).apply(this,arguments)}function l(e,t){return(l=Object.setPrototypeOf||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)}n.d(t,{M:()=>v,j:()=>c});var c=function(e){var t=a;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e);var n=function(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=u(e);if(n=t?(n=u(this).constructor,Reflect.construct(i,arguments,n)):i.apply(this,arguments),i=this,n&&("object"===r(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==i)return i;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}(a);function a(){var e,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return i(this,a),(e=n.call(this)).element=t,e.element.style.position="absolute",e.element.style.userSelect="none",e.element.setAttribute("draggable",!1),e.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),e}return 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=n(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,n,r,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:n}},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,n,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,n,i),s=t.element,/apple/i.test(navigator.vendor)?s.style.transform="translate(-50%,-50%) translate("+Math.round(h.x*r+r)+"px,"+Math.round(-h.y*a+a)+"px)":s.style.transform="translate(-50%,-50%) translate("+(h.x*r+r)+"px,"+(-h.y*a+a)+"px)",s.parentNode!==u&&u.appendChild(s),t.onAfterRender(o,n,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],n,i)}(e,e,t);for(var n=function(e){var t=[];return e.traverse((function(e){e.isCSS2DObject&&t.push(e)})),t}(e).sort((function(e,t){return e.renderOrder!==t.renderOrder?t.renderOrder-e.renderOrder:l.objects.get(e).distanceToCameraSquared-l.objects.get(t).distanceToCameraSquared})),i=n.length,s=0,f=n.length;s<f;s++)n[s].element.style.zIndex=i-s},this.setSize=function(e,i){r=(t=e)/2,a=(n=i)/2,u.style.width=e+"px",u.style.height=i+"px"}}))},693:(e,t,n)=>{n.d(t,{P7:()=>g,cp:()=>v,lX:()=>x});var r=n(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 n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&s(e.prototype,t),n&&s(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(){return(l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(r)return(r=Object.getOwnPropertyDescriptor(r,t)).get?r.get.call(arguments.length<3?e:n):r.value}).apply(this,arguments)}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=d(e);if(n=t?(n=d(this).constructor,Reflect.construct(r,arguments,n)):r.apply(this,arguments),r=this,n&&("object"===i(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");if(void 0!==r)return r;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var p=new r.Vector3,f=new r.Quaternion,m=new r.Vector3,v=function(){u(t,r.Object3D);var e=h(t);function t(){var n,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document.createElement("div");return a(this,t),(n=e.call(this)).element=r,n.element.style.position="absolute",n.element.style.pointerEvents="auto",n.element.style.userSelect="none",n.element.setAttribute("draggable",!1),n.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))})),n}return o(t,[{key:"copy",value:function(e,n){return l(d(t.prototype),"copy",this).call(this,e,n),this.element=e.element.cloneNode(!0),this}}]),t}(),g=(v.prototype.isCSS3DObject=!0,function(){u(t,v);var e=h(t);function t(n){return a(this,t),(n=e.call(this,n)).rotation2D=0,n}return o(t,[{key:"copy",value:function(e,n){return l(d(t.prototype),"copy",this).call(this,e,n),this.rotation2D=e.rotation2D,this}}]),t}()),y=(g.prototype.isCSS3DSprite=!0,new r.Matrix4),b=new r.Matrix4,x=o((function e(){var t,n,r,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:n}},this.render=function(e,t){var n=t.projectionMatrix.elements[5]*i,a=(l.camera.fov!==n&&(u.style.perspective=t.isPerspectiveCamera?n+"px":"",l.camera.fov=n),!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),t.isOrthographicCamera&&(a=-(t.right+t.left)/2,s=(t.top+t.bottom)/2),t.isOrthographicCamera?"scale("+n+")translate("+h(a)+"px,"+h(s)+"px)"+d(t.matrixWorldInverse):"translateZ("+n+"px)"+d(t.matrixWorldInverse)),s=a+"translate("+r+"px,"+i+"px)";l.camera.style!==s&&(c.style.transform=s,l.camera.style=s),function e(t,n,r,i){var a,s,u;t.isCSS3DObject&&(a=!0===t.visible&&!0===t.layers.test(r.layers),t.element.style.display=1==a?"":"none",1==a&&(t.onBeforeRender(o,n,r),a=t.isCSS3DSprite?(y.copy(r.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,n,r)));for(var h=0,d=t.children.length;h<d;h++)e(t.children[h],n,r,i)}(e,e,t,a)},this.setSize=function(e,a){r=(t=e)/2,i=(n=a)/2,u.style.width=e+"px",u.style.height=a+"px",c.style.width=e+"px",c.style.height=a+"px"}}))},608:(e,t,n)=>{n.d(t,{C:()=>r});var r={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 n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};return(()=>{__webpack_require__.d(__webpack_exports__,{default:()=>n});var e=__webpack_require__(624),t=__webpack_require__(868);const n={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__})()));